@pubid/pubid 0.1.40 → 0.1.41
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 +25 -0
- package/dist/flavors/register-types.d.ts +76 -0
- package/dist/flavors/register-types.js +78 -0
- package/dist/register-types.d.ts +23 -0
- package/dist/register-types.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,31 @@ ships per flavor where the Ruby reference implements a URN parser
|
|
|
110
110
|
(oiml today; the remaining flavors throw a clear "not yet supported"
|
|
111
111
|
error naming this issue until their ports land).
|
|
112
112
|
|
|
113
|
+
## Worker-safe registration: the pubid-scheme URN codec
|
|
114
|
+
|
|
115
|
+
The package root (and the grammar barrel `dist/flavors/index.js` it
|
|
116
|
+
re-exports) statically reaches `dist/parg/runtime.js`, whose module
|
|
117
|
+
scope walks up to a `package.json` through `node:fs` — impossible in a
|
|
118
|
+
worker bundle. Identifier-type *registration* carries no such
|
|
119
|
+
dependency, so the worker entry composes the per-flavor registration
|
|
120
|
+
manifest (`src/flavors/register-types.ts`) with the codec, and one
|
|
121
|
+
import registers every flavor:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
import { PubidUrn } from "@pubid/pubid/dist/register-types.js";
|
|
125
|
+
|
|
126
|
+
const id = PubidUrn.fromSlug("iso/is/9001/year-2015"); // resolves
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
With the manifest loaded, `PubidUrn.fromSlug` covers all 41 flavors
|
|
130
|
+
that resolve identifier types (nist, ieee and oiml included — the three
|
|
131
|
+
the barrel could not reach from a worker). `grammarImplementation`
|
|
132
|
+
(open-ended parse routing) deliberately stays behind the node-only
|
|
133
|
+
barrel: it cannot load in a worker today. The invariants are pinned by
|
|
134
|
+
`test/register-types.test.ts`: the manifest registers exactly the
|
|
135
|
+
barrel's type set, and no node-only module is reachable from the worker
|
|
136
|
+
entry's import graph.
|
|
137
|
+
|
|
113
138
|
## Development
|
|
114
139
|
|
|
115
140
|
```sh
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identifier-type registration manifest (pubid/pubid-ts#169): the
|
|
3
|
+
* parg-free subset of the flavor graph, as side-effect imports only.
|
|
4
|
+
*
|
|
5
|
+
* Every flavor registers its model classes into the global type
|
|
6
|
+
* registry ({@linkcode import("../model/identifier.js").registerType},
|
|
7
|
+
* the *_TYPE_MAP role) from exactly one of its modules: the model
|
|
8
|
+
* module when the flavor has one, the implementation entry otherwise.
|
|
9
|
+
* The grammar barrel (`./index.js`) reaches the same modules
|
|
10
|
+
* transitively — but it also statically imports the nist, ieee and
|
|
11
|
+
* doi_pfs implementations, which pull `../parg/runtime.js`, whose
|
|
12
|
+
* module scope walks up to a package.json through node:fs. That is
|
|
13
|
+
* impossible in a worker bundle, so a worker cannot import the barrel
|
|
14
|
+
* to populate the registry.
|
|
15
|
+
*
|
|
16
|
+
* This manifest imports the registration modules DIRECTLY, bypassing
|
|
17
|
+
* every parg-tainted path:
|
|
18
|
+
*
|
|
19
|
+
* - model-registrant flavors: `<flavor>/model.js` — pure model
|
|
20
|
+
* declarations, no grammar wiring. (cen_cenelec, csa, gost, bsi and
|
|
21
|
+
* oiml entry modules import the barrel for co-publisher routing, so
|
|
22
|
+
* their model module is the only clean registration path.)
|
|
23
|
+
* - index-registrant flavors: `<flavor>/index.js` — the class lives on
|
|
24
|
+
* the implementation entry; none of these statically reaches the
|
|
25
|
+
* parg runtime (the conformance gate is
|
|
26
|
+
* test/register-types.test.ts's import-graph walk).
|
|
27
|
+
*
|
|
28
|
+
* doi_pfs registers nothing by design ("one scheme, one `_type`, one
|
|
29
|
+
* global resolution" — its canonical tag routes to the coded doi
|
|
30
|
+
* class), so it has no entry here.
|
|
31
|
+
*
|
|
32
|
+
* The worker entry is dist/register-types.js (src/register-types.ts):
|
|
33
|
+
* one import registers every flavor and exposes the pubid-scheme URN
|
|
34
|
+
* codec with no node-only module in the graph.
|
|
35
|
+
*/
|
|
36
|
+
import "./amca/model.js";
|
|
37
|
+
import "./api/model.js";
|
|
38
|
+
import "./ashrae/model.js";
|
|
39
|
+
import "./asme/model.js";
|
|
40
|
+
import "./astm/model.js";
|
|
41
|
+
import "./bsi/model.js";
|
|
42
|
+
import "./cen_cenelec/model.js";
|
|
43
|
+
import "./cie/model.js";
|
|
44
|
+
import "./csa/model.js";
|
|
45
|
+
import "./evs/model.js";
|
|
46
|
+
import "./gost/model.js";
|
|
47
|
+
import "./idf/model.js";
|
|
48
|
+
import "./iec/model.js";
|
|
49
|
+
import "./ieee/model.js";
|
|
50
|
+
import "./iso/model.js";
|
|
51
|
+
import "./itu/model.js";
|
|
52
|
+
import "./nist/model.js";
|
|
53
|
+
import "./oiml/model.js";
|
|
54
|
+
import "./ansi/index.js";
|
|
55
|
+
import "./bipm/index.js";
|
|
56
|
+
import "./calconnect/index.js";
|
|
57
|
+
import "./doi/index.js";
|
|
58
|
+
import "./easc/index.js";
|
|
59
|
+
import "./ecma/index.js";
|
|
60
|
+
import "./etsi/index.js";
|
|
61
|
+
import "./gb/index.js";
|
|
62
|
+
import "./iala/index.js";
|
|
63
|
+
import "./iana/index.js";
|
|
64
|
+
import "./ietf/index.js";
|
|
65
|
+
import "./iho/index.js";
|
|
66
|
+
import "./isbn/index.js";
|
|
67
|
+
import "./jcgm/index.js";
|
|
68
|
+
import "./jis/index.js";
|
|
69
|
+
import "./ogc/index.js";
|
|
70
|
+
import "./oasis/index.js";
|
|
71
|
+
import "./omg/index.js";
|
|
72
|
+
import "./plateau/index.js";
|
|
73
|
+
import "./tgpp/index.js";
|
|
74
|
+
import "./un/index.js";
|
|
75
|
+
import "./w3c/index.js";
|
|
76
|
+
import "./xsf/index.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identifier-type registration manifest (pubid/pubid-ts#169): the
|
|
3
|
+
* parg-free subset of the flavor graph, as side-effect imports only.
|
|
4
|
+
*
|
|
5
|
+
* Every flavor registers its model classes into the global type
|
|
6
|
+
* registry ({@linkcode import("../model/identifier.js").registerType},
|
|
7
|
+
* the *_TYPE_MAP role) from exactly one of its modules: the model
|
|
8
|
+
* module when the flavor has one, the implementation entry otherwise.
|
|
9
|
+
* The grammar barrel (`./index.js`) reaches the same modules
|
|
10
|
+
* transitively — but it also statically imports the nist, ieee and
|
|
11
|
+
* doi_pfs implementations, which pull `../parg/runtime.js`, whose
|
|
12
|
+
* module scope walks up to a package.json through node:fs. That is
|
|
13
|
+
* impossible in a worker bundle, so a worker cannot import the barrel
|
|
14
|
+
* to populate the registry.
|
|
15
|
+
*
|
|
16
|
+
* This manifest imports the registration modules DIRECTLY, bypassing
|
|
17
|
+
* every parg-tainted path:
|
|
18
|
+
*
|
|
19
|
+
* - model-registrant flavors: `<flavor>/model.js` — pure model
|
|
20
|
+
* declarations, no grammar wiring. (cen_cenelec, csa, gost, bsi and
|
|
21
|
+
* oiml entry modules import the barrel for co-publisher routing, so
|
|
22
|
+
* their model module is the only clean registration path.)
|
|
23
|
+
* - index-registrant flavors: `<flavor>/index.js` — the class lives on
|
|
24
|
+
* the implementation entry; none of these statically reaches the
|
|
25
|
+
* parg runtime (the conformance gate is
|
|
26
|
+
* test/register-types.test.ts's import-graph walk).
|
|
27
|
+
*
|
|
28
|
+
* doi_pfs registers nothing by design ("one scheme, one `_type`, one
|
|
29
|
+
* global resolution" — its canonical tag routes to the coded doi
|
|
30
|
+
* class), so it has no entry here.
|
|
31
|
+
*
|
|
32
|
+
* The worker entry is dist/register-types.js (src/register-types.ts):
|
|
33
|
+
* one import registers every flavor and exposes the pubid-scheme URN
|
|
34
|
+
* codec with no node-only module in the graph.
|
|
35
|
+
*/
|
|
36
|
+
// Model-registrant flavors: registration lives in <flavor>/model.js.
|
|
37
|
+
import "./amca/model.js";
|
|
38
|
+
import "./api/model.js";
|
|
39
|
+
import "./ashrae/model.js";
|
|
40
|
+
import "./asme/model.js";
|
|
41
|
+
import "./astm/model.js";
|
|
42
|
+
import "./bsi/model.js";
|
|
43
|
+
import "./cen_cenelec/model.js";
|
|
44
|
+
import "./cie/model.js";
|
|
45
|
+
import "./csa/model.js";
|
|
46
|
+
import "./evs/model.js";
|
|
47
|
+
import "./gost/model.js";
|
|
48
|
+
import "./idf/model.js";
|
|
49
|
+
import "./iec/model.js";
|
|
50
|
+
import "./ieee/model.js";
|
|
51
|
+
import "./iso/model.js";
|
|
52
|
+
import "./itu/model.js";
|
|
53
|
+
import "./nist/model.js";
|
|
54
|
+
import "./oiml/model.js";
|
|
55
|
+
// Index-registrant flavors: registration lives in <flavor>/index.js.
|
|
56
|
+
import "./ansi/index.js";
|
|
57
|
+
import "./bipm/index.js";
|
|
58
|
+
import "./calconnect/index.js";
|
|
59
|
+
import "./doi/index.js";
|
|
60
|
+
import "./easc/index.js";
|
|
61
|
+
import "./ecma/index.js";
|
|
62
|
+
import "./etsi/index.js";
|
|
63
|
+
import "./gb/index.js";
|
|
64
|
+
import "./iala/index.js";
|
|
65
|
+
import "./iana/index.js";
|
|
66
|
+
import "./ietf/index.js";
|
|
67
|
+
import "./iho/index.js";
|
|
68
|
+
import "./isbn/index.js";
|
|
69
|
+
import "./jcgm/index.js";
|
|
70
|
+
import "./jis/index.js";
|
|
71
|
+
import "./ogc/index.js";
|
|
72
|
+
import "./oasis/index.js";
|
|
73
|
+
import "./omg/index.js";
|
|
74
|
+
import "./plateau/index.js";
|
|
75
|
+
import "./tgpp/index.js";
|
|
76
|
+
import "./un/index.js";
|
|
77
|
+
import "./w3c/index.js";
|
|
78
|
+
import "./xsf/index.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The worker-safe entry (pubid/pubid-ts#169): one import registers
|
|
3
|
+
* every flavor's identifier types and exposes the pubid-scheme URN
|
|
4
|
+
* codec — with no node-only module in the import graph.
|
|
5
|
+
*
|
|
6
|
+
* `dist/pubid-urn/index.js` alone decodes nothing on a worker ("unknown
|
|
7
|
+
* identifier type …"), because the type registry lives in
|
|
8
|
+
* {@linkcode import("./model/identifier.js").resolveType} and is
|
|
9
|
+
* populated by importing flavor modules; every existing path to those
|
|
10
|
+
* modules (the grammar barrel `dist/flavors/index.js`, or the root
|
|
11
|
+
* `dist/index.js`) drags `dist/parg/runtime.js`, whose module scope
|
|
12
|
+
* walks up to a package.json through node:fs — impossible in a worker
|
|
13
|
+
* bundle. This entry composes the parg-free registration manifest
|
|
14
|
+
* (./flavors/register-types.js) with the codec, so
|
|
15
|
+
*
|
|
16
|
+
* import { PubidUrn } from "@pubid/pubid/register-types.js";
|
|
17
|
+
*
|
|
18
|
+
* covers every flavor in a worker. The grammar-backed
|
|
19
|
+
* `grammarImplementation` (open-ended parse routing) deliberately stays
|
|
20
|
+
* behind the node-only barrel: it cannot load in a worker today.
|
|
21
|
+
*/
|
|
22
|
+
import "./flavors/register-types.js";
|
|
23
|
+
export * as PubidUrn from "./pubid-urn/index.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The worker-safe entry (pubid/pubid-ts#169): one import registers
|
|
3
|
+
* every flavor's identifier types and exposes the pubid-scheme URN
|
|
4
|
+
* codec — with no node-only module in the import graph.
|
|
5
|
+
*
|
|
6
|
+
* `dist/pubid-urn/index.js` alone decodes nothing on a worker ("unknown
|
|
7
|
+
* identifier type …"), because the type registry lives in
|
|
8
|
+
* {@linkcode import("./model/identifier.js").resolveType} and is
|
|
9
|
+
* populated by importing flavor modules; every existing path to those
|
|
10
|
+
* modules (the grammar barrel `dist/flavors/index.js`, or the root
|
|
11
|
+
* `dist/index.js`) drags `dist/parg/runtime.js`, whose module scope
|
|
12
|
+
* walks up to a package.json through node:fs — impossible in a worker
|
|
13
|
+
* bundle. This entry composes the parg-free registration manifest
|
|
14
|
+
* (./flavors/register-types.js) with the codec, so
|
|
15
|
+
*
|
|
16
|
+
* import { PubidUrn } from "@pubid/pubid/register-types.js";
|
|
17
|
+
*
|
|
18
|
+
* covers every flavor in a worker. The grammar-backed
|
|
19
|
+
* `grammarImplementation` (open-ended parse routing) deliberately stays
|
|
20
|
+
* behind the node-only barrel: it cannot load in a worker today.
|
|
21
|
+
*/
|
|
22
|
+
import "./flavors/register-types.js";
|
|
23
|
+
export * as PubidUrn from "./pubid-urn/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|