@publish.os/nextjs 0.0.1-alpha.81 → 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 (265) hide show
  1. package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
  2. package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
  3. package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
  4. package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
  5. package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
  6. package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
  7. package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
  8. package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
  9. package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
  10. package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
  11. package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
  12. package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
  13. package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
  14. package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
  15. package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
  16. package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
  17. package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
  18. package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
  19. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
  20. package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
  21. package/compiler-assets/nextjs/shims/document.tsx +38 -0
  22. package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
  23. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
  24. package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
  25. package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
  26. package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
  27. package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
  28. package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
  29. package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
  30. package/compiler-assets/nextjs/shims/proxy.ts +143 -65
  31. package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
  32. package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
  33. package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
  34. package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
  35. package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
  36. package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
  37. package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
  38. package/dist/build-operation-5QMLXF7N.js +89 -0
  39. package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
  40. package/dist/capture-local-source-WGGDIUU2.js +258 -0
  41. package/dist/chunk-22RSSUNV.js +13 -0
  42. package/dist/chunk-4BC2L2KA.js +620 -0
  43. package/dist/chunk-5J3YUNRY.js +121 -0
  44. package/dist/chunk-5KAD7W53.js +248 -0
  45. package/dist/chunk-6C65KV7O.js +142 -0
  46. package/dist/chunk-6D2E6UMD.js +695 -0
  47. package/dist/chunk-7NY22B5U.js +161 -0
  48. package/dist/chunk-AI2UULNX.js +9 -0
  49. package/dist/chunk-EFO6AWXN.js +19 -0
  50. package/dist/chunk-F3AGNDF4.js +2377 -0
  51. package/dist/chunk-GBPLER5H.js +426 -0
  52. package/dist/chunk-IL4RJOKI.js +186 -0
  53. package/dist/chunk-NNBJZPFM.js +193 -0
  54. package/dist/chunk-ORIUWJBQ.js +58 -0
  55. package/dist/chunk-OXOFRXEI.js +7129 -0
  56. package/dist/chunk-UYGCOWRF.js +1709 -0
  57. package/dist/chunk-WL75GQ5M.js +80 -0
  58. package/dist/compiler.d.ts +54 -7
  59. package/dist/compiler.js +121 -13147
  60. package/dist/components/blocks/agent-actions.d.ts +81 -0
  61. package/dist/components/blocks/agent-actions.js +594 -0
  62. package/dist/components/blocks/toc.d.ts +43 -0
  63. package/dist/components/blocks/toc.js +136 -0
  64. package/dist/components/ui/button.d.ts +5 -0
  65. package/dist/components/ui/button.js +94 -0
  66. package/dist/compose-CVBJRAF6.js +16 -0
  67. package/dist/config/createNextConfig.js +27 -0
  68. package/dist/dev-operation-OSHHWRWK.js +1095 -0
  69. package/dist/framework-selection-ZVO323PK.js +11 -0
  70. package/dist/ide-support-CU6Z5PVR.js +16 -0
  71. package/dist/index.d.ts +55 -4
  72. package/dist/jsx-dev-runtime.d.ts +6 -0
  73. package/dist/jsx-dev-runtime.js +100 -0
  74. package/dist/jsx-runtime.d.ts +7 -0
  75. package/dist/jsx-runtime.js +97 -0
  76. package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
  77. package/dist/kernel/components/blocks/AgentActions.js +401 -150
  78. package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
  79. package/dist/kernel/components/blocks/agent-actions.js +594 -0
  80. package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
  81. package/dist/kernel/components/blocks/color-palette.js +4 -4
  82. package/dist/kernel/components/blocks/logo-block.js +3 -3
  83. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
  84. package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
  85. package/dist/kernel/components/blocks/navbar.d.ts +2 -2
  86. package/dist/kernel/components/blocks/navbar.js +406 -65
  87. package/dist/kernel/components/blocks/navigation-progress.js +6 -3
  88. package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
  89. package/dist/kernel/components/blocks/next-prev.js +12 -24
  90. package/dist/kernel/components/blocks/page-list.d.ts +1 -1
  91. package/dist/kernel/components/blocks/page-list.js +7 -6
  92. package/dist/kernel/components/blocks/search.d.ts +83 -58
  93. package/dist/kernel/components/blocks/search.js +554 -428
  94. package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
  95. package/dist/kernel/components/blocks/sidebar-node.js +12 -10
  96. package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
  97. package/dist/kernel/components/blocks/sidebar.js +24 -14
  98. package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
  99. package/dist/kernel/components/blocks/theme-toggle.js +47 -1
  100. package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
  101. package/dist/kernel/components/blocks/toc-client.js +495 -0
  102. package/dist/kernel/components/blocks/toc.d.ts +19 -1
  103. package/dist/kernel/components/blocks/toc.js +122 -180
  104. package/dist/kernel/components/mdx/components/blockquote.js +2 -2
  105. package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
  106. package/dist/kernel/components/mdx/components/callout.js +67 -36
  107. package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
  108. package/dist/kernel/components/mdx/components/code-block.js +106 -5
  109. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
  110. package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
  111. package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
  112. package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
  113. package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
  114. package/dist/kernel/components/mdx/components/figure.js +24 -14
  115. package/dist/kernel/components/mdx/components/footnotes.js +1 -1
  116. package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
  117. package/dist/kernel/components/mdx/components/heading.js +6 -3
  118. package/dist/kernel/components/mdx/components/hr.js +2 -2
  119. package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
  120. package/dist/kernel/components/mdx/components/image.d.ts +1 -1
  121. package/dist/kernel/components/mdx/components/image.js +94 -68
  122. package/dist/kernel/components/mdx/components/inline-code.js +2 -2
  123. package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
  124. package/dist/kernel/components/mdx/components/kbd.js +5 -4
  125. package/dist/kernel/components/mdx/components/link.d.ts +35 -4
  126. package/dist/kernel/components/mdx/components/link.js +3 -3
  127. package/dist/kernel/components/mdx/components/paragraph.js +2 -5
  128. package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
  129. package/dist/kernel/components/mdx/components/table.js +2 -2
  130. package/dist/kernel/components/mdx/components/task-list.js +2 -2
  131. package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
  132. package/dist/kernel/components/mdx/components/video-player.js +8 -4
  133. package/dist/kernel/components/mdx/components/video.d.ts +5 -3
  134. package/dist/kernel/components/mdx/components/video.js +8 -6
  135. package/dist/kernel/components/mdx/error-boundary.js +2 -2
  136. package/dist/kernel/components/mdx/error-fallback.js +1 -1
  137. package/dist/kernel/components/mdx/mdx.d.ts +28 -14
  138. package/dist/kernel/components/mdx/mdx.js +336 -63
  139. package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
  140. package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
  141. package/dist/kernel/components/next-image.d.ts +12 -0
  142. package/dist/kernel/components/next-image.js +61 -0
  143. package/dist/kernel/components/ui/accordion.js +1 -1
  144. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
  145. package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
  146. package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
  147. package/dist/kernel/components/ui/breadcrumb.js +10 -8
  148. package/dist/kernel/components/ui/button-group.js +8 -7
  149. package/dist/kernel/components/ui/button.d.ts +58 -6
  150. package/dist/kernel/components/ui/button.js +43 -39
  151. package/dist/kernel/components/ui/card.d.ts +2 -2
  152. package/dist/kernel/components/ui/card.js +1 -1
  153. package/dist/kernel/components/ui/dialog.js +1 -1
  154. package/dist/kernel/components/ui/drawer.d.ts +3 -1
  155. package/dist/kernel/components/ui/drawer.js +6 -2
  156. package/dist/kernel/components/ui/input.d.ts +2 -2
  157. package/dist/kernel/components/ui/input.js +1 -1
  158. package/dist/kernel/components/ui/kbd.js +10 -17
  159. package/dist/kernel/components/ui/link.d.ts +11 -3
  160. package/dist/kernel/components/ui/link.js +12 -11
  161. package/dist/kernel/components/ui/menu.js +6 -6
  162. package/dist/kernel/components/ui/mod-key.d.ts +10 -0
  163. package/dist/kernel/components/ui/mod-key.js +36 -0
  164. package/dist/kernel/components/ui/navigation-menu.js +3 -3
  165. package/dist/kernel/components/ui/popover.js +1 -1
  166. package/dist/kernel/components/ui/progress.js +2 -2
  167. package/dist/kernel/components/ui/scroll-area.js +5 -5
  168. package/dist/kernel/components/ui/select.js +8 -11
  169. package/dist/kernel/components/ui/separator.js +1 -1
  170. package/dist/kernel/components/ui/table.js +1 -1
  171. package/dist/kernel/components/ui/tabs.js +1 -1
  172. package/dist/kernel/components/ui/tag.js +1 -1
  173. package/dist/kernel/components/ui/text.d.ts +2 -2
  174. package/dist/kernel/components/ui/text.js +1 -1
  175. package/dist/kernel/components/ui/toast.js +1 -1
  176. package/dist/kernel/components/ui/tooltip.js +1 -1
  177. package/dist/kernel/defaults.registry.d.ts +11 -24
  178. package/dist/kernel/defaults.registry.js +11 -26
  179. package/dist/kernel/routes/agent/markdown.d.ts +3 -1
  180. package/dist/kernel/routes/agent/markdown.js +219 -48
  181. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  182. package/dist/kernel/routes/layouts/group.js +5 -7
  183. package/dist/kernel/routes/metadata/feed.d.ts +1 -1
  184. package/dist/kernel/routes/metadata/feed.js +111 -81
  185. package/dist/kernel/routes/metadata/llms.d.ts +12 -3
  186. package/dist/kernel/routes/metadata/llms.js +156 -59
  187. package/dist/kernel/routes/metadata/og-image.js +1 -1
  188. package/dist/kernel/routes/metadata/robots.d.ts +1 -1
  189. package/dist/kernel/routes/metadata/robots.js +2 -2
  190. package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
  191. package/dist/kernel/routes/metadata/sitemap.js +206 -38
  192. package/dist/kernel/routes/not-found.d.ts +34 -0
  193. package/dist/kernel/routes/not-found.js +213 -0
  194. package/dist/kernel/routes/pages/group.d.ts +2 -2
  195. package/dist/kernel/routes/pages/group.js +21 -13
  196. package/dist/kernel/routes/pages/leaf.d.ts +28 -1
  197. package/dist/kernel/routes/pages/leaf.js +25 -16
  198. package/dist/kernel/routes/pages/root.js +19 -13
  199. package/dist/keyboard-shortcuts.js +1 -1
  200. package/dist/resolvers/manifest-resolver.js +29 -6
  201. package/dist/search.d.ts +6 -7
  202. package/dist/search.js +52 -29
  203. package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
  204. package/dist/theme-scope.js +1 -1
  205. package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
  206. package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
  207. package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
  208. package/dist/types.d.ts +15 -6
  209. package/dist/utils/heading-ids.js +30 -11
  210. package/dist/utils/toc-selection.d.ts +7 -0
  211. package/dist/utils/toc-selection.js +14 -0
  212. package/dist/validate-local-source-SV44DBQT.js +16 -0
  213. package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
  214. package/init/seed/minimal/.gitignore +1 -0
  215. package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
  216. package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
  217. package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
  218. package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
  219. package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
  220. package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
  221. package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
  222. package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
  223. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
  224. package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
  225. package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
  226. package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
  227. package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
  228. package/init/seed/minimal/publish.os/theme.css +52 -24
  229. package/init/seed/minimal/publish.os/tsconfig.json +3 -0
  230. package/init/seed/minimal/seed.json +12 -2
  231. package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
  232. package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
  233. package/init/seed/scratch/seed.json +5 -0
  234. package/package.json +55 -44
  235. package/release/app/phosphor/package.json +5 -5
  236. package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
  237. package/release/app/phosphor/pnpm-workspace.yaml +3 -0
  238. package/release/compiler/package.json +5 -3
  239. package/release/compiler/pnpm-lock.yaml.template +500 -303
  240. package/release/compiler/pnpm-workspace.yaml +3 -0
  241. package/release/release.json +8 -37
  242. package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
  243. package/dist/icons.d.ts +0 -1
  244. package/dist/icons.js +0 -2
  245. package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
  246. package/dist/kernel/components/blocks/design-system-preview.js +0 -648
  247. package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
  248. package/dist/kernel/components/blocks/link-playground.js +0 -744
  249. package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
  250. package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
  251. package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
  252. package/dist/kernel/components/mdx/components/pre.js +0 -18
  253. package/dist/kernel/components/ui/meta-key.d.ts +0 -17
  254. package/dist/kernel/components/ui/meta-key.js +0 -9
  255. package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
  256. package/dist/kernel/components/ui/theme-toggle.js +0 -58
  257. package/dist/kernel/framework-icons.d.ts +0 -1
  258. package/dist/kernel/framework-icons.js +0 -39
  259. package/dist/link-CYaCRDb6.d.ts +0 -35
  260. package/release/app/lucide/package.json +0 -30
  261. package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
  262. package/release/app/lucide/pnpm-workspace.yaml +0 -11
  263. package/release/app/tabler/package.json +0 -30
  264. package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
  265. package/release/app/tabler/pnpm-workspace.yaml +0 -11
