@lde/docgen 0.3.0 → 0.4.1
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/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +8 -5
- package/frames/shacl.frame.jsonld +3 -0
- package/package.json +10 -8
package/dist/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKpD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAe7E"}
|
package/dist/parse.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { rdfDereferencer } from 'rdf-dereference';
|
|
2
2
|
import jsonld from 'jsonld';
|
|
3
|
+
import { rdfSerializer } from 'rdf-serialize';
|
|
4
|
+
import streamToString from 'stream-to-string';
|
|
3
5
|
export async function parseRdfToJsonLd(filePath) {
|
|
4
6
|
const { data } = await rdfDereferencer.dereference(filePath, {
|
|
5
7
|
localFiles: true,
|
|
6
8
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
quads
|
|
10
|
-
}
|
|
11
|
-
|
|
9
|
+
// Convert to n-quads, the only input format that the jsonld library takes.
|
|
10
|
+
const nq = rdfSerializer.serialize(data, {
|
|
11
|
+
contentType: 'application/n-quads',
|
|
12
|
+
});
|
|
13
|
+
const nqString = await streamToString(nq);
|
|
14
|
+
return jsonld.fromRDF(nqString, {
|
|
12
15
|
useNativeTypes: true, // Convert xsd:integer to Number etc.
|
|
13
16
|
});
|
|
14
17
|
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lde/docgen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Generate documentation from SHACL shapes",
|
|
5
|
-
"repository": "github:ldengine/lde",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"shacl",
|
|
8
7
|
"rdf",
|
|
9
8
|
"documentation",
|
|
10
9
|
"generator"
|
|
11
10
|
],
|
|
11
|
+
"repository": "github:ldengine/lde",
|
|
12
12
|
"type": "module",
|
|
13
|
-
"main": "./dist/index.js",
|
|
14
|
-
"module": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
13
|
"exports": {
|
|
17
14
|
"./package.json": "./package.json",
|
|
18
15
|
".": {
|
|
@@ -22,19 +19,24 @@
|
|
|
22
19
|
"default": "./dist/index.js"
|
|
23
20
|
}
|
|
24
21
|
},
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"bin": {
|
|
26
|
+
"docgen": "./dist/cli.js"
|
|
27
|
+
},
|
|
25
28
|
"files": [
|
|
26
29
|
"dist",
|
|
27
30
|
"frames",
|
|
28
31
|
"!**/*.tsbuildinfo"
|
|
29
32
|
],
|
|
30
|
-
"bin": {
|
|
31
|
-
"docgen": "./dist/cli.js"
|
|
32
|
-
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"commander": "^14.0.0",
|
|
35
35
|
"jsonld": "^8.3.3",
|
|
36
36
|
"liquidjs": "^10.21.1",
|
|
37
37
|
"rdf-dereference": "^4.0.0",
|
|
38
|
+
"rdf-serialize": "^4.0.1",
|
|
39
|
+
"stream-to-string": "^1.2.1",
|
|
38
40
|
"tslib": "^2.3.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|