@yowasp/yosys 0.37.67-dev.638 → 0.37.67-dev.640

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.
@@ -1,3 +1,22 @@
1
+ // node_modules/@yowasp/runtime/lib/fetch.js
2
+ var fetch;
3
+ if (typeof process === "object" && process.release?.name === "node") {
4
+ fetch = async function(url, options) {
5
+ if (url.protocol === "file:") {
6
+ const { readFile } = await import("fs/promises");
7
+ let contentType = "application/octet-stream";
8
+ if (url.pathname.endsWith(".wasm"))
9
+ contentType = "application/wasm";
10
+ return new Response(await readFile(url), { headers: { "Content-Type": contentType } });
11
+ } else {
12
+ return globalThis.fetch(url, options);
13
+ }
14
+ };
15
+ } else {
16
+ fetch = globalThis.fetch;
17
+ }
18
+ var fetch_default = fetch;
19
+
1
20
  // node_modules/@yowasp/runtime/lib/wasi-virt.js
2
21
  var Exit = class extends Error {
3
22
  constructor(code = 0) {
@@ -410,8 +429,37 @@ function lineBuffered(processLine) {
410
429
  };
411
430
  }
412
431
 
413
- // node_modules/@yowasp/runtime/lib/api-base.js
414
- var BaseApplication = class {
432
+ // node_modules/@yowasp/runtime/lib/api.js
433
+ async function fetchObject(obj, fetchFn) {
434
+ const promises = [];
435
+ for (const [key, value] of Object.entries(obj)) {
436
+ if (typeof value === "string" || value instanceof Uint8Array) {
437
+ promises.push(Promise.resolve([key, value]));
438
+ } else if (value instanceof URL) {
439
+ promises.push(fetchFn(value).then((fetched) => [key, fetched]));
440
+ } else {
441
+ promises.push(fetchObject(value, fetchFn).then((fetched) => [key, fetched]));
442
+ }
443
+ }
444
+ for (const [key, value] of await Promise.all(promises))
445
+ obj[key] = value;
446
+ return obj;
447
+ }
448
+ function fetchWebAssembly(url) {
449
+ return fetch_default(url).then(WebAssembly.compileStreaming);
450
+ }
451
+ function fetchUint8Array(url) {
452
+ return fetch_default(url).then((resp) => resp.arrayBuffer()).then((buf) => new Uint8Array(buf));
453
+ }
454
+ function fetchResources({ modules, filesystem }) {
455
+ return Promise.all([
456
+ fetchObject(modules, fetchWebAssembly),
457
+ fetchObject(filesystem, fetchUint8Array)
458
+ ]).then(([modules2, filesystem2]) => {
459
+ return { modules: modules2, filesystem: filesystem2 };
460
+ });
461
+ }
462
+ var Application = class {
415
463
  constructor(resourceFileURL2, instantiate2, argv0) {
416
464
  this.resourceFileURL = resourceFileURL2;
417
465
  this.resources = null;
@@ -421,7 +469,7 @@ var BaseApplication = class {
421
469
  // The `printLine` option is deprecated and not documented but still accepted for compatibility.
422
470
  async run(args = null, files = {}, { stdout, stderr, decodeASCII = true, printLine } = {}) {
423
471
  if (this.resources === null)
424
- this.resources = await this._fetchResources();
472
+ this.resources = await import(this.resourceFileURL).then(fetchResources);
425
473
  if (args === null)
426
474
  return;
427
475
  const environment = new Environment();
@@ -455,44 +503,6 @@ var BaseApplication = class {
455
503
  return files;
456
504
  }
457
505
  }
458
- async _fetchResources() {
459
- const { modules, filesystem } = await import(this.resourceFileURL);
460
- return {
461
- modules: await this._fetchObject(modules, this._fetchWebAssembly),
462
- filesystem: await this._fetchObject(filesystem, this._fetchUint8Array)
463
- };
464
- }
465
- async _fetchObject(obj, fetchFn) {
466
- const promises = [];
467
- for (const [key, value] of Object.entries(obj)) {
468
- if (value instanceof URL) {
469
- promises.push(fetchFn(value).then((fetched) => [key, fetched]));
470
- } else if (typeof value === "string" || value instanceof Uint8Array) {
471
- promises.push(Promise.resolve([key, value]));
472
- } else {
473
- promises.push(this._fetchObject(value, fetchFn).then((fetched) => [key, fetched]));
474
- }
475
- }
476
- for (const [key, value] of await Promise.all(promises))
477
- obj[key] = value;
478
- return obj;
479
- }
480
- async _fetchUint8Array(_url) {
481
- throw "not implemented";
482
- }
483
- async _fetchWebAssembly(_url) {
484
- throw "not implemented";
485
- }
486
- };
487
-
488
- // node_modules/@yowasp/runtime/lib/api-browser.js
489
- var Application = class extends BaseApplication {
490
- _fetchUint8Array(url) {
491
- return fetch(url).then((resp) => resp.arrayBuffer()).then((buf) => new Uint8Array(buf));
492
- }
493
- _fetchWebAssembly(url) {
494
- return fetch(url).then(WebAssembly.compileStreaming);
495
- }
496
506
  };
497
507
 
498
508
  // gen/yosys.js
@@ -1,5 +1,5 @@
1
1
  // **AUTOGENERATED FILE** **DO NOT EDIT**
2
- // Generated by ../yosys-src/techlibs/quicklogic/qlf_k6n10f/generate_bram_types_sim.py at 2024-01-06 17:35:19.527610+00:00
2
+ // Generated by ../yosys-src/techlibs/quicklogic/qlf_k6n10f/generate_bram_types_sim.py at 2024-01-07 03:38:07.613641+00:00
3
3
  `timescale 1ns /10ps
4
4
 
5
5
  module TDP36K_BRAM_A_X1_B_X1_nonsplit (
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yowasp/yosys",
3
- "version": "0.37.67-dev.638",
3
+ "version": "0.37.67-dev.640",
4
4
  "description": "Yosys Open SYnthesis Suite",
5
5
  "author": "Catherine <whitequark@whitequark.org>",
6
6
  "license": "ISC",
@@ -15,26 +15,25 @@
15
15
  "type": "module",
16
16
  "files": [
17
17
  "lib/api.d.ts",
18
- "gen/bundle-*.js",
18
+ "gen/bundle.js",
19
19
  "gen/resources-*.js",
20
20
  "gen/*.wasm",
21
- "gen/share"
21
+ "gen/share/"
22
22
  ],
23
23
  "exports": {
24
- "node": "./gen/bundle-node.js",
25
- "browser": "./gen/bundle-browser.js",
24
+ "default": "./gen/bundle.js",
26
25
  "types": "./lib/api.d.ts"
27
26
  },
28
27
  "types": "./lib/api.d.ts",
29
28
  "devDependencies": {
30
29
  "@bytecodealliance/jco": "0.14.2",
31
- "@yowasp/runtime": "6.0.30",
30
+ "@yowasp/runtime": "6.0.34",
32
31
  "esbuild": "^0.19.8"
33
32
  },
34
33
  "scripts": {
35
- "pack": "yowasp-pack-resources gen/resources-yosys.js gen ../yosys-build/share",
36
34
  "transpile": "jco new ../yosys-build/yosys.wasm --wasi-command --output yosys.wasm && jco transpile yosys.wasm --instantiation async --no-typescript --no-namespaced-exports --map 'wasi:io/*=runtime#io' --map 'wasi:cli/*=runtime#cli' --map 'wasi:clocks/*=runtime#*' --map 'wasi:filesystem/*=runtime#fs' --map 'wasi:random/*=runtime#random' --out-dir gen/",
37
- "build:node": "esbuild --bundle lib/api.js --outfile=gen/bundle-node.js --format=esm --platform=node",
38
- "build:browser": "esbuild --bundle lib/api.js --outfile=gen/bundle-browser.js --format=esm --platform=browser"
35
+ "pack": "yowasp-pack-resources gen/resources-yosys.js gen ../yosys-build/share",
36
+ "build": "esbuild --bundle lib/api.js --outfile=gen/bundle.js --format=esm --platform=node",
37
+ "all": "npm run transpile && npm run pack && npm run build"
39
38
  }
40
39
  }