pagegraph 0.11.0 → 0.12.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/README.md +140 -137
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +1 -1
- package/dist/build-only/audit.d.ts +1 -0
- package/dist/build-only/audit.js +6 -0
- package/dist/build-only/audit.js.map +1 -0
- package/dist/build-only/config.d.ts +1 -0
- package/dist/build-only/config.js +6 -0
- package/dist/build-only/config.js.map +1 -0
- package/dist/build-only/tanstack-start.d.ts +1 -0
- package/dist/build-only/tanstack-start.js +6 -0
- package/dist/build-only/tanstack-start.js.map +1 -0
- package/dist/build-only/vite.d.ts +1 -0
- package/dist/build-only/vite.js +6 -0
- package/dist/build-only/vite.js.map +1 -0
- package/dist/{checks-nk8ZRRIA.js → checks-uZk5Em9A.js} +3 -141
- package/dist/checks-uZk5Em9A.js.map +1 -0
- package/dist/cli.js +393 -287
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +7 -66
- package/dist/config.js +3 -122
- package/dist/config.js.map +1 -1
- package/dist/{content-DVL2iyGU.d.ts → content-B1cPtL8b.d.ts} +4 -128
- package/dist/{content-CB_kHmJ3.js → content-kcEnQdfi.js} +3 -2
- package/dist/{content-CB_kHmJ3.js.map → content-kcEnQdfi.js.map} +1 -1
- package/dist/declare-D5o7hwmv.js +9 -0
- package/dist/declare-D5o7hwmv.js.map +1 -0
- package/dist/declare-DVgdEdOL.d.ts +12127 -0
- package/dist/graph-Bcsourlv.js +162 -0
- package/dist/graph-Bcsourlv.js.map +1 -0
- package/dist/graph-BxCY90vq.d.ts +104 -0
- package/dist/graph-CBIY71w6.d.ts +57 -0
- package/dist/index.d.ts +37 -73
- package/dist/index.js +23 -134
- package/dist/index.js.map +1 -1
- package/dist/message-DT_CjUdt.js +12 -0
- package/dist/message-DT_CjUdt.js.map +1 -0
- package/dist/page-heads-6y-CARRQ.js +25 -0
- package/dist/page-heads-6y-CARRQ.js.map +1 -0
- package/dist/page-heads-DNkjMUEN.d.ts +21 -0
- package/dist/projections-D0oOFKiY.js +142 -0
- package/dist/projections-D0oOFKiY.js.map +1 -0
- package/dist/projections-DeEFe7XT.d.ts +78 -0
- package/dist/react.d.ts +26 -12051
- package/dist/react.js +12 -3
- package/dist/react.js.map +1 -1
- package/dist/route-config-35ZEzkNC.js +308 -0
- package/dist/route-config-35ZEzkNC.js.map +1 -0
- package/dist/route-config-wneg6ktn.d.ts +29 -0
- package/dist/tanstack-start/index.d.ts +40 -0
- package/dist/tanstack-start/index.js +368 -0
- package/dist/tanstack-start/index.js.map +1 -0
- package/dist/tanstack-start/server.d.ts +14 -0
- package/dist/tanstack-start/server.js +53 -0
- package/dist/tanstack-start/server.js.map +1 -0
- package/dist/vite-graph-loader-01p1WxEq.js +104 -0
- package/dist/vite-graph-loader-01p1WxEq.js.map +1 -0
- package/dist/vite-graph-loader-Btgjz5RH.d.ts +56 -0
- package/dist/vite.d.ts +2 -28
- package/dist/vite.js +1 -307
- package/dist/wire-B4RQMc4e.js +26 -0
- package/dist/wire-B4RQMc4e.js.map +1 -0
- package/package.json +27 -5
- package/dist/checks-nk8ZRRIA.js.map +0 -1
- package/dist/vite.js.map +0 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,67 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/** A graph, plus the release of whatever producing it acquired. */
|
|
5
|
-
interface LoadedSeoGraph {
|
|
6
|
-
readonly graph: SeoGraph;
|
|
7
|
-
/** Called once the command is done with the graph, on success or failure. */
|
|
8
|
-
readonly dispose: () => Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Produces the SEO graph for the `pagegraph` CLI. A plain promise on purpose: a
|
|
12
|
-
* config file must be writable without Effect, which the CLI keeps behind its
|
|
13
|
-
* `bin` (an optional peer dependency).
|
|
14
|
-
*/
|
|
15
|
-
/** JSON input that can be supplied by config files to an app graph export. */
|
|
16
|
-
type GraphLoaderInput = null | boolean | number | string | ReadonlyArray<GraphLoaderInput> | {
|
|
17
|
-
readonly [key: string]: GraphLoaderInput;
|
|
18
|
-
};
|
|
19
|
-
type SeoGraphLoader<Input extends GraphLoaderInput | void = void> = (input: Input) => Promise<LoadedSeoGraph>;
|
|
20
|
-
interface ViteGraphLoaderOptions {
|
|
21
|
-
/** The app's Vite root — the directory its aliases and plugins resolve against. */
|
|
22
|
-
readonly root: string;
|
|
23
|
-
/** Module exporting the graph loader, root-relative (e.g. `/lib/seo/graph.ts`). */
|
|
24
|
-
readonly entry: string;
|
|
25
|
-
/** Named export on `entry` returning `Promise<SeoGraph>`. Defaults to `loadSeoGraph`. */
|
|
26
|
-
readonly exportName?: string | undefined;
|
|
27
|
-
/** Vite plugins the app's module graph needs — a content/MDX plugin, say. */
|
|
28
|
-
readonly plugins?: ReadonlyArray<PluginOption> | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Bare or virtual module ids to replace with inert source, so a module that
|
|
31
|
-
* only resolves inside the app's server runtime does not break the load.
|
|
32
|
-
*/
|
|
33
|
-
readonly stubs?: Readonly<Record<string, string>> | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* Variables to seed on `process.env` before the app's modules parse it. Vite
|
|
36
|
-
* exposes prefixed values through `import.meta.env`, so this is how a module
|
|
37
|
-
* that demands an env var at import time is satisfied. Existing values win —
|
|
38
|
-
* a real `.env` is never clobbered.
|
|
39
|
-
*/
|
|
40
|
-
readonly env?: Readonly<Record<string, string>> | undefined;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Build a {@link SeoGraphLoader} that evaluates `entry` in a headless Vite
|
|
44
|
-
* server rooted at `root`, and returns what its `exportName` export resolves to.
|
|
45
|
-
*/
|
|
46
|
-
declare const viteGraphLoader: <Input extends GraphLoaderInput | void = void>(options: ViteGraphLoaderOptions) => SeoGraphLoader<Input>;
|
|
47
|
-
//#endregion
|
|
1
|
+
import { V as FreshnessPolicy, h as CoverageRule, r as ContentPolicy } from "./content-B1cPtL8b.js";
|
|
2
|
+
import { a as viteGraphLoader, i as ViteGraphLoaderOptions, n as LoadedSeoGraph, r as SeoGraphLoader, t as GraphLoaderInput } from "./vite-graph-loader-Btgjz5RH.js";
|
|
3
|
+
import { n as PageHeadsOptions, t as PageHead } from "./page-heads-DNkjMUEN.js";
|
|
48
4
|
//#region src/config/page-heads.d.ts
|
|
49
|
-
/** Plain document metadata, without framework or schema dependencies. */
|
|
50
|
-
interface PageHead {
|
|
51
|
-
readonly path: string;
|
|
52
|
-
readonly title: string;
|
|
53
|
-
readonly description: string;
|
|
54
|
-
}
|
|
55
|
-
interface PageHeadsOptions {
|
|
56
|
-
/** Path globs: `*` matches a segment, `**` matches across segments. */
|
|
57
|
-
readonly exclude?: ReadonlyArray<string>;
|
|
58
|
-
/** Exclude noindex pages, redirects and parameter templates. Defaults to true. */
|
|
59
|
-
readonly indexable?: boolean;
|
|
60
|
-
}
|
|
61
|
-
/** Select page nodes before the host resolves metadata; sitemap-disabled hubs remain pages. */
|
|
62
|
-
declare function selectPageHeadNodes(graph: SeoGraph, options?: PageHeadsOptions): Array<SeoNode>;
|
|
63
|
-
/** Extract resolved heads, naming the selected page when metadata is missing or blank. */
|
|
64
|
-
declare function pageHeads(graph: SeoGraph, options?: PageHeadsOptions): Array<PageHead>;
|
|
65
5
|
/** Acquire, extract and release a graph on both success and metadata failure. Bind loader input in a closure. */
|
|
66
6
|
declare function loadPageHeads(loader: SeoGraphLoader, options?: PageHeadsOptions): Promise<Array<PageHead>>;
|
|
67
7
|
//#endregion
|
|
@@ -95,10 +35,11 @@ interface SeoCliConfig {
|
|
|
95
35
|
*/
|
|
96
36
|
readonly origin: string;
|
|
97
37
|
/**
|
|
98
|
-
* Path prefixes disallowed in robots.txt.
|
|
38
|
+
* Path prefixes disallowed in robots.txt. Omit when the graph loader supplies
|
|
39
|
+
* the robots policy (`tanstackStartGraph`); otherwise feed it the generated
|
|
99
40
|
* `routeConfig.robotsExclusions` if you run the `pagegraph/vite` plugin.
|
|
100
41
|
*/
|
|
101
|
-
readonly disallow
|
|
42
|
+
readonly disallow?: ReadonlyArray<string> | undefined;
|
|
102
43
|
/**
|
|
103
44
|
* Origin-wide Content-Signal preferences, forwarded to `renderRobots`.
|
|
104
45
|
* Omit for none. Preview (`--no-indexable`) never emits the line.
|
|
@@ -140,5 +81,5 @@ interface SeoCliConfig {
|
|
|
140
81
|
/** Identity — it exists for the type inference and the editor completions. */
|
|
141
82
|
declare const defineSeoConfig: (config: SeoCliConfig) => SeoCliConfig;
|
|
142
83
|
//#endregion
|
|
143
|
-
export { type GraphLoaderInput, type LoadedSeoGraph,
|
|
84
|
+
export { type GraphLoaderInput, type LoadedSeoGraph, SeoCliConfig, type SeoGraphLoader, SeoWorkflowConfig, SeoWorkflowContextConfig, SeoWorkflowOpenCodeConfig, type ViteGraphLoaderOptions, defineSeoConfig, loadPageHeads, viteGraphLoader };
|
|
144
85
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -1,125 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
//#region src/config/vite-graph-loader.ts
|
|
4
|
-
/**
|
|
5
|
-
* A graph loader that evaluates the host app's own graph module inside a
|
|
6
|
-
* headless Vite server.
|
|
7
|
-
*
|
|
8
|
-
* The SEO graph is built *by the app*: its module reads the generated route
|
|
9
|
-
* tree and whatever content collections it owns, so it pulls in the app's real
|
|
10
|
-
* module graph — path aliases, virtual modules from content plugins, bare
|
|
11
|
-
* imports that only exist inside a server runtime. A CLI cannot just `import()`
|
|
12
|
-
* that from Node or Bun.
|
|
13
|
-
*
|
|
14
|
-
* So this boots a scoped, in-process Vite server (middleware mode, no HMR, no
|
|
15
|
-
* watcher, no HTTP listener), `ssrLoadModule`s the app's graph module, and calls
|
|
16
|
-
* its exported loader. The graph comes back as a live in-process object — there
|
|
17
|
-
* is no serialization boundary for the commands to cross — and the server is
|
|
18
|
-
* closed by {@link LoadedSeoGraph.dispose}.
|
|
19
|
-
*
|
|
20
|
-
* Everything host-shaped is an option: the app supplies its own {@link
|
|
21
|
-
* ViteGraphLoaderOptions.plugins} (a content plugin, an MDX loader), {@link
|
|
22
|
-
* ViteGraphLoaderOptions.stubs} for bare modules that only resolve inside its
|
|
23
|
-
* server runtime, and {@link ViteGraphLoaderOptions.env} for variables its
|
|
24
|
-
* modules parse at import. This file knows about none of them.
|
|
25
|
-
*/
|
|
26
|
-
const messageOf = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
27
|
-
/**
|
|
28
|
-
* Vite and its plugins write progress to stdout. The CLI reserves stdout for the
|
|
29
|
-
* data plane, so redirect it to stderr for the duration of the load.
|
|
30
|
-
*
|
|
31
|
-
* Both the stream method and `console.log`/`info` are swapped: under Bun,
|
|
32
|
-
* `console.log` writes to fd 1 natively rather than going through
|
|
33
|
-
* `process.stdout.write`, so the stream swap alone would miss a plugin that
|
|
34
|
-
* logs through the console.
|
|
35
|
-
*/
|
|
36
|
-
const withCleanStdout = async (run) => {
|
|
37
|
-
const originalWrite = process.stdout.write.bind(process.stdout);
|
|
38
|
-
const originalLog = console.log;
|
|
39
|
-
const originalInfo = console.info;
|
|
40
|
-
process.stdout.write = process.stderr.write.bind(process.stderr);
|
|
41
|
-
console.log = (...args) => console.error(...args);
|
|
42
|
-
console.info = (...args) => console.error(...args);
|
|
43
|
-
try {
|
|
44
|
-
return await run();
|
|
45
|
-
} finally {
|
|
46
|
-
process.stdout.write = originalWrite;
|
|
47
|
-
console.log = originalLog;
|
|
48
|
-
console.info = originalInfo;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
/** Turn `{ id: source }` into a Vite plugin that resolves and loads each id. */
|
|
52
|
-
const stubPlugin = (stubs) => {
|
|
53
|
-
const virtualIdOf = (id) => `\0seo-cli-stub:${id}`;
|
|
54
|
-
const sourceByVirtualId = new Map(Object.entries(stubs).map(([id, source]) => [virtualIdOf(id), source]));
|
|
55
|
-
return {
|
|
56
|
-
name: "seo:stubs",
|
|
57
|
-
resolveId: (id) => id in stubs ? virtualIdOf(id) : null,
|
|
58
|
-
load: (id) => sourceByVirtualId.get(id) ?? null
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
const seedEnv = (env) => {
|
|
62
|
-
for (const [key, value] of Object.entries(env)) process.env[key] ??= value;
|
|
63
|
-
};
|
|
64
|
-
const inlineConfigFor = (options) => ({
|
|
65
|
-
configFile: false,
|
|
66
|
-
root: options.root,
|
|
67
|
-
mode: "production",
|
|
68
|
-
logLevel: "error",
|
|
69
|
-
appType: "custom",
|
|
70
|
-
clearScreen: false,
|
|
71
|
-
server: {
|
|
72
|
-
middlewareMode: true,
|
|
73
|
-
hmr: false,
|
|
74
|
-
watch: null
|
|
75
|
-
},
|
|
76
|
-
resolve: { tsconfigPaths: true },
|
|
77
|
-
plugins: [...options.stubs === void 0 ? [] : [stubPlugin(options.stubs)], ...options.plugins ?? []]
|
|
78
|
-
});
|
|
79
|
-
/**
|
|
80
|
-
* Build a {@link SeoGraphLoader} that evaluates `entry` in a headless Vite
|
|
81
|
-
* server rooted at `root`, and returns what its `exportName` export resolves to.
|
|
82
|
-
*/
|
|
83
|
-
const viteGraphLoader = (options) => async (input) => {
|
|
84
|
-
const exportName = options.exportName ?? "loadSeoGraph";
|
|
85
|
-
if (options.env) seedEnv(options.env);
|
|
86
|
-
const server = await withCleanStdout(() => createServer(inlineConfigFor(options))).catch((cause) => {
|
|
87
|
-
throw new Error(`Could not start the Vite loader: ${messageOf(cause)}`);
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
graph: await withCleanStdout(async () => {
|
|
91
|
-
const module = await server.ssrLoadModule(options.entry);
|
|
92
|
-
const load = module[exportName];
|
|
93
|
-
if (typeof load !== "function") throw new Error(`${options.entry} has no \`${exportName}\` export (found: ${Object.keys(module).join(", ") || "nothing"}).`);
|
|
94
|
-
return await load(input);
|
|
95
|
-
}).catch(async (cause) => {
|
|
96
|
-
await withCleanStdout(() => server.close()).catch(() => {});
|
|
97
|
-
throw new Error(`Could not build the SEO graph: ${messageOf(cause)}`);
|
|
98
|
-
}),
|
|
99
|
-
dispose: () => withCleanStdout(() => server.close())
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
//#endregion
|
|
1
|
+
import { t as pageHeads } from "./page-heads-6y-CARRQ.js";
|
|
2
|
+
import { t as viteGraphLoader } from "./vite-graph-loader-01p1WxEq.js";
|
|
103
3
|
//#region src/config/page-heads.ts
|
|
104
|
-
/** Select page nodes before the host resolves metadata; sitemap-disabled hubs remain pages. */
|
|
105
|
-
function selectPageHeadNodes(graph, options = {}) {
|
|
106
|
-
const excludes = (options.exclude ?? []).map(globToRegExp);
|
|
107
|
-
return [...graph.nodes.values()].filter((node) => node.kind !== "layout" && (node.policy.sitemap !== void 0 || node.instance !== void 0) && !excludes.some((pattern) => pattern.test(node.path)) && (options.indexable === false || !node.path.includes("$") && node.policy.redirectTo === void 0 && !node.policy.robots?.toLowerCase().split(/[\s,]+/).includes("noindex")));
|
|
108
|
-
}
|
|
109
|
-
/** Extract resolved heads, naming the selected page when metadata is missing or blank. */
|
|
110
|
-
function pageHeads(graph, options = {}) {
|
|
111
|
-
return selectPageHeadNodes(graph, options).map((node) => {
|
|
112
|
-
const title = node.instance?.title;
|
|
113
|
-
const description = node.instance?.description;
|
|
114
|
-
if (!title?.trim()) throw new Error(`Invalid page head for ${node.path}: missing title`);
|
|
115
|
-
if (!description?.trim()) throw new Error(`Invalid page head for ${node.path}: missing description`);
|
|
116
|
-
return {
|
|
117
|
-
path: node.path,
|
|
118
|
-
title,
|
|
119
|
-
description
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
4
|
/** Acquire, extract and release a graph on both success and metadata failure. Bind loader input in a closure. */
|
|
124
5
|
async function loadPageHeads(loader, options = {}) {
|
|
125
6
|
const loaded = await loader();
|
|
@@ -134,6 +15,6 @@ async function loadPageHeads(loader, options = {}) {
|
|
|
134
15
|
/** Identity — it exists for the type inference and the editor completions. */
|
|
135
16
|
const defineSeoConfig = (config) => config;
|
|
136
17
|
//#endregion
|
|
137
|
-
export { defineSeoConfig, loadPageHeads,
|
|
18
|
+
export { defineSeoConfig, loadPageHeads, viteGraphLoader };
|
|
138
19
|
|
|
139
20
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../src/config/vite-graph-loader.ts","../src/config/page-heads.ts","../src/config/index.ts"],"sourcesContent":["/**\n * A graph loader that evaluates the host app's own graph module inside a\n * headless Vite server.\n *\n * The SEO graph is built *by the app*: its module reads the generated route\n * tree and whatever content collections it owns, so it pulls in the app's real\n * module graph — path aliases, virtual modules from content plugins, bare\n * imports that only exist inside a server runtime. A CLI cannot just `import()`\n * that from Node or Bun.\n *\n * So this boots a scoped, in-process Vite server (middleware mode, no HMR, no\n * watcher, no HTTP listener), `ssrLoadModule`s the app's graph module, and calls\n * its exported loader. The graph comes back as a live in-process object — there\n * is no serialization boundary for the commands to cross — and the server is\n * closed by {@link LoadedSeoGraph.dispose}.\n *\n * Everything host-shaped is an option: the app supplies its own {@link\n * ViteGraphLoaderOptions.plugins} (a content plugin, an MDX loader), {@link\n * ViteGraphLoaderOptions.stubs} for bare modules that only resolve inside its\n * server runtime, and {@link ViteGraphLoaderOptions.env} for variables its\n * modules parse at import. This file knows about none of them.\n */\n\nimport { createServer, type InlineConfig, type PluginOption } from \"vite\";\n\nimport type { SeoGraph } from \"../core/graph\";\n\n/** A graph, plus the release of whatever producing it acquired. */\nexport interface LoadedSeoGraph {\n readonly graph: SeoGraph;\n /** Called once the command is done with the graph, on success or failure. */\n readonly dispose: () => Promise<void>;\n}\n\n/**\n * Produces the SEO graph for the `pagegraph` CLI. A plain promise on purpose: a\n * config file must be writable without Effect, which the CLI keeps behind its\n * `bin` (an optional peer dependency).\n */\n/** JSON input that can be supplied by config files to an app graph export. */\nexport type GraphLoaderInput = null | boolean | number | string | ReadonlyArray<GraphLoaderInput> | { readonly [key: string]: GraphLoaderInput };\n\nexport type SeoGraphLoader<Input extends GraphLoaderInput | void = void> = (input: Input) => Promise<LoadedSeoGraph>;\n\nexport interface ViteGraphLoaderOptions {\n /** The app's Vite root — the directory its aliases and plugins resolve against. */\n readonly root: string;\n /** Module exporting the graph loader, root-relative (e.g. `/lib/seo/graph.ts`). */\n readonly entry: string;\n /** Named export on `entry` returning `Promise<SeoGraph>`. Defaults to `loadSeoGraph`. */\n readonly exportName?: string | undefined;\n /** Vite plugins the app's module graph needs — a content/MDX plugin, say. */\n readonly plugins?: ReadonlyArray<PluginOption> | undefined;\n /**\n * Bare or virtual module ids to replace with inert source, so a module that\n * only resolves inside the app's server runtime does not break the load.\n */\n readonly stubs?: Readonly<Record<string, string>> | undefined;\n /**\n * Variables to seed on `process.env` before the app's modules parse it. Vite\n * exposes prefixed values through `import.meta.env`, so this is how a module\n * that demands an env var at import time is satisfied. Existing values win —\n * a real `.env` is never clobbered.\n */\n readonly env?: Readonly<Record<string, string>> | undefined;\n}\n\nconst messageOf = (cause: unknown): string =>\n cause instanceof Error ? cause.message : String(cause);\n\n/**\n * Vite and its plugins write progress to stdout. The CLI reserves stdout for the\n * data plane, so redirect it to stderr for the duration of the load.\n *\n * Both the stream method and `console.log`/`info` are swapped: under Bun,\n * `console.log` writes to fd 1 natively rather than going through\n * `process.stdout.write`, so the stream swap alone would miss a plugin that\n * logs through the console.\n */\nconst withCleanStdout = async <A>(run: () => Promise<A>): Promise<A> => {\n const originalWrite = process.stdout.write.bind(process.stdout);\n const originalLog = console.log;\n const originalInfo = console.info;\n process.stdout.write = process.stderr.write.bind(process.stderr) as typeof process.stdout.write;\n console.log = (...args: Array<unknown>) => console.error(...args);\n console.info = (...args: Array<unknown>) => console.error(...args);\n try {\n return await run();\n } finally {\n process.stdout.write = originalWrite;\n console.log = originalLog;\n console.info = originalInfo;\n }\n};\n\n/** Turn `{ id: source }` into a Vite plugin that resolves and loads each id. */\nconst stubPlugin = (stubs: Readonly<Record<string, string>>): PluginOption => {\n const virtualIdOf = (id: string) => `\\0seo-cli-stub:${id}`;\n const sourceByVirtualId = new Map(\n Object.entries(stubs).map(([id, source]) => [virtualIdOf(id), source]),\n );\n return {\n name: \"seo:stubs\",\n resolveId: (id) => (id in stubs ? virtualIdOf(id) : null),\n load: (id) => sourceByVirtualId.get(id) ?? null,\n };\n};\n\nconst seedEnv = (env: Readonly<Record<string, string>>): void => {\n for (const [key, value] of Object.entries(env)) {\n // oxlint-disable-next-line node/no-process-env -- CLI boundary: seeds the raw env BEFORE the app's own env module parses it; that module is the consumer here, not an option\n process.env[key] ??= value;\n }\n};\n\nconst inlineConfigFor = (options: ViteGraphLoaderOptions): InlineConfig => ({\n configFile: false,\n root: options.root,\n mode: \"production\",\n logLevel: \"error\",\n appType: \"custom\",\n clearScreen: false,\n server: { middlewareMode: true, hmr: false, watch: null },\n resolve: { tsconfigPaths: true },\n plugins: [\n ...(options.stubs === undefined ? [] : [stubPlugin(options.stubs)]),\n ...(options.plugins ?? []),\n ],\n});\n\n/**\n * Build a {@link SeoGraphLoader} that evaluates `entry` in a headless Vite\n * server rooted at `root`, and returns what its `exportName` export resolves to.\n */\nexport const viteGraphLoader =\n <Input extends GraphLoaderInput | void = void>(options: ViteGraphLoaderOptions): SeoGraphLoader<Input> =>\n async (input) => {\n const exportName = options.exportName ?? \"loadSeoGraph\";\n if (options.env) seedEnv(options.env);\n\n const server = await withCleanStdout(() => createServer(inlineConfigFor(options))).catch(\n (cause: unknown) => {\n throw new Error(`Could not start the Vite loader: ${messageOf(cause)}`);\n },\n );\n\n // The server is a resource from here on: a failed load must still close it,\n // and a successful one hands the close to the caller as `dispose`.\n const graph = await withCleanStdout(async () => {\n const module = (await server.ssrLoadModule(options.entry)) as Record<string, unknown>;\n const load = module[exportName];\n if (typeof load !== \"function\") {\n throw new Error(\n `${options.entry} has no \\`${exportName}\\` export (found: ${Object.keys(module).join(\", \") || \"nothing\"}).`,\n );\n }\n return (await load(input)) as SeoGraph;\n }).catch(async (cause: unknown) => {\n // Close on the way out, but never let a close failure bury the real\n // error: the reason the graph did not build is the useful one.\n await withCleanStdout(() => server.close()).catch(() => {});\n throw new Error(`Could not build the SEO graph: ${messageOf(cause)}`);\n });\n\n return { graph, dispose: () => withCleanStdout(() => server.close()) };\n };\n","import { globToRegExp } from \"../core/checks\";\nimport type { SeoGraph, SeoNode } from \"../core/graph\";\nimport type { SeoGraphLoader } from \"./vite-graph-loader\";\n\n/** Plain document metadata, without framework or schema dependencies. */\nexport interface PageHead {\n readonly path: string;\n readonly title: string;\n readonly description: string;\n}\n\nexport interface PageHeadsOptions {\n /** Path globs: `*` matches a segment, `**` matches across segments. */\n readonly exclude?: ReadonlyArray<string>;\n /** Exclude noindex pages, redirects and parameter templates. Defaults to true. */\n readonly indexable?: boolean;\n}\n\n/** Select page nodes before the host resolves metadata; sitemap-disabled hubs remain pages. */\nexport function selectPageHeadNodes(graph: SeoGraph, options: PageHeadsOptions = {}): Array<SeoNode> {\n const excludes = (options.exclude ?? []).map(globToRegExp);\n return [...graph.nodes.values()].filter((node) =>\n node.kind !== \"layout\" &&\n (node.policy.sitemap !== undefined || node.instance !== undefined) &&\n !excludes.some((pattern) => pattern.test(node.path)) &&\n (options.indexable === false || (\n !node.path.includes(\"$\") &&\n node.policy.redirectTo === undefined &&\n !node.policy.robots?.toLowerCase().split(/[\\s,]+/).includes(\"noindex\")\n )),\n );\n}\n\n/** Extract resolved heads, naming the selected page when metadata is missing or blank. */\nexport function pageHeads(graph: SeoGraph, options: PageHeadsOptions = {}): Array<PageHead> {\n return selectPageHeadNodes(graph, options).map((node) => {\n const title = node.instance?.title;\n const description = node.instance?.description;\n if (!title?.trim()) throw new Error(`Invalid page head for ${node.path}: missing title`);\n if (!description?.trim()) throw new Error(`Invalid page head for ${node.path}: missing description`);\n return { path: node.path, title, description };\n });\n}\n\n/** Acquire, extract and release a graph on both success and metadata failure. Bind loader input in a closure. */\nexport async function loadPageHeads(loader: SeoGraphLoader, options: PageHeadsOptions = {}): Promise<Array<PageHead>> {\n const loaded = await loader();\n try {\n return pageHeads(loaded.graph, options);\n } finally {\n await loaded.dispose();\n }\n}\n","/**\n * `pagegraph/config` — the `pagegraph` CLI's configuration surface.\n *\n * The CLI is a set of pure views over one graph, but *acquiring* that graph is\n * host knowledge: only the app knows where its graph module lives and what its\n * module needs to evaluate. So the app declares it once in a `seo.config.ts` at\n * its root, which the CLI discovers from the working directory:\n *\n * ```ts\n * // seo.config.ts\n * import { defineSeoConfig, viteGraphLoader } from \"pagegraph/config\";\n * import { routeConfig } from \"./lib/route-config\";\n *\n * export default defineSeoConfig({\n * origin: \"https://example.com\",\n * disallow: routeConfig.robotsExclusions,\n * contentSignal: \"search=yes, ai-input=yes, ai-train=yes\",\n * loadGraph: viteGraphLoader({ root: import.meta.dirname, entry: \"/lib/seo/graph.ts\" }),\n * });\n * ```\n *\n * Nothing here imports Effect. The CLI needs it (an optional peer dependency),\n * but a config file must not: it is the app's file, and the app may not be an\n * Effect app.\n */\n\nexport type { GraphLoaderInput, LoadedSeoGraph, SeoGraphLoader, ViteGraphLoaderOptions } from \"./vite-graph-loader\";\nexport { viteGraphLoader } from \"./vite-graph-loader\";\n\nexport { selectPageHeadNodes, pageHeads, loadPageHeads } from \"./page-heads\";\nexport type { PageHead, PageHeadsOptions } from \"./page-heads\";\n\nimport type { CoverageRule } from \"../core/checks\";\nimport type { ContentPolicy } from \"../core/content\";\nimport type { FreshnessPolicy } from \"../core/freshness\";\nimport type { SeoGraphLoader } from \"./vite-graph-loader\";\n\nexport interface SeoWorkflowOpenCodeConfig {\n /** Project-owned OpenCode configuration directory, relative to the project root. */\n readonly configDirectory: string;\n /** Default `provider/model` used by agentic workflows. */\n readonly defaultModel: string;\n /** Per-workflow `provider/model` overrides. */\n readonly models?: Readonly<Record<string, string>> | undefined;\n /** Per-completion deadline in milliseconds, including JSON repair; defaults to 180000. */\n readonly timeoutMs?: number | undefined;\n}\n\nexport interface SeoWorkflowContextConfig {\n /** Durable project context included in every workflow prompt. */\n readonly files?: ReadonlyArray<string> | undefined;\n /** Additional context files keyed by workflow id. */\n readonly byWorkflow?: Readonly<Record<string, ReadonlyArray<string>>> | undefined;\n}\n\nexport interface SeoWorkflowConfig {\n readonly opencode: SeoWorkflowOpenCodeConfig;\n readonly context?: SeoWorkflowContextConfig | undefined;\n /** Ignored run-artifact directory, relative to the project root. */\n readonly runsDirectory?: string | undefined;\n}\n\nexport interface SeoCliConfig {\n /**\n * Canonical origin the sitemap and robots projections render under, no\n * trailing slash. The `--origin` flag overrides it per invocation.\n */\n readonly origin: string;\n /**\n * Path prefixes disallowed in robots.txt. Feed it the generated\n * `routeConfig.robotsExclusions` if you run the `pagegraph/vite` plugin.\n */\n readonly disallow: ReadonlyArray<string>;\n /**\n * Origin-wide Content-Signal preferences, forwarded to `renderRobots`.\n * Omit for none. Preview (`--no-indexable`) never emits the line.\n */\n readonly contentSignal?: string | undefined;\n /**\n * Extra robots.txt group lines, forwarded to `renderRobots` as `directives`.\n */\n readonly directives?: ReadonlyArray<string> | undefined;\n /**\n * Last-mile robots.txt override, forwarded to `renderRobots` as `transform`.\n * Runs for indexable and preview hosts.\n */\n readonly transform?: ((robots: string) => string) | undefined;\n /**\n * Contextual-link coverage policy for `pagegraph check`: every sitemap-eligible\n * page matching a rule's `path` glob needs at least `minInbound` incoming\n * `related` edges. A `--require-inbound` flag overrides this per invocation.\n */\n readonly coverage?: ReadonlyArray<CoverageRule> | undefined;\n /**\n * Rendered content policy for `pagegraph check --site`: word-count floors per\n * path glob. The heading, structured-data, robots, and canonical rules need no\n * configuration.\n */\n readonly content?: ContentPolicy | undefined;\n /**\n * Freshness policy: sitemap-eligible pages whose declared `modifiedAt` (or an\n * instance's `publishedAt`) is older than `maxAgeDays` are editorial\n * `stale-page` findings in `pagegraph check` and the refresh queue in\n * `pagegraph stale`.\n */\n readonly freshness?: FreshnessPolicy | undefined;\n /** Agentic workflow host, context, and artifact settings. */\n readonly workflows?: SeoWorkflowConfig | undefined;\n /** How the CLI gets the graph. {@link viteGraphLoader} covers the Vite-app case. */\n readonly loadGraph: SeoGraphLoader;\n}\n\n/** Identity — it exists for the type inference and the editor completions. */\nexport const defineSeoConfig = (config: SeoCliConfig): SeoCliConfig => config;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../src/config/page-heads.ts","../src/config/index.ts"],"sourcesContent":["import { pageHeads, type PageHead, type PageHeadsOptions } from \"../core/page-heads\";\nimport type { SeoGraphLoader } from \"./vite-graph-loader\";\n\n/** Acquire, extract and release a graph on both success and metadata failure. Bind loader input in a closure. */\nexport async function loadPageHeads(loader: SeoGraphLoader, options: PageHeadsOptions = {}): Promise<Array<PageHead>> {\n const loaded = await loader();\n try {\n return pageHeads(loaded.graph, options);\n } finally {\n await loaded.dispose();\n }\n}\n","/**\n * `pagegraph/config` — the `pagegraph` CLI's configuration surface.\n *\n * The CLI is a set of pure views over one graph, but *acquiring* that graph is\n * host knowledge: only the app knows where its graph module lives and what its\n * module needs to evaluate. So the app declares it once in a `seo.config.ts` at\n * its root, which the CLI discovers from the working directory:\n *\n * ```ts\n * // seo.config.ts\n * import { defineSeoConfig, viteGraphLoader } from \"pagegraph/config\";\n * import { routeConfig } from \"./lib/route-config\";\n *\n * export default defineSeoConfig({\n * origin: \"https://example.com\",\n * disallow: routeConfig.robotsExclusions,\n * contentSignal: \"search=yes, ai-input=yes, ai-train=yes\",\n * loadGraph: viteGraphLoader({ root: import.meta.dirname, entry: \"/lib/seo/graph.ts\" }),\n * });\n * ```\n *\n * Nothing here imports Effect. The CLI needs it (an optional peer dependency),\n * but a config file must not: it is the app's file, and the app may not be an\n * Effect app.\n */\n\nexport type { GraphLoaderInput, LoadedSeoGraph, SeoGraphLoader, ViteGraphLoaderOptions } from \"./vite-graph-loader\";\nexport { viteGraphLoader } from \"./vite-graph-loader\";\n\nexport { loadPageHeads } from \"./page-heads\";\n\nimport type { CoverageRule } from \"../core/checks\";\nimport type { ContentPolicy } from \"../core/content\";\nimport type { FreshnessPolicy } from \"../core/freshness\";\nimport type { SeoGraphLoader } from \"./vite-graph-loader\";\n\nexport interface SeoWorkflowOpenCodeConfig {\n /** Project-owned OpenCode configuration directory, relative to the project root. */\n readonly configDirectory: string;\n /** Default `provider/model` used by agentic workflows. */\n readonly defaultModel: string;\n /** Per-workflow `provider/model` overrides. */\n readonly models?: Readonly<Record<string, string>> | undefined;\n /** Per-completion deadline in milliseconds, including JSON repair; defaults to 180000. */\n readonly timeoutMs?: number | undefined;\n}\n\nexport interface SeoWorkflowContextConfig {\n /** Durable project context included in every workflow prompt. */\n readonly files?: ReadonlyArray<string> | undefined;\n /** Additional context files keyed by workflow id. */\n readonly byWorkflow?: Readonly<Record<string, ReadonlyArray<string>>> | undefined;\n}\n\nexport interface SeoWorkflowConfig {\n readonly opencode: SeoWorkflowOpenCodeConfig;\n readonly context?: SeoWorkflowContextConfig | undefined;\n /** Ignored run-artifact directory, relative to the project root. */\n readonly runsDirectory?: string | undefined;\n}\n\nexport interface SeoCliConfig {\n /**\n * Canonical origin the sitemap and robots projections render under, no\n * trailing slash. The `--origin` flag overrides it per invocation.\n */\n readonly origin: string;\n /**\n * Path prefixes disallowed in robots.txt. Omit when the graph loader supplies\n * the robots policy (`tanstackStartGraph`); otherwise feed it the generated\n * `routeConfig.robotsExclusions` if you run the `pagegraph/vite` plugin.\n */\n readonly disallow?: ReadonlyArray<string> | undefined;\n /**\n * Origin-wide Content-Signal preferences, forwarded to `renderRobots`.\n * Omit for none. Preview (`--no-indexable`) never emits the line.\n */\n readonly contentSignal?: string | undefined;\n /**\n * Extra robots.txt group lines, forwarded to `renderRobots` as `directives`.\n */\n readonly directives?: ReadonlyArray<string> | undefined;\n /**\n * Last-mile robots.txt override, forwarded to `renderRobots` as `transform`.\n * Runs for indexable and preview hosts.\n */\n readonly transform?: ((robots: string) => string) | undefined;\n /**\n * Contextual-link coverage policy for `pagegraph check`: every sitemap-eligible\n * page matching a rule's `path` glob needs at least `minInbound` incoming\n * `related` edges. A `--require-inbound` flag overrides this per invocation.\n */\n readonly coverage?: ReadonlyArray<CoverageRule> | undefined;\n /**\n * Rendered content policy for `pagegraph check --site`: word-count floors per\n * path glob. The heading, structured-data, robots, and canonical rules need no\n * configuration.\n */\n readonly content?: ContentPolicy | undefined;\n /**\n * Freshness policy: sitemap-eligible pages whose declared `modifiedAt` (or an\n * instance's `publishedAt`) is older than `maxAgeDays` are editorial\n * `stale-page` findings in `pagegraph check` and the refresh queue in\n * `pagegraph stale`.\n */\n readonly freshness?: FreshnessPolicy | undefined;\n /** Agentic workflow host, context, and artifact settings. */\n readonly workflows?: SeoWorkflowConfig | undefined;\n /** How the CLI gets the graph. {@link viteGraphLoader} covers the Vite-app case. */\n readonly loadGraph: SeoGraphLoader;\n}\n\n/** Identity — it exists for the type inference and the editor completions. */\nexport const defineSeoConfig = (config: SeoCliConfig): SeoCliConfig => config;\n"],"mappings":";;;;AAIA,eAAsB,cAAc,QAAwB,UAA4B,CAAC,GAA6B;CACpH,MAAM,SAAS,MAAM,OAAO;CAC5B,IAAI;EACF,OAAO,UAAU,OAAO,OAAO,OAAO;CACxC,UAAU;EACR,MAAM,OAAO,QAAQ;CACvB;AACF;;;;ACsGA,MAAa,mBAAmB,WAAuC"}
|
|
@@ -1,129 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Consumer-augmented registry.
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* declare module "pagegraph" {
|
|
8
|
-
* interface Register {
|
|
9
|
-
* paths: FileRouteTypes["fullPaths"];
|
|
10
|
-
* kinds: "page" | "article" | "hub";
|
|
11
|
-
* }
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
interface Register {}
|
|
16
|
-
/** Every public full path in the consumer's route tree (type-only; erased at runtime). */
|
|
17
|
-
type PublicPath = Register extends {
|
|
18
|
-
paths: infer P extends string;
|
|
19
|
-
} ? P : string;
|
|
20
|
-
/** The consumer's page taxonomy. A label: nothing in the core branches on it. */
|
|
21
|
-
type SeoKind = Register extends {
|
|
22
|
-
kinds: infer K extends string;
|
|
23
|
-
} ? K : string;
|
|
24
|
-
interface SitemapPolicy {
|
|
25
|
-
priority: number;
|
|
26
|
-
changeFrequency: "weekly" | "monthly";
|
|
27
|
-
}
|
|
28
|
-
interface RouteSeo {
|
|
29
|
-
kind: SeoKind;
|
|
30
|
-
/** Breadcrumb label; fn form reads the match (e.g. loaderData frontmatter title). */
|
|
31
|
-
crumb?: string | ((match: AnyRouteMatch) => string) | undefined;
|
|
32
|
-
/** false = excluded from sitemap. Absent on non-indexable kinds is fine. */
|
|
33
|
-
sitemap?: SitemapPolicy | false | undefined;
|
|
34
|
-
/** meta robots value, e.g. "noindex, follow" on a hub page. */
|
|
35
|
-
robots?: string | undefined;
|
|
36
|
-
/** Typed cross-link edges. */
|
|
37
|
-
related?: ReadonlyArray<PublicPath> | undefined;
|
|
38
|
-
/** How OTHER pages render a card for this page. */
|
|
39
|
-
link?: {
|
|
40
|
-
title: string;
|
|
41
|
-
description: string;
|
|
42
|
-
} | undefined;
|
|
43
|
-
/** This route is a redirect/alias. */
|
|
44
|
-
redirectTo?: PublicPath | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* When this page's content last changed meaningfully, as an ISO 8601 date.
|
|
47
|
-
* Feeds the sitemap `<lastmod>` and the freshness report. Content instances
|
|
48
|
-
* carry their own dates instead; a param route's value is never inherited.
|
|
49
|
-
*/
|
|
50
|
-
modifiedAt?: string | undefined;
|
|
51
|
-
}
|
|
52
|
-
declare module "@tanstack/react-router" {
|
|
53
|
-
interface StaticDataRouteOption {
|
|
54
|
-
seo?: RouteSeo | undefined;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/core/graph.d.ts
|
|
59
|
-
/**
|
|
60
|
-
* Where a node came from: `"route"` for a structural route declaration, or the
|
|
61
|
-
* `source` label of the collection that produced the instance (e.g. "blog").
|
|
62
|
-
*/
|
|
63
|
-
type SeoSource = string;
|
|
64
|
-
interface SeoNode {
|
|
65
|
-
/** Canonical path, no origin (e.g. "/pricing", "/blog/my-post"). */
|
|
66
|
-
path: string;
|
|
67
|
-
kind: SeoKind;
|
|
68
|
-
source: SeoSource;
|
|
69
|
-
/** Route-declared policy, or synthesized (kind + inherited sitemap) for instances. */
|
|
70
|
-
policy: RouteSeo;
|
|
71
|
-
instance?: {
|
|
72
|
-
title: string;
|
|
73
|
-
description?: string | undefined;
|
|
74
|
-
publishedAt?: string | undefined;
|
|
75
|
-
modifiedAt?: string | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
}
|
|
78
|
-
type SeoEdgeType = "crumb-parent" | "related" | "redirect" | "collection-member";
|
|
79
|
-
interface SeoEdge {
|
|
80
|
-
from: string;
|
|
81
|
-
to: string;
|
|
82
|
-
type: SeoEdgeType;
|
|
83
|
-
}
|
|
84
|
-
interface SeoGraph {
|
|
85
|
-
nodes: Map<string, SeoNode>;
|
|
86
|
-
edges: Array<SeoEdge>;
|
|
87
|
-
/** Exact-path ownership conflicts encountered while assembling graph sources. */
|
|
88
|
-
collisions?: ReadonlyArray<{
|
|
89
|
-
path: string;
|
|
90
|
-
sources: ReadonlyArray<SeoSource>;
|
|
91
|
-
}> | undefined;
|
|
92
|
-
}
|
|
93
|
-
/** One concrete page produced by a collection. */
|
|
94
|
-
interface SeoInstance {
|
|
95
|
-
/** Canonical path of the page (e.g. "/blog/my-post"). */
|
|
96
|
-
readonly path: string;
|
|
97
|
-
readonly title: string;
|
|
98
|
-
readonly description?: string | undefined;
|
|
99
|
-
readonly publishedAt?: string | undefined;
|
|
100
|
-
readonly modifiedAt?: string | undefined;
|
|
101
|
-
}
|
|
102
|
-
interface SeoCollection {
|
|
103
|
-
/**
|
|
104
|
-
* The param route these instances render through (e.g. "/blog/$slug"). Instances
|
|
105
|
-
* inherit this route's declared policy (kind + sitemap) — the graph reads it from
|
|
106
|
-
* the structural node, so declarations stay the single source of truth.
|
|
107
|
-
*/
|
|
108
|
-
readonly route: PublicPath;
|
|
109
|
-
/** The `source` stamped on every node this collection produces (e.g. "blog"). */
|
|
110
|
-
readonly source: SeoSource;
|
|
111
|
-
readonly instances: ReadonlyArray<SeoInstance>;
|
|
112
|
-
/** Edges the collection declares between its instances and the rest of the graph. */
|
|
113
|
-
readonly edges?: ReadonlyArray<SeoEdge> | undefined;
|
|
114
|
-
}
|
|
115
|
-
interface BuildSeoGraphInput {
|
|
116
|
-
readonly routeTree: AnyRoute;
|
|
117
|
-
readonly collections?: ReadonlyArray<SeoCollection> | undefined;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Build the SEO graph from route declarations and content collections.
|
|
121
|
-
*
|
|
122
|
-
* Synchronous: the caller materializes its collections before calling, so there is
|
|
123
|
-
* no async work here. Callers own the origin.
|
|
124
|
-
*/
|
|
125
|
-
declare function buildSeoGraph(input: BuildSeoGraphInput): SeoGraph;
|
|
126
|
-
//#endregion
|
|
1
|
+
import { o as SeoKind } from "./declare-DVgdEdOL.js";
|
|
2
|
+
import { a as SeoGraph, u as SeoSource } from "./graph-BxCY90vq.js";
|
|
127
3
|
//#region src/core/freshness.d.ts
|
|
128
4
|
/** Project policy: pages whose last change is older than this are stale. */
|
|
129
5
|
interface FreshnessPolicy {
|
|
@@ -457,5 +333,5 @@ declare const renderedCheckTargets: (graph: SeoGraph) => Array<string>;
|
|
|
457
333
|
*/
|
|
458
334
|
declare function checkRenderedContent(graph: SeoGraph, documents: ReadonlyArray<RenderedDocument>, policy?: ContentPolicy): Array<Violation>;
|
|
459
335
|
//#endregion
|
|
460
|
-
export {
|
|
461
|
-
//# sourceMappingURL=content-
|
|
336
|
+
export { RenderedEdgeFailure as A, FreshnessEntry as B, Anchor as C, RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION as D, LinkGraphDiff as E, decodeRenderedEdgeArtifact as F, FreshnessReport as H, diffLinkGraph as I, extractAnchors as L, RenderedPage as M, SimpleEdge as N, RenderedEdgeArtifact as O, buildRenderedGraph as P, normalizePath as R, hasStructuralViolations as S, LinkEdge as T, freshnessReport as U, FreshnessPolicy as V, Violation as _, Heading as a, checkGraph as b, RenderedDocument as c, checkRenderedContent as d, extractPageContent as f, Severity as g, CoverageRule as h, ContentRuleName as i, RenderedGraph as j, RenderedEdgeArtifactCrawl as k, WordCountRule as l, CheckGraphOptions as m, ContentFinding as n, JsonLdNode as o, renderedCheckTargets as p, ContentPolicy as r, PageContent as s, ContentCheckOptions as t, checkPageContent as u, checkCoverage as v, AnchorRegion as w, checkRenderedCoverage as x, checkFreshness as y, renderedGraphFromEdges as z };
|
|
337
|
+
//# sourceMappingURL=content-B1cPtL8b.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as isSitemapEligible } from "./projections-D0oOFKiY.js";
|
|
2
|
+
import { a as globToRegExp } from "./checks-uZk5Em9A.js";
|
|
2
3
|
//#region src/core/inspect-html.ts
|
|
3
4
|
const ENTITIES = {
|
|
4
5
|
"&": "&",
|
|
@@ -902,4 +903,4 @@ function checkRenderedContent(graph, documents, policy = {}) {
|
|
|
902
903
|
//#endregion
|
|
903
904
|
export { RENDERED_EDGE_ARTIFACT_SCHEMA_VERSION as a, diffLinkGraph as c, renderedGraphFromEdges as d, hasBlockingIssues as f, renderedCheckTargets as i, extractAnchors as l, checkRenderedContent as n, buildRenderedGraph as o, inspectHtml as p, extractPageContent as r, decodeRenderedEdgeArtifact as s, checkPageContent as t, normalizePath as u };
|
|
904
905
|
|
|
905
|
-
//# sourceMappingURL=content-
|
|
906
|
+
//# sourceMappingURL=content-kcEnQdfi.js.map
|