@pubid/pubid 0.1.72 → 0.1.74
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 +55 -4
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/api/worker.d.ts +3 -0
- package/dist/flavors/api/worker.js +23 -0
- package/dist/flavors/ashrae/worker.d.ts +3 -0
- package/dist/flavors/ashrae/worker.js +23 -0
- package/dist/flavors/asme/worker.d.ts +3 -0
- package/dist/flavors/asme/worker.js +23 -0
- package/dist/flavors/astm/worker.d.ts +3 -0
- package/dist/flavors/astm/worker.js +23 -0
- package/dist/flavors/calconnect/worker.d.ts +3 -0
- package/dist/flavors/calconnect/worker.js +23 -0
- package/dist/flavors/cie/worker.d.ts +3 -0
- package/dist/flavors/cie/worker.js +23 -0
- package/dist/flavors/easc/worker.d.ts +3 -0
- package/dist/flavors/easc/worker.js +23 -0
- package/dist/flavors/ecma/worker.d.ts +3 -0
- package/dist/flavors/ecma/worker.js +23 -0
- package/dist/flavors/etsi/worker.d.ts +3 -0
- package/dist/flavors/etsi/worker.js +23 -0
- package/dist/flavors/gb/worker.d.ts +3 -0
- package/dist/flavors/gb/worker.js +23 -0
- package/dist/flavors/iala/worker.d.ts +3 -0
- package/dist/flavors/iala/worker.js +23 -0
- package/dist/flavors/iana/worker.d.ts +3 -0
- package/dist/flavors/iana/worker.js +23 -0
- package/dist/flavors/idf/worker.d.ts +3 -0
- package/dist/flavors/idf/worker.js +23 -0
- package/dist/flavors/ieee/model.js +14 -4
- package/dist/flavors/ieee/preprocessor.js +1 -0
- package/dist/flavors/ietf/worker.d.ts +3 -0
- package/dist/flavors/ietf/worker.js +23 -0
- package/dist/flavors/iho/worker.d.ts +3 -0
- package/dist/flavors/iho/worker.js +23 -0
- package/dist/flavors/jcgm/worker.d.ts +3 -0
- package/dist/flavors/jcgm/worker.js +23 -0
- package/dist/flavors/oasis/worker.d.ts +3 -0
- package/dist/flavors/oasis/worker.js +23 -0
- package/dist/flavors/ogc/worker.d.ts +3 -0
- package/dist/flavors/ogc/worker.js +23 -0
- package/dist/flavors/omg/worker.d.ts +3 -0
- package/dist/flavors/omg/worker.js +23 -0
- package/dist/flavors/plateau/worker.d.ts +3 -0
- package/dist/flavors/plateau/worker.js +23 -0
- package/dist/flavors/sae/worker.d.ts +3 -0
- package/dist/flavors/sae/worker.js +23 -0
- package/dist/flavors/tgpp/worker.d.ts +3 -0
- package/dist/flavors/tgpp/worker.js +23 -0
- package/dist/flavors/w3c/worker.d.ts +3 -0
- package/dist/flavors/w3c/worker.js +23 -0
- package/dist/flavors/xsf/worker.d.ts +3 -0
- package/dist/flavors/xsf/worker.js +23 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/lane-keys.d.ts +68 -0
- package/dist/lane-keys.js +113 -0
- package/dist/model/identifier.js +5 -4
- package/dist/parg/artifacts/api.d.ts +2 -0
- package/dist/parg/artifacts/api.js +5 -0
- package/dist/parg/artifacts/ashrae.d.ts +2 -0
- package/dist/parg/artifacts/ashrae.js +5 -0
- package/dist/parg/artifacts/asme.d.ts +2 -0
- package/dist/parg/artifacts/asme.js +5 -0
- package/dist/parg/artifacts/astm.d.ts +2 -0
- package/dist/parg/artifacts/astm.js +5 -0
- package/dist/parg/artifacts/calconnect.d.ts +2 -0
- package/dist/parg/artifacts/calconnect.js +5 -0
- package/dist/parg/artifacts/cie.d.ts +2 -0
- package/dist/parg/artifacts/cie.js +5 -0
- package/dist/parg/artifacts/easc.d.ts +2 -0
- package/dist/parg/artifacts/easc.js +5 -0
- package/dist/parg/artifacts/ecma.d.ts +2 -0
- package/dist/parg/artifacts/ecma.js +5 -0
- package/dist/parg/artifacts/etsi.d.ts +2 -0
- package/dist/parg/artifacts/etsi.js +5 -0
- package/dist/parg/artifacts/gb.d.ts +2 -0
- package/dist/parg/artifacts/gb.js +5 -0
- package/dist/parg/artifacts/iala.d.ts +2 -0
- package/dist/parg/artifacts/iala.js +5 -0
- package/dist/parg/artifacts/iana.d.ts +2 -0
- package/dist/parg/artifacts/iana.js +5 -0
- package/dist/parg/artifacts/idf.d.ts +2 -0
- package/dist/parg/artifacts/idf.js +5 -0
- package/dist/parg/artifacts/ietf.d.ts +2 -0
- package/dist/parg/artifacts/ietf.js +5 -0
- package/dist/parg/artifacts/iho.d.ts +2 -0
- package/dist/parg/artifacts/iho.js +5 -0
- package/dist/parg/artifacts/jcgm.d.ts +2 -0
- package/dist/parg/artifacts/jcgm.js +5 -0
- package/dist/parg/artifacts/oasis.d.ts +2 -0
- package/dist/parg/artifacts/oasis.js +5 -0
- package/dist/parg/artifacts/ogc.d.ts +2 -0
- package/dist/parg/artifacts/ogc.js +5 -0
- package/dist/parg/artifacts/omg.d.ts +2 -0
- package/dist/parg/artifacts/omg.js +5 -0
- package/dist/parg/artifacts/plateau.d.ts +2 -0
- package/dist/parg/artifacts/plateau.js +5 -0
- package/dist/parg/artifacts/sae.d.ts +2 -0
- package/dist/parg/artifacts/sae.js +5 -0
- package/dist/parg/artifacts/tgpp.d.ts +2 -0
- package/dist/parg/artifacts/tgpp.js +5 -0
- package/dist/parg/artifacts/w3c.d.ts +2 -0
- package/dist/parg/artifacts/w3c.js +5 -0
- package/dist/parg/artifacts/xsf.d.ts +2 -0
- package/dist/parg/artifacts/xsf.js +5 -0
- package/dist/parg/worker-engine.d.ts +12 -0
- package/dist/parg/worker-engine.js +32 -0
- package/dist/parg/worker.d.ts +3 -5
- package/dist/parg/worker.js +3 -9
- package/dist/parse-surface.d.ts +3 -31
- package/dist/parse-surface.js +2 -67
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -137,14 +137,32 @@ parseOk("garbage", "iso"); // false — rejections raise ParseError
|
|
|
137
137
|
|
|
138
138
|
The lane keys: `dated` (the norm — the canonical uppercased and
|
|
139
139
|
de-spaced), `undated` (every colon-year not followed by a dash is gone,
|
|
140
|
-
base and supplement alike) and `all_parts` (the parsed part
|
|
141
|
-
structurally only, never
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
base and supplement alike) and `all_parts` (the parsed part, with its
|
|
141
|
+
subpart, stripped — structurally only, never into a longer number, never
|
|
142
|
+
by guessing: `IEC 60601-1-10:2013/AMD1:2016` gives `IEC60601/AMD1`). The
|
|
143
|
+
derivation helpers `norm` / `undatedNorm` / `allPartsNorm` /
|
|
144
|
+
`structuralPart` / `laneKeysFrom` compose into them and are exported
|
|
145
|
+
individually. The flavor must be named: grammar-ported flavors
|
|
144
146
|
parse open-endedly; the rest resolve over the bundled corpus. `parse`
|
|
145
147
|
raises `ParseError` (with `input`, `flavor` and the wrapped engine
|
|
146
148
|
`cause`) on every rejection.
|
|
147
149
|
|
|
150
|
+
### Lane keys in a worker
|
|
151
|
+
|
|
152
|
+
`dist/lane-keys.js` imports nothing, so a Cloudflare Worker with no
|
|
153
|
+
`nodejs_compat` can import it. `laneKeysOf(id)` is
|
|
154
|
+
`laneKeysFrom(id.toHuman(), id.toHash())`: apply it to the identifier
|
|
155
|
+
that a worker flavor entry returns.
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { laneKeysOf } from "@pubid/pubid/dist/lane-keys.js";
|
|
159
|
+
import { iecWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iec/worker.js";
|
|
160
|
+
|
|
161
|
+
laneKeysOf(iecWorkerGrammarImplementation().parse("IEC 60601-1-10:2013/AMD1:2016"));
|
|
162
|
+
// { dated: "IEC60601-1-10:2013/AMD1:2016", undated: "IEC60601-1-10/AMD1",
|
|
163
|
+
// all_parts: "IEC60601/AMD1" }
|
|
164
|
+
```
|
|
165
|
+
|
|
148
166
|
## Worker-safe registration: the pubid-scheme URN codec
|
|
149
167
|
|
|
150
168
|
The package root (and the grammar barrel `dist/flavors/index.js` it
|
|
@@ -291,6 +309,39 @@ walks the compiled import graphs (no `node:*` module, nothing beyond
|
|
|
291
309
|
`parsanol/browser`) and bundles every entry with
|
|
292
310
|
`esbuild --platform=neutral` and no node externals.
|
|
293
311
|
|
|
312
|
+
## Worker-safe parse: the artifact entries (relaton-api-js#188)
|
|
313
|
+
|
|
314
|
+
From 0.1.71, the node entry of each generated-substrate flavor
|
|
315
|
+
(`dist/flavors/<flavor>/index.js`) loads `dist/parg/runtime.js`, which
|
|
316
|
+
uses `node:fs`. These 24 flavors now ship a worker entry
|
|
317
|
+
`dist/flavors/<flavor>/worker.js` on the nist/ieee path:
|
|
318
|
+
|
|
319
|
+
api, ashrae, asme, astm, calconnect, cie, easc, ecma, etsi, gb, iala,
|
|
320
|
+
iana, idf, ietf, iho, jcgm, oasis, ogc, omg, plateau, sae, tgpp, w3c,
|
|
321
|
+
xsf
|
|
322
|
+
|
|
323
|
+
Each entry runs the same baked artifact as the node entry, over
|
|
324
|
+
`parsanol/browser`. It bundles only its own artifact
|
|
325
|
+
(`dist/parg/artifacts/<flavor>.js`, about 90 KB gzip for all 24). The
|
|
326
|
+
entries share one lazy wasm init for each isolate with the nist and
|
|
327
|
+
ieee entries. The factory is async, and `parse()` is synchronous:
|
|
328
|
+
|
|
329
|
+
```ts
|
|
330
|
+
import { ietfWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/ietf/worker.js";
|
|
331
|
+
import { ialaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iala/worker.js";
|
|
332
|
+
|
|
333
|
+
const ietf = await ietfWorkerGrammarImplementation(parsanolWasm);
|
|
334
|
+
const iala = await ialaWorkerGrammarImplementation(parsanolWasm);
|
|
335
|
+
|
|
336
|
+
ietf.parse("RFC 8446");
|
|
337
|
+
iala.parse("IALA G1045 Annex Ed 1");
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The worker result is the node result: `test/worker-artifact-parity.test.ts`
|
|
341
|
+
parses every pinned corpus row through both entries and compares the
|
|
342
|
+
hashes. `workerForeignResolver()` still composes the synchronous
|
|
343
|
+
pure-TS ports of these flavors (`grammar.worker.ts`).
|
|
344
|
+
|
|
294
345
|
## Development
|
|
295
346
|
|
|
296
347
|
```sh
|
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the api flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the api
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { apiWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/api/worker.js";
|
|
10
|
+
//! const api = await apiWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! api.parse("API BULL 1178");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/api.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeApiGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function apiWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeApiGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the ashrae flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the ashrae
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ashraeWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/ashrae/worker.js";
|
|
10
|
+
//! const ashrae = await ashraeWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! ashrae.parse("ASHRAE Standard 140-2007");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/ashrae.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeAshraeGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ashraeWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeAshraeGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the asme flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the asme
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { asmeWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/asme/worker.js";
|
|
10
|
+
//! const asme = await asmeWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! asme.parse("ASME PTB-14-2009");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/asme.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeAsmeGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function asmeWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeAsmeGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the astm flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the astm
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { astmWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/astm/worker.js";
|
|
10
|
+
//! const astm = await astmWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! astm.parse("ADJF3504-EA");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/astm.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeAstmGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function astmWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeAstmGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the calconnect flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the calconnect
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { calconnectWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/calconnect/worker.js";
|
|
10
|
+
//! const calconnect = await calconnectWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! calconnect.parse("CC 11001:2024");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/calconnect.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeCalconnectGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function calconnectWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeCalconnectGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the cie flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the cie
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { cieWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/cie/worker.js";
|
|
10
|
+
//! const cie = await cieWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! cie.parse("CIE 198-SP1.1:2011");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/cie.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeCieGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function cieWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeCieGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the easc flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the easc
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { eascWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/easc/worker.js";
|
|
10
|
+
//! const easc = await eascWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! easc.parse("ПМГ 02-2008");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/easc.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeEascGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function eascWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeEascGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the ecma flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the ecma
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ecmaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/ecma/worker.js";
|
|
10
|
+
//! const ecma = await ecmaWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! ecma.parse("ECMA MEM/1962");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/ecma.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeEcmaGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ecmaWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeEcmaGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the etsi flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the etsi
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { etsiWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/etsi/worker.js";
|
|
10
|
+
//! const etsi = await etsiWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! etsi.parse("ETSI ETR 108/A1 ed.1 (1995-08)");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/etsi.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeEtsiGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function etsiWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeEtsiGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the gb flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the gb
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { gbWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/gb/worker.js";
|
|
10
|
+
//! const gb = await gbWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! gb.parse("GB/T 5606 (all parts)");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/gb.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeGbGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function gbWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeGbGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the iala flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the iala
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ialaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iala/worker.js";
|
|
10
|
+
//! const iala = await ialaWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! iala.parse("IALA G1045 Annex Ed 1");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/iala.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeIalaGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ialaWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeIalaGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the iana flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the iana
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ianaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iana/worker.js";
|
|
10
|
+
//! const iana = await ianaWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! iana.parse("IANA _6lowpan-parameters");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/iana.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeIanaGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ianaWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeIanaGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the idf flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the idf
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { idfWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/idf/worker.js";
|
|
10
|
+
//! const idf = await idfWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! idf.parse("IDF 140-1:2007/AMD 1:2012");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/idf.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeIdfGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function idfWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeIdfGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -896,13 +896,20 @@ function ieeeClass(spec, opts = {}) {
|
|
|
896
896
|
? base
|
|
897
897
|
: base.filter((m) => !opts.wireDelete.keys.includes(m.wire));
|
|
898
898
|
}
|
|
899
|
-
// The
|
|
900
|
-
//
|
|
901
|
-
//
|
|
899
|
+
// The NESTED list: the derived-key deletes are nested-safe since the
|
|
900
|
+
// reference's compact_hash twins (gem#806) — a class carrying
|
|
901
|
+
// nestedWireDelete drops the same keys on the nested path, so the
|
|
902
|
+
// nested base hash matches the top-level wire. Classes without a
|
|
903
|
+
// compact_hash twin (the supplement family, multi-numbered) keep the
|
|
904
|
+
// unfiltered list — the reference's nested transform still emits the
|
|
905
|
+
// derived keys for them.
|
|
902
906
|
static get mappingsNested() {
|
|
903
|
-
|
|
907
|
+
const base = opts.extraMappings === undefined
|
|
904
908
|
? parentMappings()
|
|
905
909
|
: [...parentMappings(), ...opts.extraMappings];
|
|
910
|
+
return opts.nestedWireDelete === undefined
|
|
911
|
+
? base
|
|
912
|
+
: base.filter((m) => !opts.nestedWireDelete.keys.includes(m.wire));
|
|
906
913
|
}
|
|
907
914
|
constructor(attrs = {}) {
|
|
908
915
|
super(attrs);
|
|
@@ -1117,6 +1124,7 @@ export const DualPublishedClass = ieeeClass({ kind: "dual-published" }, {
|
|
|
1117
1124
|
extraDefs: DualDefs,
|
|
1118
1125
|
extraMappings: keyValue(nestedIdWire("first_identifier"), nestedIdWire("second_identifier")),
|
|
1119
1126
|
wireDelete: { keys: ["publisher"] },
|
|
1127
|
+
nestedWireDelete: { keys: ["publisher"] },
|
|
1120
1128
|
render: (id) => `${id["first_identifier"].toHuman()} and ${id["second_identifier"].toHuman()}`,
|
|
1121
1129
|
rootOf: childOf("first_identifier"),
|
|
1122
1130
|
yearForUrnOf: childYearOf("first_identifier"),
|
|
@@ -1148,6 +1156,7 @@ export const AdoptedStandardClass = ieeeClass({ kind: "adopted-standard" }, {
|
|
|
1148
1156
|
},
|
|
1149
1157
|
extraMappings: keyValue(nestedIdWire("ieee_identifier"), nestedIdWire("adopted_identifiers")),
|
|
1150
1158
|
wireDelete: { keys: ["publisher"] },
|
|
1159
|
+
nestedWireDelete: { keys: ["publisher"] },
|
|
1151
1160
|
render: (id) => {
|
|
1152
1161
|
const ieee = id["ieee_identifier"];
|
|
1153
1162
|
let result = ieee.toHuman();
|
|
@@ -1211,6 +1220,7 @@ export const JointDevelopmentClass = ieeeClass({ kind: "joint-development" }, {
|
|
|
1211
1220
|
},
|
|
1212
1221
|
extraMappings: keyValue({ wire: "publishers", to: "publishers" }, { wire: "lead_party", to: "lead_party" }, { wire: "iso_stage", to: "iso_stage" }, { wire: "ieee_draft", to: "ieee_draft" }, { wire: "parenthetical_content", to: "parenthetical_content" }, { wire: "draft_status", to: "draft_status" }),
|
|
1213
1222
|
wireDelete: { keys: ["publisher", "copublisher"] },
|
|
1223
|
+
nestedWireDelete: { keys: ["publisher", "copublisher"] },
|
|
1214
1224
|
render: (id) => {
|
|
1215
1225
|
const publishers = id["publishers"];
|
|
1216
1226
|
const leadParty = id["lead_party"];
|
|
@@ -409,6 +409,7 @@ export function preprocessIeee(input) {
|
|
|
409
409
|
cleaned = cleaned.replace(/(IEC\s+\d+(?:-\d+)?(?::\d{4})?(?:\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})?)\s+(IEEE\s+Std\s+\S+|IEEE\s+\S+)/g, "$1; $2");
|
|
410
410
|
cleaned = cleaned.replace(/^(IEC\s+\d+(?:-\d+)?):\d{4}(\s+(?:First\s+)?[Ee]dition\s+\d+(?:\.\d+)?\s+\d{4}-\d{2})/, "$1$2");
|
|
411
411
|
cleaned = cleaned.replaceAll("™", "");
|
|
412
|
+
cleaned = cleaned.replaceAll("®", "");
|
|
412
413
|
cleaned = cleaned.replace(/\b19969\b/g, "1969");
|
|
413
414
|
cleaned = cleaned.replace(/(\d{4}),(\d{3})/g, "$1, $2");
|
|
414
415
|
cleaned = cleaned.replaceAll("/lNT", "/INT");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the ietf flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the ietf
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ietfWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/ietf/worker.js";
|
|
10
|
+
//! const ietf = await ietfWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! ietf.parse("RFC 8446");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/ietf.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeIetfGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ietfWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeIetfGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the iho flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the iho
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { ihoWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iho/worker.js";
|
|
10
|
+
//! const iho = await ihoWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! iho.parse("IHO B-1 1.0.0");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/iho.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeIhoGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function ihoWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeIhoGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//! The worker entry for the jcgm flavor (relaton-api-js#188): the same
|
|
2
|
+
//! implementation and the same baked artifact the node entry runs, over
|
|
3
|
+
//! parsanol's browser engine instead of the node:fs loader. No node:*
|
|
4
|
+
//! module appears in this graph, and the entry bundles only the jcgm
|
|
5
|
+
//! artifact. The wasm engine loads lazily, once per isolate: the first
|
|
6
|
+
//! worker entry call pays the ~2.7 MB fetch/instantiate; the parse
|
|
7
|
+
//! calls stay synchronous after the await.
|
|
8
|
+
//!
|
|
9
|
+
//! import { jcgmWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/jcgm/worker.js";
|
|
10
|
+
//! const jcgm = await jcgmWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! jcgm.parse("JCGM 100:2008/Amd 1");
|
|
12
|
+
//!
|
|
13
|
+
//! The wasm argument is whatever `parsanol/browser`'s `initialize()`
|
|
14
|
+
//! takes: an R2/CDN URL, a CompiledWasm module (wrangler
|
|
15
|
+
//! `rules = [{ type = "CompiledWasm", ... }]`), or raw bytes.
|
|
16
|
+
import artifact from "../../parg/artifacts/jcgm.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
18
|
+
import * as substrate from "./generated/substrate.js";
|
|
19
|
+
import { makeJcgmGrammarImplementation } from "./implementation.js";
|
|
20
|
+
export async function jcgmWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeJcgmGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
23
|
+
}
|