@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92
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/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
- package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +46 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
- 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 +254 -86
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
- package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
- package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-3T4HVDSC.js +426 -0
- package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
- package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
- package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
- package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
- package/dist/chunk-DX7PXFCM.js +2519 -0
- package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +111 -23
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +563 -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 +4 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-44GJSMXD.js +16 -0
- package/dist/config/createNextConfig.js +19 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-TG74L4FF.js +16 -0
- package/dist/index.d.ts +151 -95
- package/dist/index.js +25 -0
- 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 +37 -8
- package/dist/kernel/components/blocks/AgentActions.js +384 -174
- package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
- package/dist/kernel/components/blocks/agent-actions.js +563 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +79 -59
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +30 -7
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +32 -9
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +13 -3
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +137 -28
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/theme-toggle.js +5 -5
- 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 +20 -2
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +22 -17
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +6 -6
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -4
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +57 -16
- package/dist/kernel/components/mdx/mdx.js +232 -35
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- 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.d.ts +7 -7
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +6 -6
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +59 -7
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/drawer.js +1 -1
- 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.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +11 -5
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +4 -17
- package/dist/kernel/defaults.registry.js +4 -19
- package/dist/kernel/routes/agent/markdown.d.ts +7 -0
- package/dist/kernel/routes/agent/markdown.js +229 -54
- 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 -2
- package/dist/kernel/routes/metadata/feed.js +119 -88
- package/dist/kernel/routes/metadata/llms.d.ts +3 -23
- package/dist/kernel/routes/metadata/llms.js +2 -103
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
- package/dist/kernel/routes/metadata/sitemap.js +277 -49
- 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 +5 -5
- package/dist/kernel/routes/pages/group.js +11 -5
- package/dist/kernel/routes/pages/leaf.d.ts +38 -6
- package/dist/kernel/routes/pages/leaf.js +21 -12
- package/dist/kernel/routes/pages/root.d.ts +5 -5
- package/dist/kernel/routes/pages/root.js +21 -6
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +2 -9
- package/dist/search.js +9 -16
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/theme-scope.js +1 -1
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +117 -91
- 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-EN2GW4FR.js +16 -0
- package/dist/validate-publish-os-source-OEWQDB7B.js +14 -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 +85 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +12 -4
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +48 -23
- package/release/app/phosphor/package.json +4 -4
- package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +153 -183
- package/release/release.json +6 -6
- package/dist/button-CtzUJB8u.d.ts +0 -11
- package/dist/chunk-535TM4A5.js +0 -1455
- package/dist/chunk-B2V22WRT.js +0 -297
- package/dist/chunk-NECL5IBJ.js +0 -318
- package/dist/chunk-SVYGXXYR.js +0 -36
- package/dist/chunk-UF6ATARM.js +0 -1100
- package/dist/compose-NN23UJGC.js +0 -13
- package/dist/ide-support-ZNW7ODFY.js +0 -15
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -667
- 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/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -53
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-BzkZty3r.d.ts +0 -147
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/validate-local-source-XRL2Y7XE.js +0 -14
- package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
- package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
|
@@ -37,51 +37,63 @@ const VideoComponent = (sourceMedia.video ??
|
|
|
37
37
|
const FigureComponent = (sourceMedia.figure ??
|
|
38
38
|
PublishOsFigure) as typeof PublishOsFigure;
|
|
39
39
|
|
|
40
|
-
function
|
|
41
|
-
if (typeof src !== "string"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
function getMediaMetadata(src: unknown): ResolvedMediaAsset | undefined {
|
|
41
|
+
if (typeof src !== "string") return undefined;
|
|
42
|
+
const pathname = src.split(/[?#]/u, 1)[0];
|
|
43
|
+
if (!pathname?.startsWith("/publishos/assets/")) return undefined;
|
|
44
|
+
return Object.values(
|
|
45
|
+
mediaManifest.assets as Record<string, ResolvedMediaAsset>,
|
|
46
|
+
).find((asset) => asset.outputPath === pathname);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function authoredDimension(value: unknown): number | undefined {
|
|
50
|
+
if (typeof value === "number") return value;
|
|
51
|
+
if (typeof value !== "string" || !/^\d+$/u.test(value)) return undefined;
|
|
52
|
+
const dimension = Number(value);
|
|
53
|
+
return Number.isSafeInteger(dimension) && dimension > 0
|
|
54
|
+
? dimension
|
|
55
|
+
: undefined;
|
|
45
56
|
}
|
|
46
57
|
|
|
47
58
|
function Link(props: LinkProps) {
|
|
48
|
-
const asset =
|
|
59
|
+
const asset = getMediaMetadata(props.href);
|
|
49
60
|
const shouldDownload =
|
|
50
61
|
asset?.mediaType === "document" || asset?.mediaType === "file";
|
|
51
62
|
return (
|
|
52
63
|
<LinkComponent
|
|
53
64
|
{...props}
|
|
54
65
|
download={props.download ?? (shouldDownload ? "" : undefined)}
|
|
55
|
-
href={
|
|
66
|
+
href={props.href}
|
|
56
67
|
/>
|
|
57
68
|
);
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
function Image(props: ImageProps) {
|
|
61
|
-
const asset =
|
|
72
|
+
const asset = getMediaMetadata(props.src);
|
|
73
|
+
const width = authoredDimension(props.width);
|
|
74
|
+
const height = authoredDimension(props.height);
|
|
62
75
|
return (
|
|
63
76
|
<ImageComponent
|
|
64
77
|
{...props}
|
|
65
78
|
aspect={props.aspect ?? asset?.aspect}
|
|
66
|
-
height={
|
|
79
|
+
height={height ?? asset?.height}
|
|
67
80
|
intrinsicHeight={asset?.intrinsicHeight ?? asset?.height}
|
|
68
81
|
intrinsicWidth={asset?.intrinsicWidth ?? asset?.width}
|
|
69
|
-
optimized={asset?.optimized}
|
|
70
|
-
src={
|
|
71
|
-
width={
|
|
82
|
+
optimized={props.optimized ?? asset?.optimized}
|
|
83
|
+
src={props.src}
|
|
84
|
+
width={width ?? asset?.width}
|
|
72
85
|
/>
|
|
73
86
|
);
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
function Video(props: VideoProps) {
|
|
77
|
-
const asset =
|
|
78
|
-
const poster = resolveMediaAsset(props.poster);
|
|
90
|
+
const asset = getMediaMetadata(props.src);
|
|
79
91
|
return (
|
|
80
92
|
<VideoComponent
|
|
81
93
|
{...props}
|
|
82
94
|
height={props.height ?? asset?.height}
|
|
83
|
-
poster={
|
|
84
|
-
src={
|
|
95
|
+
poster={props.poster}
|
|
96
|
+
src={props.src}
|
|
85
97
|
width={props.width ?? asset?.width}
|
|
86
98
|
/>
|
|
87
99
|
);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { MDXProps } from "@publish.os/nextjs/mdx/mdx";
|
|
2
2
|
import { renderMdx } from "@publish.os/nextjs/mdx/mdx";
|
|
3
3
|
import { mdxComponents } from "@source/_internal/mdx-components.generated";
|
|
4
|
+
import { importedMdxComponents } from "@source/_internal/mdx-icon-components.generated";
|
|
4
5
|
|
|
5
6
|
export type { MDXComponents, MDXProps } from "@publish.os/nextjs/mdx/mdx";
|
|
6
7
|
export { Figure, Image, Link, Video } from "@publish.os/nextjs/mdx/mdx";
|
|
7
8
|
|
|
8
9
|
export async function MDX(props: MDXProps) {
|
|
9
|
-
return renderMdx({
|
|
10
|
+
return renderMdx({
|
|
11
|
+
...props,
|
|
12
|
+
siteComponents: mdxComponents,
|
|
13
|
+
importedComponents: importedMdxComponents[props.page.path],
|
|
14
|
+
});
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
Object.defineProperty(MDX, "__publishOsMdx", { value: true });
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
approveLocalComposition,
|
|
3
|
+
installLocalApp
|
|
4
|
+
} from "./chunk-4BC2L2KA.js";
|
|
5
|
+
import {
|
|
6
|
+
withLocalOperation
|
|
7
|
+
} from "./chunk-IL4RJOKI.js";
|
|
1
8
|
import {
|
|
2
9
|
prepareIdeSupport
|
|
3
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3T4HVDSC.js";
|
|
11
|
+
import "./chunk-6D2E6UMD.js";
|
|
4
12
|
import {
|
|
5
13
|
composeFrameworkSource
|
|
6
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NHSLTARU.js";
|
|
7
15
|
import {
|
|
8
16
|
validateLocalSource
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
withLocalOperation
|
|
18
|
-
} from "./chunk-B2V22WRT.js";
|
|
19
|
-
import {
|
|
20
|
-
installLocalApp
|
|
21
|
-
} from "./chunk-WKTEO6RS.js";
|
|
22
|
-
import "./chunk-GGKFQ3MA.js";
|
|
23
|
-
import "./chunk-DLDFHU7Y.js";
|
|
24
|
-
import "./chunk-7OGTPSKI.js";
|
|
25
|
-
import "./chunk-YLTOLYWM.js";
|
|
17
|
+
} from "./chunk-SBMDONTV.js";
|
|
18
|
+
import "./chunk-NNBJZPFM.js";
|
|
19
|
+
import "./chunk-DZ3VWEV5.js";
|
|
20
|
+
import "./chunk-7NY22B5U.js";
|
|
21
|
+
import "./chunk-DX7PXFCM.js";
|
|
22
|
+
import "./chunk-EFO6AWXN.js";
|
|
23
|
+
import "./chunk-5KAD7W53.js";
|
|
24
|
+
import "./chunk-WL75GQ5M.js";
|
|
26
25
|
import "./chunk-AI2UULNX.js";
|
|
27
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-5J3YUNRY.js";
|
|
27
|
+
import "./chunk-22RSSUNV.js";
|
|
28
28
|
|
|
29
29
|
// src/lib/compiler/lifecycle/build-operation.ts
|
|
30
30
|
async function runLocalBuild(options) {
|
|
@@ -40,10 +40,10 @@ async function runLocalBuild(options) {
|
|
|
40
40
|
sourceRoot: lifetime.sourceRoot
|
|
41
41
|
});
|
|
42
42
|
return await approveLocalComposition({ options }), options.request.context?.ide && await prepareIdeSupport({
|
|
43
|
+
frameworkOptions: { ...options, signal: lifetime.signal },
|
|
43
44
|
publishOsDir: lifetime.sourceRoot,
|
|
44
45
|
source,
|
|
45
|
-
framework
|
|
46
|
-
frameworkOptions: { ...options, signal: lifetime.signal }
|
|
46
|
+
framework
|
|
47
47
|
}), await lifetime.replaceOutput(async (outputDir) => {
|
|
48
48
|
await composeFrameworkSource({
|
|
49
49
|
request: {
|
|
@@ -62,7 +62,13 @@ async function runLocalBuild(options) {
|
|
|
62
62
|
},
|
|
63
63
|
source,
|
|
64
64
|
signal: lifetime.signal,
|
|
65
|
-
onProgress: (message) => options.onEvent?.({ type: "progress", message })
|
|
65
|
+
onProgress: (message) => options.onEvent?.({ type: "progress", message }),
|
|
66
|
+
onWarning: (warning) => options.onEvent?.({
|
|
67
|
+
type: "diagnostics",
|
|
68
|
+
diagnostics: {
|
|
69
|
+
diagnostics: [{ ...warning, severity: "warning" }]
|
|
70
|
+
}
|
|
71
|
+
})
|
|
66
72
|
});
|
|
67
73
|
let app = await installLocalApp({
|
|
68
74
|
outputDir,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { ReactNode, ComponentPropsWithRef } from 'react';
|
|
1
2
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
3
|
import { VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { ReactNode, ComponentPropsWithRef } from 'react';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "solid" | "soft" | "outline" | "ghost" | null | undefined;
|
|
7
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
8
|
-
iconOnly?: boolean | null | undefined;
|
|
6
|
+
readonly variant?: "solid" | "soft" | "outline" | "ghost" | null | undefined;
|
|
7
|
+
readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
8
|
+
readonly iconOnly?: boolean | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
11
11
|
type ButtonProps = {
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertPublishOsSourceBoundary
|
|
3
|
+
} from "./chunk-7NY22B5U.js";
|
|
4
|
+
import {
|
|
5
|
+
decodeCssPath,
|
|
6
|
+
ignoredMediaDocumentWarning,
|
|
7
|
+
mediaFileByteLimit,
|
|
8
|
+
readBoundedMediaFile,
|
|
9
|
+
themeResourceByteLimit
|
|
10
|
+
} from "./chunk-5KAD7W53.js";
|
|
11
|
+
import {
|
|
12
|
+
isExcludedSourcePath
|
|
13
|
+
} from "./chunk-WL75GQ5M.js";
|
|
14
|
+
import {
|
|
15
|
+
AppError
|
|
16
|
+
} from "./chunk-22RSSUNV.js";
|
|
17
|
+
|
|
18
|
+
// src/lib/compiler/lifecycle/capture-local-source.ts
|
|
19
|
+
import { createHash } from "crypto";
|
|
20
|
+
import { constants } from "fs";
|
|
21
|
+
import {
|
|
22
|
+
lstat,
|
|
23
|
+
mkdir,
|
|
24
|
+
open,
|
|
25
|
+
readdir,
|
|
26
|
+
readFile,
|
|
27
|
+
realpath,
|
|
28
|
+
writeFile
|
|
29
|
+
} from "fs/promises";
|
|
30
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
31
|
+
import valueParser from "postcss-value-parser";
|
|
32
|
+
function isInside({ root, path }) {
|
|
33
|
+
let value = relative(root, path);
|
|
34
|
+
return value !== "" && value !== ".." && !value.startsWith(`..${sep}`) && !isAbsolute(value);
|
|
35
|
+
}
|
|
36
|
+
function cssResourcePaths(css) {
|
|
37
|
+
let paths = /* @__PURE__ */ new Set();
|
|
38
|
+
return valueParser(css).walk((node) => {
|
|
39
|
+
if (node.type !== "function") return;
|
|
40
|
+
let name = node.value.toLowerCase(), candidates = name === "url" ? node.nodes.filter(
|
|
41
|
+
(child) => child.type === "string" || child.type === "word"
|
|
42
|
+
) : ["image-set", "-webkit-image-set"].includes(name) ? node.nodes.filter((child) => child.type === "string") : [];
|
|
43
|
+
for (let candidate of candidates) {
|
|
44
|
+
let decoded = decodeCssPath(candidate.value.trim());
|
|
45
|
+
if (!decoded || decoded.startsWith("#") || decoded.startsWith("/") || decoded.startsWith("//") || /^[a-z][a-z0-9+.-]*:/iu.test(decoded))
|
|
46
|
+
continue;
|
|
47
|
+
let path = decoded.split(/[?#]/u, 1)[0] ?? "";
|
|
48
|
+
path && paths.add(path);
|
|
49
|
+
}
|
|
50
|
+
if (name === "url") return !1;
|
|
51
|
+
}), [...paths];
|
|
52
|
+
}
|
|
53
|
+
async function collectCssReferencedResources({
|
|
54
|
+
captureDir,
|
|
55
|
+
capturedFiles
|
|
56
|
+
}) {
|
|
57
|
+
let referenced = /* @__PURE__ */ new Set();
|
|
58
|
+
for (let cssFile of capturedFiles.filter(
|
|
59
|
+
(path) => path.toLowerCase().endsWith(".css")
|
|
60
|
+
)) {
|
|
61
|
+
let css = await readFile(join(captureDir, cssFile), "utf8");
|
|
62
|
+
for (let urlPath of cssResourcePaths(css)) {
|
|
63
|
+
let absolutePath = resolve(captureDir, dirname(cssFile), urlPath);
|
|
64
|
+
isInside({ root: captureDir, path: absolutePath }) && referenced.add(relative(captureDir, absolutePath).split(sep).join("/"));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return referenced;
|
|
68
|
+
}
|
|
69
|
+
function localFontPaths(config) {
|
|
70
|
+
if (!config || typeof config != "object" || Array.isArray(config)) return [];
|
|
71
|
+
let fonts = config.fonts;
|
|
72
|
+
if (!fonts || typeof fonts != "object" || Array.isArray(fonts)) return [];
|
|
73
|
+
let paths = /* @__PURE__ */ new Set();
|
|
74
|
+
for (let role of Object.values(fonts)) {
|
|
75
|
+
if (!role || typeof role != "object" || Array.isArray(role)) continue;
|
|
76
|
+
let src = role.src, addPath = (value) => {
|
|
77
|
+
if (typeof value != "string" || /^[a-z][a-z0-9+.-]*:/iu.test(value) || value.startsWith("//") || value.includes("\0"))
|
|
78
|
+
return;
|
|
79
|
+
let normalized = value.replace(/^\/+/, "").replace(/^\.\//, "");
|
|
80
|
+
normalized && paths.add(normalized);
|
|
81
|
+
};
|
|
82
|
+
if (addPath(src), Array.isArray(src))
|
|
83
|
+
for (let file of src)
|
|
84
|
+
file && typeof file == "object" && !Array.isArray(file) && addPath(file.path);
|
|
85
|
+
}
|
|
86
|
+
return [...paths];
|
|
87
|
+
}
|
|
88
|
+
async function collectConfiguredFontResources({
|
|
89
|
+
captureDir,
|
|
90
|
+
capturedFiles
|
|
91
|
+
}) {
|
|
92
|
+
let referenced = /* @__PURE__ */ new Set();
|
|
93
|
+
for (let configPath of capturedFiles.filter(
|
|
94
|
+
(path) => path.endsWith(".config.json")
|
|
95
|
+
)) {
|
|
96
|
+
let config;
|
|
97
|
+
try {
|
|
98
|
+
config = JSON.parse(await readFile(join(captureDir, configPath), "utf8"));
|
|
99
|
+
} catch {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
for (let fontPath of localFontPaths(config)) {
|
|
103
|
+
let absolutePath = resolve(captureDir, fontPath);
|
|
104
|
+
isInside({ root: captureDir, path: absolutePath }) && referenced.add(relative(captureDir, absolutePath).split(sep).join("/"));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return referenced;
|
|
108
|
+
}
|
|
109
|
+
async function readUnboundedSourceFile({
|
|
110
|
+
path,
|
|
111
|
+
entry,
|
|
112
|
+
signal
|
|
113
|
+
}) {
|
|
114
|
+
let file = await open(
|
|
115
|
+
path,
|
|
116
|
+
constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0)
|
|
117
|
+
);
|
|
118
|
+
try {
|
|
119
|
+
let opened = await file.stat();
|
|
120
|
+
if (!opened.isFile() || opened.dev !== entry.dev || opened.ino !== entry.ino)
|
|
121
|
+
throw new AppError({
|
|
122
|
+
code: "FRAMEWORK_CAPTURE_SOURCE_CHANGED",
|
|
123
|
+
message: "A source entry changed before capture could read it."
|
|
124
|
+
});
|
|
125
|
+
signal?.throwIfAborted();
|
|
126
|
+
let contents = await file.readFile({ signal });
|
|
127
|
+
return signal?.throwIfAborted(), contents;
|
|
128
|
+
} finally {
|
|
129
|
+
await file.close();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function captureLocalSource({
|
|
133
|
+
sourceRoot,
|
|
134
|
+
captureDir,
|
|
135
|
+
signal
|
|
136
|
+
}) {
|
|
137
|
+
signal?.throwIfAborted(), await assertPublishOsSourceBoundary(sourceRoot), signal?.throwIfAborted();
|
|
138
|
+
let root = await realpath(sourceRoot), destination = resolve(captureDir), outputRoot = join(root, ".publish.os");
|
|
139
|
+
if (!isInside({ root: outputRoot, path: destination }) || await realpath(dirname(destination)) !== dirname(destination))
|
|
140
|
+
throw new AppError({
|
|
141
|
+
code: "FRAMEWORK_CAPTURE_OUTPUT_INVALID",
|
|
142
|
+
message: "Source capture requires an owned path inside source output."
|
|
143
|
+
});
|
|
144
|
+
await mkdir(destination).catch((error) => {
|
|
145
|
+
if (error.code !== "EEXIST") throw error;
|
|
146
|
+
});
|
|
147
|
+
let destinationEntry = await lstat(destination);
|
|
148
|
+
if (!destinationEntry.isDirectory() || destinationEntry.isSymbolicLink() || await realpath(destination) !== destination || (await readdir(destination)).length > 0)
|
|
149
|
+
throw new AppError({
|
|
150
|
+
code: "FRAMEWORK_CAPTURE_OUTPUT_INVALID",
|
|
151
|
+
message: "Source capture requires an empty owned directory."
|
|
152
|
+
});
|
|
153
|
+
let capturedFiles = [], deferredResources = [], copyDirectory = async (relativeDirectory) => {
|
|
154
|
+
signal?.throwIfAborted();
|
|
155
|
+
let directory = join(root, relativeDirectory), names = (await readdir(directory)).sort();
|
|
156
|
+
if (!relativeDirectory) {
|
|
157
|
+
let configIndex = names.indexOf("publish.os.config.json");
|
|
158
|
+
if (configIndex > 0) {
|
|
159
|
+
let [configName] = names.splice(configIndex, 1);
|
|
160
|
+
configName && names.unshift(configName);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (let name of names) {
|
|
164
|
+
signal?.throwIfAborted();
|
|
165
|
+
let path = relativeDirectory ? `${relativeDirectory}/${name}` : name;
|
|
166
|
+
if (isExcludedSourcePath(path) || relativeDirectory === "" && name.startsWith(".env"))
|
|
167
|
+
continue;
|
|
168
|
+
let sourcePath = join(root, path), outputPath = join(destination, path), entry = await lstat(sourcePath);
|
|
169
|
+
if (entry.isSymbolicLink())
|
|
170
|
+
throw new AppError({
|
|
171
|
+
code: "FRAMEWORK_SOURCE_SYMLINK",
|
|
172
|
+
message: "Symbolic links are not allowed inside publish.os."
|
|
173
|
+
});
|
|
174
|
+
if (!isInside({ root, path: await realpath(sourcePath) }))
|
|
175
|
+
throw new AppError({
|
|
176
|
+
code: "FRAMEWORK_SOURCE_PATH_ESCAPE",
|
|
177
|
+
message: "A source entry resolves outside the selected source."
|
|
178
|
+
});
|
|
179
|
+
if (entry.isDirectory()) {
|
|
180
|
+
await mkdir(outputPath), await copyDirectory(path);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (!entry.isFile())
|
|
184
|
+
throw new AppError({
|
|
185
|
+
code: "FRAMEWORK_SOURCE_ENTRY_NOT_REGULAR",
|
|
186
|
+
message: "Source capture accepts only directories and regular files."
|
|
187
|
+
});
|
|
188
|
+
let contents;
|
|
189
|
+
if (ignoredMediaDocumentWarning(path))
|
|
190
|
+
contents = Buffer.alloc(0);
|
|
191
|
+
else if (path.startsWith("assets/")) {
|
|
192
|
+
let relativeAssetPath = path.slice(7);
|
|
193
|
+
contents = await readBoundedMediaFile({
|
|
194
|
+
path: sourcePath,
|
|
195
|
+
relativePath: `assets/${relativeAssetPath}`,
|
|
196
|
+
limit: mediaFileByteLimit(relativeAssetPath),
|
|
197
|
+
expectedIdentity: { dev: entry.dev, ino: entry.ino },
|
|
198
|
+
signal
|
|
199
|
+
});
|
|
200
|
+
} else if (themeResourceByteLimit(path) !== void 0) {
|
|
201
|
+
deferredResources.push({
|
|
202
|
+
path: sourcePath,
|
|
203
|
+
outputPath,
|
|
204
|
+
relativePath: path,
|
|
205
|
+
entry
|
|
206
|
+
});
|
|
207
|
+
continue;
|
|
208
|
+
} else
|
|
209
|
+
contents = await readUnboundedSourceFile({
|
|
210
|
+
path: sourcePath,
|
|
211
|
+
entry,
|
|
212
|
+
signal
|
|
213
|
+
});
|
|
214
|
+
await writeFile(outputPath, contents, { flag: "wx", signal }), capturedFiles.push(path);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
await copyDirectory("");
|
|
218
|
+
let cssResources = await collectCssReferencedResources({
|
|
219
|
+
captureDir: destination,
|
|
220
|
+
capturedFiles
|
|
221
|
+
});
|
|
222
|
+
for (let path of await collectConfiguredFontResources({
|
|
223
|
+
captureDir: destination,
|
|
224
|
+
capturedFiles
|
|
225
|
+
}))
|
|
226
|
+
cssResources.add(path);
|
|
227
|
+
for (let resource of deferredResources) {
|
|
228
|
+
signal?.throwIfAborted();
|
|
229
|
+
let contents = cssResources.has(resource.relativePath) ? await readBoundedMediaFile({
|
|
230
|
+
path: resource.path,
|
|
231
|
+
relativePath: resource.relativePath,
|
|
232
|
+
limit: themeResourceByteLimit(resource.relativePath) ?? 0,
|
|
233
|
+
expectedIdentity: {
|
|
234
|
+
dev: resource.entry.dev,
|
|
235
|
+
ino: resource.entry.ino
|
|
236
|
+
},
|
|
237
|
+
signal
|
|
238
|
+
}) : await readUnboundedSourceFile({
|
|
239
|
+
path: resource.path,
|
|
240
|
+
entry: resource.entry,
|
|
241
|
+
signal
|
|
242
|
+
});
|
|
243
|
+
await writeFile(resource.outputPath, contents, { flag: "wx", signal }), capturedFiles.push(resource.relativePath);
|
|
244
|
+
}
|
|
245
|
+
let hash = createHash("sha256");
|
|
246
|
+
for (let path of capturedFiles.sort()) {
|
|
247
|
+
signal?.throwIfAborted();
|
|
248
|
+
let contents = await readFile(join(destination, path), { signal });
|
|
249
|
+
hash.update(JSON.stringify([path, contents.byteLength])), hash.update("\0"), hash.update(contents);
|
|
250
|
+
}
|
|
251
|
+
return signal?.throwIfAborted(), {
|
|
252
|
+
sourceDir: captureDir,
|
|
253
|
+
sourceRevision: `sha256:${hash.digest("hex")}`
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
export {
|
|
257
|
+
captureLocalSource
|
|
258
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/lib/compiler/internal/errors.ts
|
|
2
|
+
var AppError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
details;
|
|
5
|
+
fix;
|
|
6
|
+
constructor({ code, message, details, fix }) {
|
|
7
|
+
super(message), this.name = "FrameworkError", this.code = code, this.details = details, this.fix = fix;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
AppError
|
|
13
|
+
};
|