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

Method parseManifest

tools/mcpack.js:1170–1210  ·  view source on GitHub ↗
(path, from)

Source from the content-addressed store, hash-verified

1168 }
1169 }
1170 parseManifest(path, from) {
1171 if (this.manifests.already[path])
1172 return;
1173 const parts = this.splitPath(path);
1174 this.currentDirectory = parts.directory;
1175 this.currentPath = path;
1176 const manifest = this.readFileJSON(path);
1177 manifest.directory = parts.directory;
1178 manifest.path = path;
1179 manifest.from = from ?? path;
1180 this.manifests.already[path] = manifest;
1181
1182 this.parseBuild(manifest);
1183 if (manifest.error) {
1184 if ("string" === typeof manifest.error)
1185 manifest.error = [ manifest.error ];
1186 }
1187 else
1188 manifest.error = [];
1189 if (manifest.include) {
1190 if ("string" === typeof manifest.include)
1191 manifest.include = [ manifest.include ];
1192 }
1193 else
1194 manifest.include = [];
1195 if ("platforms" in manifest) {
1196 let platforms = manifest.platforms;
1197 let platform = this.matchPlatform(platforms, this.fullplatform);
1198 if (platform) {
1199 this.parseBuild(platform);
1200 if (platform.error)
1201 manifest.error = manifest.error.concat(platform.error);
1202 if (platform.include)
1203 manifest.include = manifest.include.concat(platform.include);
1204 }
1205 }
1206 if (manifest.error.length == 0) {
1207 manifest.include.forEach(include => this.includeManifest(include, from, manifest.directory));
1208 this.manifests.push(manifest);
1209 }
1210 }
1211 recurseDirectory(folderPath, filter, callback) {
1212 const names = this.enumerateDirectory(folderPath);
1213 for (let name of names) {

Callers 2

getPlatformBuiltinsMethod · 0.45
includeManifestMethod · 0.45

Calls 6

readFileJSONMethod · 0.80
concatMethod · 0.65
parseBuildMethod · 0.45
matchPlatformMethod · 0.45
includeManifestMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected