@pubid/pubid 0.1.74 → 0.1.76
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 +24 -10
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/bipm/worker.js +4 -8
- package/dist/flavors/bsi/worker.js +4 -7
- package/dist/flavors/cen_cenelec/worker.js +4 -7
- package/dist/flavors/csa/worker.js +4 -7
- package/dist/flavors/evs/worker.js +4 -7
- package/dist/flavors/gost/worker.js +4 -7
- package/dist/flavors/iec/worker.js +4 -8
- package/dist/flavors/ieee/worker.js +1 -4
- package/dist/flavors/iso/worker.js +4 -8
- package/dist/flavors/itu/grammar.worker.js +1 -8
- package/dist/flavors/itu/implementation.js +1 -3
- package/dist/flavors/itu/worker.d.ts +2 -1
- package/dist/flavors/itu/worker.js +18 -14
- package/dist/flavors/jis/worker.js +4 -8
- package/dist/flavors/nist/generated/substrate.d.ts +3 -3
- package/dist/flavors/nist/generated/substrate.js +4 -4
- package/dist/flavors/nist/implementation.js +14 -2
- package/dist/flavors/nist/model.js +10 -1
- package/dist/flavors/nist/worker.js +1 -5
- package/dist/flavors/oiml/worker.js +4 -8
- package/dist/flavors/worker-registry.js +68 -67
- package/dist/lane-keys.d.ts +15 -7
- package/dist/lane-keys.js +40 -7
- package/dist/parg/artifacts/itu.d.ts +2 -0
- package/dist/parg/artifacts/itu.js +5 -0
- package/dist/parg/artifacts/nist.d.ts +1 -1
- package/dist/parg/artifacts/nist.js +1 -1
- package/dist/parg/bound.d.ts +9 -0
- package/dist/parg/bound.js +23 -0
- package/dist/parg/worker-engine.d.ts +1 -5
- package/dist/parg/worker-engine.js +1 -11
- package/package.json +2 -2
- package/vendor/parg/nist.json +1 -1
package/README.md
CHANGED
|
@@ -136,11 +136,13 @@ parseOk("garbage", "iso"); // false — rejections raise ParseError
|
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
The lane keys: `dated` (the norm — the canonical uppercased and
|
|
139
|
-
de-spaced), `undated` (every colon-year
|
|
140
|
-
base and supplement alike
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
de-spaced), `undated` (every colon-year and parenthesized date not followed
|
|
140
|
+
by a dash is gone, base and supplement alike, and so is every dash-year
|
|
141
|
+
that the parse marks as a year; the digits of a document number always
|
|
142
|
+
stay: `ISO 19115` gives `ISO19115`, `RFC 2045` gives `RFC2045`) and
|
|
143
|
+
`all_parts` (the parsed part, with its subpart, stripped — structurally
|
|
144
|
+
only, never into a longer number, never by guessing:
|
|
145
|
+
`IEC 60601-1-10:2013/AMD1:2016` gives `IEC60601/AMD1`). The derivation helpers `norm` / `undatedNorm` / `allPartsNorm` /
|
|
144
146
|
`structuralPart` / `laneKeysFrom` compose into them and are exported
|
|
145
147
|
individually. The flavor must be named: grammar-ported flavors
|
|
146
148
|
parse open-endedly; the rest resolve over the bundled corpus. `parse`
|
|
@@ -313,16 +315,21 @@ walks the compiled import graphs (no `node:*` module, nothing beyond
|
|
|
313
315
|
|
|
314
316
|
From 0.1.71, the node entry of each generated-substrate flavor
|
|
315
317
|
(`dist/flavors/<flavor>/index.js`) loads `dist/parg/runtime.js`, which
|
|
316
|
-
uses `node:fs`. These
|
|
318
|
+
uses `node:fs`. These 25 flavors now ship a worker entry
|
|
317
319
|
`dist/flavors/<flavor>/worker.js` on the nist/ieee path:
|
|
318
320
|
|
|
319
321
|
api, ashrae, asme, astm, calconnect, cie, easc, ecma, etsi, gb, iala,
|
|
320
|
-
iana, idf, ietf, iho, jcgm, oasis, ogc, omg, plateau, sae, tgpp,
|
|
321
|
-
xsf
|
|
322
|
+
iana, idf, ietf, iho, itu, jcgm, oasis, ogc, omg, plateau, sae, tgpp,
|
|
323
|
+
w3c, xsf
|
|
324
|
+
|
|
325
|
+
The itu entry was synchronous before, over the pure-TS port, and
|
|
326
|
+
rejected most itu identifiers (for example `ITU-T X.509`). It is now
|
|
327
|
+
async: change `ituWorkerGrammarImplementation()` to
|
|
328
|
+
`await ituWorkerGrammarImplementation(wasm)`.
|
|
322
329
|
|
|
323
330
|
Each entry runs the same baked artifact as the node entry, over
|
|
324
331
|
`parsanol/browser`. It bundles only its own artifact
|
|
325
|
-
(`dist/parg/artifacts/<flavor>.js`, about
|
|
332
|
+
(`dist/parg/artifacts/<flavor>.js`, about 95 KB gzip for all 25). The
|
|
326
333
|
entries share one lazy wasm init for each isolate with the nist and
|
|
327
334
|
ieee entries. The factory is async, and `parse()` is synchronous:
|
|
328
335
|
|
|
@@ -340,7 +347,14 @@ iala.parse("IALA G1045 Annex Ed 1");
|
|
|
340
347
|
The worker result is the node result: `test/worker-artifact-parity.test.ts`
|
|
341
348
|
parses every pinned corpus row through both entries and compares the
|
|
342
349
|
hashes. `workerForeignResolver()` still composes the synchronous
|
|
343
|
-
pure-TS ports of these flavors (`grammar.worker.ts`).
|
|
350
|
+
pure-TS ports of these flavors (`grammar.worker.ts`). The itu port in
|
|
351
|
+
that registry rejects most itu identifiers, so a gost adoption of an
|
|
352
|
+
ITU text does not parse in a worker yet.
|
|
353
|
+
|
|
354
|
+
No worker entry and no registry member registers its engine in the
|
|
355
|
+
shared `generated/substrate.js`. Each one parses through its own
|
|
356
|
+
runtime, so a worker entry and a node entry of one flavor can load in
|
|
357
|
+
the same process (`test/substrate-isolation.test.ts`).
|
|
344
358
|
|
|
345
359
|
## Development
|
|
346
360
|
|
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//! The worker entry for the bipm flavor: the same implementation the
|
|
2
2
|
//! node entry runs — over the pure-TS worker engine
|
|
3
|
-
//! (grammar.worker.ts),
|
|
4
|
-
//! pubid-grammar#164), so the node entry and this one share the delta
|
|
5
|
-
//! byte for byte. Synchronous, no `node:*` module, no wasm.
|
|
3
|
+
//! (grammar.worker.ts). Synchronous, no `node:*` module, no wasm.
|
|
6
4
|
//!
|
|
7
5
|
//! import { bipmWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/bipm/worker.js";
|
|
8
6
|
//! const bipm = bipmWorkerGrammarImplementation();
|
|
@@ -10,10 +8,8 @@
|
|
|
10
8
|
import * as substrate from "./generated/substrate.js";
|
|
11
9
|
import { bipmWorkerRuntime } from "./grammar.worker.js";
|
|
12
10
|
import { makeBipmGrammarImplementation } from "./implementation.js";
|
|
13
|
-
|
|
14
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
15
|
-
// worker graph, where another flavor may register its own).
|
|
11
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
16
12
|
export function bipmWorkerGrammarImplementation() {
|
|
17
|
-
|
|
18
|
-
return makeBipmGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
13
|
+
const runtime = lazyRuntime(bipmWorkerRuntime);
|
|
14
|
+
return makeBipmGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
19
15
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
//! implementation the node entry runs, with the foreign-flavor
|
|
3
3
|
//! resolution (the adopted ISO/IEC/CEN routing) wired to the
|
|
4
4
|
//! worker-safe registry instead of the node barrel. No `node:*` module
|
|
5
|
-
//! appears in this graph and no wasm loads — the
|
|
6
|
-
//! registers as the substrate runtime, so the entry is synchronous
|
|
5
|
+
//! appears in this graph and no wasm loads — the entry is synchronous
|
|
7
6
|
//! (pubid/pubid-grammar#158).
|
|
8
7
|
//!
|
|
9
8
|
//! import { bsiWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/bsi/worker.js";
|
|
@@ -16,10 +15,8 @@ import { workerForeignResolver } from "../worker-registry.js";
|
|
|
16
15
|
import * as substrate from "./generated/substrate.js";
|
|
17
16
|
import { bsiWorkerRuntime } from "./grammar.worker.js";
|
|
18
17
|
import { makeBsiGrammarImplementation } from "./implementation.js";
|
|
19
|
-
|
|
20
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
21
|
-
// worker graph, where another flavor may register its own).
|
|
18
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
22
19
|
export function bsiWorkerGrammarImplementation(foreign) {
|
|
23
|
-
|
|
24
|
-
return makeBsiGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
20
|
+
const runtime = lazyRuntime(bsiWorkerRuntime);
|
|
21
|
+
return makeBsiGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)), foreign ?? workerForeignResolver());
|
|
25
22
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
//! the same implementation the node entry runs, with the adopted
|
|
3
3
|
//! ISO/IEC resolution wired to the worker-safe registry instead of the
|
|
4
4
|
//! node barrel. No `node:*` module appears in this graph and no wasm
|
|
5
|
-
//! loads — the
|
|
6
|
-
//! so the entry is synchronous (pubid/pubid-grammar#158).
|
|
5
|
+
//! loads — the entry is synchronous (pubid/pubid-grammar#158).
|
|
7
6
|
//!
|
|
8
7
|
//! import { cenCenelecWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/cen_cenelec/worker.js";
|
|
9
8
|
//! const cen = cenCenelecWorkerGrammarImplementation();
|
|
@@ -14,10 +13,8 @@ import { workerForeignResolver } from "../worker-registry.js";
|
|
|
14
13
|
import * as substrate from "./generated/substrate.js";
|
|
15
14
|
import { cenCenelecWorkerRuntime } from "./grammar.worker.js";
|
|
16
15
|
import { makeCenCenelecGrammarImplementation } from "./implementation.js";
|
|
17
|
-
|
|
18
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
19
|
-
// worker graph, where another flavor may register its own).
|
|
16
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
20
17
|
export function cenCenelecWorkerGrammarImplementation(foreign) {
|
|
21
|
-
|
|
22
|
-
return makeCenCenelecGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
18
|
+
const runtime = lazyRuntime(cenCenelecWorkerRuntime);
|
|
19
|
+
return makeCenCenelecGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)), foreign ?? workerForeignResolver());
|
|
23
20
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
//! implementation the node entry runs, with the adopted ISO/IEC
|
|
3
3
|
//! resolution wired to the worker-safe registry instead of the node
|
|
4
4
|
//! barrel. No `node:*` module appears in this graph and no wasm loads
|
|
5
|
-
//! — the
|
|
6
|
-
//! the entry is synchronous (pubid/pubid-grammar#158).
|
|
5
|
+
//! — the entry is synchronous (pubid/pubid-grammar#158).
|
|
7
6
|
//!
|
|
8
7
|
//! import { csaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/csa/worker.js";
|
|
9
8
|
//! const csa = csaWorkerGrammarImplementation();
|
|
@@ -14,10 +13,8 @@ import { workerForeignResolver } from "../worker-registry.js";
|
|
|
14
13
|
import * as substrate from "./generated/substrate.js";
|
|
15
14
|
import { csaWorkerRuntime } from "./grammar.worker.js";
|
|
16
15
|
import { makeCsaGrammarImplementation } from "./implementation.js";
|
|
17
|
-
|
|
18
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
19
|
-
// worker graph, where another flavor may register its own).
|
|
16
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
20
17
|
export function csaWorkerGrammarImplementation(foreign) {
|
|
21
|
-
|
|
22
|
-
return makeCsaGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
18
|
+
const runtime = lazyRuntime(csaWorkerRuntime);
|
|
19
|
+
return makeCsaGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)), foreign ?? workerForeignResolver());
|
|
23
20
|
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
//! CEN/CENELEC one for the national adoptions — with the foreign
|
|
4
4
|
//! resolution wired to the worker-safe registry instead of the node
|
|
5
5
|
//! barrel. No `node:*` module appears in this graph and no wasm loads
|
|
6
|
-
//! — the
|
|
7
|
-
//! the entry is synchronous (pubid/pubid-grammar#158).
|
|
6
|
+
//! — the entry is synchronous (pubid/pubid-grammar#158).
|
|
8
7
|
//!
|
|
9
8
|
//! import { evsWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/evs/worker.js";
|
|
10
9
|
//! const evs = evsWorkerGrammarImplementation();
|
|
@@ -15,10 +14,8 @@ import { workerForeignResolver } from "../worker-registry.js";
|
|
|
15
14
|
import * as substrate from "./generated/substrate.js";
|
|
16
15
|
import { evsWorkerRuntime } from "./grammar.worker.js";
|
|
17
16
|
import { makeEvsGrammarImplementation } from "./implementation.js";
|
|
18
|
-
|
|
19
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
20
|
-
// worker graph, where another flavor may register its own).
|
|
17
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
21
18
|
export function evsWorkerGrammarImplementation(foreign) {
|
|
22
|
-
|
|
23
|
-
return makeEvsGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
19
|
+
const runtime = lazyRuntime(evsWorkerRuntime);
|
|
20
|
+
return makeEvsGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)), foreign ?? workerForeignResolver());
|
|
24
21
|
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
//! verbatim captures and routes the adoptions — with the foreign
|
|
4
4
|
//! resolution wired to the worker-safe registry instead of the node
|
|
5
5
|
//! barrel. No `node:*` module appears in this graph and no wasm loads
|
|
6
|
-
//! — the
|
|
7
|
-
//! the entry is synchronous (pubid/pubid-grammar#158).
|
|
6
|
+
//! — the entry is synchronous (pubid/pubid-grammar#158).
|
|
8
7
|
//!
|
|
9
8
|
//! import { gostWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/gost/worker.js";
|
|
10
9
|
//! const gost = gostWorkerGrammarImplementation();
|
|
@@ -19,10 +18,8 @@ import { workerForeignResolver } from "../worker-registry.js";
|
|
|
19
18
|
import * as substrate from "./generated/substrate.js";
|
|
20
19
|
import { gostWorkerRuntime } from "./grammar.worker.js";
|
|
21
20
|
import { makeGostGrammarImplementation } from "./implementation.js";
|
|
22
|
-
|
|
23
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
24
|
-
// worker graph, where another flavor may register its own).
|
|
21
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
25
22
|
export function gostWorkerGrammarImplementation(foreign) {
|
|
26
|
-
|
|
27
|
-
return makeGostGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
23
|
+
const runtime = lazyRuntime(gostWorkerRuntime);
|
|
24
|
+
return makeGostGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)), foreign ?? workerForeignResolver());
|
|
28
25
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//! The worker entry for the iec flavor: the same implementation the
|
|
2
2
|
//! node entry runs - over the pure-TS worker engine
|
|
3
|
-
//! (grammar.worker.ts),
|
|
4
|
-
//! pubid-grammar#164), so the node entry and this one share the delta
|
|
5
|
-
//! byte for byte. Synchronous, no `node:*` module, no wasm.
|
|
3
|
+
//! (grammar.worker.ts). Synchronous, no `node:*` module, no wasm.
|
|
6
4
|
//!
|
|
7
5
|
//! import { iecWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iec/worker.js";
|
|
8
6
|
//! const iec = iecWorkerGrammarImplementation();
|
|
@@ -10,10 +8,8 @@
|
|
|
10
8
|
import * as substrate from "./generated/substrate.js";
|
|
11
9
|
import { iecWorkerRuntime } from "./grammar.worker.js";
|
|
12
10
|
import { makeIecGrammarImplementation } from "./implementation.js";
|
|
13
|
-
|
|
14
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
15
|
-
// worker graph, where another flavor may register its own).
|
|
11
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
16
12
|
export function iecWorkerGrammarImplementation() {
|
|
17
|
-
|
|
18
|
-
return makeIecGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
13
|
+
const runtime = lazyRuntime(iecWorkerRuntime);
|
|
14
|
+
return makeIecGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
19
15
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//! The worker entry for the ieee flavor (pubid/pubid-ts#232): the same
|
|
2
2
|
//! implementation the node entry runs, over the bundled artifact and
|
|
3
|
-
//! parsanol's browser engine
|
|
4
|
-
//! (pubid/pubid-grammar#164), so the checksum-pinned substrate owns the
|
|
5
|
-
//! engine handle on both legs. The named entries (the hand parse
|
|
3
|
+
//! parsanol's browser engine. The named entries (the hand parse
|
|
6
4
|
//! fallbacks' roots: aiee beside the default identifier) load through
|
|
7
5
|
//! the same bundled payload, constructed eagerly so the parse calls
|
|
8
6
|
//! stay synchronous after the await. No node:* module appears in this
|
|
@@ -29,7 +27,6 @@ import { makeIeeeGrammarImplementation, makeIeeeParseEngine, } from "./implement
|
|
|
29
27
|
const NAMED_ENTRIES = substrate.ENTRY_NAMES.filter((entry) => entry !== substrate.ENTRY);
|
|
30
28
|
export async function ieeeWorkerGrammarImplementation(options) {
|
|
31
29
|
const runtime = await workerPargRuntime("ieee", options?.wasm);
|
|
32
|
-
substrate.registerRuntime(() => runtime);
|
|
33
30
|
// The named-entry runtimes construct eagerly (the same wasm init, the
|
|
34
31
|
// same bundled payload) so parseEntry stays synchronous afterwards.
|
|
35
32
|
const namedRuntimes = new Map();
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//! The worker entry for the iso flavor: the same implementation the
|
|
2
2
|
//! node entry runs — over the pure-TS worker engine
|
|
3
|
-
//! (grammar.worker.ts),
|
|
4
|
-
//! pubid-grammar#164), so the node entry and this one share the delta
|
|
5
|
-
//! byte for byte. Synchronous, no `node:*` module, no wasm.
|
|
3
|
+
//! (grammar.worker.ts). Synchronous, no `node:*` module, no wasm.
|
|
6
4
|
//!
|
|
7
5
|
//! import { isoWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/iso/worker.js";
|
|
8
6
|
//! const iso = isoWorkerGrammarImplementation();
|
|
@@ -10,10 +8,8 @@
|
|
|
10
8
|
import * as substrate from "./generated/substrate.js";
|
|
11
9
|
import { isoWorkerRuntime } from "./grammar.worker.js";
|
|
12
10
|
import { makeIsoGrammarImplementation } from "./implementation.js";
|
|
13
|
-
|
|
14
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
15
|
-
// worker graph, where another flavor may register its own).
|
|
11
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
16
12
|
export function isoWorkerGrammarImplementation() {
|
|
17
|
-
|
|
18
|
-
return makeIsoGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
13
|
+
const runtime = lazyRuntime(isoWorkerRuntime);
|
|
14
|
+
return makeIsoGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
19
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//! The itu worker engine (pubid/pubid-ts#236 contract): a pure-TS
|
|
2
2
|
//! transcription of grammars/itu.parg (edition 2) — synchronous, no
|
|
3
|
-
//! `node:*` module, no wasm
|
|
4
|
-
//! artifact runtime's node:fs walk (and the lazy wasm init) cannot run.
|
|
3
|
+
//! `node:*` module, no wasm.
|
|
5
4
|
//! Its captures are the artifact's DECLARED wire (the family walks the
|
|
6
5
|
//! builder reads — base/annex_to/combined bind raw, part arrays through
|
|
7
6
|
//! parts[].part, the presence markers keep their captured tokens), so
|
|
@@ -9,12 +8,6 @@
|
|
|
9
8
|
//! engines, and the codegen differential (pubid-grammar#164's parity
|
|
10
9
|
//! scaffold) pins this engine against the artifact on every corpus row.
|
|
11
10
|
//!
|
|
12
|
-
//! Retirement: this file dies when a worker entry can register the
|
|
13
|
-
//! artifact runtime (the #232 bundled-artifact pattern is async — wasm
|
|
14
|
-
//! init — while the parse API is sync; the gap is a parsanol-ts
|
|
15
|
-
//! follow-up). Until then the differential gate keeps the two engines
|
|
16
|
-
//! locked.
|
|
17
|
-
//!
|
|
18
11
|
//! Edition-2 deviations honored here as in the .parg: every leaf
|
|
19
12
|
//! capture body is spelled at its site (a ref chain inside a capture
|
|
20
13
|
//! breaks the span lowering), the combined-designation tail repeats the
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//! The itu semantic delta over the generated substrate
|
|
2
2
|
//! (pubid/pubid-grammar#164): the builder (the exact dispatch order the
|
|
3
3
|
//! reference pins) and the input normalization peel. Pure — no
|
|
4
|
-
//! `node:*` module, no engine import — so both entries
|
|
5
|
-
//! over the wasm artifact runtime, the worker entry over the pure-TS
|
|
6
|
-
//! worker engine) run the same delta.
|
|
4
|
+
//! `node:*` module, no engine import — so both entries run the same delta.
|
|
7
5
|
//!
|
|
8
6
|
//! The parse function is injected: the entry binds it to
|
|
9
7
|
//! `substrate.boundToWire(substrate.parseBound(body))` (node) or the
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { FlavorImplementation } from "../../conformance/implementation.js";
|
|
2
|
-
|
|
2
|
+
import { type WorkerWasmInput } from "../../parg/worker-engine.js";
|
|
3
|
+
export declare function ituWorkerGrammarImplementation(wasm?: WorkerWasmInput): Promise<FlavorImplementation>;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
//! The worker entry for the itu flavor: the same
|
|
2
|
-
//!
|
|
3
|
-
//!
|
|
4
|
-
//!
|
|
5
|
-
//!
|
|
1
|
+
//! The worker entry for the itu 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 itu
|
|
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.
|
|
6
8
|
//!
|
|
7
9
|
//! import { ituWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/itu/worker.js";
|
|
8
|
-
//! const itu = ituWorkerGrammarImplementation();
|
|
9
|
-
//! itu.parse("ITU-T
|
|
10
|
+
//! const itu = await ituWorkerGrammarImplementation(wasmOrUrl);
|
|
11
|
+
//! itu.parse("ITU-T X.509 (2019)");
|
|
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/itu.js";
|
|
17
|
+
import { parseBoundWith, workerArtifactRuntime } from "../../parg/worker-engine.js";
|
|
10
18
|
import * as substrate from "./generated/substrate.js";
|
|
11
|
-
import { ituWorkerRuntime } from "./grammar.worker.js";
|
|
12
19
|
import { makeItuGrammarImplementation } from "./implementation.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export function ituWorkerGrammarImplementation() {
|
|
17
|
-
substrate.registerRuntime(ituWorkerRuntime);
|
|
18
|
-
return makeItuGrammarImplementation((body) => substrate.boundToWire(substrate.parseBound(body)));
|
|
20
|
+
export async function ituWorkerGrammarImplementation(wasm) {
|
|
21
|
+
const runtime = await workerArtifactRuntime(artifact, wasm, substrate.ENTRY);
|
|
22
|
+
return makeItuGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
19
23
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
//! The worker entry for the jis flavor: the same implementation the
|
|
2
2
|
//! node entry runs - over the pure-TS worker engine
|
|
3
|
-
//! (grammar.worker.ts),
|
|
4
|
-
//! pubid-grammar#164), so the node entry and this one share the delta
|
|
5
|
-
//! byte for byte. Synchronous, no `node:*` module, no wasm.
|
|
3
|
+
//! (grammar.worker.ts). Synchronous, no `node:*` module, no wasm.
|
|
6
4
|
//!
|
|
7
5
|
//! import { jisWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/jis/worker.js";
|
|
8
6
|
//! const jis = jisWorkerGrammarImplementation();
|
|
@@ -10,10 +8,8 @@
|
|
|
10
8
|
import * as substrate from "./generated/substrate.js";
|
|
11
9
|
import { jisWorkerRuntime } from "./grammar.worker.js";
|
|
12
10
|
import { makeJisGrammarImplementation } from "./implementation.js";
|
|
13
|
-
|
|
14
|
-
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
15
|
-
// worker graph, where another flavor may register its own).
|
|
11
|
+
import { lazyRuntime, parseBoundWith } from "../../parg/bound.js";
|
|
16
12
|
export function jisWorkerGrammarImplementation() {
|
|
17
|
-
|
|
18
|
-
return makeJisGrammarImplementation((body) => substrate.boundToWire(substrate.
|
|
13
|
+
const runtime = lazyRuntime(jisWorkerRuntime);
|
|
14
|
+
return makeJisGrammarImplementation((body) => substrate.boundToWire(parseBoundWith(runtime, substrate.FLAVOR, body)));
|
|
19
15
|
}
|