@refrakt-md/runes 0.38.0 → 0.40.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/dist/attribute-presets.d.ts +3 -2
- package/dist/attribute-presets.d.ts.map +1 -1
- package/dist/attribute-presets.js +2 -1
- package/dist/attribute-presets.js.map +1 -1
- package/dist/collection-helpers.d.ts +21 -2
- package/dist/collection-helpers.d.ts.map +1 -1
- package/dist/collection-helpers.js +72 -15
- package/dist/collection-helpers.js.map +1 -1
- package/dist/composed-rune.d.ts +59 -0
- package/dist/composed-rune.d.ts.map +1 -0
- package/dist/composed-rune.js +129 -0
- package/dist/composed-rune.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +73 -40
- package/dist/config.js.map +1 -1
- package/dist/data-pipeline.d.ts +24 -10
- package/dist/data-pipeline.d.ts.map +1 -1
- package/dist/data-pipeline.js +34 -56
- package/dist/data-pipeline.js.map +1 -1
- package/dist/file-ref-resolve.js +9 -13
- package/dist/file-ref-resolve.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/composition.d.ts +152 -0
- package/dist/lib/composition.d.ts.map +1 -0
- package/dist/lib/composition.js +1120 -0
- package/dist/lib/composition.js.map +1 -0
- package/dist/lib/index.d.ts +63 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +137 -8
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/preprocess.d.ts +64 -0
- package/dist/lib/preprocess.d.ts.map +1 -0
- package/dist/lib/preprocess.js +72 -0
- package/dist/lib/preprocess.js.map +1 -0
- package/dist/lib/registers.d.ts +132 -0
- package/dist/lib/registers.d.ts.map +1 -0
- package/dist/lib/registers.js +329 -0
- package/dist/lib/registers.js.map +1 -0
- package/dist/lib/resolver.d.ts +21 -1
- package/dist/lib/resolver.d.ts.map +1 -1
- package/dist/lib/resolver.js +41 -18
- package/dist/lib/resolver.js.map +1 -1
- package/dist/lib/schema-side-table.d.ts +26 -0
- package/dist/lib/schema-side-table.d.ts.map +1 -0
- package/dist/lib/schema-side-table.js +34 -0
- package/dist/lib/schema-side-table.js.map +1 -0
- package/dist/lib/schema-table.d.ts +59 -9
- package/dist/lib/schema-table.d.ts.map +1 -1
- package/dist/lib/schema-table.js +158 -22
- package/dist/lib/schema-table.js.map +1 -1
- package/dist/lib/slot-markers.d.ts +38 -0
- package/dist/lib/slot-markers.d.ts.map +1 -0
- package/dist/lib/slot-markers.js +105 -0
- package/dist/lib/slot-markers.js.map +1 -0
- package/dist/lib/slots.d.ts +99 -0
- package/dist/lib/slots.d.ts.map +1 -0
- package/dist/lib/slots.js +448 -0
- package/dist/lib/slots.js.map +1 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +53 -4
- package/dist/plugins.js.map +1 -1
- package/dist/reference.d.ts +18 -0
- package/dist/reference.d.ts.map +1 -1
- package/dist/reference.js +34 -1
- package/dist/reference.js.map +1 -1
- package/dist/registers-pipeline.d.ts +51 -0
- package/dist/registers-pipeline.d.ts.map +1 -0
- package/dist/registers-pipeline.js +224 -0
- package/dist/registers-pipeline.js.map +1 -0
- package/dist/schema-row.d.ts +5 -0
- package/dist/schema-row.d.ts.map +1 -1
- package/dist/schema-row.js +1 -0
- package/dist/schema-row.js.map +1 -1
- package/dist/tags/data.d.ts +2 -2
- package/dist/tags/data.d.ts.map +1 -1
- package/dist/tags/data.js +6 -4
- package/dist/tags/data.js.map +1 -1
- package/dist/tags/figure.d.ts +10 -4
- package/dist/tags/figure.d.ts.map +1 -1
- package/dist/tags/figure.js +65 -20
- package/dist/tags/figure.js.map +1 -1
- package/dist/tags/include.d.ts +51 -7
- package/dist/tags/include.d.ts.map +1 -1
- package/dist/tags/include.js +216 -7
- package/dist/tags/include.js.map +1 -1
- package/dist/tags/sandbox.d.ts.map +1 -1
- package/dist/tags/sandbox.js +13 -3
- package/dist/tags/sandbox.js.map +1 -1
- package/dist/tags/snippet.d.ts +9 -10
- package/dist/tags/snippet.d.ts.map +1 -1
- package/dist/tags/snippet.js +213 -10
- package/dist/tags/snippet.js.map +1 -1
- package/dist/universal-attributes.d.ts +1 -1
- package/package.json +3 -3
- package/dist/include-pipeline.d.ts +0 -52
- package/dist/include-pipeline.d.ts.map +0 -1
- package/dist/include-pipeline.js +0 -206
- package/dist/include-pipeline.js.map +0 -1
- package/dist/snippet-pipeline.d.ts +0 -44
- package/dist/snippet-pipeline.d.ts.map +0 -1
- package/dist/snippet-pipeline.js +0 -307
- package/dist/snippet-pipeline.js.map +0 -1
package/dist/include-pipeline.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Include pipeline hook (SPEC-129).
|
|
3
|
-
*
|
|
4
|
-
* The first preprocess step: walk the parsed AST and replace every
|
|
5
|
-
* `{% include %}` tag with the referenced partial's AST, cloned and with the
|
|
6
|
-
* tag's `variables` substituted. It runs **before** `preprocessSnippets` and
|
|
7
|
-
* `preprocessData` so a `data` or `snippet` inside the pasted file is in the
|
|
8
|
-
* tree when those hooks walk it — the case `{% partial %}` cannot serve,
|
|
9
|
-
* because Markdoc expands partials during the transform.
|
|
10
|
-
*
|
|
11
|
-
* Three properties are load-bearing:
|
|
12
|
-
*
|
|
13
|
-
* - **Splice, never wrap.** One include produces N nodes and they land as
|
|
14
|
-
* direct siblings. A container to keep the replacement 1:1 breaks
|
|
15
|
-
* composition invisibly: measured in SPEC-127, `{% section %}` and
|
|
16
|
-
* `{% grid %}` consume their children, so wrapped content vanishes with no
|
|
17
|
-
* error. Same constraint, same reason, as the `data` per-row body.
|
|
18
|
-
*
|
|
19
|
-
* - **Always clone.** The partial ASTs are parsed once per build and shared by
|
|
20
|
-
* every page that references them. The later preprocessors mutate the tree in
|
|
21
|
-
* place, so pasting the shared nodes would let one page's `data` resolution
|
|
22
|
-
* leak into the next page's copy.
|
|
23
|
-
*
|
|
24
|
-
* - **Substitute, don't scope.** `partial` binds variables into a
|
|
25
|
-
* transform-time scope, which is precisely what a preprocessor attribute
|
|
26
|
-
* cannot read. `include` rewrites `Variable` nodes in the cloned AST at paste
|
|
27
|
-
* time — the same thing `bindRow` does for `$row` — so a binding reaches
|
|
28
|
-
* `{% data where=$q %}`. Variables the include does not bind are left alone
|
|
29
|
-
* and resolve at transform against the page's own variables.
|
|
30
|
-
*
|
|
31
|
-
* Failures render a visible error callout and record a build error rather than
|
|
32
|
-
* throwing, matching `data`: one bad include does not take out the build, and
|
|
33
|
-
* the failure is on the page where the author will see it.
|
|
34
|
-
*/
|
|
35
|
-
import Markdoc from '@markdoc/markdoc';
|
|
36
|
-
import { emitErrorNode } from './data-emit.js';
|
|
37
|
-
const { Ast } = Markdoc;
|
|
38
|
-
/**
|
|
39
|
-
* How deep includes may nest.
|
|
40
|
-
*
|
|
41
|
-
* A cycle is caught by name before this ever fires — the stack check below is
|
|
42
|
-
* the real guard. This bounds the other shape: a chain of distinct files deep
|
|
43
|
-
* enough that it is a mistake rather than a structure anyone meant to author.
|
|
44
|
-
*/
|
|
45
|
-
export const MAX_INCLUDE_DEPTH = 16;
|
|
46
|
-
/**
|
|
47
|
-
* Preprocess: splice every `{% include %}` tag away. No-op when no partials are
|
|
48
|
-
* available (a tree-mode build with none wired), matching how snippet and data
|
|
49
|
-
* no-op without a sandbox — the tag then falls through to its schema transform,
|
|
50
|
-
* which names the wiring.
|
|
51
|
-
*/
|
|
52
|
-
export function preprocessIncludes(ast, page, ctx) {
|
|
53
|
-
const partials = ctx.partials;
|
|
54
|
-
if (!partials)
|
|
55
|
-
return;
|
|
56
|
-
let mutated = false;
|
|
57
|
-
walkAndReplaceIncludes(ast, page, ctx, partials, () => {
|
|
58
|
-
mutated = true;
|
|
59
|
-
}, []);
|
|
60
|
-
return mutated ? ast : undefined;
|
|
61
|
-
}
|
|
62
|
-
function walkAndReplaceIncludes(node, page, ctx, partials, onReplaced, stack) {
|
|
63
|
-
if (!node.children)
|
|
64
|
-
return;
|
|
65
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
66
|
-
const child = node.children[i];
|
|
67
|
-
if (child.type === 'tag' && child.tag === 'include') {
|
|
68
|
-
const replacement = resolveInclude(child, page, ctx, partials, stack);
|
|
69
|
-
node.children.splice(i, 1, ...replacement);
|
|
70
|
-
// Skip the pasted nodes: nested includes inside them were already
|
|
71
|
-
// expanded by `resolveInclude`, under the cycle stack that names the
|
|
72
|
-
// chain. Re-walking here would expand them a second time with an empty
|
|
73
|
-
// stack, which is exactly how a cycle becomes an infinite paste.
|
|
74
|
-
i += replacement.length - 1;
|
|
75
|
-
onReplaced();
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
walkAndReplaceIncludes(child, page, ctx, partials, onReplaced, stack);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function fail(ctx, page, message) {
|
|
82
|
-
ctx.error(`include: ${message}`, page.url);
|
|
83
|
-
return [emitErrorNode(`include error: ${message}`)];
|
|
84
|
-
}
|
|
85
|
-
function resolveInclude(tag, page, ctx, partials, stack) {
|
|
86
|
-
const file = resolveValue(tag.attributes?.file, ctx.variables);
|
|
87
|
-
if (typeof file !== 'string' || file.length === 0) {
|
|
88
|
-
return fail(ctx, page, 'the `file` attribute is required (an unresolvable variable reference resolves to empty)');
|
|
89
|
-
}
|
|
90
|
-
if (stack.includes(file)) {
|
|
91
|
-
return fail(ctx, page, `cycle — ${[...stack, file].join(' → ')}`);
|
|
92
|
-
}
|
|
93
|
-
if (stack.length >= MAX_INCLUDE_DEPTH) {
|
|
94
|
-
return fail(ctx, page, `nested more than ${MAX_INCLUDE_DEPTH} deep — ${[...stack, file].join(' → ')}`);
|
|
95
|
-
}
|
|
96
|
-
const source = partials[file];
|
|
97
|
-
if (!source || typeof source !== 'object') {
|
|
98
|
-
const known = Object.keys(partials).sort();
|
|
99
|
-
const available = known.length > 0
|
|
100
|
-
? ` Available: ${known.join(', ')}.`
|
|
101
|
-
: ' No partials are registered for this site.';
|
|
102
|
-
return fail(ctx, page, `"${file}" was not found in \`_partials/\` or any registered file root.${available}`);
|
|
103
|
-
}
|
|
104
|
-
const bindings = resolveVariables(tag.attributes?.variables, ctx.variables);
|
|
105
|
-
const pasted = source.children ?? [];
|
|
106
|
-
const children = pasted.map((child) => cloneWithBindings(child, bindings));
|
|
107
|
-
// Expand nested includes inside what was just pasted, under a stack carrying
|
|
108
|
-
// this file — so a cycle is reported by name instead of overflowing.
|
|
109
|
-
if (children.length > 0) {
|
|
110
|
-
const container = new Ast.Node('document', {}, children);
|
|
111
|
-
walkAndReplaceIncludes(container, page, ctx, partials, () => { }, [...stack, file]);
|
|
112
|
-
return container.children;
|
|
113
|
-
}
|
|
114
|
-
return children;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Clone a node, substituting bound variables.
|
|
118
|
-
*
|
|
119
|
-
* `$q` reaches the AST as a `Variable` in a node's *attributes* — on a tag
|
|
120
|
-
* (`where=$q`) and equally on a `text` node, where `{% $q %}` becomes
|
|
121
|
-
* `content: Variable(['q'])`. One rule covers both, exactly as `bindRow` does.
|
|
122
|
-
*/
|
|
123
|
-
function cloneWithBindings(node, bindings) {
|
|
124
|
-
const attributes = {};
|
|
125
|
-
for (const [key, value] of Object.entries(node.attributes ?? {})) {
|
|
126
|
-
attributes[key] = substitute(value, bindings);
|
|
127
|
-
}
|
|
128
|
-
const children = (node.children ?? []).map((child) => cloneWithBindings(child, bindings));
|
|
129
|
-
const copy = new Ast.Node(node.type, attributes, children, node.tag);
|
|
130
|
-
// The constructor takes four fields; everything else Markdoc's parser sets
|
|
131
|
-
// has to be carried across by hand. `inline` decides whether a node renders
|
|
132
|
-
// inline, and `annotations` carries `{% .class #id %}` shorthand — dropping
|
|
133
|
-
// either changes the output silently.
|
|
134
|
-
if (node.lines)
|
|
135
|
-
copy.lines = node.lines;
|
|
136
|
-
if (node.location)
|
|
137
|
-
copy.location = node.location;
|
|
138
|
-
copy.inline = node.inline;
|
|
139
|
-
if (node.annotations?.length)
|
|
140
|
-
copy.annotations = node.annotations;
|
|
141
|
-
if (node.slots && Object.keys(node.slots).length > 0) {
|
|
142
|
-
copy.slots = Object.fromEntries(Object.entries(node.slots).map(([k, v]) => [k, cloneWithBindings(v, bindings)]));
|
|
143
|
-
}
|
|
144
|
-
return copy;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Replace a `Variable` node whose root segment the include binds.
|
|
148
|
-
*
|
|
149
|
-
* Unbound variables pass through untouched rather than resolving to empty: the
|
|
150
|
-
* pasted AST is page content now, so `$page.slug` and friends still resolve at
|
|
151
|
-
* transform against the page's own variables. That is a capability `partial`
|
|
152
|
-
* does not have — its scope *replaces* the variable surface.
|
|
153
|
-
*/
|
|
154
|
-
function substitute(value, bindings) {
|
|
155
|
-
if (!value || typeof value !== 'object')
|
|
156
|
-
return value;
|
|
157
|
-
const node = value;
|
|
158
|
-
if (node.$$mdtype === 'Variable' && Array.isArray(node.path) && node.path.length > 0) {
|
|
159
|
-
const [root, ...rest] = node.path;
|
|
160
|
-
if (!(root in bindings))
|
|
161
|
-
return value;
|
|
162
|
-
let current = bindings[root];
|
|
163
|
-
for (const segment of rest) {
|
|
164
|
-
if (current === null || current === undefined)
|
|
165
|
-
return '';
|
|
166
|
-
current = current[segment];
|
|
167
|
-
}
|
|
168
|
-
return current === null || current === undefined ? '' : current;
|
|
169
|
-
}
|
|
170
|
-
return value;
|
|
171
|
-
}
|
|
172
|
-
/** The include's own `variables={...}`, with any page-variable references in
|
|
173
|
-
* its values resolved before they are substituted into the pasted AST. */
|
|
174
|
-
function resolveVariables(raw, pageVariables) {
|
|
175
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
176
|
-
return {};
|
|
177
|
-
const out = {};
|
|
178
|
-
for (const [key, value] of Object.entries(raw)) {
|
|
179
|
-
out[key] = resolveValue(value, pageVariables);
|
|
180
|
-
}
|
|
181
|
-
return out;
|
|
182
|
-
}
|
|
183
|
-
/** Resolve an attribute value against the page's variables — literals pass
|
|
184
|
-
* through, `Variable` nodes are looked up. Mirrors snippet's and data's
|
|
185
|
-
* resolvers; anything else (a `Function` node) resolves to empty — the same
|
|
186
|
-
* silent-empty behaviour BUG-010 tracks for `data`'s `where`. */
|
|
187
|
-
function resolveValue(value, variables) {
|
|
188
|
-
if (value === undefined || value === null)
|
|
189
|
-
return '';
|
|
190
|
-
if (typeof value !== 'object')
|
|
191
|
-
return value;
|
|
192
|
-
const node = value;
|
|
193
|
-
if (node.$$mdtype === 'Variable' && Array.isArray(node.path)) {
|
|
194
|
-
let current = variables;
|
|
195
|
-
for (const segment of node.path) {
|
|
196
|
-
if (current === null || current === undefined)
|
|
197
|
-
return '';
|
|
198
|
-
current = current[segment];
|
|
199
|
-
}
|
|
200
|
-
return current === null || current === undefined ? '' : current;
|
|
201
|
-
}
|
|
202
|
-
if (node.$$mdtype === undefined)
|
|
203
|
-
return value;
|
|
204
|
-
return '';
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=include-pipeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"include-pipeline.js","sourceRoot":"","sources":["../src/include-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CACjC,GAAS,EACT,IAAoB,EACpB,GAAsB;IAEtB,MAAM,QAAQ,GAAI,GAA8C,CAAC,QAAQ,CAAC;IAC1E,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,IAAI,OAA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I,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,GAAG,KAA8C,CAAC;IAC5D,IAAI,IAAI,CAAC,QAAQ,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9D,IAAI,OAAO,GAAY,SAAS,CAAC;QACjC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,IAAgB,EAAE,CAAC;YAC7C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS;gBAAE,OAAO,EAAE,CAAC;YACzD,OAAO,GAAI,OAAmC,CAAC,OAAO,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snippet pipeline hooks (SPEC-062, WORK-304).
|
|
3
|
-
*
|
|
4
|
-
* - **Preprocess** walks the parsed Markdoc AST, finds every `{% snippet %}`
|
|
5
|
-
* tag, resolves + slices its source file, and replaces the tag with a
|
|
6
|
-
* Markdoc `fence` node. The fence carries `content` + `language` (so
|
|
7
|
-
* the existing code-block transform syntax-highlights it identically to
|
|
8
|
-
* a triple-backtick fence) plus `source` / `lines` + author-set
|
|
9
|
-
* `linenumbers` / `highlight` annotations (WORK-304). The fence schema
|
|
10
|
-
* renders them as `data-source` / `data-lines` / `data-linenumbers` /
|
|
11
|
-
* `data-highlight-lines` on the output `<pre>` + `<code>`.
|
|
12
|
-
*
|
|
13
|
-
* - **PostProcess** walks the rendered renderable tree, finds every `<pre>`
|
|
14
|
-
* element carrying `data-source`, and — when not nested under a
|
|
15
|
-
* fence-consuming container (`data-rune="code-group"`, `data-rune="diff"`)
|
|
16
|
-
* — wraps it in `<figure class="rf-snippet">` so themes can style snippet
|
|
17
|
-
* blocks distinctly from regular code blocks (and tooling can find
|
|
18
|
-
* `data-source-path` on the figure).
|
|
19
|
-
*
|
|
20
|
-
* This separation is the SPEC-062 composition story: container runes see
|
|
21
|
-
* snippet output as a regular fence (because preprocess made it one) and
|
|
22
|
-
* consume it transparently; standalone snippets get the figure chrome via
|
|
23
|
-
* the wrap step. Captions / titles are intentionally not provided — wrap
|
|
24
|
-
* a snippet in `{% codegroup title="..." %}` if you want a labelled chrome.
|
|
25
|
-
*/
|
|
26
|
-
import type { Node } from '@markdoc/markdoc';
|
|
27
|
-
import type { PreprocessContext, PreprocessPage, PipelineContext, TransformedPage, AggregatedData } from '@refrakt-md/types';
|
|
28
|
-
/**
|
|
29
|
-
* Preprocess: replace every `{% snippet %}` tag in the AST with a `fence`
|
|
30
|
-
* node carrying the resolved file content. After this runs, no snippet
|
|
31
|
-
* tags remain in the AST — only fences (some "snippet-derived" identified
|
|
32
|
-
* by their `data-snippet-source` attribute).
|
|
33
|
-
*/
|
|
34
|
-
export declare function preprocessSnippets(ast: Node, page: PreprocessPage, ctx: PreprocessContext): Node | void;
|
|
35
|
-
/**
|
|
36
|
-
* PostProcess: wrap standalone snippet-derived `<pre>` elements in the
|
|
37
|
-
* snippet figure chrome. Run as part of `corePipelineHooks.postProcess`.
|
|
38
|
-
*
|
|
39
|
-
* Container-nested snippets (inside `<div data-rune="code-group">` or
|
|
40
|
-
* `<div data-rune="diff">` outputs) are left alone — the container's chrome
|
|
41
|
-
* is already there and the figure would be duplicate.
|
|
42
|
-
*/
|
|
43
|
-
export declare function wrapStandaloneSnippets(page: TransformedPage, _aggregated: AggregatedData, _ctx: PipelineContext): TransformedPage;
|
|
44
|
-
//# sourceMappingURL=snippet-pipeline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-pipeline.d.ts","sourceRoot":"","sources":["../src/snippet-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAEX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,MAAM,mBAAmB,CAAC;AA6C3B;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,iBAAiB,GACpB,IAAI,GAAG,IAAI,CAab;AAuMD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,cAAc,EAC3B,IAAI,EAAE,eAAe,GACnB,eAAe,CAIjB"}
|
package/dist/snippet-pipeline.js
DELETED
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snippet pipeline hooks (SPEC-062, WORK-304).
|
|
3
|
-
*
|
|
4
|
-
* - **Preprocess** walks the parsed Markdoc AST, finds every `{% snippet %}`
|
|
5
|
-
* tag, resolves + slices its source file, and replaces the tag with a
|
|
6
|
-
* Markdoc `fence` node. The fence carries `content` + `language` (so
|
|
7
|
-
* the existing code-block transform syntax-highlights it identically to
|
|
8
|
-
* a triple-backtick fence) plus `source` / `lines` + author-set
|
|
9
|
-
* `linenumbers` / `highlight` annotations (WORK-304). The fence schema
|
|
10
|
-
* renders them as `data-source` / `data-lines` / `data-linenumbers` /
|
|
11
|
-
* `data-highlight-lines` on the output `<pre>` + `<code>`.
|
|
12
|
-
*
|
|
13
|
-
* - **PostProcess** walks the rendered renderable tree, finds every `<pre>`
|
|
14
|
-
* element carrying `data-source`, and — when not nested under a
|
|
15
|
-
* fence-consuming container (`data-rune="code-group"`, `data-rune="diff"`)
|
|
16
|
-
* — wraps it in `<figure class="rf-snippet">` so themes can style snippet
|
|
17
|
-
* blocks distinctly from regular code blocks (and tooling can find
|
|
18
|
-
* `data-source-path` on the figure).
|
|
19
|
-
*
|
|
20
|
-
* This separation is the SPEC-062 composition story: container runes see
|
|
21
|
-
* snippet output as a regular fence (because preprocess made it one) and
|
|
22
|
-
* consume it transparently; standalone snippets get the figure chrome via
|
|
23
|
-
* the wrap step. Captions / titles are intentionally not provided — wrap
|
|
24
|
-
* a snippet in `{% codegroup title="..." %}` if you want a labelled chrome.
|
|
25
|
-
*/
|
|
26
|
-
import Markdoc from '@markdoc/markdoc';
|
|
27
|
-
import { formatHighlight, highlightMatchLines, parseHighlightMatch, reindent, shouldReindent, } from './lib/present.js';
|
|
28
|
-
import { readSnippetFile, SnippetSandboxError } from './lib/read-file.js';
|
|
29
|
-
import { compareMarker, parseMarker } from './lib/review-marker.js';
|
|
30
|
-
import { inferLanguage } from './lang-map.js';
|
|
31
|
-
const { Ast, Tag } = Markdoc;
|
|
32
|
-
/** Resolve a Markdoc attribute value to a string. Handles literal strings
|
|
33
|
-
* and Markdoc `Variable` AST nodes (e.g. `path=$file.path` parses as a
|
|
34
|
-
* Variable, not a string). Unresolvable references (variable missing from
|
|
35
|
-
* the context, or attribute is some other AST shape) return an empty
|
|
36
|
-
* string — matching transform-time variable-evaluation behaviour. */
|
|
37
|
-
function resolveAttributeValue(value, variables) {
|
|
38
|
-
if (value === undefined || value === null)
|
|
39
|
-
return '';
|
|
40
|
-
if (typeof value === 'string')
|
|
41
|
-
return value;
|
|
42
|
-
if (typeof value === 'number' || typeof value === 'boolean')
|
|
43
|
-
return String(value);
|
|
44
|
-
if (typeof value === 'object' && '$$mdtype' in value) {
|
|
45
|
-
const node = value;
|
|
46
|
-
if (node.$$mdtype === 'Variable' && Array.isArray(node.path)) {
|
|
47
|
-
let current = variables;
|
|
48
|
-
for (const segment of node.path) {
|
|
49
|
-
if (current === null || current === undefined)
|
|
50
|
-
return '';
|
|
51
|
-
current = current[segment];
|
|
52
|
-
}
|
|
53
|
-
return current === null || current === undefined ? '' : String(current);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return '';
|
|
57
|
-
}
|
|
58
|
-
/** Containers whose output consumes their fence children — wrapping a
|
|
59
|
-
* snippet-derived `<pre>` inside them would be duplicate chrome. */
|
|
60
|
-
const FENCE_CONSUMING_CONTAINERS = new Set(['code-group', 'diff']);
|
|
61
|
-
/**
|
|
62
|
-
* Preprocess: replace every `{% snippet %}` tag in the AST with a `fence`
|
|
63
|
-
* node carrying the resolved file content. After this runs, no snippet
|
|
64
|
-
* tags remain in the AST — only fences (some "snippet-derived" identified
|
|
65
|
-
* by their `data-snippet-source` attribute).
|
|
66
|
-
*/
|
|
67
|
-
export function preprocessSnippets(ast, page, ctx) {
|
|
68
|
-
if (!ctx.sandbox) {
|
|
69
|
-
// No file provider available (e.g. a tree-mode build that hasn't wired
|
|
70
|
-
// one yet) — silently no-op. Snippet refs fall through to the schema's
|
|
71
|
-
// transform, which throws a clear error.
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let mutated = false;
|
|
75
|
-
walkAndReplaceSnippets(ast, page, ctx, ctx.sandbox, (didReplace) => {
|
|
76
|
-
if (didReplace)
|
|
77
|
-
mutated = true;
|
|
78
|
-
});
|
|
79
|
-
return mutated ? ast : undefined;
|
|
80
|
-
}
|
|
81
|
-
function walkAndReplaceSnippets(node, page, ctx, files, onReplaced) {
|
|
82
|
-
if (!node.children)
|
|
83
|
-
return;
|
|
84
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
85
|
-
const child = node.children[i];
|
|
86
|
-
if (child.type === 'tag' && child.tag === 'snippet') {
|
|
87
|
-
// Always produce a fence — successful resolution returns the
|
|
88
|
-
// real fence; sandbox / missing-file / variable-resolution errors
|
|
89
|
-
// produce an error fence so the snippet tag never reaches the
|
|
90
|
-
// schema's transform (which throws). The build keeps going and
|
|
91
|
-
// the failure is visible on the rendered page.
|
|
92
|
-
node.children[i] = resolveSnippetToFence(child, page, ctx, files);
|
|
93
|
-
onReplaced(true);
|
|
94
|
-
// Don't recurse — replaced.
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
walkAndReplaceSnippets(child, page, ctx, files, onReplaced);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/** Build a `fence` AST node that renders a clear error message in place of
|
|
101
|
-
* the snippet. Used when resolution fails (sandbox, missing file, malformed
|
|
102
|
-
* lines, unresolvable variable reference). The fence carries the original
|
|
103
|
-
* attempted path in `source` so tooling can still detect snippet
|
|
104
|
-
* provenance, plus a `data-snippet-error` raw data-attr that's
|
|
105
|
-
* forwarded through the fence transform for the error styling hook. */
|
|
106
|
-
function makeErrorFence(pathAttr, message) {
|
|
107
|
-
return new Ast.Node('fence', {
|
|
108
|
-
content: `snippet error: ${message}\n`,
|
|
109
|
-
language: 'text',
|
|
110
|
-
source: pathAttr || '(unresolved)',
|
|
111
|
-
'data-snippet-error': message,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function resolveSnippetToFence(tag, page, ctx, files) {
|
|
115
|
-
const pathAttr = resolveAttributeValue(tag.attributes.path, ctx.variables);
|
|
116
|
-
const lines = tag.attributes.lines !== undefined
|
|
117
|
-
? resolveAttributeValue(tag.attributes.lines, ctx.variables)
|
|
118
|
-
: undefined;
|
|
119
|
-
const langAttr = tag.attributes.lang !== undefined
|
|
120
|
-
? resolveAttributeValue(tag.attributes.lang, ctx.variables)
|
|
121
|
-
: undefined;
|
|
122
|
-
// WORK-304 — propagate author-set fence-level annotations from the
|
|
123
|
-
// snippet rune through to the fence node. The fence schema renders
|
|
124
|
-
// them as `data-linenumbers` / `data-highlight-lines`. `linenumbers`
|
|
125
|
-
// arrives as a Boolean from the rune schema; `highlight` as a String.
|
|
126
|
-
const linenumbers = tag.attributes.linenumbers === true;
|
|
127
|
-
const highlight = tag.attributes.highlight !== undefined
|
|
128
|
-
? resolveAttributeValue(tag.attributes.highlight, ctx.variables)
|
|
129
|
-
: undefined;
|
|
130
|
-
// SPEC-131 — anchor attributes. Resolution lands in the shared reader, so
|
|
131
|
-
// `file-ref` gains the same capability from the same change.
|
|
132
|
-
const str = (name) => tag.attributes[name] !== undefined
|
|
133
|
-
? resolveAttributeValue(tag.attributes[name], ctx.variables)
|
|
134
|
-
: undefined;
|
|
135
|
-
const anchor = {
|
|
136
|
-
symbol: str('symbol'),
|
|
137
|
-
match: str('match'),
|
|
138
|
-
occurrence: tag.attributes.occurrence !== undefined ? Number(tag.attributes.occurrence) : undefined,
|
|
139
|
-
extent: str('extent'),
|
|
140
|
-
until: str('until'),
|
|
141
|
-
through: str('through'),
|
|
142
|
-
doc: tag.attributes.doc === undefined ? undefined : tag.attributes.doc === true,
|
|
143
|
-
};
|
|
144
|
-
const reindentAttr = tag.attributes.reindent === undefined ? undefined : tag.attributes.reindent === true;
|
|
145
|
-
const highlightMatch = str('highlight-match');
|
|
146
|
-
const reviewedAttr = str('reviewed');
|
|
147
|
-
if (!pathAttr) {
|
|
148
|
-
const msg = 'snippet `path` attribute is required (and an unresolvable variable reference resolves to empty)';
|
|
149
|
-
ctx.error(msg, page.url);
|
|
150
|
-
return makeErrorFence('', msg);
|
|
151
|
-
}
|
|
152
|
-
let result;
|
|
153
|
-
try {
|
|
154
|
-
result = readSnippetFile({
|
|
155
|
-
files,
|
|
156
|
-
pathAttr,
|
|
157
|
-
lines: lines || undefined,
|
|
158
|
-
anchor,
|
|
159
|
-
lang: langAttr || undefined,
|
|
160
|
-
referencingPage: page.relativePath,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
catch (err) {
|
|
164
|
-
if (err instanceof SnippetSandboxError) {
|
|
165
|
-
ctx.error(err.message, page.url);
|
|
166
|
-
return makeErrorFence(pathAttr, err.message);
|
|
167
|
-
}
|
|
168
|
-
// Unexpected error type — still produce an error fence so the build
|
|
169
|
-
// doesn't crash on a single page.
|
|
170
|
-
const msg = err.message ?? String(err);
|
|
171
|
-
ctx.error(`snippet "${pathAttr}" failed unexpectedly: ${msg}`, page.url);
|
|
172
|
-
return makeErrorFence(pathAttr, msg);
|
|
173
|
-
}
|
|
174
|
-
for (const warning of result.warnings) {
|
|
175
|
-
ctx.warn(warning, page.url);
|
|
176
|
-
}
|
|
177
|
-
// SPEC-134 — the review marker. Evaluated only after the anchor resolved,
|
|
178
|
-
// because D9 layers the two features: SPEC-131 answers *can I find the
|
|
179
|
-
// region* and refuses if not, so a refusal never reaches here at all.
|
|
180
|
-
//
|
|
181
|
-
// A finding is a `PipelineWarning` beside the page and **nothing is
|
|
182
|
-
// rendered into it** (D6). This is deliberately different from SPEC-131's
|
|
183
|
-
// error fence, and the difference is principled: there, the content could
|
|
184
|
-
// not be produced, so the fence takes its place. Here the content was
|
|
185
|
-
// produced perfectly — real, current, correctly located. What is uncertain
|
|
186
|
-
// is the prose beside it, which the resolver cannot see. Replacing a
|
|
187
|
-
// correct code block with an error because a paragraph *might* be stale is
|
|
188
|
-
// a straightforward regression for every reader.
|
|
189
|
-
if (reviewedAttr && reviewedAttr.length > 0) {
|
|
190
|
-
const stored = parseMarker(reviewedAttr);
|
|
191
|
-
const comparison = compareMarker(stored.strict, result.content, stored.loose);
|
|
192
|
-
if (comparison.verdict === 'stale') {
|
|
193
|
-
// Deliberately no diff here: at transform time the only record of
|
|
194
|
-
// the reviewed version is its hash, and a hash cannot be turned
|
|
195
|
-
// back into content. `refrakt snippet review --update` recovers the
|
|
196
|
-
// old slice from git and shows the diff — which is why D5's "show
|
|
197
|
-
// content, never hashes" is the CLI's job rather than this one's.
|
|
198
|
-
ctx.warn(`snippet \`${pathAttr}\` has changed since it was last reviewed. Re-read the prose ` +
|
|
199
|
-
'around it, then run `refrakt snippet review --update` to see the diff and re-stamp.', page.url);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
const language = langAttr && langAttr.length > 0 ? langAttr : inferLanguage(result.relativePath);
|
|
203
|
-
// WORK-589 — presentation runs strictly **after** the resolved range is
|
|
204
|
-
// fixed, so `reindent` can never shift the coordinates `linenumbers` and a
|
|
205
|
-
// numeric `highlight` read (D13). `highlight-match` is computed against the
|
|
206
|
-
// pre-reindent text because reindent changes columns, not lines.
|
|
207
|
-
const highlightMatchLinesFound = highlightMatch
|
|
208
|
-
? highlightMatchLines(result.content, parseHighlightMatch(highlightMatch))
|
|
209
|
-
: [];
|
|
210
|
-
const content = shouldReindent(result.anchored, reindentAttr)
|
|
211
|
-
? reindent(result.content)
|
|
212
|
-
: result.content;
|
|
213
|
-
// WORK-304 — write unprefixed `source` / `lines` directly. The fence
|
|
214
|
-
// schema renders them as `data-source` / `data-lines`. `linenumbers` /
|
|
215
|
-
// `highlight` are propagated from the rune attributes (file-coordinate
|
|
216
|
-
// semantics — see WORK-304 acceptance criteria).
|
|
217
|
-
const fenceAttrs = {
|
|
218
|
-
content,
|
|
219
|
-
language,
|
|
220
|
-
source: result.relativePath,
|
|
221
|
-
};
|
|
222
|
-
// The coordinate frame survives anchoring (D13): an anchored slice reports
|
|
223
|
-
// the range it actually resolved to, so `linenumbers` still starts at the
|
|
224
|
-
// real file line and the displayed numbers stay a pointer back into it.
|
|
225
|
-
if (lines)
|
|
226
|
-
fenceAttrs.lines = lines;
|
|
227
|
-
else if (result.anchored && result.start !== undefined && result.end !== undefined) {
|
|
228
|
-
fenceAttrs.lines = `${result.start}-${result.end}`;
|
|
229
|
-
}
|
|
230
|
-
if (linenumbers)
|
|
231
|
-
fenceAttrs.linenumbers = true;
|
|
232
|
-
if (highlightMatchLinesFound.length > 0) {
|
|
233
|
-
// Slice offsets converted into the file frame the fence expects.
|
|
234
|
-
const base = result.start ?? 1;
|
|
235
|
-
fenceAttrs.highlight = formatHighlight(highlightMatchLinesFound.map((n) => n + base - 1));
|
|
236
|
-
}
|
|
237
|
-
else if (highlight && highlight.length > 0) {
|
|
238
|
-
fenceAttrs.highlight = highlight;
|
|
239
|
-
}
|
|
240
|
-
// Construct a fence Ast.Node. Markdoc parses ``` blocks as
|
|
241
|
-
// new Ast.Node('fence', { content, language }) — same shape here.
|
|
242
|
-
return new Ast.Node('fence', fenceAttrs);
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* PostProcess: wrap standalone snippet-derived `<pre>` elements in the
|
|
246
|
-
* snippet figure chrome. Run as part of `corePipelineHooks.postProcess`.
|
|
247
|
-
*
|
|
248
|
-
* Container-nested snippets (inside `<div data-rune="code-group">` or
|
|
249
|
-
* `<div data-rune="diff">` outputs) are left alone — the container's chrome
|
|
250
|
-
* is already there and the figure would be duplicate.
|
|
251
|
-
*/
|
|
252
|
-
export function wrapStandaloneSnippets(page, _aggregated, _ctx) {
|
|
253
|
-
const wrapped = walkAndWrap(page.renderable, /* containerAncestors */ false);
|
|
254
|
-
if (wrapped === page.renderable)
|
|
255
|
-
return page;
|
|
256
|
-
return { ...page, renderable: wrapped };
|
|
257
|
-
}
|
|
258
|
-
function walkAndWrap(node, insideFenceContainer) {
|
|
259
|
-
if (Array.isArray(node)) {
|
|
260
|
-
let mutated = false;
|
|
261
|
-
const next = node.map((c) => {
|
|
262
|
-
const w = walkAndWrap(c, insideFenceContainer);
|
|
263
|
-
if (w !== c)
|
|
264
|
-
mutated = true;
|
|
265
|
-
return w;
|
|
266
|
-
});
|
|
267
|
-
return mutated ? next : node;
|
|
268
|
-
}
|
|
269
|
-
if (!Tag.isTag(node))
|
|
270
|
-
return node;
|
|
271
|
-
const tag = node;
|
|
272
|
-
const dataRune = tag.attributes?.['data-rune'];
|
|
273
|
-
const enteredFenceContainer = typeof dataRune === 'string' && FENCE_CONSUMING_CONTAINERS.has(dataRune);
|
|
274
|
-
const childAncestor = insideFenceContainer || enteredFenceContainer;
|
|
275
|
-
// Wrap matching <pre> elements that aren't inside a fence-consuming container.
|
|
276
|
-
if (tag.name === 'pre' &&
|
|
277
|
-
tag.attributes?.['data-source'] !== undefined &&
|
|
278
|
-
!insideFenceContainer) {
|
|
279
|
-
return wrapPreInFigure(tag);
|
|
280
|
-
}
|
|
281
|
-
if (!tag.children || tag.children.length === 0)
|
|
282
|
-
return tag;
|
|
283
|
-
let mutated = false;
|
|
284
|
-
const newChildren = tag.children.map((c) => {
|
|
285
|
-
const w = walkAndWrap(c, childAncestor);
|
|
286
|
-
if (w !== c)
|
|
287
|
-
mutated = true;
|
|
288
|
-
return w;
|
|
289
|
-
});
|
|
290
|
-
if (!mutated)
|
|
291
|
-
return tag;
|
|
292
|
-
return new Tag(tag.name, tag.attributes, newChildren);
|
|
293
|
-
}
|
|
294
|
-
function wrapPreInFigure(preTag) {
|
|
295
|
-
const attrs = preTag.attributes;
|
|
296
|
-
const source = String(attrs['data-source'] ?? '');
|
|
297
|
-
const linesAttr = attrs['data-lines'] !== undefined ? String(attrs['data-lines']) : undefined;
|
|
298
|
-
const figureAttrs = {
|
|
299
|
-
class: 'rf-snippet',
|
|
300
|
-
'data-rune': 'snippet',
|
|
301
|
-
'data-source-path': source,
|
|
302
|
-
};
|
|
303
|
-
if (linesAttr)
|
|
304
|
-
figureAttrs['data-lines'] = linesAttr;
|
|
305
|
-
return new Tag('figure', figureAttrs, [preTag]);
|
|
306
|
-
}
|
|
307
|
-
//# sourceMappingURL=snippet-pipeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-pipeline.js","sourceRoot":"","sources":["../src/snippet-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAWvC,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,cAAc,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM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