@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.91

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.
Files changed (223) hide show
  1. package/compiler-assets/nextjs/defaults/group/layout.tsx +1 -5
  2. package/compiler-assets/nextjs/defaults/group/page.tsx +31 -22
  3. package/compiler-assets/nextjs/defaults/project/next.config.mjs +19 -10
  4. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
  5. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  6. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  7. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +2 -0
  8. package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
  9. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  10. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  11. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  12. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  13. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  14. package/compiler-assets/nextjs/shims/proxy.ts +126 -60
  15. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
  16. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
  17. package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
  18. package/dist/{build-operation-2JAYBSKF.js → build-operation-5QMLXF7N.js} +29 -23
  19. package/dist/{button-c3WGnxIj.d.ts → button-BdCScEKi.d.ts} +3 -3
  20. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  21. package/dist/chunk-22RSSUNV.js +13 -0
  22. package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
  23. package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
  24. package/dist/chunk-5KAD7W53.js +248 -0
  25. package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
  26. package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
  27. package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
  28. package/dist/chunk-EFO6AWXN.js +19 -0
  29. package/dist/{chunk-726GV2NF.js → chunk-F3AGNDF4.js} +100 -67
  30. package/dist/chunk-GBPLER5H.js +426 -0
  31. package/dist/chunk-IL4RJOKI.js +186 -0
  32. package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
  33. package/dist/{chunk-VO2I7MTM.js → chunk-ORIUWJBQ.js} +8 -6
  34. package/dist/{chunk-H6XILMZX.js → chunk-OXOFRXEI.js} +1806 -831
  35. package/dist/chunk-UYGCOWRF.js +1709 -0
  36. package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
  37. package/dist/compiler.d.ts +15 -2
  38. package/dist/compiler.js +90 -21
  39. package/dist/components/blocks/agent-actions.d.ts +81 -0
  40. package/dist/components/blocks/agent-actions.js +594 -0
  41. package/dist/components/blocks/toc.d.ts +43 -0
  42. package/dist/components/blocks/toc.js +136 -0
  43. package/dist/components/ui/button.d.ts +5 -0
  44. package/dist/components/ui/button.js +94 -0
  45. package/dist/compose-CVBJRAF6.js +16 -0
  46. package/dist/config/createNextConfig.js +17 -3
  47. package/dist/{dev-operation-TZDVJCN7.js → dev-operation-OSHHWRWK.js} +121 -81
  48. package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
  49. package/dist/ide-support-CU6Z5PVR.js +16 -0
  50. package/dist/index.d.ts +40 -1
  51. package/dist/jsx-dev-runtime.d.ts +6 -0
  52. package/dist/jsx-dev-runtime.js +100 -0
  53. package/dist/jsx-runtime.d.ts +7 -0
  54. package/dist/jsx-runtime.js +97 -0
  55. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  56. package/dist/kernel/components/blocks/AgentActions.js +383 -142
  57. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  58. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  59. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  60. package/dist/kernel/components/blocks/color-palette.js +4 -4
  61. package/dist/kernel/components/blocks/logo-block.js +1 -1
  62. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -2
  63. package/dist/kernel/components/blocks/navbar.js +17 -17
  64. package/dist/kernel/components/blocks/navigation-progress.js +2 -2
  65. package/dist/kernel/components/blocks/next-prev.js +1 -1
  66. package/dist/kernel/components/blocks/page-list.js +2 -2
  67. package/dist/kernel/components/blocks/search.d.ts +1 -1
  68. package/dist/kernel/components/blocks/search.js +16 -17
  69. package/dist/kernel/components/blocks/sidebar-node.js +1 -1
  70. package/dist/kernel/components/blocks/sidebar.js +7 -4
  71. package/dist/kernel/components/blocks/theme-toggle.d.ts +1 -1
  72. package/dist/kernel/components/blocks/theme-toggle.js +5 -5
  73. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  74. package/dist/kernel/components/blocks/toc-client.js +495 -0
  75. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  76. package/dist/kernel/components/blocks/toc.js +121 -179
  77. package/dist/kernel/components/mdx/components/blockquote.js +1 -1
  78. package/dist/kernel/components/mdx/components/callout.js +1 -1
  79. package/dist/kernel/components/mdx/components/code-block.js +2 -2
  80. package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
  81. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  82. package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
  83. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  84. package/dist/kernel/components/mdx/components/figure.js +23 -13
  85. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  86. package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
  87. package/dist/kernel/components/mdx/components/heading.js +6 -3
  88. package/dist/kernel/components/mdx/components/hr.js +2 -2
  89. package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
  90. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  91. package/dist/kernel/components/mdx/components/image.js +21 -16
  92. package/dist/kernel/components/mdx/components/inline-code.js +1 -1
  93. package/dist/kernel/components/mdx/components/kbd.js +2 -2
  94. package/dist/kernel/components/mdx/components/link.d.ts +3 -3
  95. package/dist/kernel/components/mdx/components/link.js +2 -2
  96. package/dist/kernel/components/mdx/components/paragraph.js +1 -1
  97. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  98. package/dist/kernel/components/mdx/components/table.js +2 -2
  99. package/dist/kernel/components/mdx/components/task-list.js +1 -1
  100. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  101. package/dist/kernel/components/mdx/components/video-player.js +6 -2
  102. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  103. package/dist/kernel/components/mdx/components/video.js +7 -5
  104. package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
  105. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  106. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  107. package/dist/kernel/components/mdx/mdx.d.ts +20 -10
  108. package/dist/kernel/components/mdx/mdx.js +231 -34
  109. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  110. package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
  111. package/dist/kernel/components/mdx/types.d.ts +1 -1
  112. package/dist/kernel/components/next-image.d.ts +12 -0
  113. package/dist/kernel/components/next-image.js +61 -0
  114. package/dist/kernel/components/ui/accordion.js +1 -1
  115. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -2
  116. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  117. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
  118. package/dist/kernel/components/ui/breadcrumb.js +4 -4
  119. package/dist/kernel/components/ui/button-group.d.ts +1 -1
  120. package/dist/kernel/components/ui/button-group.js +3 -3
  121. package/dist/kernel/components/ui/button.d.ts +56 -4
  122. package/dist/kernel/components/ui/button.js +43 -39
  123. package/dist/kernel/components/ui/card.js +1 -1
  124. package/dist/kernel/components/ui/dialog.js +1 -1
  125. package/dist/kernel/components/ui/drawer.js +1 -1
  126. package/dist/kernel/components/ui/input.d.ts +2 -2
  127. package/dist/kernel/components/ui/input.js +1 -1
  128. package/dist/kernel/components/ui/kbd.d.ts +1 -1
  129. package/dist/kernel/components/ui/kbd.js +1 -1
  130. package/dist/kernel/components/ui/link.d.ts +8 -2
  131. package/dist/kernel/components/ui/link.js +2 -2
  132. package/dist/kernel/components/ui/menu.js +1 -1
  133. package/dist/kernel/components/ui/mod-key.js +2 -2
  134. package/dist/kernel/components/ui/navigation-menu.js +1 -1
  135. package/dist/kernel/components/ui/popover.js +1 -1
  136. package/dist/kernel/components/ui/progress.js +1 -1
  137. package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
  138. package/dist/kernel/components/ui/scroll-area.js +1 -1
  139. package/dist/kernel/components/ui/select.js +1 -1
  140. package/dist/kernel/components/ui/separator.js +1 -1
  141. package/dist/kernel/components/ui/table.js +1 -1
  142. package/dist/kernel/components/ui/tabs.js +1 -1
  143. package/dist/kernel/components/ui/tag.js +1 -1
  144. package/dist/kernel/components/ui/text.d.ts +1 -1
  145. package/dist/kernel/components/ui/text.js +1 -1
  146. package/dist/kernel/components/ui/toast.js +1 -1
  147. package/dist/kernel/components/ui/tooltip.js +1 -1
  148. package/dist/kernel/defaults.registry.d.ts +2 -15
  149. package/dist/kernel/defaults.registry.js +2 -17
  150. package/dist/kernel/routes/agent/markdown.d.ts +3 -0
  151. package/dist/kernel/routes/agent/markdown.js +219 -48
  152. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  153. package/dist/kernel/routes/layouts/group.js +5 -7
  154. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  155. package/dist/kernel/routes/metadata/feed.js +109 -83
  156. package/dist/kernel/routes/metadata/llms.d.ts +11 -3
  157. package/dist/kernel/routes/metadata/llms.js +154 -57
  158. package/dist/kernel/routes/metadata/og-image.js +1 -1
  159. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  160. package/dist/kernel/routes/metadata/sitemap.d.ts +22 -3
  161. package/dist/kernel/routes/metadata/sitemap.js +183 -43
  162. package/dist/kernel/routes/not-found.d.ts +34 -0
  163. package/dist/kernel/routes/not-found.js +213 -0
  164. package/dist/kernel/routes/pages/group.d.ts +2 -2
  165. package/dist/kernel/routes/pages/group.js +1 -1
  166. package/dist/kernel/routes/pages/leaf.d.ts +30 -3
  167. package/dist/kernel/routes/pages/leaf.js +5 -4
  168. package/dist/kernel/routes/pages/root.d.ts +2 -2
  169. package/dist/kernel/routes/pages/root.js +1 -1
  170. package/dist/keyboard-shortcuts.js +1 -1
  171. package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
  172. package/dist/search.js +7 -9
  173. package/dist/theme-scope.js +1 -1
  174. package/dist/{types-BzkZty3r.d.ts → types-J2w_puPF.d.ts} +1 -20
  175. package/dist/types-sM2g9nW0.d.ts +12 -0
  176. package/dist/types.d.ts +1 -0
  177. package/dist/utils/heading-ids.js +30 -11
  178. package/dist/utils/toc-selection.d.ts +7 -0
  179. package/dist/utils/toc-selection.js +14 -0
  180. package/dist/validate-local-source-SV44DBQT.js +16 -0
  181. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  182. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  183. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  184. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  185. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  186. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  187. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  188. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  189. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  190. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  191. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
  192. package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
  193. package/init/seed/minimal/publish.os/publish.os.config.json +6 -2
  194. package/init/seed/minimal/publish.os/theme.css +3 -3
  195. package/init/seed/minimal/seed.json +11 -4
  196. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
  197. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  198. package/package.json +45 -20
  199. package/release/app/phosphor/package.json +3 -3
  200. package/release/app/phosphor/pnpm-lock.yaml.template +88 -75
  201. package/release/compiler/package.json +5 -3
  202. package/release/compiler/pnpm-lock.yaml.template +118 -74
  203. package/release/release.json +6 -6
  204. package/dist/button-CtzUJB8u.d.ts +0 -11
  205. package/dist/chunk-535TM4A5.js +0 -1455
  206. package/dist/chunk-B2V22WRT.js +0 -297
  207. package/dist/chunk-NECL5IBJ.js +0 -318
  208. package/dist/chunk-SVYGXXYR.js +0 -36
  209. package/dist/chunk-UF6ATARM.js +0 -1100
  210. package/dist/compose-NN23UJGC.js +0 -13
  211. package/dist/ide-support-ZNW7ODFY.js +0 -15
  212. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  213. package/dist/kernel/components/blocks/design-system-preview.js +0 -667
  214. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  215. package/dist/kernel/components/blocks/link-playground.js +0 -744
  216. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  217. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  218. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  219. package/dist/kernel/components/ui/theme-toggle.js +0 -53
  220. package/dist/validate-local-source-XRL2Y7XE.js +0 -14
  221. package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
  222. package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
  223. package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
