()
| 432 | } |
| 433 | } |
| 434 | run() { |
| 435 | if (this.hasCreationMain === undefined) { |
| 436 | const builtins = this.getPlatformBuiltins(); |
| 437 | for (let builtin of builtins) { |
| 438 | this.report(builtin.specifier); |
| 439 | for (let manifest of builtin.manifests) { |
| 440 | this.report("\t" + manifest); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | this.builtins = this.mapBuiltins(this.getPlatformBuiltins()); |
| 445 | if (this.hasCreationMain) { |
| 446 | const specifier = "moddable:mc/config"; |
| 447 | this.builtins.set(specifier, { specifier, manifests:[] }); |
| 448 | } |
| 449 | this.importedBuiltinSpecifiers = []; |
| 450 | |
| 451 | this.manifests = new Map(); |
| 452 | this.modules = new Map(); |
| 453 | this.packages = new Map(); |
| 454 | this.queue = []; |
| 455 | let packageURL = this.pathToURL(this.packagePath); |
| 456 | let packageName = null; |
| 457 | let fileURL = null; |
| 458 | this.manifest = { |
| 459 | include: [], |
| 460 | modules: {} |
| 461 | }; |
| 462 | if (this.hasCreationMain) |
| 463 | this.manifest.include.push("$(MODDABLE)/examples/manifest_base.json"); |
| 464 | else |
| 465 | this.require = [ "$(MODDABLE)/examples/manifest_base.json" ]; |
| 466 | try { |
| 467 | let packageJSON = this.READ_PACKAGE_JSON(packageURL); |
| 468 | if (packageJSON == null) |
| 469 | this.throwPackageNotFoundError(); |
| 470 | packageName = packageJSON.name; |
| 471 | if ((packageJSON.exports !== null) & (packageJSON.exports !== undefined)) |
| 472 | fileURL = this.PACKAGE_EXPORTS_RESOLVE(packageURL, ".", packageJSON.exports, defaultConditions); |
| 473 | else if (typeof packageJSON.main === "string") |
| 474 | fileURL = this.mergeURL(packageJSON.main, packageURL + "/package.json"); |
| 475 | if (fileURL) |
| 476 | fileURL = this.ESM_RESOLVE(fileURL, packageURL); |
| 477 | else |
| 478 | this.throwModuleNotFoundError(); |
| 479 | } |
| 480 | catch(e) { |
| 481 | this.reportError(null, 0, e.message); |
| 482 | } |
| 483 | if (this.errorCount == 0) { |
| 484 | let item = { fileURL, packageURL, packageName, specifiers: [] }; |
| 485 | this.modules.set(fileURL, item); |
| 486 | this.queue.push(item); |
| 487 | while (this.queue.length) { |
| 488 | this.parseModule(this.queue.shift()); |
| 489 | } |
| 490 | } |
| 491 | let mainURL = fileURL; |
nothing calls this directly
no test coverage detected