@tpluscode/rdf-ns-builders 2.0.1 → 3.0.0
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 +4 -4
- package/package.json +34 -38
- package/bin/index.d.ts +0 -3
- package/bin/index.d.ts.map +0 -1
- package/bin/index.js +0 -13
- package/bin/index.mjs +0 -5
- package/build/index.d.ts +0 -9
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -46
- package/build/index.mjs +0 -28
- package/build/interface.d.ts +0 -4
- package/build/interface.d.ts.map +0 -1
- package/build/interface.js +0 -44
- package/build/interface.mjs +0 -51
- package/build/modules.d.ts +0 -4
- package/build/modules.d.ts.map +0 -1
- package/build/modules.js +0 -25
- package/build/modules.mjs +0 -22
- package/build/prefix.d.ts +0 -4
- package/build/prefix.d.ts.map +0 -1
- package/build/prefix.js +0 -59
- package/build/prefix.mjs +0 -55
- package/build/strings.d.ts +0 -2
- package/build/strings.d.ts.map +0 -1
- package/build/strings.js +0 -7
- package/build/strings.mjs +0 -3
- package/index.d.ts +0 -91
- package/index.d.ts.map +0 -1
- package/index.js +0 -184
- package/index.mjs +0 -90
- package/loose.d.ts +0 -91
- package/loose.d.ts.map +0 -1
- package/loose.js +0 -184
- package/loose.mjs +0 -90
- package/vocabularies/acl.d.ts +0 -108
- package/vocabularies/acl.d.ts.map +0 -1
- package/vocabularies/acl.js +0 -10
- package/vocabularies/acl.mjs +0 -4
- package/vocabularies/as.d.ts +0 -220
- package/vocabularies/as.d.ts.map +0 -1
- package/vocabularies/as.js +0 -10
- package/vocabularies/as.mjs +0 -4
- package/vocabularies/bibo.d.ts +0 -274
- package/vocabularies/bibo.d.ts.map +0 -1
- package/vocabularies/bibo.js +0 -10
- package/vocabularies/bibo.mjs +0 -4
- package/vocabularies/cc.d.ts +0 -120
- package/vocabularies/cc.d.ts.map +0 -1
- package/vocabularies/cc.js +0 -10
- package/vocabularies/cc.mjs +0 -4
- package/vocabularies/cnt.d.ts +0 -44
- package/vocabularies/cnt.d.ts.map +0 -1
- package/vocabularies/cnt.js +0 -10
- package/vocabularies/cnt.mjs +0 -4
- package/vocabularies/constant.d.ts +0 -664
- package/vocabularies/constant.d.ts.map +0 -1
- package/vocabularies/constant.js +0 -10
- package/vocabularies/constant.mjs +0 -4
- package/vocabularies/csvw.d.ts +0 -189
- package/vocabularies/csvw.d.ts.map +0 -1
- package/vocabularies/csvw.js +0 -10
- package/vocabularies/csvw.mjs +0 -4
- package/vocabularies/ctag.d.ts +0 -8
- package/vocabularies/ctag.d.ts.map +0 -1
- package/vocabularies/ctag.js +0 -10
- package/vocabularies/ctag.mjs +0 -4
- package/vocabularies/dash.d.ts +0 -526
- package/vocabularies/dash.d.ts.map +0 -1
- package/vocabularies/dash.js +0 -10
- package/vocabularies/dash.mjs +0 -4
- package/vocabularies/dbo.d.ts +0 -4560
- package/vocabularies/dbo.d.ts.map +0 -1
- package/vocabularies/dbo.js +0 -10
- package/vocabularies/dbo.mjs +0 -4
- package/vocabularies/dc11.d.ts +0 -38
- package/vocabularies/dc11.d.ts.map +0 -1
- package/vocabularies/dc11.js +0 -10
- package/vocabularies/dc11.mjs +0 -4
- package/vocabularies/dcam.d.ts +0 -16
- package/vocabularies/dcam.d.ts.map +0 -1
- package/vocabularies/dcam.js +0 -10
- package/vocabularies/dcam.mjs +0 -4
- package/vocabularies/dcat.d.ts +0 -76
- package/vocabularies/dcat.d.ts.map +0 -1
- package/vocabularies/dcat.js +0 -10
- package/vocabularies/dcat.mjs +0 -4
- package/vocabularies/dcmitype.d.ts +0 -32
- package/vocabularies/dcmitype.d.ts.map +0 -1
- package/vocabularies/dcmitype.js +0 -10
- package/vocabularies/dcmitype.mjs +0 -4
- package/vocabularies/dcterms.d.ts +0 -205
- package/vocabularies/dcterms.d.ts.map +0 -1
- package/vocabularies/dcterms.js +0 -10
- package/vocabularies/dcterms.mjs +0 -4
- package/vocabularies/discipline.d.ts +0 -143
- package/vocabularies/discipline.d.ts.map +0 -1
- package/vocabularies/discipline.js +0 -10
- package/vocabularies/discipline.mjs +0 -4
- package/vocabularies/doap.d.ts +0 -123
- package/vocabularies/doap.d.ts.map +0 -1
- package/vocabularies/doap.js +0 -10
- package/vocabularies/doap.mjs +0 -4
- package/vocabularies/dpv.d.ts +0 -389
- package/vocabularies/dpv.d.ts.map +0 -1
- package/vocabularies/dpv.js +0 -10
- package/vocabularies/dpv.mjs +0 -4
- package/vocabularies/dqv.d.ts +0 -48
- package/vocabularies/dqv.d.ts.map +0 -1
- package/vocabularies/dqv.js +0 -10
- package/vocabularies/dqv.mjs +0 -4
- package/vocabularies/dtype.d.ts +0 -29
- package/vocabularies/dtype.d.ts.map +0 -1
- package/vocabularies/dtype.js +0 -10
- package/vocabularies/dtype.mjs +0 -4
- package/vocabularies/duv.d.ts +0 -28
- package/vocabularies/duv.d.ts.map +0 -1
- package/vocabularies/duv.js +0 -10
- package/vocabularies/duv.mjs +0 -4
- package/vocabularies/earl.d.ts +0 -66
- package/vocabularies/earl.d.ts.map +0 -1
- package/vocabularies/earl.js +0 -10
- package/vocabularies/earl.mjs +0 -4
- package/vocabularies/ebucore.d.ts +0 -2531
- package/vocabularies/ebucore.d.ts.map +0 -1
- package/vocabularies/ebucore.js +0 -10
- package/vocabularies/ebucore.mjs +0 -4
- package/vocabularies/exif.d.ts +0 -334
- package/vocabularies/exif.d.ts.map +0 -1
- package/vocabularies/exif.js +0 -10
- package/vocabularies/exif.mjs +0 -4
- package/vocabularies/foaf.d.ts +0 -158
- package/vocabularies/foaf.d.ts.map +0 -1
- package/vocabularies/foaf.js +0 -10
- package/vocabularies/foaf.mjs +0 -4
- package/vocabularies/frbr.d.ts +0 -223
- package/vocabularies/frbr.d.ts.map +0 -1
- package/vocabularies/frbr.js +0 -10
- package/vocabularies/frbr.mjs +0 -4
- package/vocabularies/geo.d.ts +0 -244
- package/vocabularies/geo.d.ts.map +0 -1
- package/vocabularies/geo.js +0 -10
- package/vocabularies/geo.mjs +0 -4
- package/vocabularies/geof.d.ts +0 -43
- package/vocabularies/geof.d.ts.map +0 -1
- package/vocabularies/geof.js +0 -10
- package/vocabularies/geof.mjs +0 -4
- package/vocabularies/geor.d.ts +0 -32
- package/vocabularies/geor.d.ts.map +0 -1
- package/vocabularies/geor.js +0 -10
- package/vocabularies/geor.mjs +0 -4
- package/vocabularies/gml.d.ts +0 -8
- package/vocabularies/gml.d.ts.map +0 -1
- package/vocabularies/gml.js +0 -10
- package/vocabularies/gml.mjs +0 -4
- package/vocabularies/gn.d.ts +0 -771
- package/vocabularies/gn.d.ts.map +0 -1
- package/vocabularies/gn.js +0 -10
- package/vocabularies/gn.mjs +0 -4
- package/vocabularies/gr.d.ts +0 -897
- package/vocabularies/gr.d.ts.map +0 -1
- package/vocabularies/gr.js +0 -10
- package/vocabularies/gr.mjs +0 -4
- package/vocabularies/grddl.d.ts +0 -64
- package/vocabularies/grddl.d.ts.map +0 -1
- package/vocabularies/grddl.js +0 -10
- package/vocabularies/grddl.mjs +0 -4
- package/vocabularies/gs1.d.ts +0 -2473
- package/vocabularies/gs1.d.ts.map +0 -1
- package/vocabularies/gs1.js +0 -10
- package/vocabularies/gs1.mjs +0 -4
- package/vocabularies/gtfs.d.ts +0 -206
- package/vocabularies/gtfs.d.ts.map +0 -1
- package/vocabularies/gtfs.js +0 -10
- package/vocabularies/gtfs.mjs +0 -4
- package/vocabularies/http.d.ts +0 -86
- package/vocabularies/http.d.ts.map +0 -1
- package/vocabularies/http.js +0 -10
- package/vocabularies/http.mjs +0 -4
- package/vocabularies/hydra.d.ts +0 -143
- package/vocabularies/hydra.d.ts.map +0 -1
- package/vocabularies/hydra.js +0 -10
- package/vocabularies/hydra.mjs +0 -4
- package/vocabularies/ical.d.ts +0 -179
- package/vocabularies/ical.d.ts.map +0 -1
- package/vocabularies/ical.js +0 -10
- package/vocabularies/ical.mjs +0 -4
- package/vocabularies/ldp.d.ts +0 -66
- package/vocabularies/ldp.d.ts.map +0 -1
- package/vocabularies/ldp.js +0 -10
- package/vocabularies/ldp.mjs +0 -4
- package/vocabularies/locn.d.ts +0 -55
- package/vocabularies/locn.d.ts.map +0 -1
- package/vocabularies/locn.js +0 -10
- package/vocabularies/locn.mjs +0 -4
- package/vocabularies/lvont.d.ts +0 -122
- package/vocabularies/lvont.d.ts.map +0 -1
- package/vocabularies/lvont.js +0 -10
- package/vocabularies/lvont.mjs +0 -4
- package/vocabularies/ma.d.ts +0 -185
- package/vocabularies/ma.d.ts.map +0 -1
- package/vocabularies/ma.js +0 -10
- package/vocabularies/ma.mjs +0 -4
- package/vocabularies/oa.d.ts +0 -149
- package/vocabularies/oa.d.ts.map +0 -1
- package/vocabularies/oa.js +0 -10
- package/vocabularies/oa.mjs +0 -4
- package/vocabularies/og.d.ts +0 -78
- package/vocabularies/og.d.ts.map +0 -1
- package/vocabularies/og.js +0 -10
- package/vocabularies/og.mjs +0 -4
- package/vocabularies/org.d.ts +0 -98
- package/vocabularies/org.d.ts.map +0 -1
- package/vocabularies/org.js +0 -10
- package/vocabularies/org.mjs +0 -4
- package/vocabularies/owl.d.ts +0 -162
- package/vocabularies/owl.d.ts.map +0 -1
- package/vocabularies/owl.js +0 -10
- package/vocabularies/owl.mjs +0 -4
- package/vocabularies/prefix.d.ts +0 -37
- package/vocabularies/prefix.d.ts.map +0 -1
- package/vocabularies/prefix.js +0 -10
- package/vocabularies/prefix.mjs +0 -4
- package/vocabularies/prov.d.ts +0 -286
- package/vocabularies/prov.d.ts.map +0 -1
- package/vocabularies/prov.js +0 -10
- package/vocabularies/prov.mjs +0 -4
- package/vocabularies/qb.d.ts +0 -83
- package/vocabularies/qb.d.ts.map +0 -1
- package/vocabularies/qb.js +0 -10
- package/vocabularies/qb.mjs +0 -4
- package/vocabularies/qkdv.d.ts +0 -205
- package/vocabularies/qkdv.d.ts.map +0 -1
- package/vocabularies/qkdv.js +0 -10
- package/vocabularies/qkdv.mjs +0 -4
- package/vocabularies/quantitykind.d.ts +0 -873
- package/vocabularies/quantitykind.d.ts.map +0 -1
- package/vocabularies/quantitykind.js +0 -10
- package/vocabularies/quantitykind.mjs +0 -4
- package/vocabularies/qudt.d.ts +0 -1084
- package/vocabularies/qudt.d.ts.map +0 -1
- package/vocabularies/qudt.js +0 -10
- package/vocabularies/qudt.mjs +0 -4
- package/vocabularies/qudtv.mjs +0 -2
- package/vocabularies/rdau.d.ts +0 -3128
- package/vocabularies/rdau.d.ts.map +0 -1
- package/vocabularies/rdau.js +0 -10
- package/vocabularies/rdau.mjs +0 -4
- package/vocabularies/rdf.d.ts +0 -52
- package/vocabularies/rdf.d.ts.map +0 -1
- package/vocabularies/rdf.js +0 -10
- package/vocabularies/rdf.mjs +0 -4
- package/vocabularies/rdfa.d.ts +0 -28
- package/vocabularies/rdfa.d.ts.map +0 -1
- package/vocabularies/rdfa.js +0 -10
- package/vocabularies/rdfa.mjs +0 -4
- package/vocabularies/rdfs.d.ts +0 -41
- package/vocabularies/rdfs.d.ts.map +0 -1
- package/vocabularies/rdfs.js +0 -10
- package/vocabularies/rdfs.mjs +0 -4
- package/vocabularies/rev.d.ts +0 -8
- package/vocabularies/rev.d.ts.map +0 -1
- package/vocabularies/rev.js +0 -10
- package/vocabularies/rev.mjs +0 -4
- package/vocabularies/rico.d.ts +0 -2726
- package/vocabularies/rico.d.ts.map +0 -1
- package/vocabularies/rico.js +0 -10
- package/vocabularies/rico.mjs +0 -4
- package/vocabularies/rif.d.ts +0 -8
- package/vocabularies/rif.d.ts.map +0 -1
- package/vocabularies/rif.js +0 -10
- package/vocabularies/rif.mjs +0 -4
- package/vocabularies/rr.d.ts +0 -89
- package/vocabularies/rr.d.ts.map +0 -1
- package/vocabularies/rr.js +0 -10
- package/vocabularies/rr.mjs +0 -4
- package/vocabularies/rss.d.ts +0 -28
- package/vocabularies/rss.d.ts.map +0 -1
- package/vocabularies/rss.js +0 -10
- package/vocabularies/rss.mjs +0 -4
- package/vocabularies/schema.d.ts +0 -6152
- package/vocabularies/schema.d.ts.map +0 -1
- package/vocabularies/schema.js +0 -10
- package/vocabularies/schema.mjs +0 -1
- package/vocabularies/sd.d.ts +0 -84
- package/vocabularies/sd.d.ts.map +0 -1
- package/vocabularies/sd.js +0 -10
- package/vocabularies/sd.mjs +0 -4
- package/vocabularies/sdmx.d.ts +0 -35
- package/vocabularies/sdmx.d.ts.map +0 -1
- package/vocabularies/sdmx.js +0 -10
- package/vocabularies/sdmx.mjs +0 -4
- package/vocabularies/sem.d.ts +0 -89
- package/vocabularies/sem.d.ts.map +0 -1
- package/vocabularies/sem.js +0 -10
- package/vocabularies/sem.mjs +0 -4
- package/vocabularies/sf.d.ts +0 -8
- package/vocabularies/sf.d.ts.map +0 -1
- package/vocabularies/sf.js +0 -10
- package/vocabularies/sf.mjs +0 -4
- package/vocabularies/sh.d.ts +0 -411
- package/vocabularies/sh.d.ts.map +0 -1
- package/vocabularies/sh.js +0 -10
- package/vocabularies/sh.mjs +0 -4
- package/vocabularies/shex.d.ts +0 -144
- package/vocabularies/shex.d.ts.map +0 -1
- package/vocabularies/shex.js +0 -10
- package/vocabularies/shex.mjs +0 -4
- package/vocabularies/sioc.d.ts +0 -204
- package/vocabularies/sioc.d.ts.map +0 -1
- package/vocabularies/sioc.js +0 -10
- package/vocabularies/sioc.mjs +0 -4
- package/vocabularies/skos.d.ts +0 -52
- package/vocabularies/skos.d.ts.map +0 -1
- package/vocabularies/skos.js +0 -10
- package/vocabularies/skos.mjs +0 -4
- package/vocabularies/skosxl.d.ts +0 -18
- package/vocabularies/skosxl.d.ts.map +0 -1
- package/vocabularies/skosxl.js +0 -10
- package/vocabularies/skosxl.mjs +0 -4
- package/vocabularies/sosa.d.ts +0 -80
- package/vocabularies/sosa.d.ts.map +0 -1
- package/vocabularies/sosa.js +0 -10
- package/vocabularies/sosa.mjs +0 -4
- package/vocabularies/sou.d.ts +0 -26
- package/vocabularies/sou.d.ts.map +0 -1
- package/vocabularies/sou.js +0 -10
- package/vocabularies/sou.mjs +0 -4
- package/vocabularies/ssn.d.ts +0 -50
- package/vocabularies/ssn.d.ts.map +0 -1
- package/vocabularies/ssn.js +0 -10
- package/vocabularies/ssn.mjs +0 -4
- package/vocabularies/test.d.ts +0 -41
- package/vocabularies/test.d.ts.map +0 -1
- package/vocabularies/test.js +0 -10
- package/vocabularies/test.mjs +0 -4
- package/vocabularies/time.d.ts +0 -214
- package/vocabularies/time.d.ts.map +0 -1
- package/vocabularies/time.js +0 -10
- package/vocabularies/time.mjs +0 -4
- package/vocabularies/unit.d.ts +0 -1724
- package/vocabularies/unit.d.ts.map +0 -1
- package/vocabularies/unit.js +0 -10
- package/vocabularies/unit.mjs +0 -4
- package/vocabularies/v.d.ts +0 -8
- package/vocabularies/v.d.ts.map +0 -1
- package/vocabularies/v.js +0 -10
- package/vocabularies/v.mjs +0 -4
- package/vocabularies/vaem.d.ts +0 -80
- package/vocabularies/vaem.d.ts.map +0 -1
- package/vocabularies/vaem.js +0 -10
- package/vocabularies/vaem.mjs +0 -4
- package/vocabularies/vann.d.ts +0 -22
- package/vocabularies/vann.d.ts.map +0 -1
- package/vocabularies/vann.js +0 -10
- package/vocabularies/vann.mjs +0 -4
- package/vocabularies/vcard.d.ts +0 -273
- package/vocabularies/vcard.d.ts.map +0 -1
- package/vocabularies/vcard.js +0 -10
- package/vocabularies/vcard.mjs +0 -4
- package/vocabularies/void.d.ts +0 -65
- package/vocabularies/void.d.ts.map +0 -1
- package/vocabularies/void.js +0 -10
- package/vocabularies/void.mjs +0 -4
- package/vocabularies/vs.d.ts +0 -14
- package/vocabularies/vs.d.ts.map +0 -1
- package/vocabularies/vs.js +0 -10
- package/vocabularies/vs.mjs +0 -4
- package/vocabularies/wdr.d.ts +0 -8
- package/vocabularies/wdr.d.ts.map +0 -1
- package/vocabularies/wdr.js +0 -10
- package/vocabularies/wdr.mjs +0 -4
- package/vocabularies/wdrs.d.ts +0 -8
- package/vocabularies/wdrs.d.ts.map +0 -1
- package/vocabularies/wdrs.js +0 -10
- package/vocabularies/wdrs.mjs +0 -4
- package/vocabularies/wgs.d.ts +0 -47
- package/vocabularies/wgs.d.ts.map +0 -1
- package/vocabularies/wgs.js +0 -10
- package/vocabularies/wgs.mjs +0 -4
- package/vocabularies/xhv.d.ts +0 -460
- package/vocabularies/xhv.d.ts.map +0 -1
- package/vocabularies/xhv.js +0 -10
- package/vocabularies/xhv.mjs +0 -4
- package/vocabularies/xkos.d.ts +0 -57
- package/vocabularies/xkos.d.ts.map +0 -1
- package/vocabularies/xkos.js +0 -10
- package/vocabularies/xkos.mjs +0 -4
- package/vocabularies/xml.d.ts +0 -8
- package/vocabularies/xml.d.ts.map +0 -1
- package/vocabularies/xml.js +0 -10
- package/vocabularies/xml.mjs +0 -4
- package/vocabularies/xsd.d.ts +0 -423
- package/vocabularies/xsd.d.ts.map +0 -1
- package/vocabularies/xsd.js +0 -10
- package/vocabularies/xsd.mjs +0 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
> # @tpluscode/rdf-ns-builders
|
|
2
2
|
|
|
3
|
-
Common RDF vocabularies extracted from [`@zazuko/
|
|
3
|
+
Common RDF vocabularies extracted from [`@zazuko/vocabularies`][rdfv] and wrapped
|
|
4
4
|
as [`@rdfjs/namespace`][ns] builder objects.
|
|
5
5
|
|
|
6
6
|
Also includes TypeScript declarations of the terms included in the known
|
|
@@ -19,7 +19,7 @@ npm i -S @tpluscode/rdf-ns-builders
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
-
Simply import a namespace builder by its prefix defined in [`@zazuko/
|
|
22
|
+
Simply import a namespace builder by its prefix defined in [`@zazuko/vocabularies`][rdfv]
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
import { schema } from '@tpluscode/rdf-ns-builders'
|
|
@@ -42,12 +42,12 @@ const schemaPerson: NamedNode = schema.Persona
|
|
|
42
42
|
|
|
43
43
|
## Roll your own
|
|
44
44
|
|
|
45
|
-
Given a package with same exports as `@zazuko/
|
|
45
|
+
Given a package with same exports as `@zazuko/vocabularies`, it is possible to generate a set of namespace builders generated from your own vocabularies.
|
|
46
46
|
|
|
47
47
|
Install required peer dependencies:
|
|
48
48
|
|
|
49
49
|
```
|
|
50
|
-
npm i -D ts-node ts-morph clownface @zazuko/
|
|
50
|
+
npm i -D ts-node ts-morph clownface @zazuko/vocabularies safe-identifier
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
Run the following command to generate builders package by providing the source package name and output directory.
|
package/package.json
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tpluscode/rdf-ns-builders",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Generated RDF/JS namespace builders for common vocabularies",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "index.js",
|
|
6
|
-
"module": "index.
|
|
7
|
-
"browser": "index.
|
|
7
|
+
"module": "index.js",
|
|
8
|
+
"browser": "index.js",
|
|
8
9
|
"types": "index.d.ts",
|
|
9
10
|
"bin": {
|
|
10
11
|
"rdf-ns-builders": "bin/index.js"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
14
|
+
"postinstall": "patch-package",
|
|
15
|
+
"generate": "node --loader ts-node/esm src/bin/index.ts generate -p @zazuko/vocabularies -o src",
|
|
16
|
+
"test": "c8 --reporter=lcov mocha test/index.test.ts",
|
|
15
17
|
"prepack": "npm run build",
|
|
16
|
-
"
|
|
17
|
-
"build
|
|
18
|
-
"build:esm": "babel src --out-dir . --extensions .ts --out-file-extension .mjs",
|
|
18
|
+
"lint": "eslint . --ext .ts --quiet --ignore-path .gitignore --ignore-path .eslintignore",
|
|
19
|
+
"build": "tsc",
|
|
19
20
|
"release": "changeset publish"
|
|
20
21
|
},
|
|
21
22
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
|
|
24
|
-
"import": "./index.mjs"
|
|
25
|
-
},
|
|
26
|
-
"./loose": {
|
|
27
|
-
"require": "./loose.js",
|
|
28
|
-
"import": "./loose.mjs"
|
|
29
|
-
}
|
|
23
|
+
".": "./index.js",
|
|
24
|
+
"./loose": "./loose.js"
|
|
30
25
|
},
|
|
31
26
|
"files": [
|
|
32
27
|
"*.js",
|
|
33
|
-
"*.mjs",
|
|
34
28
|
"bin",
|
|
35
29
|
"build",
|
|
36
30
|
"vocabularies",
|
|
@@ -38,56 +32,55 @@
|
|
|
38
32
|
"*.d.ts.map"
|
|
39
33
|
],
|
|
40
34
|
"dependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
35
|
+
"@rdfjs/data-model": "^2",
|
|
36
|
+
"@rdfjs/namespace": "^2",
|
|
43
37
|
"@rdfjs/types": "*",
|
|
38
|
+
"@types/rdfjs__namespace": "^2.0.2",
|
|
39
|
+
"@zazuko/prefixes": "^1.0.0-rc.0",
|
|
44
40
|
"commander": "^7.2.0",
|
|
45
41
|
"fs-extra": "^10.0.0"
|
|
46
42
|
},
|
|
47
43
|
"peerDependencies": {
|
|
48
|
-
"@zazuko/
|
|
44
|
+
"@zazuko/vocabularies": "^1.0.0-rc.2",
|
|
49
45
|
"clownface": "^1",
|
|
50
46
|
"safe-identifier": "^0.4.2",
|
|
51
47
|
"ts-morph": ">=11",
|
|
52
48
|
"ts-node": ">= 8"
|
|
53
49
|
},
|
|
54
50
|
"devDependencies": {
|
|
55
|
-
"@babel/cli": "^7.10.3",
|
|
56
|
-
"@babel/core": "^7.10.3",
|
|
57
|
-
"@babel/preset-env": "^7.10.3",
|
|
58
|
-
"@babel/preset-typescript": "^7.10.1",
|
|
59
|
-
"@babel/register": "^7.10.4",
|
|
60
51
|
"@changesets/cli": "^2.23.0",
|
|
61
|
-
"@tpluscode/eslint-config": "^0.
|
|
52
|
+
"@tpluscode/eslint-config": "^0.4.2",
|
|
62
53
|
"@types/chai": "^4.2.11",
|
|
63
54
|
"@types/clownface": "^1.5.0",
|
|
64
55
|
"@types/mocha": "^9.1.1",
|
|
65
|
-
"@types/rdf-ext": "^
|
|
66
|
-
"@types/
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
68
|
-
"@typescript-eslint/parser": "^5.
|
|
69
|
-
"@zazuko/
|
|
70
|
-
"babel-plugin-add-import-extension": "^1.3.1",
|
|
56
|
+
"@types/rdf-ext": "^2.0.1",
|
|
57
|
+
"@types/rdfjs__data-model": "^2",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
|
59
|
+
"@typescript-eslint/parser": "^5.55.0",
|
|
60
|
+
"@zazuko/vocabularies": "^1.0.0-rc.2",
|
|
71
61
|
"c8": "^7.11.3",
|
|
72
62
|
"chai": "^4.2.0",
|
|
73
63
|
"clownface": "^1.5.1",
|
|
74
64
|
"eslint": "^8.5.0",
|
|
75
65
|
"eslint-config-standard": "^17.0.0",
|
|
76
|
-
"eslint-import-resolver-typescript": "^
|
|
77
|
-
"eslint-plugin-import": "^2.
|
|
66
|
+
"eslint-import-resolver-typescript": "^3.5.3",
|
|
67
|
+
"eslint-plugin-import": "^2.27.5",
|
|
78
68
|
"eslint-plugin-lit-a11y": "^2.2.0",
|
|
79
|
-
"eslint-plugin-n": "^15.
|
|
69
|
+
"eslint-plugin-n": "^15.6.1",
|
|
80
70
|
"eslint-plugin-node": "^11.1.0",
|
|
81
|
-
"eslint-plugin-promise": "^6.
|
|
71
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
72
|
+
"eslint-plugin-require-extensions": "^0.1.2",
|
|
82
73
|
"husky": "^3.1.0",
|
|
83
74
|
"lint-staged": "^13.0.3",
|
|
84
75
|
"mocha": "^10.0.0",
|
|
85
76
|
"npm-run-all": "^4.1.5",
|
|
77
|
+
"patch-package": "^6.5.1",
|
|
78
|
+
"postinstall-postinstall": "^2.1.0",
|
|
86
79
|
"safe-identifier": "^0.4.2",
|
|
87
80
|
"standard": "^17.0.0",
|
|
88
81
|
"ts-morph": "^15.1.0",
|
|
89
|
-
"ts-node": "^10.
|
|
90
|
-
"typescript": "^4.
|
|
82
|
+
"ts-node": "^10.9.1",
|
|
83
|
+
"typescript": "^4.9.5"
|
|
91
84
|
},
|
|
92
85
|
"publishConfig": {
|
|
93
86
|
"access": "public"
|
|
@@ -111,5 +104,8 @@
|
|
|
111
104
|
"*.{js,ts}": [
|
|
112
105
|
"eslint --fix --quiet"
|
|
113
106
|
]
|
|
107
|
+
},
|
|
108
|
+
"mocha": {
|
|
109
|
+
"loader": "ts-node/esm"
|
|
114
110
|
}
|
|
115
111
|
}
|
package/bin/index.d.ts
DELETED
package/bin/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/bin/index.ts"],"names":[],"mappings":""}
|
package/bin/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commander_1 = __importDefault(require("commander"));
|
|
8
|
-
const build_1 = require("../build");
|
|
9
|
-
commander_1.default.command('generate')
|
|
10
|
-
.requiredOption('-p, --vocabsPackage <vocabsPackage>', 'Name of source package or path to local module (typescript included)')
|
|
11
|
-
.option('-o, --outDir <outDir>', 'Directory in which to create builder modules', 'builders')
|
|
12
|
-
.action(build_1.build);
|
|
13
|
-
commander_1.default.parse(process.argv);
|
package/bin/index.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
import Program from 'commander';
|
|
3
|
-
import { build } from "../build/index.mjs";
|
|
4
|
-
Program.command('generate').requiredOption('-p, --vocabsPackage <vocabsPackage>', 'Name of source package or path to local module (typescript included)').option('-o, --outDir <outDir>', 'Directory in which to create builder modules', 'builders').action(build);
|
|
5
|
-
Program.parse(process.argv);
|
package/build/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as RdfVocabularies from '@zazuko/rdf-vocabularies';
|
|
2
|
-
interface Build {
|
|
3
|
-
outDir: string;
|
|
4
|
-
vocabsPackage: string;
|
|
5
|
-
}
|
|
6
|
-
export declare type ImportedVocabularies = Pick<typeof RdfVocabularies, 'vocabularies' | 'prefixes'>;
|
|
7
|
-
export declare function build({ outDir, vocabsPackage }: Build): Promise<void>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,eAAe,MAAM,0BAA0B,CAAA;AAMhE,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,oBAAY,oBAAoB,GAAG,IAAI,CAAC,OAAO,eAAe,EAAE,cAAc,GAAG,UAAU,CAAC,CAAA;AAE5F,wBAAsB,KAAK,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB3E"}
|
package/build/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.build = void 0;
|
|
27
|
-
const path_1 = require("path");
|
|
28
|
-
const ts_morph_1 = require("ts-morph");
|
|
29
|
-
const prefix_1 = require("./prefix");
|
|
30
|
-
const modules_1 = require("./modules");
|
|
31
|
-
const project = new ts_morph_1.Project();
|
|
32
|
-
async function build({ outDir, vocabsPackage }) {
|
|
33
|
-
const packagePath = vocabsPackage.startsWith('.') ? (0, path_1.resolve)(process.cwd(), vocabsPackage) : vocabsPackage;
|
|
34
|
-
const rdfVocabularies = await Promise.resolve().then(() => __importStar(require(packagePath)));
|
|
35
|
-
const promises = Object.entries(rdfVocabularies.prefixes).map(([prefix, namespace]) => {
|
|
36
|
-
const sourceFile = project.createSourceFile((0, path_1.resolve)(outDir, 'vocabularies', `${prefix}.ts`), undefined, { overwrite: true });
|
|
37
|
-
return (0, prefix_1.createPrefixFile)(sourceFile, prefix, namespace, rdfVocabularies);
|
|
38
|
-
});
|
|
39
|
-
await Promise.all(promises);
|
|
40
|
-
const defaultModule = project.createSourceFile((0, path_1.resolve)(outDir, 'index.ts'), undefined, { overwrite: true });
|
|
41
|
-
(0, modules_1.createDefaultModule)(defaultModule, rdfVocabularies.prefixes);
|
|
42
|
-
const looseModule = project.createSourceFile((0, path_1.resolve)(outDir, 'loose.ts'), undefined, { overwrite: true });
|
|
43
|
-
(0, modules_1.createLooseModule)(looseModule, rdfVocabularies.prefixes);
|
|
44
|
-
await project.save();
|
|
45
|
-
}
|
|
46
|
-
exports.build = build;
|
package/build/index.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
2
|
-
import { Project } from 'ts-morph';
|
|
3
|
-
import { createPrefixFile } from "./prefix.mjs";
|
|
4
|
-
import { createDefaultModule, createLooseModule } from "./modules.mjs";
|
|
5
|
-
const project = new Project();
|
|
6
|
-
export async function build({
|
|
7
|
-
outDir,
|
|
8
|
-
vocabsPackage
|
|
9
|
-
}) {
|
|
10
|
-
const packagePath = vocabsPackage.startsWith('.') ? resolve(process.cwd(), vocabsPackage) : vocabsPackage;
|
|
11
|
-
const rdfVocabularies = await import(packagePath);
|
|
12
|
-
const promises = Object.entries(rdfVocabularies.prefixes).map(([prefix, namespace]) => {
|
|
13
|
-
const sourceFile = project.createSourceFile(resolve(outDir, 'vocabularies', `${prefix}.ts`), undefined, {
|
|
14
|
-
overwrite: true
|
|
15
|
-
});
|
|
16
|
-
return createPrefixFile(sourceFile, prefix, namespace, rdfVocabularies);
|
|
17
|
-
});
|
|
18
|
-
await Promise.all(promises);
|
|
19
|
-
const defaultModule = project.createSourceFile(resolve(outDir, 'index.ts'), undefined, {
|
|
20
|
-
overwrite: true
|
|
21
|
-
});
|
|
22
|
-
createDefaultModule(defaultModule, rdfVocabularies.prefixes);
|
|
23
|
-
const looseModule = project.createSourceFile(resolve(outDir, 'loose.ts'), undefined, {
|
|
24
|
-
overwrite: true
|
|
25
|
-
});
|
|
26
|
-
createLooseModule(looseModule, rdfVocabularies.prefixes);
|
|
27
|
-
await project.save();
|
|
28
|
-
}
|
package/build/interface.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PropertySignatureStructure } from 'ts-morph';
|
|
2
|
-
import { ImportedVocabularies } from './';
|
|
3
|
-
export declare function createMembers(prefix: string, { vocabularies, prefixes }: ImportedVocabularies): Promise<PropertySignatureStructure[]>;
|
|
4
|
-
//# sourceMappingURL=interface.d.ts.map
|
package/build/interface.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/build/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAiB,MAAM,UAAU,CAAA;AAIpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAA;AAkBzC,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAyB3I"}
|
package/build/interface.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createMembers = void 0;
|
|
7
|
-
const ts_morph_1 = require("ts-morph");
|
|
8
|
-
const rdf_vocabularies_1 = require("@zazuko/rdf-vocabularies");
|
|
9
|
-
const clownface_1 = __importDefault(require("clownface"));
|
|
10
|
-
const data_model_1 = require("@rdf-esm/data-model");
|
|
11
|
-
const rdfsComment = (0, data_model_1.namedNode)('http://www.w3.org/2000/01/rdf-schema#comment');
|
|
12
|
-
function createMember(prefixes, prefix, term, comment) {
|
|
13
|
-
const member = {
|
|
14
|
-
name: `"${term}"`,
|
|
15
|
-
kind: ts_morph_1.StructureKind.PropertySignature,
|
|
16
|
-
type: `NamedNode<'${prefixes[prefix]}${term}'>`,
|
|
17
|
-
};
|
|
18
|
-
if (comment) {
|
|
19
|
-
member.docs = [comment];
|
|
20
|
-
}
|
|
21
|
-
return member;
|
|
22
|
-
}
|
|
23
|
-
async function createMembers(prefix, { vocabularies, prefixes }) {
|
|
24
|
-
const prefixedRegex = new RegExp(`^${prefix}:(.+)$`);
|
|
25
|
-
const terms = new Map();
|
|
26
|
-
const dataset = (await vocabularies({ only: [prefix] }))[prefix];
|
|
27
|
-
if (!dataset) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
const graph = (0, clownface_1.default)({ dataset });
|
|
31
|
-
[...graph.in().toArray(), ...graph.out().toArray()]
|
|
32
|
-
.forEach((node) => {
|
|
33
|
-
const prefixedName = (0, rdf_vocabularies_1.shrink)(node.value);
|
|
34
|
-
const matchesPrefix = prefixedName.match(prefixedRegex);
|
|
35
|
-
if (prefixedName && matchesPrefix) {
|
|
36
|
-
const term = matchesPrefix[1];
|
|
37
|
-
if (!terms.has(matchesPrefix[1])) {
|
|
38
|
-
terms.set(term, createMember(prefixes, prefix, term, node.out(rdfsComment).values[0]));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return [...terms.values()].sort();
|
|
43
|
-
}
|
|
44
|
-
exports.createMembers = createMembers;
|
package/build/interface.mjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { StructureKind } from 'ts-morph';
|
|
2
|
-
import { shrink } from '@zazuko/rdf-vocabularies';
|
|
3
|
-
import cf from 'clownface';
|
|
4
|
-
import { namedNode } from '@rdf-esm/data-model';
|
|
5
|
-
const rdfsComment = namedNode('http://www.w3.org/2000/01/rdf-schema#comment');
|
|
6
|
-
|
|
7
|
-
function createMember(prefixes, prefix, term, comment) {
|
|
8
|
-
const member = {
|
|
9
|
-
name: `"${term}"`,
|
|
10
|
-
kind: StructureKind.PropertySignature,
|
|
11
|
-
type: `NamedNode<'${prefixes[prefix]}${term}'>`
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
if (comment) {
|
|
15
|
-
member.docs = [comment];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return member;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function createMembers(prefix, {
|
|
22
|
-
vocabularies,
|
|
23
|
-
prefixes
|
|
24
|
-
}) {
|
|
25
|
-
const prefixedRegex = new RegExp(`^${prefix}:(.+)$`);
|
|
26
|
-
const terms = new Map();
|
|
27
|
-
const dataset = (await vocabularies({
|
|
28
|
-
only: [prefix]
|
|
29
|
-
}))[prefix];
|
|
30
|
-
|
|
31
|
-
if (!dataset) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const graph = cf({
|
|
36
|
-
dataset
|
|
37
|
-
});
|
|
38
|
-
[...graph.in().toArray(), ...graph.out().toArray()].forEach(node => {
|
|
39
|
-
const prefixedName = shrink(node.value);
|
|
40
|
-
const matchesPrefix = prefixedName.match(prefixedRegex);
|
|
41
|
-
|
|
42
|
-
if (prefixedName && matchesPrefix) {
|
|
43
|
-
const term = matchesPrefix[1];
|
|
44
|
-
|
|
45
|
-
if (!terms.has(matchesPrefix[1])) {
|
|
46
|
-
terms.set(term, createMember(prefixes, prefix, term, node.out(rdfsComment).values[0]));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return [...terms.values()].sort();
|
|
51
|
-
}
|
package/build/modules.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SourceFile } from 'ts-morph';
|
|
2
|
-
export declare function createLooseModule(sourceFile: SourceFile, prefixes: Record<string, string>): void;
|
|
3
|
-
export declare function createDefaultModule(sourceFile: SourceFile, prefixes: Record<string, string>): void;
|
|
4
|
-
//# sourceMappingURL=modules.d.ts.map
|
package/build/modules.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/build/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,UAAU,EAAE,MAAM,UAAU,CAAA;AAa/E,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAIhG;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAIlG"}
|
package/build/modules.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDefaultModule = exports.createLooseModule = void 0;
|
|
4
|
-
const safe_identifier_1 = require("safe-identifier");
|
|
5
|
-
function createExport(prefix, exportName) {
|
|
6
|
-
return {
|
|
7
|
-
namedExports: [{
|
|
8
|
-
name: exportName,
|
|
9
|
-
alias: (0, safe_identifier_1.identifier)(prefix),
|
|
10
|
-
}],
|
|
11
|
-
moduleSpecifier: `./vocabularies/${prefix}`,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function createLooseModule(sourceFile, prefixes) {
|
|
15
|
-
Object.keys(prefixes).forEach(prefix => {
|
|
16
|
-
sourceFile.addExportDeclaration(createExport(prefix, 'loose'));
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
exports.createLooseModule = createLooseModule;
|
|
20
|
-
function createDefaultModule(sourceFile, prefixes) {
|
|
21
|
-
Object.keys(prefixes).forEach(prefix => {
|
|
22
|
-
sourceFile.addExportDeclaration(createExport(prefix, 'strict'));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
exports.createDefaultModule = createDefaultModule;
|
package/build/modules.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { identifier } from 'safe-identifier';
|
|
2
|
-
|
|
3
|
-
function createExport(prefix, exportName) {
|
|
4
|
-
return {
|
|
5
|
-
namedExports: [{
|
|
6
|
-
name: exportName,
|
|
7
|
-
alias: identifier(prefix)
|
|
8
|
-
}],
|
|
9
|
-
moduleSpecifier: `./vocabularies/${prefix}`
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function createLooseModule(sourceFile, prefixes) {
|
|
14
|
-
Object.keys(prefixes).forEach(prefix => {
|
|
15
|
-
sourceFile.addExportDeclaration(createExport(prefix, 'loose'));
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export function createDefaultModule(sourceFile, prefixes) {
|
|
19
|
-
Object.keys(prefixes).forEach(prefix => {
|
|
20
|
-
sourceFile.addExportDeclaration(createExport(prefix, 'strict'));
|
|
21
|
-
});
|
|
22
|
-
}
|
package/build/prefix.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SourceFile } from 'ts-morph';
|
|
2
|
-
import type { ImportedVocabularies } from '.';
|
|
3
|
-
export declare function createPrefixFile(sourceFile: SourceFile, prefix: string, namespace: string, vocabs: ImportedVocabularies): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=prefix.d.ts.map
|
package/build/prefix.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../src/build/prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0C,MAAM,UAAU,CAAA;AAI7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAE7C,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,iBAyD7H"}
|
package/build/prefix.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPrefixFile = void 0;
|
|
4
|
-
const ts_morph_1 = require("ts-morph");
|
|
5
|
-
const safe_identifier_1 = require("safe-identifier");
|
|
6
|
-
const interface_1 = require("./interface");
|
|
7
|
-
const strings_1 = require("./strings");
|
|
8
|
-
async function createPrefixFile(sourceFile, prefix, namespace, vocabs) {
|
|
9
|
-
const interfaceName = (0, safe_identifier_1.identifier)((0, strings_1.toProperCase)(prefix));
|
|
10
|
-
sourceFile.addImportDeclaration({
|
|
11
|
-
defaultImport: 'namespace',
|
|
12
|
-
namedImports: [{
|
|
13
|
-
name: 'NamespaceBuilder',
|
|
14
|
-
}],
|
|
15
|
-
moduleSpecifier: '@rdf-esm/namespace',
|
|
16
|
-
});
|
|
17
|
-
sourceFile.addImportDeclaration({
|
|
18
|
-
namedImports: [{
|
|
19
|
-
name: 'NamedNode',
|
|
20
|
-
}],
|
|
21
|
-
moduleSpecifier: '@rdfjs/types',
|
|
22
|
-
});
|
|
23
|
-
const prefixInterface = sourceFile.addInterface({
|
|
24
|
-
name: interfaceName,
|
|
25
|
-
});
|
|
26
|
-
prefixInterface.addMember({
|
|
27
|
-
name: "''",
|
|
28
|
-
kind: ts_morph_1.StructureKind.PropertySignature,
|
|
29
|
-
type: `NamedNode<'${namespace}'>`,
|
|
30
|
-
});
|
|
31
|
-
prefixInterface.addMembers(await (0, interface_1.createMembers)(prefix, vocabs));
|
|
32
|
-
sourceFile.addVariableStatement({
|
|
33
|
-
declarations: [{
|
|
34
|
-
name: 'builder',
|
|
35
|
-
initializer: `namespace("${namespace}")`,
|
|
36
|
-
trailingTrivia: ' as any',
|
|
37
|
-
}],
|
|
38
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
39
|
-
});
|
|
40
|
-
sourceFile.addVariableStatement({
|
|
41
|
-
declarations: [{
|
|
42
|
-
name: 'strict',
|
|
43
|
-
initializer: 'builder',
|
|
44
|
-
trailingTrivia: ` as NamespaceBuilder<keyof ${interfaceName}> & ${interfaceName}`,
|
|
45
|
-
}],
|
|
46
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
47
|
-
isExported: true,
|
|
48
|
-
});
|
|
49
|
-
sourceFile.addVariableStatement({
|
|
50
|
-
declarations: [{
|
|
51
|
-
name: 'loose',
|
|
52
|
-
initializer: 'builder',
|
|
53
|
-
trailingTrivia: ` as NamespaceBuilder & ${interfaceName}`,
|
|
54
|
-
}],
|
|
55
|
-
declarationKind: ts_morph_1.VariableDeclarationKind.Const,
|
|
56
|
-
isExported: true,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
exports.createPrefixFile = createPrefixFile;
|
package/build/prefix.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { StructureKind, VariableDeclarationKind } from 'ts-morph';
|
|
2
|
-
import { identifier } from 'safe-identifier';
|
|
3
|
-
import { createMembers } from "./interface.mjs";
|
|
4
|
-
import { toProperCase } from "./strings.mjs";
|
|
5
|
-
export async function createPrefixFile(sourceFile, prefix, namespace, vocabs) {
|
|
6
|
-
const interfaceName = identifier(toProperCase(prefix));
|
|
7
|
-
sourceFile.addImportDeclaration({
|
|
8
|
-
defaultImport: 'namespace',
|
|
9
|
-
namedImports: [{
|
|
10
|
-
name: 'NamespaceBuilder'
|
|
11
|
-
}],
|
|
12
|
-
moduleSpecifier: '@rdf-esm/namespace'
|
|
13
|
-
});
|
|
14
|
-
sourceFile.addImportDeclaration({
|
|
15
|
-
namedImports: [{
|
|
16
|
-
name: 'NamedNode'
|
|
17
|
-
}],
|
|
18
|
-
moduleSpecifier: '@rdfjs/types'
|
|
19
|
-
});
|
|
20
|
-
const prefixInterface = sourceFile.addInterface({
|
|
21
|
-
name: interfaceName
|
|
22
|
-
});
|
|
23
|
-
prefixInterface.addMember({
|
|
24
|
-
name: "''",
|
|
25
|
-
kind: StructureKind.PropertySignature,
|
|
26
|
-
type: `NamedNode<'${namespace}'>`
|
|
27
|
-
});
|
|
28
|
-
prefixInterface.addMembers(await createMembers(prefix, vocabs));
|
|
29
|
-
sourceFile.addVariableStatement({
|
|
30
|
-
declarations: [{
|
|
31
|
-
name: 'builder',
|
|
32
|
-
initializer: `namespace("${namespace}")`,
|
|
33
|
-
trailingTrivia: ' as any'
|
|
34
|
-
}],
|
|
35
|
-
declarationKind: VariableDeclarationKind.Const
|
|
36
|
-
});
|
|
37
|
-
sourceFile.addVariableStatement({
|
|
38
|
-
declarations: [{
|
|
39
|
-
name: 'strict',
|
|
40
|
-
initializer: 'builder',
|
|
41
|
-
trailingTrivia: ` as NamespaceBuilder<keyof ${interfaceName}> & ${interfaceName}`
|
|
42
|
-
}],
|
|
43
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
44
|
-
isExported: true
|
|
45
|
-
});
|
|
46
|
-
sourceFile.addVariableStatement({
|
|
47
|
-
declarations: [{
|
|
48
|
-
name: 'loose',
|
|
49
|
-
initializer: 'builder',
|
|
50
|
-
trailingTrivia: ` as NamespaceBuilder & ${interfaceName}`
|
|
51
|
-
}],
|
|
52
|
-
declarationKind: VariableDeclarationKind.Const,
|
|
53
|
-
isExported: true
|
|
54
|
-
});
|
|
55
|
-
}
|
package/build/strings.d.ts
DELETED
package/build/strings.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/build/strings.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,UAEvC"}
|
package/build/strings.js
DELETED
package/build/strings.mjs
DELETED