@absolutejs/absolute 0.19.0-beta.999 → 0.20.0-beta.1
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/LICENSE +21 -13
- package/README.md +48 -2
- package/dist/angular/browser.js +82 -77
- package/dist/angular/browser.js.map +11 -11
- package/dist/angular/components/constants.js +43 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +132 -134
- package/dist/angular/index.js +1719 -844
- package/dist/angular/index.js.map +34 -26
- package/dist/angular/server.js +1620 -768
- package/dist/angular/server.js.map +28 -20
- package/dist/build.js +4935 -2593
- package/dist/build.js.map +72 -57
- package/dist/cli/config/client.js +578 -0
- package/dist/cli/config/server.js +39587 -0
- package/dist/cli/htmx/htmx.min.js +1 -0
- package/dist/cli/index.js +16828 -3511
- package/dist/client/index.js +49 -46
- package/dist/client/index.js.map +12 -12
- package/dist/core/streamingSlotRegistrar.js +1 -19
- package/dist/core/streamingSlotRegistrar.js.map +2 -2
- package/dist/core/streamingSlotRegistry.js +1 -19
- package/dist/core/streamingSlotRegistry.js.map +2 -2
- package/dist/dev/client/cssUtils.ts +98 -41
- package/dist/dev/client/domState.ts +2 -0
- package/dist/dev/client/errorOverlay.ts +14 -13
- package/dist/dev/client/handlers/angularHmrShim.ts +20 -20
- package/dist/dev/client/handlers/angularRemount.ts +74 -55
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -2
- package/dist/dev/client/handlers/html.ts +144 -41
- package/dist/dev/client/handlers/htmx.ts +43 -8
- package/dist/dev/client/handlers/react.ts +114 -32
- package/dist/dev/client/handlers/rebuild.ts +28 -8
- package/dist/dev/client/handlers/svelte.ts +92 -51
- package/dist/dev/client/handlers/vue.ts +36 -45
- package/dist/dev/client/hmrClient.ts +101 -26
- package/dist/dev/client/hmrTiming.ts +141 -0
- package/dist/dev/client/hmrToast.ts +22 -24
- package/dist/dev/client/reactRefreshSetup.ts +4 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.d.ts +12 -0
- package/dist/dev/client/vendor/reactRefreshRuntime.js +313 -0
- package/dist/dev/serverBootstrap.js +45 -0
- package/dist/index.js +7153 -3224
- package/dist/index.js.map +118 -86
- package/dist/islands/browser.js +1 -19
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +709 -120
- package/dist/islands/index.js.map +18 -13
- package/dist/mobile/browser.js +428 -0
- package/dist/mobile/browser.js.map +12 -0
- package/dist/mobile/index.js +3058 -0
- package/dist/mobile/index.js.map +35 -0
- package/dist/react/browser.js +13 -62
- package/dist/react/browser.js.map +5 -6
- package/dist/react/components/browser/index.js +23 -13
- package/dist/react/components/index.js +30 -34
- package/dist/react/components/index.js.map +8 -7
- package/dist/react/hooks/index.js +1 -19
- package/dist/react/hooks/index.js.map +3 -3
- package/dist/react/index.js +1643 -679
- package/dist/react/index.js.map +29 -20
- package/dist/react/jsxDevRuntimeCompat.js +22 -20
- package/dist/react/jsxDevRuntimeCompat.js.map +5 -4
- package/dist/react/jsxRuntimeCompat.js +90 -0
- package/dist/react/jsxRuntimeCompat.js.map +10 -0
- package/dist/react/router/browser.js +77 -0
- package/dist/react/router/browser.js.map +10 -0
- package/dist/react/router/index.js +77 -0
- package/dist/react/router/index.js.map +10 -0
- package/dist/react/server.js +950 -565
- package/dist/react/server.js.map +16 -11
- package/dist/src/angular/components/constants.d.ts +21 -0
- package/dist/src/angular/hmrPreserveCore.d.ts +7 -20
- package/dist/src/angular/islands.d.ts +1 -1
- package/dist/src/angular/pageHandler.d.ts +2 -0
- package/dist/src/angular/ssrRender.d.ts +4 -1
- package/dist/src/build/bunStringRawUnicodePlugin.d.ts +12 -0
- package/dist/src/build/chainInlineSourcemaps.d.ts +1 -0
- package/dist/src/build/compileAngular.d.ts +5 -7
- package/dist/src/build/compileSvelte.d.ts +3 -0
- package/dist/src/build/compileVue.d.ts +3 -1
- package/dist/src/build/generateReactIndexes.d.ts +1 -0
- package/dist/src/build/islandRegistryTransform.d.ts +17 -0
- package/dist/src/build/maskLiterals.d.ts +28 -0
- package/dist/src/build/parseVueSpaRoutes.d.ts +5 -0
- package/dist/src/build/resolveBuildMode.d.ts +7 -0
- package/dist/src/build/serverExternals.d.ts +14 -0
- package/dist/src/build/spaSideManifests.d.ts +16 -0
- package/dist/src/build/tailwindCompiler.d.ts +0 -1
- package/dist/src/cli/add/dependencies.d.ts +13 -0
- package/dist/src/cli/config/absolute/AbsoluteConfigPanel.d.ts +6 -0
- package/dist/src/cli/config/absolute/editAbsoluteConfig.d.ts +5 -0
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +19 -0
- package/dist/src/cli/config/auth/AuthPanel.d.ts +6 -0
- package/dist/src/cli/config/auth/authCatalog.d.ts +10 -0
- package/dist/src/cli/config/auth/authScaffolds.d.ts +16 -0
- package/dist/src/cli/config/auth/editAuthConfig.d.ts +5 -0
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +14 -0
- package/dist/src/cli/config/auth/resolveAuthState.d.ts +2 -0
- package/dist/src/cli/config/auth/scaffoldAuthFeature.d.ts +6 -0
- package/dist/src/cli/config/client.d.ts +1 -0
- package/dist/src/cli/config/configCert.d.ts +12 -0
- package/dist/src/cli/config/eslint/EslintPanel.d.ts +6 -0
- package/dist/src/cli/config/eslint/configAst.d.ts +18 -0
- package/dist/src/cli/config/eslint/editConfigRule.d.ts +6 -0
- package/dist/src/cli/config/eslint/eslintStyles.d.ts +1 -0
- package/dist/src/cli/config/eslint/resolveConfig.d.ts +3 -0
- package/dist/src/cli/config/eslint/serializeValue.d.ts +9 -0
- package/dist/src/cli/config/guards.d.ts +4 -0
- package/dist/src/cli/config/integrations/IntegrationsPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/PackageJsonPanel.d.ts +6 -0
- package/dist/src/cli/config/packageJson/editPackageJson.d.ts +9 -0
- package/dist/src/cli/config/packageJson/resolvePackageJson.d.ts +8 -0
- package/dist/src/cli/config/page/ConfigShell.d.ts +6 -0
- package/dist/src/cli/config/page/FieldEditor.d.ts +9 -0
- package/dist/src/cli/config/page/PanelHost.d.ts +6 -0
- package/dist/src/cli/config/page/configStyles.d.ts +1 -0
- package/dist/src/cli/config/panels.d.ts +7 -0
- package/dist/src/cli/config/prettier/PrettierPanel.d.ts +6 -0
- package/dist/src/cli/config/prettier/editPrettier.d.ts +5 -0
- package/dist/src/cli/config/prettier/resolvePrettier.d.ts +11 -0
- package/dist/src/cli/config/schema/fromJsonSchema.d.ts +3 -0
- package/dist/src/cli/config/schema/fromType.d.ts +1 -0
- package/dist/src/cli/config/schema/serialize.d.ts +1 -0
- package/dist/src/cli/config/server.d.ts +527 -0
- package/dist/src/cli/config/tsconfig/TsconfigPanel.d.ts +6 -0
- package/dist/src/cli/config/tsconfig/editTsconfig.d.ts +5 -0
- package/dist/src/cli/config/tsconfig/resolveTsconfig.d.ts +8 -0
- package/dist/src/cli/config/tsconfig/tsconfigStyles.d.ts +1 -0
- package/dist/src/cli/discoverInstances.d.ts +5 -0
- package/dist/src/cli/elysiaOpenApiTypeboxPlugin.d.ts +8 -0
- package/dist/src/cli/generate/componentTemplates.d.ts +7 -0
- package/dist/src/cli/generate/context.d.ts +30 -0
- package/dist/src/cli/generate/cssStrategy.d.ts +20 -0
- package/dist/src/cli/generate/frameworkKey.d.ts +3 -0
- package/dist/src/cli/generate/frameworks.d.ts +40 -0
- package/dist/src/cli/generate/generateApi.d.ts +3 -0
- package/dist/src/cli/generate/generateComponent.d.ts +4 -0
- package/dist/src/cli/generate/generatePage.d.ts +4 -0
- package/dist/src/cli/generate/naming.d.ts +5 -0
- package/dist/src/cli/generate/navData.d.ts +10 -0
- package/dist/src/cli/generate/outcome.d.ts +17 -0
- package/dist/src/cli/generate/pageTemplates.d.ts +11 -0
- package/dist/src/cli/generate/routeWiring.d.ts +40 -0
- package/dist/src/cli/generate/staticNav.d.ts +5 -0
- package/dist/src/cli/heapDiff.d.ts +1 -0
- package/dist/src/cli/htmx/install.d.ts +6 -0
- package/dist/src/cli/inspectData.d.ts +12 -0
- package/dist/src/cli/inspectTui.d.ts +1 -0
- package/dist/src/cli/instanceStatus.d.ts +22 -0
- package/dist/src/cli/integrations/addPlugin.d.ts +8 -0
- package/dist/src/cli/integrations/catalog.d.ts +20 -0
- package/dist/src/cli/psTui.d.ts +1 -0
- package/dist/src/cli/scripts/add.d.ts +1 -0
- package/dist/src/cli/scripts/analyze.d.ts +1 -0
- package/dist/src/cli/scripts/api.d.ts +1 -0
- package/dist/src/cli/scripts/build.d.ts +1 -1
- package/dist/src/cli/scripts/db.d.ts +20 -0
- package/dist/src/cli/scripts/dev.d.ts +5 -1
- package/dist/src/cli/scripts/doctor.d.ts +1 -0
- package/dist/src/cli/scripts/env.d.ts +7 -0
- package/dist/src/cli/scripts/eslint.d.ts +37 -2
- package/dist/src/cli/scripts/eslintChunked.d.ts +37 -0
- package/dist/src/cli/scripts/generate.d.ts +1 -0
- package/dist/src/cli/scripts/htmx.d.ts +1 -0
- package/dist/src/cli/scripts/inspect.d.ts +1 -0
- package/dist/src/cli/scripts/islands.d.ts +1 -0
- package/dist/src/cli/scripts/lintProof.d.ts +42 -0
- package/dist/src/cli/scripts/logs.d.ts +1 -0
- package/dist/src/cli/scripts/ls.d.ts +1 -0
- package/dist/src/cli/scripts/mem.d.ts +1 -0
- package/dist/src/cli/scripts/mobile.d.ts +1 -0
- package/dist/src/cli/scripts/prettier.d.ts +2 -0
- package/dist/src/cli/scripts/ps.d.ts +1 -0
- package/dist/src/cli/scripts/remove.d.ts +1 -0
- package/dist/src/cli/scripts/routes.d.ts +1 -0
- package/dist/src/cli/scripts/start.d.ts +6 -1
- package/dist/src/cli/scripts/tunnelRelay.d.ts +9 -0
- package/dist/src/cli/scripts/workspace.d.ts +3 -1
- package/dist/src/cli/serverBundleExternals.d.ts +2 -0
- package/dist/src/cli/tuiPrimitives.d.ts +14 -0
- package/dist/src/cli/typeGraphCoherence.d.ts +32 -0
- package/dist/src/cli/utils.d.ts +3 -1
- package/dist/src/cli/workspaceTui.d.ts +2 -1
- package/dist/src/client/hydrators/react.d.ts +1 -1
- package/dist/src/client/hydrators/svelte.d.ts +1 -1
- package/dist/src/client/hydrators/vue.d.ts +1 -1
- package/dist/src/client/islandStore.d.ts +3 -3
- package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
- package/dist/src/constants.d.ts +21 -0
- package/dist/src/core/angularServerModule.d.ts +1 -0
- package/dist/src/core/build.d.ts +11 -3
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
- package/dist/src/core/index.d.ts +1 -0
- package/dist/src/core/pageResponseCache.d.ts +23 -0
- package/dist/src/core/prepare.d.ts +192 -154
- package/dist/src/core/requestContext.d.ts +18 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +5 -3
- package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
- package/dist/src/dev/clientManager.d.ts +10 -1
- package/dist/src/dev/configResolver.d.ts +2 -0
- package/dist/src/dev/moduleMapper.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -1
- package/dist/src/dev/pathUtils.d.ts +1 -1
- package/dist/src/dev/reactComponentClassifier.d.ts +1 -1
- package/dist/src/dev/rebuildTrigger.d.ts +4 -0
- package/dist/src/dev/requestInspector.d.ts +31 -0
- package/dist/src/dev/serverBootstrap.d.ts +1 -0
- package/dist/src/dev/serverEntryWatcher.d.ts +3 -3
- package/dist/src/dev/tunnel/client.d.ts +20 -0
- package/dist/src/dev/tunnel/protocol.d.ts +85 -0
- package/dist/src/dev/tunnel/relay.d.ts +28 -0
- package/dist/src/dev/webSocket.d.ts +1 -1
- package/dist/src/mobile/androidConformance.d.ts +42 -0
- package/dist/src/mobile/androidEmulatorController.d.ts +99 -0
- package/dist/src/mobile/androidNativeWatcher.d.ts +19 -0
- package/dist/src/mobile/androidRelease.d.ts +47 -0
- package/dist/src/mobile/androidWebView.d.ts +46 -0
- package/dist/src/mobile/artifactStore.d.ts +47 -0
- package/dist/src/mobile/associationFiles.d.ts +49 -0
- package/dist/src/mobile/browser.d.ts +2 -0
- package/dist/src/mobile/buildMetadata.d.ts +10 -0
- package/dist/src/mobile/buildPipeline.d.ts +8 -0
- package/dist/src/mobile/buildRelease.d.ts +24 -0
- package/dist/src/mobile/capacitorBundle.d.ts +28 -0
- package/dist/src/mobile/capacitorProject.d.ts +9 -0
- package/dist/src/mobile/client.d.ts +35 -0
- package/dist/src/mobile/compatibilityDispatcher.d.ts +26 -0
- package/dist/src/mobile/config.d.ts +16 -0
- package/dist/src/mobile/emulatorDoctor.d.ts +25 -0
- package/dist/src/mobile/emulatorInstaller.d.ts +41 -0
- package/dist/src/mobile/index.d.ts +19 -0
- package/dist/src/mobile/materializedBundle.d.ts +36 -0
- package/dist/src/mobile/nativeDeepLinks.d.ts +5 -0
- package/dist/src/mobile/pageProtocol.d.ts +89 -0
- package/dist/src/mobile/producerContext.d.ts +4 -0
- package/dist/src/mobile/producerContextState.d.ts +10 -0
- package/dist/src/mobile/releaseArtifact.d.ts +75 -0
- package/dist/src/mobile/releaseDoctor.d.ts +13 -0
- package/dist/src/mobile/routeMatcher.d.ts +3 -0
- package/dist/src/mobile/routeMetadataTransform.d.ts +13 -0
- package/dist/src/mobile/shellBootstrap.d.ts +1 -0
- package/dist/src/mobile/transport.d.ts +31 -0
- package/dist/src/plugins/devtoolsJson.d.ts +6 -47
- package/dist/src/plugins/hmr.d.ts +22 -96
- package/dist/src/plugins/imageOptimizer.d.ts +150 -62
- package/dist/src/plugins/networking.d.ts +2 -2
- package/dist/src/plugins/openApiPlugin.d.ts +4 -0
- package/dist/src/plugins/telemetryPlugin.d.ts +36 -0
- package/dist/src/react/browser.d.ts +0 -2
- package/dist/src/react/hooks/useMediaQuery.d.ts +1 -1
- package/dist/src/react/index.d.ts +0 -2
- package/dist/src/react/jsxDevRuntimeCompat.d.ts +1 -1
- package/dist/src/react/jsxRuntimeCompat.d.ts +7 -0
- package/dist/src/react/pageHandler.d.ts +8 -0
- package/dist/src/react/router/UniversalRouter.d.ts +43 -0
- package/dist/src/react/router/browser.d.ts +2 -0
- package/dist/src/react/router/index.d.ts +2 -0
- package/dist/src/svelte/pageHandler.d.ts +5 -0
- package/dist/src/svelte/router/hashMode.d.ts +1 -6
- package/dist/src/svelte/router/matchPath.d.ts +4 -24
- package/dist/src/svelte/router/page.svelte.d.ts +1 -10
- package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
- package/dist/src/utils/cleanup.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +2 -2
- package/dist/src/utils/defineEnv.d.ts +4 -4
- package/dist/src/utils/formatBytes.d.ts +2 -0
- package/dist/src/utils/generatedDir.d.ts +1 -1
- package/dist/src/utils/iconVersion.d.ts +5 -0
- package/dist/src/utils/imageProcessing.d.ts +1 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/inlinePageCss.d.ts +9 -0
- package/dist/src/utils/instanceRegistry.d.ts +13 -0
- package/dist/src/utils/isTestSourcePath.d.ts +1 -0
- package/dist/src/utils/jsonLd.d.ts +1 -1
- package/dist/src/utils/loadConfig.d.ts +11 -3
- package/dist/src/utils/logger.d.ts +2 -0
- package/dist/src/utils/portScan.d.ts +22 -0
- package/dist/src/utils/projectRoot.d.ts +17 -0
- package/dist/src/utils/resolveConvention.d.ts +1 -1
- package/dist/src/utils/resolveDevPort.d.ts +4 -1
- package/dist/src/utils/runtimeMode.d.ts +1 -1
- package/dist/src/utils/spaRouteCss.d.ts +10 -0
- package/dist/src/utils/spaRouteManifest.d.ts +8 -0
- package/dist/src/utils/stripStringsAndComments.d.ts +18 -0
- package/dist/src/utils/userAgentFunctions.d.ts +1 -1
- package/dist/src/utils/vueCompiler.d.ts +1 -0
- package/dist/src/vue/components/Image.d.ts +2 -2
- package/dist/src/vue/defineVuePage.d.ts +1 -11
- package/dist/src/vue/index.d.ts +3 -0
- package/dist/src/vue/pageHandler.d.ts +5 -0
- package/dist/src/vue/resolveGeneratedVueModulePath.d.ts +1 -0
- package/dist/src/vue/teleports.d.ts +2 -0
- package/dist/src/vue/useResource.d.ts +65 -0
- package/dist/svelte/browser.js +1 -19
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/components/Head.svelte +7 -1
- package/dist/svelte/index.js +1281 -543
- package/dist/svelte/index.js.map +27 -19
- package/dist/svelte/router/Link.svelte.d.ts +3 -3
- package/dist/svelte/router/Route.svelte.d.ts +5 -5
- package/dist/svelte/router/Router.svelte.d.ts +3 -3
- package/dist/svelte/router/hashMode.ts +6 -12
- package/dist/svelte/router/matchPath.ts +44 -61
- package/dist/svelte/router/page.d.ts +1 -10
- package/dist/svelte/router/page.js +6 -6
- package/dist/svelte/router/prefetchCache.ts +21 -23
- package/dist/svelte/router/viewTransitions.ts +22 -12
- package/dist/svelte/server.js +697 -565
- package/dist/svelte/server.js.map +14 -11
- package/dist/types/absoluteConfig.d.ts +22 -0
- package/dist/types/angular.d.ts +4 -1
- package/dist/types/authPanel.d.ts +62 -0
- package/dist/types/build.d.ts +116 -0
- package/dist/types/cli.d.ts +57 -0
- package/dist/types/config.d.ts +52 -0
- package/dist/types/eslintConfig.d.ts +68 -0
- package/dist/types/globals.d.ts +31 -10
- package/dist/types/image.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/integrationsPanel.d.ts +29 -0
- package/dist/types/messages.d.ts +12 -0
- package/dist/types/packageJson.d.ts +74 -0
- package/dist/types/packageJsonPanel.d.ts +29 -0
- package/dist/types/prettier.d.ts +26 -0
- package/dist/types/tsconfig.d.ts +31 -0
- package/dist/types/vue.d.ts +13 -15
- package/dist/vue/browser.js +14 -36
- package/dist/vue/browser.js.map +5 -5
- package/dist/vue/components/Image.js +3 -20
- package/dist/vue/components/Image.js.map +3 -3
- package/dist/vue/components/index.js +3 -20
- package/dist/vue/components/index.js.map +3 -3
- package/dist/vue/index.js +1573 -620
- package/dist/vue/index.js.map +34 -22
- package/dist/vue/server.js +800 -520
- package/dist/vue/server.js.map +17 -11
- package/package.json +145 -68
- package/dist/src/react/UniversalRouter.d.ts +0 -12
package/dist/svelte/server.js
CHANGED
|
@@ -3,7 +3,6 @@ var __create = Object.create;
|
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
7
|
function __accessProp(key) {
|
|
9
8
|
return this[key];
|
|
@@ -30,23 +29,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
30
29
|
cache.set(mod, to);
|
|
31
30
|
return to;
|
|
32
31
|
};
|
|
33
|
-
var __toCommonJS = (from) => {
|
|
34
|
-
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
35
|
-
if (entry)
|
|
36
|
-
return entry;
|
|
37
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
38
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
-
for (var key of __getOwnPropNames(from))
|
|
40
|
-
if (!__hasOwnProp.call(entry, key))
|
|
41
|
-
__defProp(entry, key, {
|
|
42
|
-
get: __accessProp.bind(from, key),
|
|
43
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
__moduleCache.set(from, entry);
|
|
47
|
-
return entry;
|
|
48
|
-
};
|
|
49
|
-
var __moduleCache;
|
|
50
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
51
33
|
var __returnValue = (v) => v;
|
|
52
34
|
function __exportSetter(name, newValue) {
|
|
@@ -134,8 +116,9 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
134
116
|
var init_resolvePackageImport = () => {};
|
|
135
117
|
|
|
136
118
|
// src/constants.ts
|
|
137
|
-
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
119
|
+
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", TAILWIND_BUN_CSS_WARNING_PATTERN, BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, DEFAULT_WEBSOCKET_IDLE_TIMEOUT_SECONDS = 240, DEFAULT_HTTP_IDLE_TIMEOUT_SECONDS = 240, MAX_HTTP_IDLE_TIMEOUT_SECONDS = 255, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
138
120
|
var init_constants = __esm(() => {
|
|
121
|
+
TAILWIND_BUN_CSS_WARNING_PATTERN = /invalid @ rule encountered: '@(theme|tailwind|source|utility|variant|custom-variant|apply|reference|plugin|config)'/;
|
|
139
122
|
IMAGE_DEFAULT_DEVICE_SIZES = [
|
|
140
123
|
640,
|
|
141
124
|
750,
|
|
@@ -1072,22 +1055,20 @@ __export(exports_devRouteRegistrationCallsite, {
|
|
|
1072
1055
|
});
|
|
1073
1056
|
import { AsyncLocalStorage } from "async_hooks";
|
|
1074
1057
|
import { Elysia } from "elysia";
|
|
1075
|
-
var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, handlerSourceMentionsPageHelper = (handler) => {
|
|
1058
|
+
var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, NODE_ENV_KEY = "NODE_ENV", ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, isPageHandlerFunction = (value) => typeof value === "function", handlerSourceMentionsPageHelper = (handler) => {
|
|
1076
1059
|
const source = handler.toString();
|
|
1077
1060
|
return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
|
|
1061
|
+
}, getOriginalPageHandlerSource = (handler) => {
|
|
1062
|
+
if (!isPageHandlerFunction(handler))
|
|
1063
|
+
return;
|
|
1064
|
+
const info = pageHandlerWrappers.get(handler);
|
|
1065
|
+
return (info?.originalHandler ?? handler).toString();
|
|
1078
1066
|
}, isPageHandler = (handler) => {
|
|
1079
|
-
if (
|
|
1067
|
+
if (!isPageHandlerFunction(handler))
|
|
1080
1068
|
return false;
|
|
1081
|
-
|
|
1082
|
-
if (pageHandlerWrappers.has(fn))
|
|
1069
|
+
if (pageHandlerWrappers.has(handler))
|
|
1083
1070
|
return true;
|
|
1084
|
-
return handlerSourceMentionsPageHelper(
|
|
1085
|
-
}, getOriginalPageHandlerSource = (handler) => {
|
|
1086
|
-
if (typeof handler !== "function")
|
|
1087
|
-
return;
|
|
1088
|
-
const fn = handler;
|
|
1089
|
-
const info = pageHandlerWrappers.get(fn);
|
|
1090
|
-
return (info?.originalHandler ?? fn).toString();
|
|
1071
|
+
return handlerSourceMentionsPageHelper(handler);
|
|
1091
1072
|
}, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
|
|
1092
1073
|
const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
|
|
1093
1074
|
if (value === null || typeof value === "undefined") {
|
|
@@ -1121,17 +1102,22 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
1121
1102
|
return function wrappedRouteHandler(...args) {
|
|
1122
1103
|
return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
|
|
1123
1104
|
};
|
|
1124
|
-
}, createPatchedRouteMethod = (originalMethod, methodName) => function patchedRouteMethod(path,
|
|
1105
|
+
}, createPatchedRouteMethod = (originalMethod, methodName) => function patchedRouteMethod(path, ...routeArguments) {
|
|
1106
|
+
const handlerIndex = routeArguments.length >= 2 ? 1 : 0;
|
|
1107
|
+
const handler = routeArguments[handlerIndex];
|
|
1125
1108
|
const callsite = captureRouteRegistrationCallsite();
|
|
1126
1109
|
const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
|
|
1127
|
-
if (methodName === "get" &&
|
|
1110
|
+
if (methodName === "get" && isPageHandlerFunction(handler) && isPageHandlerFunction(wrapped) && handlerSourceMentionsPageHelper(handler)) {
|
|
1128
1111
|
pageHandlerWrappers.set(wrapped, {
|
|
1129
1112
|
originalHandler: handler
|
|
1130
1113
|
});
|
|
1131
1114
|
}
|
|
1132
|
-
|
|
1115
|
+
routeArguments[handlerIndex] = wrapped;
|
|
1116
|
+
return Reflect.apply(originalMethod, this, [path, ...routeArguments]);
|
|
1133
1117
|
}, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
|
|
1134
|
-
if (
|
|
1118
|
+
if (process.env[NODE_ENV_KEY] === "production") {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1135
1121
|
if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
|
|
1136
1122
|
return;
|
|
1137
1123
|
}
|
|
@@ -1168,6 +1154,43 @@ var init_devRouteRegistrationCallsite = __esm(() => {
|
|
|
1168
1154
|
pageHandlerWrappers = new WeakMap;
|
|
1169
1155
|
});
|
|
1170
1156
|
|
|
1157
|
+
// src/core/pageResponseCache.ts
|
|
1158
|
+
import { createHash as createHash2 } from "crypto";
|
|
1159
|
+
var STREAMING_PAGE_HEADER = "x-absolute-stream", HTML_CONTENT_TYPE = "text/html", streamingPageHeaders = (extra) => {
|
|
1160
|
+
const headers = new Headers(extra);
|
|
1161
|
+
headers.set("content-type", HTML_CONTENT_TYPE);
|
|
1162
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
1163
|
+
return headers;
|
|
1164
|
+
}, computeEtag = (html) => `W/"${createHash2("sha1").update(html).digest("base64url")}"`, withPageCacheHeaders = async (response, request, options) => {
|
|
1165
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
1166
|
+
if (!contentType.includes(HTML_CONTENT_TYPE))
|
|
1167
|
+
return response;
|
|
1168
|
+
const isStreaming = response.headers.get(STREAMING_PAGE_HEADER) === "1";
|
|
1169
|
+
if (isStreaming && !options?.bufferStreamForEtag || !response.body) {
|
|
1170
|
+
response.headers.delete(STREAMING_PAGE_HEADER);
|
|
1171
|
+
response.headers.set("cache-control", "no-cache");
|
|
1172
|
+
return response;
|
|
1173
|
+
}
|
|
1174
|
+
const html = await response.text();
|
|
1175
|
+
const etag = computeEtag(html);
|
|
1176
|
+
if (request?.headers.get("if-none-match") === etag) {
|
|
1177
|
+
return new Response(null, {
|
|
1178
|
+
headers: { "cache-control": "no-cache", etag },
|
|
1179
|
+
status: 304
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
const headers = new Headers(response.headers);
|
|
1183
|
+
headers.delete(STREAMING_PAGE_HEADER);
|
|
1184
|
+
headers.set("cache-control", "no-cache");
|
|
1185
|
+
headers.set("etag", etag);
|
|
1186
|
+
return new Response(html, {
|
|
1187
|
+
headers,
|
|
1188
|
+
status: response.status,
|
|
1189
|
+
statusText: response.statusText
|
|
1190
|
+
});
|
|
1191
|
+
};
|
|
1192
|
+
var init_pageResponseCache = () => {};
|
|
1193
|
+
|
|
1171
1194
|
// src/client/streamSwap.ts
|
|
1172
1195
|
var streamSwapRuntime = () => {
|
|
1173
1196
|
const absoluteWindow = window;
|
|
@@ -1953,6 +1976,19 @@ var colors2, frameworkColors, formatPath = (filePath) => {
|
|
|
1953
1976
|
const errorMsg = error instanceof Error ? error.message : error;
|
|
1954
1977
|
const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
|
|
1955
1978
|
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
1979
|
+
}, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
|
|
1980
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1981
|
+
const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
|
|
1982
|
+
const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
|
|
1983
|
+
const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
|
|
1984
|
+
const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
|
|
1985
|
+
let action = "failed after";
|
|
1986
|
+
if (outcome === "applied")
|
|
1987
|
+
action = "applied in";
|
|
1988
|
+
else if (outcome === "reloaded")
|
|
1989
|
+
action = "falling back to reload after";
|
|
1990
|
+
const kindLabel = kind ? `${kind} ` : "";
|
|
1991
|
+
console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
|
|
1956
1992
|
}, logHmrUpdate = (path, framework, duration) => {
|
|
1957
1993
|
log("hmr update", { duration, framework, path });
|
|
1958
1994
|
}, logInfo = (message) => {
|
|
@@ -1992,6 +2028,37 @@ var init_logger = __esm(() => {
|
|
|
1992
2028
|
};
|
|
1993
2029
|
});
|
|
1994
2030
|
|
|
2031
|
+
// src/utils/inlinePageCss.ts
|
|
2032
|
+
var siblingCssCache, clearSiblingCssCache = () => {
|
|
2033
|
+
siblingCssCache.clear();
|
|
2034
|
+
}, injectInlineCss = (headTag, css) => {
|
|
2035
|
+
if (!css)
|
|
2036
|
+
return headTag;
|
|
2037
|
+
const styleBlock = `<style data-absolute-page-css>${css}</style>`;
|
|
2038
|
+
return headTag.replace("</head>", `${styleBlock}</head>`);
|
|
2039
|
+
}, readSiblingCss = async (siblingJsPath) => {
|
|
2040
|
+
if (!siblingJsPath)
|
|
2041
|
+
return "";
|
|
2042
|
+
const cssPath = siblingJsPath.replace(/\.js$/, ".css");
|
|
2043
|
+
if (cssPath === siblingJsPath)
|
|
2044
|
+
return "";
|
|
2045
|
+
const cached = siblingCssCache.get(cssPath);
|
|
2046
|
+
if (cached !== undefined)
|
|
2047
|
+
return cached;
|
|
2048
|
+
const { readFile: readFile2 } = await import("fs/promises");
|
|
2049
|
+
try {
|
|
2050
|
+
const css = await readFile2(cssPath, "utf-8");
|
|
2051
|
+
siblingCssCache.set(cssPath, css);
|
|
2052
|
+
return css;
|
|
2053
|
+
} catch {
|
|
2054
|
+
siblingCssCache.set(cssPath, "");
|
|
2055
|
+
return "";
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
var init_inlinePageCss = __esm(() => {
|
|
2059
|
+
siblingCssCache = new Map;
|
|
2060
|
+
});
|
|
2061
|
+
|
|
1995
2062
|
// src/utils/ssrErrorPage.ts
|
|
1996
2063
|
var exports_ssrErrorPage = {};
|
|
1997
2064
|
__export(exports_ssrErrorPage, {
|
|
@@ -2056,194 +2123,530 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
|
|
|
2056
2123
|
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
2057
2124
|
};
|
|
2058
2125
|
|
|
2059
|
-
// src/
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
});
|
|
2065
|
-
var SVELTE_PAGE_ROOT_ID = "__absolute_svelte_root__", renderToReadableStream = async (component, props, {
|
|
2066
|
-
bootstrapScriptContent,
|
|
2067
|
-
bootstrapScripts = [],
|
|
2068
|
-
bootstrapModules = [],
|
|
2069
|
-
nonce,
|
|
2070
|
-
onError = console.error,
|
|
2071
|
-
progressiveChunkSize = DEFAULT_CHUNK_SIZE,
|
|
2072
|
-
signal,
|
|
2073
|
-
headContent,
|
|
2074
|
-
bodyContent
|
|
2075
|
-
} = {}) => {
|
|
2076
|
-
try {
|
|
2077
|
-
const { render } = await import("svelte/server");
|
|
2078
|
-
const renderComponent = render;
|
|
2079
|
-
const rendered = typeof props === "undefined" ? await renderComponent(component) : await renderComponent(component, { props });
|
|
2080
|
-
const { head, body } = rendered;
|
|
2081
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
2082
|
-
const scripts = (bootstrapScriptContent ? `<script${nonceAttr}>${escapeScriptContent(bootstrapScriptContent)}</script>` : "") + bootstrapScripts.map((src) => `<script${nonceAttr} src="${src}"></script>`).join("") + bootstrapModules.map((src) => `<script${nonceAttr} type="module" src="${src}"></script>`).join("");
|
|
2083
|
-
const encoder = new TextEncoder;
|
|
2084
|
-
const full = encoder.encode(`<!DOCTYPE html><html lang="en"><head>${head}${headContent ?? ""}</head><body><div id="${SVELTE_PAGE_ROOT_ID}">${body}</div>${scripts}${bodyContent ?? ""}</body></html>`);
|
|
2085
|
-
let offset = 0;
|
|
2086
|
-
return new ReadableStream({
|
|
2087
|
-
type: "bytes",
|
|
2088
|
-
cancel(reason) {
|
|
2089
|
-
onError?.(reason);
|
|
2090
|
-
},
|
|
2091
|
-
pull(controller) {
|
|
2092
|
-
if (signal?.aborted) {
|
|
2093
|
-
controller.close();
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
2096
|
-
if (offset >= full.length) {
|
|
2097
|
-
controller.close();
|
|
2098
|
-
return;
|
|
2099
|
-
}
|
|
2100
|
-
const end = Math.min(offset + progressiveChunkSize, full.length);
|
|
2101
|
-
controller.enqueue(full.subarray(offset, end));
|
|
2102
|
-
offset = end;
|
|
2103
|
-
}
|
|
2104
|
-
});
|
|
2105
|
-
} catch (error) {
|
|
2106
|
-
onError?.(error);
|
|
2107
|
-
throw error;
|
|
2108
|
-
}
|
|
2109
|
-
};
|
|
2110
|
-
var init_renderToReadableStream = __esm(() => {
|
|
2111
|
-
init_constants();
|
|
2112
|
-
init_escapeScriptContent();
|
|
2113
|
-
});
|
|
2114
|
-
|
|
2115
|
-
// src/core/streamingSlotRegistrar.ts
|
|
2116
|
-
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
2117
|
-
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
2118
|
-
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
2119
|
-
var getRegisteredStreamingSlotRegistrar = () => {
|
|
2120
|
-
const value = Reflect.get(globalThis, STREAMING_SLOT_REGISTRAR_KEY);
|
|
2121
|
-
if (typeof value === "function" || value === null) {
|
|
2126
|
+
// src/utils/resolveConvention.ts
|
|
2127
|
+
import { basename as basename2 } from "path";
|
|
2128
|
+
var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
|
|
2129
|
+
const value = Reflect.get(globalThis, CONVENTIONS_KEY);
|
|
2130
|
+
if (isConventionsMap(value))
|
|
2122
2131
|
return value;
|
|
2123
|
-
}
|
|
2124
|
-
return;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
};
|
|
2141
|
-
var hasRegisteredStreamingSlotRegistrar = () => typeof getRegisteredStreamingSlotRegistrar() === "function";
|
|
2142
|
-
var isStreamingSlotCollectionActive = () => getCollectionController()?.isCollecting() === true;
|
|
2143
|
-
var registerStreamingSlot = (slot) => {
|
|
2144
|
-
getRegisteredStreamingSlotRegistrar()?.(slot);
|
|
2145
|
-
};
|
|
2146
|
-
var setStreamingSlotCollectionController = (controller) => {
|
|
2147
|
-
Reflect.set(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY, controller);
|
|
2148
|
-
};
|
|
2149
|
-
var setStreamingSlotRegistrar = (nextRegistrar) => {
|
|
2150
|
-
Reflect.set(globalThis, STREAMING_SLOT_REGISTRAR_KEY, nextRegistrar);
|
|
2151
|
-
};
|
|
2152
|
-
var setStreamingSlotWarningController = (controller) => {
|
|
2153
|
-
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
|
|
2154
|
-
};
|
|
2155
|
-
var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
2156
|
-
if (isStreamingSlotCollectionActive()) {
|
|
2132
|
+
const empty = {};
|
|
2133
|
+
return empty;
|
|
2134
|
+
}, derivePageName = (pagePath) => {
|
|
2135
|
+
const base = basename2(pagePath);
|
|
2136
|
+
const dotIndex = base.indexOf(".");
|
|
2137
|
+
const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
|
|
2138
|
+
return toPascal(name);
|
|
2139
|
+
}, normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, ""), hasErrorConvention = (framework) => {
|
|
2140
|
+
const conventions = getMap()[framework];
|
|
2141
|
+
if (!conventions)
|
|
2142
|
+
return false;
|
|
2143
|
+
if (conventions.defaults?.error)
|
|
2144
|
+
return true;
|
|
2145
|
+
return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
|
|
2146
|
+
}, resolveErrorConventionPath = (framework, pageName) => {
|
|
2147
|
+
const conventions = getMap()[framework];
|
|
2148
|
+
if (!conventions)
|
|
2157
2149
|
return;
|
|
2150
|
+
const exact = conventions.pages?.[pageName]?.error;
|
|
2151
|
+
if (exact)
|
|
2152
|
+
return exact;
|
|
2153
|
+
const normalizedPageName = normalizeConventionPageName(pageName);
|
|
2154
|
+
for (const [candidate, page] of Object.entries(conventions.pages ?? {})) {
|
|
2155
|
+
if (normalizeConventionPageName(candidate) === normalizedPageName) {
|
|
2156
|
+
return page.error ?? conventions.defaults?.error;
|
|
2157
|
+
}
|
|
2158
2158
|
}
|
|
2159
|
-
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
2165
|
-
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
2166
|
-
var getStorageGlobal = () => {
|
|
2167
|
-
const value = Reflect.get(globalThis, STREAMING_SLOT_STORAGE_KEY);
|
|
2168
|
-
if (value === null || typeof value === "undefined") {
|
|
2169
|
-
return value;
|
|
2170
|
-
}
|
|
2171
|
-
return isAsyncLocalStorage(value) ? value : undefined;
|
|
2172
|
-
};
|
|
2173
|
-
var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
|
|
2174
|
-
var ensureAsyncLocalStorage = async () => {
|
|
2175
|
-
const storage = getStorageGlobal();
|
|
2176
|
-
if (typeof storage !== "undefined") {
|
|
2177
|
-
return storage;
|
|
2178
|
-
}
|
|
2179
|
-
if (!isServerRuntime()) {
|
|
2180
|
-
Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, null);
|
|
2181
|
-
return getStorageGlobal();
|
|
2182
|
-
}
|
|
2183
|
-
const mod = await import("async_hooks");
|
|
2184
|
-
Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, new mod.AsyncLocalStorage);
|
|
2185
|
-
return getStorageGlobal();
|
|
2186
|
-
};
|
|
2187
|
-
var getActiveSlotStore = () => {
|
|
2188
|
-
const storage = getStorageGlobal();
|
|
2189
|
-
if (!storage)
|
|
2190
|
-
return;
|
|
2191
|
-
return storage.getStore();
|
|
2192
|
-
};
|
|
2193
|
-
var registerStreamingSlot2 = (slot) => {
|
|
2194
|
-
const store = getActiveSlotStore();
|
|
2195
|
-
if (!store)
|
|
2196
|
-
return;
|
|
2197
|
-
store.set(slot.id, slot);
|
|
2198
|
-
};
|
|
2199
|
-
setStreamingSlotRegistrar(registerStreamingSlot2);
|
|
2200
|
-
setStreamingSlotCollectionController({
|
|
2201
|
-
isCollecting: () => getActiveSlotStore() !== undefined
|
|
2202
|
-
});
|
|
2203
|
-
var hasActiveStreamingSlotRegistry = () => getActiveSlotStore() !== undefined;
|
|
2204
|
-
var runWithStreamingSlotRegistry = async (task) => {
|
|
2205
|
-
const storage = await ensureAsyncLocalStorage();
|
|
2206
|
-
if (!storage) {
|
|
2207
|
-
const slots = [];
|
|
2159
|
+
return conventions.defaults?.error;
|
|
2160
|
+
}, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map) => {
|
|
2161
|
+
Reflect.set(globalThis, CONVENTIONS_KEY, map);
|
|
2162
|
+
}, isDev = () => true, buildErrorProps = (error) => {
|
|
2163
|
+
if (error instanceof Error) {
|
|
2208
2164
|
return {
|
|
2209
|
-
|
|
2210
|
-
|
|
2165
|
+
message: error.message,
|
|
2166
|
+
name: error.name,
|
|
2167
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
2211
2168
|
};
|
|
2212
2169
|
}
|
|
2213
|
-
return
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2170
|
+
return { message: String(error), name: "Error" };
|
|
2171
|
+
}, renderReactError = async (conventionPath, errorProps) => {
|
|
2172
|
+
const { createElement } = await import("react");
|
|
2173
|
+
const { renderToReadableStream } = await import("react-dom/server");
|
|
2174
|
+
const mod = await import(conventionPath);
|
|
2175
|
+
const ErrorComponent = mod.default;
|
|
2176
|
+
if (typeof ErrorComponent !== "function")
|
|
2177
|
+
return null;
|
|
2178
|
+
const element = createElement(ErrorComponent, errorProps);
|
|
2179
|
+
const stream = await renderToReadableStream(element);
|
|
2180
|
+
return new Response(stream, {
|
|
2181
|
+
headers: { "Content-Type": "text/html" },
|
|
2182
|
+
status: 500
|
|
2220
2183
|
});
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
const
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
}
|
|
2245
|
-
const
|
|
2246
|
-
|
|
2184
|
+
}, renderSvelteError = async (conventionPath, errorProps) => {
|
|
2185
|
+
const { render } = await import("svelte/server");
|
|
2186
|
+
const mod = await import(conventionPath);
|
|
2187
|
+
const ErrorComponent = mod.default;
|
|
2188
|
+
if (!ErrorComponent)
|
|
2189
|
+
return null;
|
|
2190
|
+
const { head, body } = render(ErrorComponent, {
|
|
2191
|
+
props: errorProps
|
|
2192
|
+
});
|
|
2193
|
+
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
2194
|
+
return new Response(html, {
|
|
2195
|
+
headers: { "Content-Type": "text/html" },
|
|
2196
|
+
status: 500
|
|
2197
|
+
});
|
|
2198
|
+
}, unescapeVueStyles = (ssrBody) => {
|
|
2199
|
+
let styles = "";
|
|
2200
|
+
const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
|
|
2201
|
+
styles += `<style>${css.replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</style>`;
|
|
2202
|
+
return "";
|
|
2203
|
+
});
|
|
2204
|
+
return { body, styles };
|
|
2205
|
+
}, renderVueError = async (conventionPath, errorProps) => {
|
|
2206
|
+
const { createSSRApp, h } = await import("vue");
|
|
2207
|
+
const { renderToString } = await import("vue/server-renderer");
|
|
2208
|
+
const mod = await import(conventionPath);
|
|
2209
|
+
const ErrorComponent = mod.default;
|
|
2210
|
+
if (!ErrorComponent)
|
|
2211
|
+
return null;
|
|
2212
|
+
const app = createSSRApp({
|
|
2213
|
+
render: () => h(ErrorComponent, errorProps)
|
|
2214
|
+
});
|
|
2215
|
+
const rawBody = await renderToString(app);
|
|
2216
|
+
const { styles, body } = unescapeVueStyles(rawBody);
|
|
2217
|
+
const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
|
|
2218
|
+
return new Response(html, {
|
|
2219
|
+
headers: { "Content-Type": "text/html" },
|
|
2220
|
+
status: 500
|
|
2221
|
+
});
|
|
2222
|
+
}, renderAngularError = async (conventionPath, errorProps) => {
|
|
2223
|
+
const mod = await import(conventionPath);
|
|
2224
|
+
const renderFn = mod.default;
|
|
2225
|
+
if (typeof renderFn !== "function")
|
|
2226
|
+
return null;
|
|
2227
|
+
const html = renderFn(errorProps);
|
|
2228
|
+
return new Response(html, {
|
|
2229
|
+
headers: { "Content-Type": "text/html" },
|
|
2230
|
+
status: 500
|
|
2231
|
+
});
|
|
2232
|
+
}, escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : ""), renderHtmlError = async (conventionPath, errorProps) => {
|
|
2233
|
+
const template = await Bun.file(conventionPath).text();
|
|
2234
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
2235
|
+
return new Response(html, {
|
|
2236
|
+
headers: { "Content-Type": "text/html" },
|
|
2237
|
+
status: 500
|
|
2238
|
+
});
|
|
2239
|
+
}, logConventionRenderError = (framework, label, renderError) => {
|
|
2240
|
+
const message = renderError instanceof Error ? renderError.message : "";
|
|
2241
|
+
if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
|
|
2242
|
+
console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
|
|
2243
|
+
return;
|
|
2244
|
+
}
|
|
2245
|
+
console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
|
|
2246
|
+
}, renderEmberError = async () => null, renderEmberNotFound = async () => null, ERROR_RENDERERS, tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
2247
|
+
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
2248
|
+
if (!conventionPath && error instanceof Error && error.stack) {
|
|
2249
|
+
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
2250
|
+
const [, candidate] = match;
|
|
2251
|
+
if (!candidate)
|
|
2252
|
+
continue;
|
|
2253
|
+
conventionPath = resolveErrorConventionPath(framework, candidate);
|
|
2254
|
+
if (conventionPath)
|
|
2255
|
+
break;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
if (!conventionPath)
|
|
2259
|
+
return null;
|
|
2260
|
+
const renderer = ERROR_RENDERERS[framework];
|
|
2261
|
+
if (!renderer)
|
|
2262
|
+
return null;
|
|
2263
|
+
try {
|
|
2264
|
+
return await renderer(conventionPath, errorProps);
|
|
2265
|
+
} catch (renderError) {
|
|
2266
|
+
logConventionRenderError(framework, "error", renderError);
|
|
2267
|
+
}
|
|
2268
|
+
return null;
|
|
2269
|
+
}, renderConventionError = async (framework, pageName, error) => {
|
|
2270
|
+
const errorProps = buildErrorProps(error);
|
|
2271
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
2272
|
+
if (frameworkResponse)
|
|
2273
|
+
return frameworkResponse;
|
|
2274
|
+
if (framework !== "html") {
|
|
2275
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
2276
|
+
if (htmlResponse)
|
|
2277
|
+
return htmlResponse;
|
|
2278
|
+
}
|
|
2279
|
+
return null;
|
|
2280
|
+
}, renderReactNotFound = async (conventionPath) => {
|
|
2281
|
+
const { createElement } = await import("react");
|
|
2282
|
+
const { renderToReadableStream } = await import("react-dom/server");
|
|
2283
|
+
const mod = await import(conventionPath);
|
|
2284
|
+
const NotFoundComponent = mod.default;
|
|
2285
|
+
if (typeof NotFoundComponent !== "function")
|
|
2286
|
+
return null;
|
|
2287
|
+
const element = createElement(NotFoundComponent);
|
|
2288
|
+
const stream = await renderToReadableStream(element);
|
|
2289
|
+
return new Response(stream, {
|
|
2290
|
+
headers: { "Content-Type": "text/html" },
|
|
2291
|
+
status: 404
|
|
2292
|
+
});
|
|
2293
|
+
}, renderSvelteNotFound = async (conventionPath) => {
|
|
2294
|
+
const { render } = await import("svelte/server");
|
|
2295
|
+
const mod = await import(conventionPath);
|
|
2296
|
+
const NotFoundComponent = mod.default;
|
|
2297
|
+
if (!NotFoundComponent)
|
|
2298
|
+
return null;
|
|
2299
|
+
const { head, body } = render(NotFoundComponent);
|
|
2300
|
+
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
2301
|
+
return new Response(html, {
|
|
2302
|
+
headers: { "Content-Type": "text/html" },
|
|
2303
|
+
status: 404
|
|
2304
|
+
});
|
|
2305
|
+
}, renderVueNotFound = async (conventionPath) => {
|
|
2306
|
+
const { createSSRApp, h } = await import("vue");
|
|
2307
|
+
const { renderToString } = await import("vue/server-renderer");
|
|
2308
|
+
const mod = await import(conventionPath);
|
|
2309
|
+
const NotFoundComponent = mod.default;
|
|
2310
|
+
if (!NotFoundComponent)
|
|
2311
|
+
return null;
|
|
2312
|
+
const app = createSSRApp({
|
|
2313
|
+
render: () => h(NotFoundComponent)
|
|
2314
|
+
});
|
|
2315
|
+
const rawBody = await renderToString(app);
|
|
2316
|
+
const { styles, body } = unescapeVueStyles(rawBody);
|
|
2317
|
+
const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
|
|
2318
|
+
return new Response(html, {
|
|
2319
|
+
headers: { "Content-Type": "text/html" },
|
|
2320
|
+
status: 404
|
|
2321
|
+
});
|
|
2322
|
+
}, renderAngularNotFound = async (conventionPath) => {
|
|
2323
|
+
const mod = await import(conventionPath);
|
|
2324
|
+
const renderFn = mod.default;
|
|
2325
|
+
if (typeof renderFn !== "function")
|
|
2326
|
+
return null;
|
|
2327
|
+
const html = renderFn();
|
|
2328
|
+
return new Response(html, {
|
|
2329
|
+
headers: { "Content-Type": "text/html" },
|
|
2330
|
+
status: 404
|
|
2331
|
+
});
|
|
2332
|
+
}, renderHtmlNotFound = async (conventionPath) => {
|
|
2333
|
+
const html = await Bun.file(conventionPath).text();
|
|
2334
|
+
return new Response(html, {
|
|
2335
|
+
headers: { "Content-Type": "text/html" },
|
|
2336
|
+
status: 404
|
|
2337
|
+
});
|
|
2338
|
+
}, NOT_FOUND_RENDERERS, renderConventionNotFound = async (framework) => {
|
|
2339
|
+
const conventionPath = resolveNotFoundConventionPath(framework);
|
|
2340
|
+
if (!conventionPath)
|
|
2341
|
+
return null;
|
|
2342
|
+
const renderer = NOT_FOUND_RENDERERS[framework];
|
|
2343
|
+
if (!renderer)
|
|
2344
|
+
return null;
|
|
2345
|
+
try {
|
|
2346
|
+
return await renderer(conventionPath);
|
|
2347
|
+
} catch (renderError) {
|
|
2348
|
+
logConventionRenderError(framework, "not-found", renderError);
|
|
2349
|
+
}
|
|
2350
|
+
return null;
|
|
2351
|
+
}, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
|
|
2352
|
+
const renderNext = async (frameworks) => {
|
|
2353
|
+
const [framework, ...remaining] = frameworks;
|
|
2354
|
+
if (!framework) {
|
|
2355
|
+
return null;
|
|
2356
|
+
}
|
|
2357
|
+
if (!getMap()[framework]?.defaults?.notFound) {
|
|
2358
|
+
return renderNext(remaining);
|
|
2359
|
+
}
|
|
2360
|
+
const response = await renderConventionNotFound(framework);
|
|
2361
|
+
if (response) {
|
|
2362
|
+
return response;
|
|
2363
|
+
}
|
|
2364
|
+
return renderNext(remaining);
|
|
2365
|
+
};
|
|
2366
|
+
return renderNext(NOT_FOUND_PRIORITY);
|
|
2367
|
+
};
|
|
2368
|
+
var init_resolveConvention = __esm(() => {
|
|
2369
|
+
ERROR_RENDERERS = {
|
|
2370
|
+
angular: renderAngularError,
|
|
2371
|
+
ember: renderEmberError,
|
|
2372
|
+
html: renderHtmlError,
|
|
2373
|
+
react: renderReactError,
|
|
2374
|
+
svelte: renderSvelteError,
|
|
2375
|
+
vue: renderVueError
|
|
2376
|
+
};
|
|
2377
|
+
NOT_FOUND_RENDERERS = {
|
|
2378
|
+
angular: renderAngularNotFound,
|
|
2379
|
+
ember: renderEmberNotFound,
|
|
2380
|
+
html: renderHtmlNotFound,
|
|
2381
|
+
react: renderReactNotFound,
|
|
2382
|
+
svelte: renderSvelteNotFound,
|
|
2383
|
+
vue: renderVueNotFound
|
|
2384
|
+
};
|
|
2385
|
+
NOT_FOUND_PRIORITY = [
|
|
2386
|
+
"react",
|
|
2387
|
+
"svelte",
|
|
2388
|
+
"vue",
|
|
2389
|
+
"angular",
|
|
2390
|
+
"html"
|
|
2391
|
+
];
|
|
2392
|
+
});
|
|
2393
|
+
|
|
2394
|
+
// src/utils/spaRouteManifest.ts
|
|
2395
|
+
import { basename as basename3 } from "path";
|
|
2396
|
+
var SPA_ROUTES_KEY = "__absoluteSpaRoutes", setSpaRouteManifest = (hosts) => {
|
|
2397
|
+
Reflect.set(globalThis, SPA_ROUTES_KEY, hosts);
|
|
2398
|
+
}, isRuntimeSpaHost = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "framework") === "string", getSpaRouteManifest = () => {
|
|
2399
|
+
const value = Reflect.get(globalThis, SPA_ROUTES_KEY);
|
|
2400
|
+
return Array.isArray(value) ? value.filter(isRuntimeSpaHost) : [];
|
|
2401
|
+
}, normalizePath = (path) => {
|
|
2402
|
+
const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
|
|
2403
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
2404
|
+
return trimmed || "/";
|
|
2405
|
+
}, fullRoutePath = (baseHref, routePath) => {
|
|
2406
|
+
const base = normalizePath(baseHref);
|
|
2407
|
+
const route = normalizePath(routePath);
|
|
2408
|
+
if (base !== "/" && (route === base || route.startsWith(`${base}/`))) {
|
|
2409
|
+
return route;
|
|
2410
|
+
}
|
|
2411
|
+
if (base === "/")
|
|
2412
|
+
return route;
|
|
2413
|
+
return normalizePath(`${base}/${route.replace(/^\/+/, "")}`);
|
|
2414
|
+
}, routePattern = (path) => {
|
|
2415
|
+
const segments = normalizePath(path).split("/").filter(Boolean);
|
|
2416
|
+
let expression = "^";
|
|
2417
|
+
for (const segment of segments) {
|
|
2418
|
+
if (segment === "*" || segment === "**") {
|
|
2419
|
+
expression += "(?:/.*)?";
|
|
2420
|
+
continue;
|
|
2421
|
+
}
|
|
2422
|
+
const parameter = /^:[A-Za-z_$][A-Za-z0-9_$]*(?:\((.*)\))?(\?)?$/.exec(segment);
|
|
2423
|
+
if (parameter) {
|
|
2424
|
+
const valuePattern = parameter[1] || "[^/]+";
|
|
2425
|
+
expression += parameter[2] ? `(?:/${valuePattern})?` : `/${valuePattern}`;
|
|
2426
|
+
continue;
|
|
2427
|
+
}
|
|
2428
|
+
expression += `/${segment.replace(/[.+?^${}()|[\]\\]/g, "\\$&")}`;
|
|
2429
|
+
}
|
|
2430
|
+
return new RegExp(`${expression || "^/"}/?$`);
|
|
2431
|
+
}, sourcePageName = (sourceFile) => basename3(sourceFile).replace(/\.[^.]+$/, "").toLowerCase(), isKnownSpaRoute = (framework, pageName, request) => {
|
|
2432
|
+
if (!request)
|
|
2433
|
+
return true;
|
|
2434
|
+
let pathname;
|
|
2435
|
+
try {
|
|
2436
|
+
pathname = normalizePath(new URL(request.url).pathname);
|
|
2437
|
+
} catch {
|
|
2438
|
+
return true;
|
|
2439
|
+
}
|
|
2440
|
+
const hosts = getSpaRouteManifest().filter((host) => {
|
|
2441
|
+
if (host.framework !== framework)
|
|
2442
|
+
return false;
|
|
2443
|
+
if (sourcePageName(host.sourceFile) !== pageName.toLowerCase())
|
|
2444
|
+
return false;
|
|
2445
|
+
const base = normalizePath(host.baseHref);
|
|
2446
|
+
return base === "/" || pathname === base || pathname.startsWith(`${base}/`);
|
|
2447
|
+
});
|
|
2448
|
+
if (hosts.length === 0)
|
|
2449
|
+
return true;
|
|
2450
|
+
return hosts.some((host) => host.routes.some((route) => routePattern(fullRoutePath(host.baseHref, route.path)).test(pathname)));
|
|
2451
|
+
}, renderSpaNotFound = async (framework, pageName, request) => {
|
|
2452
|
+
if (isKnownSpaRoute(framework, pageName, request))
|
|
2453
|
+
return null;
|
|
2454
|
+
return await renderFirstNotFound() ?? new Response("Not found", {
|
|
2455
|
+
headers: { "Content-Type": "text/plain" },
|
|
2456
|
+
status: 404
|
|
2457
|
+
});
|
|
2458
|
+
};
|
|
2459
|
+
var init_spaRouteManifest = __esm(() => {
|
|
2460
|
+
init_resolveConvention();
|
|
2461
|
+
});
|
|
2462
|
+
|
|
2463
|
+
// src/svelte/renderToReadableStream.ts
|
|
2464
|
+
var exports_renderToReadableStream = {};
|
|
2465
|
+
__export(exports_renderToReadableStream, {
|
|
2466
|
+
renderToReadableStream: () => renderToReadableStream,
|
|
2467
|
+
SVELTE_PAGE_ROOT_ID: () => SVELTE_PAGE_ROOT_ID
|
|
2468
|
+
});
|
|
2469
|
+
var SVELTE_PAGE_ROOT_ID = "__absolute_svelte_root__", renderToReadableStream = async (component, props, {
|
|
2470
|
+
bootstrapScriptContent,
|
|
2471
|
+
bootstrapScripts = [],
|
|
2472
|
+
bootstrapModules = [],
|
|
2473
|
+
nonce,
|
|
2474
|
+
onError = console.error,
|
|
2475
|
+
progressiveChunkSize = DEFAULT_CHUNK_SIZE,
|
|
2476
|
+
signal,
|
|
2477
|
+
headContent,
|
|
2478
|
+
bodyContent
|
|
2479
|
+
} = {}) => {
|
|
2480
|
+
try {
|
|
2481
|
+
const { render } = await import("svelte/server");
|
|
2482
|
+
const renderComponent = render;
|
|
2483
|
+
const rendered = typeof props === "undefined" ? await renderComponent(component) : await renderComponent(component, { props });
|
|
2484
|
+
const { head, body } = rendered;
|
|
2485
|
+
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
2486
|
+
const scripts = (bootstrapScriptContent ? `<script${nonceAttr}>${escapeScriptContent(bootstrapScriptContent)}</script>` : "") + bootstrapScripts.map((src) => `<script${nonceAttr} src="${src}"></script>`).join("") + bootstrapModules.map((src) => `<script${nonceAttr} type="module" src="${src}"></script>`).join("");
|
|
2487
|
+
const encoder = new TextEncoder;
|
|
2488
|
+
const full = encoder.encode(`<!DOCTYPE html><html lang="en"><head>${head}${headContent ?? ""}</head><body><div id="${SVELTE_PAGE_ROOT_ID}">${body}</div>${scripts}${bodyContent ?? ""}</body></html>`);
|
|
2489
|
+
let offset = 0;
|
|
2490
|
+
return new ReadableStream({
|
|
2491
|
+
type: "bytes",
|
|
2492
|
+
cancel(reason) {
|
|
2493
|
+
onError?.(reason);
|
|
2494
|
+
},
|
|
2495
|
+
pull(controller) {
|
|
2496
|
+
if (signal?.aborted) {
|
|
2497
|
+
controller.close();
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
if (offset >= full.length) {
|
|
2501
|
+
controller.close();
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
const end = Math.min(offset + progressiveChunkSize, full.length);
|
|
2505
|
+
controller.enqueue(full.subarray(offset, end));
|
|
2506
|
+
offset = end;
|
|
2507
|
+
}
|
|
2508
|
+
});
|
|
2509
|
+
} catch (error) {
|
|
2510
|
+
onError?.(error);
|
|
2511
|
+
throw error;
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
var init_renderToReadableStream = __esm(() => {
|
|
2515
|
+
init_constants();
|
|
2516
|
+
init_escapeScriptContent();
|
|
2517
|
+
});
|
|
2518
|
+
|
|
2519
|
+
// src/core/streamingSlotRegistrar.ts
|
|
2520
|
+
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
2521
|
+
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
2522
|
+
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
2523
|
+
var getRegisteredStreamingSlotRegistrar = () => {
|
|
2524
|
+
const value = Reflect.get(globalThis, STREAMING_SLOT_REGISTRAR_KEY);
|
|
2525
|
+
if (typeof value === "function" || value === null) {
|
|
2526
|
+
return value;
|
|
2527
|
+
}
|
|
2528
|
+
return;
|
|
2529
|
+
};
|
|
2530
|
+
var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
|
|
2531
|
+
var isStreamingSlotWarningController = (value) => isObjectRecord(value) && ("maybeWarn" in value) && typeof value.maybeWarn === "function";
|
|
2532
|
+
var isStreamingSlotCollectionController = (value) => isObjectRecord(value) && ("isCollecting" in value) && typeof value.isCollecting === "function";
|
|
2533
|
+
var getWarningController = () => {
|
|
2534
|
+
const value = Reflect.get(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY);
|
|
2535
|
+
if (value === null || typeof value === "undefined")
|
|
2536
|
+
return;
|
|
2537
|
+
return isStreamingSlotWarningController(value) ? value : undefined;
|
|
2538
|
+
};
|
|
2539
|
+
var getCollectionController = () => {
|
|
2540
|
+
const value = Reflect.get(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY);
|
|
2541
|
+
if (value === null || typeof value === "undefined")
|
|
2542
|
+
return;
|
|
2543
|
+
return isStreamingSlotCollectionController(value) ? value : undefined;
|
|
2544
|
+
};
|
|
2545
|
+
var hasRegisteredStreamingSlotRegistrar = () => typeof getRegisteredStreamingSlotRegistrar() === "function";
|
|
2546
|
+
var isStreamingSlotCollectionActive = () => getCollectionController()?.isCollecting() === true;
|
|
2547
|
+
var registerStreamingSlot = (slot) => {
|
|
2548
|
+
getRegisteredStreamingSlotRegistrar()?.(slot);
|
|
2549
|
+
};
|
|
2550
|
+
var setStreamingSlotCollectionController = (controller) => {
|
|
2551
|
+
Reflect.set(globalThis, STREAMING_SLOT_COLLECTION_STORAGE_KEY, controller);
|
|
2552
|
+
};
|
|
2553
|
+
var setStreamingSlotRegistrar = (nextRegistrar) => {
|
|
2554
|
+
Reflect.set(globalThis, STREAMING_SLOT_REGISTRAR_KEY, nextRegistrar);
|
|
2555
|
+
};
|
|
2556
|
+
var setStreamingSlotWarningController = (controller) => {
|
|
2557
|
+
Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
|
|
2558
|
+
};
|
|
2559
|
+
var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
2560
|
+
if (isStreamingSlotCollectionActive()) {
|
|
2561
|
+
return;
|
|
2562
|
+
}
|
|
2563
|
+
getWarningController()?.maybeWarn(primitiveName);
|
|
2564
|
+
};
|
|
2565
|
+
|
|
2566
|
+
// src/core/streamingSlotRegistry.ts
|
|
2567
|
+
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
2568
|
+
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
2569
|
+
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
2570
|
+
var getStorageGlobal = () => {
|
|
2571
|
+
const value = Reflect.get(globalThis, STREAMING_SLOT_STORAGE_KEY);
|
|
2572
|
+
if (value === null || typeof value === "undefined") {
|
|
2573
|
+
return value;
|
|
2574
|
+
}
|
|
2575
|
+
return isAsyncLocalStorage(value) ? value : undefined;
|
|
2576
|
+
};
|
|
2577
|
+
var isServerRuntime = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
|
|
2578
|
+
var ensureAsyncLocalStorage = async () => {
|
|
2579
|
+
const storage = getStorageGlobal();
|
|
2580
|
+
if (typeof storage !== "undefined") {
|
|
2581
|
+
return storage;
|
|
2582
|
+
}
|
|
2583
|
+
if (!isServerRuntime()) {
|
|
2584
|
+
Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, null);
|
|
2585
|
+
return getStorageGlobal();
|
|
2586
|
+
}
|
|
2587
|
+
const mod = await import("async_hooks");
|
|
2588
|
+
Reflect.set(globalThis, STREAMING_SLOT_STORAGE_KEY, new mod.AsyncLocalStorage);
|
|
2589
|
+
return getStorageGlobal();
|
|
2590
|
+
};
|
|
2591
|
+
var getActiveSlotStore = () => {
|
|
2592
|
+
const storage = getStorageGlobal();
|
|
2593
|
+
if (!storage)
|
|
2594
|
+
return;
|
|
2595
|
+
return storage.getStore();
|
|
2596
|
+
};
|
|
2597
|
+
var registerStreamingSlot2 = (slot) => {
|
|
2598
|
+
const store = getActiveSlotStore();
|
|
2599
|
+
if (!store)
|
|
2600
|
+
return;
|
|
2601
|
+
store.set(slot.id, slot);
|
|
2602
|
+
};
|
|
2603
|
+
setStreamingSlotRegistrar(registerStreamingSlot2);
|
|
2604
|
+
setStreamingSlotCollectionController({
|
|
2605
|
+
isCollecting: () => getActiveSlotStore() !== undefined
|
|
2606
|
+
});
|
|
2607
|
+
var hasActiveStreamingSlotRegistry = () => getActiveSlotStore() !== undefined;
|
|
2608
|
+
var runWithStreamingSlotRegistry = async (task) => {
|
|
2609
|
+
const storage = await ensureAsyncLocalStorage();
|
|
2610
|
+
if (!storage) {
|
|
2611
|
+
const slots = [];
|
|
2612
|
+
return {
|
|
2613
|
+
result: await task(),
|
|
2614
|
+
slots
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2617
|
+
return storage.run(new Map, async () => {
|
|
2618
|
+
const result = await task();
|
|
2619
|
+
const store = storage.getStore();
|
|
2620
|
+
return {
|
|
2621
|
+
result,
|
|
2622
|
+
slots: store ? [...store.values()] : []
|
|
2623
|
+
};
|
|
2624
|
+
});
|
|
2625
|
+
};
|
|
2626
|
+
|
|
2627
|
+
// src/svelte/pageHandler.ts
|
|
2628
|
+
init_svelteServerModule();
|
|
2629
|
+
|
|
2630
|
+
// src/core/islandPageContext.ts
|
|
2631
|
+
var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
|
|
2632
|
+
var ISLAND_MARKER = 'data-island="true"';
|
|
2633
|
+
var MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__";
|
|
2634
|
+
var ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__";
|
|
2635
|
+
var CLOSING_HEAD_TAG = "</head>";
|
|
2636
|
+
var buildIslandsHeadMarkup = (manifest) => {
|
|
2637
|
+
const manifestScript = `<script>window.__ABSOLUTE_MANIFEST__ = ${JSON.stringify(manifest)}</script>`;
|
|
2638
|
+
const islandStateScript = `<script>window.__ABS_ISLAND_STATE__ = ${JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {})}</script>`;
|
|
2639
|
+
const bootstrapPath = manifest[BOOTSTRAP_MANIFEST_KEY];
|
|
2640
|
+
const bootstrapScript = bootstrapPath ? `<script type="module" src="${bootstrapPath}"></script>` : "";
|
|
2641
|
+
return `${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
2642
|
+
};
|
|
2643
|
+
var injectHeadMarkup = (html, markup) => {
|
|
2644
|
+
const closingHeadIndex = html.indexOf("</head>");
|
|
2645
|
+
if (closingHeadIndex >= 0) {
|
|
2646
|
+
return `${html.slice(0, closingHeadIndex)}${markup}${html.slice(closingHeadIndex)}`;
|
|
2647
|
+
}
|
|
2648
|
+
const openingBodyIndex = html.indexOf("<body");
|
|
2649
|
+
if (openingBodyIndex >= 0) {
|
|
2247
2650
|
const bodyStart = html.indexOf(">", openingBodyIndex);
|
|
2248
2651
|
if (bodyStart >= 0) {
|
|
2249
2652
|
return `${html.slice(0, openingBodyIndex)}<head>${markup}</head>${html.slice(openingBodyIndex)}`;
|
|
@@ -2345,61 +2748,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
|
|
|
2345
2748
|
var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
|
|
2346
2749
|
const encoder = new TextEncoder;
|
|
2347
2750
|
const decoder = new TextDecoder;
|
|
2348
|
-
const
|
|
2349
|
-
const
|
|
2350
|
-
if (
|
|
2351
|
-
controller.enqueue(encoder.encode(
|
|
2352
|
-
return { injected, pending: "" };
|
|
2751
|
+
const headLookbehind = CLOSING_HEAD_TAG.length - 1;
|
|
2752
|
+
const enqueue = (controller, text) => {
|
|
2753
|
+
if (text.length > 0) {
|
|
2754
|
+
controller.enqueue(encoder.encode(text));
|
|
2353
2755
|
}
|
|
2354
|
-
const markerIndex = pending.indexOf(ISLAND_MARKER);
|
|
2355
|
-
if (markerIndex >= 0) {
|
|
2356
|
-
const tagStart = pending.lastIndexOf("<", markerIndex);
|
|
2357
|
-
const injectAt = tagStart >= 0 ? tagStart : markerIndex;
|
|
2358
|
-
const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
|
|
2359
|
-
controller.enqueue(encoder.encode(next));
|
|
2360
|
-
return { injected: true, pending: "" };
|
|
2361
|
-
}
|
|
2362
|
-
return {
|
|
2363
|
-
injected,
|
|
2364
|
-
pending: flushSafePendingText(controller, encoder, pending, lookbehind)
|
|
2365
|
-
};
|
|
2366
2756
|
};
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
controller.enqueue(encoder.encode(finalPending));
|
|
2757
|
+
const processHolding = (controller, held) => {
|
|
2758
|
+
if (!held.includes(ISLAND_MARKER)) {
|
|
2759
|
+
return { held, injected: false, pending: "", sawHead: true };
|
|
2371
2760
|
}
|
|
2372
|
-
controller
|
|
2761
|
+
enqueue(controller, `${markup}${held}`);
|
|
2762
|
+
return { held: "", injected: true, pending: "", sawHead: true };
|
|
2373
2763
|
};
|
|
2374
|
-
const
|
|
2375
|
-
const
|
|
2376
|
-
if (
|
|
2377
|
-
return {
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2764
|
+
const processHead = (controller, pending) => {
|
|
2765
|
+
const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
|
|
2766
|
+
if (headIndex < 0) {
|
|
2767
|
+
return {
|
|
2768
|
+
held: "",
|
|
2769
|
+
injected: false,
|
|
2770
|
+
pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
|
|
2771
|
+
sawHead: false
|
|
2772
|
+
};
|
|
2773
|
+
}
|
|
2774
|
+
enqueue(controller, pending.slice(0, headIndex));
|
|
2775
|
+
return processHolding(controller, pending.slice(headIndex));
|
|
2385
2776
|
};
|
|
2386
|
-
const
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2777
|
+
const processChunk = (controller, state, chunk) => {
|
|
2778
|
+
if (state.injected) {
|
|
2779
|
+
enqueue(controller, chunk);
|
|
2780
|
+
return state;
|
|
2781
|
+
}
|
|
2782
|
+
if (!state.sawHead) {
|
|
2783
|
+
return processHead(controller, state.pending + chunk);
|
|
2784
|
+
}
|
|
2785
|
+
return processHolding(controller, state.held + chunk);
|
|
2786
|
+
};
|
|
2787
|
+
const finishMarkerStream = (controller, state) => {
|
|
2788
|
+
const tail = decoder.decode();
|
|
2789
|
+
const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
|
|
2790
|
+
enqueue(controller, remainder);
|
|
2791
|
+
controller.close();
|
|
2792
|
+
};
|
|
2793
|
+
const runMarkerLoop = (controller, reader) => {
|
|
2794
|
+
const consumeNext = async (state) => {
|
|
2795
|
+
const { done, value } = await readStreamChunk(reader);
|
|
2796
|
+
if (done || !value) {
|
|
2797
|
+
return state;
|
|
2392
2798
|
}
|
|
2393
|
-
return
|
|
2799
|
+
return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
|
|
2394
2800
|
};
|
|
2395
|
-
return
|
|
2801
|
+
return consumeNext({
|
|
2802
|
+
held: "",
|
|
2803
|
+
injected: false,
|
|
2804
|
+
pending: "",
|
|
2805
|
+
sawHead: false
|
|
2806
|
+
});
|
|
2396
2807
|
};
|
|
2397
2808
|
return new ReadableStream({
|
|
2398
2809
|
async start(controller) {
|
|
2399
2810
|
const reader = stream.getReader();
|
|
2400
2811
|
try {
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2812
|
+
const finalState = await runMarkerLoop(controller, reader);
|
|
2813
|
+
finishMarkerStream(controller, finalState);
|
|
2403
2814
|
} catch (error) {
|
|
2404
2815
|
controller.error(error);
|
|
2405
2816
|
}
|
|
@@ -2437,9 +2848,11 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
2437
2848
|
|
|
2438
2849
|
// src/svelte/pageHandler.ts
|
|
2439
2850
|
init_devRouteRegistrationCallsite();
|
|
2851
|
+
init_pageResponseCache();
|
|
2440
2852
|
|
|
2441
2853
|
// src/core/responseEnhancers.ts
|
|
2442
2854
|
init_streamingSlots();
|
|
2855
|
+
init_pageResponseCache();
|
|
2443
2856
|
var toResponse = async (responseLike) => responseLike;
|
|
2444
2857
|
var cloneHeaders = (response) => {
|
|
2445
2858
|
const headers = new Headers(response.headers);
|
|
@@ -2463,8 +2876,10 @@ var enhanceHtmlResponseWithStreamingSlots = (response, {
|
|
|
2463
2876
|
runtimePlacement,
|
|
2464
2877
|
runtimePreludeScript
|
|
2465
2878
|
});
|
|
2879
|
+
const headers = cloneHeaders(response);
|
|
2880
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
2466
2881
|
return new Response(body, {
|
|
2467
|
-
headers
|
|
2882
|
+
headers,
|
|
2468
2883
|
status: response.status,
|
|
2469
2884
|
statusText: response.statusText
|
|
2470
2885
|
});
|
|
@@ -2544,303 +2959,11 @@ var captureStreamingSlotWarningCallsite = () => {
|
|
|
2544
2959
|
return extractCallsiteFromStack(stack);
|
|
2545
2960
|
};
|
|
2546
2961
|
var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage().run({ handlerCallsite: metadata?.handlerCallsite, hasWarned: false }, task);
|
|
2547
|
-
// src/utils/resolveConvention.ts
|
|
2548
|
-
import { basename as basename2 } from "path";
|
|
2549
|
-
var CONVENTIONS_KEY = "__absoluteConventions";
|
|
2550
|
-
var isConventionsMap = (value) => Boolean(value) && typeof value === "object";
|
|
2551
|
-
var getMap = () => {
|
|
2552
|
-
const value = Reflect.get(globalThis, CONVENTIONS_KEY);
|
|
2553
|
-
if (isConventionsMap(value))
|
|
2554
|
-
return value;
|
|
2555
|
-
const empty = {};
|
|
2556
|
-
return empty;
|
|
2557
|
-
};
|
|
2558
|
-
var derivePageName = (pagePath) => {
|
|
2559
|
-
const base = basename2(pagePath);
|
|
2560
|
-
const dotIndex = base.indexOf(".");
|
|
2561
|
-
const name = dotIndex > 0 ? base.slice(0, dotIndex) : base;
|
|
2562
|
-
return toPascal(name);
|
|
2563
|
-
};
|
|
2564
|
-
var normalizeConventionPageName = (name) => toPascal(name).replace(/\d+$/, "");
|
|
2565
|
-
var resolveErrorConventionPath = (framework, pageName) => {
|
|
2566
|
-
const conventions = getMap()[framework];
|
|
2567
|
-
if (!conventions)
|
|
2568
|
-
return;
|
|
2569
|
-
const exact = conventions.pages?.[pageName]?.error;
|
|
2570
|
-
if (exact)
|
|
2571
|
-
return exact;
|
|
2572
|
-
const normalizedPageName = normalizeConventionPageName(pageName);
|
|
2573
|
-
for (const [candidate, page] of Object.entries(conventions.pages ?? {})) {
|
|
2574
|
-
if (normalizeConventionPageName(candidate) === normalizedPageName) {
|
|
2575
|
-
return page.error ?? conventions.defaults?.error;
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
return conventions.defaults?.error;
|
|
2579
|
-
};
|
|
2580
|
-
var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
|
|
2581
|
-
var hasErrorConvention = (framework) => {
|
|
2582
|
-
const conventions = getMap()[framework];
|
|
2583
|
-
if (!conventions)
|
|
2584
|
-
return false;
|
|
2585
|
-
if (conventions.defaults?.error)
|
|
2586
|
-
return true;
|
|
2587
|
-
return Object.values(conventions.pages ?? {}).some((page) => Boolean(page.error));
|
|
2588
|
-
};
|
|
2589
|
-
var setConventions = (map) => {
|
|
2590
|
-
Reflect.set(globalThis, CONVENTIONS_KEY, map);
|
|
2591
|
-
};
|
|
2592
|
-
var isDev = () => true;
|
|
2593
|
-
var buildErrorProps = (error) => {
|
|
2594
|
-
if (error instanceof Error) {
|
|
2595
|
-
return {
|
|
2596
|
-
name: error.name,
|
|
2597
|
-
message: error.message,
|
|
2598
|
-
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
2599
|
-
};
|
|
2600
|
-
}
|
|
2601
|
-
return { name: "Error", message: String(error) };
|
|
2602
|
-
};
|
|
2603
|
-
var renderReactError = async (conventionPath, errorProps) => {
|
|
2604
|
-
const { createElement } = await import("react");
|
|
2605
|
-
const { renderToReadableStream } = await import("react-dom/server");
|
|
2606
|
-
const mod = await import(conventionPath);
|
|
2607
|
-
const ErrorComponent = mod.default;
|
|
2608
|
-
if (typeof ErrorComponent !== "function")
|
|
2609
|
-
return null;
|
|
2610
|
-
const element = createElement(ErrorComponent, errorProps);
|
|
2611
|
-
const stream = await renderToReadableStream(element);
|
|
2612
|
-
return new Response(stream, {
|
|
2613
|
-
headers: { "Content-Type": "text/html" },
|
|
2614
|
-
status: 500
|
|
2615
|
-
});
|
|
2616
|
-
};
|
|
2617
|
-
var renderSvelteError = async (conventionPath, errorProps) => {
|
|
2618
|
-
const { render } = await import("svelte/server");
|
|
2619
|
-
const mod = await import(conventionPath);
|
|
2620
|
-
const ErrorComponent = mod.default;
|
|
2621
|
-
if (!ErrorComponent)
|
|
2622
|
-
return null;
|
|
2623
|
-
const { head, body } = render(ErrorComponent, {
|
|
2624
|
-
props: errorProps
|
|
2625
|
-
});
|
|
2626
|
-
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
2627
|
-
return new Response(html, {
|
|
2628
|
-
headers: { "Content-Type": "text/html" },
|
|
2629
|
-
status: 500
|
|
2630
|
-
});
|
|
2631
|
-
};
|
|
2632
|
-
var unescapeVueStyles = (ssrBody) => {
|
|
2633
|
-
let styles = "";
|
|
2634
|
-
const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
|
|
2635
|
-
styles += `<style>${css.replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}</style>`;
|
|
2636
|
-
return "";
|
|
2637
|
-
});
|
|
2638
|
-
return { body, styles };
|
|
2639
|
-
};
|
|
2640
|
-
var renderVueError = async (conventionPath, errorProps) => {
|
|
2641
|
-
const { createSSRApp, h } = await import("vue");
|
|
2642
|
-
const { renderToString } = await import("vue/server-renderer");
|
|
2643
|
-
const mod = await import(conventionPath);
|
|
2644
|
-
const ErrorComponent = mod.default;
|
|
2645
|
-
if (!ErrorComponent)
|
|
2646
|
-
return null;
|
|
2647
|
-
const app = createSSRApp({
|
|
2648
|
-
render: () => h(ErrorComponent, errorProps)
|
|
2649
|
-
});
|
|
2650
|
-
const rawBody = await renderToString(app);
|
|
2651
|
-
const { styles, body } = unescapeVueStyles(rawBody);
|
|
2652
|
-
const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
|
|
2653
|
-
return new Response(html, {
|
|
2654
|
-
headers: { "Content-Type": "text/html" },
|
|
2655
|
-
status: 500
|
|
2656
|
-
});
|
|
2657
|
-
};
|
|
2658
|
-
var renderAngularError = async (conventionPath, errorProps) => {
|
|
2659
|
-
const mod = await import(conventionPath);
|
|
2660
|
-
const renderFn = mod.default;
|
|
2661
|
-
if (typeof renderFn !== "function")
|
|
2662
|
-
return null;
|
|
2663
|
-
const html = renderFn(errorProps);
|
|
2664
|
-
return new Response(html, {
|
|
2665
|
-
headers: { "Content-Type": "text/html" },
|
|
2666
|
-
status: 500
|
|
2667
|
-
});
|
|
2668
|
-
};
|
|
2669
|
-
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2670
|
-
var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
|
|
2671
|
-
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
2672
|
-
const template = await Bun.file(conventionPath).text();
|
|
2673
|
-
const html = replaceErrorTokens(template, errorProps);
|
|
2674
|
-
return new Response(html, {
|
|
2675
|
-
headers: { "Content-Type": "text/html" },
|
|
2676
|
-
status: 500
|
|
2677
|
-
});
|
|
2678
|
-
};
|
|
2679
|
-
var logConventionRenderError = (framework, label, renderError) => {
|
|
2680
|
-
const message = renderError instanceof Error ? renderError.message : "";
|
|
2681
|
-
if (message.includes("Cannot find module") || message.includes("Cannot find package") || message.includes("not found in module")) {
|
|
2682
|
-
console.error(`[SSR] Convention ${label} page for ${framework} failed: missing framework package. Ensure the ${framework} runtime is installed (e.g. bun add ${framework === "react" ? "react react-dom" : framework}).`);
|
|
2683
|
-
return;
|
|
2684
|
-
}
|
|
2685
|
-
console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
|
|
2686
|
-
};
|
|
2687
|
-
var renderEmberError = async () => null;
|
|
2688
|
-
var renderEmberNotFound = async () => null;
|
|
2689
|
-
var ERROR_RENDERERS = {
|
|
2690
|
-
angular: renderAngularError,
|
|
2691
|
-
ember: renderEmberError,
|
|
2692
|
-
html: renderHtmlError,
|
|
2693
|
-
react: renderReactError,
|
|
2694
|
-
svelte: renderSvelteError,
|
|
2695
|
-
vue: renderVueError
|
|
2696
|
-
};
|
|
2697
|
-
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
2698
|
-
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
2699
|
-
if (!conventionPath && error instanceof Error && error.stack) {
|
|
2700
|
-
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
2701
|
-
const candidate = match[1];
|
|
2702
|
-
if (!candidate)
|
|
2703
|
-
continue;
|
|
2704
|
-
conventionPath = resolveErrorConventionPath(framework, candidate);
|
|
2705
|
-
if (conventionPath)
|
|
2706
|
-
break;
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
if (!conventionPath)
|
|
2710
|
-
return null;
|
|
2711
|
-
const renderer = ERROR_RENDERERS[framework];
|
|
2712
|
-
if (!renderer)
|
|
2713
|
-
return null;
|
|
2714
|
-
try {
|
|
2715
|
-
return await renderer(conventionPath, errorProps);
|
|
2716
|
-
} catch (renderError) {
|
|
2717
|
-
logConventionRenderError(framework, "error", renderError);
|
|
2718
|
-
}
|
|
2719
|
-
return null;
|
|
2720
|
-
};
|
|
2721
|
-
var renderConventionError = async (framework, pageName, error) => {
|
|
2722
|
-
const errorProps = buildErrorProps(error);
|
|
2723
|
-
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
2724
|
-
if (frameworkResponse)
|
|
2725
|
-
return frameworkResponse;
|
|
2726
|
-
if (framework !== "html") {
|
|
2727
|
-
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
2728
|
-
if (htmlResponse)
|
|
2729
|
-
return htmlResponse;
|
|
2730
|
-
}
|
|
2731
|
-
return null;
|
|
2732
|
-
};
|
|
2733
|
-
var renderReactNotFound = async (conventionPath) => {
|
|
2734
|
-
const { createElement } = await import("react");
|
|
2735
|
-
const { renderToReadableStream } = await import("react-dom/server");
|
|
2736
|
-
const mod = await import(conventionPath);
|
|
2737
|
-
const NotFoundComponent = mod.default;
|
|
2738
|
-
if (typeof NotFoundComponent !== "function")
|
|
2739
|
-
return null;
|
|
2740
|
-
const element = createElement(NotFoundComponent);
|
|
2741
|
-
const stream = await renderToReadableStream(element);
|
|
2742
|
-
return new Response(stream, {
|
|
2743
|
-
headers: { "Content-Type": "text/html" },
|
|
2744
|
-
status: 404
|
|
2745
|
-
});
|
|
2746
|
-
};
|
|
2747
|
-
var renderSvelteNotFound = async (conventionPath) => {
|
|
2748
|
-
const { render } = await import("svelte/server");
|
|
2749
|
-
const mod = await import(conventionPath);
|
|
2750
|
-
const NotFoundComponent = mod.default;
|
|
2751
|
-
if (!NotFoundComponent)
|
|
2752
|
-
return null;
|
|
2753
|
-
const { head, body } = render(NotFoundComponent);
|
|
2754
|
-
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
2755
|
-
return new Response(html, {
|
|
2756
|
-
headers: { "Content-Type": "text/html" },
|
|
2757
|
-
status: 404
|
|
2758
|
-
});
|
|
2759
|
-
};
|
|
2760
|
-
var renderVueNotFound = async (conventionPath) => {
|
|
2761
|
-
const { createSSRApp, h } = await import("vue");
|
|
2762
|
-
const { renderToString } = await import("vue/server-renderer");
|
|
2763
|
-
const mod = await import(conventionPath);
|
|
2764
|
-
const NotFoundComponent = mod.default;
|
|
2765
|
-
if (!NotFoundComponent)
|
|
2766
|
-
return null;
|
|
2767
|
-
const app = createSSRApp({
|
|
2768
|
-
render: () => h(NotFoundComponent)
|
|
2769
|
-
});
|
|
2770
|
-
const rawBody = await renderToString(app);
|
|
2771
|
-
const { styles, body } = unescapeVueStyles(rawBody);
|
|
2772
|
-
const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
|
|
2773
|
-
return new Response(html, {
|
|
2774
|
-
headers: { "Content-Type": "text/html" },
|
|
2775
|
-
status: 404
|
|
2776
|
-
});
|
|
2777
|
-
};
|
|
2778
|
-
var renderAngularNotFound = async (conventionPath) => {
|
|
2779
|
-
const mod = await import(conventionPath);
|
|
2780
|
-
const renderFn = mod.default;
|
|
2781
|
-
if (typeof renderFn !== "function")
|
|
2782
|
-
return null;
|
|
2783
|
-
const html = renderFn();
|
|
2784
|
-
return new Response(html, {
|
|
2785
|
-
headers: { "Content-Type": "text/html" },
|
|
2786
|
-
status: 404
|
|
2787
|
-
});
|
|
2788
|
-
};
|
|
2789
|
-
var renderHtmlNotFound = async (conventionPath) => {
|
|
2790
|
-
const html = await Bun.file(conventionPath).text();
|
|
2791
|
-
return new Response(html, {
|
|
2792
|
-
headers: { "Content-Type": "text/html" },
|
|
2793
|
-
status: 404
|
|
2794
|
-
});
|
|
2795
|
-
};
|
|
2796
|
-
var NOT_FOUND_RENDERERS = {
|
|
2797
|
-
angular: renderAngularNotFound,
|
|
2798
|
-
ember: renderEmberNotFound,
|
|
2799
|
-
html: renderHtmlNotFound,
|
|
2800
|
-
react: renderReactNotFound,
|
|
2801
|
-
svelte: renderSvelteNotFound,
|
|
2802
|
-
vue: renderVueNotFound
|
|
2803
|
-
};
|
|
2804
|
-
var renderConventionNotFound = async (framework) => {
|
|
2805
|
-
const conventionPath = resolveNotFoundConventionPath(framework);
|
|
2806
|
-
if (!conventionPath)
|
|
2807
|
-
return null;
|
|
2808
|
-
const renderer = NOT_FOUND_RENDERERS[framework];
|
|
2809
|
-
if (!renderer)
|
|
2810
|
-
return null;
|
|
2811
|
-
try {
|
|
2812
|
-
return await renderer(conventionPath);
|
|
2813
|
-
} catch (renderError) {
|
|
2814
|
-
logConventionRenderError(framework, "not-found", renderError);
|
|
2815
|
-
}
|
|
2816
|
-
return null;
|
|
2817
|
-
};
|
|
2818
|
-
var NOT_FOUND_PRIORITY = [
|
|
2819
|
-
"react",
|
|
2820
|
-
"svelte",
|
|
2821
|
-
"vue",
|
|
2822
|
-
"angular",
|
|
2823
|
-
"html"
|
|
2824
|
-
];
|
|
2825
|
-
var renderFirstNotFound = async () => {
|
|
2826
|
-
const renderNext = async (frameworks) => {
|
|
2827
|
-
const [framework, ...remaining] = frameworks;
|
|
2828
|
-
if (!framework) {
|
|
2829
|
-
return null;
|
|
2830
|
-
}
|
|
2831
|
-
if (!getMap()[framework]?.defaults?.notFound) {
|
|
2832
|
-
return renderNext(remaining);
|
|
2833
|
-
}
|
|
2834
|
-
const response = await renderConventionNotFound(framework);
|
|
2835
|
-
if (response) {
|
|
2836
|
-
return response;
|
|
2837
|
-
}
|
|
2838
|
-
return renderNext(remaining);
|
|
2839
|
-
};
|
|
2840
|
-
return renderNext(NOT_FOUND_PRIORITY);
|
|
2841
|
-
};
|
|
2842
2962
|
|
|
2843
2963
|
// src/svelte/pageHandler.ts
|
|
2964
|
+
init_inlinePageCss();
|
|
2965
|
+
init_spaRouteManifest();
|
|
2966
|
+
init_resolveConvention();
|
|
2844
2967
|
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
2845
2968
|
var isGenericSvelteComponent = (value) => typeof value === "function" || isRecord2(value);
|
|
2846
2969
|
var readHasIslands = (value) => {
|
|
@@ -2857,9 +2980,8 @@ var primeSvelteStream = async (stream) => {
|
|
|
2857
2980
|
};
|
|
2858
2981
|
var restorePrimedStream = (firstChunk, reader) => new ReadableStream({
|
|
2859
2982
|
start(controller) {
|
|
2860
|
-
if (!firstChunk.done)
|
|
2983
|
+
if (!firstChunk.done)
|
|
2861
2984
|
controller.enqueue(firstChunk.value);
|
|
2862
|
-
}
|
|
2863
2985
|
if (firstChunk.done) {
|
|
2864
2986
|
controller.close();
|
|
2865
2987
|
return;
|
|
@@ -2886,11 +3008,14 @@ var handleSveltePageRequest = async (input) => {
|
|
|
2886
3008
|
const resolvedPagePath = input.pagePath;
|
|
2887
3009
|
const userProps = input.props;
|
|
2888
3010
|
const requestPathname = resolveRequestPathname(input.request);
|
|
2889
|
-
const resolvedProps = requestPathname !== undefined && (!userProps || !("url" in userProps)) ? {
|
|
3011
|
+
const resolvedProps = requestPathname !== undefined && (!isRecord2(userProps) || !("url" in userProps)) ? {
|
|
2890
3012
|
...userProps ?? {},
|
|
2891
3013
|
url: requestPathname
|
|
2892
3014
|
} : userProps;
|
|
2893
3015
|
try {
|
|
3016
|
+
const spaNotFound = await renderSpaNotFound("svelte", derivePageName(resolvedPagePath), input.request);
|
|
3017
|
+
if (spaNotFound)
|
|
3018
|
+
return withPageCacheHeaders(spaNotFound, input.request);
|
|
2894
3019
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
2895
3020
|
const renderPageResponse = async () => {
|
|
2896
3021
|
const resolvePageComponent = async () => {
|
|
@@ -2921,38 +3046,45 @@ var handleSveltePageRequest = async (input) => {
|
|
|
2921
3046
|
};
|
|
2922
3047
|
const { renderToReadableStream: renderToReadableStream2 } = await Promise.resolve().then(() => (init_renderToReadableStream(), exports_renderToReadableStream));
|
|
2923
3048
|
const resolvedPage = await resolvePageComponent();
|
|
3049
|
+
const siblingCss = await readSiblingCss(resolvedPagePath);
|
|
3050
|
+
const cssBlock = siblingCss ? `<style data-absolute-page-css>${siblingCss}</style>` : "";
|
|
3051
|
+
const composedHeadContent = `${cssBlock}${resolvedOptions?.headContent ?? ""}`;
|
|
2924
3052
|
const stream = await renderToReadableStream2(resolvedPage.component, resolvedProps, {
|
|
2925
3053
|
bodyContent: resolvedOptions?.bodyContent,
|
|
2926
3054
|
bootstrapScriptContent: `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(resolvedProps)};${resolvedIndexPath ? `import(${JSON.stringify(resolvedIndexPath)});` : ""}`,
|
|
2927
|
-
headContent:
|
|
3055
|
+
headContent: composedHeadContent
|
|
2928
3056
|
});
|
|
2929
3057
|
const htmlStream = injectIslandPageContextStream(stream, {
|
|
2930
3058
|
hasIslands: resolvedPage.hasIslands ? true : undefined
|
|
2931
3059
|
});
|
|
2932
3060
|
const { firstChunk, reader } = await primeSvelteStream(htmlStream);
|
|
2933
3061
|
return new Response(restorePrimedStream(firstChunk, reader), {
|
|
2934
|
-
headers:
|
|
3062
|
+
headers: streamingPageHeaders()
|
|
2935
3063
|
});
|
|
2936
3064
|
};
|
|
2937
|
-
|
|
3065
|
+
const pageResponse = await runWithStreamingSlotWarningScope(() => resolvedOptions?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, {
|
|
2938
3066
|
...resolvedOptions,
|
|
2939
3067
|
runtimePlacement: resolvedOptions.runtimePlacement ?? "body"
|
|
2940
3068
|
}) : renderPageResponse(), { handlerCallsite });
|
|
3069
|
+
return withPageCacheHeaders(pageResponse, input.request, {
|
|
3070
|
+
bufferStreamForEtag: input.bufferStreamForEtag
|
|
3071
|
+
});
|
|
2941
3072
|
} catch (error) {
|
|
2942
3073
|
console.error("[SSR] Svelte render error:", error);
|
|
2943
3074
|
const pageName = derivePageName(resolvedPagePath);
|
|
2944
3075
|
const conventionResponse = await renderConventionError("svelte", pageName, error);
|
|
2945
|
-
if (conventionResponse)
|
|
2946
|
-
return conventionResponse;
|
|
2947
|
-
|
|
3076
|
+
if (conventionResponse) {
|
|
3077
|
+
return withPageCacheHeaders(conventionResponse, input.request);
|
|
3078
|
+
}
|
|
3079
|
+
return withPageCacheHeaders(new Response(ssrErrorPage("svelte", error), {
|
|
2948
3080
|
headers: { "Content-Type": "text/html" },
|
|
2949
3081
|
status: 500
|
|
2950
|
-
});
|
|
3082
|
+
}), input.request);
|
|
2951
3083
|
}
|
|
2952
3084
|
};
|
|
2953
3085
|
export {
|
|
2954
3086
|
handleSveltePageRequest
|
|
2955
3087
|
};
|
|
2956
3088
|
|
|
2957
|
-
//# debugId=
|
|
3089
|
+
//# debugId=3689ECCA0C4862B064756E2164756E21
|
|
2958
3090
|
//# sourceMappingURL=server.js.map
|