eyeling 1.19.6 → 1.20.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/HANDBOOK.md +39 -3
- package/bin/eyeling.cjs +10 -0
- package/dist/browser/eyeling.browser.js +12796 -0
- package/dist/browser/index.mjs +78 -0
- package/eyeling.js +5 -4
- package/index.d.ts +38 -0
- package/lib/entry.js +2 -0
- package/package.json +25 -2
- package/test/packlist.test.js +16 -3
- package/tools/bundle.js +258 -147
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import './eyeling.browser.js';
|
|
2
|
+
|
|
3
|
+
function getBrowserApi() {
|
|
4
|
+
const api = typeof globalThis !== 'undefined' ? globalThis.eyeling : undefined;
|
|
5
|
+
if (!api) {
|
|
6
|
+
throw new Error(
|
|
7
|
+
'Eyeling browser bundle is not initialized. Import "eyeling/browser" only in a browser or worker runtime.',
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return api;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function reasonStream(input, opts) {
|
|
14
|
+
return getBrowserApi().reasonStream(input, opts);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function reasonRdfJs(input, opts) {
|
|
18
|
+
return getBrowserApi().reasonRdfJs(input, opts);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function registerBuiltin(iri, handler) {
|
|
22
|
+
return getBrowserApi().registerBuiltin(iri, handler);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function unregisterBuiltin(iri) {
|
|
26
|
+
return getBrowserApi().unregisterBuiltin(iri);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function registerBuiltinModule(mod, origin) {
|
|
30
|
+
return getBrowserApi().registerBuiltinModule(mod, origin);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function listBuiltinIris() {
|
|
34
|
+
return getBrowserApi().listBuiltinIris();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function collectOutputStringsFromFacts(facts, prefixes) {
|
|
38
|
+
return getBrowserApi().collectOutputStringsFromFacts(facts, prefixes);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function prettyPrintQueryTriples(triples, prefixes) {
|
|
42
|
+
return getBrowserApi().prettyPrintQueryTriples(triples, prefixes);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const rdfjs = new Proxy(Object.create(null), {
|
|
46
|
+
get(_target, prop) {
|
|
47
|
+
return Reflect.get(getBrowserApi().rdfjs, prop);
|
|
48
|
+
},
|
|
49
|
+
set(_target, prop, value) {
|
|
50
|
+
return Reflect.set(getBrowserApi().rdfjs, prop, value);
|
|
51
|
+
},
|
|
52
|
+
has(_target, prop) {
|
|
53
|
+
return prop in getBrowserApi().rdfjs;
|
|
54
|
+
},
|
|
55
|
+
ownKeys() {
|
|
56
|
+
return Reflect.ownKeys(getBrowserApi().rdfjs);
|
|
57
|
+
},
|
|
58
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
59
|
+
return Object.getOwnPropertyDescriptor(getBrowserApi().rdfjs, prop);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const eyeling = {
|
|
64
|
+
get version() {
|
|
65
|
+
return getBrowserApi().version;
|
|
66
|
+
},
|
|
67
|
+
reasonStream,
|
|
68
|
+
reasonRdfJs,
|
|
69
|
+
rdfjs,
|
|
70
|
+
registerBuiltin,
|
|
71
|
+
unregisterBuiltin,
|
|
72
|
+
registerBuiltinModule,
|
|
73
|
+
listBuiltinIris,
|
|
74
|
+
collectOutputStringsFromFacts,
|
|
75
|
+
prettyPrintQueryTriples,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default eyeling;
|
package/eyeling.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
(function(){
|
|
@@ -8972,6 +8971,8 @@ module.exports = {
|
|
|
8972
8971
|
isGroundTriple: engine.isGroundTriple,
|
|
8973
8972
|
printExplanation: engine.printExplanation,
|
|
8974
8973
|
tripleToN3: engine.tripleToN3,
|
|
8974
|
+
collectOutputStringsFromFacts: engine.collectOutputStringsFromFacts,
|
|
8975
|
+
prettyPrintQueryTriples: engine.prettyPrintQueryTriples,
|
|
8975
8976
|
getEnforceHttpsEnabled: engine.getEnforceHttpsEnabled,
|
|
8976
8977
|
setEnforceHttpsEnabled: engine.setEnforceHttpsEnabled,
|
|
8977
8978
|
getProofCommentsEnabled: engine.getProofCommentsEnabled,
|
|
@@ -12752,7 +12753,7 @@ module.exports = {
|
|
|
12752
12753
|
return m.exports;
|
|
12753
12754
|
}
|
|
12754
12755
|
const __entry = __loadEntry();
|
|
12755
|
-
const __api =
|
|
12756
|
+
const __api = __entry;
|
|
12756
12757
|
|
|
12757
12758
|
try { if (__outerModule && __outerModule.exports) __outerModule.exports = __api; } catch (ignoredError) {}
|
|
12758
12759
|
try { if (__outerSelf) __outerSelf.eyeling = __api; } catch (ignoredError) {}
|
|
@@ -12769,8 +12770,9 @@ module.exports = {
|
|
|
12769
12770
|
if (typeof __entry.isGroundTriple === "function") __outerSelf.isGroundTriple = __entry.isGroundTriple;
|
|
12770
12771
|
if (typeof __entry.printExplanation === "function") __outerSelf.printExplanation = __entry.printExplanation;
|
|
12771
12772
|
if (typeof __entry.tripleToN3 === "function") __outerSelf.tripleToN3 = __entry.tripleToN3;
|
|
12773
|
+
if (typeof __entry.collectOutputStringsFromFacts === "function") __outerSelf.collectOutputStringsFromFacts = __entry.collectOutputStringsFromFacts;
|
|
12774
|
+
if (typeof __entry.prettyPrintQueryTriples === "function") __outerSelf.prettyPrintQueryTriples = __entry.prettyPrintQueryTriples;
|
|
12772
12775
|
|
|
12773
|
-
// Expose flags as mutable globals (with live linkage to engine module state).
|
|
12774
12776
|
const def = (name, getFn, setFn) => {
|
|
12775
12777
|
try {
|
|
12776
12778
|
if (typeof Object.defineProperty === "function") {
|
|
@@ -12780,7 +12782,6 @@ module.exports = {
|
|
|
12780
12782
|
set: (typeof setFn === "function") ? setFn : undefined,
|
|
12781
12783
|
});
|
|
12782
12784
|
} else {
|
|
12783
|
-
// Fallback (no live linkage)
|
|
12784
12785
|
if (typeof getFn === "function") __outerSelf[name] = getFn();
|
|
12785
12786
|
}
|
|
12786
12787
|
} catch (ignoredError) {}
|
package/index.d.ts
CHANGED
|
@@ -205,3 +205,41 @@ declare module 'eyeling' {
|
|
|
205
205
|
export function loadBuiltinModule(specifier: string, options?: { resolveFrom?: string }): string;
|
|
206
206
|
export function listBuiltinIris(): string[];
|
|
207
207
|
}
|
|
208
|
+
|
|
209
|
+
declare module 'eyeling/browser' {
|
|
210
|
+
export type RdfJsDataFactory = import('eyeling').RdfJsDataFactory;
|
|
211
|
+
export type RdfJsQuad = import('eyeling').RdfJsQuad;
|
|
212
|
+
export type RdfJsReasonInput = import('eyeling').RdfJsReasonInput;
|
|
213
|
+
export type EyelingAstBundle = import('eyeling').EyelingAstBundle;
|
|
214
|
+
export type ReasonStreamOptions = import('eyeling').ReasonStreamOptions;
|
|
215
|
+
export type ReasonStreamResult = import('eyeling').ReasonStreamResult;
|
|
216
|
+
export type BuiltinHandler = import('eyeling').BuiltinHandler;
|
|
217
|
+
|
|
218
|
+
export function reasonStream(
|
|
219
|
+
input: string | RdfJsReasonInput | EyelingAstBundle,
|
|
220
|
+
opts?: ReasonStreamOptions,
|
|
221
|
+
): ReasonStreamResult;
|
|
222
|
+
export function reasonRdfJs(
|
|
223
|
+
input: string | RdfJsReasonInput | EyelingAstBundle,
|
|
224
|
+
opts?: Omit<ReasonStreamOptions, 'rdfjs' | 'onDerived'>,
|
|
225
|
+
): AsyncIterable<RdfJsQuad>;
|
|
226
|
+
|
|
227
|
+
export const rdfjs: RdfJsDataFactory;
|
|
228
|
+
export function registerBuiltin(iri: string, handler: BuiltinHandler): BuiltinHandler;
|
|
229
|
+
export function unregisterBuiltin(iri: string): boolean;
|
|
230
|
+
export function registerBuiltinModule(mod: any, origin?: string): boolean;
|
|
231
|
+
export function listBuiltinIris(): string[];
|
|
232
|
+
|
|
233
|
+
const eyeling: {
|
|
234
|
+
readonly version: string;
|
|
235
|
+
reasonStream: typeof reasonStream;
|
|
236
|
+
reasonRdfJs: typeof reasonRdfJs;
|
|
237
|
+
rdfjs: typeof rdfjs;
|
|
238
|
+
registerBuiltin: typeof registerBuiltin;
|
|
239
|
+
unregisterBuiltin: typeof unregisterBuiltin;
|
|
240
|
+
registerBuiltinModule: typeof registerBuiltinModule;
|
|
241
|
+
listBuiltinIris: typeof listBuiltinIris;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export default eyeling;
|
|
245
|
+
}
|
package/lib/entry.js
CHANGED
|
@@ -32,6 +32,8 @@ module.exports = {
|
|
|
32
32
|
isGroundTriple: engine.isGroundTriple,
|
|
33
33
|
printExplanation: engine.printExplanation,
|
|
34
34
|
tripleToN3: engine.tripleToN3,
|
|
35
|
+
collectOutputStringsFromFacts: engine.collectOutputStringsFromFacts,
|
|
36
|
+
prettyPrintQueryTriples: engine.prettyPrintQueryTriples,
|
|
35
37
|
getEnforceHttpsEnabled: engine.getEnforceHttpsEnabled,
|
|
36
38
|
setEnforceHttpsEnabled: engine.setEnforceHttpsEnabled,
|
|
37
39
|
getProofCommentsEnabled: engine.getProofCommentsEnabled,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyeling",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "A minimal Notation3 (N3) reasoner in JavaScript.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/eyereasoner/eyeling#readme",
|
|
17
17
|
"bin": {
|
|
18
|
-
"eyeling": "./eyeling.
|
|
18
|
+
"eyeling": "./bin/eyeling.cjs"
|
|
19
19
|
},
|
|
20
20
|
"types": "./index.d.ts",
|
|
21
21
|
"files": [
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"eyeling.js",
|
|
28
28
|
"index.js",
|
|
29
29
|
"index.d.ts",
|
|
30
|
+
"bin",
|
|
31
|
+
"dist",
|
|
30
32
|
"lib",
|
|
31
33
|
"test",
|
|
32
34
|
"tools",
|
|
@@ -53,5 +55,26 @@
|
|
|
53
55
|
"posttest": "npm run test:package",
|
|
54
56
|
"preversion": "npm test",
|
|
55
57
|
"postversion": "git push origin HEAD --follow-tags"
|
|
58
|
+
},
|
|
59
|
+
"exports": {
|
|
60
|
+
".": {
|
|
61
|
+
"types": "./index.d.ts",
|
|
62
|
+
"browser": "./dist/browser/index.mjs",
|
|
63
|
+
"require": "./index.js",
|
|
64
|
+
"default": "./index.js"
|
|
65
|
+
},
|
|
66
|
+
"./browser": {
|
|
67
|
+
"types": "./index.d.ts",
|
|
68
|
+
"default": "./dist/browser/index.mjs"
|
|
69
|
+
},
|
|
70
|
+
"./eyeling.js": "./eyeling.js",
|
|
71
|
+
"./package.json": "./package.json"
|
|
72
|
+
},
|
|
73
|
+
"typesVersions": {
|
|
74
|
+
"*": {
|
|
75
|
+
"browser": [
|
|
76
|
+
"index.d.ts"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
56
79
|
}
|
|
57
80
|
}
|
package/test/packlist.test.js
CHANGED
|
@@ -30,8 +30,12 @@ try {
|
|
|
30
30
|
assert.ok(fs.existsSync('eyeling.js'), 'eyeling.js missing');
|
|
31
31
|
assert.ok(fs.existsSync('index.js'), 'index.js missing');
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
assert.
|
|
33
|
+
assert.ok(fs.existsSync('bin/eyeling.cjs'), 'bin/eyeling.cjs missing');
|
|
34
|
+
assert.ok(fs.existsSync('dist/browser/eyeling.browser.js'), 'dist/browser/eyeling.browser.js missing');
|
|
35
|
+
assert.ok(fs.existsSync('dist/browser/index.mjs'), 'dist/browser/index.mjs missing');
|
|
36
|
+
|
|
37
|
+
const binFirstLine = fs.readFileSync('bin/eyeling.cjs', 'utf8').split(/\r?\n/, 1)[0];
|
|
38
|
+
assert.match(binFirstLine, /^#!\/usr\/bin\/env node\b/, 'bin/eyeling.cjs should start with "#!/usr/bin/env node"');
|
|
35
39
|
|
|
36
40
|
let packJson;
|
|
37
41
|
try {
|
|
@@ -43,7 +47,16 @@ try {
|
|
|
43
47
|
const pack = JSON.parse(packJson)[0];
|
|
44
48
|
const paths = new Set(pack.files.map((f) => f.path));
|
|
45
49
|
|
|
46
|
-
const mustHave = [
|
|
50
|
+
const mustHave = [
|
|
51
|
+
'package.json',
|
|
52
|
+
'README.md',
|
|
53
|
+
'LICENSE.md',
|
|
54
|
+
'eyeling.js',
|
|
55
|
+
'index.js',
|
|
56
|
+
'bin/eyeling.cjs',
|
|
57
|
+
'dist/browser/eyeling.browser.js',
|
|
58
|
+
'dist/browser/index.mjs',
|
|
59
|
+
];
|
|
47
60
|
|
|
48
61
|
for (const p of mustHave) assert.ok(paths.has(p), `missing from npm pack: ${p}`);
|
|
49
62
|
|