@pubid/pubid 0.1.69 → 0.1.71
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 +123 -1
- package/dist/flavors/bsi/index.d.ts +3 -2
- package/dist/flavors/bsi/index.js +43 -42
- package/dist/flavors/bsi/worker.d.ts +3 -0
- package/dist/flavors/bsi/worker.js +18 -0
- package/dist/flavors/cen_cenelec/index.d.ts +3 -2
- package/dist/flavors/cen_cenelec/index.js +14 -8
- package/dist/flavors/cen_cenelec/worker.d.ts +3 -0
- package/dist/flavors/cen_cenelec/worker.js +17 -0
- package/dist/flavors/csa/index.d.ts +2 -1
- package/dist/flavors/csa/index.js +27 -28
- package/dist/flavors/csa/worker.d.ts +3 -0
- package/dist/flavors/csa/worker.js +17 -0
- package/dist/flavors/evs/index.d.ts +2 -1
- package/dist/flavors/evs/index.js +4 -4
- package/dist/flavors/evs/worker.d.ts +3 -0
- package/dist/flavors/evs/worker.js +18 -0
- package/dist/flavors/foreign-resolver.d.ts +6 -0
- package/dist/flavors/foreign-resolver.js +9 -0
- package/dist/flavors/gost/index.d.ts +2 -1
- package/dist/flavors/gost/index.js +19 -20
- package/dist/flavors/gost/worker.d.ts +3 -0
- package/dist/flavors/gost/worker.js +21 -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 +6 -6
- 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/flavors/worker-registry.d.ts +13 -0
- package/dist/flavors/worker-registry.js +120 -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";
|
|
@@ -147,7 +147,7 @@ function grammarImplementationSwitch(flavor) {
|
|
|
147
147
|
case "ieee":
|
|
148
148
|
return ieeeGrammarImplementation();
|
|
149
149
|
case "cen_cenelec":
|
|
150
|
-
return cenCenelecGrammarImplementation();
|
|
150
|
+
return cenCenelecGrammarImplementation(grammarImplementation);
|
|
151
151
|
case "cen_pfs":
|
|
152
152
|
return cenPfsGrammarImplementation();
|
|
153
153
|
case "astm":
|
|
@@ -155,17 +155,17 @@ function grammarImplementationSwitch(flavor) {
|
|
|
155
155
|
case "idf":
|
|
156
156
|
return idfGrammarImplementation();
|
|
157
157
|
case "gost":
|
|
158
|
-
return gostGrammarImplementation();
|
|
158
|
+
return gostGrammarImplementation(grammarImplementation);
|
|
159
159
|
case "evs":
|
|
160
|
-
return evsGrammarImplementation();
|
|
160
|
+
return evsGrammarImplementation(grammarImplementation);
|
|
161
161
|
case "ashrae":
|
|
162
162
|
return ashraeGrammarImplementation();
|
|
163
163
|
case "bsi":
|
|
164
|
-
return bsiGrammarImplementation();
|
|
164
|
+
return bsiGrammarImplementation(grammarImplementation);
|
|
165
165
|
case "bsi_pfs":
|
|
166
166
|
return bsiPfsGrammarImplementation();
|
|
167
167
|
case "csa":
|
|
168
|
-
return csaGrammarImplementation();
|
|
168
|
+
return csaGrammarImplementation(grammarImplementation);
|
|
169
169
|
case "asme":
|
|
170
170
|
return asmeGrammarImplementation();
|
|
171
171
|
case "amca":
|