@@ -0,0 +1,121 @@
1
+ import {
2
+ AppError
3
+ } from "./chunk-22RSSUNV.js";
4
+
5
+ // src/lib/compiler/release/installed-framework.ts
6
+ import { readFileSync } from "fs";
7
+ import { readFile } from "fs/promises";
8
+ import { dirname, join } from "path";
9
+ import { fileURLToPath } from "url";
10
+ var frameworkPackageName = "@publish.os/nextjs", exactVersion = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?(?:\+[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/u, sha256Digest = /^[a-f0-9]{64}$/u;
11
+ function record(value) {
12
+ if (!value || typeof value != "object" || Array.isArray(value))
13
+ throw new AppError({
14
+ code: "FRAMEWORK_RELEASE_INVALID",
15
+ message: "The installed framework release metadata is invalid."
16
+ });
17
+ return value;
18
+ }
19
+ function version(value) {
20
+ if (typeof value != "string" || !exactVersion.test(value))
21
+ throw new AppError({
22
+ code: "FRAMEWORK_RELEASE_INVALID",
23
+ message: "The installed framework release version is not exact."
24
+ });
25
+ return value;
26
+ }
27
+ function graphRecord(value) {
28
+ let graph = record(value), fields = [
29
+ "packageJsonSha256",
30
+ "pnpmWorkspaceSha256",
31
+ "lockfileTemplateSha256"
32
+ ];
33
+ for (let field of fields)
34
+ if (typeof graph[field] != "string" || !sha256Digest.test(graph[field]))
35
+ throw new AppError({
36
+ code: "FRAMEWORK_RELEASE_INVALID",
37
+ message: `The installed framework release has an invalid ${field}.`
38
+ });
39
+ return Object.freeze({
40
+ packageJsonSha256: graph.packageJsonSha256,
41
+ pnpmWorkspaceSha256: graph.pnpmWorkspaceSha256,
42
+ lockfileTemplateSha256: graph.lockfileTemplateSha256
43
+ });
44
+ }
45
+ function readInstalledFrameworkLocation() {
46
+ let directory = dirname(fileURLToPath(import.meta.url));
47
+ for (; ; ) {
48
+ try {
49
+ let manifest = record(
50
+ JSON.parse(readFileSync(join(directory, "package.json"), "utf8"))
51
+ );
52
+ if (manifest.name !== frameworkPackageName)
53
+ throw new AppError({
54
+ code: "FRAMEWORK_RELEASE_INVALID",
55
+ message: "The compiler is not inside the selected framework package."
56
+ });
57
+ return { packageRoot: directory, manifest };
58
+ } catch (error) {
59
+ if (error.code !== "ENOENT")
60
+ throw error instanceof AppError ? error : new AppError({
61
+ code: "FRAMEWORK_RELEASE_INVALID",
62
+ message: "The installed framework package metadata is unreadable or invalid."
63
+ });
64
+ }
65
+ let parent = dirname(directory);
66
+ if (parent === directory)
67
+ throw new AppError({
68
+ code: "FRAMEWORK_RELEASE_INVALID",
69
+ message: "The installed framework package metadata is missing."
70
+ });
71
+ directory = parent;
72
+ }
73
+ }
74
+ async function readInstalledFramework() {
75
+ let { packageRoot, manifest } = readInstalledFrameworkLocation(), installedVersion = version(manifest.version), release;
76
+ try {
77
+ release = record(
78
+ JSON.parse(
79
+ await readFile(join(packageRoot, "release", "release.json"), "utf8")
80
+ )
81
+ );
82
+ } catch {
83
+ throw new AppError({
84
+ code: "FRAMEWORK_RELEASE_INVALID",
85
+ message: "The installed framework release metadata is unreadable or invalid."
86
+ });
87
+ }
88
+ let node = record(manifest.engines).node;
89
+ if (release.schemaVersion !== 1 || release.runtime !== "nextjs" || release.version !== installedVersion || typeof node != "string" || node.trim().length === 0 || release.node !== node)
90
+ throw new AppError({
91
+ code: "FRAMEWORK_RELEASE_INVALID",
92
+ message: "The installed framework release identity does not match its package."
93
+ });
94
+ let graphRecords = record(release.graphs), graphs = Object.freeze({
95
+ compiler: graphRecord(graphRecords.compiler),
96
+ "app/phosphor": graphRecord(graphRecords["app/phosphor"])
97
+ });
98
+ if ("configurableDependencies" in release)
99
+ throw new AppError({
100
+ code: "FRAMEWORK_RELEASE_INVALID",
101
+ message: "The installed framework still declares configurable icon dependencies."
102
+ });
103
+ return Object.freeze({
104
+ packageName: frameworkPackageName,
105
+ version: installedVersion,
106
+ packageRoot,
107
+ release: Object.freeze({
108
+ schemaVersion: 1,
109
+ runtime: "nextjs",
110
+ version: installedVersion,
111
+ node,
112
+ pnpm: version(release.pnpm),
113
+ graphs
114
+ })
115
+ });
116
+ }
117
+
118
+ export {
119
+ readInstalledFrameworkLocation,
120
+ readInstalledFramework
121
+ };
@@ -0,0 +1,248 @@
1
+ import {
2
+ AppError
3
+ } from "./chunk-22RSSUNV.js";
4
+
5
+ // src/lib/compiler/source/assets/media-file-policy.ts
6
+ import { constants as fsConstants } from "fs";
7
+ import { open } from "fs/promises";
8
+ var DEFAULT_MAX_IMAGE_BYTES = 20 * 1024 * 1024, DEFAULT_MAX_VIDEO_BYTES = 20 * 1024 * 1024, DEFAULT_MAX_OTHER_BYTES = 5 * 1024 * 1024, MAX_THEME_FONT_BYTES = DEFAULT_MAX_OTHER_BYTES, MAX_MEDIA_SVG_BYTES = 256 * 1024, IGNORED_DOCUMENT_EXTENSIONS = /* @__PURE__ */ new Set(["pdf", "txt", "csv", "zip"]), THEME_IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
9
+ "png",
10
+ "jpg",
11
+ "jpeg",
12
+ "gif",
13
+ "webp",
14
+ "avif",
15
+ "ico",
16
+ "svg"
17
+ ]), THEME_FONT_EXTENSIONS = /* @__PURE__ */ new Set(["woff", "woff2", "ttf", "otf"]);
18
+ function ignoredMediaDocumentWarning(relativePath) {
19
+ let extension = relativePath.split(".").at(-1)?.toLowerCase() ?? "";
20
+ if (IGNORED_DOCUMENT_EXTENSIONS.has(extension))
21
+ return {
22
+ code: "FRAMEWORK_MEDIA_DOCUMENT_IGNORED",
23
+ message: `${relativePath} is ignored because this file type is not supported.`,
24
+ details: { file: relativePath, path: relativePath }
25
+ };
26
+ }
27
+ function ignoredMediaPathWarning(sourcePath) {
28
+ return {
29
+ code: "FRAMEWORK_MEDIA_PATH_IGNORED",
30
+ message: "Hidden media file ignored.",
31
+ details: { file: sourcePath, path: sourcePath }
32
+ };
33
+ }
34
+ function isHiddenMediaPath(sourcePath) {
35
+ return sourcePath.split(/[\\/]/u).some((segment) => segment.startsWith("."));
36
+ }
37
+ function mediaFileTooLarge(options) {
38
+ return new AppError({
39
+ code: "FRAMEWORK_MEDIA_FILE_TOO_LARGE",
40
+ message: `${options.relativePath} is ${options.bytes} bytes. Media files must be less than ${Math.round(options.limit / 1024 / 1024)} MB.`,
41
+ details: {
42
+ path: options.relativePath,
43
+ bytes: options.bytes,
44
+ limit: options.limit
45
+ }
46
+ });
47
+ }
48
+ function mediaFileByteLimit(relativePath) {
49
+ let extension = relativePath.split(".").at(-1)?.toLowerCase() ?? "", imageLimit = DEFAULT_MAX_IMAGE_BYTES;
50
+ return ["png", "jpg", "jpeg", "gif", "webp", "avif", "ico"].includes(extension) ? imageLimit : extension === "svg" ? Math.min(imageLimit, MAX_MEDIA_SVG_BYTES) : ["mp4", "webm"].includes(extension) ? DEFAULT_MAX_VIDEO_BYTES : DEFAULT_MAX_OTHER_BYTES;
51
+ }
52
+ function themeResourceByteLimit(relativePath) {
53
+ let extension = relativePath.split(".").at(-1)?.toLowerCase() ?? "";
54
+ if (THEME_FONT_EXTENSIONS.has(extension)) return MAX_THEME_FONT_BYTES;
55
+ if (THEME_IMAGE_EXTENSIONS.has(extension))
56
+ return mediaFileByteLimit(relativePath);
57
+ }
58
+ async function readBoundedMediaFile(options) {
59
+ let handle = await (options.openFile ?? open)(
60
+ options.path,
61
+ fsConstants.O_RDONLY | (fsConstants.O_NOFOLLOW ?? 0) | (fsConstants.O_NONBLOCK ?? 0)
62
+ );
63
+ try {
64
+ let opened = await handle.stat();
65
+ if (!opened.isFile() || options.expectedIdentity !== void 0 && (opened.dev !== options.expectedIdentity.dev || opened.ino !== options.expectedIdentity.ino))
66
+ throw new AppError({
67
+ code: "FRAMEWORK_MEDIA_FILE_CHANGED",
68
+ message: `${options.relativePath} changed while media was being read`,
69
+ details: { path: options.relativePath }
70
+ });
71
+ if (opened.size > options.limit)
72
+ throw mediaFileTooLarge({
73
+ relativePath: options.relativePath,
74
+ bytes: opened.size,
75
+ limit: options.limit
76
+ });
77
+ let chunkSize = Math.min(64 * 1024, options.limit + 1), chunk = Buffer.allocUnsafe(Math.max(1, chunkSize)), chunks = [], bytesRead = 0;
78
+ for (; ; ) {
79
+ options.signal?.throwIfAborted();
80
+ let remainingWithOverflowProbe = options.limit - bytesRead + 1, { bytesRead: count } = await handle.read(
81
+ chunk,
82
+ 0,
83
+ Math.min(chunk.length, remainingWithOverflowProbe),
84
+ null
85
+ );
86
+ if (options.signal?.throwIfAborted(), count === 0) break;
87
+ if (bytesRead += count, bytesRead > options.limit)
88
+ throw mediaFileTooLarge({
89
+ relativePath: options.relativePath,
90
+ bytes: bytesRead,
91
+ limit: options.limit
92
+ });
93
+ chunks.push(Buffer.from(chunk.subarray(0, count)));
94
+ }
95
+ let completed = await handle.stat();
96
+ if (completed.size > options.limit)
97
+ throw mediaFileTooLarge({
98
+ relativePath: options.relativePath,
99
+ bytes: completed.size,
100
+ limit: options.limit
101
+ });
102
+ if (completed.size !== bytesRead)
103
+ throw new AppError({
104
+ code: "FRAMEWORK_MEDIA_FILE_CHANGED",
105
+ message: `${options.relativePath} changed while media was being read`,
106
+ details: { path: options.relativePath }
107
+ });
108
+ return Buffer.concat(chunks, bytesRead);
109
+ } finally {
110
+ await handle.close();
111
+ }
112
+ }
113
+
114
+ // src/lib/compiler/source/css-imports.ts
115
+ function skipString(css, start) {
116
+ let quote = css[start];
117
+ for (let index = start + 1; index < css.length; index += 1)
118
+ if (css[index] === "\\") index += 1;
119
+ else if (css[index] === quote) return index + 1;
120
+ return css.length;
121
+ }
122
+ function maskComments(css) {
123
+ let result = "";
124
+ for (let index = 0; index < css.length; )
125
+ if (css[index] === '"' || css[index] === "'") {
126
+ let end = skipString(css, index);
127
+ result += css.slice(index, end), index = end;
128
+ } else if (css.startsWith("/*", index)) {
129
+ let closing = css.indexOf("*/", index + 2), end = closing < 0 ? css.length : closing + 2;
130
+ result += css.slice(index, end).replace(/[^\r\n]/g, " "), index = end;
131
+ } else
132
+ result += css[index], index += 1;
133
+ return result;
134
+ }
135
+ function decodeCssPath(value) {
136
+ return value.replace(/\\(?:\r\n|[\r\n\f])/g, "").replace(
137
+ /\\([\da-f]{1,6})[\t\n\f\r ]?|\\(.)/gi,
138
+ (_match, hex, escaped) => {
139
+ if (!hex) return escaped ?? "";
140
+ let codePoint = Number.parseInt(hex, 16);
141
+ return codePoint > 0 && codePoint <= 1114111 && !(codePoint >= 55296 && codePoint <= 57343) ? String.fromCodePoint(codePoint) : "\uFFFD";
142
+ }
143
+ );
144
+ }
145
+ function statementEnd(scan, start) {
146
+ let depth = 0;
147
+ for (let index = start; index < scan.length; index += 1)
148
+ if (scan[index] === '"' || scan[index] === "'")
149
+ index = skipString(scan, index) - 1;
150
+ else if (scan[index] === "\\")
151
+ index += 1;
152
+ else if (scan[index] === "(")
153
+ depth += 1;
154
+ else if (scan[index] === ")")
155
+ depth -= 1;
156
+ else {
157
+ if (scan[index] === ";" && depth === 0)
158
+ return index + 1;
159
+ if ((scan[index] === "{" || scan[index] === "}") && depth === 0)
160
+ return index;
161
+ }
162
+ return scan.length;
163
+ }
164
+ function closingParenthesis(scan, start, end) {
165
+ let depth = 0;
166
+ for (let index = start; index < end; index += 1)
167
+ if (scan[index] === '"' || scan[index] === "'")
168
+ index = skipString(scan, index) - 1;
169
+ else if (scan[index] === "\\")
170
+ index += 1;
171
+ else if (scan[index] === "(")
172
+ depth += 1;
173
+ else if (scan[index] === ")" && --depth === 0)
174
+ return index;
175
+ return end;
176
+ }
177
+ function importConditions({
178
+ css,
179
+ scan,
180
+ start,
181
+ end
182
+ }) {
183
+ let result = {}, tailEnd = scan[end - 1] === ";" ? end - 1 : end, cursor = start, skipWhitespace = () => {
184
+ for (; cursor < tailEnd && /\s/.test(scan[cursor] ?? ""); ) cursor += 1;
185
+ };
186
+ skipWhitespace();
187
+ let layer = /^layer(?=\(|\s|$)/i.exec(scan.slice(cursor, tailEnd));
188
+ if (layer) {
189
+ if (cursor += layer[0].length, scan[cursor] === "(") {
190
+ let closing = closingParenthesis(scan, cursor, tailEnd);
191
+ result.layer = css.slice(cursor + 1, closing).trim(), cursor = closing + 1;
192
+ } else
193
+ result.layer = !0;
194
+ skipWhitespace();
195
+ }
196
+ let supports = /^supports\(/i.exec(scan.slice(cursor, tailEnd));
197
+ if (supports) {
198
+ let opening = cursor + supports[0].length - 1, closing = closingParenthesis(scan, opening, tailEnd);
199
+ result.supports = css.slice(opening + 1, closing).trim(), cursor = closing + 1, skipWhitespace();
200
+ }
201
+ return scan.slice(cursor, tailEnd).trim() && (result.media = css.slice(cursor, tailEnd).trim()), result;
202
+ }
203
+ function cssImports({ css }) {
204
+ let scan = maskComments(css), pattern = /@import\s+(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|url\(\s*(?:"((?:\\.|[^"\\])*)"|'((?:\\.|[^'\\])*)'|([^\s)]+))\s*\))/giy, imports = [];
205
+ for (let index = 0; index < scan.length; ) {
206
+ if (scan[index] === '"' || scan[index] === "'") {
207
+ index = skipString(scan, index);
208
+ continue;
209
+ }
210
+ if (scan[index] === "\\") {
211
+ index += 2;
212
+ continue;
213
+ }
214
+ pattern.lastIndex = index;
215
+ let match = scan[index] === "@" ? pattern.exec(scan) : null;
216
+ if (!match) {
217
+ index += 1;
218
+ continue;
219
+ }
220
+ let path = decodeCssPath(
221
+ match.slice(1).find((value) => value !== void 0) ?? ""
222
+ ), end = statementEnd(scan, pattern.lastIndex);
223
+ imports.push({
224
+ path,
225
+ start: index,
226
+ end,
227
+ ...importConditions({ css, scan, start: pattern.lastIndex, end })
228
+ }), index = end;
229
+ }
230
+ return imports;
231
+ }
232
+ function localCssImports({ css }) {
233
+ return cssImports({ css }).filter(({ path }) => path.startsWith("."));
234
+ }
235
+
236
+ export {
237
+ MAX_MEDIA_SVG_BYTES,
238
+ ignoredMediaDocumentWarning,
239
+ ignoredMediaPathWarning,
240
+ isHiddenMediaPath,
241
+ mediaFileTooLarge,
242
+ mediaFileByteLimit,
243
+ themeResourceByteLimit,
244
+ readBoundedMediaFile,
245
+ decodeCssPath,
246
+ cssImports,
247
+ localCssImports
248
+ };
@@ -0,0 +1,142 @@
1
+ import {
2
+ acquireOperationLock,
3
+ assertLocalDirectory,
4
+ assertOperationOutput,
5
+ markOperationOutput
6
+ } from "./chunk-6D2E6UMD.js";
7
+ import {
8
+ AppError
9
+ } from "./chunk-22RSSUNV.js";
10
+
11
+ // src/lib/compiler/lifecycle/checkout-preparation.ts
12
+ import { lstat, mkdir, readdir, realpath } from "fs/promises";
13
+ import { isAbsolute, join } from "path";
14
+ import { setTimeout } from "timers/promises";
15
+ async function withCheckoutPreparation({
16
+ packageRoot,
17
+ workspaceRoot,
18
+ signal,
19
+ prepare
20
+ }) {
21
+ signal?.throwIfAborted();
22
+ let selectedRoot = workspaceRoot ?? packageRoot;
23
+ if (!isAbsolute(selectedRoot))
24
+ throw new AppError({
25
+ code: "FRAMEWORK_LOCAL_SOURCE_INVALID",
26
+ message: "Checkout preparation requires an absolute checkout path."
27
+ });
28
+ let sourceRoot = await realpath(selectedRoot), sourceIdentity = await assertLocalDirectory(sourceRoot), outputRoot = join(sourceRoot, ".publish.os");
29
+ await mkdir(outputRoot).catch((error) => {
30
+ if (error.code !== "EEXIST") throw error;
31
+ });
32
+ let rootIdentity = await assertLocalDirectory(outputRoot), outputDir = join(outputRoot, "checkout-dependencies"), output = { sourceRoot, outputDir, operation: "dependencies" }, created = !1;
33
+ await mkdir(outputDir).then(() => {
34
+ created = !0;
35
+ }).catch((error) => {
36
+ if (error.code !== "EEXIST") throw error;
37
+ });
38
+ let identity = await assertLocalDirectory(outputDir);
39
+ if (created) {
40
+ if ((await readdir(outputDir)).length !== 0)
41
+ throw new AppError({
42
+ code: "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
43
+ message: `Checkout preparation metadata changed at ${outputDir}. Preserve it and inspect the owner before retrying.`
44
+ });
45
+ await markOperationOutput(output);
46
+ } else
47
+ for (let attempt = 0; ; attempt += 1) {
48
+ signal?.throwIfAborted(), await assertLocalDirectory(sourceRoot, sourceIdentity), await assertLocalDirectory(outputRoot, rootIdentity), await assertLocalDirectory(outputDir, identity);
49
+ let entries = await readdir(outputDir), published = entries.includes(".operation-owner.json");
50
+ published && await assertOperationOutput(output);
51
+ let temporary = entries.filter(
52
+ (name) => /^\.operation-owner-init-[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}\.tmp$/u.test(
53
+ name
54
+ )
55
+ );
56
+ if (entries.some(
57
+ (name) => !temporary.includes(name) && name !== ".operation-owner.json" && !(published && name === ".locks")
58
+ ))
59
+ throw new AppError({
60
+ code: "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
61
+ message: `Checkout preparation initialization cannot be verified at ${outputDir}. Preserve its files and inspect the owner before retrying.`
62
+ });
63
+ for (let name of temporary) {
64
+ let entry = await lstat(join(outputDir, name)).catch(
65
+ (error) => {
66
+ if (error.code !== "ENOENT") throw error;
67
+ }
68
+ );
69
+ if (entry && !entry.isFile())
70
+ throw new AppError({
71
+ code: "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
72
+ message: `Checkout preparation initialization is redirected at ${join(outputDir, name)}. Preserve the marker and restore its owner before retrying.`
73
+ });
74
+ }
75
+ if (published && temporary.length === 0) break;
76
+ if (attempt >= 50)
77
+ throw new AppError({
78
+ code: "FRAMEWORK_LOCAL_OUTPUT_OWNERSHIP",
79
+ message: `Checkout preparation initialization did not finish at ${outputDir}. Preserve its metadata and verify the initializer stopped before retrying.`
80
+ });
81
+ await setTimeout(10, void 0, { signal });
82
+ }
83
+ let assertCurrent = async () => {
84
+ if (await assertLocalDirectory(sourceRoot, sourceIdentity), await assertLocalDirectory(outputRoot, rootIdentity), await assertLocalDirectory(outputDir, identity), await assertOperationOutput(output), (await readdir(outputDir)).some(
85
+ (name) => name !== ".operation-owner.json" && name !== ".locks"
86
+ ))
87
+ throw new AppError({
88
+ code: "FRAMEWORK_LOCAL_LOCK_UNVERIFIED",
89
+ message: `Checkout preparation contains unknown files at ${outputDir}. Preserve them and inspect the owner before retrying.`
90
+ });
91
+ }, deadline = Date.now() + 36e4, release;
92
+ for (; ; ) {
93
+ signal?.throwIfAborted(), await assertCurrent();
94
+ try {
95
+ release = await acquireOperationLock({
96
+ sourceRoot,
97
+ outputRoot: outputDir,
98
+ operation: "dependencies",
99
+ signal
100
+ });
101
+ break;
102
+ } catch (error) {
103
+ if (!(error instanceof AppError) || error.code !== "FRAMEWORK_LOCAL_OPERATION_ACTIVE" || Date.now() >= deadline)
104
+ throw error;
105
+ await setTimeout(100, void 0, { signal });
106
+ }
107
+ }
108
+ let stopped = !0, failed = !1, failure, result;
109
+ try {
110
+ await assertCurrent(), signal?.throwIfAborted(), stopped = !1, result = await prepare(() => {
111
+ stopped = !0;
112
+ });
113
+ } catch (error) {
114
+ failed = !0, failure = error;
115
+ }
116
+ try {
117
+ await assertCurrent(), await release({ shutdownUnverified: !stopped });
118
+ } catch (error) {
119
+ if (!failed) throw error;
120
+ failure instanceof Error && (failure.cause = new AppError({
121
+ code: "FRAMEWORK_LOCAL_LOCK_UNVERIFIED",
122
+ message: `Checkout dependency lock retention failed at ${outputDir}. Preserve the metadata and verify the recorded preparer's descendants before recovery.`,
123
+ details: {
124
+ lockPath: join(outputDir, ".locks/dependencies"),
125
+ cause: error,
126
+ primaryCause: failure.cause
127
+ }
128
+ }));
129
+ }
130
+ if (failed) throw failure;
131
+ if (!stopped)
132
+ throw new AppError({
133
+ code: "FRAMEWORK_PROCESS_SHUTDOWN_FAILED",
134
+ message: `Checkout dependency preparation at ${sourceRoot} did not prove shutdown. Its lock remains protected.`,
135
+ fix: "Verify the recorded preparer's descendants stopped before recovering its retained lock."
136
+ });
137
+ return result;
138
+ }
139
+
140
+ export {
141
+ withCheckoutPreparation
142
+ };