veryfront 0.1.1127 → 0.1.1132
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/esm/cli/commands/eval/command.d.ts +2 -70
- package/esm/cli/commands/eval/command.d.ts.map +1 -1
- package/esm/cli/commands/eval/command.js +207 -550
- package/esm/cli/templates/manifest.d.ts +1 -0
- package/esm/cli/templates/manifest.js +3 -2
- package/esm/deno.js +1 -1
- package/esm/src/agent/hosted/chat-execution-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-execution-runtime.js +16 -33
- package/esm/src/agent/hosted/child-fork-tool-sources.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-tool-sources.js +6 -38
- package/esm/src/agent/hosted/hosted-chat-finalization.d.ts +30 -0
- package/esm/src/agent/hosted/hosted-chat-finalization.d.ts.map +1 -0
- package/esm/src/agent/hosted/hosted-chat-finalization.js +249 -0
- package/esm/src/agent/hosted/project-remote-tool-source.d.ts.map +1 -1
- package/esm/src/agent/hosted/project-remote-tool-source.js +4 -23
- package/esm/src/agent/mcp-tool-policy.d.ts +19 -0
- package/esm/src/agent/mcp-tool-policy.d.ts.map +1 -0
- package/esm/src/agent/mcp-tool-policy.js +66 -0
- package/esm/src/agent/runtime/mcp-server-tool-sources.d.ts.map +1 -1
- package/esm/src/agent/runtime/mcp-server-tool-sources.js +8 -44
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +7 -90
- package/esm/src/eval/run-report.d.ts +189 -0
- package/esm/src/eval/run-report.d.ts.map +1 -0
- package/esm/src/eval/run-report.js +603 -0
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/templates/router.js +35 -11
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +19 -45
- package/esm/src/index.client.d.ts +6 -21
- package/esm/src/index.client.d.ts.map +1 -1
- package/esm/src/index.client.js +6 -21
- package/esm/src/modules/server/ssr-import-rewriter.d.ts +2 -26
- package/esm/src/modules/server/ssr-import-rewriter.d.ts.map +1 -1
- package/esm/src/modules/server/ssr-import-rewriter.js +1 -206
- package/esm/src/react/runtime/core.d.ts +22 -0
- package/esm/src/react/runtime/core.d.ts.map +1 -1
- package/esm/src/react/runtime/core.js +1 -1
- package/esm/src/rendering/orchestrator/module-collection.d.ts +8 -0
- package/esm/src/rendering/orchestrator/module-collection.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-collection.js +10 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +2 -2
- package/esm/src/routing/api/context-builder.d.ts +7 -0
- package/esm/src/routing/api/context-builder.d.ts.map +1 -1
- package/esm/src/routing/api/context-builder.js +20 -2
- package/esm/src/routing/api/module-loader/external-import-rewriter.d.ts +2 -7
- package/esm/src/routing/api/module-loader/external-import-rewriter.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/external-import-rewriter.js +10 -209
- package/esm/src/server/dev-server/file-watch-setup.d.ts.map +1 -1
- package/esm/src/server/dev-server/file-watch-setup.js +11 -1
- package/esm/src/server/dev-server/middleware.d.ts.map +1 -1
- package/esm/src/server/dev-server/middleware.js +45 -11
- package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/files/esbuild-plugins.js +22 -0
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.js +24 -1
- package/esm/src/server/handlers/response/not-found.d.ts +0 -1
- package/esm/src/server/handlers/response/not-found.d.ts.map +1 -1
- package/esm/src/server/handlers/response/not-found.js +9 -110
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +66 -145
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts +118 -0
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts.map +1 -0
- package/esm/src/server/runtime-handler/project-runtime-context.js +181 -0
- package/esm/src/server/services/rsc/orchestrators/handler.d.ts +3 -1
- package/esm/src/server/services/rsc/orchestrators/handler.d.ts.map +1 -1
- package/esm/src/server/services/rsc/orchestrators/handler.js +13 -8
- package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts +1 -1
- package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts.map +1 -1
- package/esm/src/server/services/rsc/orchestrators/render-handler.js +2 -2
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +132 -46
- package/esm/src/transforms/esm/import-attributes.d.ts.map +1 -1
- package/esm/src/transforms/esm/import-attributes.js +2 -9
- package/esm/src/transforms/esm/in-flight-manager.d.ts +3 -2
- package/esm/src/transforms/esm/in-flight-manager.d.ts.map +1 -1
- package/esm/src/transforms/esm/in-flight-manager.js +6 -5
- package/esm/src/transforms/import-rewriter/core.d.ts +8 -0
- package/esm/src/transforms/import-rewriter/core.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/core.js +27 -0
- package/esm/src/transforms/import-rewriter/import-edit.d.ts +57 -0
- package/esm/src/transforms/import-rewriter/import-edit.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/import-edit.js +151 -0
- package/esm/src/transforms/import-rewriter/package-resolution.d.ts +12 -0
- package/esm/src/transforms/import-rewriter/package-resolution.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/package-resolution.js +79 -0
- package/esm/src/transforms/import-rewriter/parse-cache.d.ts +4 -42
- package/esm/src/transforms/import-rewriter/parse-cache.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/parse-cache.js +3 -134
- package/esm/src/transforms/import-rewriter/route-adapter.d.ts +24 -0
- package/esm/src/transforms/import-rewriter/route-adapter.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/route-adapter.js +235 -0
- package/esm/src/transforms/import-rewriter/ssr-adapter.d.ts +27 -0
- package/esm/src/transforms/import-rewriter/ssr-adapter.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/ssr-adapter.js +206 -0
- package/esm/src/transforms/import-rewriter/strategies/bare-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/bare-strategy.js +16 -2
- package/esm/src/transforms/import-rewriter/unified-rewriter.d.ts +0 -4
- package/esm/src/transforms/import-rewriter/unified-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/unified-rewriter.js +2 -39
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/executor/workflow-executor.d.ts +0 -20
- package/esm/src/workflow/executor/workflow-executor.d.ts.map +1 -1
- package/esm/src/workflow/executor/workflow-executor.js +41 -320
- package/esm/src/workflow/runtime/approval-manager.d.ts.map +1 -1
- package/esm/src/workflow/runtime/approval-manager.js +20 -61
- package/esm/src/workflow/runtime/workflow-run-control.d.ts +95 -0
- package/esm/src/workflow/runtime/workflow-run-control.d.ts.map +1 -0
- package/esm/src/workflow/runtime/workflow-run-control.js +529 -0
- package/esm/src/workflow/worker/run-manager.d.ts.map +1 -1
- package/esm/src/workflow/worker/run-manager.js +18 -92
- package/esm/src/workflow/worker/shared.d.ts +1 -1
- package/esm/src/workflow/worker/shared.d.ts.map +1 -1
- package/esm/src/workflow/worker/shared.js +17 -15
- package/package.json +5 -5
|
@@ -592,7 +592,7 @@ export const getRouterScript = () => `
|
|
|
592
592
|
// ============================================
|
|
593
593
|
// SPA navigation handler
|
|
594
594
|
// ============================================
|
|
595
|
-
async function navigateSPA(href,
|
|
595
|
+
async function navigateSPA(href, historyMode = 'push', restoreScroll = false) {
|
|
596
596
|
currentAbortController?.abort();
|
|
597
597
|
|
|
598
598
|
if (isNavigating) return;
|
|
@@ -626,14 +626,24 @@ export const getRouterScript = () => `
|
|
|
626
626
|
// { redirect: { destination } } payload. Follow it with a document
|
|
627
627
|
// navigation to the target (the same net effect as the full-page 302),
|
|
628
628
|
// instead of trying to render a page that does not exist here.
|
|
629
|
+
// Only follow http(s)/relative destinations: assigning a javascript:/data:
|
|
630
|
+
// URL to location.href would EXECUTE it (the server also filters these, so
|
|
631
|
+
// this is defense in depth). Fall through to the normal error path otherwise.
|
|
629
632
|
if (pageData && pageData.redirect && typeof pageData.redirect.destination === 'string') {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
+
try {
|
|
634
|
+
var redirectTarget = new URL(pageData.redirect.destination, window.location.origin);
|
|
635
|
+
if (redirectTarget.protocol === 'http:' || redirectTarget.protocol === 'https:') {
|
|
636
|
+
log('SPA navigation redirect -> ' + redirectTarget.href);
|
|
637
|
+
window.location.href = redirectTarget.href;
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
} catch (e) { /* invalid destination — do not follow */ }
|
|
633
641
|
}
|
|
634
642
|
|
|
635
|
-
if (
|
|
643
|
+
if (historyMode === 'push') {
|
|
636
644
|
window.history.pushState({ pageData, scrollY: 0 }, '', href);
|
|
645
|
+
} else if (historyMode === 'replace') {
|
|
646
|
+
window.history.replaceState({ pageData, scrollY: 0 }, '', href);
|
|
637
647
|
}
|
|
638
648
|
|
|
639
649
|
// Update the shared router snapshot BEFORE rendering. RouterProvider
|
|
@@ -666,7 +676,11 @@ export const getRouterScript = () => `
|
|
|
666
676
|
|
|
667
677
|
hideNavigationProgress();
|
|
668
678
|
perfEnd('nav:total:' + href);
|
|
669
|
-
emitRouteTiming('total', targetPath, navigationStartedAt, {
|
|
679
|
+
emitRouteTiming('total', targetPath, navigationStartedAt, {
|
|
680
|
+
href,
|
|
681
|
+
historyMode,
|
|
682
|
+
restoreScroll
|
|
683
|
+
});
|
|
670
684
|
log('SPA navigation complete');
|
|
671
685
|
} catch (error) {
|
|
672
686
|
hideNavigationProgress();
|
|
@@ -1076,10 +1090,10 @@ export const getRouterScript = () => `
|
|
|
1076
1090
|
domain: window.location.origin,
|
|
1077
1091
|
path: window.location.pathname,
|
|
1078
1092
|
push: (path) => {
|
|
1079
|
-
void navigateSPA(path,
|
|
1093
|
+
void navigateSPA(path, 'push');
|
|
1080
1094
|
},
|
|
1081
1095
|
replace: (path) => {
|
|
1082
|
-
void navigateSPA(path,
|
|
1096
|
+
void navigateSPA(path, 'replace');
|
|
1083
1097
|
},
|
|
1084
1098
|
back: () => {
|
|
1085
1099
|
window.history.back();
|
|
@@ -1105,12 +1119,22 @@ export const getRouterScript = () => `
|
|
|
1105
1119
|
})(),
|
|
1106
1120
|
isPreview: false,
|
|
1107
1121
|
isMounted: true,
|
|
1108
|
-
navigate: (path) => navigateSPA(path,
|
|
1122
|
+
navigate: (path) => navigateSPA(path, 'push'),
|
|
1109
1123
|
reload: () => window.location.reload()
|
|
1110
1124
|
};
|
|
1111
1125
|
|
|
1112
1126
|
window.__veryfrontRouter = router;
|
|
1113
1127
|
|
|
1128
|
+
// Route useRouter().push/replace/navigate (from veryfront/router) through the
|
|
1129
|
+
// same SPA navigator that intercepts <Link> clicks. Without this the shared
|
|
1130
|
+
// navigation store has no navigator registered and its navigate() falls back
|
|
1131
|
+
// to a full-page location.assign (finding #7: push() full-reloads).
|
|
1132
|
+
getNavigationStore().setNavigator((href, options) => {
|
|
1133
|
+
const mode = options && options.history;
|
|
1134
|
+
const historyMode = mode === 'replace' ? 'replace' : mode === 'none' ? 'none' : 'push';
|
|
1135
|
+
return navigateSPA(href, historyMode);
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1114
1138
|
// ============================================
|
|
1115
1139
|
// Event handlers
|
|
1116
1140
|
// ============================================
|
|
@@ -1121,7 +1145,7 @@ export const getRouterScript = () => `
|
|
|
1121
1145
|
saveScrollPosition(currentPath);
|
|
1122
1146
|
|
|
1123
1147
|
if (!e.state?.pageData) {
|
|
1124
|
-
await navigateSPA(path,
|
|
1148
|
+
await navigateSPA(path, 'none', true);
|
|
1125
1149
|
return;
|
|
1126
1150
|
}
|
|
1127
1151
|
|
|
@@ -1177,7 +1201,7 @@ export const getRouterScript = () => `
|
|
|
1177
1201
|
|
|
1178
1202
|
e.preventDefault();
|
|
1179
1203
|
cancelScheduledPrefetch();
|
|
1180
|
-
void navigateSPA(href,
|
|
1204
|
+
void navigateSPA(href, 'push');
|
|
1181
1205
|
});
|
|
1182
1206
|
|
|
1183
1207
|
document.addEventListener(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/src/html/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAO1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAgBjF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAQR;AAaD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AA4DD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGrD,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/src/html/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAO1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAgBjF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAQR;AAaD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AA4DD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGrD,CAAC;AAuJF,UAAU,qBAAqB;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD;AA+GD,wBAAsB,cAAc,CAClC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvD,OAAO,CAAC,cAAc,CAAC,CA4DzB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvD,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAElF"}
|
package/esm/src/html/utils.js
CHANGED
|
@@ -70,37 +70,33 @@ export const PLATFORM_UTILITIES = {
|
|
|
70
70
|
...CORE_PLATFORM_UTILITIES,
|
|
71
71
|
...AI_MODULE_UTILITIES,
|
|
72
72
|
};
|
|
73
|
+
// React import-map entries, always from esm.sh — the only CDN that serves React
|
|
74
|
+
// as real ESM. Uses the centralized esmShReact() helper so the URLs stay
|
|
75
|
+
// byte-identical across SSR/client (any mismatch loads a second React instance
|
|
76
|
+
// and hooks fail).
|
|
77
|
+
function esmShReactImports(react) {
|
|
78
|
+
return {
|
|
79
|
+
react: esmShReact("react", react),
|
|
80
|
+
"react-dom": esmShReact("react-dom", react, "", true),
|
|
81
|
+
"react-dom/client": esmShReact("react-dom", react, "/client", true),
|
|
82
|
+
"react/jsx-runtime": esmShReact("react", react, "/jsx-runtime", true),
|
|
83
|
+
"react/jsx-dev-runtime": esmShReact("react", react, "/jsx-dev-runtime", true),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
73
86
|
const CDN_URL_TEMPLATES = {
|
|
74
87
|
"esm.sh": {
|
|
75
|
-
// Use centralized esmShReact() helper from package-registry.ts to ensure URL consistency
|
|
76
|
-
// Any URL mismatch causes esm.sh to serve different modules -> multiple React instances -> hooks fail
|
|
77
|
-
react: (v) => esmShReact("react", v),
|
|
78
|
-
reactDom: (v) => esmShReact("react-dom", v, "", true),
|
|
79
|
-
reactDomClient: (v) => esmShReact("react-dom", v, "/client", true),
|
|
80
|
-
jsxRuntime: (v) => esmShReact("react", v, "/jsx-runtime", true),
|
|
81
|
-
jsxDevRuntime: (v) => esmShReact("react", v, "/jsx-dev-runtime", true),
|
|
82
88
|
veryfrontChat: (v) => `https://esm.sh/veryfront@${v}/chat?external=react,react-dom&target=es2022`,
|
|
83
89
|
veryfrontMarkdown: (v) => `https://esm.sh/veryfront@${v}/markdown?external=react,react-dom&target=es2022`,
|
|
84
90
|
veryfrontMdx: (v) => `https://esm.sh/veryfront@${v}/mdx?external=react,react-dom&target=es2022`,
|
|
85
91
|
veryfrontWorkflow: (v) => `https://esm.sh/veryfront@${v}/workflow/react?external=react,react-dom&target=es2022`,
|
|
86
92
|
},
|
|
87
93
|
unpkg: {
|
|
88
|
-
react: (v) => `https://unpkg.com/react@${v}/umd/react.production.min.js`,
|
|
89
|
-
reactDom: (v) => `https://unpkg.com/react-dom@${v}/umd/react-dom.production.min.js`,
|
|
90
|
-
reactDomClient: (v) => `https://unpkg.com/react-dom@${v}/umd/react-dom.production.min.js`,
|
|
91
|
-
jsxRuntime: (v) => `https://unpkg.com/react@${v}/jsx-runtime`,
|
|
92
|
-
jsxDevRuntime: (v) => `https://unpkg.com/react@${v}/jsx-dev-runtime`,
|
|
93
94
|
veryfrontChat: (v) => `https://unpkg.com/veryfront@${v}/esm/src/chat/index.js`,
|
|
94
95
|
veryfrontMarkdown: (v) => `https://unpkg.com/veryfront@${v}/esm/src/markdown/index.js`,
|
|
95
96
|
veryfrontMdx: (v) => `https://unpkg.com/veryfront@${v}/esm/src/mdx/index.js`,
|
|
96
97
|
veryfrontWorkflow: (v) => `https://unpkg.com/veryfront@${v}/esm/src/workflow/react/index.js`,
|
|
97
98
|
},
|
|
98
99
|
jsdelivr: {
|
|
99
|
-
react: (v) => `https://cdn.jsdelivr.net/npm/react@${v}/umd/react.production.min.js`,
|
|
100
|
-
reactDom: (v) => `https://cdn.jsdelivr.net/npm/react-dom@${v}/umd/react-dom.production.min.js`,
|
|
101
|
-
reactDomClient: (v) => `https://cdn.jsdelivr.net/npm/react-dom@${v}/umd/react-dom.production.min.js`,
|
|
102
|
-
jsxRuntime: (v) => `https://cdn.jsdelivr.net/npm/react@${v}/jsx-runtime`,
|
|
103
|
-
jsxDevRuntime: (v) => `https://cdn.jsdelivr.net/npm/react@${v}/jsx-dev-runtime`,
|
|
104
100
|
veryfrontChat: (v) => `https://cdn.jsdelivr.net/npm/veryfront@${v}/esm/src/chat/index.js`,
|
|
105
101
|
veryfrontMarkdown: (v) => `https://cdn.jsdelivr.net/npm/veryfront@${v}/esm/src/markdown/index.js`,
|
|
106
102
|
veryfrontMdx: (v) => `https://cdn.jsdelivr.net/npm/veryfront@${v}/esm/src/mdx/index.js`,
|
|
@@ -117,25 +113,15 @@ function buildCdnImportMapFromTemplates(versions, templates,
|
|
|
117
113
|
// optionally, the AI modules — never the core runtime.
|
|
118
114
|
includeAiModulesLocally) {
|
|
119
115
|
const { react, veryfront } = versions;
|
|
120
|
-
// React is ALWAYS served from esm.sh, regardless of the configured CDN
|
|
121
|
-
// provider. esm.sh is the only CDN that serves React as real ESM; unpkg and
|
|
122
|
-
// jsdelivr only ship UMD globals (react/umd/react.production.min.js), which
|
|
123
|
-
// cannot be consumed through an import map at all — the browser rejects them
|
|
124
|
-
// with a module-resolution/CORS error and hydration never starts. Self-hosted
|
|
125
|
-
// mode already does exactly this. The `provider` only governs where the
|
|
126
|
-
// veryfront framework modules load from.
|
|
127
|
-
const reactTemplates = CDN_URL_TEMPLATES["esm.sh"];
|
|
128
116
|
return {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"react/jsx-runtime": reactTemplates.jsxRuntime(react),
|
|
133
|
-
"react/jsx-dev-runtime": reactTemplates.jsxDevRuntime(react),
|
|
117
|
+
// React is ALWAYS from esm.sh, regardless of the configured provider (see
|
|
118
|
+
// esmShReactImports). The `provider` only governs the veryfront modules.
|
|
119
|
+
...esmShReactImports(react),
|
|
134
120
|
"veryfront/chat": templates.veryfrontChat(veryfront),
|
|
135
121
|
"veryfront/markdown": templates.veryfrontMarkdown(veryfront),
|
|
136
122
|
"veryfront/mdx": templates.veryfrontMdx(veryfront),
|
|
137
123
|
"veryfront/workflow": templates.veryfrontWorkflow(veryfront),
|
|
138
|
-
// Core runtime utilities always resolve locally
|
|
124
|
+
// Core runtime utilities always resolve locally.
|
|
139
125
|
...CORE_PLATFORM_UTILITIES,
|
|
140
126
|
// AI modules only override the CDN entries when requested.
|
|
141
127
|
...(includeAiModulesLocally ? AI_MODULE_UTILITIES : {}),
|
|
@@ -152,13 +138,8 @@ function getJsdelivrImportMap(versions) {
|
|
|
152
138
|
}
|
|
153
139
|
function getSelfHostedImportMap(versions) {
|
|
154
140
|
const { react } = versions;
|
|
155
|
-
const esmShTemplates = CDN_URL_TEMPLATES["esm.sh"];
|
|
156
141
|
return {
|
|
157
|
-
|
|
158
|
-
"react-dom": esmShTemplates.reactDom(react),
|
|
159
|
-
"react-dom/client": esmShTemplates.reactDomClient(react),
|
|
160
|
-
"react/jsx-runtime": esmShTemplates.jsxRuntime(react),
|
|
161
|
-
"react/jsx-dev-runtime": esmShTemplates.jsxDevRuntime(react),
|
|
142
|
+
...esmShReactImports(react),
|
|
162
143
|
"veryfront/chat": "/_veryfront/lib/chat.js",
|
|
163
144
|
"veryfront/markdown": "/_veryfront/lib/markdown.js",
|
|
164
145
|
"veryfront/mdx": "/_veryfront/lib/mdx.js",
|
|
@@ -297,14 +278,7 @@ export async function buildImportMap(options) {
|
|
|
297
278
|
? await resolveVersions(projectDir, config)
|
|
298
279
|
: DEFAULT_VERSIONS;
|
|
299
280
|
if (mode === "bundled") {
|
|
300
|
-
|
|
301
|
-
let imports = {
|
|
302
|
-
react: reactTemplates.react(versions.react),
|
|
303
|
-
"react-dom": reactTemplates.reactDom(versions.react),
|
|
304
|
-
"react-dom/client": reactTemplates.reactDomClient(versions.react),
|
|
305
|
-
"react/jsx-runtime": reactTemplates.jsxRuntime(versions.react),
|
|
306
|
-
"react/jsx-dev-runtime": reactTemplates.jsxDevRuntime(versions.react),
|
|
307
|
-
};
|
|
281
|
+
let imports = { ...esmShReactImports(versions.react) };
|
|
308
282
|
imports = applyManifestDependencies(imports, releaseAssetManifest);
|
|
309
283
|
imports = applyReleaseModuleVersions(imports, releaseAssetManifest);
|
|
310
284
|
imports = { ...imports, ...customImports };
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Browser- and SSR-safe helpers from the `veryfront` package.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `src/server/production-server.ts`, which has module top-level `await` and
|
|
10
|
-
* cannot be transformed to the es2020 browser target (HTTP 500 on that chunk,
|
|
11
|
-
* which aborts hydration).
|
|
12
|
-
*
|
|
13
|
-
* A client-reachable module doing a used value import from the barrel, for
|
|
14
|
-
* example `import { getEnv } from "veryfront"`, is not dead-stripped, so it
|
|
15
|
-
* keeps the barrel and the leak. This barrel exposes exactly the same
|
|
16
|
-
* browser-safe surface minus the server bootstrap functions, which no
|
|
17
|
-
* client/SSR page code legitimately calls. The import rewriter redirects
|
|
18
|
-
* `veryfront` to this module for the `browser` and `ssr` targets (see
|
|
19
|
-
* `src/transforms/import-rewriter/strategies/veryfront-strategy.ts`), the same
|
|
20
|
-
* mechanism `veryfront/workflow` already uses.
|
|
21
|
-
*
|
|
22
|
-
* Keep the exports below in sync with {@link file://./index.ts}: everything
|
|
23
|
-
* except the `createHandler` / `startServer` / `toNodeHandler` value exports.
|
|
4
|
+
* This entrypoint exposes the root package's client-safe configuration,
|
|
5
|
+
* platform, routing, data, and security helpers without server bootstrap
|
|
6
|
+
* functions. Most app code can import these helpers from `veryfront`; use this
|
|
7
|
+
* explicit entrypoint when a browser or SSR module needs to declare that
|
|
8
|
+
* boundary directly.
|
|
24
9
|
*
|
|
25
10
|
* @example
|
|
26
11
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../src/src/index.client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../src/src/index.client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACpF,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE/F,OAAO,EACL,UAAU,EACV,SAAS,EACT,IAAI,EACJ,QAAQ,IAAI,WAAW,EACvB,QAAQ,IAAI,WAAW,EACvB,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EACV,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/esm/src/index.client.js
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Browser- and SSR-safe helpers from the `veryfront` package.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `src/server/production-server.ts`, which has module top-level `await` and
|
|
10
|
-
* cannot be transformed to the es2020 browser target (HTTP 500 on that chunk,
|
|
11
|
-
* which aborts hydration).
|
|
12
|
-
*
|
|
13
|
-
* A client-reachable module doing a used value import from the barrel, for
|
|
14
|
-
* example `import { getEnv } from "veryfront"`, is not dead-stripped, so it
|
|
15
|
-
* keeps the barrel and the leak. This barrel exposes exactly the same
|
|
16
|
-
* browser-safe surface minus the server bootstrap functions, which no
|
|
17
|
-
* client/SSR page code legitimately calls. The import rewriter redirects
|
|
18
|
-
* `veryfront` to this module for the `browser` and `ssr` targets (see
|
|
19
|
-
* `src/transforms/import-rewriter/strategies/veryfront-strategy.ts`), the same
|
|
20
|
-
* mechanism `veryfront/workflow` already uses.
|
|
21
|
-
*
|
|
22
|
-
* Keep the exports below in sync with {@link file://./index.ts}: everything
|
|
23
|
-
* except the `createHandler` / `startServer` / `toNodeHandler` value exports.
|
|
4
|
+
* This entrypoint exposes the root package's client-safe configuration,
|
|
5
|
+
* platform, routing, data, and security helpers without server bootstrap
|
|
6
|
+
* functions. Most app code can import these helpers from `veryfront`; use this
|
|
7
|
+
* explicit entrypoint when a browser or SSR module needs to declare that
|
|
8
|
+
* boundary directly.
|
|
24
9
|
*
|
|
25
10
|
* @example
|
|
26
11
|
* ```ts
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
type
|
|
2
|
-
export
|
|
3
|
-
specifier: string;
|
|
4
|
-
kind: "alias" | "relative";
|
|
5
|
-
modulePath: string;
|
|
6
|
-
rewrittenPath: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function stripSSRModuleJsExtension(path: string): string;
|
|
9
|
-
export declare function resolveSSRImportTargetModulePath(target: SSRImportRewriteTarget, currentModulePath: string): string;
|
|
10
|
-
export interface SSRRewriteOptions {
|
|
11
|
-
/** Project slug for multi-project routing */
|
|
12
|
-
projectSlug?: string | null;
|
|
13
|
-
/** Branch name for branch-aware routing */
|
|
14
|
-
branch?: string | null;
|
|
15
|
-
/** Cache buster token. When omitted, each rewritten target gets a stable token. */
|
|
16
|
-
cacheBuster?: CacheBuster;
|
|
17
|
-
/** Resolve a cache buster token for each rewritten target. */
|
|
18
|
-
resolveCacheBuster?: (target: SSRImportRewriteTarget) => CacheBuster | null | undefined | Promise<CacheBuster | null | undefined>;
|
|
19
|
-
/** Cross-project reference (e.g., "demo@0.0") for @/ path rewrites */
|
|
20
|
-
crossProjectRef?: string;
|
|
21
|
-
/** React version to use for import rewrites */
|
|
22
|
-
reactVersion?: string;
|
|
23
|
-
}
|
|
24
|
-
export declare function applySSRImportRewrites(code: string, options?: SSRRewriteOptions): string;
|
|
25
|
-
export declare function applySSRImportRewritesAsync(code: string, options?: SSRRewriteOptions): Promise<string>;
|
|
26
|
-
export {};
|
|
1
|
+
export type { SSRImportRewriteTarget, SSRRewriteOptions, } from "../../transforms/import-rewriter/ssr-adapter.js";
|
|
2
|
+
export { resolveSSRImportTargetModulePathCompat as resolveSSRImportTargetModulePath, rewriteSSRImportsCompat as applySSRImportRewrites, rewriteSSRImportsCompatAsync as applySSRImportRewritesAsync, stripSSRModuleJsExtensionCompat as stripSSRModuleJsExtension, } from "../../transforms/import-rewriter/ssr-adapter.js";
|
|
27
3
|
//# sourceMappingURL=ssr-import-rewriter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-import-rewriter.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/ssr-import-rewriter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssr-import-rewriter.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/ssr-import-rewriter.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,sCAAsC,IAAI,gCAAgC,EAC1E,uBAAuB,IAAI,sBAAsB,EACjD,4BAA4B,IAAI,2BAA2B,EAC3D,+BAA+B,IAAI,yBAAyB,GAC7D,MAAM,iDAAiD,CAAC"}
|
|
@@ -1,206 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { isDeno, isNode } from "../../platform/compat/runtime.js";
|
|
3
|
-
import { getLocalReactPaths } from "../../platform/compat/react-paths.js";
|
|
4
|
-
import { hashString } from "../../cache/hash.js";
|
|
5
|
-
export function stripSSRModuleJsExtension(path) {
|
|
6
|
-
return path.replace(/\.(?:mjs|js)$/i, "");
|
|
7
|
-
}
|
|
8
|
-
function normalizeSSRModulePath(path) {
|
|
9
|
-
let normalized = path.replace(/^\/+/, "");
|
|
10
|
-
if (normalized.startsWith("_vf_modules/")) {
|
|
11
|
-
normalized = normalized.slice("_vf_modules/".length);
|
|
12
|
-
}
|
|
13
|
-
if (normalized.startsWith("@/"))
|
|
14
|
-
normalized = normalized.slice(2);
|
|
15
|
-
return normalized;
|
|
16
|
-
}
|
|
17
|
-
export function resolveSSRImportTargetModulePath(target, currentModulePath) {
|
|
18
|
-
if (target.kind === "alias")
|
|
19
|
-
return normalizeSSRModulePath(target.modulePath);
|
|
20
|
-
const currentPath = normalizeSSRModulePath(currentModulePath);
|
|
21
|
-
if (target.specifier.startsWith("/")) {
|
|
22
|
-
return normalizeSSRModulePath(target.specifier);
|
|
23
|
-
}
|
|
24
|
-
const basePath = currentPath.startsWith("/") ? currentPath : `/${currentPath}`;
|
|
25
|
-
const resolved = new URL(target.specifier, `http://veryfront.local${basePath}`).pathname;
|
|
26
|
-
return normalizeSSRModulePath(resolved);
|
|
27
|
-
}
|
|
28
|
-
function shouldKeepBareSpecifier(specifier) {
|
|
29
|
-
// npm: specifiers are only supported in Deno, not Node.js
|
|
30
|
-
// In Node.js, we need to convert them to esm.sh URLs (handled in rewriteBareImports)
|
|
31
|
-
if (specifier.startsWith("npm:"))
|
|
32
|
-
return isDeno;
|
|
33
|
-
if (specifier.startsWith("http://") ||
|
|
34
|
-
specifier.startsWith("https://") ||
|
|
35
|
-
specifier.startsWith("file://") ||
|
|
36
|
-
specifier.startsWith("node:")) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (specifier.startsWith("@/"))
|
|
40
|
-
return true;
|
|
41
|
-
if (specifier.startsWith("veryfront/"))
|
|
42
|
-
return true;
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
function resolveReactForRuntime(specifier, version) {
|
|
46
|
-
// For Bun: Use local React paths from veryfront's node_modules.
|
|
47
|
-
// Bun handles CJS/ESM interop correctly with file:// URLs.
|
|
48
|
-
if (!isDeno && !isNode) {
|
|
49
|
-
const localPath = getLocalReactPaths()[specifier];
|
|
50
|
-
if (localPath)
|
|
51
|
-
return localPath;
|
|
52
|
-
// If not found in local paths, fall through to esm.sh for subpath imports
|
|
53
|
-
}
|
|
54
|
-
// For Deno: Use esm.sh URLs (Deno supports HTTP imports natively).
|
|
55
|
-
// For Node.js: Use esm.sh URLs which will be cached to disk by cacheHttpImportsToLocal.
|
|
56
|
-
// The cached bundles are ESM-compatible and can be imported via file:// URLs.
|
|
57
|
-
const v = version ?? DEFAULT_REACT_VERSION;
|
|
58
|
-
const mapped = getReactImportMap(v)[specifier];
|
|
59
|
-
if (mapped)
|
|
60
|
-
return mapped;
|
|
61
|
-
if (specifier.startsWith("react/")) {
|
|
62
|
-
const subpath = specifier.slice("react/".length);
|
|
63
|
-
return `https://esm.sh/react@${v}/${subpath}?external=react&target=es2022`;
|
|
64
|
-
}
|
|
65
|
-
if (specifier.startsWith("react-dom/")) {
|
|
66
|
-
const subpath = specifier.slice("react-dom/".length);
|
|
67
|
-
return `https://esm.sh/react-dom@${v}/${subpath}?external=react&target=es2022`;
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
function rewriteBareImports(code, version) {
|
|
72
|
-
const v = version ?? DEFAULT_REACT_VERSION;
|
|
73
|
-
return code.replace(/from\s+["']([^"'./][^"']*)["']/g, (_match, specifier) => {
|
|
74
|
-
const bareSpecifier = specifier.startsWith("npm:") ? specifier.slice(4) : specifier;
|
|
75
|
-
const reactUrl = resolveReactForRuntime(bareSpecifier, v);
|
|
76
|
-
if (reactUrl)
|
|
77
|
-
return `from "${reactUrl}"`;
|
|
78
|
-
if (shouldKeepBareSpecifier(specifier))
|
|
79
|
-
return `from "${specifier}"`;
|
|
80
|
-
return `from "https://esm.sh/${bareSpecifier}?external=react&target=es2022"`;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function getDefaultCacheBuster(target, options) {
|
|
84
|
-
return hashString([
|
|
85
|
-
target.kind,
|
|
86
|
-
target.modulePath,
|
|
87
|
-
target.rewrittenPath,
|
|
88
|
-
options.projectSlug ?? "",
|
|
89
|
-
options.branch ?? "",
|
|
90
|
-
options.crossProjectRef ?? "",
|
|
91
|
-
options.reactVersion ?? "",
|
|
92
|
-
].join("\0"));
|
|
93
|
-
}
|
|
94
|
-
function getCacheBusterSync(target, options) {
|
|
95
|
-
if (options.cacheBuster !== undefined)
|
|
96
|
-
return String(options.cacheBuster);
|
|
97
|
-
return getDefaultCacheBuster(target, options);
|
|
98
|
-
}
|
|
99
|
-
async function getCacheBusterAsync(target, options) {
|
|
100
|
-
if (options.cacheBuster !== undefined)
|
|
101
|
-
return String(options.cacheBuster);
|
|
102
|
-
const resolved = await options.resolveCacheBuster?.(target);
|
|
103
|
-
if (resolved !== undefined && resolved !== null)
|
|
104
|
-
return String(resolved);
|
|
105
|
-
return getDefaultCacheBuster(target, options);
|
|
106
|
-
}
|
|
107
|
-
function buildAliasRewrite(specifierPath, options) {
|
|
108
|
-
const { crossProjectRef } = options;
|
|
109
|
-
const jsPath = specifierPath.endsWith(".js") ? specifierPath : `${specifierPath}.js`;
|
|
110
|
-
if (crossProjectRef) {
|
|
111
|
-
const rewrittenPath = `/_vf_modules/_cross/${crossProjectRef}/@/${jsPath}`;
|
|
112
|
-
return {
|
|
113
|
-
target: {
|
|
114
|
-
specifier: `@/${specifierPath}`,
|
|
115
|
-
kind: "alias",
|
|
116
|
-
modulePath: jsPath,
|
|
117
|
-
rewrittenPath,
|
|
118
|
-
},
|
|
119
|
-
prefix: `${rewrittenPath}?ssr=true`,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const rewrittenPath = `/_vf_modules/${jsPath}`;
|
|
123
|
-
return {
|
|
124
|
-
target: {
|
|
125
|
-
specifier: `@/${specifierPath}`,
|
|
126
|
-
kind: "alias",
|
|
127
|
-
modulePath: jsPath,
|
|
128
|
-
rewrittenPath,
|
|
129
|
-
},
|
|
130
|
-
prefix: `${rewrittenPath}?ssr=true`,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function buildRelativeRewrite(specifier) {
|
|
134
|
-
return {
|
|
135
|
-
target: {
|
|
136
|
-
specifier,
|
|
137
|
-
kind: "relative",
|
|
138
|
-
modulePath: specifier,
|
|
139
|
-
rewrittenPath: specifier,
|
|
140
|
-
},
|
|
141
|
-
prefix: `${specifier}?ssr=true`,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function buildScopedParams(options) {
|
|
145
|
-
const projectParam = options.projectSlug ? `&project=${options.projectSlug}` : "";
|
|
146
|
-
const branchParam = options.branch ? `&branch=${options.branch}` : "";
|
|
147
|
-
return `${projectParam}${branchParam}`;
|
|
148
|
-
}
|
|
149
|
-
function rewritePathAliases(code, options) {
|
|
150
|
-
const scopedParams = buildScopedParams(options);
|
|
151
|
-
return code.replace(/from\s+["']@\/([^"']+)["']/g, (_match, path) => {
|
|
152
|
-
const { target, prefix } = buildAliasRewrite(path, options);
|
|
153
|
-
const cacheBuster = getCacheBusterSync(target, options);
|
|
154
|
-
return `from "${prefix}${scopedParams}&v=${cacheBuster}"`;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
function rewriteRelativeImports(code, options) {
|
|
158
|
-
const scopedParams = buildScopedParams(options);
|
|
159
|
-
return code.replace(/from\s+["']((?:\.\.?\/|\/)[^"']+\.js)["']/g, (_match, path) => {
|
|
160
|
-
const { target, prefix } = buildRelativeRewrite(path);
|
|
161
|
-
const cacheBuster = getCacheBusterSync(target, options);
|
|
162
|
-
return `from "${prefix}${scopedParams}&v=${cacheBuster}"`;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
export function applySSRImportRewrites(code, options = {}) {
|
|
166
|
-
let result = rewriteBareImports(code, options.reactVersion);
|
|
167
|
-
result = rewritePathAliases(result, options);
|
|
168
|
-
result = rewriteRelativeImports(result, options);
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
async function replaceAsync(code, pattern, replacer) {
|
|
172
|
-
const chunks = [];
|
|
173
|
-
let lastIndex = 0;
|
|
174
|
-
pattern.lastIndex = 0;
|
|
175
|
-
for (let match = pattern.exec(code); match; match = pattern.exec(code)) {
|
|
176
|
-
chunks.push(code.slice(lastIndex, match.index));
|
|
177
|
-
chunks.push(await replacer(match));
|
|
178
|
-
lastIndex = match.index + match[0].length;
|
|
179
|
-
}
|
|
180
|
-
chunks.push(code.slice(lastIndex));
|
|
181
|
-
return chunks.join("");
|
|
182
|
-
}
|
|
183
|
-
async function rewritePathAliasesAsync(code, options) {
|
|
184
|
-
const scopedParams = buildScopedParams(options);
|
|
185
|
-
return await replaceAsync(code, /from\s+["']@\/([^"']+)["']/g, async (match) => {
|
|
186
|
-
const path = match[1] ?? "";
|
|
187
|
-
const { target, prefix } = buildAliasRewrite(path, options);
|
|
188
|
-
const cacheBuster = await getCacheBusterAsync(target, options);
|
|
189
|
-
return `from "${prefix}${scopedParams}&v=${cacheBuster}"`;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
async function rewriteRelativeImportsAsync(code, options) {
|
|
193
|
-
const scopedParams = buildScopedParams(options);
|
|
194
|
-
return await replaceAsync(code, /from\s+["']((?:\.\.?\/|\/)[^"']+\.js)["']/g, async (match) => {
|
|
195
|
-
const path = match[1] ?? "";
|
|
196
|
-
const { target, prefix } = buildRelativeRewrite(path);
|
|
197
|
-
const cacheBuster = await getCacheBusterAsync(target, options);
|
|
198
|
-
return `from "${prefix}${scopedParams}&v=${cacheBuster}"`;
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
export async function applySSRImportRewritesAsync(code, options = {}) {
|
|
202
|
-
let result = rewriteBareImports(code, options.reactVersion);
|
|
203
|
-
result = await rewritePathAliasesAsync(result, options);
|
|
204
|
-
result = await rewriteRelativeImportsAsync(result, options);
|
|
205
|
-
return result;
|
|
206
|
-
}
|
|
1
|
+
export { resolveSSRImportTargetModulePathCompat as resolveSSRImportTargetModulePath, rewriteSSRImportsCompat as applySSRImportRewrites, rewriteSSRImportsCompatAsync as applySSRImportRewritesAsync, stripSSRModuleJsExtensionCompat as stripSSRModuleJsExtension, } from "../../transforms/import-rewriter/ssr-adapter.js";
|
|
@@ -77,6 +77,28 @@ export interface PageContextProviderProps {
|
|
|
77
77
|
/** Page context value to expose to descendants. */
|
|
78
78
|
pageContext?: PageContextValue;
|
|
79
79
|
}
|
|
80
|
+
/** How a navigation should affect the history stack. */
|
|
81
|
+
type HistoryMode = "push" | "replace" | "none";
|
|
82
|
+
/** Options accepted by the navigation store's `navigate`. */
|
|
83
|
+
interface NavigateOptions {
|
|
84
|
+
history?: HistoryMode;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The cross-bundle navigation store the client router and this React runtime
|
|
88
|
+
* share. This is an inline mirror of `rendering/client/navigation-store.ts`,
|
|
89
|
+
* kept here so the public React runtime bundle does not import the rendering
|
|
90
|
+
* layer. The shared `Symbol.for` key guarantees both bundles resolve the *same*
|
|
91
|
+
* runtime object regardless of which one evaluates first — so `RouterProvider`
|
|
92
|
+
* can subscribe synchronously on its first render, with no boot-order race.
|
|
93
|
+
*/
|
|
94
|
+
interface NavigationStore {
|
|
95
|
+
subscribe(listener: () => void): () => void;
|
|
96
|
+
getHref(): string;
|
|
97
|
+
notify(): void;
|
|
98
|
+
navigate(href: string, options?: NavigateOptions): Promise<void>;
|
|
99
|
+
setNavigator(navigator: (href: string, options?: NavigateOptions) => Promise<void>): void;
|
|
100
|
+
}
|
|
101
|
+
export declare function getNavigationStore(): NavigationStore;
|
|
80
102
|
/**
|
|
81
103
|
* Provides the router context. `pathname`/`query` track the live URL through the
|
|
82
104
|
* shared navigation store's `useSyncExternalStore` surface; `params`/`domain`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/src/react/runtime/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,kDAAkD;AAClD,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,qDAAqD;IACrD,SAAS,EA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Ac/C;AAED,sCAAsC;AACtC,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAED,sEAAsE;AACtE,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAwIpF;AAED,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -50,7 +50,7 @@ function collectHead(data) {
|
|
|
50
50
|
collector?.(data);
|
|
51
51
|
}
|
|
52
52
|
const NAVIGATION_STORE_KEY = Symbol.for("veryfront.navigation.store.v1");
|
|
53
|
-
function getNavigationStore() {
|
|
53
|
+
export function getNavigationStore() {
|
|
54
54
|
const holder = globalThis;
|
|
55
55
|
const existing = holder[NAVIGATION_STORE_KEY];
|
|
56
56
|
if (existing)
|
|
@@ -17,6 +17,14 @@ export declare const MODULE_LOAD_HARD_TIMEOUT_MS = 45000;
|
|
|
17
17
|
export declare const DATA_FETCH_TIMEOUT_MS = 15000;
|
|
18
18
|
/** Timeout for SSR rendering stage */
|
|
19
19
|
export declare const SSR_RENDER_TIMEOUT_MS = 20000;
|
|
20
|
+
/**
|
|
21
|
+
* Human-readable label for the module-loading timeout.
|
|
22
|
+
*
|
|
23
|
+
* Falls back to the route pathname when the slug is empty — the index route's
|
|
24
|
+
* slug is `""`, which otherwise produced a blank timeout label
|
|
25
|
+
* (`"Module loading for "`) that named no route when a cold load stalled.
|
|
26
|
+
*/
|
|
27
|
+
export declare function moduleLoadLabel(slug: string, pathname: string): string;
|
|
20
28
|
/** Module to load for data fetching */
|
|
21
29
|
export interface ModuleToLoad {
|
|
22
30
|
type: "page" | "layout";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-collection.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/module-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,sCAAsC;AACtC,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,OAAO,EACxB,iBAAiB,EAAE,OAAO,EAC1B,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7D,YAAY,EAAE,CAchB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAI7D"}
|
|
1
|
+
{"version":3,"file":"module-collection.d.ts","sourceRoot":"","sources":["../../../../src/src/rendering/orchestrator/module-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,+DAA+D;AAC/D,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C,sCAAsC;AACtC,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,OAAO,EACxB,iBAAiB,EAAE,OAAO,EAC1B,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7D,YAAY,EAAE,CAchB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAI7D"}
|