parsanol 1.5.26 → 1.5.27

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/package.json +7 -2
  3. package/wasm.d.ts +6 -0
package/README.md CHANGED
@@ -104,6 +104,19 @@ synchronous constructor requires initialization first. Pass original artifact
104
104
  and binding JSON text unchanged; parsing and reserializing checksum-bound
105
105
  resources can change their numeric representations.
106
106
 
107
+ A Cloudflare Worker cannot fetch the WASM relative to the module. Import it as
108
+ a WASM module through the `parsanol/wasm` subpath (wrangler/esbuild resolve it
109
+ through the `exports` map) and pass the module to `initialize`:
110
+
111
+ ```ts
112
+ import wasm from "parsanol/wasm";
113
+ import initialize, { PargRuntime } from "parsanol/browser";
114
+ await initialize(wasm);
115
+ const parser = new PargRuntime(artifactJson);
116
+ ```
117
+
118
+ Build scripts can locate the same file with `require.resolve("parsanol/wasm")`.
119
+
107
120
  The browser entry has HTTP `fromURL` instead of Node filesystem helpers. Its
108
121
  `compiledFrom(source)` uses asynchronous WebCrypto: `await` its result. The
109
122
  Node entry retains its synchronous API. Browser-aware package resolution also
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parsanol",
3
- "version": "1.5.26",
3
+ "version": "1.5.27",
4
4
  "description": "PARG artifact runtime for TypeScript \u2014 checksum-verified artifact load, wasm parse, bindings, schema-driven materialization",
5
5
  "type": "module",
6
6
  "main": "dist/runtime.js",
@@ -18,12 +18,17 @@
18
18
  "./browser": {
19
19
  "types": "./dist/browser.d.ts",
20
20
  "default": "./dist/browser.js"
21
+ },
22
+ "./wasm": {
23
+ "types": "./wasm.d.ts",
24
+ "default": "./vendor/parsanol-web/parsanol_bg.wasm"
21
25
  }
22
26
  },
23
27
  "files": [
24
28
  "dist/",
25
29
  "vendor/parsanol-wasm/",
26
- "vendor/parsanol-web/"
30
+ "vendor/parsanol-web/",
31
+ "wasm.d.ts"
27
32
  ],
28
33
  "scripts": {
29
34
  "build": "tsc -p tsconfig.json",
package/wasm.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ // Types for the `parsanol/wasm` subpath: the web-target engine binary.
2
+ // A bundler that imports wasm as a module (wrangler/esbuild in a Cloudflare
3
+ // Worker) gives the compiled module as the default import; pass it to
4
+ // `initialize` from `parsanol/browser`.
5
+ declare const wasm: WebAssembly.Module;
6
+ export default wasm;