MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / resolveSource

Method resolveSource

tools/mcmanifest.js:3146–3159  ·  view source on GitHub ↗
(sourceIn)

Source from the content-addressed store, hash-verified

3144 return value;
3145 }
3146 resolveSource(sourceIn) {
3147 var source = ("string" == typeof sourceIn) ? sourceIn : sourceIn.source;
3148 var result = this.resolveVariable(source);
3149 var slash = result.lastIndexOf(this.slash);
3150 if (slash < 0)
3151 throw new Error("'" + source + "': path not found!");
3152 var directory = this.resolveDirectoryPath(result.slice(0, slash));
3153 if (!directory)
3154 throw new Error("'" + source + "': directory not found!");
3155 result = directory + result.slice(slash);
3156 if ("string" == typeof sourceIn)
3157 return result;
3158 return {...sourceIn, source: result};
3159 }
3160 resolveVariable(value) {
3161 value = value.replace(/\$\(([^\)]+)\)/g, (offset, value) => {
3162 if (value in this.environment)

Callers 2

concatPropertiesMethod · 0.95
mergePlatformMethod · 0.95

Calls 2

resolveVariableMethod · 0.95
sliceMethod · 0.65

Tested by

no test coverage detected