@yowasp/yosys 0.38.1-dev.650 → 0.38.52-dev.660

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/gen/bundle.js CHANGED
@@ -460,28 +460,28 @@ function fetchResources({ modules, filesystem }) {
460
460
  });
461
461
  }
462
462
  var Application = class {
463
- constructor(resourceFileURL2, instantiate2, argv0) {
464
- this.resourceFileURL = resourceFileURL2;
465
- this.resources = null;
463
+ constructor(resources, instantiate2, argv0) {
464
+ this.resources = resources;
465
+ this.resourceData = null;
466
466
  this.instantiate = instantiate2;
467
467
  this.argv0 = argv0;
468
468
  }
469
469
  // The `printLine` option is deprecated and not documented but still accepted for compatibility.
470
470
  async run(args = null, files = {}, { stdout, stderr, decodeASCII = true, printLine } = {}) {
471
- if (this.resources === null)
472
- this.resources = await import(this.resourceFileURL).then(fetchResources);
471
+ if (this.resourceData === null)
472
+ this.resourceData = await this.resources().then(fetchResources);
473
473
  if (args === null)
474
474
  return;
475
475
  const environment = new Environment();
476
476
  environment.args = [this.argv0].concat(args);
477
477
  environment.root = directoryFromTree(files);
478
- for (const [dirName, dirContents] of Object.entries(this.resources.filesystem))
478
+ for (const [dirName, dirContents] of Object.entries(this.resourceData.filesystem))
479
479
  environment.root.files[dirName] = directoryFromTree(dirContents);
480
480
  const lineBufferedConsole = lineBuffered(printLine ?? console.log);
481
481
  environment.stdout = stdout === void 0 ? lineBufferedConsole : stdout;
482
482
  environment.stderr = stderr === void 0 ? lineBufferedConsole : stderr;
483
483
  const wasmCommand = await this.instantiate(
484
- (filename) => this.resources.modules[filename],
484
+ (filename) => this.resourceData.modules[filename],
485
485
  { runtime: environment.exports }
486
486
  );
487
487
  let error = null;
@@ -493,7 +493,7 @@ var Application = class {
493
493
  if (e instanceof Exit && e.code !== 0)
494
494
  error = e;
495
495
  }
496
- for (const dirName of Object.keys(this.resources.filesystem))
496
+ for (const dirName of Object.keys(this.resourceData.filesystem))
497
497
  delete environment.root.files[dirName];
498
498
  files = directoryIntoTree(environment.root, { decodeASCII });
499
499
  if (error !== null) {
@@ -4640,8 +4640,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4640
4640
  }
4641
4641
 
4642
4642
  // lib/api.js
4643
- var resourceFileURL = new URL("./resources-yosys.js", import.meta.url);
4644
- var yosys = new Application(resourceFileURL, instantiate, "yowasp-yosys");
4643
+ var yosys = new Application(() => import("./resources-yosys.js"), instantiate, "yowasp-yosys");
4645
4644
  var runYosys = yosys.run.bind(yosys);
4646
4645
  var commands = { "yosys": runYosys };
4647
4646
  export {