- PUBLIC_PAGEFIND_DIRECTORY
3
- } from "./chunk-YLTOLYWM.js";
2
+ PUBLIC_SEARCH_DIRECTORY
3
+ } from "./chunk-EFO6AWXN.js";
4
4
  import {
5
5
  AppError
6
- } from "./chunk-WDY4IK6Z.js";
6
+ } from "./chunk-22RSSUNV.js";
7
7
 
8
8
  // src/lib/compiler/lifecycle/output-ownership.ts
9
9
  import { createHash, randomUUID } from "crypto";
@@ -12,10 +12,12 @@ import {
12
12
  link,
13
13
  lstat,
14
14
  mkdir,
15
+ mkdtemp,
15
16
  open,
16
17
  readdir,
17
18
  realpath,
18
19
  rename,
20
+ rmdir,
19
21
  unlink,
20
22
  writeFile
21
23
  } from "fs/promises";
@@ -27,7 +29,7 @@ var MUTABLE_PREVIEW_ENTRIES = /* @__PURE__ */ new Set([
27
29
  "tsconfig.tsbuildinfo",
28
30
  ".operation-owner.json",
29
31
  ".preview-cache.json",
30
- PUBLIC_PAGEFIND_DIRECTORY
32
+ PUBLIC_SEARCH_DIRECTORY
31
33
  ]);
