sbmlsim-core 0.2.0 → 0.4.0

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/README.md CHANGED
@@ -20,7 +20,7 @@ npm install sbmlsim-core
20
20
  or import the modules from a CDN, which serves them with the headers every origin may read:
21
21
 
22
22
  ```js
23
- import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.2.0/panels.mjs";
23
+ import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.4.0/panels.mjs";
24
24
  ```
25
25
 
26
26
  A pool started from a module of another origin starts its workers through a module of the page's own origin, so the CDN works for the workers as well. The engine needs fixed-width SIMD of WebAssembly: Chrome 91, Firefox 89, Safari 16.4 or newer, Node 20 or newer.
@@ -86,7 +86,7 @@ pool.close();
86
86
  <!-- the IIFE build of sbmlsim-web, a release with registerEndpoint -->
87
87
  <script src="sbmlsim-web.iife.js"></script>
88
88
  <script type="module">
89
- import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.2.0/panels.mjs";
89
+ import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.4.0/panels.mjs";
90
90
 
91
91
  sbmlsimWeb.registerEndpoint(
92
92
  "local:glimepiride",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbmlsim-core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Simulate SBML models compiled to WebAssembly in browsers and Node: the JavaScript host of sbmlsim-core with its engine (CVODE, KLU), a pool of workers and the panel endpoint of sbmlsim",
5
5
  "keywords": [
6
6
  "sbml",
@@ -50,6 +50,7 @@
50
50
  ],
51
51
  "scripts": {
52
52
  "test": "node --test test/",
53
+ "build": "node build.mjs",
53
54
  "prepack": "node prepack.mjs"
54
55
  },
55
56
  "engines": {
@@ -58,5 +59,8 @@
58
59
  "publishConfig": {
59
60
  "access": "public",
60
61
  "provenance": true
62
+ },
63
+ "devDependencies": {
64
+ "esbuild": "0.28.2"
61
65
  }
62
66
  }
package/panels.mjs CHANGED
@@ -58,7 +58,7 @@ import { EngineError } from "./loader.mjs";
58
58
  import { createPool, defaultWorkers } from "./pool.mjs";
59
59
 
60
60
  /** The version of sbmlsim-core (`js/package.json`), which the provenance of a run names. */
61
- export const CORE_VERSION = "0.2.0";
61
+ export const CORE_VERSION = "0.4.0";
62
62
 
63
63
  /** The engine a provenance names. */
64
64
  export const ENGINE = `sbmlsim-core ${CORE_VERSION}`;
Binary file
Binary file
package/worker.mjs CHANGED
@@ -93,9 +93,11 @@ if (typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlob
93
93
  globalThis.addEventListener("message", (event) => receive(event.data));
94
94
  } else {
95
95
  // a worker thread of Node: the messages wait in `parentPort` until a listener is added
96
+ // No top-level await, so the inline build (`inline.mjs`) runs this script as a classic worker.
96
97
  const specifier = "node:worker_threads";
97
- const { parentPort } = await import(specifier);
98
- if (!parentPort) throw new Error("worker.mjs runs as a Web Worker or as a worker thread of Node");
99
- post = (message, transfer = []) => parentPort.postMessage(message, transfer);
100
- parentPort.on("message", receive);
98
+ import(specifier).then(({ parentPort }) => {
99
+ if (!parentPort) throw new Error("worker.mjs runs as a Web Worker or as a worker thread of Node");
100
+ post = (message, transfer = []) => parentPort.postMessage(message, transfer);
101
+ parentPort.on("message", receive);
102
+ });
101
103
  }