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
package/HANDBOOK.md
CHANGED
|
@@ -54,7 +54,7 @@ That last point is the heart of Eyeling’s design: _forward rules are executed
|
|
|
54
54
|
|
|
55
55
|
Eyeling deliberately keeps the implementation small and dependency-free:
|
|
56
56
|
|
|
57
|
-
- the published package includes a
|
|
57
|
+
- the published package includes a Node-oriented bundle (`eyeling.js`) and a dedicated browser bundle (`dist/browser/eyeling.browser.js`)
|
|
58
58
|
- the source is organized into `lib/*` modules that read like a miniature compiler + logic engine.
|
|
59
59
|
|
|
60
60
|
This handbook is a tour of that miniature system.
|
|
@@ -1805,7 +1805,7 @@ Custom builtins can be loaded explicitly from the CLI:
|
|
|
1805
1805
|
npx eyeling --builtin lib/builtin-sudoku.js examples/sudoku.n3
|
|
1806
1806
|
```
|
|
1807
1807
|
|
|
1808
|
-
### 14.2 The bundled CLI (`eyeling.js`)
|
|
1808
|
+
### 14.2 The bundled Node CLI/runtime (`eyeling.js`)
|
|
1809
1809
|
|
|
1810
1810
|
The bundle contains the whole engine. The CLI path is the “canonical behavior”:
|
|
1811
1811
|
|
|
@@ -1831,6 +1831,42 @@ The current CLI supports a small set of flags (see `lib/cli.js`):
|
|
|
1831
1831
|
- With no positional argument, Eyeling reads from stdin when input is piped.
|
|
1832
1832
|
- Use `-` as the input path to read explicitly from stdin.
|
|
1833
1833
|
|
|
1834
|
+
### 14.3 Package entrypoint split for Node, browser, and CLI
|
|
1835
|
+
|
|
1836
|
+
The repo now publishes three distinct surfaces instead of forcing browser tooling through the Node-first bundle entry:
|
|
1837
|
+
|
|
1838
|
+
- `index.js` remains the **Node API** used by `require('eyeling')` and `import eyeling from 'eyeling'` in Node.
|
|
1839
|
+
- `bin/eyeling.cjs` is the **CLI shim** with the shebang. It loads the Node bundle and calls `main()`.
|
|
1840
|
+
- `dist/browser/eyeling.browser.js` is the **browser-safe bundle asset** with **no shebang**.
|
|
1841
|
+
- `dist/browser/index.mjs` is the **browser import surface** exported as `eyeling/browser`.
|
|
1842
|
+
|
|
1843
|
+
That gives the intended mental model:
|
|
1844
|
+
|
|
1845
|
+
```js
|
|
1846
|
+
import eyeling from 'eyeling'; // Node
|
|
1847
|
+
import eyelingBrowser from 'eyeling/browser'; // Browser / worker
|
|
1848
|
+
```
|
|
1849
|
+
|
|
1850
|
+
```bash
|
|
1851
|
+
npx eyeling … # CLI
|
|
1852
|
+
```
|
|
1853
|
+
|
|
1854
|
+
The `package.json` `exports` map points the `browser` condition at `dist/browser/index.mjs`, so browser-oriented bundlers stop resolving the package root to the Node wrapper in `index.js`.
|
|
1855
|
+
|
|
1856
|
+
`dist/browser/index.mjs` intentionally re-exports only the browser-safe surface:
|
|
1857
|
+
|
|
1858
|
+
- `reasonStream(...)`
|
|
1859
|
+
- `reasonRdfJs(...)`
|
|
1860
|
+
- `rdfjs`
|
|
1861
|
+
- `registerBuiltin(...)`
|
|
1862
|
+
- `unregisterBuiltin(...)`
|
|
1863
|
+
- `registerBuiltinModule(...)`
|
|
1864
|
+
- `listBuiltinIris()`
|
|
1865
|
+
|
|
1866
|
+
It deliberately does **not** expose `loadBuiltinModule(...)`, because loading builtin files by module specifier is a Node-only pattern. In browsers, custom builtins should be registered directly in-process (for example with `registerBuiltin(...)` or `registerBuiltinModule(...)`).
|
|
1867
|
+
|
|
1868
|
+
For browser apps, prefer running Eyeling in a **Web Worker** and importing `eyeling/browser` there.
|
|
1869
|
+
|
|
1834
1870
|
### 14.3 `lib/entry.js`: bundler-friendly exports
|
|
1835
1871
|
|
|
1836
1872
|
`lib/entry.js` exports:
|
|
@@ -1845,7 +1881,7 @@ The current CLI supports a small set of flags (see `lib/cli.js`):
|
|
|
1845
1881
|
Eyeling exposes two JavaScript entry styles:
|
|
1846
1882
|
|
|
1847
1883
|
- `reason(...)` from `index.js` when you want the same text output as the CLI
|
|
1848
|
-
- `reasonStream(...)` / `reasonRdfJs(...)` from the bundle
|
|
1884
|
+
- `reasonStream(...)` / `reasonRdfJs(...)` from the Node bundle or `eyeling/browser` when you want in-process reasoning and structured RDF/JS results
|
|
1849
1885
|
|
|
1850
1886
|
#### 14.4.1 npm helper: `reason(...)`
|
|
1851
1887
|
|