32
34
  async function generatedInventory(outputDir, stagingDir) {
33
35
  if (stagingDir && (dirname(stagingDir) !== outputDir || !/^\.refresh-[a-zA-Z0-9]{6}$/u.test(basename(stagingDir))))
@@ -52,7 +54,7 @@ async function generatedInventory(outputDir, stagingDir) {
52
54
  return;
53
55
  }
54
56
  if (MUTABLE_PREVIEW_ENTRIES.has(path)) {
55
- if (["node_modules", ".next", PUBLIC_PAGEFIND_DIRECTORY].includes(path))
57
+ if (["node_modules", ".next", PUBLIC_SEARCH_DIRECTORY].includes(path))
56
58
  await assertLocalDirectory(absolute), path !== "node_modules" && await assertMutable(absolute);
57
59
  else if (!entry.isFile()) throw redirectedOutput(absolute);
58
60
  return;
@@ -210,7 +212,8 @@ async function markOperationOutput(options) {
210
212
  function ownershipError() {
211
213
  return new AppError({
212
214
  code: "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
213
- message: "The generated output owner cannot be verified. Restore this source's output metadata before continuing."
215
+ message: "The generated output could not be verified. Its files were preserved.",
216
+ fix: "Stop commands using this source, then run the command again to rebuild its generated output."
214
217
  });
215
218
  }
216
219
  function redirectedOutput(path) {
@@ -224,7 +227,8 @@ async function assertLocalDirectory(path, expected) {
224
227
  if (!entry.isDirectory() || entry.isSymbolicLink() || await realpath(path) !== path || expected && (entry.dev !== expected.dev || entry.ino !== expected.ino))
225
228
  throw new AppError({
226
229
  code: "FRAMEWORK_LOCAL_OUTPUT_REDIRECTED",
227
- message: "The source-owned output directory was redirected or replaced. Restore it before continuing."
230
+ message: "The source-owned output directory was redirected or replaced. Restore it before continuing.",
231
+ details: { path }
228
232
  });
229
233
  return entry;
230
234
  }
@@ -241,69 +245,41 @@ async function readOwnership(path, maximumSize = 16384) {
241
245
  await file.close();
242
246
  }
243
247
  }
244
- async function ensureOutputOwnership({
245
- sourceRoot,
246
- ownerSourceRoot = sourceRoot
248
+ async function ensureLocalOutputRoot({
249
+ sourceRoot
247
250
  }) {
248
251
  let sourceIdentity = await assertLocalDirectory(sourceRoot), outputRoot = join(sourceRoot, ".publish.os");
249
252
  await mkdir(outputRoot).catch((error) => {
250
253
  if (error.code !== "EEXIST") throw error;
251
254
  });
252
- let outputIdentity = await assertLocalDirectory(outputRoot), ownerPath = join(outputRoot, ".owner.json"), owner = { schemaVersion: 1, sourceRoot: ownerSourceRoot }, assertDirectories = async () => {
255
+ let outputIdentity = await assertLocalDirectory(outputRoot), assertCurrent = async () => {
253
256
  await assertLocalDirectory(sourceRoot, sourceIdentity), await assertLocalDirectory(outputRoot, outputIdentity);
254
- for (let name of [
255
- ".locks",
256
- ".stages",
257
- "build",
258
- "dev",
259
- "ide",
260
- ".ide-lock"
261
- ])
262
- await assertLocalDirectory(join(outputRoot, name)).catch(
263
- (error) => {
264
- if (error.code !== "ENOENT") throw error;
265
- }
266
- );
267
- }, assertOwner = async () => {
268
- try {
269
- let current = await readOwnership(ownerPath);
270
- if (!current || current.schemaVersion !== 1 || current.sourceRoot !== ownerSourceRoot)
271
- throw ownershipError();
272
- } catch {
273
- throw ownershipError();
274
- }
275
257
  };
276
- if (!await lstat(ownerPath).then(() => !0).catch((error) => {
277
- if (error.code !== "ENOENT") throw error;
278
- return !1;
279
- })) {
280
- let entries = await readdir(outputRoot), isIdeOwned = (name) => name === "ide" || name === ".ide-lock" || name.startsWith(".ide.tmp-") || name.startsWith("ide.previous-");
281
- if (entries.some(
282
- (name) => !isIdeOwned(name) && !/^\.owner-init-[a-f0-9-]+\.tmp$/.test(name)
283
- ))
284
- await assertOwner();
285
- else {
286
- await assertDirectories();
287
- let temporary = join(outputRoot, `.owner-init-${randomUUID()}.tmp`);
288
- await writeFile(temporary, `${JSON.stringify(owner)}
289
- `, { flag: "wx" });
290
- try {
291
- await assertDirectories(), await link(temporary, ownerPath).catch(
292
- (error) => {
293
- if (error.code !== "EEXIST") throw error;
294
- }
295
- );
296
- } finally {
297
- await assertDirectories(), await unlink(temporary);
298
- }
299
- }
258
+ return await assertCurrent(), { outputRoot, assertCurrent };
259
+ }
260
+ async function recoverOperationOutput(options) {
261
+ try {
262
+ await assertOperationOutput(options), await assertGeneratedOutput(options);
263
+ return;
264
+ } catch (error) {
265
+ if (!(error instanceof AppError) || ![
266
+ "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
267
+ "FRAMEWORK_LOCAL_OUTPUT_MODIFIED",
268
+ "FRAMEWORK_LOCAL_OUTPUT_REDIRECTED"
269
+ ].includes(error.code))
270
+ throw error;
271
+ }
272
+ await options.assertCurrent();
273
+ let recoveryRoot = join(dirname(options.outputDir), "recovery");
274
+ await mkdir(recoveryRoot, { recursive: !0 }), await assertLocalDirectory(recoveryRoot);
275
+ let recovery = await mkdtemp(
276
+ join(recoveryRoot, `${localOperationName(options)}-`)
277
+ );
278
+ try {
279
+ await options.assertCurrent(), await rename(options.outputDir, join(recovery, "output"));
280
+ } catch (error) {
281
+ throw await rmdir(recovery), error;
300
282
  }
301
- return await assertOwner(), await assertDirectories(), {
302
- outputRoot,
303
- assertCurrent: async () => {
304
- await assertDirectories(), await assertOwner();
305
- }
306
- };
307
283
  }
308
284
 
309
285
  // src/lib/compiler/lifecycle/operation-lock.ts
@@ -315,18 +291,23 @@ import {
315
291
  open as open2,
316
292
  readdir as readdir2,
317
293
  realpath as realpath2,
318
- rmdir,
294
+ rmdir as rmdir2,
319
295
  unlink as unlink2,
320
296
  writeFile as writeFile2
321
297
  } from "fs/promises";
322
298
  import { hostname } from "os";
323
- import { join as join2, resolve } from "path";
299
+ import { isAbsolute, join as join2, resolve } from "path";
324
300
  function lockError({
325
301
  code,
326
302
  message,
327
303
  sourceRoot
328
304
  }) {
329
- return new AppError({ code, message, details: { sourceRoot } });
305
+ return new AppError({
306
+ code,
307
+ message,
308
+ details: { sourceRoot },
309
+ fix: code === "FRAMEWORK_LOCAL_OPERATION_ACTIVE" ? "Stop the running command for this source, then run the command again." : `Stop commands using this source, move only ${join2(sourceRoot, ".publish.os")} aside to preserve it, then run the command again.`
310
+ });
330
311
  }
331
312
  async function directoryIdentity({
332
313
  path,
@@ -385,7 +366,7 @@ async function readOwner({
385
366
  if (!owner || typeof owner != "object")
386
367
  throw new Error("Invalid lock metadata.");
387
368
  let value = owner;
388
- if (value.sourceRoot !== sourceRoot || !["build", "dev", "ide", "dependencies"].includes(
369
+ if (typeof value.sourceRoot != "string" || !isAbsolute(value.sourceRoot) || !["build", "dev", "ide", "dependencies"].includes(
389
370
  value.operation ?? ""
390
371
  ) || value.scope !== void 0 && (value.operation !== "dev" || typeof value.scope != "string" || !/^[a-f0-9]{64}$/u.test(value.scope)) || !Number.isSafeInteger(value.pid) || (value.pid ?? 0) <= 0 || typeof value.hostname != "string" || !value.hostname || typeof value.token != "string" || !/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/u.test(
391
372
  value.token
@@ -411,7 +392,7 @@ async function assertOwnedLock({
411
392
  }) {
412
393
  await verifyDirectory({ directory: parent, sourceRoot: owner.sourceRoot });
413
394
  let current = await readOwner({ directory, sourceRoot: owner.sourceRoot });
414
- if (current.token !== owner.token || current.operation !== owner.operation || current.scope !== owner.scope)
395
+ if (current.sourceRoot !== owner.sourceRoot || current.token !== owner.token || current.operation !== owner.operation || current.scope !== owner.scope)
415
396
  throw lockError({
416
397
  code: "FRAMEWORK_LOCAL_LOCK_UNVERIFIED",
417
398
  message: "The operation lock now belongs to another owner. Leave it in place and inspect the active operation.",
@@ -460,7 +441,7 @@ async function removeOwnedLock({
460
441
  owner,
461
442
  beforeRemoval
462
443
  }) {
463
- await assertOwnedLock({ directory, parent, owner }), beforeRemoval?.(), await unlink2(join2(directory.path, "owner.json")), await rmdir(directory.path);
444
+ await assertOwnedLock({ directory, parent, owner }), beforeRemoval?.(), await unlink2(join2(directory.path, "owner.json")), await rmdir2(directory.path);
464
445
  }
465
446
  function assertDeadOwner({
466
447
  owner,
@@ -609,6 +590,97 @@ async function acquireOperationLock({
609
590
  };
610
591
  }
611
592
 
593
+ // src/lib/compiler/lifecycle/owned-directory-publication.ts
594
+ import { lstat as lstat3, mkdir as mkdir3, mkdtemp as mkdtemp2, rename as rename2, rm } from "fs/promises";
595
+ import { basename as basename2, join as join3 } from "path";
596
+ async function assertMissing(path) {
597
+ try {
598
+ await lstat3(path);
599
+ } catch (error) {
600
+ if (error.code === "ENOENT") return;
601
+ throw error;
602
+ }
603
+ throw new AppError({
604
+ code: "FRAMEWORK_LOCAL_OUTPUT_REDIRECTED",
605
+ message: `Owned output appeared during publication: ${path}. The previous bytes were preserved.`
606
+ });
607
+ }
608
+ async function publishOwnedDirectory(options) {
609
+ options.signal?.throwIfAborted(), await options.assertOwner(), await mkdir3(options.stagingRoot, { recursive: !0 });
610
+ let stagingRootIdentity = await assertLocalDirectory(options.stagingRoot), stage = await mkdtemp2(
611
+ join3(options.stagingRoot, `${options.stagingPrefix}-`)
612
+ ), stageIdentity = await assertLocalDirectory(stage), incoming = join3(stage, "incoming"), retainStage = !1, assertStage = async () => {
613
+ try {
614
+ await options.assertOwner(), await assertLocalDirectory(options.stagingRoot, stagingRootIdentity), await assertLocalDirectory(stage, stageIdentity);
615
+ } catch (error) {
616
+ throw options.onRecoveryRequired?.(), error;
617
+ }
618
+ }, previous, previousIdentity, recoveryEntry, recoveryRootIdentity, recoveryEntryIdentity, movedPrevious = !1, published = !1, failure;
619
+ try {
620
+ await mkdir3(incoming), await assertLocalDirectory(incoming), await options.prepareIncoming(incoming), options.signal?.throwIfAborted(), await assertStage();
621
+ let preparedIncomingIdentity = await assertLocalDirectory(incoming);
622
+ await options.validateIncoming?.(incoming), await assertStage(), await assertLocalDirectory(incoming, preparedIncomingIdentity);
623
+ try {
624
+ previousIdentity = await lstat3(options.targetDirectory), await assertLocalDirectory(options.targetDirectory, previousIdentity);
625
+ } catch (error) {
626
+ if (error.code !== "ENOENT") throw error;
627
+ previousIdentity = void 0;
628
+ }
629
+ if (previousIdentity) {
630
+ options.recoveryRoot ? (await mkdir3(options.recoveryRoot, { recursive: !0 }), recoveryRootIdentity = await assertLocalDirectory(options.recoveryRoot), recoveryEntry = await mkdtemp2(
631
+ join3(options.recoveryRoot, `${basename2(options.targetDirectory)}-`)
632
+ ), recoveryEntryIdentity = await assertLocalDirectory(recoveryEntry), previous = join3(recoveryEntry, basename2(options.targetDirectory))) : previous = join3(stage, "previous"), await assertStage(), recoveryRootIdentity && options.recoveryRoot && await assertLocalDirectory(options.recoveryRoot, recoveryRootIdentity), recoveryEntryIdentity && recoveryEntry && await assertLocalDirectory(recoveryEntry, recoveryEntryIdentity), await assertLocalDirectory(options.targetDirectory, previousIdentity), await rename2(options.targetDirectory, previous), movedPrevious = !0;
633
+ try {
634
+ await assertLocalDirectory(previous, previousIdentity);
635
+ } catch (error) {
636
+ throw retainStage = !0, options.onRecoveryRequired?.(), new AggregateError(
637
+ [error],
638
+ `Owned output changed while being retained; preserve the previous output at ${previous}.`
639
+ );
640
+ }
641
+ }
642
+ try {
643
+ options.signal?.throwIfAborted(), await assertStage(), await assertLocalDirectory(incoming, preparedIncomingIdentity), await assertMissing(options.targetDirectory), await options.beforePublish?.(), await rename2(incoming, options.targetDirectory), published = !0;
644
+ } catch (publishError) {
645
+ if (movedPrevious && previous && previousIdentity)
646
+ try {
647
+ await assertStage(), recoveryRootIdentity && options.recoveryRoot && await assertLocalDirectory(
648
+ options.recoveryRoot,
649
+ recoveryRootIdentity
650
+ ), recoveryEntryIdentity && recoveryEntry && await assertLocalDirectory(recoveryEntry, recoveryEntryIdentity), await assertMissing(options.targetDirectory), await rename2(previous, options.targetDirectory), await assertLocalDirectory(options.targetDirectory, previousIdentity), movedPrevious = !1;
651
+ } catch (rollbackError) {
652
+ throw retainStage = !0, options.onRecoveryRequired?.(), new AggregateError(
653
+ [publishError, rollbackError],
654
+ `Owned output publication failed; the previous output remains at ${previous}.`
655
+ );
656
+ }
657
+ throw publishError;
658
+ }
659
+ } catch (error) {
660
+ failure = error;
661
+ }
662
+ if (!retainStage && (!failure || options.cleanupFailedStaging !== !1))
663
+ try {
664
+ await assertStage(), await rm(stage, { recursive: !0, force: !0 });
665
+ } catch (cleanupError) {
666
+ failure = failure ? new AggregateError(
667
+ [failure, cleanupError],
668
+ `Owned output publication failed; staging cleanup also failed at ${stage}.`
669
+ ) : cleanupError;
670
+ }
671
+ if (recoveryEntry && !movedPrevious)
672
+ try {
673
+ options.recoveryRoot && recoveryRootIdentity && await assertLocalDirectory(options.recoveryRoot, recoveryRootIdentity), recoveryEntryIdentity && await assertLocalDirectory(recoveryEntry, recoveryEntryIdentity), await rm(recoveryEntry, { recursive: !0, force: !0 });
674
+ } catch (cleanupError) {
675
+ failure = failure ? new AggregateError(
676
+ [failure, cleanupError],
677
+ `Owned output publication failed; recovery cleanup also failed at ${recoveryEntry}.`
678
+ ) : cleanupError;
679
+ }
680
+ if (failure) throw failure;
681
+ if (!published) throw new Error("Owned output was not published.");
682
+ }
683
+
612
684
  export {
613
685
  assertGeneratedOutput,
614
686
  prepareGeneratedOutputUpdate,
@@ -616,6 +688,8 @@ export {
616
688
  assertOperationOutput,
617
689
  markOperationOutput,
618
690
  assertLocalDirectory,
619
- ensureOutputOwnership,
620
- acquireOperationLock
691
+ ensureLocalOutputRoot,
692
+ recoverOperationOutput,
693
+ acquireOperationLock,
694
+ publishOwnedDirectory
621
695
  };
@@ -1,6 +1,11 @@
1
1
  import {
2
+ isOsMetadataPath,
2
3
  isSameOrDescendant
3
- } from "./chunk-YLTOLYWM.js";
4
+ } from "./chunk-WL75GQ5M.js";
5
+
6
+ // src/lib/compiler/source/assert-publish-os-source-boundary.ts
7
+ import { lstat, readdir, realpath } from "fs/promises";
8
+ import { basename, dirname, join, relative, resolve, sep } from "path";
4
9
 
5
10
  // src/lib/compiler/source/diagnostics/errors/publish-os-source-error.ts
6
11
  var ERROR_CODES = {
@@ -25,6 +30,7 @@ var ERROR_CODES = {
25
30
  CONFIG_CONTENT_MISSING: "CONFIG_CONTENT_MISSING",
26
31
  CONFIG_CONTENT_NOT_DIRECTORY: "CONFIG_CONTENT_NOT_DIRECTORY",
27
32
  CONTENT_FRONTMATTER_INVALID_JSON: "CONTENT_FRONTMATTER_INVALID_JSON",
33
+ CONTENT_FRONTMATTER_LANGUAGE_UNSUPPORTED: "CONTENT_FRONTMATTER_LANGUAGE_UNSUPPORTED",
28
34
  CONTENT_FRONTMATTER_REQUIRED: "CONTENT_FRONTMATTER_REQUIRED",
29
35
  CONTENT_FRONTMATTER_ID_INVALID: "CONTENT_FRONTMATTER_ID_INVALID",
30
36
  CONTENT_FILE_PARSE_FAILED: "CONTENT_FILE_PARSE_FAILED",
@@ -42,8 +48,6 @@ var ERROR_CODES = {
42
48
  };
43
49
 
44
50
  // src/lib/compiler/source/assert-publish-os-source-boundary.ts
45
- import { lstat, readdir, realpath } from "fs/promises";
46
- import { basename, dirname, join, relative, resolve, sep } from "path";
47
51
  function displayPath(root, path) {
48
52
  return relative(root, path).split(sep).join("/") || ".";
49
53
  }
@@ -55,6 +59,7 @@ function sourceBoundaryError(options) {
55
59
  });
56
60
  }
57
61
  async function assertEntry(options) {
62
+ if (isOsMetadataPath(relative(options.root, options.path))) return;
58
63
  let entry = await lstat(options.path);
59
64
  if (entry.isSymbolicLink())
60
65
  throw sourceBoundaryError({
@@ -0,0 +1,19 @@
1
+ // src/lib/hosting/framework-paths.ts
2
+ var FRAMEWORK_PREFIX = "/publishos", SOURCE_ASSET_PREFIX = `${FRAMEWORK_PREFIX}/assets`, INTERNAL_PREFIX = `${FRAMEWORK_PREFIX}/internal`, SITE_API_PREFIX = `${FRAMEWORK_PREFIX}/api`, SEARCH_PREFIX = `${INTERNAL_PREFIX}/search`, PAGEFIND_MODULE_URL = `${SEARCH_PREFIX}/pagefind.js`, PAGEFIND_ENTRY_URL = `${SEARCH_PREFIX}/pagefind-entry.json`, IMAGE_OPTIMIZER_PATH = `${SITE_API_PREFIX}/image`, NEXT_IMAGE_OPTIMIZER_PATH = "/_next/image", OG_SERVICE_PREFIX = `${SITE_API_PREFIX}/og`, PUBLIC_INTERNAL_DIRECTORY = INTERNAL_PREFIX.slice(1), PUBLIC_FONT_DIRECTORY = `${PUBLIC_INTERNAL_DIRECTORY}/fonts`, PUBLIC_SEARCH_DIRECTORY = `public/${PUBLIC_INTERNAL_DIRECTORY}/search`, FRAMEWORK_PROXY_MATCHER = `/((?!${FRAMEWORK_PREFIX.slice(1)}(?:/|$)|_next/static|_next/image|_next/webpack-hmr).*)`;
3
+ function isFrameworkNamespacePath(pathname) {
4
+ return pathname === FRAMEWORK_PREFIX || pathname.startsWith(`${FRAMEWORK_PREFIX}/`);
5
+ }
6
+
7
+ export {
8
+ FRAMEWORK_PREFIX,
9
+ SOURCE_ASSET_PREFIX,
10
+ INTERNAL_PREFIX,
11
+ IMAGE_OPTIMIZER_PATH,
12
+ NEXT_IMAGE_OPTIMIZER_PATH,
13
+ OG_SERVICE_PREFIX,
14
+ PUBLIC_INTERNAL_DIRECTORY,
15
+ PUBLIC_FONT_DIRECTORY,
16
+ PUBLIC_SEARCH_DIRECTORY,
17
+ FRAMEWORK_PROXY_MATCHER,
18
+ isFrameworkNamespacePath
19
+ };
@@ -1,41 +1,50 @@
1
1
  import {
2
- supportedNextjsSourceImports
3
- } from "./chunk-NECL5IBJ.js";
2
+ AppError as AppError2,
3
+ ERROR_CODES,
4
+ assertPublishOsSourceBoundary
5
+ } from "./chunk-7NY22B5U.js";
4
6
  import {
7
+ MdxIconImportError,
5
8
  ROOT_CONTENT_GROUP_KEY,
6
9
  ROOT_CONTENT_GROUP_TITLE,
10
+ UnsupportedFrontmatterLanguageError,
7
11
  assertSourceDependency,
8
12
  buildFaviconsAndLogos,
9
13
  buildMediaAssets,
10
14
  collectBindingNames,
11
15
  groupedMdxExports,
12
16
  joinUrlPath,
13
- localCssImports,
14
17
  mdxComponentExportName,
15
18
  namedValueExports,
16
19
  normalizeSlugPath,
17
20
  normalizeUrlPath,
18
- replacedMdxSourceFiles
19
- } from "./chunk-535TM4A5.js";
21
+ originalDefaultComponentSourcePath,
22
+ parseSourceFrontmatter,
23
+ replacedMdxSourceFiles,
24
+ supportedNextjsSourceImports,
25
+ validateMdxIconImports
26
+ } from "./chunk-UYGCOWRF.js";
20
27
  import {
21
- AppError as AppError2,
22
- ERROR_CODES,
23
- assertPublishOsSourceBoundary
24
- } from "./chunk-7OGTPSKI.js";
28
+ isFrameworkNamespacePath
29
+ } from "./chunk-EFO6AWXN.js";
30
+ import {
31
+ localCssImports
32
+ } from "./chunk-5KAD7W53.js";
25
33
  import {
26
34
  isApprovedPublishOsPath,
27
35
  isExcludedSourcePath,
28
- isFrameworkNamespacePath,
29
36
  isReservedFrameworkPath,
30
37
  isSameOrDescendant
31
- } from "./chunk-YLTOLYWM.js";
38
+ } from "./chunk-WL75GQ5M.js";
32
39
  import {
33
40
  runtimePackageVersion
34
41
  } from "./chunk-AI2UULNX.js";
35
42
  import {
36
- AppError,
37
43
  readInstalledFrameworkLocation
38
- } from "./chunk-WDY4IK6Z.js";
44
+ } from "./chunk-5J3YUNRY.js";
45
+ import {
46
+ AppError
47
+ } from "./chunk-22RSSUNV.js";
39
48
 
40
49
  // src/lib/compiler/validation/validate-publish-os-source.ts
41
50
  import { readdir as readdir3, readFile as readFile5, stat as stat3 } from "fs/promises";
@@ -88,9 +97,15 @@ import { resolve } from "path";
88
97
  function issueMessages(issue) {
89
98
  return issue.code === "invalid_union" ? issue.unionErrors.flatMap(
90
99
  (error) => error.issues.flatMap(issueMessages)
91
- ) : issue.code === "unrecognized_keys" ? issue.keys.map(
92
- (key) => `${[...issue.path, key].join(".")}: Unknown field.`
93
- ) : [`${issue.path.join(".") || "(root)"}: ${issue.message}`];
100
+ ) : issue.code === "unrecognized_keys" ? issue.keys.map((key) => {
101
+ let path = [...issue.path, key].join(".");
102
+ return issue.path.join(".") === "media.assets" && [
103
+ "maxImageBytes",
104
+ "maxVideoBytes",
105
+ "maxTotalBytes",
106
+ "maxFileCount"
107
+ ].includes(key) ? `${path}: Media limits are fixed by PublishOS. Remove this field.` : `${path}: Unknown field.`;
108
+ }) : [`${issue.path.join(".") || "(root)"}: ${issue.message}`];
94
109
  }
95
110
  function formatConfigIssues(error) {
96
111
  return [...new Set(error.issues.flatMap(issueMessages))].join(`
@@ -158,7 +173,10 @@ var treeNodeSchema = z3.lazy(
158
173
  scope: outputScopeSchema.optional(),
159
174
  description: z3.string().optional(),
160
175
  limit: z3.number().int().positive().optional()
161
- }).strict(), outputDefaultsDeclarationSchema = z3.object({
176
+ }).strict(), sitemapOutputSchema = outputDeclarationSchema.extend({
177
+ path: z3.string().min(1).optional(),
178
+ mode: z3.enum(["index", "urls"]).optional()
179
+ }), outputDefaultsDeclarationSchema = z3.object({
162
180
  scope: outputScopeSchema.optional(),
163
181
  limit: z3.number().int().positive().optional(),
164
182
  status: z3.array(outputStatusSchema).optional(),
@@ -172,10 +190,12 @@ var treeNodeSchema = z3.lazy(
172
190
  atom: outputDefaultsDeclarationSchema.optional(),
173
191
  json: outputDefaultsDeclarationSchema.optional()
174
192
  }).strict(), outputsSchema = z3.object({
175
- llms: outputDeclarationSchema.optional(),
193
+ llms: outputDeclarationSchema.or(z3.literal(!1)).optional(),
194
+ llmsFull: outputDeclarationSchema.or(z3.literal(!1)).optional(),
176
195
  feeds: feedsOutputSchema.optional(),
177
- robots: outputDeclarationSchema.optional(),
178
- sitemap: outputDeclarationSchema.optional()
196
+ robots: outputDeclarationSchema.or(z3.literal(!1)).optional(),
197
+ sitemap: sitemapOutputSchema.or(z3.literal(!1)).optional(),
198
+ sitemapMarkdown: outputDeclarationSchema.or(z3.literal(!1)).optional()
179
199
  }).strict(), outputDefaultsSchema = z3.object({
180
200
  llms: outputDefaultsDeclarationSchema.optional(),
181
201
  feeds: feedsOutputDefaultsSchema.optional()
@@ -267,31 +287,8 @@ var siteSchema = z4.object({
267
287
  }), rootThemeSchema = z4.object({
268
288
  defaultMode: z4.enum(["system", "light", "dark"]).optional(),
269
289
  forcedMode: z4.enum(["light", "dark"]).optional()
270
- }).strict(), remoteMediaSourceSchema = z4.object({
271
- protocol: z4.literal("https"),
272
- hostname: z4.string().min(1),
273
- pathname: z4.string().optional()
274
- }).strict(), remoteEmbedSourceSchema = z4.object({
275
- provider: z4.enum([
276
- "youtube",
277
- "vimeo",
278
- "loom",
279
- "wistia",
280
- "cloudflare-stream"
281
- ]),
282
- hostname: z4.string().min(1)
283
290
  }).strict(), mediaConfigSchema = z4.object({
284
- assets: z4.object({
285
- maxImageBytes: z4.number().int().positive().optional(),
286
- maxVideoBytes: z4.number().int().positive().optional(),
287
- maxTotalBytes: z4.number().int().positive().optional(),
288
- maxFileCount: z4.number().int().positive().optional()
289
- }).strict().optional(),
290
- remote: z4.object({
291
- images: z4.array(remoteMediaSourceSchema).optional(),
292
- videos: z4.array(remoteMediaSourceSchema).optional(),
293
- embeds: z4.array(remoteEmbedSourceSchema).optional()
294
- }).strict().optional()
291
+ assets: z4.object({}).strict().optional()
295
292
  }).strict(), agentConfigSchema = z4.object({
296
293
  enabled: z4.boolean().optional(),
297
294
  markdownRoutes: z4.boolean().optional(),
@@ -802,7 +799,6 @@ async function resolvePublishOsConfig(baseDir) {
802
799
  // src/lib/compiler/source/content/scan-publish-os-content.ts
803
800
  import { readdir as readdir2, readFile as readFile3, stat as stat2 } from "fs/promises";
804
801
  import { extname, join as join2, relative as relative2 } from "path";
805
- import matter from "gray-matter";
806
802
  var RESERVED_FIELDS = /* @__PURE__ */ new Set([
807
803
  "title",
808
804
  "slug",
@@ -1008,7 +1004,7 @@ function customMeta(frontmatter, absolutePath) {
1008
1004
  async function readContentFile(group, absolutePath, configSlugs) {
1009
1005
  let raw = await readFile3(absolutePath, "utf-8");
1010
1006
  try {
1011
- let parsed = matter(raw), frontmatter = parsed.data, relativePath = relative2(group.contentPath, absolutePath), fileID = normalizeContentSlug(fileSlug(relativePath), absolutePath), title = asString(frontmatter.title);
1007
+ let parsed = parseSourceFrontmatter(raw), frontmatter = parsed.data, relativePath = relative2(group.contentPath, absolutePath), fileID = normalizeContentSlug(fileSlug(relativePath), absolutePath), title = asString(frontmatter.title);
1012
1008
  if (frontmatter.id !== void 0)
1013
1009
  throw new AppError2({
1014
1010
  code: ERROR_CODES.CONTENT_FRONTMATTER_ID_INVALID,
@@ -1102,7 +1098,11 @@ async function readContentFile(group, absolutePath, configSlugs) {
1102
1098
  warnings
1103
1099
  };
1104
1100
  } catch (error) {
1105
- throw error instanceof AppError2 ? error : new AppError2({
1101
+ throw error instanceof AppError2 ? error : error instanceof UnsupportedFrontmatterLanguageError ? new AppError2({
1102
+ code: ERROR_CODES.CONTENT_FRONTMATTER_LANGUAGE_UNSUPPORTED,
1103
+ message: `Unsupported frontmatter language "${error.language}" for ${absolutePath}. Use YAML or JSON.`,
1104
+ details: { path: absolutePath, language: error.language }
1105
+ }) : new AppError2({
1106
1106
  code: ERROR_CODES.CONTENT_FILE_PARSE_FAILED,
1107
1107
  message: `Failed to parse frontmatter for ${absolutePath}`,
1108
1108
  details: { error }
@@ -1475,7 +1475,9 @@ async function preparePublishOsSource({
1475
1475
  ), config = await resolvePublishOsConfig(sourceRoot), content = await scanContent(config), media = await buildMediaAssets({
1476
1476
  config,
1477
1477
  publishOsDir
1478
- }), faviconsAndLogos = await buildFaviconsAndLogos({ publishOsDir }), missingPages = await missingPageReferences({
1478
+ }), faviconsAndLogos = buildFaviconsAndLogos({
1479
+ media
1480
+ }), missingPages = await missingPageReferences({
1479
1481
  sourceRoot,
1480
1482
  config,
1481
1483
  content
@@ -1490,13 +1492,10 @@ async function preparePublishOsSource({
1490
1492
  })),
1491
1493
  ...content.warnings,
1492
1494
  ...missingPages,
1495
+ ...faviconsAndLogos.warnings,
1493
1496
  ...media.warnings.map((warning2) => ({
1494
1497
  ...warning2,
1495
1498
  level: "warning"
1496
- })),
1497
- ...faviconsAndLogos.warnings.map((warning2) => ({
1498
- ...warning2,
1499
- level: "warning"
1500
1499
  }))
1501
1500
  ],
1502
1501
  source: {
@@ -1704,6 +1703,10 @@ function isAllowedBareImport(specifier) {
1704
1703
  }
1705
1704
  return ALLOWED_BARE_IMPORTS.has(specifier);
1706
1705
  }
1706
+ function isOriginalDefaultComponentBridge(options) {
1707
+ let sourcePath = originalDefaultComponentSourcePath(options.specifier);
1708
+ return sourcePath ? options.relativeFile.replace(/\.[^.]+$/, "") === sourcePath : !1;
1709
+ }
1707
1710
  function addFileError(store, code, message, file, details = {}) {
1708
1711
  store.error(code, message, { ...details, file });
1709
1712
  }
@@ -2075,7 +2078,7 @@ function validateLegacyIconReferences(source, file, store) {
2075
2078
  match && addFileError(
2076
2079
  store,
2077
2080
  "FRAMEWORK_ICON_RESOLVER_REJECTED",
2078
- 'The Icon resolver is removed. Import an exact component from "@phosphor-icons/react/ssr" in a custom MDX component instead.',
2081
+ 'The Icon resolver is removed. Import an exact named component from "@phosphor-icons/react/ssr" in MDX or TSX instead.',
2079
2082
  file,
2080
2083
  sourceDetails(source, match.index, match[0] ?? "")
2081
2084
  );
@@ -2115,7 +2118,23 @@ async function validateSourceFileContents({
2115
2118
  filePath: absolutePath,
2116
2119
  css: source,
2117
2120
  checked: checkedCss
2118
- })), scansLegacyIcons && validateLegacyIconReferences(source, file, store), sourceModule && (validateSourceModuleSafety(source, file, store), await validateSourceModule({
2121
+ }));
2122
+ let importsIconBinding = !1;
2123
+ if (extension === ".mdx" && !file.startsWith("assets/"))
2124
+ try {
2125
+ importsIconBinding = (await validateMdxIconImports(source)).some(({ local }) => local === "Icon");
2126
+ } catch (error) {
2127
+ let line = error instanceof MdxIconImportError ? error.line : 1, column = error instanceof MdxIconImportError ? error.column : 1;
2128
+ addFileError(
2129
+ store,
2130
+ error instanceof MdxIconImportError ? error.code : "FRAMEWORK_MDX_IMPORT_INVALID",
2131
+ error instanceof Error ? error.message : String(error),
2132
+ file,
2133
+ { line, column, sourceLine: source.split(`
2134
+ `)[line - 1] ?? "" }
2135
+ );
2136
+ }
2137
+ scansLegacyIcons && !importsIconBinding && validateLegacyIconReferences(source, file, store), sourceModule && (validateSourceModuleSafety(source, file, store), await validateSourceModule({
2119
2138
  absolutePath,
2120
2139
  groupFolders,
2121
2140
  publishOsDir,
@@ -2140,18 +2159,32 @@ async function validateSourceBoundary(publishOsDir, config, store) {
2140
2159
  "package.json"
2141
2160
  );
2142
2161
  for (let file of await walkAllFiles(publishOsDir))
2143
- validateSourceFilePath({ file, groupFolders, store }) && (validateSourceFontFile({ file, configuredFontSourcePaths, store }) || (isApprovedPublishOsPath(file, groupFolders) || addFileWarning(
2144
- store,
2145
- "FRAMEWORK_SOURCE_PATH_IGNORED",
2146
- "This file is outside the supported publish.os structure and will not be included in the site.",
2147
- file
2148
- ), await validateSourceFileContents({
2149
- publishOsDir,
2150
- file,
2151
- groupFolders,
2152
- checkedCss,
2153
- store
2154
- })));
2162
+ if (validateSourceFilePath({ file, groupFolders, store }) && !validateSourceFontFile({ file, configuredFontSourcePaths, store })) {
2163
+ if (!isApprovedPublishOsPath(file, groupFolders))
2164
+ if (file.startsWith("public/")) {
2165
+ let assetPath = file.slice(7);
2166
+ addFileWarning(
2167
+ store,
2168
+ "FRAMEWORK_SOURCE_PUBLIC_UNSUPPORTED",
2169
+ `Files in publish.os/public are not included. Move this file to publish.os/assets/${assetPath} and reference it as /assets/${assetPath}.`,
2170
+ file,
2171
+ { correction: `assets/${assetPath}` }
2172
+ );
2173
+ } else
2174
+ addFileWarning(
2175
+ store,
2176
+ "FRAMEWORK_SOURCE_PATH_IGNORED",
2177
+ "This file is outside the supported publish.os structure and will not be included in the site.",
2178
+ file
2179
+ );
2180
+ await validateSourceFileContents({
2181
+ publishOsDir,
2182
+ file,
2183
+ groupFolders,
2184
+ checkedCss,
2185
+ store
2186
+ });
2187
+ }
2155
2188
  }
2156
2189
  async function validateCssDependencies({
2157
2190
  publishOsDir,
@@ -2296,7 +2329,7 @@ async function validateImportSpecifier(options) {
2296
2329
  );
2297
2330
  return;
2298
2331
  }
2299
- isAllowedBareImport(options.specifier) || addFileError(
2332
+ !isAllowedBareImport(options.specifier) && !isOriginalDefaultComponentBridge(options) && addFileError(
2300
2333
  options.store,
2301
2334
  "FRAMEWORK_IMPORT_NOT_ALLOWED",
2302
2335
  `Can't import from "${options.specifier}". Source modules can only import approved runtime packages.`,