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

Method getBuiltins

tools/mcpack.js:1008–1056  ·  view source on GitHub ↗
(manifests)

Source from the content-addressed store, hash-verified

1006 return parts.name.startsWith("manifest") && (parts.extension == ".json") && (parts.directory.indexOf("manifests") < 0);
1007 }
1008 getBuiltins(manifests) {
1009 const builtins = [];
1010 for (let manifest of manifests) {
1011 this.currentDirectory = manifest.directory;
1012 this.currentPath = manifest.path;
1013 const result = {};
1014 this.concatProperties(result, manifest.modules, true);
1015 if ("platforms" in manifest) {
1016 let platform = this.matchPlatform(manifest.platforms, this.fullplatform);
1017 if (platform)
1018 this.concatProperties(result, platform.modules, true);
1019 }
1020 var rule = new ModulesRule(this);
1021 this.jsFiles = [];
1022 this.jsFiles.already = {};
1023 this.jsFolders = [];
1024 this.jsFolders.already = {};
1025 this.tsFiles = [];
1026 this.tsFiles.already = {};
1027 this.dtsFiles = [];
1028 this.dtsFiles.already = {};
1029 rule.process(result);
1030
1031 let path = manifest.from.slice(this.moddablePath.length);
1032 if (this.windows)
1033 path = path.replaceAll('\\', '/');
1034 for (let file of this.jsFiles) {
1035 let specifier = file.target.slice(0, -4);
1036 if (this.windows)
1037 specifier = specifier.replaceAll('\\', '/');
1038 let builtin = builtins.find(it => it.specifier == specifier);
1039 if (builtin)
1040 builtin.manifests.push(path);
1041 else
1042 builtins.push({ specifier, manifests:[path] });
1043 }
1044 }
1045 builtins.sort((a, b) => a.specifier.localeCompare(b.specifier));
1046 for (let builtin of builtins) {
1047 let specifier = builtin.specifier;
1048 if (specifier.startsWith("~.embedded/"))
1049 specifier = "embedded:" + specifier.slice(11);
1050 else
1051 specifier = "moddable:" + specifier;
1052 builtin.specifier = specifier
1053 builtin.manifests.sort();
1054 }
1055 return builtins;
1056 }
1057 getPlatformBuiltins() {
1058 const version = this.getToolsVersion();
1059 const platform = this.platform;

Callers 2

runMethod · 0.80
getPlatformBuiltinsMethod · 0.80

Calls 6

findMethod · 0.80
sliceMethod · 0.65
concatPropertiesMethod · 0.45
matchPlatformMethod · 0.45
processMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected