@refrakt-md/content 0.14.4 → 0.15.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/file-roots.d.ts +70 -0
- package/dist/file-roots.d.ts.map +1 -0
- package/dist/file-roots.js +146 -0
- package/dist/file-roots.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +20 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +4 -1
- package/dist/loader.js.map +1 -1
- package/dist/refract-loader.d.ts +14 -1
- package/dist/refract-loader.d.ts.map +1 -1
- package/dist/refract-loader.js +82 -1
- package/dist/refract-loader.js.map +1 -1
- package/dist/registry.d.ts +22 -3
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +106 -23
- package/dist/registry.js.map +1 -1
- package/dist/site.d.ts +15 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +150 -16
- package/dist/site.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-roots scanning and resolution.
|
|
3
|
+
*
|
|
4
|
+
* A file root is a named directory that file-reading runes can reach via the
|
|
5
|
+
* `namespace:filename` syntax. The v1 consumer is Markdoc partials —
|
|
6
|
+
* `{% partial file="shared:footer.md" /%}` resolves from whatever directory
|
|
7
|
+
* is registered under `shared`. Snippet (SPEC-062 v2) and future file-reading
|
|
8
|
+
* runes plug into the same resolver.
|
|
9
|
+
*
|
|
10
|
+
* File roots originate from two sources:
|
|
11
|
+
* - **User config** — `refrakt.config.json#/fileRoots`, paths relative to the
|
|
12
|
+
* config file's directory.
|
|
13
|
+
* - **Plugins** — `Plugin.fileRoots` field, paths relative to the plugin's
|
|
14
|
+
* package directory (resolved by `loadPlugin` before reaching this layer).
|
|
15
|
+
*
|
|
16
|
+
* Plugin-vs-plugin collisions throw at merge time. User-vs-plugin collisions
|
|
17
|
+
* let the user win (see {@link mergeFileRoots}).
|
|
18
|
+
*/
|
|
19
|
+
import type { PartialFile } from './content-tree.js';
|
|
20
|
+
export type FileRoots = Record<string, string>;
|
|
21
|
+
/** Result of merging user-config + plugin file roots. */
|
|
22
|
+
export interface MergedFileRoots {
|
|
23
|
+
/** Final namespace → absolute directory path map (user wins collisions). */
|
|
24
|
+
roots: FileRoots;
|
|
25
|
+
/** Soft diagnostics: warnings about plugin namespaces shadowed by user
|
|
26
|
+
* config. Adapters can surface these alongside other build warnings. */
|
|
27
|
+
warnings: string[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve user-config file roots against the config-file directory.
|
|
31
|
+
*
|
|
32
|
+
* Each value in `userFileRoots` is interpreted relative to `configDir`.
|
|
33
|
+
* Validates namespace names (rejects reserved + empty) and that each
|
|
34
|
+
* resolved directory exists.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveUserFileRoots(userFileRoots: FileRoots | undefined, configDir: string): FileRoots;
|
|
37
|
+
/**
|
|
38
|
+
* Merge plugin-registered file roots with user-config-resolved ones.
|
|
39
|
+
*
|
|
40
|
+
* Precedence: **user wins** any collision. Plugins whose namespaces are
|
|
41
|
+
* shadowed by user config are still loaded (the runes etc.) but their
|
|
42
|
+
* file-root contribution is silently dropped, with a soft warning so the
|
|
43
|
+
* shadowing is visible during development.
|
|
44
|
+
*/
|
|
45
|
+
export declare function mergeFileRoots(userRoots: FileRoots, pluginRoots: FileRoots): MergedFileRoots;
|
|
46
|
+
/**
|
|
47
|
+
* Scan every registered file root, returning `namespace:filename` →
|
|
48
|
+
* `PartialFile`.
|
|
49
|
+
*
|
|
50
|
+
* Each root is validated to exist (throws otherwise — broken config should
|
|
51
|
+
* fail loud at load time). Inside each root, all `.md` files are picked up
|
|
52
|
+
* recursively; subdirectory paths flow through as part of the filename
|
|
53
|
+
* (`shared:legal/terms.md`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function readFileRoots(roots: FileRoots): Promise<Map<string, PartialFile>>;
|
|
56
|
+
/** Validate a `namespace:filename` reference against the registered roots.
|
|
57
|
+
*
|
|
58
|
+
* Returns the absolute file path for valid references; throws on:
|
|
59
|
+
* - Unknown namespace (listing the available ones).
|
|
60
|
+
* - Empty namespace (`:foo.md`).
|
|
61
|
+
* - Absolute paths (`shared:/abs.md`).
|
|
62
|
+
* - Traversal escapes (`shared:../escape.md`).
|
|
63
|
+
*
|
|
64
|
+
* Note: this validation runs at scan time (above), so by the time content
|
|
65
|
+
* authors hit a problem they see it at build, not at render. The function
|
|
66
|
+
* is exported for runes (like the snippet rune's v2) that need to validate
|
|
67
|
+
* ad-hoc references against the same rules.
|
|
68
|
+
*/
|
|
69
|
+
export declare function validateNamespacedReference(ref: string, roots: FileRoots): string;
|
|
70
|
+
//# sourceMappingURL=file-roots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-roots.d.ts","sourceRoot":"","sources":["../src/file-roots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC/B,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB;6EACyE;IACzE,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,SAAS,GAAG,SAAS,EACpC,SAAS,EAAE,MAAM,GACf,SAAS,CAsBX;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC7B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,SAAS,GACpB,eAAe,CAYjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAmBvF;AAwBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAC1C,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,GACd,MAAM,CAgCR"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File-roots scanning and resolution.
|
|
3
|
+
*
|
|
4
|
+
* A file root is a named directory that file-reading runes can reach via the
|
|
5
|
+
* `namespace:filename` syntax. The v1 consumer is Markdoc partials —
|
|
6
|
+
* `{% partial file="shared:footer.md" /%}` resolves from whatever directory
|
|
7
|
+
* is registered under `shared`. Snippet (SPEC-062 v2) and future file-reading
|
|
8
|
+
* runes plug into the same resolver.
|
|
9
|
+
*
|
|
10
|
+
* File roots originate from two sources:
|
|
11
|
+
* - **User config** — `refrakt.config.json#/fileRoots`, paths relative to the
|
|
12
|
+
* config file's directory.
|
|
13
|
+
* - **Plugins** — `Plugin.fileRoots` field, paths relative to the plugin's
|
|
14
|
+
* package directory (resolved by `loadPlugin` before reaching this layer).
|
|
15
|
+
*
|
|
16
|
+
* Plugin-vs-plugin collisions throw at merge time. User-vs-plugin collisions
|
|
17
|
+
* let the user win (see {@link mergeFileRoots}).
|
|
18
|
+
*/
|
|
19
|
+
import * as fs from 'node:fs';
|
|
20
|
+
import * as path from 'node:path';
|
|
21
|
+
/**
|
|
22
|
+
* Resolve user-config file roots against the config-file directory.
|
|
23
|
+
*
|
|
24
|
+
* Each value in `userFileRoots` is interpreted relative to `configDir`.
|
|
25
|
+
* Validates namespace names (rejects reserved + empty) and that each
|
|
26
|
+
* resolved directory exists.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveUserFileRoots(userFileRoots, configDir) {
|
|
29
|
+
if (!userFileRoots || Object.keys(userFileRoots).length === 0)
|
|
30
|
+
return {};
|
|
31
|
+
const resolved = {};
|
|
32
|
+
for (const [namespace, relativePath] of Object.entries(userFileRoots)) {
|
|
33
|
+
if (namespace.length === 0) {
|
|
34
|
+
throw new Error(`refrakt.config.json#/fileRoots: namespace name is empty — namespaces must be non-empty strings.`);
|
|
35
|
+
}
|
|
36
|
+
if (namespace === 'site') {
|
|
37
|
+
throw new Error(`refrakt.config.json#/fileRoots: namespace "${namespace}" is reserved. Pick a different name.`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof relativePath !== 'string' || relativePath.length === 0) {
|
|
40
|
+
throw new Error(`refrakt.config.json#/fileRoots["${namespace}"] must be a non-empty string path.`);
|
|
41
|
+
}
|
|
42
|
+
resolved[namespace] = path.resolve(configDir, relativePath);
|
|
43
|
+
}
|
|
44
|
+
return resolved;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Merge plugin-registered file roots with user-config-resolved ones.
|
|
48
|
+
*
|
|
49
|
+
* Precedence: **user wins** any collision. Plugins whose namespaces are
|
|
50
|
+
* shadowed by user config are still loaded (the runes etc.) but their
|
|
51
|
+
* file-root contribution is silently dropped, with a soft warning so the
|
|
52
|
+
* shadowing is visible during development.
|
|
53
|
+
*/
|
|
54
|
+
export function mergeFileRoots(userRoots, pluginRoots) {
|
|
55
|
+
const merged = { ...pluginRoots };
|
|
56
|
+
const warnings = [];
|
|
57
|
+
for (const [namespace, absPath] of Object.entries(userRoots)) {
|
|
58
|
+
if (merged[namespace] && merged[namespace] !== absPath) {
|
|
59
|
+
warnings.push(`File-root namespace "${namespace}" is registered by both user config and a plugin. User config wins.`);
|
|
60
|
+
}
|
|
61
|
+
merged[namespace] = absPath;
|
|
62
|
+
}
|
|
63
|
+
return { roots: merged, warnings };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Scan every registered file root, returning `namespace:filename` →
|
|
67
|
+
* `PartialFile`.
|
|
68
|
+
*
|
|
69
|
+
* Each root is validated to exist (throws otherwise — broken config should
|
|
70
|
+
* fail loud at load time). Inside each root, all `.md` files are picked up
|
|
71
|
+
* recursively; subdirectory paths flow through as part of the filename
|
|
72
|
+
* (`shared:legal/terms.md`).
|
|
73
|
+
*/
|
|
74
|
+
export async function readFileRoots(roots) {
|
|
75
|
+
const map = new Map();
|
|
76
|
+
for (const [namespace, absPath] of Object.entries(roots)) {
|
|
77
|
+
let stat;
|
|
78
|
+
try {
|
|
79
|
+
stat = await fs.promises.stat(absPath);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
throw new Error(`File root "${namespace}" — directory does not exist: ${absPath}`);
|
|
83
|
+
}
|
|
84
|
+
if (!stat.isDirectory()) {
|
|
85
|
+
throw new Error(`File root "${namespace}" — expected a directory, got a file: ${absPath}`);
|
|
86
|
+
}
|
|
87
|
+
await scanRoot(absPath, absPath, namespace, map);
|
|
88
|
+
}
|
|
89
|
+
return map;
|
|
90
|
+
}
|
|
91
|
+
async function scanRoot(dirPath, rootPath, namespace, map) {
|
|
92
|
+
const entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
95
|
+
if (entry.isDirectory() && !entry.name.startsWith('.')) {
|
|
96
|
+
await scanRoot(fullPath, rootPath, namespace, map);
|
|
97
|
+
}
|
|
98
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
99
|
+
const raw = await fs.promises.readFile(fullPath, 'utf-8');
|
|
100
|
+
// Use POSIX-style slashes in the key regardless of host OS so that
|
|
101
|
+
// authoring stays consistent across platforms.
|
|
102
|
+
const relative = path.relative(rootPath, fullPath).split(path.sep).join('/');
|
|
103
|
+
const key = `${namespace}:${relative}`;
|
|
104
|
+
map.set(key, { name: key, filePath: fullPath, raw });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Validate a `namespace:filename` reference against the registered roots.
|
|
109
|
+
*
|
|
110
|
+
* Returns the absolute file path for valid references; throws on:
|
|
111
|
+
* - Unknown namespace (listing the available ones).
|
|
112
|
+
* - Empty namespace (`:foo.md`).
|
|
113
|
+
* - Absolute paths (`shared:/abs.md`).
|
|
114
|
+
* - Traversal escapes (`shared:../escape.md`).
|
|
115
|
+
*
|
|
116
|
+
* Note: this validation runs at scan time (above), so by the time content
|
|
117
|
+
* authors hit a problem they see it at build, not at render. The function
|
|
118
|
+
* is exported for runes (like the snippet rune's v2) that need to validate
|
|
119
|
+
* ad-hoc references against the same rules.
|
|
120
|
+
*/
|
|
121
|
+
export function validateNamespacedReference(ref, roots) {
|
|
122
|
+
const colonIdx = ref.indexOf(':');
|
|
123
|
+
if (colonIdx <= 0) {
|
|
124
|
+
throw new Error(`File-root reference "${ref}" is missing a namespace prefix. Expected "<namespace>:<path>".`);
|
|
125
|
+
}
|
|
126
|
+
const namespace = ref.slice(0, colonIdx);
|
|
127
|
+
const relative = ref.slice(colonIdx + 1);
|
|
128
|
+
if (relative.length === 0) {
|
|
129
|
+
throw new Error(`File-root reference "${ref}" is missing a path after the colon.`);
|
|
130
|
+
}
|
|
131
|
+
const root = roots[namespace];
|
|
132
|
+
if (!root) {
|
|
133
|
+
const available = Object.keys(roots).join(', ') || '(none registered)';
|
|
134
|
+
throw new Error(`Unknown file-root namespace "${namespace}" in reference "${ref}". Available: ${available}.`);
|
|
135
|
+
}
|
|
136
|
+
if (relative.startsWith('/')) {
|
|
137
|
+
throw new Error(`File-root reference "${ref}" uses an absolute path; namespaced references must be relative to the root.`);
|
|
138
|
+
}
|
|
139
|
+
const resolved = path.resolve(root, relative);
|
|
140
|
+
const rootWithSep = root.endsWith(path.sep) ? root : root + path.sep;
|
|
141
|
+
if (!resolved.startsWith(rootWithSep) && resolved !== root) {
|
|
142
|
+
throw new Error(`File-root reference "${ref}" escapes its root directory. Paths must stay within "${root}".`);
|
|
143
|
+
}
|
|
144
|
+
return resolved;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=file-roots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-roots.js","sourceRoot":"","sources":["../src/file-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ityRegistryImpl } from './registry.js';
|
|
|
14
14
|
export { createRefraktLoader, createVirtualRefraktLoader, buildHighlightOptions, type RefraktLoader, type RefraktLoaderOptions, type VirtualRefraktLoaderOptions } from './refract-loader.js';
|
|
15
15
|
export { runPipeline, type HookSet, type PipelineResult, type PipelineStats } from './pipeline.js';
|
|
16
16
|
export { formatPipelineSummary } from './format.js';
|
|
17
|
+
export { readFileRoots, resolveUserFileRoots, mergeFileRoots, validateNamespacedReference, type FileRoots, type MergedFileRoots, } from './file-roots.js';
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,0BAA0B,EAAE,KAAK,aA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.js
CHANGED
|
@@ -14,4 +14,5 @@ export { EntityRegistryImpl } from './registry.js';
|
|
|
14
14
|
export { createRefraktLoader, createVirtualRefraktLoader, buildHighlightOptions } from './refract-loader.js';
|
|
15
15
|
export { runPipeline } from './pipeline.js';
|
|
16
16
|
export { formatPipelineSummary } from './format.js';
|
|
17
|
+
export { readFileRoots, resolveUserFileRoots, mergeFileRoots, validateNamespacedReference, } from './file-roots.js';
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA+E,MAAM,mBAAmB,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAoB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAc,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAoC,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,kBAAkB,GAGnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,eAAe,EAA6C,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAiF,MAAM,WAAW,CAAC;AAC5I,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAA0E,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAE,eAAe,EAAqB,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAwB,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAuB,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,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EACpB,cAAc,EACd,2BAA2B,GAG5B,MAAM,iBAAiB,CAAC"}
|
package/dist/loader.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Schema } from '@markdoc/markdoc';
|
|
2
2
|
import type { Plugin, SecurityPolicy } from '@refrakt-md/types';
|
|
3
|
+
import type { CompiledXrefPattern } from '@refrakt-md/runes';
|
|
3
4
|
import { type Site, type VirtualReader } from './site.js';
|
|
4
5
|
import type { ContentTree } from './content-tree.js';
|
|
6
|
+
import type { FileRoots } from './file-roots.js';
|
|
5
7
|
export interface SiteLoaderOptions {
|
|
6
8
|
dirPath: string;
|
|
7
9
|
basePath?: string;
|
|
@@ -13,6 +15,17 @@ export interface SiteLoaderOptions {
|
|
|
13
15
|
variables?: Record<string, unknown>;
|
|
14
16
|
/** Security policy for untrusted author content. Default: `'trusted'`. */
|
|
15
17
|
securityPolicy?: SecurityPolicy;
|
|
18
|
+
/** Absolute path to the project root (where `refrakt.config.json` lives).
|
|
19
|
+
* Used to compute `$file.path` as a project-root-relative POSIX path.
|
|
20
|
+
* When omitted, defaults to `dirPath`'s parent — adapters that resolve a
|
|
21
|
+
* config file should pass `dirname(configPath)` explicitly. */
|
|
22
|
+
projectRoot?: string;
|
|
23
|
+
/** Compiled xref patterns from `refrakt.config.json#/xrefs`. Adapters
|
|
24
|
+
* that read the config should compile via `compileXrefPatterns` and
|
|
25
|
+
* pass the result here. */
|
|
26
|
+
xrefPatterns?: CompiledXrefPattern[];
|
|
27
|
+
/** Registered file roots — namespace → absolute directory path. */
|
|
28
|
+
fileRoots?: FileRoots;
|
|
16
29
|
/** When true, every load() call re-reads from disk (no caching). Default: false. */
|
|
17
30
|
dev?: boolean;
|
|
18
31
|
}
|
|
@@ -38,6 +51,13 @@ export interface VirtualSiteLoaderOptions {
|
|
|
38
51
|
/** Optional async reader for ad-hoc lookups. Forward-compatibility hook —
|
|
39
52
|
* see `LoadContentFromTreeOptions.reader` for details. */
|
|
40
53
|
reader?: VirtualReader;
|
|
54
|
+
/** Absolute path to the project root (where `refrakt.config.json` lives).
|
|
55
|
+
* Used to compute `$file.path` as a project-root-relative POSIX path. */
|
|
56
|
+
projectRoot?: string;
|
|
57
|
+
/** Compiled xref patterns from `refrakt.config.json#/xrefs`. */
|
|
58
|
+
xrefPatterns?: CompiledXrefPattern[];
|
|
59
|
+
/** Registered file roots — namespace → absolute directory path. */
|
|
60
|
+
fileRoots?: FileRoots;
|
|
41
61
|
/** When true, every load() call re-runs the pipeline against the current
|
|
42
62
|
* tree (no caching). Use when the host swaps the tree's contents in place. */
|
|
43
63
|
dev?: boolean;
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAoC,KAAK,IAAI,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAoC,KAAK,IAAI,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;+DAC2D;IAC3D,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;8EAC0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,mEAAmE;IACnE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;mFAC+E;IAC/E,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,UAAU,CAyBrF"}
|
package/dist/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ export function createSiteLoader(options) {
|
|
|
5
5
|
load() {
|
|
6
6
|
if (!options.dev && cached)
|
|
7
7
|
return cached;
|
|
8
|
-
const promise = loadContent(options.dirPath, options.basePath, options.icons, options.additionalTags, options.plugins, options.sandboxExamplesDir, options.variables, options.securityPolicy);
|
|
8
|
+
const promise = loadContent(options.dirPath, options.basePath, options.icons, options.additionalTags, options.plugins, options.sandboxExamplesDir, options.variables, options.securityPolicy, options.projectRoot, options.xrefPatterns, options.fileRoots);
|
|
9
9
|
if (!options.dev)
|
|
10
10
|
cached = promise;
|
|
11
11
|
return promise;
|
|
@@ -35,6 +35,9 @@ export function createVirtualSiteLoader(options) {
|
|
|
35
35
|
variables: options.variables,
|
|
36
36
|
securityPolicy: options.securityPolicy,
|
|
37
37
|
reader: options.reader,
|
|
38
|
+
projectRoot: options.projectRoot,
|
|
39
|
+
xrefPatterns: options.xrefPatterns,
|
|
40
|
+
fileRoots: options.fileRoots,
|
|
38
41
|
});
|
|
39
42
|
if (!options.dev)
|
|
40
43
|
cached = promise;
|
package/dist/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader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S,EAAE,OAAO,CAAC,SAAS;gBAC5B,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,SAAS,EAAE,OAAO,CAAC,SAAS;aAC5B,CAAC,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,GAAG;gBAAE,MAAM,GAAG,OAAO,CAAC;YACnC,OAAO,OAAO,CAAC;QAChB,CAAC;QACD,UAAU;YACT,MAAM,GAAG,IAAI,CAAC;QACf,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/refract-loader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { SiteConfig, SecurityPolicy } from '@refrakt-md/types';
|
|
1
|
+
import type { SiteConfig, SecurityPolicy, XrefPattern } from '@refrakt-md/types';
|
|
2
|
+
import { type FileRoots } from './file-roots.js';
|
|
2
3
|
import type { ContentTree } from './content-tree.js';
|
|
3
4
|
import type { Site, VirtualReader } from './site.js';
|
|
4
5
|
export interface RefraktLoaderOptions {
|
|
@@ -63,6 +64,18 @@ export interface VirtualRefraktLoaderOptions {
|
|
|
63
64
|
security?: SecurityPolicy;
|
|
64
65
|
/** URL base path for the Router. Default: `'/'`. */
|
|
65
66
|
basePath?: string;
|
|
67
|
+
/** Absolute path to the project root (where `refrakt.config.json` lives, or
|
|
68
|
+
* the conceptual root in a virtual environment). Used to compute
|
|
69
|
+
* `$file.path`. When omitted, `$file.path` falls back to the page's
|
|
70
|
+
* content-root-relative path. */
|
|
71
|
+
projectRoot?: string;
|
|
72
|
+
/** Xref patterns to compile and use as URL-resolution fallback. */
|
|
73
|
+
xrefs?: XrefPattern[];
|
|
74
|
+
/** File roots — namespace → absolute directory path. Hosts that have a
|
|
75
|
+
* conceptual project root should resolve their fileRoots config against
|
|
76
|
+
* it before passing the result here (the virtual loader doesn't read a
|
|
77
|
+
* config file). Plugin-declared roots merge in automatically. */
|
|
78
|
+
fileRoots?: FileRoots;
|
|
66
79
|
/** Skip caching — re-run the pipeline on every load(). Default: false. */
|
|
67
80
|
dev?: boolean;
|
|
68
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refract-loader.d.ts","sourceRoot":"","sources":["../src/refract-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"refract-loader.d.ts","sourceRoot":"","sources":["../src/refract-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAU,UAAU,EAAE,cAAc,EAAiB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKxG,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAMvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACpC,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;2DACuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC;;;kFAG8E;IAC9E,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,8DAA8D;IAC9D,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC7B,wDAAwD;IACxD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,yDAAyD;IACzD,YAAY,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;IAC5C,8CAA8C;IAC9C,qBAAqB,IAAI,OAAO,CAAC;QAAE,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,uEAAuE;IACvE,cAAc,IAAI,IAAI,CAAC;CACvB;AA6BD;;;;;sDAKsD;AACtD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU;;;;;;EAQrD;AAoHD,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa,CAmGjF;AAED,MAAM,WAAW,2BAA2B;IAC3C;;;;iFAI6E;IAC7E,IAAI,EAAE,UAAU,CAAC;IACjB;uCACmC;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB;iCAC6B;IAC7B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;sCAGkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB;;;sEAGkE;IAClE,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,0EAA0E;IAC1E,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa,CAkF9F"}
|
package/dist/refract-loader.js
CHANGED
|
@@ -2,7 +2,23 @@ import { readFileSync } from 'node:fs';
|
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
3
|
import { getThemePackage } from '@refrakt-md/types';
|
|
4
4
|
import { normalizeRefraktConfig, resolveSite, loadPresets } from '@refrakt-md/transform/node';
|
|
5
|
+
import { compileXrefPatterns } from '@refrakt-md/runes';
|
|
6
|
+
import { mergeFileRoots, resolveUserFileRoots } from './file-roots.js';
|
|
5
7
|
import { createSiteLoader, createVirtualSiteLoader, } from './loader.js';
|
|
8
|
+
/** Compile xref patterns from a raw config, logging any diagnostics to
|
|
9
|
+
* stderr so the build surface remains visible. Errors don't throw — they
|
|
10
|
+
* produce a permissively-empty pattern set so the rest of the load
|
|
11
|
+
* succeeds and the user can fix the config without losing the whole site. */
|
|
12
|
+
function compileConfiguredXrefPatterns(patterns) {
|
|
13
|
+
const result = compileXrefPatterns(patterns);
|
|
14
|
+
for (const warning of result.warnings) {
|
|
15
|
+
process.stderr.write(`refrakt: xref pattern warning — ${warning}\n`);
|
|
16
|
+
}
|
|
17
|
+
for (const error of result.errors) {
|
|
18
|
+
process.stderr.write(`refrakt: xref pattern error — ${error}\n`);
|
|
19
|
+
}
|
|
20
|
+
return result.patterns;
|
|
21
|
+
}
|
|
6
22
|
/** Compose the options bag handed to `createHighlightTransform`. Merges the
|
|
7
23
|
* site's `highlight.*` block with theme-level code settings (`theme.code.*`)
|
|
8
24
|
* so a single object reaches the transform — keeps adapter call sites tidy
|
|
@@ -83,6 +99,7 @@ async function assembleSiteContext(site, opts = {}) {
|
|
|
83
99
|
communityTags: undefined,
|
|
84
100
|
communityPackages: undefined,
|
|
85
101
|
icons,
|
|
102
|
+
pluginFileRoots: {},
|
|
86
103
|
};
|
|
87
104
|
}
|
|
88
105
|
const { config: assembledConfig } = assembleThemeConfig({
|
|
@@ -95,6 +112,7 @@ async function assembleSiteContext(site, opts = {}) {
|
|
|
95
112
|
communityTags: undefined,
|
|
96
113
|
communityPackages: undefined,
|
|
97
114
|
icons,
|
|
115
|
+
pluginFileRoots: {},
|
|
98
116
|
};
|
|
99
117
|
}
|
|
100
118
|
const { loadPlugin, mergePlugins, runes: coreRunes } = await import('@refrakt-md/runes');
|
|
@@ -116,6 +134,7 @@ async function assembleSiteContext(site, opts = {}) {
|
|
|
116
134
|
communityTags: Object.keys(merged.tags).length > 0 ? merged.tags : undefined,
|
|
117
135
|
communityPackages: merged.plugins,
|
|
118
136
|
icons,
|
|
137
|
+
pluginFileRoots: merged.fileRoots,
|
|
119
138
|
};
|
|
120
139
|
}
|
|
121
140
|
export function createRefraktLoader(options) {
|
|
@@ -127,6 +146,15 @@ export function createRefraktLoader(options) {
|
|
|
127
146
|
const normalized = normalizeRefraktConfig(rawConfig, { configDir });
|
|
128
147
|
const { site } = resolveSite(normalized, options?.site);
|
|
129
148
|
const contentDir = resolve(site.contentDir);
|
|
149
|
+
// Compile xref patterns once at loader construction. Diagnostics
|
|
150
|
+
// (invalid regex, unknown placeholders, etc.) are surfaced via
|
|
151
|
+
// stderr — adapters can intercept via their own pipeline-warnings
|
|
152
|
+
// formatter once SPEC-058 wiring is fully in place.
|
|
153
|
+
const xrefPatterns = compileConfiguredXrefPatterns(rawConfig.xrefs);
|
|
154
|
+
// Resolve user-config file roots against the config-file directory.
|
|
155
|
+
// Plugin-contributed roots are merged in at init time (after plugins
|
|
156
|
+
// load); user roots win any namespace collision (warning surfaced).
|
|
157
|
+
const userFileRoots = resolveUserFileRoots(rawConfig.fileRoots, configDir);
|
|
130
158
|
let _initPromise = null;
|
|
131
159
|
let _transform = null;
|
|
132
160
|
let _loader = null;
|
|
@@ -137,6 +165,30 @@ export function createRefraktLoader(options) {
|
|
|
137
165
|
_initPromise = (async () => {
|
|
138
166
|
const ctx = await assembleSiteContext(site, { configDir });
|
|
139
167
|
_transform = ctx.transform;
|
|
168
|
+
// Run each plugin's `configure` lifecycle hook before any pipeline
|
|
169
|
+
// phases. Plugins that need build-time config (e.g. plan reading
|
|
170
|
+
// plan.dir for its unconditional-scan path) wire it up here. The
|
|
171
|
+
// `registerFileRoot` callback lets plugins dynamically register
|
|
172
|
+
// file-root namespaces whose paths depend on user config (the
|
|
173
|
+
// plan plugin uses this to expose the user's plan.dir as `plan:`).
|
|
174
|
+
const dynamicFileRoots = {};
|
|
175
|
+
const registerFileRoot = (namespace, absolutePath) => {
|
|
176
|
+
dynamicFileRoots[namespace] = absolutePath;
|
|
177
|
+
};
|
|
178
|
+
for (const pkg of ctx.communityPackages ?? []) {
|
|
179
|
+
if (pkg.pipeline?.configure) {
|
|
180
|
+
await pkg.pipeline.configure({
|
|
181
|
+
config: rawConfig,
|
|
182
|
+
configDir,
|
|
183
|
+
registerFileRoot,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const pluginRoots = { ...ctx.pluginFileRoots, ...dynamicFileRoots };
|
|
188
|
+
const { roots: fileRoots, warnings: fileRootWarnings } = mergeFileRoots(userFileRoots, pluginRoots);
|
|
189
|
+
for (const warning of fileRootWarnings) {
|
|
190
|
+
process.stderr.write(`refrakt: ${warning}\n`);
|
|
191
|
+
}
|
|
140
192
|
_loader = createSiteLoader({
|
|
141
193
|
dirPath: contentDir,
|
|
142
194
|
basePath: '/',
|
|
@@ -145,6 +197,9 @@ export function createRefraktLoader(options) {
|
|
|
145
197
|
plugins: ctx.communityPackages,
|
|
146
198
|
variables: options?.variables,
|
|
147
199
|
securityPolicy: options?.security,
|
|
200
|
+
projectRoot: configDir,
|
|
201
|
+
xrefPatterns,
|
|
202
|
+
fileRoots: Object.keys(fileRoots).length > 0 ? fileRoots : undefined,
|
|
148
203
|
dev: options?.dev ?? false,
|
|
149
204
|
});
|
|
150
205
|
})();
|
|
@@ -188,7 +243,9 @@ export function createRefraktLoader(options) {
|
|
|
188
243
|
* dependencies in the host environment.
|
|
189
244
|
*/
|
|
190
245
|
export function createVirtualRefraktLoader(options) {
|
|
191
|
-
const { site, tree, reader, variables, security, basePath, dev } = options;
|
|
246
|
+
const { site, tree, reader, variables, security, basePath, projectRoot, xrefs, fileRoots: userFileRootsOption, dev } = options;
|
|
247
|
+
const xrefPatterns = compileConfiguredXrefPatterns(xrefs);
|
|
248
|
+
const userFileRoots = userFileRootsOption ?? {};
|
|
192
249
|
let _initPromise = null;
|
|
193
250
|
let _transform = null;
|
|
194
251
|
let _loader = null;
|
|
@@ -199,6 +256,27 @@ export function createVirtualRefraktLoader(options) {
|
|
|
199
256
|
_initPromise = (async () => {
|
|
200
257
|
const ctx = await assembleSiteContext(site);
|
|
201
258
|
_transform = ctx.transform;
|
|
259
|
+
// Plugin `configure` lifecycle — same as in createRefraktLoader.
|
|
260
|
+
// Virtual hosts pass the pre-resolved SiteConfig directly; plugins
|
|
261
|
+
// see the per-site config object rather than a full RefraktConfig.
|
|
262
|
+
const dynamicFileRoots = {};
|
|
263
|
+
const registerFileRoot = (namespace, absolutePath) => {
|
|
264
|
+
dynamicFileRoots[namespace] = absolutePath;
|
|
265
|
+
};
|
|
266
|
+
for (const pkg of ctx.communityPackages ?? []) {
|
|
267
|
+
if (pkg.pipeline?.configure) {
|
|
268
|
+
await pkg.pipeline.configure({
|
|
269
|
+
config: site,
|
|
270
|
+
configDir: projectRoot ?? '',
|
|
271
|
+
registerFileRoot,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const pluginRoots = { ...ctx.pluginFileRoots, ...dynamicFileRoots };
|
|
276
|
+
const { roots: fileRoots, warnings: fileRootWarnings } = mergeFileRoots(userFileRoots, pluginRoots);
|
|
277
|
+
for (const warning of fileRootWarnings) {
|
|
278
|
+
process.stderr.write(`refrakt: ${warning}\n`);
|
|
279
|
+
}
|
|
202
280
|
_loader = createVirtualSiteLoader({
|
|
203
281
|
tree,
|
|
204
282
|
basePath: basePath ?? '/',
|
|
@@ -208,6 +286,9 @@ export function createVirtualRefraktLoader(options) {
|
|
|
208
286
|
variables,
|
|
209
287
|
securityPolicy: security,
|
|
210
288
|
reader,
|
|
289
|
+
projectRoot,
|
|
290
|
+
xrefPatterns,
|
|
291
|
+
fileRoots: Object.keys(fileRoots).length > 0 ? fileRoots : undefined,
|
|
211
292
|
dev: dev ?? false,
|
|
212
293
|
});
|
|
213
294
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refract-loader.js","sourceRoot":"","sources":["../src/refract-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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OAAO;YACZ,MAAM,IAAI,EAAE,CAAC;YACb,OAAO,OAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;QAED,KAAK,CAAC,YAAY;YACjB,MAAM,IAAI,EAAE,CAAC;YACb,OAAO,UAAW,CAAC;QACpB,CAAC;QAED,KAAK,CAAC,qBAAqB;YAC1B,IAAI,GAAG;gBAAE,OAAO,GAAG,CAAC;YACpB,MAAM,EAAE,wBAAwB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;YAC3E,GAAG,GAAG,MAAM,wBAAwB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;YAClE,OAAO,GAAG,CAAC;QACZ,CAAC;QAED,cAAc;YACb,OAAO,EAAE,UAAU,EAAE,CAAC;QACvB,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -6,7 +6,13 @@ import type { EntityRegistration, EntityRegistry } from '@refrakt-md/types';
|
|
|
6
6
|
* - byTypeAndId: primary index for getAll() and getById()
|
|
7
7
|
* - byTypeAndUrl: secondary index for getByUrl()
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Page-scoped entries (SPEC-060, WORK-256) are keyed internally by
|
|
10
|
+
* `${sourceUrl}::${id}` in the primary index, so two pages can register
|
|
11
|
+
* the same `(type, id)` without colliding. Site-scoped entries (the
|
|
12
|
+
* default) keep using the bare `id` as their key, preserving the
|
|
13
|
+
* pre-WORK-256 collision semantics (last-write-wins on `(type, id)`).
|
|
14
|
+
*
|
|
15
|
+
* On collision within the same scope, the last registration wins.
|
|
10
16
|
*/
|
|
11
17
|
export declare class EntityRegistryImpl implements EntityRegistry {
|
|
12
18
|
private byTypeAndId;
|
|
@@ -16,8 +22,21 @@ export declare class EntityRegistryImpl implements EntityRegistry {
|
|
|
16
22
|
getAll(type: string): EntityRegistration[];
|
|
17
23
|
/** All entities of a given type registered from a specific page URL */
|
|
18
24
|
getByUrl(type: string, url: string): EntityRegistration[];
|
|
19
|
-
/** Find a specific entity by type and id
|
|
20
|
-
|
|
25
|
+
/** Find a specific entity by type and id. Lookup order:
|
|
26
|
+
* 1. **Page-scoped match from `pageUrl`** — when `pageUrl` is provided,
|
|
27
|
+
* check for a page-scoped entry registered from that page. Fragments
|
|
28
|
+
* and trailing slashes are normalised so callers may pass the URL in
|
|
29
|
+
* any shape an adapter produces.
|
|
30
|
+
* 2. **Site-scoped match** — the entry registered with the bare `id`.
|
|
31
|
+
* 3. **Cross-page fallback** — when neither of the above hits, scan
|
|
32
|
+
* for any page-scoped entry with the same id from any page. This
|
|
33
|
+
* is the SPEC-060 cross-page drawer-trigger path: a drawer
|
|
34
|
+
* registered on page A is still findable when a xref on page B
|
|
35
|
+
* references its id. Returns the first match in registration
|
|
36
|
+
* order; cross-page id collisions are extraordinary enough that
|
|
37
|
+
* callers wanting strict resolution can pass `pageUrl` and check
|
|
38
|
+
* `sourceUrl` on the returned entry. */
|
|
39
|
+
getById(type: string, id: string, pageUrl?: string): EntityRegistration | undefined;
|
|
21
40
|
/** All registered entity type names */
|
|
22
41
|
getTypes(): string[];
|
|
23
42
|
}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;;;;;;;;;;;;GAcG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACxD,OAAO,CAAC,WAAW,CAAsD;IACzE,OAAO,CAAC,YAAY,CAAwD;IAE5E,QAAQ,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAyCzC,0DAA0D;IAC1D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAM1C,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAIzD;;;;;;;;;;;;;gDAa4C;IAC5C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAiBnF,uCAAuC;IACvC,QAAQ,IAAI,MAAM,EAAE;CAGpB"}
|
package/dist/registry.js
CHANGED
|
@@ -5,39 +5,54 @@
|
|
|
5
5
|
* - byTypeAndId: primary index for getAll() and getById()
|
|
6
6
|
* - byTypeAndUrl: secondary index for getByUrl()
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Page-scoped entries (SPEC-060, WORK-256) are keyed internally by
|
|
9
|
+
* `${sourceUrl}::${id}` in the primary index, so two pages can register
|
|
10
|
+
* the same `(type, id)` without colliding. Site-scoped entries (the
|
|
11
|
+
* default) keep using the bare `id` as their key, preserving the
|
|
12
|
+
* pre-WORK-256 collision semantics (last-write-wins on `(type, id)`).
|
|
13
|
+
*
|
|
14
|
+
* On collision within the same scope, the last registration wins.
|
|
9
15
|
*/
|
|
10
16
|
export class EntityRegistryImpl {
|
|
11
17
|
byTypeAndId = new Map();
|
|
12
18
|
byTypeAndUrl = new Map();
|
|
13
19
|
register(entry) {
|
|
20
|
+
// Normalize empty-string sourceUrl to undefined — distinguishing
|
|
21
|
+
// "explicitly empty" from "missing" isn't useful, and the resolver
|
|
22
|
+
// treats both the same downstream.
|
|
23
|
+
const normalized = entry.sourceUrl === '' ? { ...entry, sourceUrl: undefined } : entry;
|
|
24
|
+
const key = primaryKey(normalized);
|
|
14
25
|
// Primary index
|
|
15
|
-
let typeMap = this.byTypeAndId.get(
|
|
26
|
+
let typeMap = this.byTypeAndId.get(normalized.type);
|
|
16
27
|
if (!typeMap) {
|
|
17
28
|
typeMap = new Map();
|
|
18
|
-
this.byTypeAndId.set(
|
|
19
|
-
}
|
|
20
|
-
typeMap.set(entry.id, entry);
|
|
21
|
-
// Secondary index
|
|
22
|
-
let urlMap = this.byTypeAndUrl.get(entry.type);
|
|
23
|
-
if (!urlMap) {
|
|
24
|
-
urlMap = new Map();
|
|
25
|
-
this.byTypeAndUrl.set(entry.type, urlMap);
|
|
29
|
+
this.byTypeAndId.set(normalized.type, typeMap);
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
typeMap.set(key, normalized);
|
|
32
|
+
// Secondary index — only meaningful when the entity has a sourceUrl.
|
|
33
|
+
// Entries without one (plan content not published to any site, etc.)
|
|
34
|
+
// are still in the primary index for getById; they just don't
|
|
35
|
+
// participate in URL-based lookups.
|
|
36
|
+
if (normalized.sourceUrl !== undefined) {
|
|
37
|
+
let urlMap = this.byTypeAndUrl.get(normalized.type);
|
|
38
|
+
if (!urlMap) {
|
|
39
|
+
urlMap = new Map();
|
|
40
|
+
this.byTypeAndUrl.set(normalized.type, urlMap);
|
|
41
|
+
}
|
|
42
|
+
const urlList = urlMap.get(normalized.sourceUrl);
|
|
43
|
+
if (urlList) {
|
|
44
|
+
const idx = urlList.findIndex(e => sameIdentity(e, normalized));
|
|
45
|
+
if (idx >= 0) {
|
|
46
|
+
urlList[idx] = normalized;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
urlList.push(normalized);
|
|
50
|
+
}
|
|
33
51
|
}
|
|
34
52
|
else {
|
|
35
|
-
|
|
53
|
+
urlMap.set(normalized.sourceUrl, [normalized]);
|
|
36
54
|
}
|
|
37
55
|
}
|
|
38
|
-
else {
|
|
39
|
-
urlMap.set(entry.sourceUrl, [entry]);
|
|
40
|
-
}
|
|
41
56
|
}
|
|
42
57
|
/** All entities of a given type, in registration order */
|
|
43
58
|
getAll(type) {
|
|
@@ -50,13 +65,81 @@ export class EntityRegistryImpl {
|
|
|
50
65
|
getByUrl(type, url) {
|
|
51
66
|
return this.byTypeAndUrl.get(type)?.get(url) ?? [];
|
|
52
67
|
}
|
|
53
|
-
/** Find a specific entity by type and id
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
/** Find a specific entity by type and id. Lookup order:
|
|
69
|
+
* 1. **Page-scoped match from `pageUrl`** — when `pageUrl` is provided,
|
|
70
|
+
* check for a page-scoped entry registered from that page. Fragments
|
|
71
|
+
* and trailing slashes are normalised so callers may pass the URL in
|
|
72
|
+
* any shape an adapter produces.
|
|
73
|
+
* 2. **Site-scoped match** — the entry registered with the bare `id`.
|
|
74
|
+
* 3. **Cross-page fallback** — when neither of the above hits, scan
|
|
75
|
+
* for any page-scoped entry with the same id from any page. This
|
|
76
|
+
* is the SPEC-060 cross-page drawer-trigger path: a drawer
|
|
77
|
+
* registered on page A is still findable when a xref on page B
|
|
78
|
+
* references its id. Returns the first match in registration
|
|
79
|
+
* order; cross-page id collisions are extraordinary enough that
|
|
80
|
+
* callers wanting strict resolution can pass `pageUrl` and check
|
|
81
|
+
* `sourceUrl` on the returned entry. */
|
|
82
|
+
getById(type, id, pageUrl) {
|
|
83
|
+
const typeMap = this.byTypeAndId.get(type);
|
|
84
|
+
if (!typeMap)
|
|
85
|
+
return undefined;
|
|
86
|
+
if (pageUrl !== undefined) {
|
|
87
|
+
const normalized = normalizePageUrl(stripFragment(pageUrl));
|
|
88
|
+
const pageHit = typeMap.get(pageScopedKey(normalized, id));
|
|
89
|
+
if (pageHit)
|
|
90
|
+
return pageHit;
|
|
91
|
+
}
|
|
92
|
+
const siteHit = typeMap.get(id);
|
|
93
|
+
if (siteHit)
|
|
94
|
+
return siteHit;
|
|
95
|
+
// Cross-page fallback for page-scoped entries with this id.
|
|
96
|
+
for (const entry of typeMap.values()) {
|
|
97
|
+
if (entry.id === id && entry.scope === 'page')
|
|
98
|
+
return entry;
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
56
101
|
}
|
|
57
102
|
/** All registered entity type names */
|
|
58
103
|
getTypes() {
|
|
59
104
|
return [...this.byTypeAndId.keys()];
|
|
60
105
|
}
|
|
61
106
|
}
|
|
107
|
+
/** Internal storage key for an entry. Site-scoped uses the bare id (so
|
|
108
|
+
* pre-WORK-256 callers keep working unchanged); page-scoped namespaces
|
|
109
|
+
* by the normalised page part of sourceUrl (fragment stripped, trailing
|
|
110
|
+
* slash trimmed) so the same id on the same page lands in one bucket
|
|
111
|
+
* regardless of href shape. A page-scoped entry without a usable
|
|
112
|
+
* sourceUrl falls back to the site-scoped key — that path is degenerate
|
|
113
|
+
* (it'll collide with site-scoped entries of the same id) and reflects
|
|
114
|
+
* a misconfiguration at the registration site rather than something the
|
|
115
|
+
* registry can recover from. */
|
|
116
|
+
function primaryKey(entry) {
|
|
117
|
+
if (entry.scope === 'page' && entry.sourceUrl) {
|
|
118
|
+
return pageScopedKey(normalizePageUrl(stripFragment(entry.sourceUrl)), entry.id);
|
|
119
|
+
}
|
|
120
|
+
return entry.id;
|
|
121
|
+
}
|
|
122
|
+
function pageScopedKey(pageUrl, id) {
|
|
123
|
+
return `${pageUrl}::${id}`;
|
|
124
|
+
}
|
|
125
|
+
function stripFragment(url) {
|
|
126
|
+
const i = url.indexOf('#');
|
|
127
|
+
return i === -1 ? url : url.slice(0, i);
|
|
128
|
+
}
|
|
129
|
+
/** Normalise a page URL for keying purposes — strip a trailing slash so
|
|
130
|
+
* adapters that emit `/x/` and ones that emit `/x` (or the resolver
|
|
131
|
+
* passing either form) coalesce into one bucket. Root (`/`) is preserved. */
|
|
132
|
+
function normalizePageUrl(url) {
|
|
133
|
+
if (url.length > 1 && url.endsWith('/'))
|
|
134
|
+
return url.slice(0, -1);
|
|
135
|
+
return url;
|
|
136
|
+
}
|
|
137
|
+
/** Two registrations refer to the same logical entry when their identity
|
|
138
|
+
* fields line up — used by the byTypeAndUrl secondary index to dedupe
|
|
139
|
+
* re-registrations from the same page. Scope participates because the
|
|
140
|
+
* same `(type, id)` can legitimately exist twice on a page when one is
|
|
141
|
+
* site-scoped and the other page-scoped (rare, but well-defined). */
|
|
142
|
+
function sameIdentity(a, b) {
|
|
143
|
+
return a.id === b.id && (a.scope ?? 'site') === (b.scope ?? 'site');
|
|
144
|
+
}
|
|
62
145
|
//# sourceMappingURL=registry.js.map
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAkB;IACtB,WAAW,GAAG,IAAI,GAAG,EAA2C,CAAC;IACjE,YAAY,GAAG,IAAI,GAAG,EAA6C,CAAC;IAE5E,QAAQ,CAAC,KAAyB;QACjC,iEAAiE;QACjE,mEAAmE;QACnE,mCAAmC;QACnC,MAAM,UAAU,GACf,KAAK,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAErE,MAAM,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;QAEnC,gBAAgB;QAChB,IAAI,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAE7B,qEAAqE;QACrE,qEAAqE;QACrE,8DAA8D;QAC9D,oC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AC,CAAC;IAClF,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAC,OAAe,EAAE,EAAU;IACjD,OAAO,GAAG,OAAO,KAAK,EAAE,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IACjC,MAAM,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC;AAED;;8EAE8E;AAC9E,SAAS,gBAAgB,CAAC,GAAW;IACpC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;sEAIsE;AACtE,SAAS,YAAY,CAAC,CAAqB,EAAE,CAAqB;IACjE,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/site.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RenderableTreeNodes, Schema } from '@markdoc/markdoc';
|
|
2
|
+
import type { CompiledXrefPattern } from '@refrakt-md/runes';
|
|
2
3
|
import type { PageSeo, HeadingInfo } from '@refrakt-md/runes';
|
|
3
4
|
import type { Plugin, PipelineWarning, AggregatedData, SecurityPolicy } from '@refrakt-md/types';
|
|
4
5
|
import type { PipelineStats } from './pipeline.js';
|
|
@@ -8,6 +9,7 @@ import { Route } from './router.js';
|
|
|
8
9
|
import { ResolvedLayout } from './layout.js';
|
|
9
10
|
import { type ResolvedTintCascade } from './tint-cascade.js';
|
|
10
11
|
import { NavTree } from './navigation.js';
|
|
12
|
+
import { type FileRoots } from './file-roots.js';
|
|
11
13
|
/** Async reader for ad-hoc lookups in virtual (non-FS) hosting environments.
|
|
12
14
|
* Returns the file content or `null` when the path is unknown. */
|
|
13
15
|
export type VirtualReader = (path: string) => Promise<string | null>;
|
|
@@ -54,7 +56,7 @@ export interface SitePage {
|
|
|
54
56
|
* to `'trusted'` (current behaviour). Set `'strict'` for hosted-product use
|
|
55
57
|
* to strip scripts and harden the sandbox iframe.
|
|
56
58
|
*/
|
|
57
|
-
export declare function loadContent(dirPath: string, basePath?: string, icons?: Record<string, Record<string, string>>, additionalTags?: Record<string, Schema>, packages?: Plugin[], sandboxExamplesDir?: string, variables?: Record<string, unknown>, securityPolicy?: SecurityPolicy): Promise<Site>;
|
|
59
|
+
export declare function loadContent(dirPath: string, basePath?: string, icons?: Record<string, Record<string, string>>, additionalTags?: Record<string, Schema>, packages?: Plugin[], sandboxExamplesDir?: string, variables?: Record<string, unknown>, securityPolicy?: SecurityPolicy, projectRoot?: string, xrefPatterns?: CompiledXrefPattern[], fileRoots?: FileRoots): Promise<Site>;
|
|
58
60
|
/** Options accepted by {@link loadContentFromTree}. */
|
|
59
61
|
export interface LoadContentFromTreeOptions {
|
|
60
62
|
/** URL base path for the Router. Default: `'/'`. */
|
|
@@ -81,6 +83,18 @@ export interface LoadContentFromTreeOptions {
|
|
|
81
83
|
* hosts can wire it once and not need to thread it again when new internal
|
|
82
84
|
* consumers land. */
|
|
83
85
|
reader?: VirtualReader;
|
|
86
|
+
/** Absolute path to the project root (where `refrakt.config.json` lives).
|
|
87
|
+
* Used to compute `$file.path` as a project-root-relative POSIX path.
|
|
88
|
+
* When omitted, `$file.path` falls back to the page's content-root-relative
|
|
89
|
+
* path. Hosted environments that have a meaningful project-root concept
|
|
90
|
+
* should pass it; pure in-memory hosts that don't can leave it undefined. */
|
|
91
|
+
projectRoot?: string;
|
|
92
|
+
/** Compiled xref patterns from `refrakt.config.json#/xrefs`. Hosted
|
|
93
|
+
* environments that own their config resolution can compile patterns via
|
|
94
|
+
* `compileXrefPatterns` and pass them here. */
|
|
95
|
+
xrefPatterns?: CompiledXrefPattern[];
|
|
96
|
+
/** Registered file roots — namespace → absolute directory path. */
|
|
97
|
+
fileRoots?: FileRoots;
|
|
84
98
|
}
|
|
85
99
|
/**
|
|
86
100
|
* Like {@link loadContent}, but driven by a pre-built {@link ContentTree}
|
package/dist/site.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAQ,mBAAmB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEjG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAoB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAkB,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAQ,mBAAmB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1E,O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,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;sEAEkE;IAClE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACxC;;;;;;0BAMsB;IACtB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;;;kFAI8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;oDAEgD;IAChD,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,mEAAmE;IACnE,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,WAAW,EACjB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
package/dist/site.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
2
|
+
import { resolve, relative, sep as pathSep, posix as pathPosix } from 'node:path';
|
|
3
3
|
import Markdoc from '@markdoc/markdoc';
|
|
4
|
-
import { tags, nodes, extractHeadings, extractSeo, corePipelineHooks, escapeFenceTags, resolveCoreSentinels } from '@refrakt-md/runes';
|
|
4
|
+
import { tags, nodes, extractHeadings, firstH1, extractSeo, corePipelineHooks, createCorePipelineHooks, escapeFenceTags, resolveCoreSentinels } from '@refrakt-md/runes';
|
|
5
5
|
import { resolveSecurityPolicy } from '@refrakt-md/types';
|
|
6
6
|
import { ContentTree } from './content-tree.js';
|
|
7
7
|
import { parseFrontmatter } from './frontmatter.js';
|
|
@@ -10,6 +10,7 @@ import { resolveLayouts } from './layout.js';
|
|
|
10
10
|
import { resolveTintCascade } from './tint-cascade.js';
|
|
11
11
|
import { runPipeline } from './pipeline.js';
|
|
12
12
|
import { getGitTimestamps, resolveTimestamps } from './timestamps.js';
|
|
13
|
+
import { readFileRoots } from './file-roots.js';
|
|
13
14
|
/** Synchronous file reader that returns null on failure. */
|
|
14
15
|
function sandboxReadFile(p) {
|
|
15
16
|
try {
|
|
@@ -37,8 +38,7 @@ function sandboxDirExists(p) {
|
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
function transformContent(content, path, sourcePath, icons, additionalTags, contentVariables, partials) {
|
|
41
|
-
const ast = Markdoc.parse(escapeFenceTags(content));
|
|
41
|
+
function transformContent(ast, content, path, sourcePath, icons, additionalTags, contentVariables, partials) {
|
|
42
42
|
const headings = extractHeadings(ast);
|
|
43
43
|
const mergedTags = additionalTags ? { ...tags, ...additionalTags } : tags;
|
|
44
44
|
const config = { tags: mergedTags, nodes, variables: {
|
|
@@ -51,6 +51,38 @@ function transformContent(content, path, sourcePath, icons, additionalTags, cont
|
|
|
51
51
|
}
|
|
52
52
|
return { renderable: Markdoc.transform(ast, config), headings };
|
|
53
53
|
}
|
|
54
|
+
/** Convert a host-OS file path to POSIX form (forward slashes). */
|
|
55
|
+
function posixPath(p) {
|
|
56
|
+
return pathSep === '/' ? p : p.split(pathSep).join('/');
|
|
57
|
+
}
|
|
58
|
+
/** POSIX dirname with the `"."` (no-directory) sentinel mapped to `""` so
|
|
59
|
+
* callers don't have to special-case content-root pages. */
|
|
60
|
+
function posixDirname(p) {
|
|
61
|
+
const dir = pathPosix.dirname(posixPath(p));
|
|
62
|
+
return dir === '.' ? '' : dir;
|
|
63
|
+
}
|
|
64
|
+
/** Project-root-relative path in POSIX form. */
|
|
65
|
+
function posixRelativeFromRoot(projectRoot, absolutePath) {
|
|
66
|
+
return posixPath(relative(projectRoot, absolutePath));
|
|
67
|
+
}
|
|
68
|
+
/** Last URL segment, stripping any trailing slash. Empty string for `/`. */
|
|
69
|
+
function lastUrlSegment(url) {
|
|
70
|
+
const trimmed = url.replace(/\/+$/, '');
|
|
71
|
+
const idx = trimmed.lastIndexOf('/');
|
|
72
|
+
return idx === -1 ? trimmed : trimmed.slice(idx + 1);
|
|
73
|
+
}
|
|
74
|
+
/** Derive the page title: trimmed non-empty frontmatter.title wins, else
|
|
75
|
+
* the first H1 in the AST (depth-first, walking into tag children), else
|
|
76
|
+
* undefined. */
|
|
77
|
+
function derivePageTitle(frontmatter, ast) {
|
|
78
|
+
const raw = frontmatter.title;
|
|
79
|
+
if (typeof raw === 'string') {
|
|
80
|
+
const trimmed = raw.trim();
|
|
81
|
+
if (trimmed.length > 0)
|
|
82
|
+
return trimmed;
|
|
83
|
+
}
|
|
84
|
+
return firstH1(ast);
|
|
85
|
+
}
|
|
54
86
|
const nullSandboxHooks = {
|
|
55
87
|
read: () => null,
|
|
56
88
|
list: () => [],
|
|
@@ -62,25 +94,95 @@ async function processContentTree(tree, opts) {
|
|
|
62
94
|
const pages = [];
|
|
63
95
|
const sandbox = opts.sandbox ?? nullSandboxHooks;
|
|
64
96
|
const gitTimestamps = opts.gitTimestamps ?? new Map();
|
|
65
|
-
// Pre-parse partials into Markdoc ASTs for the transform config
|
|
97
|
+
// Pre-parse partials into Markdoc ASTs for the transform config. Two
|
|
98
|
+
// sources contribute:
|
|
99
|
+
// - Site-local `_partials/` directory (already-scanned by ContentTree;
|
|
100
|
+
// keys are unprefixed relative paths like `footer.md`).
|
|
101
|
+
// - Registered file roots (project-wide; keys are namespaced like
|
|
102
|
+
// `shared:footer.md`). Plugins can also contribute roots via
|
|
103
|
+
// `Plugin.fileRoots`; both arrive in `opts.fileRoots` already
|
|
104
|
+
// merged by the loader bootstrap.
|
|
66
105
|
const partialFiles = tree.partials();
|
|
106
|
+
const namespacedPartials = opts.fileRoots && Object.keys(opts.fileRoots).length > 0
|
|
107
|
+
? await readFileRoots(opts.fileRoots)
|
|
108
|
+
: new Map();
|
|
67
109
|
let parsedPartials;
|
|
68
|
-
if (partialFiles.size > 0) {
|
|
110
|
+
if (partialFiles.size > 0 || namespacedPartials.size > 0) {
|
|
69
111
|
parsedPartials = {};
|
|
70
112
|
for (const [name, partial] of partialFiles) {
|
|
71
113
|
parsedPartials[name] = Markdoc.parse(escapeFenceTags(partial.raw));
|
|
72
114
|
}
|
|
115
|
+
for (const [name, partial] of namespacedPartials) {
|
|
116
|
+
parsedPartials[name] = Markdoc.parse(escapeFenceTags(partial.raw));
|
|
117
|
+
}
|
|
73
118
|
}
|
|
119
|
+
// Build hook sets here (rather than after the per-page loop, as before)
|
|
120
|
+
// so the preprocess phase can run during page processing — each hook set
|
|
121
|
+
// gets a chance to rewrite the parsed AST before the transform runs.
|
|
122
|
+
// The core hook set carries snippet's preprocess implementation (SPEC-062);
|
|
123
|
+
// plugins that register their own preprocess hooks plug in alongside.
|
|
124
|
+
//
|
|
125
|
+
// The merged tags + nodes (core + every loaded plugin) are also threaded
|
|
126
|
+
// through to the core hooks as `embedConfig` — expand (SPEC-066) needs
|
|
127
|
+
// them to re-transform extracted entity subtrees using the same schemas
|
|
128
|
+
// the host page used.
|
|
129
|
+
const embedTags = opts.additionalTags ? { ...tags, ...opts.additionalTags } : tags;
|
|
130
|
+
const coreHooksOptions = {
|
|
131
|
+
xrefPatterns: opts.xrefPatterns,
|
|
132
|
+
embedConfig: {
|
|
133
|
+
tags: embedTags,
|
|
134
|
+
nodes: nodes,
|
|
135
|
+
projectRoot: opts.projectRoot,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
const coreHooks = (opts.xrefPatterns && opts.xrefPatterns.length > 0) || opts.projectRoot
|
|
139
|
+
? createCorePipelineHooks(coreHooksOptions)
|
|
140
|
+
: corePipelineHooks;
|
|
141
|
+
const hookSets = [{ pluginName: '__core__', hooks: coreHooks }];
|
|
142
|
+
for (const pkg of opts.plugins ?? []) {
|
|
143
|
+
if (pkg.pipeline) {
|
|
144
|
+
hookSets.push({ pluginName: pkg.name, hooks: pkg.pipeline });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// Per-page preprocess context — file-system + project-root shared with the
|
|
148
|
+
// transform-time sandbox but exposed at preprocess time (variables aren't
|
|
149
|
+
// available yet). Warnings accumulate into a per-page array that callers
|
|
150
|
+
// funnel through the standard pipeline-warnings surface.
|
|
151
|
+
const preprocessWarnings = [];
|
|
152
|
+
const makePreprocessCtx = (pageUrl, variables) => ({
|
|
153
|
+
info(message, url) { preprocessWarnings.push({ severity: 'info', message, url: url ?? pageUrl }); },
|
|
154
|
+
warn(message, url) { preprocessWarnings.push({ severity: 'warning', message, url: url ?? pageUrl }); },
|
|
155
|
+
error(message, url) { preprocessWarnings.push({ severity: 'error', message, url: url ?? pageUrl }); },
|
|
156
|
+
projectRoot: opts.projectRoot,
|
|
157
|
+
sandbox: opts.sandbox,
|
|
158
|
+
variables,
|
|
159
|
+
});
|
|
74
160
|
for (const page of tree.pages()) {
|
|
75
161
|
const { frontmatter, content } = parseFrontmatter(page.raw);
|
|
76
162
|
const route = router.resolve(page.relativePath, frontmatter);
|
|
77
163
|
const layout = resolveLayouts(page, tree.root, opts.icons);
|
|
78
164
|
const fileTimestamps = resolveTimestamps(page.relativePath, page.filePath, gitTimestamps, frontmatter);
|
|
165
|
+
let ast = Markdoc.parse(escapeFenceTags(content));
|
|
166
|
+
// Compute the page-variable surface before preprocess so file-reading
|
|
167
|
+
// preprocessors (snippet) can resolve `path=$file.path` style attribute
|
|
168
|
+
// references against the same variables a transform-time evaluator would.
|
|
169
|
+
const pagePath = posixPath(page.relativePath);
|
|
170
|
+
const filePath = opts.projectRoot
|
|
171
|
+
? posixRelativeFromRoot(opts.projectRoot, page.filePath)
|
|
172
|
+
: pagePath;
|
|
79
173
|
const contentVariables = {
|
|
80
174
|
...opts.variables,
|
|
81
175
|
frontmatter,
|
|
82
|
-
page: {
|
|
176
|
+
page: {
|
|
177
|
+
url: route.url,
|
|
178
|
+
path: pagePath,
|
|
179
|
+
dir: posixDirname(page.relativePath),
|
|
180
|
+
slug: lastUrlSegment(route.url),
|
|
181
|
+
title: derivePageTitle(frontmatter, ast),
|
|
182
|
+
draft: route.draft,
|
|
183
|
+
},
|
|
83
184
|
file: {
|
|
185
|
+
path: filePath,
|
|
84
186
|
created: fileTimestamps.created,
|
|
85
187
|
modified: fileTimestamps.modified,
|
|
86
188
|
},
|
|
@@ -90,21 +192,42 @@ async function processContentTree(tree, opts) {
|
|
|
90
192
|
__sandboxExamplesDir: opts.sandboxExamplesDir,
|
|
91
193
|
__securityPolicy: resolvedSecurity,
|
|
92
194
|
};
|
|
93
|
-
|
|
195
|
+
// SPEC-062 preprocess phase — runs after variables are computed (so
|
|
196
|
+
// hooks can resolve `path=$file.path`-style attribute references against
|
|
197
|
+
// them) and before the schema-driven transform. Snippet pre-resolves
|
|
198
|
+
// itself into a fence node here; the returned AST (or the mutated one
|
|
199
|
+
// if void) feeds the transform.
|
|
200
|
+
const pageMeta = {
|
|
201
|
+
url: route.url,
|
|
202
|
+
relativePath: page.relativePath,
|
|
203
|
+
filePath: page.filePath,
|
|
204
|
+
};
|
|
205
|
+
const ppCtx = makePreprocessCtx(route.url, contentVariables);
|
|
206
|
+
for (const { hooks } of hookSets) {
|
|
207
|
+
if (!hooks.preprocess)
|
|
208
|
+
continue;
|
|
209
|
+
const next = await hooks.preprocess(ast, pageMeta, ppCtx);
|
|
210
|
+
if (next)
|
|
211
|
+
ast = next;
|
|
212
|
+
}
|
|
213
|
+
const { renderable, headings } = transformContent(ast, content, route.url, page.relativePath, opts.icons, opts.additionalTags, contentVariables, parsedPartials);
|
|
94
214
|
const seo = extractSeo(renderable, frontmatter, route.url);
|
|
95
215
|
const tintCascade = resolveTintCascade(page, tree.root, {
|
|
96
216
|
colorScheme: opts.colorScheme,
|
|
97
217
|
});
|
|
98
218
|
pages.push({ route, frontmatter, content, renderable, headings, layout, seo, tintCascade });
|
|
99
219
|
}
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (pkg.pipeline) {
|
|
104
|
-
hookSets.push({ pluginName: pkg.name, hooks: pkg.pipeline });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
220
|
+
// `hookSets` were built before the per-page loop so the preprocess phase
|
|
221
|
+
// could run during page processing. They're reused here for register /
|
|
222
|
+
// aggregate / postProcess.
|
|
107
223
|
const { pages: enrichedPages, warnings, stats, aggregated } = await runPipeline(pages, hookSets);
|
|
224
|
+
// Funnel any preprocess-phase diagnostics (file-not-found, sandbox rejections,
|
|
225
|
+
// line-range clamps) into the same warnings array the rest of the pipeline
|
|
226
|
+
// uses. Preprocess runs before `runPipeline`, so its warnings would otherwise
|
|
227
|
+
// be invisible to adapters that only print the pipeline summary.
|
|
228
|
+
for (const w of preprocessWarnings) {
|
|
229
|
+
warnings.push({ severity: w.severity, phase: 'register', pluginName: '__preprocess__', url: w.url, message: w.message });
|
|
230
|
+
}
|
|
108
231
|
// Apply auto-resolutions to layout regions per page. Layouts are parsed once
|
|
109
232
|
// and shared across pages, but the auto-open / auto-pagination sentinels need
|
|
110
233
|
// per-page context (current URL, sibling order). The pipeline already wired
|
|
@@ -172,11 +295,16 @@ function makeContextForRegions(warnings, url) {
|
|
|
172
295
|
* to `'trusted'` (current behaviour). Set `'strict'` for hosted-product use
|
|
173
296
|
* to strip scripts and harden the sandbox iframe.
|
|
174
297
|
*/
|
|
175
|
-
export async function loadContent(dirPath, basePath = '/', icons, additionalTags, packages, sandboxExamplesDir, variables, securityPolicy) {
|
|
298
|
+
export async function loadContent(dirPath, basePath = '/', icons, additionalTags, packages, sandboxExamplesDir, variables, securityPolicy, projectRoot, xrefPatterns, fileRoots) {
|
|
176
299
|
const tree = await ContentTree.fromDirectory(dirPath);
|
|
177
300
|
const resolvedExamplesDir = sandboxExamplesDir
|
|
178
301
|
? resolve(sandboxExamplesDir)
|
|
179
302
|
: resolve(dirPath, '..', 'examples');
|
|
303
|
+
// Default to the content directory's parent (the common
|
|
304
|
+
// `<project>/site/content/` → `<project>/site/` layout). Adapters that
|
|
305
|
+
// know the real project root (the directory containing
|
|
306
|
+
// `refrakt.config.json`) should pass it explicitly.
|
|
307
|
+
const resolvedProjectRoot = projectRoot ?? resolve(dirPath, '..');
|
|
180
308
|
return processContentTree(tree, {
|
|
181
309
|
basePath,
|
|
182
310
|
icons,
|
|
@@ -191,6 +319,9 @@ export async function loadContent(dirPath, basePath = '/', icons, additionalTags
|
|
|
191
319
|
exists: sandboxDirExists,
|
|
192
320
|
},
|
|
193
321
|
sandboxExamplesDir: resolvedExamplesDir,
|
|
322
|
+
projectRoot: resolvedProjectRoot,
|
|
323
|
+
xrefPatterns,
|
|
324
|
+
fileRoots,
|
|
194
325
|
});
|
|
195
326
|
}
|
|
196
327
|
/**
|
|
@@ -221,6 +352,9 @@ export async function loadContentFromTree(tree, options = {}) {
|
|
|
221
352
|
variables: options.variables,
|
|
222
353
|
securityPolicy: options.securityPolicy,
|
|
223
354
|
colorScheme: options.colorScheme,
|
|
355
|
+
projectRoot: options.projectRoot,
|
|
356
|
+
xrefPatterns: options.xrefPatterns,
|
|
357
|
+
fileRoots: options.fileRoots,
|
|
224
358
|
});
|
|
225
359
|
}
|
|
226
360
|
//# sourceMappingURL=site.js.map
|
package/dist/site.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.js","sourceRoot":"","sources":["../src/site.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGvI,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAe,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAS,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAC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QAClC,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/content",
|
|
3
3
|
"description": "Content loading and transformation pipeline",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"build": "tsc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@refrakt-md/highlight": "0.
|
|
33
|
-
"@refrakt-md/runes": "0.
|
|
34
|
-
"@refrakt-md/transform": "0.
|
|
35
|
-
"@refrakt-md/types": "0.
|
|
32
|
+
"@refrakt-md/highlight": "0.15.0",
|
|
33
|
+
"@refrakt-md/runes": "0.15.0",
|
|
34
|
+
"@refrakt-md/transform": "0.15.0",
|
|
35
|
+
"@refrakt-md/types": "0.15.0",
|
|
36
36
|
"@markdoc/markdoc": "0.4.0",
|
|
37
37
|
"yaml": "^2.4.0"
|
|
38
38
|
}
|