@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.
- package/compiler-assets/nextjs/defaults/app/globals.css +1 -0
- package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
- package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
- package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
- package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
- package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
- package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
- package/compiler-assets/nextjs/shims/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +143 -65
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
- package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-5QMLXF7N.js +89 -0
- package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-4BC2L2KA.js +620 -0
- package/dist/chunk-5J3YUNRY.js +121 -0
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/chunk-6C65KV7O.js +142 -0
- package/dist/chunk-6D2E6UMD.js +695 -0
- package/dist/chunk-7NY22B5U.js +161 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-F3AGNDF4.js +2377 -0
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/chunk-NNBJZPFM.js +193 -0
- package/dist/chunk-ORIUWJBQ.js +58 -0
- package/dist/chunk-OXOFRXEI.js +7129 -0
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/chunk-WL75GQ5M.js +80 -0
- package/dist/compiler.d.ts +54 -7
- package/dist/compiler.js +121 -13147
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +594 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-CVBJRAF6.js +16 -0
- package/dist/config/createNextConfig.js +27 -0
- package/dist/dev-operation-OSHHWRWK.js +1095 -0
- package/dist/framework-selection-ZVO323PK.js +11 -0
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +55 -4
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +35 -6
- package/dist/kernel/components/blocks/AgentActions.js +401 -150
- package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
- package/dist/kernel/components/blocks/agent-actions.js +594 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.js +3 -3
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +406 -65
- package/dist/kernel/components/blocks/navigation-progress.js +6 -3
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +12 -24
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +7 -6
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +554 -428
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +12 -10
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +24 -14
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +47 -1
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +19 -1
- package/dist/kernel/components/blocks/toc.js +122 -180
- package/dist/kernel/components/mdx/components/blockquote.js +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +67 -36
- package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
- package/dist/kernel/components/mdx/components/code-block.js +106 -5
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
- package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +24 -14
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +94 -68
- package/dist/kernel/components/mdx/components/inline-code.js +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +5 -4
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +3 -3
- package/dist/kernel/components/mdx/components/paragraph.js +2 -5
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +2 -2
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +8 -4
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +8 -6
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +28 -14
- package/dist/kernel/components/mdx/mdx.js +336 -63
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +10 -8
- package/dist/kernel/components/ui/button-group.js +8 -7
- package/dist/kernel/components/ui/button.d.ts +58 -6
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +6 -2
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.js +10 -17
- package/dist/kernel/components/ui/link.d.ts +11 -3
- package/dist/kernel/components/ui/link.js +12 -11
- package/dist/kernel/components/ui/menu.js +6 -6
- package/dist/kernel/components/ui/mod-key.d.ts +10 -0
- package/dist/kernel/components/ui/mod-key.js +36 -0
- package/dist/kernel/components/ui/navigation-menu.js +3 -3
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +2 -2
- package/dist/kernel/components/ui/scroll-area.js +5 -5
- package/dist/kernel/components/ui/select.js +8 -11
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +11 -24
- package/dist/kernel/defaults.registry.js +11 -26
- package/dist/kernel/routes/agent/markdown.d.ts +3 -1
- package/dist/kernel/routes/agent/markdown.js +219 -48
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.js +111 -81
- package/dist/kernel/routes/metadata/llms.d.ts +12 -3
- package/dist/kernel/routes/metadata/llms.js +156 -59
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +1 -1
- package/dist/kernel/routes/metadata/robots.js +2 -2
- package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
- package/dist/kernel/routes/metadata/sitemap.js +206 -38
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +2 -2
- package/dist/kernel/routes/pages/group.js +21 -13
- package/dist/kernel/routes/pages/leaf.d.ts +28 -1
- package/dist/kernel/routes/pages/leaf.js +25 -16
- package/dist/kernel/routes/pages/root.js +19 -13
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +52 -29
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
- package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
- package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
- package/dist/types.d.ts +15 -6
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-SV44DBQT.js +16 -0
- package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
- package/init/seed/minimal/.gitignore +1 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +82 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
- package/init/seed/minimal/publish.os/theme.css +52 -24
- package/init/seed/minimal/publish.os/tsconfig.json +3 -0
- package/init/seed/minimal/seed.json +12 -2
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
- package/init/seed/scratch/seed.json +5 -0
- package/package.json +55 -44
- package/release/app/phosphor/package.json +5 -5
- package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +500 -303
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +8 -37
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
- package/dist/icons.d.ts +0 -1
- package/dist/icons.js +0 -2
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -648
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- package/dist/kernel/components/mdx/components/pre.d.ts +0 -6
- package/dist/kernel/components/mdx/components/pre.js +0 -18
- package/dist/kernel/components/ui/meta-key.d.ts +0 -17
- package/dist/kernel/components/ui/meta-key.js +0 -9
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -58
- package/dist/kernel/framework-icons.d.ts +0 -1
- package/dist/kernel/framework-icons.js +0 -39
- package/dist/link-CYaCRDb6.d.ts +0 -35
- package/release/app/lucide/package.json +0 -30
- package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
- package/release/app/lucide/pnpm-workspace.yaml +0 -11
- package/release/app/tabler/package.json +0 -30
- package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
- package/release/app/tabler/pnpm-workspace.yaml +0 -11
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runtimePackageVersion
|
|
3
|
+
} from "./chunk-AI2UULNX.js";
|
|
4
|
+
import {
|
|
5
|
+
readInstalledFrameworkLocation
|
|
6
|
+
} from "./chunk-5J3YUNRY.js";
|
|
7
|
+
import {
|
|
8
|
+
AppError
|
|
9
|
+
} from "./chunk-22RSSUNV.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/compiler/release/framework-selection.ts
|
|
12
|
+
import { createHash } from "crypto";
|
|
13
|
+
import { readFile, realpath, stat } from "fs/promises";
|
|
14
|
+
import { isAbsolute, join, relative, resolve, sep } from "path";
|
|
15
|
+
import { fileURLToPath } from "url";
|
|
16
|
+
|
|
17
|
+
// src/lib/compiler/release/framework-archive.ts
|
|
18
|
+
import { posix } from "path";
|
|
19
|
+
import { isDeepStrictEqual } from "util";
|
|
20
|
+
import { Parser } from "tar";
|
|
21
|
+
function invalidArchive(message) {
|
|
22
|
+
return new AppError({ code: "FRAMEWORK_ARCHIVE_INVALID", message });
|
|
23
|
+
}
|
|
24
|
+
async function readArchiveManifest(archive) {
|
|
25
|
+
return await new Promise((resolve2, reject) => {
|
|
26
|
+
let manifestFound = !1, manifestSource, parser = new Parser({
|
|
27
|
+
strict: !0,
|
|
28
|
+
onReadEntry: (entry) => {
|
|
29
|
+
if (posix.normalize(entry.path.replaceAll("\\", "/")) !== "package/package.json") {
|
|
30
|
+
entry.resume();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (manifestFound || entry.path !== "package/package.json" || entry.type !== "File" || entry.size > 1048576) {
|
|
34
|
+
parser.abort(
|
|
35
|
+
invalidArchive(
|
|
36
|
+
"The framework archive must contain one regular package manifest."
|
|
37
|
+
)
|
|
38
|
+
), entry.resume();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
manifestFound = !0;
|
|
42
|
+
let chunks = [];
|
|
43
|
+
entry.on("data", (chunk) => {
|
|
44
|
+
chunks.push(chunk);
|
|
45
|
+
}), entry.on("end", () => {
|
|
46
|
+
manifestSource = Buffer.concat(chunks).toString("utf8");
|
|
47
|
+
}), entry.resume();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
parser.on("error", (error) => {
|
|
51
|
+
reject(
|
|
52
|
+
error instanceof AppError ? error : invalidArchive("The framework archive is malformed.")
|
|
53
|
+
);
|
|
54
|
+
}), parser.on("end", () => {
|
|
55
|
+
try {
|
|
56
|
+
let manifest = JSON.parse(manifestSource ?? "");
|
|
57
|
+
if (!manifest || typeof manifest != "object" || Array.isArray(manifest))
|
|
58
|
+
throw invalidArchive(
|
|
59
|
+
"The framework archive package manifest is invalid."
|
|
60
|
+
);
|
|
61
|
+
resolve2(manifest);
|
|
62
|
+
} catch {
|
|
63
|
+
reject(
|
|
64
|
+
invalidArchive(
|
|
65
|
+
"The framework archive package manifest is missing or invalid."
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}), parser.end(archive);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async function assertFrameworkArchiveIdentity({
|
|
73
|
+
archive,
|
|
74
|
+
framework
|
|
75
|
+
}) {
|
|
76
|
+
let manifest = await readArchiveManifest(archive);
|
|
77
|
+
if (manifest.name !== framework.packageName || manifest.version !== framework.version)
|
|
78
|
+
throw invalidArchive(
|
|
79
|
+
"The framework archive identity does not match the executing release."
|
|
80
|
+
);
|
|
81
|
+
let installed = readInstalledFrameworkLocation();
|
|
82
|
+
if (installed.packageRoot !== framework.packageRoot || installed.manifest.version !== framework.version)
|
|
83
|
+
throw invalidArchive(
|
|
84
|
+
"The executing framework identity changed during archive validation."
|
|
85
|
+
);
|
|
86
|
+
for (let field of [
|
|
87
|
+
"dependencies",
|
|
88
|
+
"optionalDependencies",
|
|
89
|
+
"peerDependencies",
|
|
90
|
+
"peerDependenciesMeta",
|
|
91
|
+
"engines"
|
|
92
|
+
])
|
|
93
|
+
if (!isDeepStrictEqual(manifest[field] ?? {}, installed.manifest[field] ?? {}))
|
|
94
|
+
throw invalidArchive(
|
|
95
|
+
`The framework archive field ${field} does not match the executing release.`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/lib/compiler/release/framework-selection.ts
|
|
100
|
+
async function readCheckoutTypeScriptConfig({
|
|
101
|
+
packageRoot
|
|
102
|
+
}) {
|
|
103
|
+
try {
|
|
104
|
+
let source = await readFile(join(packageRoot, "tsconfig.json")), paths = JSON.parse(source.toString("utf8"))?.compilerOptions?.paths;
|
|
105
|
+
if (!paths || typeof paths != "object" || Array.isArray(paths) || !Object.values(paths).every(
|
|
106
|
+
(targets) => Array.isArray(targets) && targets.length > 0 && targets.every(
|
|
107
|
+
(target) => typeof target == "string" && target.length > 0
|
|
108
|
+
)
|
|
109
|
+
))
|
|
110
|
+
throw new Error("Invalid checkout paths");
|
|
111
|
+
let aliases = paths;
|
|
112
|
+
if (!aliases["@/*"] || aliases["@/*"].some(
|
|
113
|
+
(target) => resolve(packageRoot, target) !== join(packageRoot, "src/*")
|
|
114
|
+
))
|
|
115
|
+
throw new Error("Missing compiler source alias");
|
|
116
|
+
return { source, paths: aliases };
|
|
117
|
+
} catch {
|
|
118
|
+
throw new AppError({
|
|
119
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
120
|
+
message: "The selected checkout TypeScript configuration is missing or invalid.",
|
|
121
|
+
fix: "Restore the checkout tsconfig.json and its source paths, then repeat the operation. No registry fallback is available."
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function assertFrameworkSelection({
|
|
126
|
+
context,
|
|
127
|
+
framework,
|
|
128
|
+
runtime
|
|
129
|
+
}) {
|
|
130
|
+
let selected = context?.framework;
|
|
131
|
+
if (selected !== void 0) {
|
|
132
|
+
if (!selected || !["checkout", "candidate"].includes(selected.kind) || selected.packageName !== framework.packageName || selected.version !== framework.version)
|
|
133
|
+
throw new AppError({
|
|
134
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
135
|
+
message: "The selected local framework does not match the executing input.",
|
|
136
|
+
fix: "Select a valid local checkout or package candidate and repeat the operation. No registry fallback is available."
|
|
137
|
+
});
|
|
138
|
+
if (selected.kind === "checkout") {
|
|
139
|
+
let root = typeof selected.packageRoot == "string" && isAbsolute(selected.packageRoot) ? await realpath(selected.packageRoot).catch(() => {
|
|
140
|
+
}) : void 0;
|
|
141
|
+
if (!root || !relative(root, fileURLToPath(import.meta.url)).startsWith(
|
|
142
|
+
`src${sep}`
|
|
143
|
+
) || !fileURLToPath(import.meta.url).endsWith(".ts") || root !== await realpath(framework.packageRoot) || !(await stat(join(root, "src/compiler.ts")).catch(() => {
|
|
144
|
+
}))?.isFile() || context?.archive !== void 0)
|
|
145
|
+
throw new AppError({
|
|
146
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
147
|
+
message: "The selected checkout is missing or does not contain the executing compiler.",
|
|
148
|
+
fix: "Invoke src/compiler.ts from the selected editable checkout without a package archive. No registry fallback is available."
|
|
149
|
+
});
|
|
150
|
+
let config = await readCheckoutTypeScriptConfig({ packageRoot: root }), manifest = await readFile(join(root, "package.json")).catch(() => {
|
|
151
|
+
throw new AppError({
|
|
152
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
153
|
+
message: "The selected checkout package metadata is unreadable.",
|
|
154
|
+
fix: "Restore the checkout package.json, then repeat the operation. No registry fallback is available."
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
return `checkout:${createHash("sha256").update(root).update(manifest).update(config.source).update(JSON.stringify(framework.release)).digest("hex")}`;
|
|
158
|
+
}
|
|
159
|
+
if (typeof selected.integrity != "string" || !/^sha512-[A-Za-z0-9+/]{86}==$/u.test(selected.integrity) || selected.integrity !== context?.archive?.integrity)
|
|
160
|
+
throw new AppError({
|
|
161
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
162
|
+
message: "The selected local framework does not match the executing input.",
|
|
163
|
+
fix: "Select a valid local checkout or package candidate and repeat the operation. No registry fallback is available."
|
|
164
|
+
});
|
|
165
|
+
let archive = await readFile(context?.archive?.path ?? "").catch(() => {
|
|
166
|
+
throw new AppError({
|
|
167
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
168
|
+
message: "The selected local framework archive is missing or unreadable.",
|
|
169
|
+
fix: "Prepare the selected local framework again. No registry fallback is available."
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
if (`sha512-${createHash("sha512").update(archive).digest("base64")}` !== selected.integrity)
|
|
173
|
+
throw new AppError({
|
|
174
|
+
code: "FRAMEWORK_SELECTION_INVALID",
|
|
175
|
+
message: "The selected local framework archive does not match its integrity.",
|
|
176
|
+
fix: "Prepare the selected local framework again. No registry fallback is available."
|
|
177
|
+
});
|
|
178
|
+
return await assertFrameworkArchiveIdentity({ archive, framework }), selected.integrity;
|
|
179
|
+
}
|
|
180
|
+
if (runtimePackageVersion(runtime) !== framework.version)
|
|
181
|
+
throw new AppError({
|
|
182
|
+
code: "FRAMEWORK_SOURCE_PIN_MISMATCH",
|
|
183
|
+
message: "The source pin does not match the executing framework release.",
|
|
184
|
+
fix: "Invoke the exact framework version selected in publish.os.config.json."
|
|
185
|
+
});
|
|
186
|
+
return context?.archive?.integrity ?? "";
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
assertFrameworkArchiveIdentity,
|
|
191
|
+
readCheckoutTypeScriptConfig,
|
|
192
|
+
assertFrameworkSelection
|
|
193
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertFrameworkSelection
|
|
3
|
+
} from "./chunk-NNBJZPFM.js";
|
|
4
|
+
import {
|
|
5
|
+
validatePublishOsSource
|
|
6
|
+
} from "./chunk-F3AGNDF4.js";
|
|
7
|
+
import {
|
|
8
|
+
readInstalledFramework
|
|
9
|
+
} from "./chunk-5J3YUNRY.js";
|
|
10
|
+
import {
|
|
11
|
+
AppError
|
|
12
|
+
} from "./chunk-22RSSUNV.js";
|
|
13
|
+
|
|
14
|
+
// src/lib/compiler/lifecycle/validate-local-source.ts
|
|
15
|
+
async function validateLocalSource({
|
|
16
|
+
options,
|
|
17
|
+
sourceDir,
|
|
18
|
+
sourceRoot
|
|
19
|
+
}) {
|
|
20
|
+
options.signal?.throwIfAborted(), options.onEvent?.({ type: "progress", message: "Validating source" });
|
|
21
|
+
let validation = await validatePublishOsSource({
|
|
22
|
+
publishOsDir: sourceDir,
|
|
23
|
+
sourceIdentity: { sourceRoot }
|
|
24
|
+
});
|
|
25
|
+
if (options.signal?.throwIfAborted(), options.onEvent?.({
|
|
26
|
+
type: "diagnostics",
|
|
27
|
+
diagnostics: {
|
|
28
|
+
diagnostics: [...validation.errors, ...validation.warnings].map(
|
|
29
|
+
(diagnostic) => ({
|
|
30
|
+
code: diagnostic.code,
|
|
31
|
+
severity: diagnostic.level,
|
|
32
|
+
message: diagnostic.message,
|
|
33
|
+
...diagnostic.file === void 0 ? {} : { file: diagnostic.file },
|
|
34
|
+
...diagnostic.line === void 0 ? {} : { line: diagnostic.line },
|
|
35
|
+
...diagnostic.column === void 0 ? {} : { column: diagnostic.column },
|
|
36
|
+
...typeof diagnostic.details?.correction == "string" ? { correction: diagnostic.details.correction } : {},
|
|
37
|
+
...typeof diagnostic.details?.sourceLine == "string" ? { sourceLine: diagnostic.details.sourceLine } : {},
|
|
38
|
+
...typeof diagnostic.details?.length == "number" ? { length: diagnostic.details.length } : {},
|
|
39
|
+
...typeof diagnostic.details?.propertyPath == "string" ? { propertyPath: diagnostic.details.propertyPath } : {}
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}), !validation.valid || !validation.source)
|
|
44
|
+
throw new AppError({
|
|
45
|
+
code: "FRAMEWORK_SOURCE_INVALID",
|
|
46
|
+
message: "The selected source failed validation."
|
|
47
|
+
});
|
|
48
|
+
let framework = await readInstalledFramework();
|
|
49
|
+
return await assertFrameworkSelection({
|
|
50
|
+
context: options.request.context,
|
|
51
|
+
framework,
|
|
52
|
+
runtime: validation.source.config.runtime
|
|
53
|
+
}), { source: validation.source, framework };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
validateLocalSource
|
|
58
|
+
};
|