eyeling 1.19.5 → 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/examples/deck/extra.md +169 -0
- package/examples/extra/collatz-1000.js +138 -0
- package/examples/extra/control-system.js +68 -0
- package/examples/extra/deep-taxonomy-100000.js +95 -0
- package/examples/extra/delfour.js +110 -0
- package/examples/extra/euler-identity.js +41 -0
- package/examples/extra/fibonacci.js +81 -0
- package/examples/extra/goldbach-1000.js +112 -0
- package/examples/extra/gps.js +274 -0
- package/examples/extra/kaprekar-6174.js +112 -0
- package/examples/extra/matrix-mechanics.js +69 -0
- package/examples/extra/odrl-dpv-ehds-risk-ranked.js +255 -0
- package/examples/extra/output/collatz-1000.txt +18 -0
- package/examples/extra/output/control-system.txt +14 -0
- package/examples/extra/output/deep-taxonomy-100000.txt +15 -0
- package/examples/extra/output/delfour.txt +20 -0
- package/examples/extra/output/euler-identity.txt +12 -0
- package/examples/extra/output/fibonacci.txt +21 -0
- package/examples/extra/output/goldbach-1000.txt +17 -0
- package/examples/extra/output/gps.txt +33 -0
- package/examples/extra/output/kaprekar-6174.txt +17 -0
- package/examples/extra/output/matrix-mechanics.txt +14 -0
- package/examples/extra/output/odrl-dpv-ehds-risk-ranked.txt +48 -0
- package/examples/extra/output/path-discovery.txt +28 -0
- package/examples/extra/output/pn-junction-tunneling.txt +15 -0
- package/examples/extra/output/polynomial.txt +20 -0
- package/examples/extra/output/sudoku.txt +47 -0
- package/examples/extra/output/transistor-switch.txt +16 -0
- package/examples/extra/path-discovery.js +45114 -0
- package/examples/extra/pn-junction-tunneling.js +69 -0
- package/examples/extra/polynomial.js +181 -0
- package/examples/extra/sudoku.js +330 -0
- package/examples/extra/transistor-switch.js +93 -0
- package/eyeling.js +5 -4
- package/index.d.ts +38 -0
- package/lib/entry.js +2 -0
- package/package.json +27 -3
- package/test/extra.test.js +100 -0
- package/test/packlist.test.js +16 -3
- package/tools/bundle.js +258 -147
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",
|
|
@@ -43,14 +45,36 @@
|
|
|
43
45
|
"test:builtin-contract": "node test/builtin-contract.test.js",
|
|
44
46
|
"test:n3gen": "node test/n3gen.test.js",
|
|
45
47
|
"test:examples": "node test/examples.test.js",
|
|
48
|
+
"test:extra": "node test/extra.test.js",
|
|
46
49
|
"test:manifest": "node test/manifest.test.js",
|
|
47
50
|
"test:playground": "node test/playground.test.js",
|
|
48
51
|
"test:package": "node test/package.test.js",
|
|
49
|
-
"test:all": "npm run test:api && npm run test:builtin-contract && npm run test:n3gen && npm run test:examples && npm run test:manifest && npm run test:playground",
|
|
52
|
+
"test:all": "npm run test:api && npm run test:builtin-contract && npm run test:n3gen && npm run test:examples && npm run test:extra && npm run test:manifest && npm run test:playground",
|
|
50
53
|
"pretest": "npm run build && npm run test:packlist",
|
|
51
54
|
"test": "npm run test:all",
|
|
52
55
|
"posttest": "npm run test:package",
|
|
53
56
|
"preversion": "npm test",
|
|
54
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
|
+
}
|
|
55
79
|
}
|
|
56
80
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const cp = require('node:child_process');
|
|
7
|
+
|
|
8
|
+
const TTY = process.stdout.isTTY;
|
|
9
|
+
const C = TTY
|
|
10
|
+
? { g: '\x1b[32m', r: '\x1b[31m', y: '\x1b[33m', dim: '\x1b[2m', n: '\x1b[0m' }
|
|
11
|
+
: { g: '', r: '', y: '', dim: '', n: '' };
|
|
12
|
+
const msTag = (ms) => `${C.dim}(${ms} ms)${C.n}`;
|
|
13
|
+
|
|
14
|
+
function ok(msg) {
|
|
15
|
+
console.log(`${C.g}OK${C.n} ${msg}`);
|
|
16
|
+
}
|
|
17
|
+
function fail(msg) {
|
|
18
|
+
console.error(`${C.r}FAIL${C.n} ${msg}`);
|
|
19
|
+
}
|
|
20
|
+
function info(msg) {
|
|
21
|
+
console.log(`${C.y}==${C.n} ${msg}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function main() {
|
|
25
|
+
const suiteStart = Date.now();
|
|
26
|
+
const root = path.resolve(__dirname, '..');
|
|
27
|
+
const extraDir = path.join(root, 'examples', 'extra');
|
|
28
|
+
const outputDir = path.join(extraDir, 'output');
|
|
29
|
+
const nodePath = process.execPath;
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(extraDir)) {
|
|
32
|
+
fail(`Cannot find examples/extra directory: ${extraDir}`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
37
|
+
|
|
38
|
+
const files = fs
|
|
39
|
+
.readdirSync(extraDir)
|
|
40
|
+
.filter((f) => f.endsWith('.js'))
|
|
41
|
+
.sort((a, b) => a.localeCompare(b));
|
|
42
|
+
|
|
43
|
+
info(`Running ${files.length} extra examples`);
|
|
44
|
+
console.log(`${C.dim}node ${process.version}${C.n}`);
|
|
45
|
+
|
|
46
|
+
if (files.length === 0) {
|
|
47
|
+
ok('No .js files found in examples/extra/');
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let passed = 0;
|
|
52
|
+
let failed = 0;
|
|
53
|
+
const idxWidth = String(files.length).length;
|
|
54
|
+
|
|
55
|
+
for (let i = 0; i < files.length; i += 1) {
|
|
56
|
+
const idx = String(i + 1).padStart(idxWidth, '0');
|
|
57
|
+
const file = files[i];
|
|
58
|
+
const start = Date.now();
|
|
59
|
+
|
|
60
|
+
const inputPath = path.join(extraDir, file);
|
|
61
|
+
const outputPath = path.join(outputDir, file.replace(/\.js$/i, '.txt'));
|
|
62
|
+
|
|
63
|
+
const r = cp.spawnSync(nodePath, [inputPath], {
|
|
64
|
+
cwd: extraDir,
|
|
65
|
+
encoding: 'utf8',
|
|
66
|
+
maxBuffer: 200 * 1024 * 1024,
|
|
67
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const stdout = r.stdout || '';
|
|
71
|
+
fs.writeFileSync(outputPath, stdout, 'utf8');
|
|
72
|
+
|
|
73
|
+
const rc = r.status == null ? 1 : r.status;
|
|
74
|
+
const ms = Date.now() - start;
|
|
75
|
+
|
|
76
|
+
if (rc === 0) {
|
|
77
|
+
ok(`${idx} ${file} -> output/${path.basename(outputPath)} ${msTag(ms)}`);
|
|
78
|
+
passed += 1;
|
|
79
|
+
} else {
|
|
80
|
+
fail(`${idx} ${file} ${msTag(ms)}`);
|
|
81
|
+
fail(`Exit code ${rc}`);
|
|
82
|
+
if (r.stderr) process.stderr.write(r.stderr);
|
|
83
|
+
failed += 1;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log('');
|
|
88
|
+
const suiteMs = Date.now() - suiteStart;
|
|
89
|
+
info(`Total elapsed: ${suiteMs} ms (${(suiteMs / 1000).toFixed(2)} s)`);
|
|
90
|
+
|
|
91
|
+
if (failed === 0) {
|
|
92
|
+
ok(`All extra examples passed (${passed}/${files.length})`);
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
fail(`Some extra examples failed (${passed}/${files.length})`);
|
|
97
|
+
process.exit(2);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main();
|
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
|
|