@ascribed/astro 0.4.1 → 0.4.2

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/dev.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AstroIntegration } from "astro";
2
- import { type ProjectInfo } from "./project.js";
2
+ import { type BinaryOption, type ProjectInfo } from "./project.js";
3
3
  type ServerOptions = Parameters<NonNullable<AstroIntegration["hooks"]["astro:server:setup"]>>[0];
4
4
  /**
5
5
  * The assets a build copied from outside the content root, as absolute paths,
@@ -45,5 +45,7 @@ export declare function watchDev(options: {
45
45
  onBuilt?: () => void;
46
46
  /** The sources as the first build read them. */
47
47
  seen?: SeenFiles;
48
+ /** Where to find the binary, to read a project whose `ascribe.toml` has `[from]`. */
49
+ binary?: BinaryOption;
48
50
  }): DevBuilds;
49
51
  export {};
package/dist/dev.js CHANGED
@@ -114,7 +114,7 @@ export function watchDev(options) {
114
114
  if (!failed) {
115
115
  options.onBuilt?.();
116
116
  try {
117
- const reloaded = readProject(project.dir);
117
+ const reloaded = readProject(project.dir, options.binary);
118
118
  if (options.builds.some((build, i) => reloaded.siteRoot(build) !== previousSiteRoots[i])) {
119
119
  throw new Error("ascribe.toml changed output-dir; restart astro dev to reload the collection.");
120
120
  }
package/dist/dev.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAIjF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB,EAAE,KAAa;IAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,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,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,EAAE,CAAC;QACjD,IAAI,KAAK,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,SAAS,CAAC;YAClB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;YACrE,CAAC;;gBAAM,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrC,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { AstroIntegration } from \"astro\";\nimport { permalinksText } from \"./permalinks.js\";\nimport { consumerMismatches, readProject, type ProjectInfo } from \"./project.js\";\n\ntype ServerOptions = Parameters<NonNullable<AstroIntegration[\"hooks\"][\"astro:server:setup\"]>>[0];\n\n/**\n * The assets a build copied from outside the content root, as absolute paths,\n * read from the site output's manifest. Watching the content root doesn't\n * cover them. A manifest that's missing or unreadable gives none: the next\n * successful build writes one.\n */\nexport function outsideAssets(project: ProjectInfo, build: string): string[] {\n const manifest = path.join(path.dirname(project.siteRoot(build)), \"site.manifest.json\");\n let files: unknown;\n try {\n files = (JSON.parse(readFileSync(manifest, \"utf8\")) as { files?: unknown }).files;\n } catch {\n return [];\n }\n if (!Array.isArray(files)) return [];\n const assets = new Set<string>();\n for (const entry of files as { kind?: unknown; source?: unknown }[]) {\n if (entry.kind !== \"asset\" || typeof entry.source !== \"string\") continue;\n const absolute = path.resolve(project.contentRoot, entry.source);\n if (!absolute.startsWith(project.contentRoot + path.sep)) assets.add(absolute);\n }\n return [...assets].sort();\n}\n\n/**\n * Each watched file's size and modification time, as last seen. A watcher\n * can report an edit late, after a build already read it: macOS delivers\n * edits made just before the dev server started some seconds after it\n * started. An event that changes neither is no edit, and rebuilding for it\n * would reload the page under the reader.\n */\nexport class SeenFiles {\n private readonly stamps = new Map<string, string>();\n\n /** Records the files under `paths` (files or folders) as they are now. */\n prime(paths: readonly string[]): void {\n for (const at of paths) {\n let entries: string[];\n try {\n entries = statSync(at).isDirectory()\n ? readdirSync(at, { recursive: true, encoding: \"utf8\" }).map((f) => path.join(at, f))\n : [at];\n } catch {\n continue;\n }\n for (const file of entries) {\n const stamp = stampOf(file);\n if (stamp !== undefined && !this.stamps.has(file)) this.stamps.set(file, stamp);\n }\n }\n }\n\n /** Whether `file` differs from when it was last seen (or wasn't seen), and records it. */\n changed(file: string): boolean {\n const stamp = stampOf(file);\n const before = this.stamps.get(file);\n if (stamp === undefined) this.stamps.delete(file);\n else this.stamps.set(file, stamp);\n return stamp === undefined || stamp !== before;\n }\n}\n\nfunction stampOf(file: string): string | undefined {\n try {\n const stat = statSync(file);\n return stat.isFile() ? `${stat.size}:${stat.mtimeMs}` : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** What `watchDev` gives back. */\nexport interface DevBuilds {\n /** Runs `task` in turn with the compiler runs, never during one. */\n inTurn(task: () => Promise<void>): Promise<void>;\n}\n\n/** Watch source files, serialize compiler runs, and refresh Astro after successful output. */\nexport function watchDev(options: {\n server: ServerOptions[\"server\"];\n refreshContent: () => Promise<void>;\n logger: ServerOptions[\"logger\"];\n project: ProjectInfo;\n astro: { base: string; trailingSlash: string; site: string | undefined };\n /** The project's builds the site shows: one, or more when entries share the project. */\n builds: readonly string[];\n rebuild: () => Promise<void>;\n /** Called after each successful rebuild, before Astro reloads the page. */\n onBuilt?: () => void;\n /** The sources as the first build read them. */\n seen?: SeenFiles;\n}): DevBuilds {\n const { server, refreshContent, logger, rebuild } = options;\n let project = options.project;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let pending: Promise<void> = Promise.resolve();\n let dirty = false;\n let running = false;\n let failed = false;\n let assets = new Set<string>();\n const seen = options.seen ?? new SeenFiles();\n const watchAssets = () => {\n assets = new Set(options.builds.flatMap((build) => outsideAssets(project, build)));\n if (assets.size > 0) server.watcher.add([...assets]);\n seen.prime([...assets]);\n };\n\n const drain = async () => {\n running = true;\n const previousProject = project;\n const previousSiteRoots = options.builds.map((build) => previousProject.siteRoot(build));\n const permalinkTexts = () => previousSiteRoots.map((root) => permalinksText(root) ?? \"\");\n const previousPermalinks = permalinkTexts().join(\"\\0\");\n while (dirty) {\n dirty = false;\n try {\n await rebuild();\n failed = false;\n } catch (error) {\n failed = true;\n logger.error(error instanceof Error ? error.message : String(error));\n }\n }\n if (!failed) {\n options.onBuilt?.();\n try {\n const reloaded = readProject(project.dir);\n if (options.builds.some((build, i) => reloaded.siteRoot(build) !== previousSiteRoots[i])) {\n throw new Error(\n \"ascribe.toml changed output-dir; restart astro dev to reload the collection.\",\n );\n }\n const mismatches = consumerMismatches(reloaded, options.astro);\n if (mismatches.length > 0) {\n throw new Error(\n `@ascribed/astro: ascribe.toml and astro.config disagree:\\n- ${mismatches.join(\"\\n- \")}`,\n );\n }\n project = reloaded;\n server.watcher.add(project.contentRoot);\n server.watcher.add(project.configPath);\n watchAssets();\n await refreshContent();\n // Astro keeps each route's `getStaticPaths` until content changes, and adding or removing a\n // permalink may change no page: clear it, as Astro does, so the addresses follow the list.\n if (permalinkTexts().join(\"\\0\") !== previousPermalinks) {\n for (const name of [\"ssr\", \"prerender\"]) {\n server.environments[name]?.hot.send(\"astro:content-changed\", {});\n }\n }\n server.ws.send({ type: \"full-reload\" });\n } catch (error) {\n failed = true;\n logger.error(\n `could not refresh Ascribe content: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n running = false;\n };\n const schedule = () => {\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n timer = undefined;\n pending = pending.then(drain);\n }, 50);\n };\n const onChange = (event: string, file: string) => {\n if (![\"add\", \"change\", \"unlink\"].includes(event)) return;\n const absolute = path.resolve(file);\n const source =\n absolute === project.configPath ||\n assets.has(absolute) ||\n (absolute.startsWith(project.contentRoot + path.sep) &&\n !absolute.startsWith(project.outputRoot + path.sep));\n if (!source) return;\n // A late report of an edit the last build already had.\n if (event !== \"unlink\" && !seen.changed(absolute)) return;\n dirty = true;\n schedule();\n };\n server.watcher.add(project.contentRoot);\n server.watcher.add(project.configPath);\n seen.prime([project.contentRoot, project.configPath]);\n watchAssets();\n server.watcher.on(\"all\", onChange);\n server.httpServer?.once(\"close\", () => {\n if (timer) clearTimeout(timer);\n server.watcher.off(\"all\", onChange);\n });\n server.middlewares.use((_req, res, next) => {\n if (!dirty && !running && !failed) return next();\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n pending = pending.then(drain);\n }\n void pending.then(() => {\n if (failed) {\n res.statusCode = 503;\n res.end(\"Ascribe build failed; fix the source and save to retry.\");\n } else next();\n });\n });\n return {\n inTurn: (task) => {\n const run = pending.then(task);\n pending = run.catch(() => undefined);\n return run;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../src/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cA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C,KAAK,EAAE,QAAQ,CAAC,CAAC;IACnC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;QACpC,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,EAAE,CAAC;QACjD,IAAI,KAAK,EAAE,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,SAAS,CAAC;YAClB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;YACrE,CAAC;;gBAAM,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACf,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACrC,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { readdirSync, readFileSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { AstroIntegration } from \"astro\";\nimport { permalinksText } from \"./permalinks.js\";\nimport { consumerMismatches, readProject, type BinaryOption, type ProjectInfo } from \"./project.js\";\n\ntype ServerOptions = Parameters<NonNullable<AstroIntegration[\"hooks\"][\"astro:server:setup\"]>>[0];\n\n/**\n * The assets a build copied from outside the content root, as absolute paths,\n * read from the site output's manifest. Watching the content root doesn't\n * cover them. A manifest that's missing or unreadable gives none: the next\n * successful build writes one.\n */\nexport function outsideAssets(project: ProjectInfo, build: string): string[] {\n const manifest = path.join(path.dirname(project.siteRoot(build)), \"site.manifest.json\");\n let files: unknown;\n try {\n files = (JSON.parse(readFileSync(manifest, \"utf8\")) as { files?: unknown }).files;\n } catch {\n return [];\n }\n if (!Array.isArray(files)) return [];\n const assets = new Set<string>();\n for (const entry of files as { kind?: unknown; source?: unknown }[]) {\n if (entry.kind !== \"asset\" || typeof entry.source !== \"string\") continue;\n const absolute = path.resolve(project.contentRoot, entry.source);\n if (!absolute.startsWith(project.contentRoot + path.sep)) assets.add(absolute);\n }\n return [...assets].sort();\n}\n\n/**\n * Each watched file's size and modification time, as last seen. A watcher\n * can report an edit late, after a build already read it: macOS delivers\n * edits made just before the dev server started some seconds after it\n * started. An event that changes neither is no edit, and rebuilding for it\n * would reload the page under the reader.\n */\nexport class SeenFiles {\n private readonly stamps = new Map<string, string>();\n\n /** Records the files under `paths` (files or folders) as they are now. */\n prime(paths: readonly string[]): void {\n for (const at of paths) {\n let entries: string[];\n try {\n entries = statSync(at).isDirectory()\n ? readdirSync(at, { recursive: true, encoding: \"utf8\" }).map((f) => path.join(at, f))\n : [at];\n } catch {\n continue;\n }\n for (const file of entries) {\n const stamp = stampOf(file);\n if (stamp !== undefined && !this.stamps.has(file)) this.stamps.set(file, stamp);\n }\n }\n }\n\n /** Whether `file` differs from when it was last seen (or wasn't seen), and records it. */\n changed(file: string): boolean {\n const stamp = stampOf(file);\n const before = this.stamps.get(file);\n if (stamp === undefined) this.stamps.delete(file);\n else this.stamps.set(file, stamp);\n return stamp === undefined || stamp !== before;\n }\n}\n\nfunction stampOf(file: string): string | undefined {\n try {\n const stat = statSync(file);\n return stat.isFile() ? `${stat.size}:${stat.mtimeMs}` : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** What `watchDev` gives back. */\nexport interface DevBuilds {\n /** Runs `task` in turn with the compiler runs, never during one. */\n inTurn(task: () => Promise<void>): Promise<void>;\n}\n\n/** Watch source files, serialize compiler runs, and refresh Astro after successful output. */\nexport function watchDev(options: {\n server: ServerOptions[\"server\"];\n refreshContent: () => Promise<void>;\n logger: ServerOptions[\"logger\"];\n project: ProjectInfo;\n astro: { base: string; trailingSlash: string; site: string | undefined };\n /** The project's builds the site shows: one, or more when entries share the project. */\n builds: readonly string[];\n rebuild: () => Promise<void>;\n /** Called after each successful rebuild, before Astro reloads the page. */\n onBuilt?: () => void;\n /** The sources as the first build read them. */\n seen?: SeenFiles;\n /** Where to find the binary, to read a project whose `ascribe.toml` has `[from]`. */\n binary?: BinaryOption;\n}): DevBuilds {\n const { server, refreshContent, logger, rebuild } = options;\n let project = options.project;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let pending: Promise<void> = Promise.resolve();\n let dirty = false;\n let running = false;\n let failed = false;\n let assets = new Set<string>();\n const seen = options.seen ?? new SeenFiles();\n const watchAssets = () => {\n assets = new Set(options.builds.flatMap((build) => outsideAssets(project, build)));\n if (assets.size > 0) server.watcher.add([...assets]);\n seen.prime([...assets]);\n };\n\n const drain = async () => {\n running = true;\n const previousProject = project;\n const previousSiteRoots = options.builds.map((build) => previousProject.siteRoot(build));\n const permalinkTexts = () => previousSiteRoots.map((root) => permalinksText(root) ?? \"\");\n const previousPermalinks = permalinkTexts().join(\"\\0\");\n while (dirty) {\n dirty = false;\n try {\n await rebuild();\n failed = false;\n } catch (error) {\n failed = true;\n logger.error(error instanceof Error ? error.message : String(error));\n }\n }\n if (!failed) {\n options.onBuilt?.();\n try {\n const reloaded = readProject(project.dir, options.binary);\n if (options.builds.some((build, i) => reloaded.siteRoot(build) !== previousSiteRoots[i])) {\n throw new Error(\n \"ascribe.toml changed output-dir; restart astro dev to reload the collection.\",\n );\n }\n const mismatches = consumerMismatches(reloaded, options.astro);\n if (mismatches.length > 0) {\n throw new Error(\n `@ascribed/astro: ascribe.toml and astro.config disagree:\\n- ${mismatches.join(\"\\n- \")}`,\n );\n }\n project = reloaded;\n server.watcher.add(project.contentRoot);\n server.watcher.add(project.configPath);\n watchAssets();\n await refreshContent();\n // Astro keeps each route's `getStaticPaths` until content changes, and adding or removing a\n // permalink may change no page: clear it, as Astro does, so the addresses follow the list.\n if (permalinkTexts().join(\"\\0\") !== previousPermalinks) {\n for (const name of [\"ssr\", \"prerender\"]) {\n server.environments[name]?.hot.send(\"astro:content-changed\", {});\n }\n }\n server.ws.send({ type: \"full-reload\" });\n } catch (error) {\n failed = true;\n logger.error(\n `could not refresh Ascribe content: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n running = false;\n };\n const schedule = () => {\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n timer = undefined;\n pending = pending.then(drain);\n }, 50);\n };\n const onChange = (event: string, file: string) => {\n if (![\"add\", \"change\", \"unlink\"].includes(event)) return;\n const absolute = path.resolve(file);\n const source =\n absolute === project.configPath ||\n assets.has(absolute) ||\n (absolute.startsWith(project.contentRoot + path.sep) &&\n !absolute.startsWith(project.outputRoot + path.sep));\n if (!source) return;\n // A late report of an edit the last build already had.\n if (event !== \"unlink\" && !seen.changed(absolute)) return;\n dirty = true;\n schedule();\n };\n server.watcher.add(project.contentRoot);\n server.watcher.add(project.configPath);\n seen.prime([project.contentRoot, project.configPath]);\n watchAssets();\n server.watcher.on(\"all\", onChange);\n server.httpServer?.once(\"close\", () => {\n if (timer) clearTimeout(timer);\n server.watcher.off(\"all\", onChange);\n });\n server.middlewares.use((_req, res, next) => {\n if (!dirty && !running && !failed) return next();\n if (timer) {\n clearTimeout(timer);\n timer = undefined;\n pending = pending.then(drain);\n }\n void pending.then(() => {\n if (failed) {\n res.statusCode = 503;\n res.end(\"Ascribe build failed; fix the source and save to retry.\");\n } else next();\n });\n });\n return {\n inTurn: (task) => {\n const run = pending.then(task);\n pending = run.catch(() => undefined);\n return run;\n },\n };\n}\n"]}
package/dist/index.js CHANGED
@@ -151,7 +151,10 @@ export default function ascribe(options) {
151
151
  fail(nameProblems(list), "the `projects` option is wrong");
152
152
  const codegen = command === "preview" ? "" : fileURLToPath(createCodegenDir());
153
153
  entries = list.map((entry) => {
154
- const project = readProject(path.resolve(root, entry.project ?? "."));
154
+ const project = readProject(path.resolve(root, entry.project ?? "."), {
155
+ binary: options.binary,
156
+ root,
157
+ });
155
158
  return {
156
159
  name: entry.name,
157
160
  build: entry.build,
@@ -260,7 +263,7 @@ export default function ascribe(options) {
260
263
  return;
261
264
  const current = entries.map((entry) => ({
262
265
  ...entry,
263
- project: readProject(entry.project.dir),
266
+ project: readProject(entry.project.dir, { binary: options.binary, root }),
264
267
  }));
265
268
  fail(basePathClashes(current), "two projects share a base path");
266
269
  fail(pagesUnderOtherPaths(current), "a page is under another project's base path");
@@ -378,6 +381,7 @@ export default function ascribe(options) {
378
381
  astro: routing,
379
382
  builds: group.entries.map((entry) => entry.build),
380
383
  rebuild: group.rebuild,
384
+ ...(binary === undefined ? {} : { binary: { binary, root: group.project.dir } }),
381
385
  onBuilt: () => {
382
386
  if (reviewed !== undefined && group.entries.includes(reviewed))
383
387
  review?.rebuilt();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,SAAS;AACT,EAAE;AACF,wBAAwB;AACxB,2CAA2C;AAC3C,kCAAkC;AAClC,sEAAsE;AACtE,2EAA2E;AAC3E,kDAAkD;AAClD,QAAQ;AACR,EAAE;AACF,6BAA6B;AAC7B,sDAAsD;AACtD,iEAAiE;AACjE,iFAAiF;AACjF,mFAAmF;AACnF,6EAA6E;AAC7E,0FAA0F;AAC1F,EAAE;AACF,gBAAgB;AAChB,+FAA+F;AAC/F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BACN,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// @ascribed/astro: the Astro integration for Ascribe. Written against Astro\n// 7.3.5.\n//\n// // astro.config.mjs\n// import ascribe from \"@ascribed/astro\";\n// export default defineConfig({\n// // `site`, `base`, and `trailingSlash` come from ascribe.toml's\n// // [consumer] when they're left out here; set here, they must agree.\n// integrations: [ascribe({ build: \"site\" })],\n// });\n//\n// // src/content.config.ts\n// import { defineCollection } from \"astro:content\";\n// import { ascribeCollection } from \"@ascribed/astro/content\";\n// // The generated schema. With the project outside the Astro root, import the\n// // copy inside it instead: \"../.astro/integrations/_ascribed_astro/schema.ts\".\n// import { schema } from \"../.ascribe/build/site/site/_ascribe/schema.ts\";\n// export const collections = { docs: defineCollection(ascribeCollection({ schema })) };\n//\n// // a layout\n// import Elements from \"@ascribed/astro/Elements.astro\"; // <Elements /> in <head>\n// import Availability from \"@ascribed/astro/Availability.astro\"; // the page's availability\n// import Head from \"@ascribed/astro/Head.astro\"; // <Head entry={entry} /> in <head>\n// import Versions from \"@ascribed/astro/Versions.astro\"; // the lines that have the page\n//\n// // the sidebar: the project's navigation, joined to the collection\n// import { sidebar } from \"@ascribed/astro/content\";\n// const groups = sidebar(await getCollection(\"docs\"));\n//\n// // src/pages/404.astro\n// import MissingPermalink from \"@ascribed/astro/MissingPermalink.astro\"; // a permalink that isn't here\n//\n// Several projects in one site, each entry named, and each collection naming its entry:\n//\n// ascribe({\n// projects: [\n// { name: \"docs\", project: \"../docs\", build: \"site\" },\n// { name: \"home\", project: \"home\", build: \"site\" },\n// ],\n// review: \"docs\",\n// })\n// ascribeCollection({ schema, name: \"docs\" })\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport { writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { AstroIntegration, IntegrationResolvedRoute } from \"astro\";\nimport { findBinary } from \"./binary.js\";\nimport { codeTitles } from \"./code-titles.js\";\nimport { SeenFiles, watchDev, type DevBuilds } from \"./dev.js\";\nimport {\n agentsMiddleware,\n copyAgentFiles,\n copyPublishedFiles,\n filesMiddleware,\n folderUnder,\n inOrder,\n} from \"./files.js\";\nimport { WARN as HEAD_WARN } from \"./head-check.js\";\nimport { headersFor, headersOutcome, mergeRules, readHeaders } from \"./headers.js\";\nimport { forwardingRoutes, hasPermalinks, permalinkPattern, readPermalinks } from \"./permalinks.js\";\nimport {\n consumerMismatches,\n homeRoute,\n normalizeBase,\n readProject,\n supplyRouting,\n type AstroRouting,\n} from \"./project.js\";\nimport {\n basePathClashes,\n nameProblems,\n pagesUnderOtherPaths,\n permalinkProblems,\n type ProjectEntry,\n type ResolvedEntry,\n} from \"./projects.js\";\nimport {\n pageList,\n readRecords,\n routeAs,\n routeKey,\n sitemapRoute,\n type ProjectRobots,\n} from \"./records.js\";\nimport rehypeAscribeAttributes from \"./rehype.js\";\nimport { removeDevFile, siteUrl, writeDevFile } from \"./review/devfile.js\";\nimport { runDiff, runPrompt } from \"./review/diff.js\";\nimport { APP_ID } from \"./review/protocol.js\";\nimport { readRoutes, type RoutedPage } from \"./review/routes.js\";\nimport { channelProblem, ReviewServer, type ToolbarChannel } from \"./review/server.js\";\nimport {\n devRouted,\n devSitePages,\n rootFiles,\n rootFilesMiddleware,\n type RootFileSources,\n} from \"./root-files.js\";\nimport { anchorsFor, hasWarnings, reviewFor, runBuild } from \"./run.js\";\nimport { satteriAscribeAttributes } from \"./satteri.js\";\nimport { copySchema } from \"./schema.js\";\nimport { linesOf, olderLines } from \"./versions.js\";\n\nexport { default as rehypeAscribeAttributes } from \"./rehype.js\";\nexport { satteriAscribeAttributes } from \"./satteri.js\";\nexport type { ProjectEntry } from \"./projects.js\";\n\n/** The virtual module `content.ts` reads the resolved site output roots from. */\nconst SITE_MODULE = \"virtual:ascribe/site\";\n\n/** Options every form of the integration takes. */\ninterface SharedOptions {\n /**\n * The `ascribe` binary, relative to the Astro root. Default: `ASCRIBE_BIN`, then\n * the platform binary installed with `@ascribed/cli`.\n */\n binary?: string;\n /**\n * Mark each block of the site output with the source lines it came from\n * (source anchors), for review: `\"dev\"` in `astro dev` only, `true` always.\n * Default: `false`, though `review` has them in `astro dev`.\n */\n anchors?: boolean | \"dev\";\n /**\n * Review in the site preview: an **Ascribe review** app in `astro dev`'s\n * toolbar, which marks the page's changes and shows the pull request's\n * comments, with source anchors in `astro dev`. Default `true`; `false`\n * removes the app. `astro build` never has it. With several projects, it\n * reviews one: the entry a name names, or the first for `true`.\n */\n review?: boolean | string;\n /**\n * Show a code block's title (`title=\"…\"` in its info string, as `@snippet`\n * writes it), and what a tested example was tested with (`tested=\"…\"`),\n * above it, with a Shiki transformer that puts the block in a\n * `<figure class=\"code-title\">` with a `<figcaption>`. Default `true`.\n */\n codeTitles?: boolean;\n /**\n * The site's one sitemap, at `<base>sitemap.xml`, of every listed page of\n * every project and every page of the site's own. `exclude` lists routes,\n * from the host's root, of the site's own pages to leave out of it, such\n * as one that carries `noindex`.\n */\n sitemap?: { exclude?: string[] };\n}\n\n/** Options of the integration with one project. */\nexport interface OneProjectOptions extends SharedOptions {\n /** The build whose site output is the collection (a name in `ascribe.toml`). */\n build: string;\n /** The directory holding `ascribe.toml`, relative to the Astro root. Default: the root. */\n project?: string;\n projects?: never;\n}\n\n/** Options of the integration with several projects, each entry named. */\nexport interface ProjectsOptions extends SharedOptions {\n /** The projects, each a named build of a project; two entries may share a project. */\n projects: ProjectEntry[];\n build?: never;\n project?: never;\n}\n\n/** Options of the integration. */\nexport type AscribeOptions = OneProjectOptions | ProjectsOptions;\n\n/** The toolbar app's icon: a speech bubble over a page. */\nconst ICON =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M6 3h8l4 4v6\"/><path d=\"M14 3v4h4\"/><path d=\"M6 3v15\"/><path d=\"M11 14h10v6h-6l-3 2v-2h-1z\"/></svg>';\n\n/** An entry as the hooks use it. */\ninterface Entry extends ResolvedEntry {\n siteRoot: string;\n /** The plain output's root, when the project publishes it for agents. */\n agentsRoot: string | undefined;\n /** Where the generated schema's copy goes, inside the Astro root. */\n schemaDir: string;\n}\n\n/** A project with the entries that build it, which a dev watcher follows together. */\ninterface DevGroup {\n project: ResolvedEntry[\"project\"];\n entries: Entry[];\n rebuild: () => Promise<void>;\n builds?: DevBuilds;\n}\n\nfunction fail(problems: string[], what: string): void {\n if (problems.length > 0) throw new Error(`@ascribed/astro: ${what}:\\n- ${problems.join(\"\\n- \")}`);\n}\n\n/**\n * Runs `ascribe build` for each project, checks the site's routing, adds the markdown plugin, adds a\n * page for each permalink's address, and serves published files, and, with `[consumer] agents = true`,\n * `llms.txt` and each page's Markdown, each at its project's base path; and writes the site's one\n * sitemap and `robots.txt` from every project's page records, and, with `[consumer] headers =\n * \"netlify\"`, its `_headers` from their headers lists.\n */\nexport default function ascribe(options: AscribeOptions): AstroIntegration {\n /** With `projects`; otherwise the one entry has no name a collection gives. */\n const named = options.projects !== undefined;\n let entries: Entry[] = [];\n let groups: DevGroup[] = [];\n let routing: AstroRouting | undefined;\n /** The dev server's sources as its first build read them. */\n const seen = new SeenFiles();\n let binary: string | undefined;\n let reviewed: Entry | undefined;\n let devCommand = false;\n let devHttps = false;\n let review: ReviewServer | undefined;\n /** The site's routes, as Astro resolved them, for what `astro dev` serves of the site's own. */\n let astroRoutes: IntegrationResolvedRoute[] = [];\n /** The site's `public/` folder, where its own `robots.txt` would be. */\n let publicDir = \"\";\n\n /** What the sitemap and `robots.txt` are drawn from, given the site's pages and its routes. */\n const rootSources = (\n sitePages: readonly string[],\n routed: (route: string) => boolean,\n ): RootFileSources => {\n const base = routing?.base ?? \"/\";\n const records = entries.map((entry) => readRecords(entry.siteRoot));\n // Entries of one project share its `ascribe.toml`, and so what it says to crawlers.\n const robots = new Map<string, ProjectRobots>();\n for (const [i, entry] of entries.entries()) {\n if (!robots.has(entry.project.dir))\n robots.set(entry.project.dir, {\n name: entry.name,\n robots: records[i]?.robots ?? { lines: [] },\n });\n }\n const root = normalizeBase(base);\n return {\n projects: [\n ...records.map(pageList),\n // An older line's pages are the site's too: those the current line has point at it.\n ...entries.flatMap((entry) =>\n olderLines(entry.siteRoot).map((line) => pageList(readRecords(line.siteRoot))),\n ),\n ],\n routed,\n sitePages,\n excluded: [\n ...forwardingRoutes(entries.map((entry) => readPermalinks(entry.siteRoot))),\n `${root}404`,\n `${root}500`,\n ...(options.sitemap?.exclude ?? []),\n ],\n robots: [...robots.values()],\n site: routing?.site,\n base,\n ownRobots: existsSync(path.join(publicDir, \"robots.txt\")),\n ownSitemap: existsSync(path.join(publicDir, \"sitemap.xml\")),\n };\n };\n return {\n name: \"@ascribed/astro\",\n hooks: {\n \"astro:config:setup\": async ({\n config,\n command,\n logger,\n updateConfig,\n addDevToolbarApp,\n createCodegenDir,\n injectRoute,\n addMiddleware,\n }) => {\n const root = fileURLToPath(config.root);\n publicDir = fileURLToPath(config.publicDir);\n const list: ProjectEntry[] = options.projects ?? [\n {\n name: \"\",\n build: options.build,\n ...(options.project === undefined ? {} : { project: options.project }),\n },\n ];\n if (named) fail(nameProblems(list), \"the `projects` option is wrong\");\n const codegen = command === \"preview\" ? \"\" : fileURLToPath(createCodegenDir());\n entries = list.map((entry) => {\n const project = readProject(path.resolve(root, entry.project ?? \".\"));\n return {\n name: entry.name,\n build: entry.build,\n project,\n // An unknown build is `ascribe build`'s to report: it knows the implicit `site` build.\n siteRoot: project.siteRoot(entry.build),\n agentsRoot: project.consumer.agents ? project.plainRoot(entry.build) : undefined,\n schemaDir: named ? path.join(codegen, entry.name) : codegen,\n };\n });\n\n // What astro.config leaves unset comes from [consumer]: `site` and `trailingSlash` from the\n // first project that has them, and with one project, `base` from its base path. With\n // `projects`, `base` stays the site's, the root every base path is under.\n const { routing: astro, supplied } = supplyRouting(\n entries.map((entry) => entry.project),\n { base: config.base, trailingSlash: config.trailingSlash, site: config.site },\n !named,\n );\n // `ascribe.toml`'s routing must be Astro's, or every link Ascribe writes is wrong.\n for (const entry of entries) {\n fail(\n consumerMismatches(entry.project, astro),\n named\n ? `\"${entry.name}\"'s ascribe.toml and astro.config disagree`\n : \"ascribe.toml and astro.config disagree\",\n );\n }\n fail(basePathClashes(entries), \"two projects share a base path\");\n\n if (typeof options.review === \"string\" && !entries.some((e) => e.name === options.review)) {\n throw new Error(\n `@ascribed/astro: \\`review\\` names \"${options.review}\", and no entry of \\`projects\\` has that name.`,\n );\n }\n if (reviewFor(options.review, command)) {\n reviewed =\n typeof options.review === \"string\"\n ? entries.find((e) => e.name === options.review)\n : entries[0];\n }\n\n // Where a markdown plugin goes depends on the processor Astro 7.3 runs.\n const processor = config.markdown.processor;\n const pluginLists = processor.options as {\n rehypePlugins?: unknown[];\n hastPlugins?: unknown[];\n };\n if (processor.name === \"satteri\" && pluginLists.hastPlugins !== undefined) {\n pluginLists.hastPlugins.push(satteriAscribeAttributes());\n } else if (processor.name === \"unified\" && pluginLists.rehypePlugins !== undefined) {\n pluginLists.rehypePlugins.push(rehypeAscribeAttributes);\n } else {\n throw new Error(\n `@ascribed/astro: the markdown processor \"${processor.name}\" is not one it can add its plugin to. ` +\n \"Use Astro's default (satteri) or unified(), or add `rehypeAscribeAttributes` to your own.\",\n );\n }\n\n routing = astro;\n\n if (reviewed !== undefined) {\n addDevToolbarApp({\n id: APP_ID,\n name: \"Ascribe review\",\n icon: ICON,\n entrypoint: new URL(\"./toolbar/app.js\", import.meta.url),\n });\n }\n\n if (command !== \"preview\") {\n const found = findBinary({ binary: options.binary, root });\n binary = found;\n const buildEntry = async (entry: Entry) => {\n logger.info(\n `running ${path.basename(found)} build for \"${entry.build}\"${named ? ` (${entry.name})` : \"\"}`,\n );\n const run = {\n binary: found,\n configPath: entry.project.configPath,\n cwd: entry.project.dir,\n anchors: anchorsFor(options.anchors, command, entry === reviewed),\n };\n // `llms.txt` and each page's Markdown, which agents read.\n const plain = entry.agentsRoot === undefined ? [] : ([\"plain\"] as const);\n const result = await runBuild({\n ...run,\n build: entry.build,\n outputs: [\n \"site\",\n ...plain,\n // While review is on, the JSON output says which page is at each route.\n ...(entry === reviewed && review?.active ? ([\"json\"] as const) : []),\n ],\n });\n if (hasWarnings(result.diagnostics)) logger.warn(result.diagnostics);\n else if (result.diagnostics !== \"\") logger.info(result.diagnostics);\n if (result.summary !== \"\") logger.info(result.summary);\n // A versioned build's other lines, which the build's `versions.json` names, once the\n // current line's build has written it. An error in one fails this run as it would the\n // first; `ascribe check` reports every line's warnings, so only what was built is said.\n const older = olderLines(entry.siteRoot).map((line) => line.build);\n if (older.length > 0) {\n const lines = await runBuild({\n ...run,\n build: older,\n outputs: [\n \"site\",\n ...plain,\n ...(entry === reviewed && review?.active ? ([\"json\"] as const) : []),\n ],\n });\n if (lines.summary !== \"\") logger.info(lines.summary);\n }\n // The schema's copy inside the Astro root, for content.config.ts to import.\n mkdirSync(entry.schemaDir, { recursive: true });\n copySchema(entry.siteRoot, entry.schemaDir);\n };\n // What the projects share, which no one project's build can see.\n const checkShared = () => {\n if (entries.length < 2) return;\n const current = entries.map((entry) => ({\n ...entry,\n project: readProject(entry.project.dir),\n }));\n fail(basePathClashes(current), \"two projects share a base path\");\n fail(pagesUnderOtherPaths(current), \"a page is under another project's base path\");\n fail(\n permalinkProblems(\n current,\n current.map((entry) => readPermalinks(entry.siteRoot)),\n ),\n \"the projects' permalinks can't share one route\",\n );\n };\n // One group for each project: a change rebuilds the project it's in.\n const byDir = new Map<string, Entry[]>();\n for (const entry of entries) {\n byDir.set(entry.project.dir, [...(byDir.get(entry.project.dir) ?? []), entry]);\n }\n groups = [...byDir.values()].map((group) => ({\n project: (group[0] as Entry).project,\n entries: group,\n rebuild: async () => {\n for (const entry of group) await buildEntry(entry);\n checkShared();\n },\n }));\n // The sources as the first build reads them: the watcher may report their edits late.\n if (command === \"dev\") {\n for (const group of groups)\n seen.prime([group.project.contentRoot, group.project.configPath]);\n }\n for (const entry of entries) await buildEntry(entry);\n checkShared();\n devCommand = command === \"dev\";\n if (devCommand) {\n // A tag of the head written twice, by Head.astro and the layout, is warned about.\n (globalThis as Record<symbol, unknown>)[HEAD_WARN] = (message: string) =>\n logger.warn(message);\n addMiddleware({\n entrypoint: new URL(\"./head-check.js\", import.meta.url),\n order: \"post\",\n });\n }\n\n // Each permalink's address, a page that forwards to its heading. One route serves every\n // list, at the path of the first that names anything.\n const lists = entries.flatMap((entry) => readPermalinks(entry.siteRoot) ?? []);\n const served = lists.find(hasPermalinks) ?? lists[0];\n if (served !== undefined) {\n injectRoute({\n pattern: permalinkPattern(served.path, astro.base),\n entrypoint: new URL(\"../src/Permalink.astro\", import.meta.url),\n prerender: true,\n });\n }\n }\n\n const projectHome = (entry: Entry) =>\n homeRoute(entry.project.consumer.basePath, astro.trailingSlash);\n // Dev serving of `_ascribe/files/`, and of the plain output for agents; the build copies them in `astro:build:done`.\n updateConfig({\n ...supplied,\n ...(options.codeTitles === false\n ? {}\n : { markdown: { shikiConfig: { transformers: [codeTitles] } } }),\n vite: {\n // `Elements.astro` is Astro source, so Vite must compile it, not load it as a Node module.\n ssr: { noExternal: [\"@ascribed/astro\"] },\n plugins: [\n {\n name: \"@ascribed/astro:site\",\n resolveId: (id) => (id === SITE_MODULE ? `\\0${SITE_MODULE}` : undefined),\n load: (id) =>\n id === `\\0${SITE_MODULE}`\n ? `export const siteRoot = ${JSON.stringify(entries[0]?.siteRoot ?? \"\")};\\n` +\n `export const astroRoot = ${JSON.stringify(root)};\\n` +\n `export const home = ${JSON.stringify(homeRoute(astro.base, astro.trailingSlash))};\\n` +\n `export const collections = ${JSON.stringify(\n named ? Object.fromEntries(entries.map((e) => [e.name, e.siteRoot])) : {},\n )};\\n` +\n `export const permalinks = ${JSON.stringify(\n entries.map((e) => ({ siteRoot: e.siteRoot, home: projectHome(e) })),\n )};\\n` +\n `export const routes = ${JSON.stringify(\n entries.map((e) => ({\n siteRoot: e.siteRoot,\n basePath: e.project.consumer.basePath,\n trailingSlash: e.project.consumer.trailingSlash,\n })),\n )};`\n : undefined,\n },\n {\n name: \"@ascribed/astro:files\",\n configureServer(server) {\n for (const entry of entries) {\n const base = entry.project.consumer.basePath;\n server.middlewares.use(filesMiddleware(entry.siteRoot, base));\n // Each older line's, at its own base path; the lines are read as each request comes.\n server.middlewares.use((req, res, next) =>\n inOrder(\n olderLines(entry.siteRoot).map((line) =>\n filesMiddleware(line.siteRoot, line.base),\n ),\n req,\n res,\n next,\n ),\n );\n if (entry.agentsRoot !== undefined) {\n const siteRoot = entry.siteRoot;\n server.middlewares.use(\n agentsMiddleware(entry.agentsRoot, base, (pathname) =>\n headersFor(siteRoot, pathname),\n ),\n );\n // Each older line's outputs for agents, at its own base path.\n server.middlewares.use((req, res, next) =>\n inOrder(\n olderLines(siteRoot).map((line) =>\n agentsMiddleware(line.plainRoot, line.base, (pathname) =>\n headersFor(line.siteRoot, pathname),\n ),\n ),\n req,\n res,\n next,\n ),\n );\n }\n }\n // The sitemap and robots.txt, as the build would write them now.\n server.middlewares.use(\n rootFilesMiddleware(astro.base, () =>\n rootFiles(\n rootSources(\n devSitePages(astroRoutes, astro),\n devRouted(astroRoutes, astro),\n ),\n ),\n ),\n );\n },\n },\n ],\n },\n });\n },\n \"astro:routes:resolved\": ({ routes }) => {\n astroRoutes = routes;\n },\n \"astro:server:setup\": ({ server, refreshContent, logger, toolbar }) => {\n if (!devCommand || !routing) return;\n if (!refreshContent)\n throw new Error(\"@ascribed/astro: this Astro version does not support refreshContent.\");\n devHttps = Boolean(server.config.server.https);\n for (const group of groups) {\n group.builds = watchDev({\n server,\n seen,\n refreshContent: () => refreshContent({}),\n logger,\n project: group.project,\n astro: routing,\n builds: group.entries.map((entry) => entry.build),\n rebuild: group.rebuild,\n onBuilt: () => {\n if (reviewed !== undefined && group.entries.includes(reviewed)) review?.rebuilt();\n },\n });\n }\n const group = groups.find((g) => reviewed !== undefined && g.entries.includes(reviewed));\n if (reviewed !== undefined && group?.builds !== undefined && binary !== undefined) {\n const entry = reviewed;\n const builds = group.builds;\n const run = { binary, configPath: entry.project.configPath, cwd: entry.project.dir };\n // A versioned build is reviewed in every line, the current one first, each line's\n // routes from its own JSON output.\n const lines = () =>\n linesOf(entry.siteRoot)?.map((line) => ({\n build: line.build,\n siteRoot: line.siteRoot,\n })) ?? [{ build: entry.build, siteRoot: entry.siteRoot }];\n const lineBuilds = () => lines().map((line) => line.build);\n review = new ReviewServer({\n channel: toolbar as ToolbarChannel,\n logger,\n build: entry.build,\n contentRoot: entry.project.contentRoot,\n channelProblem: channelProblem(server.config),\n diff: (base) => runDiff({ ...run, build: lineBuilds(), base }),\n prompt: (page, base) => runPrompt({ ...run, build: lineBuilds(), base, path: page }),\n projectDir: entry.project.dir,\n connect: async () => (await import(\"./review/github.js\")).connect(entry.project.dir),\n writeRoutes: () =>\n builds.inTurn(async () => {\n await runBuild({ ...run, build: lineBuilds(), outputs: [\"json\"] });\n }),\n readRoutes: async () => {\n const all = new Map<string, RoutedPage>();\n const versioned = lines().length > 1;\n for (const line of lines()) {\n const jsonRoot = path.join(path.dirname(line.siteRoot), \"json\");\n for (const [route, page] of await readRoutes(jsonRoot)) {\n if (!all.has(route))\n all.set(route, versioned ? { ...page, build: line.build } : page);\n }\n }\n return all;\n },\n });\n }\n },\n \"astro:server:start\": ({ address, logger }) => {\n review?.listening(address.address);\n if (!devCommand) return;\n // Each project's folder gets its own file, with its own address: its base path.\n for (const group of groups) {\n const entry = group.entries[0] as Entry;\n const dir = group.project.dir;\n try {\n writeDevFile(dir, {\n url: siteUrl(address, { https: devHttps, base: entry.project.consumer.basePath }),\n build: entry.build,\n pid: process.pid,\n });\n // Vite exits on a signal before `astro:server:done` runs.\n process.once(\"exit\", () => removeDevFile(dir, process.pid));\n } catch (error) {\n logger.warn(\n `couldn't write ${groups.length > 1 ? path.join(dir, \".ascribe\", \"dev.json\") : \".ascribe/dev.json\"}, which the editor's Open Site Preview reads: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n },\n \"astro:server:done\": () => {\n review?.dispose();\n review = undefined;\n if (devCommand) for (const group of groups) removeDevFile(group.project.dir, process.pid);\n },\n \"astro:build:done\": async ({ dir, pages, logger }) => {\n const base = routing?.base ?? \"/\";\n const trailingSlash = routing?.trailingSlash ?? \"ignore\";\n // Every page Astro built, by its route from the host's root. Astro lists\n // pages only, not endpoints such as a feed, so a dot in a page's last\n // segment, as in `/v1.2`, is still a page.\n const built = pages.map((page) =>\n routeAs(`${normalizeBase(base)}${page.pathname.replace(/^\\//, \"\")}`, trailingSlash),\n );\n const builtKeys = new Set(built.map(routeKey));\n const files = rootFiles(rootSources(built, (route) => builtKeys.has(routeKey(route))));\n fail(files.problems, \"the site's robots.txt\");\n for (const note of files.notes) logger[note.level](note.text);\n const out = fileURLToPath(dir);\n if (files.sitemap !== undefined) {\n await writeFile(path.join(out, \"sitemap.xml\"), files.sitemap);\n logger.info(`wrote ${sitemapRoute(base)}`);\n }\n if (files.robots !== undefined) {\n await writeFile(path.join(out, \"robots.txt\"), files.robots);\n logger.info(\"wrote /robots.txt\");\n }\n // The host's headers, from the projects that name its format.\n const ownHeaders = path.join(publicDir, \"_headers\");\n const headers = headersOutcome({\n rules: mergeRules(\n entries\n .filter((entry) => entry.project.consumer.headers === \"netlify\")\n .flatMap((entry) =>\n [entry.siteRoot, ...olderLines(entry.siteRoot).map((line) => line.siteRoot)].map(\n (siteRoot) => readHeaders(siteRoot) ?? [],\n ),\n ),\n ),\n base,\n own: existsSync(ownHeaders) ? readFileSync(ownHeaders, \"utf8\") : undefined,\n });\n if (headers.kind === \"fail\") throw new Error(`@ascribed/astro: ${headers.text}`);\n if (headers.kind === \"note\") logger.info(headers.text);\n if (headers.kind === \"write\") {\n await writeFile(path.join(out, \"_headers\"), headers.text);\n logger.info(\"wrote /_headers\");\n }\n // Entries of one project publish at one base path: the first entry's copies go last, so they win.\n for (const entry of [...entries].reverse()) {\n const folder = folderUnder(entry.project.consumer.basePath, base);\n const where = folder === \"\" ? \"\" : ` to ${folder}`;\n if (await copyPublishedFiles(entry.siteRoot, dir, folder))\n logger.info(`copied _ascribe/files/${where}`);\n for (const line of olderLines(entry.siteRoot)) {\n const lineFolder = folderUnder(line.base, base);\n if (await copyPublishedFiles(line.siteRoot, dir, lineFolder))\n logger.info(`copied ${line.build}'s _ascribe/files/ to ${lineFolder}`);\n }\n if (\n entry.agentsRoot !== undefined &&\n (await copyAgentFiles(entry.agentsRoot, dir, folder))\n )\n logger.info(`copied llms.txt and each page's Markdown${where}`);\n if (entry.agentsRoot !== undefined) {\n for (const line of olderLines(entry.siteRoot)) {\n const lineFolder = folderUnder(line.base, base);\n if (await copyAgentFiles(line.plainRoot, dir, lineFolder))\n logger.info(\n `copied ${line.build}'s llms.txt and each page's Markdown to ${lineFolder}`,\n );\n }\n }\n }\n },\n },\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,SAAS;AACT,EAAE;AACF,wBAAwB;AACxB,2CAA2C;AAC3C,kCAAkC;AAClC,sEAAsE;AACtE,2EAA2E;AAC3E,kDAAkD;AAClD,QAAQ;AACR,EAAE;AACF,6BAA6B;AAC7B,sDAAsD;AACtD,iEAAiE;AACjE,iFAAiF;AACjF,mFAAmF;AACnF,6EAA6E;AAC7E,0FAA0F;AAC1F,EAAE;AACF,gBAAgB;AAChB,+FAA+F;AAC/F,gGAAgG;AAChG,yGAAyG;AACzG,qGAAqG;AACrG,EAAE;AACF,uEAAuE;AACvE,uDAAuD;AACvD,yDAAyD;AACzD,EAAE;AACF,2BAA2B;AAC3B,0GAA0G;AAC1G,EAAE;AACF,wFAAwF;AACxF,EAAE;AACF,cAAc;AACd,kBAAkB;AAClB,6DAA6D;AAC7D,0DAA0D;AAC1D,SAAS;AACT,sBAAsB;AACtB,OAAO;AACP,gDAAgD;AAChD,OAAO,EAAE,UAAU,EA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AAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["// @ascribed/astro: the Astro integration for Ascribe. Written against Astro\n// 7.3.5.\n//\n// // astro.config.mjs\n// import ascribe from \"@ascribed/astro\";\n// export default defineConfig({\n// // `site`, `base`, and `trailingSlash` come from ascribe.toml's\n// // [consumer] when they're left out here; set here, they must agree.\n// integrations: [ascribe({ build: \"site\" })],\n// });\n//\n// // src/content.config.ts\n// import { defineCollection } from \"astro:content\";\n// import { ascribeCollection } from \"@ascribed/astro/content\";\n// // The generated schema. With the project outside the Astro root, import the\n// // copy inside it instead: \"../.astro/integrations/_ascribed_astro/schema.ts\".\n// import { schema } from \"../.ascribe/build/site/site/_ascribe/schema.ts\";\n// export const collections = { docs: defineCollection(ascribeCollection({ schema })) };\n//\n// // a layout\n// import Elements from \"@ascribed/astro/Elements.astro\"; // <Elements /> in <head>\n// import Availability from \"@ascribed/astro/Availability.astro\"; // the page's availability\n// import Head from \"@ascribed/astro/Head.astro\"; // <Head entry={entry} /> in <head>\n// import Versions from \"@ascribed/astro/Versions.astro\"; // the lines that have the page\n//\n// // the sidebar: the project's navigation, joined to the collection\n// import { sidebar } from \"@ascribed/astro/content\";\n// const groups = sidebar(await getCollection(\"docs\"));\n//\n// // src/pages/404.astro\n// import MissingPermalink from \"@ascribed/astro/MissingPermalink.astro\"; // a permalink that isn't here\n//\n// Several projects in one site, each entry named, and each collection naming its entry:\n//\n// ascribe({\n// projects: [\n// { name: \"docs\", project: \"../docs\", build: \"site\" },\n// { name: \"home\", project: \"home\", build: \"site\" },\n// ],\n// review: \"docs\",\n// })\n// ascribeCollection({ schema, name: \"docs\" })\nimport { existsSync, mkdirSync, readFileSync } from \"node:fs\";\nimport { writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { AstroIntegration, IntegrationResolvedRoute } from \"astro\";\nimport { findBinary } from \"./binary.js\";\nimport { codeTitles } from \"./code-titles.js\";\nimport { SeenFiles, watchDev, type DevBuilds } from \"./dev.js\";\nimport {\n agentsMiddleware,\n copyAgentFiles,\n copyPublishedFiles,\n filesMiddleware,\n folderUnder,\n inOrder,\n} from \"./files.js\";\nimport { WARN as HEAD_WARN } from \"./head-check.js\";\nimport { headersFor, headersOutcome, mergeRules, readHeaders } from \"./headers.js\";\nimport { forwardingRoutes, hasPermalinks, permalinkPattern, readPermalinks } from \"./permalinks.js\";\nimport {\n consumerMismatches,\n homeRoute,\n normalizeBase,\n readProject,\n supplyRouting,\n type AstroRouting,\n} from \"./project.js\";\nimport {\n basePathClashes,\n nameProblems,\n pagesUnderOtherPaths,\n permalinkProblems,\n type ProjectEntry,\n type ResolvedEntry,\n} from \"./projects.js\";\nimport {\n pageList,\n readRecords,\n routeAs,\n routeKey,\n sitemapRoute,\n type ProjectRobots,\n} from \"./records.js\";\nimport rehypeAscribeAttributes from \"./rehype.js\";\nimport { removeDevFile, siteUrl, writeDevFile } from \"./review/devfile.js\";\nimport { runDiff, runPrompt } from \"./review/diff.js\";\nimport { APP_ID } from \"./review/protocol.js\";\nimport { readRoutes, type RoutedPage } from \"./review/routes.js\";\nimport { channelProblem, ReviewServer, type ToolbarChannel } from \"./review/server.js\";\nimport {\n devRouted,\n devSitePages,\n rootFiles,\n rootFilesMiddleware,\n type RootFileSources,\n} from \"./root-files.js\";\nimport { anchorsFor, hasWarnings, reviewFor, runBuild } from \"./run.js\";\nimport { satteriAscribeAttributes } from \"./satteri.js\";\nimport { copySchema } from \"./schema.js\";\nimport { linesOf, olderLines } from \"./versions.js\";\n\nexport { default as rehypeAscribeAttributes } from \"./rehype.js\";\nexport { satteriAscribeAttributes } from \"./satteri.js\";\nexport type { ProjectEntry } from \"./projects.js\";\n\n/** The virtual module `content.ts` reads the resolved site output roots from. */\nconst SITE_MODULE = \"virtual:ascribe/site\";\n\n/** Options every form of the integration takes. */\ninterface SharedOptions {\n /**\n * The `ascribe` binary, relative to the Astro root. Default: `ASCRIBE_BIN`, then\n * the platform binary installed with `@ascribed/cli`.\n */\n binary?: string;\n /**\n * Mark each block of the site output with the source lines it came from\n * (source anchors), for review: `\"dev\"` in `astro dev` only, `true` always.\n * Default: `false`, though `review` has them in `astro dev`.\n */\n anchors?: boolean | \"dev\";\n /**\n * Review in the site preview: an **Ascribe review** app in `astro dev`'s\n * toolbar, which marks the page's changes and shows the pull request's\n * comments, with source anchors in `astro dev`. Default `true`; `false`\n * removes the app. `astro build` never has it. With several projects, it\n * reviews one: the entry a name names, or the first for `true`.\n */\n review?: boolean | string;\n /**\n * Show a code block's title (`title=\"…\"` in its info string, as `@snippet`\n * writes it), and what a tested example was tested with (`tested=\"…\"`),\n * above it, with a Shiki transformer that puts the block in a\n * `<figure class=\"code-title\">` with a `<figcaption>`. Default `true`.\n */\n codeTitles?: boolean;\n /**\n * The site's one sitemap, at `<base>sitemap.xml`, of every listed page of\n * every project and every page of the site's own. `exclude` lists routes,\n * from the host's root, of the site's own pages to leave out of it, such\n * as one that carries `noindex`.\n */\n sitemap?: { exclude?: string[] };\n}\n\n/** Options of the integration with one project. */\nexport interface OneProjectOptions extends SharedOptions {\n /** The build whose site output is the collection (a name in `ascribe.toml`). */\n build: string;\n /** The directory holding `ascribe.toml`, relative to the Astro root. Default: the root. */\n project?: string;\n projects?: never;\n}\n\n/** Options of the integration with several projects, each entry named. */\nexport interface ProjectsOptions extends SharedOptions {\n /** The projects, each a named build of a project; two entries may share a project. */\n projects: ProjectEntry[];\n build?: never;\n project?: never;\n}\n\n/** Options of the integration. */\nexport type AscribeOptions = OneProjectOptions | ProjectsOptions;\n\n/** The toolbar app's icon: a speech bubble over a page. */\nconst ICON =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M6 3h8l4 4v6\"/><path d=\"M14 3v4h4\"/><path d=\"M6 3v15\"/><path d=\"M11 14h10v6h-6l-3 2v-2h-1z\"/></svg>';\n\n/** An entry as the hooks use it. */\ninterface Entry extends ResolvedEntry {\n siteRoot: string;\n /** The plain output's root, when the project publishes it for agents. */\n agentsRoot: string | undefined;\n /** Where the generated schema's copy goes, inside the Astro root. */\n schemaDir: string;\n}\n\n/** A project with the entries that build it, which a dev watcher follows together. */\ninterface DevGroup {\n project: ResolvedEntry[\"project\"];\n entries: Entry[];\n rebuild: () => Promise<void>;\n builds?: DevBuilds;\n}\n\nfunction fail(problems: string[], what: string): void {\n if (problems.length > 0) throw new Error(`@ascribed/astro: ${what}:\\n- ${problems.join(\"\\n- \")}`);\n}\n\n/**\n * Runs `ascribe build` for each project, checks the site's routing, adds the markdown plugin, adds a\n * page for each permalink's address, and serves published files, and, with `[consumer] agents = true`,\n * `llms.txt` and each page's Markdown, each at its project's base path; and writes the site's one\n * sitemap and `robots.txt` from every project's page records, and, with `[consumer] headers =\n * \"netlify\"`, its `_headers` from their headers lists.\n */\nexport default function ascribe(options: AscribeOptions): AstroIntegration {\n /** With `projects`; otherwise the one entry has no name a collection gives. */\n const named = options.projects !== undefined;\n let entries: Entry[] = [];\n let groups: DevGroup[] = [];\n let routing: AstroRouting | undefined;\n /** The dev server's sources as its first build read them. */\n const seen = new SeenFiles();\n let binary: string | undefined;\n let reviewed: Entry | undefined;\n let devCommand = false;\n let devHttps = false;\n let review: ReviewServer | undefined;\n /** The site's routes, as Astro resolved them, for what `astro dev` serves of the site's own. */\n let astroRoutes: IntegrationResolvedRoute[] = [];\n /** The site's `public/` folder, where its own `robots.txt` would be. */\n let publicDir = \"\";\n\n /** What the sitemap and `robots.txt` are drawn from, given the site's pages and its routes. */\n const rootSources = (\n sitePages: readonly string[],\n routed: (route: string) => boolean,\n ): RootFileSources => {\n const base = routing?.base ?? \"/\";\n const records = entries.map((entry) => readRecords(entry.siteRoot));\n // Entries of one project share its `ascribe.toml`, and so what it says to crawlers.\n const robots = new Map<string, ProjectRobots>();\n for (const [i, entry] of entries.entries()) {\n if (!robots.has(entry.project.dir))\n robots.set(entry.project.dir, {\n name: entry.name,\n robots: records[i]?.robots ?? { lines: [] },\n });\n }\n const root = normalizeBase(base);\n return {\n projects: [\n ...records.map(pageList),\n // An older line's pages are the site's too: those the current line has point at it.\n ...entries.flatMap((entry) =>\n olderLines(entry.siteRoot).map((line) => pageList(readRecords(line.siteRoot))),\n ),\n ],\n routed,\n sitePages,\n excluded: [\n ...forwardingRoutes(entries.map((entry) => readPermalinks(entry.siteRoot))),\n `${root}404`,\n `${root}500`,\n ...(options.sitemap?.exclude ?? []),\n ],\n robots: [...robots.values()],\n site: routing?.site,\n base,\n ownRobots: existsSync(path.join(publicDir, \"robots.txt\")),\n ownSitemap: existsSync(path.join(publicDir, \"sitemap.xml\")),\n };\n };\n return {\n name: \"@ascribed/astro\",\n hooks: {\n \"astro:config:setup\": async ({\n config,\n command,\n logger,\n updateConfig,\n addDevToolbarApp,\n createCodegenDir,\n injectRoute,\n addMiddleware,\n }) => {\n const root = fileURLToPath(config.root);\n publicDir = fileURLToPath(config.publicDir);\n const list: ProjectEntry[] = options.projects ?? [\n {\n name: \"\",\n build: options.build,\n ...(options.project === undefined ? {} : { project: options.project }),\n },\n ];\n if (named) fail(nameProblems(list), \"the `projects` option is wrong\");\n const codegen = command === \"preview\" ? \"\" : fileURLToPath(createCodegenDir());\n entries = list.map((entry) => {\n const project = readProject(path.resolve(root, entry.project ?? \".\"), {\n binary: options.binary,\n root,\n });\n return {\n name: entry.name,\n build: entry.build,\n project,\n // An unknown build is `ascribe build`'s to report: it knows the implicit `site` build.\n siteRoot: project.siteRoot(entry.build),\n agentsRoot: project.consumer.agents ? project.plainRoot(entry.build) : undefined,\n schemaDir: named ? path.join(codegen, entry.name) : codegen,\n };\n });\n\n // What astro.config leaves unset comes from [consumer]: `site` and `trailingSlash` from the\n // first project that has them, and with one project, `base` from its base path. With\n // `projects`, `base` stays the site's, the root every base path is under.\n const { routing: astro, supplied } = supplyRouting(\n entries.map((entry) => entry.project),\n { base: config.base, trailingSlash: config.trailingSlash, site: config.site },\n !named,\n );\n // `ascribe.toml`'s routing must be Astro's, or every link Ascribe writes is wrong.\n for (const entry of entries) {\n fail(\n consumerMismatches(entry.project, astro),\n named\n ? `\"${entry.name}\"'s ascribe.toml and astro.config disagree`\n : \"ascribe.toml and astro.config disagree\",\n );\n }\n fail(basePathClashes(entries), \"two projects share a base path\");\n\n if (typeof options.review === \"string\" && !entries.some((e) => e.name === options.review)) {\n throw new Error(\n `@ascribed/astro: \\`review\\` names \"${options.review}\", and no entry of \\`projects\\` has that name.`,\n );\n }\n if (reviewFor(options.review, command)) {\n reviewed =\n typeof options.review === \"string\"\n ? entries.find((e) => e.name === options.review)\n : entries[0];\n }\n\n // Where a markdown plugin goes depends on the processor Astro 7.3 runs.\n const processor = config.markdown.processor;\n const pluginLists = processor.options as {\n rehypePlugins?: unknown[];\n hastPlugins?: unknown[];\n };\n if (processor.name === \"satteri\" && pluginLists.hastPlugins !== undefined) {\n pluginLists.hastPlugins.push(satteriAscribeAttributes());\n } else if (processor.name === \"unified\" && pluginLists.rehypePlugins !== undefined) {\n pluginLists.rehypePlugins.push(rehypeAscribeAttributes);\n } else {\n throw new Error(\n `@ascribed/astro: the markdown processor \"${processor.name}\" is not one it can add its plugin to. ` +\n \"Use Astro's default (satteri) or unified(), or add `rehypeAscribeAttributes` to your own.\",\n );\n }\n\n routing = astro;\n\n if (reviewed !== undefined) {\n addDevToolbarApp({\n id: APP_ID,\n name: \"Ascribe review\",\n icon: ICON,\n entrypoint: new URL(\"./toolbar/app.js\", import.meta.url),\n });\n }\n\n if (command !== \"preview\") {\n const found = findBinary({ binary: options.binary, root });\n binary = found;\n const buildEntry = async (entry: Entry) => {\n logger.info(\n `running ${path.basename(found)} build for \"${entry.build}\"${named ? ` (${entry.name})` : \"\"}`,\n );\n const run = {\n binary: found,\n configPath: entry.project.configPath,\n cwd: entry.project.dir,\n anchors: anchorsFor(options.anchors, command, entry === reviewed),\n };\n // `llms.txt` and each page's Markdown, which agents read.\n const plain = entry.agentsRoot === undefined ? [] : ([\"plain\"] as const);\n const result = await runBuild({\n ...run,\n build: entry.build,\n outputs: [\n \"site\",\n ...plain,\n // While review is on, the JSON output says which page is at each route.\n ...(entry === reviewed && review?.active ? ([\"json\"] as const) : []),\n ],\n });\n if (hasWarnings(result.diagnostics)) logger.warn(result.diagnostics);\n else if (result.diagnostics !== \"\") logger.info(result.diagnostics);\n if (result.summary !== \"\") logger.info(result.summary);\n // A versioned build's other lines, which the build's `versions.json` names, once the\n // current line's build has written it. An error in one fails this run as it would the\n // first; `ascribe check` reports every line's warnings, so only what was built is said.\n const older = olderLines(entry.siteRoot).map((line) => line.build);\n if (older.length > 0) {\n const lines = await runBuild({\n ...run,\n build: older,\n outputs: [\n \"site\",\n ...plain,\n ...(entry === reviewed && review?.active ? ([\"json\"] as const) : []),\n ],\n });\n if (lines.summary !== \"\") logger.info(lines.summary);\n }\n // The schema's copy inside the Astro root, for content.config.ts to import.\n mkdirSync(entry.schemaDir, { recursive: true });\n copySchema(entry.siteRoot, entry.schemaDir);\n };\n // What the projects share, which no one project's build can see.\n const checkShared = () => {\n if (entries.length < 2) return;\n const current = entries.map((entry) => ({\n ...entry,\n project: readProject(entry.project.dir, { binary: options.binary, root }),\n }));\n fail(basePathClashes(current), \"two projects share a base path\");\n fail(pagesUnderOtherPaths(current), \"a page is under another project's base path\");\n fail(\n permalinkProblems(\n current,\n current.map((entry) => readPermalinks(entry.siteRoot)),\n ),\n \"the projects' permalinks can't share one route\",\n );\n };\n // One group for each project: a change rebuilds the project it's in.\n const byDir = new Map<string, Entry[]>();\n for (const entry of entries) {\n byDir.set(entry.project.dir, [...(byDir.get(entry.project.dir) ?? []), entry]);\n }\n groups = [...byDir.values()].map((group) => ({\n project: (group[0] as Entry).project,\n entries: group,\n rebuild: async () => {\n for (const entry of group) await buildEntry(entry);\n checkShared();\n },\n }));\n // The sources as the first build reads them: the watcher may report their edits late.\n if (command === \"dev\") {\n for (const group of groups)\n seen.prime([group.project.contentRoot, group.project.configPath]);\n }\n for (const entry of entries) await buildEntry(entry);\n checkShared();\n devCommand = command === \"dev\";\n if (devCommand) {\n // A tag of the head written twice, by Head.astro and the layout, is warned about.\n (globalThis as Record<symbol, unknown>)[HEAD_WARN] = (message: string) =>\n logger.warn(message);\n addMiddleware({\n entrypoint: new URL(\"./head-check.js\", import.meta.url),\n order: \"post\",\n });\n }\n\n // Each permalink's address, a page that forwards to its heading. One route serves every\n // list, at the path of the first that names anything.\n const lists = entries.flatMap((entry) => readPermalinks(entry.siteRoot) ?? []);\n const served = lists.find(hasPermalinks) ?? lists[0];\n if (served !== undefined) {\n injectRoute({\n pattern: permalinkPattern(served.path, astro.base),\n entrypoint: new URL(\"../src/Permalink.astro\", import.meta.url),\n prerender: true,\n });\n }\n }\n\n const projectHome = (entry: Entry) =>\n homeRoute(entry.project.consumer.basePath, astro.trailingSlash);\n // Dev serving of `_ascribe/files/`, and of the plain output for agents; the build copies them in `astro:build:done`.\n updateConfig({\n ...supplied,\n ...(options.codeTitles === false\n ? {}\n : { markdown: { shikiConfig: { transformers: [codeTitles] } } }),\n vite: {\n // `Elements.astro` is Astro source, so Vite must compile it, not load it as a Node module.\n ssr: { noExternal: [\"@ascribed/astro\"] },\n plugins: [\n {\n name: \"@ascribed/astro:site\",\n resolveId: (id) => (id === SITE_MODULE ? `\\0${SITE_MODULE}` : undefined),\n load: (id) =>\n id === `\\0${SITE_MODULE}`\n ? `export const siteRoot = ${JSON.stringify(entries[0]?.siteRoot ?? \"\")};\\n` +\n `export const astroRoot = ${JSON.stringify(root)};\\n` +\n `export const home = ${JSON.stringify(homeRoute(astro.base, astro.trailingSlash))};\\n` +\n `export const collections = ${JSON.stringify(\n named ? Object.fromEntries(entries.map((e) => [e.name, e.siteRoot])) : {},\n )};\\n` +\n `export const permalinks = ${JSON.stringify(\n entries.map((e) => ({ siteRoot: e.siteRoot, home: projectHome(e) })),\n )};\\n` +\n `export const routes = ${JSON.stringify(\n entries.map((e) => ({\n siteRoot: e.siteRoot,\n basePath: e.project.consumer.basePath,\n trailingSlash: e.project.consumer.trailingSlash,\n })),\n )};`\n : undefined,\n },\n {\n name: \"@ascribed/astro:files\",\n configureServer(server) {\n for (const entry of entries) {\n const base = entry.project.consumer.basePath;\n server.middlewares.use(filesMiddleware(entry.siteRoot, base));\n // Each older line's, at its own base path; the lines are read as each request comes.\n server.middlewares.use((req, res, next) =>\n inOrder(\n olderLines(entry.siteRoot).map((line) =>\n filesMiddleware(line.siteRoot, line.base),\n ),\n req,\n res,\n next,\n ),\n );\n if (entry.agentsRoot !== undefined) {\n const siteRoot = entry.siteRoot;\n server.middlewares.use(\n agentsMiddleware(entry.agentsRoot, base, (pathname) =>\n headersFor(siteRoot, pathname),\n ),\n );\n // Each older line's outputs for agents, at its own base path.\n server.middlewares.use((req, res, next) =>\n inOrder(\n olderLines(siteRoot).map((line) =>\n agentsMiddleware(line.plainRoot, line.base, (pathname) =>\n headersFor(line.siteRoot, pathname),\n ),\n ),\n req,\n res,\n next,\n ),\n );\n }\n }\n // The sitemap and robots.txt, as the build would write them now.\n server.middlewares.use(\n rootFilesMiddleware(astro.base, () =>\n rootFiles(\n rootSources(\n devSitePages(astroRoutes, astro),\n devRouted(astroRoutes, astro),\n ),\n ),\n ),\n );\n },\n },\n ],\n },\n });\n },\n \"astro:routes:resolved\": ({ routes }) => {\n astroRoutes = routes;\n },\n \"astro:server:setup\": ({ server, refreshContent, logger, toolbar }) => {\n if (!devCommand || !routing) return;\n if (!refreshContent)\n throw new Error(\"@ascribed/astro: this Astro version does not support refreshContent.\");\n devHttps = Boolean(server.config.server.https);\n for (const group of groups) {\n group.builds = watchDev({\n server,\n seen,\n refreshContent: () => refreshContent({}),\n logger,\n project: group.project,\n astro: routing,\n builds: group.entries.map((entry) => entry.build),\n rebuild: group.rebuild,\n ...(binary === undefined ? {} : { binary: { binary, root: group.project.dir } }),\n onBuilt: () => {\n if (reviewed !== undefined && group.entries.includes(reviewed)) review?.rebuilt();\n },\n });\n }\n const group = groups.find((g) => reviewed !== undefined && g.entries.includes(reviewed));\n if (reviewed !== undefined && group?.builds !== undefined && binary !== undefined) {\n const entry = reviewed;\n const builds = group.builds;\n const run = { binary, configPath: entry.project.configPath, cwd: entry.project.dir };\n // A versioned build is reviewed in every line, the current one first, each line's\n // routes from its own JSON output.\n const lines = () =>\n linesOf(entry.siteRoot)?.map((line) => ({\n build: line.build,\n siteRoot: line.siteRoot,\n })) ?? [{ build: entry.build, siteRoot: entry.siteRoot }];\n const lineBuilds = () => lines().map((line) => line.build);\n review = new ReviewServer({\n channel: toolbar as ToolbarChannel,\n logger,\n build: entry.build,\n contentRoot: entry.project.contentRoot,\n channelProblem: channelProblem(server.config),\n diff: (base) => runDiff({ ...run, build: lineBuilds(), base }),\n prompt: (page, base) => runPrompt({ ...run, build: lineBuilds(), base, path: page }),\n projectDir: entry.project.dir,\n connect: async () => (await import(\"./review/github.js\")).connect(entry.project.dir),\n writeRoutes: () =>\n builds.inTurn(async () => {\n await runBuild({ ...run, build: lineBuilds(), outputs: [\"json\"] });\n }),\n readRoutes: async () => {\n const all = new Map<string, RoutedPage>();\n const versioned = lines().length > 1;\n for (const line of lines()) {\n const jsonRoot = path.join(path.dirname(line.siteRoot), \"json\");\n for (const [route, page] of await readRoutes(jsonRoot)) {\n if (!all.has(route))\n all.set(route, versioned ? { ...page, build: line.build } : page);\n }\n }\n return all;\n },\n });\n }\n },\n \"astro:server:start\": ({ address, logger }) => {\n review?.listening(address.address);\n if (!devCommand) return;\n // Each project's folder gets its own file, with its own address: its base path.\n for (const group of groups) {\n const entry = group.entries[0] as Entry;\n const dir = group.project.dir;\n try {\n writeDevFile(dir, {\n url: siteUrl(address, { https: devHttps, base: entry.project.consumer.basePath }),\n build: entry.build,\n pid: process.pid,\n });\n // Vite exits on a signal before `astro:server:done` runs.\n process.once(\"exit\", () => removeDevFile(dir, process.pid));\n } catch (error) {\n logger.warn(\n `couldn't write ${groups.length > 1 ? path.join(dir, \".ascribe\", \"dev.json\") : \".ascribe/dev.json\"}, which the editor's Open Site Preview reads: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n },\n \"astro:server:done\": () => {\n review?.dispose();\n review = undefined;\n if (devCommand) for (const group of groups) removeDevFile(group.project.dir, process.pid);\n },\n \"astro:build:done\": async ({ dir, pages, logger }) => {\n const base = routing?.base ?? \"/\";\n const trailingSlash = routing?.trailingSlash ?? \"ignore\";\n // Every page Astro built, by its route from the host's root. Astro lists\n // pages only, not endpoints such as a feed, so a dot in a page's last\n // segment, as in `/v1.2`, is still a page.\n const built = pages.map((page) =>\n routeAs(`${normalizeBase(base)}${page.pathname.replace(/^\\//, \"\")}`, trailingSlash),\n );\n const builtKeys = new Set(built.map(routeKey));\n const files = rootFiles(rootSources(built, (route) => builtKeys.has(routeKey(route))));\n fail(files.problems, \"the site's robots.txt\");\n for (const note of files.notes) logger[note.level](note.text);\n const out = fileURLToPath(dir);\n if (files.sitemap !== undefined) {\n await writeFile(path.join(out, \"sitemap.xml\"), files.sitemap);\n logger.info(`wrote ${sitemapRoute(base)}`);\n }\n if (files.robots !== undefined) {\n await writeFile(path.join(out, \"robots.txt\"), files.robots);\n logger.info(\"wrote /robots.txt\");\n }\n // The host's headers, from the projects that name its format.\n const ownHeaders = path.join(publicDir, \"_headers\");\n const headers = headersOutcome({\n rules: mergeRules(\n entries\n .filter((entry) => entry.project.consumer.headers === \"netlify\")\n .flatMap((entry) =>\n [entry.siteRoot, ...olderLines(entry.siteRoot).map((line) => line.siteRoot)].map(\n (siteRoot) => readHeaders(siteRoot) ?? [],\n ),\n ),\n ),\n base,\n own: existsSync(ownHeaders) ? readFileSync(ownHeaders, \"utf8\") : undefined,\n });\n if (headers.kind === \"fail\") throw new Error(`@ascribed/astro: ${headers.text}`);\n if (headers.kind === \"note\") logger.info(headers.text);\n if (headers.kind === \"write\") {\n await writeFile(path.join(out, \"_headers\"), headers.text);\n logger.info(\"wrote /_headers\");\n }\n // Entries of one project publish at one base path: the first entry's copies go last, so they win.\n for (const entry of [...entries].reverse()) {\n const folder = folderUnder(entry.project.consumer.basePath, base);\n const where = folder === \"\" ? \"\" : ` to ${folder}`;\n if (await copyPublishedFiles(entry.siteRoot, dir, folder))\n logger.info(`copied _ascribe/files/${where}`);\n for (const line of olderLines(entry.siteRoot)) {\n const lineFolder = folderUnder(line.base, base);\n if (await copyPublishedFiles(line.siteRoot, dir, lineFolder))\n logger.info(`copied ${line.build}'s _ascribe/files/ to ${lineFolder}`);\n }\n if (\n entry.agentsRoot !== undefined &&\n (await copyAgentFiles(entry.agentsRoot, dir, folder))\n )\n logger.info(`copied llms.txt and each page's Markdown${where}`);\n if (entry.agentsRoot !== undefined) {\n for (const line of olderLines(entry.siteRoot)) {\n const lineFolder = folderUnder(line.base, base);\n if (await copyAgentFiles(line.plainRoot, dir, lineFolder))\n logger.info(\n `copied ${line.build}'s llms.txt and each page's Markdown to ${lineFolder}`,\n );\n }\n }\n }\n },\n },\n };\n}\n"]}
package/dist/project.d.ts CHANGED
@@ -25,8 +25,19 @@ export interface ProjectInfo {
25
25
  /** The plain output's root for a build: `<output-dir>/<build>/plain`. */
26
26
  plainRoot(build: string): string;
27
27
  }
28
- /** Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read. */
29
- export declare function readProject(dir: string): ProjectInfo;
28
+ /** Where to find the binary, as the integration's `binary` option and Astro's root say. */
29
+ export interface BinaryOption {
30
+ binary?: string | undefined;
31
+ root: string;
32
+ }
33
+ /**
34
+ * Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read.
35
+ * When it has `[from]`, what it takes is the other file's, which the binary
36
+ * reads: `[consumer]` and `[builds]` are then the binary's answer, from
37
+ * `ascribe model --format json`, run with the binary `binary` finds
38
+ * (`findBinary`).
39
+ */
40
+ export declare function readProject(dir: string, binary?: BinaryOption): ProjectInfo;
30
41
  /** A base path with a leading and a trailing `/`, as Ascribe's router has it. */
31
42
  export declare function normalizeBase(base: string): string;
32
43
  /**
package/dist/project.js CHANGED
@@ -1,12 +1,21 @@
1
1
  // What the integration needs from `ascribe.toml`: where a build's site output
2
2
  // goes, and the consumer settings that must agree with `astro.config`.
3
3
  // The compiler validates the whole file; this reads
4
- // only what it compiled.
4
+ // only what it compiled. A file with `[from]` takes keys from another
5
+ // project's, which only the binary follows, so then the binary is asked.
6
+ import { execFileSync } from "node:child_process";
5
7
  import { readFileSync } from "node:fs";
6
8
  import path from "node:path";
7
9
  import { parse } from "smol-toml";
8
- /** Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read. */
9
- export function readProject(dir) {
10
+ import { findBinary } from "./binary.js";
11
+ /**
12
+ * Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read.
13
+ * When it has `[from]`, what it takes is the other file's, which the binary
14
+ * reads: `[consumer]` and `[builds]` are then the binary's answer, from
15
+ * `ascribe model --format json`, run with the binary `binary` finds
16
+ * (`findBinary`).
17
+ */
18
+ export function readProject(dir, binary) {
10
19
  const configPath = path.join(dir, "ascribe.toml");
11
20
  let table;
12
21
  try {
@@ -16,27 +25,68 @@ export function readProject(dir) {
16
25
  throw new Error(`@ascribed/astro can't read ${configPath}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
17
26
  }
18
27
  const project = section(table, "project");
19
- const consumer = section(table, "consumer");
28
+ let consumer = section(table, "consumer");
29
+ let builds = Object.keys(section(table, "builds"));
30
+ if (Object.keys(section(table, "from")).length > 0) {
31
+ const model = askModel(configPath, findBinary(binary ?? { root: dir }));
32
+ consumer = Object.fromEntries(model.consumer.filter((key) => key.set).map((key) => [key.key, key.value]));
33
+ if (takes(table, "builds"))
34
+ builds = model.builds.map((build) => build.name);
35
+ }
20
36
  const outputDir = typeof project["output-dir"] === "string" ? project["output-dir"] : ".ascribe/build";
21
37
  const contentDir = typeof project["content-root"] === "string" ? project["content-root"] : "docs";
22
38
  const trailingSlash = consumer["trailing-slash"] === "never" ? "never" : "always";
39
+ const site = typeof consumer["site"] === "string" ? consumer["site"] : undefined;
23
40
  return {
24
41
  dir,
25
42
  configPath,
26
43
  contentRoot: path.resolve(dir, contentDir),
27
44
  outputRoot: path.resolve(dir, outputDir),
28
45
  consumer: {
29
- site: typeof consumer["site"] === "string" ? consumer["site"] : undefined,
46
+ site,
30
47
  basePath: normalizeBase(typeof consumer["base-path"] === "string" ? consumer["base-path"] : "/"),
31
48
  trailingSlash,
32
- agents: consumer["agents"] === true,
49
+ // `true` with a site unless it says otherwise, as the binary reads it.
50
+ agents: typeof consumer["agents"] === "boolean" ? consumer["agents"] : site !== undefined,
33
51
  headers: consumer["headers"] === "netlify" ? "netlify" : undefined,
34
52
  },
35
- builds: Object.keys(section(table, "builds")),
53
+ builds,
36
54
  siteRoot: (build) => path.resolve(dir, outputDir, build, "site"),
37
55
  plainRoot: (build) => path.resolve(dir, outputDir, build, "plain"),
38
56
  };
39
57
  }
58
+ /** The content model as the binary reads it, `[from]` followed. Throws a readable error when it can't. */
59
+ function askModel(configPath, binary) {
60
+ try {
61
+ const out = execFileSync(binary, ["model", "--format", "json", "--config", configPath], {
62
+ encoding: "utf8",
63
+ maxBuffer: 64 * 1024 * 1024,
64
+ stdio: ["ignore", "pipe", "pipe"],
65
+ });
66
+ const report = JSON.parse(out);
67
+ return {
68
+ consumer: report.consumer ?? [],
69
+ builds: (report.builds ?? []).filter((build) => build.line === undefined),
70
+ };
71
+ }
72
+ catch (error) {
73
+ const stderr = error.stderr;
74
+ const detail = typeof stderr === "string" && stderr.trim() !== ""
75
+ ? stderr.trim()
76
+ : error instanceof Error
77
+ ? error.message
78
+ : String(error);
79
+ throw new Error(`@ascribed/astro can't read ${configPath}, whose [from] takes keys from another file, with \`ascribe model\`: ${detail}`, { cause: error });
80
+ }
81
+ }
82
+ /** Whether a `take` list of `[from]` names `name`, or a key in it. */
83
+ function takes(table, name) {
84
+ return Object.values(section(table, "from")).some((from) => {
85
+ const take = typeof from === "object" && from !== null ? from.take : [];
86
+ return (Array.isArray(take) &&
87
+ take.some((key) => typeof key === "string" && (key === name || key.startsWith(`${name}.`))));
88
+ });
89
+ }
40
90
  function section(table, name) {
41
91
  const value = table[name];
42
92
  return typeof value === "object" && value !== null && !Array.isArray(value)
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,oDAAoD;AACpD,yBAAyB;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AA8BlC,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAClD,IAAI,KAA8B,CAAC;IACnC,IAAI,CAAC;QACH,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,8BAA8B,UAAU,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACrG,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC5C,MAAM,SAAS,GACb,OAAO,OAAO,CAAC,YAAY,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;IACvF,MAAM,UAAU,GAAG,OAAO,OAAO,CAAC,cAAc,CAAC,KA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,KAAK,QAAQ,IAAI,KAAK,CAAC,aAAa,KAAK,aAAa,EAAE,CAAC;QAC9E,QAAQ,CAAC,IAAI,CACX,iCAAiC,aAAa,wCAAwC,KAAK,CAAC,aAAa,IAAI,CAC9G,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1F,QAAQ,CAAC,IAAI,CAAC,uBAAuB,IAAI,+BAA+B,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,MAAM,CAAC,GAAW;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["// What the integration needs from `ascribe.toml`: where a build's site output\n// goes, and the consumer settings that must agree with `astro.config`.\n// The compiler validates the whole file; this reads\n// only what it compiled.\nimport { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parse } from \"smol-toml\";\n\n/** The parts of an Ascribe project the integration reads. */\nexport interface ProjectInfo {\n /** The directory holding `ascribe.toml`. */\n dir: string;\n /** The path of `ascribe.toml`. */\n configPath: string;\n /** Source files and assets watched during development. */\n contentRoot: string;\n /** Generated output, never treated as a source change. */\n outputRoot: string;\n /** `[consumer]`, with the profile's defaults. */\n consumer: {\n site: string | undefined;\n basePath: string;\n trailingSlash: \"always\" | \"never\";\n /** Whether builds publish what agents read: `llms.txt` and each page's Markdown, in the plain output. */\n agents: boolean;\n /** The host whose format the site's response headers are written in: `\"netlify\"`, or none. */\n headers: \"netlify\" | undefined;\n };\n /** The names of `[builds]`'s tables, in order: empty when there are none, and the one build is `site`. */\n builds: string[];\n /** The site output's root for a build: `<output-dir>/<build>/site`. */\n siteRoot(build: string): string;\n /** The plain output's root for a build: `<output-dir>/<build>/plain`. */\n plainRoot(build: string): string;\n}\n\n/** Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read. */\nexport function readProject(dir: string): ProjectInfo {\n const configPath = path.join(dir, \"ascribe.toml\");\n let table: Record<string, unknown>;\n try {\n table = parse(readFileSync(configPath, \"utf8\"));\n } catch (error) {\n throw new Error(\n `@ascribed/astro can't read ${configPath}: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n const project = section(table, \"project\");\n const consumer = section(table, \"consumer\");\n const outputDir =\n typeof project[\"output-dir\"] === \"string\" ? project[\"output-dir\"] : \".ascribe/build\";\n const contentDir = typeof project[\"content-root\"] === \"string\" ? project[\"content-root\"] : \"docs\";\n const trailingSlash = consumer[\"trailing-slash\"] === \"never\" ? \"never\" : \"always\";\n return {\n dir,\n configPath,\n contentRoot: path.resolve(dir, contentDir),\n outputRoot: path.resolve(dir, outputDir),\n consumer: {\n site: typeof consumer[\"site\"] === \"string\" ? consumer[\"site\"] : undefined,\n basePath: normalizeBase(\n typeof consumer[\"base-path\"] === \"string\" ? consumer[\"base-path\"] : \"/\",\n ),\n trailingSlash,\n agents: consumer[\"agents\"] === true,\n headers: consumer[\"headers\"] === \"netlify\" ? \"netlify\" : undefined,\n },\n builds: Object.keys(section(table, \"builds\")),\n siteRoot: (build) => path.resolve(dir, outputDir, build, \"site\"),\n plainRoot: (build) => path.resolve(dir, outputDir, build, \"plain\"),\n };\n}\n\nfunction section(table: Record<string, unknown>, name: string): Record<string, unknown> {\n const value = table[name];\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\n/** A base path with a leading and a trailing `/`, as Ascribe's router has it. */\nexport function normalizeBase(base: string): string {\n let result = base.trim();\n if (!result.startsWith(\"/\")) result = `/${result}`;\n if (!result.endsWith(\"/\")) result += \"/\";\n return result;\n}\n\n/**\n * The route of a base path, ending the way `trailingSlash` says the site's\n * routes do: the site's root for Astro's `base`, a project's root for its\n * `[consumer] base-path`. (`import.meta.env.BASE_URL` isn't replaced in a\n * package's components.)\n */\nexport function homeRoute(base: string, trailingSlash: \"always\" | \"never\" | \"ignore\"): string {\n const root = normalizeBase(base);\n return trailingSlash === \"never\" && root !== \"/\" ? root.slice(0, -1) : root;\n}\n\n/** Astro's routing settings, as the integration reads and supplies them. */\nexport interface AstroRouting {\n base: string;\n trailingSlash: \"always\" | \"never\" | \"ignore\";\n site: string | undefined;\n}\n\n/**\n * Astro's routing with what astro.config leaves unset taken from `[consumer]`,\n * and the settings taken, for `updateConfig`. Astro gives an integration its\n * configuration with its defaults filled in, so unset is the default: no\n * `site`, `trailingSlash: \"ignore\"`, and `base: \"/\"`. `site` and\n * `trailingSlash` come from the first project that has them, since every\n * project must agree with them anyway. `base` comes from the first project's\n * `base-path` only with `supplyBase`, as with one project; with several, it\n * stays the site's, the root every base path is under. A base Astro has is\n * rewritten to end the way a supplied `trailingSlash` says, as Astro writes\n * it when the setting is its own.\n */\nexport function supplyRouting(\n projects: readonly ProjectInfo[],\n astro: AstroRouting,\n supplyBase: boolean,\n): { routing: AstroRouting; supplied: Partial<AstroRouting> } {\n const supplied: Partial<AstroRouting> = {};\n if (astro.site === undefined) {\n const site = projects.find((project) => project.consumer.site !== undefined)?.consumer.site;\n if (site !== undefined) supplied.site = site;\n }\n const first = projects[0];\n if (first === undefined) return { routing: astro, supplied };\n if (astro.trailingSlash === \"ignore\") supplied.trailingSlash = first.consumer.trailingSlash;\n const trailingSlash = supplied.trailingSlash ?? astro.trailingSlash;\n const base = homeRoute(\n supplyBase && normalizeBase(astro.base) === \"/\" ? first.consumer.basePath : astro.base,\n trailingSlash,\n );\n if (base !== astro.base) supplied.base = base;\n return { routing: { ...astro, ...supplied }, supplied };\n}\n\n/**\n * The ways `ascribe.toml`'s `[consumer]` disagrees with Astro's configuration,\n * as sentences. Ascribe writes every link with its own settings, so a site\n * whose routes differ would have broken links.\n */\nexport function consumerMismatches(\n project: ProjectInfo,\n astro: { base: string; trailingSlash: string; site: string | undefined },\n): string[] {\n const problems: string[] = [];\n const { basePath, trailingSlash, site } = project.consumer;\n // A base path under Astro's `base` leaves the rest of the site to other pages, such as a home page.\n if (!basePath.startsWith(normalizeBase(astro.base))) {\n problems.push(\n `[consumer] base-path is \"${basePath}\", but Astro's \\`base\\` is \"${astro.base}\". Set base-path to that path or a path under it.`,\n );\n }\n // Astro's \"ignore\" serves both forms, so Ascribe's links work either way.\n if (astro.trailingSlash !== \"ignore\" && astro.trailingSlash !== trailingSlash) {\n problems.push(\n `[consumer] trailing-slash is \"${trailingSlash}\", but Astro's \\`trailingSlash\\` is \"${astro.trailingSlash}\".`,\n );\n }\n if (site !== undefined && astro.site !== undefined && origin(site) !== origin(astro.site)) {\n problems.push(`[consumer] site is \"${site}\", but Astro's \\`site\\` is \"${astro.site}\".`);\n }\n return problems;\n}\n\nfunction origin(url: string): string {\n try {\n return new URL(url).origin;\n } catch {\n return url;\n }\n}\n"]}
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,oDAAoD;AACpD,sEAAsE;AACtE,yEAAyE;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoCzC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,MAAqB;IAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAClD,IAAI,KAA8B,CAAC;IACnC,IAAI,CAAC;QACH,K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AO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC","sourcesContent":["// What the integration needs from `ascribe.toml`: where a build's site output\n// goes, and the consumer settings that must agree with `astro.config`.\n// The compiler validates the whole file; this reads\n// only what it compiled. A file with `[from]` takes keys from another\n// project's, which only the binary follows, so then the binary is asked.\nimport { execFileSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parse } from \"smol-toml\";\nimport { findBinary } from \"./binary.js\";\n\n/** The parts of an Ascribe project the integration reads. */\nexport interface ProjectInfo {\n /** The directory holding `ascribe.toml`. */\n dir: string;\n /** The path of `ascribe.toml`. */\n configPath: string;\n /** Source files and assets watched during development. */\n contentRoot: string;\n /** Generated output, never treated as a source change. */\n outputRoot: string;\n /** `[consumer]`, with the profile's defaults. */\n consumer: {\n site: string | undefined;\n basePath: string;\n trailingSlash: \"always\" | \"never\";\n /** Whether builds publish what agents read: `llms.txt` and each page's Markdown, in the plain output. */\n agents: boolean;\n /** The host whose format the site's response headers are written in: `\"netlify\"`, or none. */\n headers: \"netlify\" | undefined;\n };\n /** The names of `[builds]`'s tables, in order: empty when there are none, and the one build is `site`. */\n builds: string[];\n /** The site output's root for a build: `<output-dir>/<build>/site`. */\n siteRoot(build: string): string;\n /** The plain output's root for a build: `<output-dir>/<build>/plain`. */\n plainRoot(build: string): string;\n}\n\n/** Where to find the binary, as the integration's `binary` option and Astro's root say. */\nexport interface BinaryOption {\n binary?: string | undefined;\n root: string;\n}\n\n/**\n * Reads `ascribe.toml` in `dir`. Throws a readable error if it can't be read.\n * When it has `[from]`, what it takes is the other file's, which the binary\n * reads: `[consumer]` and `[builds]` are then the binary's answer, from\n * `ascribe model --format json`, run with the binary `binary` finds\n * (`findBinary`).\n */\nexport function readProject(dir: string, binary?: BinaryOption): ProjectInfo {\n const configPath = path.join(dir, \"ascribe.toml\");\n let table: Record<string, unknown>;\n try {\n table = parse(readFileSync(configPath, \"utf8\"));\n } catch (error) {\n throw new Error(\n `@ascribed/astro can't read ${configPath}: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n const project = section(table, \"project\");\n let consumer = section(table, \"consumer\");\n let builds = Object.keys(section(table, \"builds\"));\n if (Object.keys(section(table, \"from\")).length > 0) {\n const model = askModel(configPath, findBinary(binary ?? { root: dir }));\n consumer = Object.fromEntries(\n model.consumer.filter((key) => key.set).map((key) => [key.key, key.value]),\n );\n if (takes(table, \"builds\")) builds = model.builds.map((build) => build.name);\n }\n const outputDir =\n typeof project[\"output-dir\"] === \"string\" ? project[\"output-dir\"] : \".ascribe/build\";\n const contentDir = typeof project[\"content-root\"] === \"string\" ? project[\"content-root\"] : \"docs\";\n const trailingSlash = consumer[\"trailing-slash\"] === \"never\" ? \"never\" : \"always\";\n const site = typeof consumer[\"site\"] === \"string\" ? consumer[\"site\"] : undefined;\n return {\n dir,\n configPath,\n contentRoot: path.resolve(dir, contentDir),\n outputRoot: path.resolve(dir, outputDir),\n consumer: {\n site,\n basePath: normalizeBase(\n typeof consumer[\"base-path\"] === \"string\" ? consumer[\"base-path\"] : \"/\",\n ),\n trailingSlash,\n // `true` with a site unless it says otherwise, as the binary reads it.\n agents: typeof consumer[\"agents\"] === \"boolean\" ? consumer[\"agents\"] : site !== undefined,\n headers: consumer[\"headers\"] === \"netlify\" ? \"netlify\" : undefined,\n },\n builds,\n siteRoot: (build) => path.resolve(dir, outputDir, build, \"site\"),\n plainRoot: (build) => path.resolve(dir, outputDir, build, \"plain\"),\n };\n}\n\n/** What the integration reads of `ascribe model --format json`. */\ninterface ModelReport {\n consumer: { key: string; value?: unknown; set: boolean }[];\n builds: { name: string; line?: string }[];\n}\n\n/** The content model as the binary reads it, `[from]` followed. Throws a readable error when it can't. */\nfunction askModel(configPath: string, binary: string): ModelReport {\n try {\n const out = execFileSync(binary, [\"model\", \"--format\", \"json\", \"--config\", configPath], {\n encoding: \"utf8\",\n maxBuffer: 64 * 1024 * 1024,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const report = JSON.parse(out) as Partial<ModelReport>;\n return {\n consumer: report.consumer ?? [],\n builds: (report.builds ?? []).filter((build) => build.line === undefined),\n };\n } catch (error) {\n const stderr = (error as { stderr?: unknown }).stderr;\n const detail =\n typeof stderr === \"string\" && stderr.trim() !== \"\"\n ? stderr.trim()\n : error instanceof Error\n ? error.message\n : String(error);\n throw new Error(\n `@ascribed/astro can't read ${configPath}, whose [from] takes keys from another file, with \\`ascribe model\\`: ${detail}`,\n { cause: error },\n );\n }\n}\n\n/** Whether a `take` list of `[from]` names `name`, or a key in it. */\nfunction takes(table: Record<string, unknown>, name: string): boolean {\n return Object.values(section(table, \"from\")).some((from) => {\n const take = typeof from === \"object\" && from !== null ? (from as { take?: unknown }).take : [];\n return (\n Array.isArray(take) &&\n take.some((key) => typeof key === \"string\" && (key === name || key.startsWith(`${name}.`)))\n );\n });\n}\n\nfunction section(table: Record<string, unknown>, name: string): Record<string, unknown> {\n const value = table[name];\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\n/** A base path with a leading and a trailing `/`, as Ascribe's router has it. */\nexport function normalizeBase(base: string): string {\n let result = base.trim();\n if (!result.startsWith(\"/\")) result = `/${result}`;\n if (!result.endsWith(\"/\")) result += \"/\";\n return result;\n}\n\n/**\n * The route of a base path, ending the way `trailingSlash` says the site's\n * routes do: the site's root for Astro's `base`, a project's root for its\n * `[consumer] base-path`. (`import.meta.env.BASE_URL` isn't replaced in a\n * package's components.)\n */\nexport function homeRoute(base: string, trailingSlash: \"always\" | \"never\" | \"ignore\"): string {\n const root = normalizeBase(base);\n return trailingSlash === \"never\" && root !== \"/\" ? root.slice(0, -1) : root;\n}\n\n/** Astro's routing settings, as the integration reads and supplies them. */\nexport interface AstroRouting {\n base: string;\n trailingSlash: \"always\" | \"never\" | \"ignore\";\n site: string | undefined;\n}\n\n/**\n * Astro's routing with what astro.config leaves unset taken from `[consumer]`,\n * and the settings taken, for `updateConfig`. Astro gives an integration its\n * configuration with its defaults filled in, so unset is the default: no\n * `site`, `trailingSlash: \"ignore\"`, and `base: \"/\"`. `site` and\n * `trailingSlash` come from the first project that has them, since every\n * project must agree with them anyway. `base` comes from the first project's\n * `base-path` only with `supplyBase`, as with one project; with several, it\n * stays the site's, the root every base path is under. A base Astro has is\n * rewritten to end the way a supplied `trailingSlash` says, as Astro writes\n * it when the setting is its own.\n */\nexport function supplyRouting(\n projects: readonly ProjectInfo[],\n astro: AstroRouting,\n supplyBase: boolean,\n): { routing: AstroRouting; supplied: Partial<AstroRouting> } {\n const supplied: Partial<AstroRouting> = {};\n if (astro.site === undefined) {\n const site = projects.find((project) => project.consumer.site !== undefined)?.consumer.site;\n if (site !== undefined) supplied.site = site;\n }\n const first = projects[0];\n if (first === undefined) return { routing: astro, supplied };\n if (astro.trailingSlash === \"ignore\") supplied.trailingSlash = first.consumer.trailingSlash;\n const trailingSlash = supplied.trailingSlash ?? astro.trailingSlash;\n const base = homeRoute(\n supplyBase && normalizeBase(astro.base) === \"/\" ? first.consumer.basePath : astro.base,\n trailingSlash,\n );\n if (base !== astro.base) supplied.base = base;\n return { routing: { ...astro, ...supplied }, supplied };\n}\n\n/**\n * The ways `ascribe.toml`'s `[consumer]` disagrees with Astro's configuration,\n * as sentences. Ascribe writes every link with its own settings, so a site\n * whose routes differ would have broken links.\n */\nexport function consumerMismatches(\n project: ProjectInfo,\n astro: { base: string; trailingSlash: string; site: string | undefined },\n): string[] {\n const problems: string[] = [];\n const { basePath, trailingSlash, site } = project.consumer;\n // A base path under Astro's `base` leaves the rest of the site to other pages, such as a home page.\n if (!basePath.startsWith(normalizeBase(astro.base))) {\n problems.push(\n `[consumer] base-path is \"${basePath}\", but Astro's \\`base\\` is \"${astro.base}\". Set base-path to that path or a path under it.`,\n );\n }\n // Astro's \"ignore\" serves both forms, so Ascribe's links work either way.\n if (astro.trailingSlash !== \"ignore\" && astro.trailingSlash !== trailingSlash) {\n problems.push(\n `[consumer] trailing-slash is \"${trailingSlash}\", but Astro's \\`trailingSlash\\` is \"${astro.trailingSlash}\".`,\n );\n }\n if (site !== undefined && astro.site !== undefined && origin(site) !== origin(astro.site)) {\n problems.push(`[consumer] site is \"${site}\", but Astro's \\`site\\` is \"${astro.site}\".`);\n }\n return problems;\n}\n\nfunction origin(url: string): string {\n try {\n return new URL(url).origin;\n } catch {\n return url;\n }\n}\n"]}
@@ -1 +1 @@
1
- export declare const PANEL_CSS = "\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #22272e;\n --muted: #676c75;\n --win: #ffffff;\n --side: #f7f9fd;\n --line: #e3e6ec;\n --accent: #5962e8;\n --accent-ink: #ffffff;\n --notice: #fef5eb;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n";
1
+ export declare const PANEL_CSS = "\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #0b1824;\n --muted: #47606f;\n --win: #f2f7f9;\n --side: #ffffff;\n --line: #ccdce4;\n --accent: #0b6f8e;\n --accent-ink: #ffffff;\n --focus: #b4530f;\n --notice: #fdf1d8;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #e3f1f7;\n --muted: #8aa6b8;\n --win: #0b1824;\n --side: #112233;\n --line: #263a4b;\n --accent: #56d0f0;\n --accent-ink: #0b1824;\n --focus: #f0a35e;\n --notice: #32240a;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #e3f1f7;\n --muted: #8aa6b8;\n --win: #0b1824;\n --side: #112233;\n --line: #263a4b;\n --accent: #56d0f0;\n --accent-ink: #0b1824;\n --focus: #f0a35e;\n --notice: #32240a;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--focus);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n";
@@ -3,14 +3,15 @@
3
3
  export const PANEL_CSS = `
4
4
  .panel {
5
5
  /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */
6
- --ink: #22272e;
7
- --muted: #676c75;
8
- --win: #ffffff;
9
- --side: #f7f9fd;
10
- --line: #e3e6ec;
11
- --accent: #5962e8;
6
+ --ink: #0b1824;
7
+ --muted: #47606f;
8
+ --win: #f2f7f9;
9
+ --side: #ffffff;
10
+ --line: #ccdce4;
11
+ --accent: #0b6f8e;
12
12
  --accent-ink: #ffffff;
13
- --notice: #fef5eb;
13
+ --focus: #b4530f;
14
+ --notice: #fdf1d8;
14
15
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
15
16
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
16
17
  /* End of generated panel. */
@@ -19,27 +20,29 @@ export const PANEL_CSS = `
19
20
  @media (prefers-color-scheme: dark) {
20
21
  .panel:not([data-scheme="light"]) {
21
22
  /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */
22
- --ink: #f0f3f7;
23
- --muted: #a5a9b2;
24
- --win: #0c0f16;
25
- --side: #13171f;
26
- --line: #393d46;
27
- --accent: #91a1fe;
28
- --accent-ink: #0c0f16;
29
- --notice: #2b1a03;
23
+ --ink: #e3f1f7;
24
+ --muted: #8aa6b8;
25
+ --win: #0b1824;
26
+ --side: #112233;
27
+ --line: #263a4b;
28
+ --accent: #56d0f0;
29
+ --accent-ink: #0b1824;
30
+ --focus: #f0a35e;
31
+ --notice: #32240a;
30
32
  /* End of generated panel. */
31
33
  }
32
34
  }
33
35
  .panel[data-scheme="dark"] {
34
36
  /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */
35
- --ink: #f0f3f7;
36
- --muted: #a5a9b2;
37
- --win: #0c0f16;
38
- --side: #13171f;
39
- --line: #393d46;
40
- --accent: #91a1fe;
41
- --accent-ink: #0c0f16;
42
- --notice: #2b1a03;
37
+ --ink: #e3f1f7;
38
+ --muted: #8aa6b8;
39
+ --win: #0b1824;
40
+ --side: #112233;
41
+ --line: #263a4b;
42
+ --accent: #56d0f0;
43
+ --accent-ink: #0b1824;
44
+ --focus: #f0a35e;
45
+ --notice: #32240a;
43
46
  /* End of generated panel. */
44
47
  }
45
48
  .panel {
@@ -183,7 +186,7 @@ button:disabled {
183
186
  }
184
187
  button:focus-visible,
185
188
  a:focus-visible {
186
- outline: 2px solid var(--accent);
189
+ outline: 2px solid var(--focus);
187
190
  outline-offset: 1px;
188
191
  }
189
192
  .ghost {
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/toolbar/style.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8PxB,CAAC","sourcesContent":["// The toolbar app's panel, in the app's own shadow root: the page's styles\n// don't reach it, and its don't reach the page.\nexport const PANEL_CSS = `\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #22272e;\n --muted: #676c75;\n --win: #ffffff;\n --side: #f7f9fd;\n --line: #e3e6ec;\n --accent: #5962e8;\n --accent-ink: #ffffff;\n --notice: #fef5eb;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #f0f3f7;\n --muted: #a5a9b2;\n --win: #0c0f16;\n --side: #13171f;\n --line: #393d46;\n --accent: #91a1fe;\n --accent-ink: #0c0f16;\n --notice: #2b1a03;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--accent);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n`;\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/toolbar/style.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiQxB,CAAC","sourcesContent":["// The toolbar app's panel, in the app's own shadow root: the page's styles\n// don't reach it, and its don't reach the page.\nexport const PANEL_CSS = `\n.panel {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, light. */\n --ink: #0b1824;\n --muted: #47606f;\n --win: #f2f7f9;\n --side: #ffffff;\n --line: #ccdce4;\n --accent: #0b6f8e;\n --accent-ink: #ffffff;\n --focus: #b4530f;\n --notice: #fdf1d8;\n --ui: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;\n /* End of generated panel. */\n}\n/* Light or dark as the page is (data-scheme), else as the reader's system is. */\n@media (prefers-color-scheme: dark) {\n .panel:not([data-scheme=\"light\"]) {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #e3f1f7;\n --muted: #8aa6b8;\n --win: #0b1824;\n --side: #112233;\n --line: #263a4b;\n --accent: #56d0f0;\n --accent-ink: #0b1824;\n --focus: #f0a35e;\n --notice: #32240a;\n /* End of generated panel. */\n }\n}\n.panel[data-scheme=\"dark\"] {\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: panel, dark. */\n --ink: #e3f1f7;\n --muted: #8aa6b8;\n --win: #0b1824;\n --side: #112233;\n --line: #263a4b;\n --accent: #56d0f0;\n --accent-ink: #0b1824;\n --focus: #f0a35e;\n --notice: #32240a;\n /* End of generated panel. */\n}\n.panel {\n position: fixed;\n left: 50%;\n bottom: 72px;\n transform: translateX(-50%);\n width: min(960px, calc(100vw - 20px));\n box-sizing: border-box;\n max-height: 300px;\n overflow-y: auto;\n background: var(--win);\n color: var(--ink);\n border: 1px solid var(--ink);\n border-radius: 8px;\n /* Generated from design/tokens.toml by scripts/design/tokens.ts: shadow, light. */\n box-shadow: 0 8px 28px rgb(0 0 0 / 0.3);\n /* End of generated shadow. */\n font: 12.5px/1.45 var(--ui);\n z-index: 1;\n}\n.ttl {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 4px 10px;\n font-size: 11px;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n font-weight: 700;\n background: var(--ink);\n color: var(--win);\n position: sticky;\n top: 0;\n}\n.ttl .grow {\n flex: 1;\n}\n.ttl button {\n border: 0;\n background: transparent;\n color: var(--win);\n padding: 0;\n font: inherit;\n text-transform: none;\n letter-spacing: 0;\n font-weight: 400;\n cursor: pointer;\n}\n.row,\n.notice,\n.unsent {\n display: flex;\n flex-wrap: wrap;\n gap: 6px 10px;\n align-items: center;\n padding: 6px 10px;\n border-bottom: 1px solid var(--line);\n font-size: 12px;\n}\n.row {\n background: var(--side);\n}\n.row .grow {\n flex: 1;\n min-width: 160px;\n color: var(--muted);\n}\n.row b {\n color: var(--ink);\n font-weight: 600;\n}\n.legend {\n flex-basis: 100%;\n color: var(--muted);\n font-size: 11.5px;\n}\n.notice,\n.unsent {\n background: var(--notice);\n font-size: 12.5px;\n}\n.notice code {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 0.95em;\n}\n.spacer {\n flex: 1;\n}\n.body {\n padding: 8px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n border-bottom: 1px solid var(--line);\n}\n.body:last-child,\n.row:last-child,\n.notice:last-child,\n.unsent:last-child {\n border-bottom: 0;\n}\n.hint {\n color: var(--muted);\n font-size: 11.5px;\n}\nul {\n margin: 0;\n padding-left: 18px;\n}\nli + li {\n margin-top: 2px;\n}\n.thread {\n border: 1px solid var(--line);\n border-radius: 6px;\n padding: 6px 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.thread .where {\n color: var(--muted);\n font-size: 11.5px;\n}\n.thread .comment p {\n margin: 0;\n}\ncode {\n font-family: var(--mono);\n font-size: 0.92em;\n}\nbutton {\n font: inherit;\n cursor: pointer;\n color: inherit;\n}\nbutton:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\nbutton:focus-visible,\na:focus-visible {\n outline: 2px solid var(--focus);\n outline-offset: 1px;\n}\n.ghost {\n border: 1px solid var(--line);\n background: var(--win);\n border-radius: 5px;\n padding: 2px 8px;\n font-size: 12px;\n}\n.ghost:hover {\n border-color: var(--accent);\n color: var(--accent);\n}\n.square {\n min-width: 28px;\n min-height: 24px;\n}\n.primary {\n border: 1px solid var(--accent);\n background: var(--accent);\n color: var(--accent-ink);\n border-radius: 5px;\n padding: 2px 10px;\n font-size: 12.5px;\n font-weight: 600;\n}\n.link,\na {\n border: 0;\n background: transparent;\n color: var(--accent);\n padding: 0;\n font-size: inherit;\n text-decoration: none;\n}\n.link:hover,\na:hover {\n text-decoration: underline;\n}\n.position {\n white-space: nowrap;\n}\n.segmented {\n display: inline-flex;\n border: 1px solid var(--line);\n border-radius: 5px;\n overflow: hidden;\n}\n.segmented button {\n border: 0;\n background: transparent;\n padding: 2px 9px;\n font-size: 12px;\n color: var(--muted);\n}\n.segmented button + button {\n border-left: 1px solid var(--line);\n}\n.segmented button[aria-pressed=\"true\"] {\n background: var(--accent);\n color: var(--accent-ink);\n}\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n}\n`;\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ascribed/astro",
3
- "version": "0.4.1",
4
- "description": "The Astro integration for Ascribe.",
3
+ "version": "0.4.2",
4
+ "description": "A toolchain for documentation written as code. This package is its Astro integration, which publishes a project's pages as a site.",
5
5
  "type": "module",
6
6
  "license": "MPL-2.0",
7
7
  "author": "Bryo Studio <hello@bryostudio.com> (https://bryostudio.com)",
@@ -10,7 +10,15 @@
10
10
  "url": "git+https://github.com/ascribed-dev/ascribe.git",
11
11
  "directory": "packages/astro"
12
12
  },
13
- "homepage": "https://github.com/ascribed-dev/ascribe/tree/main/packages/astro#readme",
13
+ "keywords": [
14
+ "ascribe",
15
+ "documentation",
16
+ "markdown",
17
+ "docs-as-code",
18
+ "astro",
19
+ "astro-integration"
20
+ ],
21
+ "homepage": "https://ascribed-dev.com/go/astro-guide/",
14
22
  "bugs": "https://github.com/ascribed-dev/ascribe/issues",
15
23
  "sideEffects": false,
16
24
  "bin": {
@@ -59,9 +67,9 @@
59
67
  "node": ">=24"
60
68
  },
61
69
  "dependencies": {
62
- "@ascribed/cli": "0.4.1",
63
- "@ascribed/elements": "0.4.1",
64
- "@ascribed/review": "0.4.1",
70
+ "@ascribed/cli": "0.4.2",
71
+ "@ascribed/elements": "0.4.2",
72
+ "@ascribed/review": "0.4.2",
65
73
  "github-slugger": "^2.0.0",
66
74
  "property-information": "^7.2.0",
67
75
  "smol-toml": "^1.9.1"
@@ -82,9 +90,9 @@
82
90
  "devDependencies": {
83
91
  "@types/hast": "^3.0.4",
84
92
  "@types/node": "^24.19.2",
85
- "astro": "7.3.8",
93
+ "astro": "7.4.0",
86
94
  "hast-util-from-html": "^2.0.3",
87
- "jsdom": "^30.1.2",
95
+ "jsdom": "^30.1.3",
88
96
  "rehype-raw": "^7.0.0",
89
97
  "rehype-stringify": "^10.0.1",
90
98
  "remark-gfm": "^4.0.1",