@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7
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/README.md +3 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/button-CFdx-ohV.d.ts +20 -0
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1198
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +88 -169
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +18 -47
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +22 -62
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +20 -54
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +10 -32
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +19 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +3 -25
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +8 -29
- package/dist/kernel/defaults.registry.d.ts +1 -1
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +40 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/link-CYaCRDb6.d.ts +35 -0
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +469 -35
- package/release/{package.json → app/lucide/package.json} +11 -5
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +29 -5
- package/release/runtime-pnpm-lock.yaml +0 -1316
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/components/ui/tooltip.tsx
|
|
4
4
|
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { clsx } from "clsx";
|
|
8
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
9
|
-
var twMerge = extendTailwindMerge({
|
|
10
|
-
extend: {
|
|
11
|
-
classGroups: {
|
|
12
|
-
z: [
|
|
13
|
-
"z-content",
|
|
14
|
-
"z-nav",
|
|
15
|
-
"z-overlay",
|
|
16
|
-
"z-modal",
|
|
17
|
-
"z-search",
|
|
18
|
-
"z-toast",
|
|
19
|
-
"z-progress"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
function cn(...inputs) {
|
|
25
|
-
return twMerge(clsx(inputs));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// src/kernel/components/ui/tooltip.tsx
|
|
5
|
+
import { useThemeScope } from "@publish.os/nextjs/theme-scope";
|
|
6
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
29
7
|
import { jsx } from "react/jsx-runtime";
|
|
30
8
|
function TooltipProvider(props) {
|
|
31
9
|
return /* @__PURE__ */ jsx(BaseTooltip.Provider, { ...props });
|
|
@@ -38,7 +16,7 @@ function TooltipTrigger({ className, ...props }) {
|
|
|
38
16
|
BaseTooltip.Trigger,
|
|
39
17
|
{
|
|
40
18
|
className: cn(
|
|
41
|
-
"rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-
|
|
19
|
+
"rounded-button focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-focus-stroke",
|
|
42
20
|
className
|
|
43
21
|
),
|
|
44
22
|
...props
|
|
@@ -46,7 +24,8 @@ function TooltipTrigger({ className, ...props }) {
|
|
|
46
24
|
);
|
|
47
25
|
}
|
|
48
26
|
function TooltipPortal(props) {
|
|
49
|
-
|
|
27
|
+
let themeScope = useThemeScope();
|
|
28
|
+
return /* @__PURE__ */ jsx(BaseTooltip.Portal, { ...props, ...themeScope });
|
|
50
29
|
}
|
|
51
30
|
function TooltipPositioner({
|
|
52
31
|
className,
|
|
@@ -56,7 +35,7 @@ function TooltipPositioner({
|
|
|
56
35
|
return /* @__PURE__ */ jsx(
|
|
57
36
|
BaseTooltip.Positioner,
|
|
58
37
|
{
|
|
59
|
-
className: cn("z-
|
|
38
|
+
className: cn("z-overlay outline-none", className),
|
|
60
39
|
sideOffset,
|
|
61
40
|
...props
|
|
62
41
|
}
|
|
@@ -67,7 +46,7 @@ function TooltipPopup({ className, ...props }) {
|
|
|
67
46
|
BaseTooltip.Popup,
|
|
68
47
|
{
|
|
69
48
|
className: cn(
|
|
70
|
-
"max-w-xs rounded-tooltip border border-tooltip-stroke-4 bg-tooltip-surface-1 px-2.5 py-1.5 text-xs leading-5 text-tooltip-foreground-1 shadow-
|
|
49
|
+
"max-w-xs rounded-tooltip border border-tooltip-stroke-4 bg-tooltip-surface-1 px-2.5 py-1.5 text-xs leading-5 text-tooltip-foreground-1 shadow-tooltip outline-none [--text-foreground:var(--tooltip-foreground-1)] [--text-muted-foreground:var(--tooltip-foreground-4)]",
|
|
71
50
|
className
|
|
72
51
|
),
|
|
73
52
|
...props
|
|
@@ -406,7 +406,7 @@ declare const kernelDefaultsRegistry: {
|
|
|
406
406
|
readonly category: "route";
|
|
407
407
|
readonly name: "RootLayout";
|
|
408
408
|
readonly status: "available";
|
|
409
|
-
readonly description: "
|
|
409
|
+
readonly description: "Framework-owned default root layout wrapper.";
|
|
410
410
|
readonly projectPath: "publish.os/layout.tsx";
|
|
411
411
|
}, {
|
|
412
412
|
readonly category: "route";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/defaults-registry.ts
|
|
2
2
|
var kernelDefaultsRegistry = {
|
|
3
3
|
version: 1,
|
|
4
4
|
entries: [
|
|
@@ -445,7 +445,7 @@ var kernelDefaultsRegistry = {
|
|
|
445
445
|
category: "route",
|
|
446
446
|
name: "RootLayout",
|
|
447
447
|
status: "available",
|
|
448
|
-
description: "
|
|
448
|
+
description: "Framework-owned default root layout wrapper.",
|
|
449
449
|
projectPath: "publish.os/layout.tsx"
|
|
450
450
|
},
|
|
451
451
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArrowRight as FrameworkArrowRightIcon, Bot as FrameworkBotIcon, Check as FrameworkCheckIcon, ChevronDown as FrameworkChevronDownIcon, ChevronLeft as FrameworkChevronLeftIcon, ChevronRight as FrameworkChevronRightIcon, Clipboard as FrameworkClipboardIcon, Copy as FrameworkCopyIcon, ExternalLink as FrameworkExternalLinkIcon, Eye as FrameworkEyeIcon, Github as FrameworkGithubIcon, Link as FrameworkLinkIcon, MessageCircle as FrameworkMessageCircleIcon, Monitor as FrameworkMonitorIcon, Moon as FrameworkMoonIcon, Search as FrameworkSearchIcon, Sun as FrameworkSunIcon } from 'lucide-react';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/framework-icons.ts
|
|
2
|
+
import {
|
|
3
|
+
ArrowRight,
|
|
4
|
+
Bot,
|
|
5
|
+
Check,
|
|
6
|
+
ChevronDown,
|
|
7
|
+
ChevronLeft,
|
|
8
|
+
ChevronRight,
|
|
9
|
+
Clipboard,
|
|
10
|
+
Copy,
|
|
11
|
+
ExternalLink,
|
|
12
|
+
Eye,
|
|
13
|
+
Github,
|
|
14
|
+
Link,
|
|
15
|
+
MessageCircle,
|
|
16
|
+
Monitor,
|
|
17
|
+
Moon,
|
|
18
|
+
Search,
|
|
19
|
+
Sun
|
|
20
|
+
} from "lucide-react";
|
|
21
|
+
export {
|
|
22
|
+
ArrowRight as FrameworkArrowRightIcon,
|
|
23
|
+
Bot as FrameworkBotIcon,
|
|
24
|
+
Check as FrameworkCheckIcon,
|
|
25
|
+
ChevronDown as FrameworkChevronDownIcon,
|
|
26
|
+
ChevronLeft as FrameworkChevronLeftIcon,
|
|
27
|
+
ChevronRight as FrameworkChevronRightIcon,
|
|
28
|
+
Clipboard as FrameworkClipboardIcon,
|
|
29
|
+
Copy as FrameworkCopyIcon,
|
|
30
|
+
ExternalLink as FrameworkExternalLinkIcon,
|
|
31
|
+
Eye as FrameworkEyeIcon,
|
|
32
|
+
Github as FrameworkGithubIcon,
|
|
33
|
+
Link as FrameworkLinkIcon,
|
|
34
|
+
MessageCircle as FrameworkMessageCircleIcon,
|
|
35
|
+
Monitor as FrameworkMonitorIcon,
|
|
36
|
+
Moon as FrameworkMoonIcon,
|
|
37
|
+
Search as FrameworkSearchIcon,
|
|
38
|
+
Sun as FrameworkSunIcon
|
|
39
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var isDev = process.env.NODE_ENV !== "production"
|
|
3
|
-
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
4
|
-
var log = {
|
|
1
|
+
// src/lib/runtime/logging/logger.ts
|
|
2
|
+
var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1", log = {
|
|
5
3
|
debug(...args) {
|
|
6
|
-
|
|
4
|
+
isDev && isDebugEnabled && console.debug("[publish.os:debug]", ...args);
|
|
7
5
|
},
|
|
8
6
|
info(...args) {
|
|
9
7
|
console.log("[publish.os]", ...args);
|
|
@@ -16,42 +14,27 @@ var log = {
|
|
|
16
14
|
}
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
// src/
|
|
20
|
-
var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate";
|
|
21
|
-
var CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate";
|
|
22
|
-
var SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate";
|
|
23
|
-
var SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
17
|
+
// src/lib/runtime/response/cached-text-response.ts
|
|
18
|
+
var CACHE_CONTROL = "public, max-age=300, s-maxage=3600, stale-while-revalidate=3600, must-revalidate", CDN_CACHE_CONTROL = "public, max-age=3600, stale-while-revalidate=3600, must-revalidate", SHORT_CACHE_CONTROL = "public, max-age=60, s-maxage=600, stale-while-revalidate=300, must-revalidate", SHORT_CDN_CACHE_CONTROL = "public, max-age=300, stale-while-revalidate=3600";
|
|
24
19
|
function cacheControl(policy) {
|
|
25
|
-
|
|
26
|
-
if (policy === "short") return SHORT_CACHE_CONTROL;
|
|
27
|
-
return policy;
|
|
20
|
+
return !policy || policy === "default" ? CACHE_CONTROL : policy === "short" ? SHORT_CACHE_CONTROL : policy;
|
|
28
21
|
}
|
|
29
22
|
function cdnCacheControl(policy) {
|
|
30
|
-
|
|
31
|
-
if (policy === "short") return SHORT_CDN_CACHE_CONTROL;
|
|
32
|
-
return policy;
|
|
23
|
+
return !policy || policy === "default" ? CDN_CACHE_CONTROL : policy === "short" ? SHORT_CDN_CACHE_CONTROL : policy;
|
|
33
24
|
}
|
|
34
25
|
function cachedTextHeaders(contentType, options = {}) {
|
|
35
|
-
|
|
36
|
-
headers.set("cache-control", cacheControl(options.cachePolicy));
|
|
37
|
-
headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
38
|
-
headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy));
|
|
39
|
-
headers.set("content-type", contentType);
|
|
40
|
-
headers.set("x-content-type-options", "nosniff");
|
|
41
|
-
if (options.noindex) headers.set("x-robots-tag", "noindex");
|
|
42
|
-
return headers;
|
|
26
|
+
let headers = new Headers(options.headers);
|
|
27
|
+
return headers.set("cache-control", cacheControl(options.cachePolicy)), headers.set("cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("vercel-cdn-cache-control", cdnCacheControl(options.cachePolicy)), headers.set("content-type", contentType), headers.set("x-content-type-options", "nosniff"), options.noindex && headers.set("x-robots-tag", "noindex"), headers;
|
|
43
28
|
}
|
|
44
29
|
function createCachedTextResponse(options) {
|
|
45
|
-
|
|
46
|
-
const method = options.method ?? "GET";
|
|
47
|
-
const headers = cachedTextHeaders(options.contentType, options);
|
|
30
|
+
let status = options.status ?? 200, method = options.method ?? "GET", headers = cachedTextHeaders(options.contentType, options);
|
|
48
31
|
return new Response(method === "HEAD" ? null : options.body, {
|
|
49
32
|
headers,
|
|
50
33
|
status
|
|
51
34
|
});
|
|
52
35
|
}
|
|
53
36
|
|
|
54
|
-
// src/
|
|
37
|
+
// src/route-agent-markdown.ts
|
|
55
38
|
var DEFAULT_DISCOVERY_LINKS = {
|
|
56
39
|
home: "/",
|
|
57
40
|
llms: "/llms.txt",
|
|
@@ -61,17 +44,12 @@ function debugMarkdownResponse(details) {
|
|
|
61
44
|
log.debug("[agent-route]", "md-response", details);
|
|
62
45
|
}
|
|
63
46
|
function normalizeArtifactPath(parts) {
|
|
64
|
-
|
|
65
|
-
if (parts.some((part) => part === ".." || part.includes("\0"))) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
return `/${parts.join("/")}`.replace(/\/+/g, "/");
|
|
47
|
+
return parts?.length ? parts.some((part) => part === ".." || part.includes("\0")) ? null : `/${parts.join("/")}`.replace(/\/+/g, "/") : "/index.md";
|
|
69
48
|
}
|
|
70
49
|
function findArtifactKey(artifacts, artifactPath) {
|
|
71
50
|
if (artifacts[artifactPath]) return artifactPath;
|
|
72
|
-
|
|
51
|
+
let suffixedPath = artifactPath.endsWith(".md") ? artifactPath : `${artifactPath}.md`;
|
|
73
52
|
if (artifacts[suffixedPath]) return suffixedPath;
|
|
74
|
-
return void 0;
|
|
75
53
|
}
|
|
76
54
|
function findArtifact(artifacts, artifactPath) {
|
|
77
55
|
return artifacts[artifactPath] ?? artifacts[artifactPath.endsWith(".md") ? artifactPath : `${artifactPath}.md`];
|
|
@@ -85,68 +63,62 @@ function markdownHeaders(artifact) {
|
|
|
85
63
|
};
|
|
86
64
|
}
|
|
87
65
|
function markdown404Body(discoveryLinks) {
|
|
88
|
-
const links = [
|
|
89
|
-
discoveryLinks.home ? `> Home: ${discoveryLinks.home}` : void 0,
|
|
90
|
-
discoveryLinks.sitemap ? `> Sitemap: ${discoveryLinks.sitemap}` : void 0,
|
|
91
|
-
discoveryLinks.llms ? `> LLMS index: ${discoveryLinks.llms}` : void 0
|
|
92
|
-
].filter((line) => Boolean(line));
|
|
93
66
|
return [
|
|
94
67
|
"# Not found",
|
|
95
68
|
"",
|
|
96
|
-
...
|
|
69
|
+
...[
|
|
70
|
+
discoveryLinks.home ? `> Home: ${discoveryLinks.home}` : void 0,
|
|
71
|
+
discoveryLinks.sitemap ? `> Sitemap: ${discoveryLinks.sitemap}` : void 0,
|
|
72
|
+
discoveryLinks.llms ? `> LLMS index: ${discoveryLinks.llms}` : void 0
|
|
73
|
+
].filter((line) => !!line),
|
|
97
74
|
"",
|
|
98
75
|
"The requested Markdown page was not found.",
|
|
99
76
|
""
|
|
100
|
-
].join(
|
|
77
|
+
].join(`
|
|
78
|
+
`);
|
|
101
79
|
}
|
|
102
80
|
function notFoundResponse(method, discoveryLinks, artifactPath, reason) {
|
|
103
|
-
debugMarkdownResponse({
|
|
81
|
+
return debugMarkdownResponse({
|
|
104
82
|
artifactPath,
|
|
105
83
|
method,
|
|
106
84
|
reason,
|
|
107
85
|
status: 404
|
|
108
|
-
})
|
|
109
|
-
return createCachedTextResponse({
|
|
86
|
+
}), createCachedTextResponse({
|
|
110
87
|
body: markdown404Body(discoveryLinks),
|
|
111
88
|
cachePolicy: "short",
|
|
112
89
|
contentType: "text/markdown; charset=utf-8",
|
|
113
90
|
method,
|
|
114
|
-
noindex:
|
|
91
|
+
noindex: !0,
|
|
115
92
|
status: 404
|
|
116
93
|
});
|
|
117
94
|
}
|
|
118
95
|
async function markdownResponse(artifacts, discoveryLinks, method, context) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (!artifactPath) {
|
|
96
|
+
let params = await Promise.resolve(context.params), artifactPath = normalizeArtifactPath(params?.path);
|
|
97
|
+
if (!artifactPath)
|
|
122
98
|
return notFoundResponse(method, discoveryLinks, void 0, "invalid-path");
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!artifactKey) {
|
|
99
|
+
let artifactKey = findArtifactKey(artifacts.index, artifactPath);
|
|
100
|
+
if (!artifactKey)
|
|
126
101
|
return notFoundResponse(
|
|
127
102
|
method,
|
|
128
103
|
discoveryLinks,
|
|
129
104
|
artifactPath,
|
|
130
105
|
"missing-index"
|
|
131
106
|
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!artifact) {
|
|
107
|
+
let artifact = await artifacts.loadArtifact(artifactKey);
|
|
108
|
+
if (!artifact)
|
|
135
109
|
return notFoundResponse(
|
|
136
110
|
method,
|
|
137
111
|
discoveryLinks,
|
|
138
112
|
artifactPath,
|
|
139
113
|
"missing-shard"
|
|
140
114
|
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
debugMarkdownResponse({
|
|
115
|
+
let { contentType, headers } = markdownHeaders(artifact);
|
|
116
|
+
return debugMarkdownResponse({
|
|
144
117
|
artifactPath: artifact.markdownPath,
|
|
145
118
|
contentType,
|
|
146
119
|
method,
|
|
147
120
|
status: 200
|
|
148
|
-
})
|
|
149
|
-
return createCachedTextResponse({
|
|
121
|
+
}), createCachedTextResponse({
|
|
150
122
|
body: artifact.body,
|
|
151
123
|
contentType,
|
|
152
124
|
headers,
|
|
@@ -155,17 +127,16 @@ async function markdownResponse(artifacts, discoveryLinks, method, context) {
|
|
|
155
127
|
});
|
|
156
128
|
}
|
|
157
129
|
function createMarkdownRouteHandlers(artifacts, options = {}) {
|
|
158
|
-
|
|
130
|
+
let discoveryLinks = {
|
|
159
131
|
...DEFAULT_DISCOVERY_LINKS,
|
|
160
132
|
...options.discoveryLinks
|
|
161
133
|
};
|
|
162
|
-
const generateStaticParams = () => Object.keys(artifacts.index).map((artifactPath) => ({
|
|
163
|
-
path: artifactPath.replace(/^\//, "").replace(/\.md$/, "").split("/")
|
|
164
|
-
}));
|
|
165
134
|
return {
|
|
166
135
|
GET: (_request, context) => markdownResponse(artifacts, discoveryLinks, "GET", context),
|
|
167
136
|
HEAD: (_request, context) => markdownResponse(artifacts, discoveryLinks, "HEAD", context),
|
|
168
|
-
generateStaticParams
|
|
137
|
+
generateStaticParams: () => Object.keys(artifacts.index).map((artifactPath) => ({
|
|
138
|
+
path: artifactPath.replace(/^\//, "").replace(/\.md$/, "").split("/")
|
|
139
|
+
}))
|
|
169
140
|
};
|
|
170
141
|
}
|
|
171
142
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { ManifestLike, LayoutProps } from '../../../types.js';
|
|
3
|
+
import { M as ManifestLike, L as LayoutProps } from '../../../types-CIwwieNw.js';
|
|
4
4
|
|
|
5
5
|
type LayoutComponent = (props: LayoutProps) => ReactElement | Promise<ReactElement>;
|
|
6
6
|
type GroupLayoutConfig = {
|
|
@@ -1,65 +1,13 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/route-layout-group.tsx
|
|
2
|
+
import { tags } from "@publish.os/nextjs/cache/tags";
|
|
3
|
+
import { resolveGroupLayout } from "@publish.os/nextjs/resolvers/manifest-resolver";
|
|
2
4
|
import { cacheLife, cacheTag } from "next/cache";
|
|
3
5
|
import { notFound } from "next/navigation";
|
|
4
6
|
|
|
5
|
-
// src/
|
|
6
|
-
|
|
7
|
-
var MAX_TAG_LEN = 256;
|
|
8
|
-
var MAX_SEGMENT_LEN = 80;
|
|
9
|
-
var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
|
|
10
|
-
function sha256(value) {
|
|
11
|
-
return createHash("sha256").update(value).digest("hex").slice(0, 16);
|
|
12
|
-
}
|
|
13
|
-
function safeSegment(value) {
|
|
14
|
-
const raw = value.trim().toLowerCase() || "root";
|
|
15
|
-
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
16
|
-
const segment = normalized || "root";
|
|
17
|
-
if (segment.length <= MAX_SEGMENT_LEN) return segment;
|
|
18
|
-
return `${segment.slice(0, 48)}.${sha256(segment)}`;
|
|
19
|
-
}
|
|
20
|
-
function assertTag(tag) {
|
|
21
|
-
if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
|
|
22
|
-
return `tag:${sha256(tag)}`;
|
|
23
|
-
}
|
|
24
|
-
return tag;
|
|
25
|
-
}
|
|
26
|
-
var tags = {
|
|
27
|
-
site() {
|
|
28
|
-
return "site";
|
|
29
|
-
},
|
|
30
|
-
pages() {
|
|
31
|
-
return "pages";
|
|
32
|
-
},
|
|
33
|
-
group(group) {
|
|
34
|
-
return assertTag(`group:${safeSegment(group)}`);
|
|
35
|
-
},
|
|
36
|
-
page(group, slug) {
|
|
37
|
-
const path = Array.isArray(slug) ? slug.join("/") : slug;
|
|
38
|
-
return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
|
|
39
|
-
},
|
|
40
|
-
manifest(contentHash) {
|
|
41
|
-
return assertTag(`manifest:${safeSegment(contentHash)}`);
|
|
42
|
-
},
|
|
43
|
-
sitemap() {
|
|
44
|
-
return "sitemap";
|
|
45
|
-
},
|
|
46
|
-
robots() {
|
|
47
|
-
return "robots";
|
|
48
|
-
},
|
|
49
|
-
llms(scope = "root") {
|
|
50
|
-
return assertTag(`llms:${safeSegment(scope)}`);
|
|
51
|
-
},
|
|
52
|
-
feed(format, scope = "site") {
|
|
53
|
-
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/internal/utils/logger.ts
|
|
58
|
-
var isDev = process.env.NODE_ENV !== "production";
|
|
59
|
-
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
60
|
-
var log = {
|
|
7
|
+
// src/lib/runtime/logging/logger.ts
|
|
8
|
+
var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1", log = {
|
|
61
9
|
debug(...args) {
|
|
62
|
-
|
|
10
|
+
isDev && isDebugEnabled && console.debug("[publish.os:debug]", ...args);
|
|
63
11
|
},
|
|
64
12
|
info(...args) {
|
|
65
13
|
console.log("[publish.os]", ...args);
|
|
@@ -72,65 +20,30 @@ var log = {
|
|
|
72
20
|
}
|
|
73
21
|
};
|
|
74
22
|
|
|
75
|
-
// src/
|
|
76
|
-
function groupNode(group) {
|
|
77
|
-
return {
|
|
78
|
-
type: "section",
|
|
79
|
-
id: group.key,
|
|
80
|
-
title: group.title,
|
|
81
|
-
path: group.path,
|
|
82
|
-
group: group.key,
|
|
83
|
-
children: group.tree
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function resolveGroup(manifest, group) {
|
|
87
|
-
const groupData = manifest.groups[group];
|
|
88
|
-
if (!groupData) return null;
|
|
89
|
-
return {
|
|
90
|
-
site: manifest.site,
|
|
91
|
-
tree: groupData.tree,
|
|
92
|
-
node: groupNode(groupData),
|
|
93
|
-
currentPath: groupData.path,
|
|
94
|
-
group
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function resolveGroupLayout(manifest, group, children) {
|
|
98
|
-
const resolved = resolveGroup(manifest, group);
|
|
99
|
-
if (!resolved) return null;
|
|
100
|
-
return { ...resolved, children };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// src/kernel/routes/layouts/group.tsx
|
|
23
|
+
// src/route-layout-group.tsx
|
|
104
24
|
import { jsx } from "react/jsx-runtime";
|
|
105
|
-
var manifests = /* @__PURE__ */ new Map();
|
|
106
|
-
var layoutChains = /* @__PURE__ */ new Map();
|
|
25
|
+
var manifests = /* @__PURE__ */ new Map(), layoutChains = /* @__PURE__ */ new Map();
|
|
107
26
|
async function CachedGroupLayoutData({
|
|
108
27
|
routeGroup,
|
|
109
28
|
layoutGroup
|
|
110
29
|
}) {
|
|
111
30
|
"use cache";
|
|
112
|
-
cacheLife("page");
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
log.debug("[cache]", `${routeGroup}/layout:${layoutGroup}`);
|
|
118
|
-
const resolved = resolveGroupLayout(manifest, layoutGroup, null);
|
|
119
|
-
if (!resolved) notFound();
|
|
120
|
-
return resolved;
|
|
31
|
+
cacheLife("page"), cacheTag(tags.site(), tags.group(layoutGroup));
|
|
32
|
+
let manifest = manifests.get(routeGroup);
|
|
33
|
+
manifest || notFound(), cacheTag(tags.manifest(manifest.contentHash)), log.debug("[cache]", `${routeGroup}/layout:${layoutGroup}`);
|
|
34
|
+
let resolved = resolveGroupLayout(manifest, layoutGroup, null);
|
|
35
|
+
return resolved || notFound(), resolved;
|
|
121
36
|
}
|
|
122
37
|
function createGroupLayout({
|
|
123
38
|
group,
|
|
124
39
|
manifest,
|
|
125
40
|
layouts
|
|
126
41
|
}) {
|
|
127
|
-
manifests.set(group, manifest)
|
|
128
|
-
layoutChains.set(group, layouts);
|
|
129
|
-
return async function GroupLayout({ children }) {
|
|
42
|
+
return manifests.set(group, manifest), layoutChains.set(group, layouts), async function({ children }) {
|
|
130
43
|
log.debug("[render]", `${group}/layout`);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
44
|
+
let chain = layoutChains.get(group);
|
|
45
|
+
chain?.length || notFound();
|
|
46
|
+
let resolvedLayouts = await Promise.all(
|
|
134
47
|
chain.map(async (item) => ({
|
|
135
48
|
item,
|
|
136
49
|
props: await CachedGroupLayoutData({
|
|
@@ -138,13 +51,11 @@ function createGroupLayout({
|
|
|
138
51
|
routeGroup: group
|
|
139
52
|
})
|
|
140
53
|
}))
|
|
141
|
-
);
|
|
142
|
-
let output = children;
|
|
54
|
+
), output = children;
|
|
143
55
|
for (let index = resolvedLayouts.length - 1; index >= 0; index -= 1) {
|
|
144
|
-
|
|
56
|
+
let resolvedLayout = resolvedLayouts[index];
|
|
145
57
|
if (resolvedLayout) {
|
|
146
|
-
|
|
147
|
-
const fontClassName = resolvedLayout.item.fontClassName;
|
|
58
|
+
let Layout = resolvedLayout.item.Layout, fontClassName = resolvedLayout.item.fontClassName;
|
|
148
59
|
output = /* @__PURE__ */ jsx(Layout, { ...resolvedLayout.props, children: fontClassName ? /* @__PURE__ */ jsx("div", { className: fontClassName, children: output }) : output });
|
|
149
60
|
}
|
|
150
61
|
}
|