@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler-assets/nextjs/defaults/group/layout.tsx +1 -5
- package/compiler-assets/nextjs/defaults/group/page.tsx +31 -22
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +19 -10
- 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/shims/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +2 -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 +126 -60
- 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-5QMLXF7N.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-BdCScEKi.d.ts} +3 -3
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -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-EFO6AWXN.js +19 -0
- package/dist/{chunk-726GV2NF.js → chunk-F3AGNDF4.js} +100 -67
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-ORIUWJBQ.js} +8 -6
- package/dist/{chunk-H6XILMZX.js → chunk-OXOFRXEI.js} +1806 -831
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +90 -21
- 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 +17 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-OSHHWRWK.js} +121 -81
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +40 -1
- 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 +383 -142
- 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 +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -2
- package/dist/kernel/components/blocks/navbar.js +17 -17
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.js +1 -1
- package/dist/kernel/components/blocks/page-list.js +2 -2
- package/dist/kernel/components/blocks/search.d.ts +1 -1
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.js +1 -1
- package/dist/kernel/components/blocks/sidebar.js +7 -4
- package/dist/kernel/components/blocks/theme-toggle.d.ts +1 -1
- 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 +19 -1
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- 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 +1 -1
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +21 -16
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +3 -3
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- 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 +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- 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 +20 -10
- package/dist/kernel/components/mdx/mdx.js +231 -34
- 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.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -2
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +1 -1
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +56 -4
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- 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 +1 -1
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +8 -2
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.js +1 -1
- 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 +1 -1
- 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 +2 -15
- package/dist/kernel/defaults.registry.js +2 -17
- package/dist/kernel/routes/agent/markdown.d.ts +3 -0
- 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 +109 -83
- package/dist/kernel/routes/metadata/llms.d.ts +11 -3
- package/dist/kernel/routes/metadata/llms.js +154 -57
- 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/sitemap.d.ts +22 -3
- package/dist/kernel/routes/metadata/sitemap.js +183 -43
- 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 +1 -1
- package/dist/kernel/routes/pages/leaf.d.ts +30 -3
- package/dist/kernel/routes/pages/leaf.js +5 -4
- package/dist/kernel/routes/pages/root.d.ts +2 -2
- package/dist/kernel/routes/pages/root.js +1 -1
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.js +7 -9
- package/dist/theme-scope.js +1 -1
- package/dist/{types-BzkZty3r.d.ts → types-J2w_puPF.d.ts} +1 -20
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +1 -0
- 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/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 +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +6 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +11 -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 +45 -20
- package/release/app/phosphor/package.json +3 -3
- package/release/app/phosphor/pnpm-lock.yaml.template +88 -75
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +118 -74
- 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/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
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withCheckoutPreparation
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
approveLocalComposition
|
|
6
|
-
} from "./chunk-SVYGXXYR.js";
|
|
7
|
-
import {
|
|
8
|
-
withLocalOperation
|
|
9
|
-
} from "./chunk-B2V22WRT.js";
|
|
3
|
+
} from "./chunk-6C65KV7O.js";
|
|
10
4
|
import {
|
|
11
5
|
LocalProcessError,
|
|
6
|
+
approveLocalComposition,
|
|
12
7
|
installLocalApp,
|
|
13
8
|
localProcessEnvironment,
|
|
14
9
|
startLocalProcess
|
|
15
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4BC2L2KA.js";
|
|
11
|
+
import {
|
|
12
|
+
withLocalOperation
|
|
13
|
+
} from "./chunk-IL4RJOKI.js";
|
|
16
14
|
import {
|
|
17
15
|
assertGeneratedOutput,
|
|
18
16
|
assertLocalDirectory,
|
|
19
17
|
assertOperationOutput,
|
|
20
18
|
prepareGeneratedOutputUpdate
|
|
21
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-6D2E6UMD.js";
|
|
22
20
|
import {
|
|
23
21
|
assertFrameworkSelection
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-NNBJZPFM.js";
|
|
23
|
+
import "./chunk-7NY22B5U.js";
|
|
24
|
+
import {
|
|
25
|
+
PUBLIC_SEARCH_DIRECTORY
|
|
26
|
+
} from "./chunk-EFO6AWXN.js";
|
|
26
27
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from "./chunk-
|
|
28
|
+
isExcludedSourcePath,
|
|
29
|
+
isOsMetadataPath
|
|
30
|
+
} from "./chunk-WL75GQ5M.js";
|
|
30
31
|
import "./chunk-AI2UULNX.js";
|
|
31
32
|
import {
|
|
32
|
-
AppError,
|
|
33
33
|
readInstalledFramework
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-5J3YUNRY.js";
|
|
35
|
+
import {
|
|
36
|
+
AppError
|
|
37
|
+
} from "./chunk-22RSSUNV.js";
|
|
35
38
|
|
|
36
39
|
// src/lib/compiler/lifecycle/dev-operation.ts
|
|
37
40
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -41,23 +44,47 @@ import { join as join5 } from "path";
|
|
|
41
44
|
import { setTimeout as delay } from "timers/promises";
|
|
42
45
|
import { stripVTControlCharacters } from "util";
|
|
43
46
|
|
|
47
|
+
// src/lib/compiler/lifecycle/change-scheduler.ts
|
|
48
|
+
function createChangeScheduler({
|
|
49
|
+
onChange,
|
|
50
|
+
onReady,
|
|
51
|
+
delayMs = 100
|
|
52
|
+
}) {
|
|
53
|
+
let timer;
|
|
54
|
+
return {
|
|
55
|
+
notify() {
|
|
56
|
+
onChange(), timer && clearTimeout(timer), timer = setTimeout(() => {
|
|
57
|
+
timer = void 0, onReady();
|
|
58
|
+
}, delayMs);
|
|
59
|
+
},
|
|
60
|
+
stop() {
|
|
61
|
+
timer && clearTimeout(timer), timer = void 0;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
44
66
|
// src/lib/compiler/lifecycle/checkout-development.ts
|
|
45
67
|
import { createHash as createHash2 } from "crypto";
|
|
46
68
|
import { mkdtemp, readFile as readFile2, rm, stat, writeFile } from "fs/promises";
|
|
47
69
|
import { createRequire } from "module";
|
|
48
70
|
import { dirname, isAbsolute, join as join2 } from "path";
|
|
71
|
+
import { pathToFileURL } from "url";
|
|
49
72
|
|
|
50
73
|
// src/lib/compiler/lifecycle/source-watch.ts
|
|
51
74
|
import { createHash } from "crypto";
|
|
52
75
|
import { watch } from "fs";
|
|
53
76
|
import { lstat, readdir, readFile } from "fs/promises";
|
|
54
77
|
import { join, relative } from "path";
|
|
78
|
+
import { setImmediate } from "timers/promises";
|
|
55
79
|
function ignored(sourceRoot, path, include) {
|
|
56
80
|
let name = relative(sourceRoot, path).replace(/\\/g, "/");
|
|
57
|
-
return (include ? !include(name) : isExcludedSourcePath(name)) || name.split("/").length === 1 && name.startsWith(".env") || name.split("/").some(
|
|
81
|
+
return isOsMetadataPath(name) || (include ? !include(name) : isExcludedSourcePath(name)) || name.split("/").length === 1 && name.startsWith(".env") || name.split("/").some(
|
|
58
82
|
(segment) => ["node_modules", ".next", ".cache", ".turbo", ".git"].includes(segment)
|
|
59
83
|
);
|
|
60
84
|
}
|
|
85
|
+
function usesRecursiveSourceWatch(platform) {
|
|
86
|
+
return platform === "darwin";
|
|
87
|
+
}
|
|
61
88
|
function changesBetween(before, after) {
|
|
62
89
|
return [.../* @__PURE__ */ new Set([...before.keys(), ...after.keys()])].sort().flatMap((path) => {
|
|
63
90
|
let previous = before.get(path), current = after.get(path);
|
|
@@ -70,17 +97,24 @@ function changesBetween(before, after) {
|
|
|
70
97
|
});
|
|
71
98
|
}
|
|
72
99
|
async function watchSource(options) {
|
|
73
|
-
let watchers = /* @__PURE__ */ new Map(), closed = !1, scan = Promise.resolve(), baseline = /* @__PURE__ */ new Map(),
|
|
100
|
+
let watchers = /* @__PURE__ */ new Map(), recursiveRootWatch = usesRecursiveSourceWatch(process.platform), closed = !1, scan = Promise.resolve(), rescanning = !1, baseline = /* @__PURE__ */ new Map(), closeWatchers = async () => {
|
|
101
|
+
let entries = [...watchers.values()];
|
|
102
|
+
watchers.clear();
|
|
103
|
+
for (let { watcher } of entries)
|
|
104
|
+
await setImmediate(), watcher.close();
|
|
105
|
+
}, scanNow = async () => {
|
|
74
106
|
let visited = /* @__PURE__ */ new Set(), identity = /* @__PURE__ */ new Map();
|
|
75
107
|
await visit(options.sourceRoot, visited, identity);
|
|
76
108
|
for (let [path, entry] of watchers)
|
|
77
109
|
visited.has(path) || (entry.watcher.close(), watchers.delete(path));
|
|
78
110
|
return identity;
|
|
79
|
-
}, rescan = () => (scan = scan.then(async () => {
|
|
111
|
+
}, rescan = () => (closed || rescanning || (rescanning = !0, scan = scan.then(async () => {
|
|
80
112
|
if (closed) return;
|
|
81
113
|
let identity = await scanNow();
|
|
82
|
-
changesBetween(baseline, identity).length > 0 && options.onChange();
|
|
83
|
-
}).catch(options.onError)
|
|
114
|
+
!closed && changesBetween(baseline, identity).length > 0 && options.onChange();
|
|
115
|
+
}).catch(options.onError).finally(() => {
|
|
116
|
+
rescanning = !1;
|
|
117
|
+
})), scan), visit = async (directory, visited, identity) => {
|
|
84
118
|
if (closed || ignored(options.sourceRoot, directory, options.include))
|
|
85
119
|
return;
|
|
86
120
|
let entry = await lstat(directory, { bigint: !0 }).catch(
|
|
@@ -104,15 +138,16 @@ async function watchSource(options) {
|
|
|
104
138
|
return;
|
|
105
139
|
}
|
|
106
140
|
visited.add(directory);
|
|
107
|
-
let previous = watchers.get(directory);
|
|
108
|
-
if (previous && (previous.dev !== entry.dev || previous.ino !== entry.ino) && (previous.watcher.close(), watchers.delete(directory)), !watchers.has(directory)) {
|
|
109
|
-
let
|
|
110
|
-
|
|
141
|
+
let watchDirectory = !recursiveRootWatch || directory === options.sourceRoot, previous = watchDirectory ? watchers.get(directory) : void 0;
|
|
142
|
+
if (previous && (previous.dev !== entry.dev || previous.ino !== entry.ino) && (previous.watcher.close(), watchers.delete(directory)), watchDirectory && !watchers.has(directory)) {
|
|
143
|
+
let onEvent = (_event, filename) => {
|
|
144
|
+
let relativeFilename = typeof filename == "string" ? filename : Buffer.isBuffer(filename) ? filename.toString("utf8") : void 0;
|
|
145
|
+
closed || relativeFilename && ignored(
|
|
111
146
|
options.sourceRoot,
|
|
112
|
-
join(directory,
|
|
147
|
+
join(directory, relativeFilename),
|
|
113
148
|
options.include
|
|
114
149
|
) || rescan();
|
|
115
|
-
});
|
|
150
|
+
}, watcher = recursiveRootWatch ? watch(directory, { recursive: !0 }, onEvent) : watch(directory, onEvent);
|
|
116
151
|
watcher.on("error", (error) => {
|
|
117
152
|
closed || options.onError(error);
|
|
118
153
|
}), watchers.set(directory, { watcher, dev: entry.dev, ino: entry.ino });
|
|
@@ -131,11 +166,12 @@ async function watchSource(options) {
|
|
|
131
166
|
baseline = identity;
|
|
132
167
|
}), await scan;
|
|
133
168
|
} catch (error) {
|
|
134
|
-
closed = !0;
|
|
135
|
-
for (let { watcher } of watchers.values()) watcher.close();
|
|
136
|
-
throw error;
|
|
169
|
+
throw closed = !0, await closeWatchers(), error;
|
|
137
170
|
}
|
|
138
|
-
|
|
171
|
+
let reconciliation = setInterval(() => {
|
|
172
|
+
rescan();
|
|
173
|
+
}, 2e3);
|
|
174
|
+
return reconciliation.unref(), {
|
|
139
175
|
reconcileStartup: rescan,
|
|
140
176
|
revision: async () => {
|
|
141
177
|
if (await scan, closed) return;
|
|
@@ -159,9 +195,7 @@ async function watchSource(options) {
|
|
|
159
195
|
return baseline = current, changes;
|
|
160
196
|
},
|
|
161
197
|
stop: async () => {
|
|
162
|
-
closed = !0;
|
|
163
|
-
for (let { watcher } of watchers.values()) watcher.close();
|
|
164
|
-
watchers.clear(), await scan;
|
|
198
|
+
closed = !0, clearInterval(reconciliation), await closeWatchers(), await scan;
|
|
165
199
|
}
|
|
166
200
|
};
|
|
167
201
|
}
|
|
@@ -295,8 +329,7 @@ async function prepareCheckoutDependencies(options) {
|
|
|
295
329
|
"@publish.os/nextjs...",
|
|
296
330
|
"install",
|
|
297
331
|
"--frozen-lockfile",
|
|
298
|
-
"--prefer-offline"
|
|
299
|
-
"--fetch-timeout=10000"
|
|
332
|
+
"--prefer-offline"
|
|
300
333
|
],
|
|
301
334
|
cwd: options.workspaceRoot ?? options.packageRoot,
|
|
302
335
|
environment: {
|
|
@@ -305,7 +338,7 @@ async function prepareCheckoutDependencies(options) {
|
|
|
305
338
|
},
|
|
306
339
|
signal: AbortSignal.any([
|
|
307
340
|
options.lifetime.signal,
|
|
308
|
-
AbortSignal.timeout(
|
|
341
|
+
AbortSignal.timeout(3e5)
|
|
309
342
|
]),
|
|
310
343
|
onShutdown: options.lifetime.onShutdown,
|
|
311
344
|
quiet: !0
|
|
@@ -328,7 +361,7 @@ async function runCheckoutCompiler(options) {
|
|
|
328
361
|
});
|
|
329
362
|
let temporary = await mkdtemp(
|
|
330
363
|
join2(dirname(options.request.paths.output), "compiler-")
|
|
331
|
-
), identity = await assertLocalDirectory(temporary), requestPath = join2(temporary, "request.json"), resultPath = join2(temporary, "result.json"),
|
|
364
|
+
), identity = await assertLocalDirectory(temporary), requestPath = join2(temporary, "request.json"), resultPath = join2(temporary, "result.json"), retain = !1;
|
|
332
365
|
try {
|
|
333
366
|
await writeFile(requestPath, JSON.stringify(options.request), {
|
|
334
367
|
flag: "wx",
|
|
@@ -337,9 +370,11 @@ async function runCheckoutCompiler(options) {
|
|
|
337
370
|
command: process.execPath,
|
|
338
371
|
args: [
|
|
339
372
|
"--import",
|
|
340
|
-
|
|
341
|
-
"
|
|
342
|
-
|
|
373
|
+
pathToFileURL(
|
|
374
|
+
createRequire(join2(selection.packageRoot, "package.json")).resolve(
|
|
375
|
+
"tsx/esm"
|
|
376
|
+
)
|
|
377
|
+
).href,
|
|
343
378
|
join2(
|
|
344
379
|
selection.packageRoot,
|
|
345
380
|
"src/lib/compiler/lifecycle/checkout-compiler-worker.ts"
|
|
@@ -374,6 +409,15 @@ async function runCheckoutCompiler(options) {
|
|
|
374
409
|
}
|
|
375
410
|
}
|
|
376
411
|
|
|
412
|
+
// src/lib/compiler/lifecycle/checkout-watch-shutdown.ts
|
|
413
|
+
async function startCheckoutWatchForOperation({
|
|
414
|
+
lifetime,
|
|
415
|
+
watch: watch2
|
|
416
|
+
}) {
|
|
417
|
+
let checkoutWatch = await watch2();
|
|
418
|
+
return lifetime.onShutdown(() => checkoutWatch.stop()), checkoutWatch;
|
|
419
|
+
}
|
|
420
|
+
|
|
377
421
|
// src/lib/compiler/lifecycle/preview-cache.ts
|
|
378
422
|
import { createHash as createHash3 } from "crypto";
|
|
379
423
|
import {
|
|
@@ -443,7 +487,7 @@ async function reusablePreview(options) {
|
|
|
443
487
|
let current = cache.revision === options.revision && cache.frameworkIdentity === options.frameworkIdentity && cache.compilerRevision === options.compilerRevision && cache.checkoutDependencyRevision === options.checkoutDependencyRevision && cache.url === options.url;
|
|
444
488
|
return !current && options.inputKind !== "checkout" || options.inputKind === "checkout" && (!options.checkoutRoot || await realpath(
|
|
445
489
|
join3(options.outputDir, "node_modules/@publish.os/nextjs")
|
|
446
|
-
) !== await realpath(options.checkoutRoot)) ||
|
|
490
|
+
) !== await realpath(options.checkoutRoot)) || cache.integrity !== await outputIntegrity(options) ? void 0 : {
|
|
447
491
|
current,
|
|
448
492
|
dependenciesChanged: cache.checkoutDependencyRevision !== options.checkoutDependencyRevision
|
|
449
493
|
};
|
|
@@ -490,7 +534,7 @@ var PRESERVED_PREVIEW_ENTRIES = /* @__PURE__ */ new Set([
|
|
|
490
534
|
".next",
|
|
491
535
|
".operation-owner.json",
|
|
492
536
|
".preview-cache.json",
|
|
493
|
-
|
|
537
|
+
PUBLIC_SEARCH_DIRECTORY
|
|
494
538
|
]);
|
|
495
539
|
async function refreshPreview(options) {
|
|
496
540
|
let sync = async (source, target) => {
|
|
@@ -670,7 +714,7 @@ async function runDevelopment(options) {
|
|
|
670
714
|
scope,
|
|
671
715
|
signal: options.signal ? AbortSignal.any([options.signal, sessionCancellation.signal]) : sessionCancellation.signal,
|
|
672
716
|
run: async (lifetime) => {
|
|
673
|
-
let localOptions = { ...options, signal: lifetime.signal }, stopped = !1, dirty = !1, refreshing, startupReconciliation,
|
|
717
|
+
let localOptions = { ...options, signal: lifetime.signal }, stopped = !1, dirty = !1, refreshing, startupReconciliation, ready = !1, checkoutWatch, checkoutDependenciesDirty = !1, rejectSession = () => {
|
|
674
718
|
}, failed = new Promise((_resolve, reject) => {
|
|
675
719
|
rejectSession = reject;
|
|
676
720
|
});
|
|
@@ -678,12 +722,15 @@ async function runDevelopment(options) {
|
|
|
678
722
|
});
|
|
679
723
|
let abortSession = () => rejectSession(lifetime.signal.reason);
|
|
680
724
|
lifetime.signal.addEventListener("abort", abortSession, { once: !0 });
|
|
681
|
-
let
|
|
725
|
+
let changeScheduler = createChangeScheduler({
|
|
682
726
|
onChange: () => {
|
|
683
|
-
dirty = !0
|
|
684
|
-
ready && drain();
|
|
685
|
-
}, 100);
|
|
727
|
+
dirty = !0;
|
|
686
728
|
},
|
|
729
|
+
onReady: () => {
|
|
730
|
+
ready && drain();
|
|
731
|
+
}
|
|
732
|
+
}), watchOptions = {
|
|
733
|
+
onChange: changeScheduler.notify,
|
|
687
734
|
onError: (cause) => {
|
|
688
735
|
let error = new AppError({
|
|
689
736
|
code: "FRAMEWORK_PREVIEW_WATCH_FAILED",
|
|
@@ -695,15 +742,20 @@ async function runDevelopment(options) {
|
|
|
695
742
|
...watchOptions,
|
|
696
743
|
sourceRoot: lifetime.sourceRoot
|
|
697
744
|
});
|
|
698
|
-
lifetime.onShutdown(async () => {
|
|
699
|
-
stopped = !0,
|
|
700
|
-
}), options.request.context?.framework?.kind === "checkout"
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
745
|
+
if (lifetime.onShutdown(async () => {
|
|
746
|
+
stopped = !0, changeScheduler.stop(), await sourceWatch.stop(), await startupReconciliation, await refreshing;
|
|
747
|
+
}), options.request.context?.framework?.kind === "checkout") {
|
|
748
|
+
let packageRoot = options.request.context.framework.packageRoot;
|
|
749
|
+
checkoutWatch = await startCheckoutWatchForOperation({
|
|
750
|
+
lifetime,
|
|
751
|
+
watch: () => watchCheckout({
|
|
752
|
+
...watchOptions,
|
|
753
|
+
packageRoot
|
|
754
|
+
})
|
|
755
|
+
});
|
|
756
|
+
}
|
|
704
757
|
let initialRevision = await sourceWatch.revision(), initialCompilerRevision = await checkoutWatch?.revision(), initialDependencyRevision = await checkoutWatch?.dependencyRevision(), initialConfig = await readSourceSelection(lifetime.sourceRoot) ?? {}, reuse = await reusablePreview({
|
|
705
758
|
outputDir: lifetime.outputDir,
|
|
706
|
-
sourceRoot: lifetime.sourceRoot,
|
|
707
759
|
revision: initialRevision,
|
|
708
760
|
runtime: options.request.context?.framework ? `${framework.packageName}@${framework.version}` : initialConfig.runtime ?? "",
|
|
709
761
|
frameworkIdentity,
|
|
@@ -712,11 +764,10 @@ async function runDevelopment(options) {
|
|
|
712
764
|
inputKind,
|
|
713
765
|
url,
|
|
714
766
|
sourcePath: options.request.context?.sourcePath ?? "publish.os",
|
|
715
|
-
ide: !!options.request.context?.ide,
|
|
716
767
|
checkoutRoot: options.request.context?.framework?.kind === "checkout" ? options.request.context.framework.packageRoot : void 0
|
|
717
768
|
});
|
|
718
769
|
checkoutDependenciesDirty = reuse?.dependenciesChanged ?? !1;
|
|
719
|
-
let validateSource = async () => (await import("./validate-local-source-
|
|
770
|
+
let validateSource = async () => (await import("./validate-local-source-SV44DBQT.js")).validateLocalSource({
|
|
720
771
|
options: localOptions,
|
|
721
772
|
sourceDir: lifetime.sourceDir,
|
|
722
773
|
sourceRoot: lifetime.sourceRoot
|
|
@@ -732,17 +783,16 @@ async function runDevelopment(options) {
|
|
|
732
783
|
});
|
|
733
784
|
};
|
|
734
785
|
if (options.request.context?.ide) {
|
|
735
|
-
let { prepareIdeSupport } = await import("./ide-support-
|
|
786
|
+
let { prepareIdeSupport } = await import("./ide-support-CU6Z5PVR.js"), ideSource = prepared?.source ?? (await validateSource()).source;
|
|
736
787
|
await prepareIdeSupport({
|
|
788
|
+
frameworkOptions: localOptions,
|
|
737
789
|
publishOsDir: lifetime.sourceRoot,
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
framework: prepared?.framework ?? framework,
|
|
741
|
-
frameworkOptions: localOptions
|
|
790
|
+
source: ideSource,
|
|
791
|
+
framework: prepared?.framework ?? framework
|
|
742
792
|
});
|
|
743
793
|
}
|
|
744
794
|
let compose = async (outputDir, preparedSource) => {
|
|
745
|
-
let { composeFrameworkSource } = await import("./compose-
|
|
795
|
+
let { composeFrameworkSource } = await import("./compose-CVBJRAF6.js");
|
|
746
796
|
await composeFrameworkSource({
|
|
747
797
|
request: {
|
|
748
798
|
...options.request,
|
|
@@ -756,7 +806,13 @@ async function runDevelopment(options) {
|
|
|
756
806
|
},
|
|
757
807
|
source: preparedSource,
|
|
758
808
|
signal: lifetime.signal,
|
|
759
|
-
onProgress: (message) => options.onEvent?.({ type: "progress", message })
|
|
809
|
+
onProgress: (message) => options.onEvent?.({ type: "progress", message }),
|
|
810
|
+
onWarning: (warning) => options.onEvent?.({
|
|
811
|
+
type: "diagnostics",
|
|
812
|
+
diagnostics: {
|
|
813
|
+
diagnostics: [{ ...warning, severity: "warning" }]
|
|
814
|
+
}
|
|
815
|
+
})
|
|
760
816
|
});
|
|
761
817
|
}, search = async (outputDir) => {
|
|
762
818
|
options.onEvent?.({
|
|
@@ -874,7 +930,7 @@ async function runDevelopment(options) {
|
|
|
874
930
|
);
|
|
875
931
|
let revisionBefore = await sourceWatch.revision(), compilerRevisionBefore = await checkoutWatch?.revision(), dependencyRevisionBefore = await checkoutWatch?.dependencyRevision(), inputsCurrent = async () => revisionBefore !== void 0 && revisionBefore === await sourceWatch.revision() && (!checkoutWatch || compilerRevisionBefore !== void 0 && compilerRevisionBefore === await checkoutWatch.revision());
|
|
876
932
|
await assertSelection();
|
|
877
|
-
let validation = checkoutWatch ? void 0 : await (await import("./validate-local-source-
|
|
933
|
+
let validation = checkoutWatch ? void 0 : await (await import("./validate-local-source-SV44DBQT.js")).validateLocalSource({
|
|
878
934
|
options: localOptions,
|
|
879
935
|
sourceDir: lifetime.sourceDir,
|
|
880
936
|
sourceRoot: lifetime.sourceRoot
|
|
@@ -946,22 +1002,6 @@ async function runDevelopment(options) {
|
|
|
946
1002
|
framework,
|
|
947
1003
|
runtime: void 0
|
|
948
1004
|
}) : frameworkIdentity;
|
|
949
|
-
if (checkoutWatch && options.request.context?.ide && JSON.parse(
|
|
950
|
-
await readFile5(
|
|
951
|
-
join5(lifetime.sourceRoot, ".publish.os/ide/metadata.json"),
|
|
952
|
-
"utf8"
|
|
953
|
-
)
|
|
954
|
-
).selection?.integrity !== nextFrameworkIdentity) {
|
|
955
|
-
let ide = await runCheckoutCompiler({
|
|
956
|
-
request: {
|
|
957
|
-
...options.request,
|
|
958
|
-
operation: "validate",
|
|
959
|
-
paths: { source: lifetime.sourceRoot, output: incoming }
|
|
960
|
-
},
|
|
961
|
-
lifetime
|
|
962
|
-
});
|
|
963
|
-
acceptCompilation(ide);
|
|
964
|
-
}
|
|
965
1005
|
if (!await inputsCurrent())
|
|
966
1006
|
return dirty = !0, !1;
|
|
967
1007
|
if (recordGeneratedOutput = await prepareGeneratedOutputUpdate({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertFrameworkSelection,
|
|
3
3
|
readCheckoutTypeScriptConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NNBJZPFM.js";
|
|
5
5
|
import "./chunk-AI2UULNX.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-5J3YUNRY.js";
|
|
7
|
+
import "./chunk-22RSSUNV.js";
|
|
7
8
|
export {
|
|
8
9
|
assertFrameworkSelection,
|
|
9
10
|
readCheckoutTypeScriptConfig
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prepareIdeSupport
|
|
3
|
+
} from "./chunk-GBPLER5H.js";
|
|
4
|
+
import "./chunk-6D2E6UMD.js";
|
|
5
|
+
import "./chunk-OXOFRXEI.js";
|
|
6
|
+
import "./chunk-NNBJZPFM.js";
|
|
7
|
+
import "./chunk-UYGCOWRF.js";
|
|
8
|
+
import "./chunk-EFO6AWXN.js";
|
|
9
|
+
import "./chunk-5KAD7W53.js";
|
|
10
|
+
import "./chunk-WL75GQ5M.js";
|
|
11
|
+
import "./chunk-AI2UULNX.js";
|
|
12
|
+
import "./chunk-5J3YUNRY.js";
|
|
13
|
+
import "./chunk-22RSSUNV.js";
|
|
14
|
+
export {
|
|
15
|
+
prepareIdeSupport
|
|
16
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ type PageProps<TMeta extends Record<string, unknown> = Record<string, unknown>>
|
|
|
153
153
|
tree: TreeNode[];
|
|
154
154
|
node: TreeNode;
|
|
155
155
|
page: PageData<TMeta>;
|
|
156
|
+
markdownRevision?: string;
|
|
156
157
|
currentPath: string;
|
|
157
158
|
group: string;
|
|
158
159
|
};
|
|
@@ -195,6 +196,32 @@ declare function createRssFeedRoute(manifest: ManifestLike, options?: FeedRouteO
|
|
|
195
196
|
declare function createAtomFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
196
197
|
declare function createJsonFeedRoute(manifest: ManifestLike, options?: FeedRouteOptions): () => Promise<Response>;
|
|
197
198
|
|
|
199
|
+
type MarkdownRouteArtifact = {
|
|
200
|
+
body: string;
|
|
201
|
+
bodyHash?: string;
|
|
202
|
+
byteSize?: number;
|
|
203
|
+
htmlPath: string;
|
|
204
|
+
markdownPath: string;
|
|
205
|
+
sourceHash?: string;
|
|
206
|
+
title: string;
|
|
207
|
+
};
|
|
208
|
+
type MarkdownRouteArtifactIndexEntry = Omit<MarkdownRouteArtifact, "body"> & {
|
|
209
|
+
shardId: string;
|
|
210
|
+
};
|
|
211
|
+
type MarkdownRouteArtifactIndex = Record<string, MarkdownRouteArtifactIndexEntry>;
|
|
212
|
+
type MarkdownRouteArtifactShardMetadata = {
|
|
213
|
+
byteSize: number;
|
|
214
|
+
contentHash: string;
|
|
215
|
+
id: string;
|
|
216
|
+
modulePath: string;
|
|
217
|
+
pageCount: number;
|
|
218
|
+
};
|
|
219
|
+
type MarkdownRouteArtifactManifest = {
|
|
220
|
+
byHtmlPath: Record<string, string>;
|
|
221
|
+
byMarkdownPath: MarkdownRouteArtifactIndex;
|
|
222
|
+
shards: MarkdownRouteArtifactShardMetadata[];
|
|
223
|
+
};
|
|
224
|
+
|
|
198
225
|
type LlmsRouteOptions = {
|
|
199
226
|
scope?: "site" | "group" | "self";
|
|
200
227
|
group?: string;
|
|
@@ -205,8 +232,13 @@ type LlmsRouteOptions = {
|
|
|
205
232
|
path: string;
|
|
206
233
|
group?: string;
|
|
207
234
|
}>;
|
|
235
|
+
otherGroupLinks?: Array<{
|
|
236
|
+
title: string;
|
|
237
|
+
path: string;
|
|
238
|
+
group?: string;
|
|
239
|
+
}>;
|
|
208
240
|
};
|
|
209
|
-
declare function createLlmsTxtRoute(manifest: ManifestLike, options?: LlmsRouteOptions): () => Promise<Response>;
|
|
241
|
+
declare function createLlmsTxtRoute(manifest: ManifestLike, options?: LlmsRouteOptions, artifactManifest?: MarkdownRouteArtifactManifest): () => Promise<Response>;
|
|
210
242
|
|
|
211
243
|
type OgImageEntryLike = {
|
|
212
244
|
key: string;
|
|
@@ -281,8 +313,15 @@ declare function createOgImageStaticParams({ manifest }: OgImageRouteConfig): {
|
|
|
281
313
|
|
|
282
314
|
declare function createRobotsTxtRoute(manifest: ManifestLike): () => Promise<Response>;
|
|
283
315
|
|
|
316
|
+
type SitemapReference = {
|
|
317
|
+
path: string;
|
|
318
|
+
group?: string;
|
|
319
|
+
};
|
|
284
320
|
type SitemapRouteOptions = {
|
|
285
321
|
group?: string;
|
|
322
|
+
path?: string;
|
|
323
|
+
sitemaps?: SitemapReference[];
|
|
324
|
+
exclude?: SitemapReference[];
|
|
286
325
|
};
|
|
287
326
|
declare function createSitemapXmlRoute(manifest: ManifestLike, options?: SitemapRouteOptions): () => Promise<Response>;
|
|
288
327
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// src/jsx-dev-runtime.ts
|
|
2
|
+
import { jsxDEV as reactJsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
+
|
|
4
|
+
// src/lib/hosting/framework-paths.ts
|
|
5
|
+
var FRAMEWORK_PREFIX = "/publishos", SOURCE_ASSET_PREFIX = `${FRAMEWORK_PREFIX}/assets`, INTERNAL_PREFIX = `${FRAMEWORK_PREFIX}/internal`, SITE_API_PREFIX = `${FRAMEWORK_PREFIX}/api`, SEARCH_PREFIX = `${INTERNAL_PREFIX}/search`, PAGEFIND_MODULE_URL = `${SEARCH_PREFIX}/pagefind.js`, PAGEFIND_ENTRY_URL = `${SEARCH_PREFIX}/pagefind-entry.json`, IMAGE_OPTIMIZER_PATH = `${SITE_API_PREFIX}/image`;
|
|
6
|
+
var OG_SERVICE_PREFIX = `${SITE_API_PREFIX}/og`, PUBLIC_INTERNAL_DIRECTORY = INTERNAL_PREFIX.slice(1), PUBLIC_FONT_DIRECTORY = `${PUBLIC_INTERNAL_DIRECTORY}/fonts`, PUBLIC_SEARCH_DIRECTORY = `public/${PUBLIC_INTERNAL_DIRECTORY}/search`, FRAMEWORK_PROXY_MATCHER = `/((?!${FRAMEWORK_PREFIX.slice(1)}(?:/|$)|_next/static|_next/image|_next/webpack-hmr).*)`;
|
|
7
|
+
|
|
8
|
+
// src/lib/assets/map-source-asset-url.ts
|
|
9
|
+
var SOURCE_ASSET_PATH = "/assets/", URL_PROPS = [
|
|
10
|
+
"action",
|
|
11
|
+
"cite",
|
|
12
|
+
"data",
|
|
13
|
+
"formAction",
|
|
14
|
+
"href",
|
|
15
|
+
"poster",
|
|
16
|
+
"src",
|
|
17
|
+
"xlinkHref"
|
|
18
|
+
];
|
|
19
|
+
function hasUnsafeControlCharacters(value) {
|
|
20
|
+
for (let character of value) {
|
|
21
|
+
let code = character.codePointAt(0) ?? 0;
|
|
22
|
+
if (code <= 31 || code >= 127 && code <= 159) return !0;
|
|
23
|
+
}
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
function assertSafeAssetPath(path) {
|
|
27
|
+
if (path.includes("\\") || hasUnsafeControlCharacters(path))
|
|
28
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
29
|
+
for (let segment of path.split("/")) {
|
|
30
|
+
if (!segment)
|
|
31
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
32
|
+
let decoded;
|
|
33
|
+
try {
|
|
34
|
+
decoded = decodeURIComponent(segment);
|
|
35
|
+
} catch {
|
|
36
|
+
throw new TypeError("Local asset URLs must use valid URL encoding.");
|
|
37
|
+
}
|
|
38
|
+
if (decoded === "." || decoded === ".." || decoded.includes("/") || decoded.includes("\\") || hasUnsafeControlCharacters(decoded))
|
|
39
|
+
throw new TypeError("Local asset URLs must use safe path segments.");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function mapSourceAssetUrl(value) {
|
|
43
|
+
if (typeof value != "string" || !value.startsWith(SOURCE_ASSET_PATH))
|
|
44
|
+
return value;
|
|
45
|
+
let suffixIndex = value.search(/[?#]/u), pathname = suffixIndex < 0 ? value : value.slice(0, suffixIndex), suffix = suffixIndex < 0 ? "" : value.slice(suffixIndex), path = pathname.slice(SOURCE_ASSET_PATH.length);
|
|
46
|
+
return assertSafeAssetPath(path), `${SOURCE_ASSET_PREFIX}/${path}${suffix}`;
|
|
47
|
+
}
|
|
48
|
+
function mapSourceSet(value) {
|
|
49
|
+
let candidates = [], cursor = 0;
|
|
50
|
+
for (; cursor < value.length; ) {
|
|
51
|
+
for (; cursor < value.length && /[\s,]/u.test(value[cursor] ?? ""); )
|
|
52
|
+
cursor += 1;
|
|
53
|
+
if (cursor >= value.length) break;
|
|
54
|
+
let start = cursor;
|
|
55
|
+
for (; cursor < value.length && !/\s/u.test(value[cursor] ?? ""); )
|
|
56
|
+
cursor += 1;
|
|
57
|
+
let url = value.slice(start, cursor), endsCandidate = url.endsWith(",");
|
|
58
|
+
endsCandidate && (url = url.replace(/,+$/u, ""));
|
|
59
|
+
let mapped = String(mapSourceAssetUrl(url));
|
|
60
|
+
if (endsCandidate) {
|
|
61
|
+
candidates.push(mapped);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
for (; cursor < value.length && /\s/u.test(value[cursor] ?? ""); )
|
|
65
|
+
cursor += 1;
|
|
66
|
+
let descriptorStart = cursor;
|
|
67
|
+
for (; cursor < value.length && value[cursor] !== ","; ) cursor += 1;
|
|
68
|
+
let descriptor = value.slice(descriptorStart, cursor).trim();
|
|
69
|
+
candidates.push(descriptor ? `${mapped} ${descriptor}` : mapped), value[cursor] === "," && (cursor += 1);
|
|
70
|
+
}
|
|
71
|
+
return candidates.join(", ");
|
|
72
|
+
}
|
|
73
|
+
function mapSourceAssetProps(props) {
|
|
74
|
+
if (!props || typeof props != "object") return props;
|
|
75
|
+
let source = props, mapped;
|
|
76
|
+
for (let name of URL_PROPS) {
|
|
77
|
+
let value = source[name], next = mapSourceAssetUrl(value);
|
|
78
|
+
next !== value && (mapped ??= { ...source }, mapped[name] = next);
|
|
79
|
+
}
|
|
80
|
+
if (typeof source.srcSet == "string") {
|
|
81
|
+
let next = mapSourceSet(source.srcSet);
|
|
82
|
+
next !== source.srcSet && (mapped ??= { ...source }, mapped.srcSet = next);
|
|
83
|
+
}
|
|
84
|
+
return mapped ?? props;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/jsx-dev-runtime.ts
|
|
88
|
+
import { Fragment } from "react/jsx-dev-runtime";
|
|
89
|
+
var jsxDEV = (type, props, key, isStaticChildren, source, self) => reactJsxDEV(
|
|
90
|
+
type,
|
|
91
|
+
mapSourceAssetProps(props),
|
|
92
|
+
key,
|
|
93
|
+
isStaticChildren,
|
|
94
|
+
source,
|
|
95
|
+
self
|
|
96
|
+
);
|
|
97
|
+
export {
|
|
98
|
+
Fragment,
|
|
99
|
+
jsxDEV
|
|
100
|
+
};
|