@pubid/pubid 0.1.68 → 0.1.70
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 +75 -1
- package/dist/flavors/iec/model.d.ts +46 -0
- package/dist/flavors/iec/model.js +224 -0
- package/dist/flavors/ieee/artifact_tree.js +1 -1
- package/dist/flavors/ieee/implementation.d.ts +16 -0
- package/dist/flavors/ieee/implementation.js +2195 -0
- package/dist/flavors/ieee/index.js +18 -2181
- package/dist/flavors/ieee/worker.d.ts +7 -0
- package/dist/flavors/ieee/worker.js +31 -0
- package/dist/flavors/index.js +1 -1
- package/dist/flavors/nist/implementation.d.ts +5 -0
- package/dist/flavors/nist/implementation.js +1326 -0
- package/dist/flavors/nist/index.js +14 -1330
- package/dist/flavors/nist/worker.d.ts +3 -0
- package/dist/flavors/nist/worker.js +24 -0
- package/dist/flavors/oiml/implementation.d.ts +2 -1
- package/dist/flavors/oiml/implementation.js +2 -3
- package/dist/flavors/oiml/index.d.ts +2 -0
- package/dist/flavors/oiml/index.js +10 -0
- package/dist/flavors/oiml/worker.d.ts +2 -0
- package/dist/flavors/oiml/worker.js +14 -0
- package/dist/parg/artifacts/ieee.d.ts +2 -0
- package/dist/parg/artifacts/ieee.js +5 -0
- package/dist/parg/artifacts/nist.d.ts +2 -0
- package/dist/parg/artifacts/nist.js +5 -0
- package/dist/parg/runtime.d.ts +1 -13
- package/dist/parg/runtime.js +4 -36
- package/dist/parg/shape.d.ts +13 -0
- package/dist/parg/shape.js +39 -0
- package/dist/parg/worker.d.ts +9 -0
- package/dist/parg/worker.js +32 -0
- package/dist/register-types.d.ts +7 -1
- package/dist/register-types.js +7 -1
- package/package.json +7 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type WorkerWasmInput } from "../../parg/worker.js";
|
|
2
|
+
import type { FlavorImplementation } from "../../conformance/implementation.js";
|
|
3
|
+
export declare function ieeeWorkerGrammarImplementation(options?: {
|
|
4
|
+
wasm?: WorkerWasmInput;
|
|
5
|
+
/** Override the co-published side resolver (default: iec only). */
|
|
6
|
+
coPublished?: (flavor: string) => FlavorImplementation | undefined;
|
|
7
|
+
}): Promise<FlavorImplementation>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//! The worker entry for the ieee flavor (pubid/pubid-ts#232): the same
|
|
2
|
+
//! implementation the node entry runs, over the bundled artifact and
|
|
3
|
+
//! parsanol's browser engine. No node:* module appears in this graph.
|
|
4
|
+
//! The wasm engine loads lazily — the first
|
|
5
|
+
//! `ieeeWorkerGrammarImplementation()` call pays the ~2.7 MB
|
|
6
|
+
//! fetch/instantiate; the parse calls stay synchronous after the await.
|
|
7
|
+
//!
|
|
8
|
+
//! Co-published routing: the iec side goes through the parg-free iec
|
|
9
|
+
//! implementation (pure parslet, worker-safe). The ansi side has no
|
|
10
|
+
//! worker implementation yet — adopted-standard ids carrying an ANSI
|
|
11
|
+
//! part reject with the same "ANSI implementation unavailable" the node
|
|
12
|
+
//! router produces for an unknown flavor. A consumer that ships an ansi
|
|
13
|
+
//! implementation can inject it via `coPublished`.
|
|
14
|
+
//!
|
|
15
|
+
//! import { ieeeWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/ieee/worker.js";
|
|
16
|
+
//! const ieee = await ieeeWorkerGrammarImplementation(wasmOrUrl);
|
|
17
|
+
//! ieee.parse("IEEE Std 802.3-2022");
|
|
18
|
+
import { workerPargRuntime } from "../../parg/worker.js";
|
|
19
|
+
import { iecGrammarImplementation } from "../iec/index.js";
|
|
20
|
+
import { makeIeeeGrammarImplementation, makeIeeeParseEngine, } from "./implementation.js";
|
|
21
|
+
export async function ieeeWorkerGrammarImplementation(options) {
|
|
22
|
+
const runtime = await workerPargRuntime("ieee", options?.wasm);
|
|
23
|
+
const coPublished = options?.coPublished ??
|
|
24
|
+
((flavor) => (flavor === "iec" ? iecGrammarImplementation() : undefined));
|
|
25
|
+
return makeIeeeGrammarImplementation(makeIeeeParseEngine({
|
|
26
|
+
parseAndBind(input) {
|
|
27
|
+
return runtime.parseAndBind(input);
|
|
28
|
+
},
|
|
29
|
+
coPublished,
|
|
30
|
+
}));
|
|
31
|
+
}
|
package/dist/flavors/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { lookupUrnParser, parseUrnFor } from "../urn/parsers.js";
|
|
2
|
-
import { oimlGrammarImplementation } from "./oiml/
|
|
2
|
+
import { oimlGrammarImplementation } from "./oiml/index.js";
|
|
3
3
|
import { xsfGrammarImplementation } from "./xsf/index.js";
|
|
4
4
|
import { doiGrammarImplementation } from "./doi/index.js";
|
|
5
5
|
import { doiPfsGrammarImplementation } from "./doi_pfs/index.js";
|