@pieceful/ravel-host-node 0.1.1 → 0.3.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/LICENSE +15 -3
- package/README.md +74 -1
- package/package.json +37 -11
- package/src/index.d.ts +38 -4
- package/src/index.js +834 -101
package/LICENSE
CHANGED
|
@@ -2,8 +2,20 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 James Taylor
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
8
14
|
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pieceful/ravel-host-node
|
|
2
2
|
|
|
3
|
-
The Node.js host for Ravel projects. It loads Markdown, JSON Ravel Maps, and
|
|
3
|
+
The Node.js host for [Ravel](https://github.com/jostylr/ravel) projects. It loads Markdown, JSON Ravel Maps, and
|
|
4
4
|
TOML project configuration; confines project filesystem access; and safely
|
|
5
5
|
writes planned deliverables, manifests, provenance maps, cleanups, and backups.
|
|
6
6
|
|
|
@@ -13,6 +13,79 @@ completed program, or use the higher-level `@pieceful/ravel` CLI. Inputs and
|
|
|
13
13
|
outputs are contained beneath an explicit project root; path escapes and
|
|
14
14
|
symlink traversal are rejected.
|
|
15
15
|
|
|
16
|
+
Editor hosts can evaluate unsaved project state by supplying absolute,
|
|
17
|
+
normalized in-memory overlays. Imported inputs and configuration consult the
|
|
18
|
+
overlay before disk:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const loaded = await loadBuildInput("ravel.toml", {
|
|
22
|
+
overlays: new Map([
|
|
23
|
+
[absoluteMarkdownPath, { text: dirtyEditorText, version: 12 }],
|
|
24
|
+
]),
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Loading overlays never writes source, deliverables, manifests, provenance
|
|
29
|
+
sidecars, backups, or stale-output changes. Artifact writes remain separate,
|
|
30
|
+
explicit host operations.
|
|
31
|
+
|
|
32
|
+
`loadBuildInput` reports `loadedInputUris` for invalidation and separately
|
|
33
|
+
reports `authoredSourceUris` plus `authoredSourceTexts`. The text record contains
|
|
34
|
+
the exact overlay or disk text consumed for each authored non-JSON input, keyed
|
|
35
|
+
relative to the project root. Editor hosts can use it to prove that a newly
|
|
36
|
+
opened clean navigation destination still matches the evaluated snapshot; it
|
|
37
|
+
does not supply an editor version or write permission. A source path merely
|
|
38
|
+
asserted by JSON Ravel Map data is not added to the authored set, and a load
|
|
39
|
+
containing JSON map provenance reports `sourceEditsAllowed: false` for the
|
|
40
|
+
current conservative automatic-edit policy.
|
|
41
|
+
|
|
42
|
+
Version-1 TOML projects may declare text `[[live.resources]]` and installed
|
|
43
|
+
package exports in `[[live.modules]]`. The host validates and loads those
|
|
44
|
+
declarations; provider-specific package preparation remains outside this
|
|
45
|
+
general filesystem host.
|
|
46
|
+
|
|
47
|
+
`.qmd` inputs are parsed through the modern Markdown adapter before any Quarto
|
|
48
|
+
execution stage. Markdown entries in `ravel.toml` may select
|
|
49
|
+
`profile = "modern"` or retain the compatibility profile with
|
|
50
|
+
`profile = "fences"`.
|
|
51
|
+
|
|
52
|
+
Historical projects select the independent LitPro adapter with
|
|
53
|
+
`adapter = "markdown-litpro"` and may choose `dialect = "litpro-2017"`,
|
|
54
|
+
`"pieceful-2020"`, or `"litpro-plus"`. Legacy `load:` directives retain the
|
|
55
|
+
adapter and dialect while loading their declared input; parsing never performs
|
|
56
|
+
other legacy effects.
|
|
57
|
+
|
|
58
|
+
Noweb sources use `.nw` or `.noweb`, or may be selected explicitly with
|
|
59
|
+
`adapter = "noweb"`. TOML accepts `dialect = "noweb"` or `"noweb-plus"`,
|
|
60
|
+
`references = "noweb"`, `"underscore-quote"`, or `"both"`, and an optional
|
|
61
|
+
`language`. `run = true` and `provider = "..."` retain live execution intent
|
|
62
|
+
as chunk metadata; loading never executes a noweb chunk or writes tangled
|
|
63
|
+
output.
|
|
64
|
+
|
|
65
|
+
AsciiDoc sources use `.adoc`, `.asciidoc`, or `adapter = "asciidoc"`.
|
|
66
|
+
Section and block pieces retain exact source bodies, pipelines, native
|
|
67
|
+
cross-reference navigation, and `ravel::` graph directives. Loading does not
|
|
68
|
+
invoke Asciidoctor or expand includes.
|
|
69
|
+
|
|
70
|
+
HTML sources use `.html`, `.htm`, or `adapter = "html"`. Semantic sections and
|
|
71
|
+
figures retain visible names, decoded code, native navigation, pipelines, and
|
|
72
|
+
directive links. Loading uses authored source with scripting disabled; it
|
|
73
|
+
never constructs a browser DOM or observes runtime mutations.
|
|
74
|
+
|
|
75
|
+
Org sources use `.org` or `adapter = "org"`. TOML can select
|
|
76
|
+
`references = "org-noweb"`, `"underscore-quote"`, or `"both"`, enable
|
|
77
|
+
Ravel-only use-site pipes with `noweb_pipes = true`, and assign Babel
|
|
78
|
+
authority with `execution_owner = "org"` or `"ravel"`. The host retains
|
|
79
|
+
Babel header arguments, result artifacts, and tangle requests as data; loading
|
|
80
|
+
does not invoke Emacs or Babel.
|
|
81
|
+
|
|
82
|
+
MyST sources use `.myst.md` or `adapter = "myst"`. Labeled `{ravel:piece}`,
|
|
83
|
+
`{code}`, `{code-block}`, and `{code-cell}` directives retain visible
|
|
84
|
+
captions, anchors, exact bodies, cross-reference navigation, front matter, and
|
|
85
|
+
notebook tags. TOML may assign cell authority with
|
|
86
|
+
`execution_owner = "myst"` or `"ravel"`; loading invokes neither MyST nor
|
|
87
|
+
Jupyter.
|
|
88
|
+
|
|
16
89
|
Requires Node.js 22 or newer. This package is intentionally Node-specific;
|
|
17
90
|
browser and Bun hosts should supply their own I/O boundary around
|
|
18
91
|
`@pieceful/ravel-core`.
|
package/package.json
CHANGED
|
@@ -1,25 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pieceful/ravel-host-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Node host capabilities for Ravel.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "James Taylor",
|
|
8
|
-
"repository": {
|
|
9
|
-
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/jostylr/ravel.git",
|
|
11
|
+
"directory": "packages/host-node"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/jostylr/ravel/issues"
|
|
15
|
+
},
|
|
10
16
|
"homepage": "https://ravel.jostylr.com/",
|
|
11
|
-
"engines": {
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ravel",
|
|
22
|
+
"literate-programming",
|
|
23
|
+
"node",
|
|
24
|
+
"build"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
14
29
|
"exports": {
|
|
15
30
|
".": "./src/index.js"
|
|
16
31
|
},
|
|
17
32
|
"types": "./src/index.d.ts",
|
|
18
|
-
"files": [
|
|
33
|
+
"files": [
|
|
34
|
+
"src",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE"
|
|
37
|
+
],
|
|
19
38
|
"dependencies": {
|
|
20
|
-
"@pieceful/ravel-
|
|
21
|
-
"@pieceful/ravel-
|
|
22
|
-
"@pieceful/ravel-
|
|
23
|
-
"
|
|
39
|
+
"@pieceful/ravel-asciidoc": "0.3.0",
|
|
40
|
+
"@pieceful/ravel-core": "0.3.0",
|
|
41
|
+
"@pieceful/ravel-html": "0.3.0",
|
|
42
|
+
"@pieceful/ravel-map": "0.3.0",
|
|
43
|
+
"@pieceful/ravel-markdown": "0.3.0",
|
|
44
|
+
"@pieceful/ravel-markdown-litpro": "0.3.0",
|
|
45
|
+
"@pieceful/ravel-myst": "0.3.0",
|
|
46
|
+
"@pieceful/ravel-noweb": "0.3.0",
|
|
47
|
+
"@pieceful/ravel-org": "0.3.0",
|
|
48
|
+
"@pieceful/ravel-transforms": "0.3.0",
|
|
49
|
+
"smol-toml": "^1.9.1"
|
|
24
50
|
}
|
|
25
51
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -3,11 +3,45 @@ export interface SourceRange { start: SourcePosition; end: SourcePosition; }
|
|
|
3
3
|
export interface SourceLocation { uri: string; range: SourceRange; }
|
|
4
4
|
export interface Diagnostic { code: string; severity: "error" | "warning" | "info"; message: string; source: SourceLocation; }
|
|
5
5
|
export interface RavelProgram { version?: number; deliverables: Record<string, { name: string; from: string; value: string; segments?: unknown[] }>; }
|
|
6
|
-
export interface
|
|
6
|
+
export interface LiveModuleDeclaration { specifier: string; from: string; source?: SourceLocation; }
|
|
7
|
+
export interface LiveResourceDeclaration { name: string; path: string; source?: SourceLocation; }
|
|
8
|
+
export interface LiveConfiguration { modules: LiveModuleDeclaration[]; resources: Record<string, string>; resourceDeclarations?: LiveResourceDeclaration[]; }
|
|
9
|
+
export interface BuildInput {
|
|
10
|
+
pretransform: unknown;
|
|
11
|
+
outputDirectory?: string;
|
|
12
|
+
rootDirectory: string;
|
|
13
|
+
/** Relative source documents actually parsed through a source adapter. */
|
|
14
|
+
authoredSourceUris: string[];
|
|
15
|
+
/** Exact authored text consumed by source adapters for this evaluation. */
|
|
16
|
+
authoredSourceTexts: Record<string, string>;
|
|
17
|
+
/** Relative JSON/markup/config inputs whose overlays invalidate analysis. */
|
|
18
|
+
loadedInputUris: string[];
|
|
19
|
+
/** False when any supplied JSON map makes automatic edit provenance unverified. */
|
|
20
|
+
sourceEditsAllowed: boolean;
|
|
21
|
+
buildOptions?: { clean: boolean; backup: boolean | string };
|
|
22
|
+
live?: LiveConfiguration;
|
|
23
|
+
}
|
|
24
|
+
export interface SourceAdapterOptions {
|
|
25
|
+
document?: string;
|
|
26
|
+
mode?: "opt-in" | "primary";
|
|
27
|
+
profile?: "fences" | "modern" | "litpro";
|
|
28
|
+
adapter?: "asciidoc" | "html" | "markdown" | "markdown-litpro" | "myst" | "noweb" | "org";
|
|
29
|
+
dialect?: "litpro-2017" | "pieceful-2020" | "litpro-plus" | "noweb" | "noweb-plus";
|
|
30
|
+
references?: "noweb" | "org-noweb" | "underscore-quote" | "both";
|
|
31
|
+
language?: string;
|
|
32
|
+
nowebPipes?: boolean;
|
|
33
|
+
executionOwner?: "org" | "myst" | "ravel";
|
|
34
|
+
run?: boolean;
|
|
35
|
+
provider?: string;
|
|
36
|
+
overlays?: Map<string, string | { text: string; version?: number }> | Record<string, string | { text: string; version?: number }>;
|
|
37
|
+
/** Keep live resource declarations but do not read their contents. Intended for editor analysis. */
|
|
38
|
+
readLiveResources?: boolean;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
7
41
|
export class RavelInputError extends Error { diagnostics: Diagnostic[]; }
|
|
8
|
-
export function loadPretransformGraph(entryPath: string, options?:
|
|
9
|
-
export function loadTomlBuild(configPath: string): Promise<BuildInput>;
|
|
10
|
-
export function loadBuildInput(inputPath: string, options?:
|
|
42
|
+
export function loadPretransformGraph(entryPath: string, options?: SourceAdapterOptions): Promise<unknown>;
|
|
43
|
+
export function loadTomlBuild(configPath: string, options?: SourceAdapterOptions): Promise<BuildInput>;
|
|
44
|
+
export function loadBuildInput(inputPath: string, options?: SourceAdapterOptions): Promise<BuildInput>;
|
|
11
45
|
export function planDeliverables(program: RavelProgram, outputDirectory: string): { version: 1; outputDirectory: string; manifest: string; deliverables: Array<Record<string, unknown>> };
|
|
12
46
|
export function planStaleDeliverables(program: RavelProgram, outputDirectory: string, options?: { rootDirectory?: string; staleSince?: string }): Promise<Array<Record<string, unknown>>>;
|
|
13
47
|
export function writeDeliverables(program: RavelProgram, outputDirectory: string, options?: { rootDirectory?: string }): Promise<string[]>;
|