@absolutejs/absolute 0.20.0-beta.169 → 0.20.0-beta.170
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/CHANGELOG.md +80 -0
- package/README.md +232 -0
- package/changelog.json +228 -0
- package/dist/angular/browser.js +7 -8
- package/dist/angular/browser.js.map +6 -5
- package/dist/angular/components/core/streamingSlotRegistrar.js +6 -2
- package/dist/angular/components/core/streamingSlotRegistry.js +7 -3
- package/dist/angular/index.js +555 -156
- package/dist/angular/index.js.map +29 -23
- package/dist/angular/server.js +555 -156
- package/dist/angular/server.js.map +29 -23
- package/dist/build/buildWorker.js +14 -8
- package/dist/build.js +4949 -1941
- package/dist/build.js.map +72 -42
- package/dist/cli/{add-7azr0c83.js → add-6a7pjkn9.js} +11 -7
- package/dist/cli/{analyze-3cyek6v3.js → analyze-606fshwa.js} +1 -1
- package/dist/cli/{build-25rz8v25.js → build-g81xqbb9.js} +1 -1
- package/dist/cli/{compile-4jnfxts9.js → compile-9y1w9zpj.js} +3 -3
- package/dist/cli/config/server.js +10699 -1538
- package/dist/cli/{dev-9tk5hn2e.js → dev-hyeb89hp.js} +5 -1
- package/dist/cli/{doctor-4nv2c2j3.js → doctor-h55y9hj1.js} +1 -1
- package/dist/cli/{generate-v75p2fct.js → generate-20x1pkf7.js} +4 -4
- package/dist/cli/{htmx-427swtdz.js → htmx-6mz2h7k1.js} +2 -2
- package/dist/cli/{index-bhbs6d5z.js → index-32ge2w1f.js} +12 -4
- package/dist/cli/{index-a4ws2jwd.js → index-3wz3mktm.js} +1 -1
- package/dist/cli/{index-b7hjgknf.js → index-9sksd8c8.js} +13 -4
- package/dist/cli/{index-eyzwc7gz.js → index-qbrzvmh9.js} +4 -2
- package/dist/cli/index-qw98g1p6.js +269 -0
- package/dist/cli/{index-434b7j4a.js → index-vtp20gwf.js} +69 -1
- package/dist/cli/{index-h7qhz02e.js → index-wk0pyxrg.js} +3 -0
- package/dist/cli/{index-k3y8cb6c.js → index-z6f43b20.js} +1 -1
- package/dist/cli/index.js +16 -16
- package/dist/cli/{islands-8sgky9gh.js → islands-dc54e5y1.js} +1 -1
- package/dist/cli/{ls-4m4yqwww.js → ls-b6zz24nt.js} +1 -1
- package/dist/cli/{mobile-hcxjr2gf.js → mobile-ajnnvqtv.js} +3 -3
- package/dist/cli/prerender-fqpp0m1j.js +10 -0
- package/dist/cli/{remove-1ycjx85k.js → remove-t8x1mrxg.js} +4 -4
- package/dist/cli/{start-mbaejxhm.js → start-d6p831ny.js} +3 -3
- package/dist/cli/{typecheck-dr068pmh.js → typecheck-stbt0qt5.js} +6 -1
- package/dist/cli/{workspace-1sycp9g1.js → workspace-61hh6jq1.js} +1 -1
- package/dist/client/chunks/index-6b66nzyf.js +381 -0
- package/dist/client/chunks/index-6b66nzyf.js.map +11 -0
- package/dist/client/chunks/{islands-rc28k5sx.js → islands-s2ta5ajb.js} +5 -2
- package/dist/client/chunks/{islands-rc28k5sx.js.map → islands-s2ta5ajb.js.map} +7 -6
- package/dist/client/index.js +160 -3
- package/dist/client/index.js.map +6 -4
- package/dist/client/navigation.js +764 -0
- package/dist/client/navigation.js.map +10 -0
- package/dist/client/prefetch.js +33 -375
- package/dist/client/prefetch.js.map +3 -4
- package/dist/core/streamingSlotRegistrar.js +5 -2
- package/dist/core/streamingSlotRegistrar.js.map +5 -4
- package/dist/core/streamingSlotRegistry.js +5 -2
- package/dist/core/streamingSlotRegistry.js.map +5 -4
- package/dist/dev/client/cspNonce.ts +28 -0
- package/dist/dev/client/handlers/html.ts +4 -3
- package/dist/dev/client/handlers/htmx.ts +3 -2
- package/dist/dev/client/handlers/svelte.ts +15 -90
- package/dist/dev/client/syncDevtools.ts +2 -1
- package/dist/dev/serverBootstrap.js +11 -4
- package/dist/i18n/index.js +543 -0
- package/dist/i18n/index.js.map +15 -0
- package/dist/index.js +6339 -2233
- package/dist/index.js.map +89 -54
- package/dist/islands/index.js +282 -40
- package/dist/islands/index.js.map +14 -10
- package/dist/mobile/browser.js +7 -2
- package/dist/mobile/browser.js.map +5 -4
- package/dist/mobile/index.js +7 -2
- package/dist/mobile/index.js.map +5 -4
- package/dist/mobile/remoteMacAgentEntry.js +1 -1
- package/dist/react/components/browser/index.js +94 -4
- package/dist/react/components/index.js +150 -10
- package/dist/react/components/index.js.map +15 -10
- package/dist/react/hooks/index.js +479 -13
- package/dist/react/hooks/index.js.map +12 -4
- package/dist/react/index.js +769 -166
- package/dist/react/index.js.map +32 -21
- package/dist/react/router/browser.js +21 -4
- package/dist/react/router/browser.js.map +5 -4
- package/dist/react/router/index.js +21 -4
- package/dist/react/router/index.js.map +5 -4
- package/dist/react/server.js +597 -203
- package/dist/react/server.js.map +25 -15
- package/dist/src/angular/zoneRuntime.d.ts +5 -0
- package/dist/src/build/buildReactServerComponents.d.ts +22 -0
- package/dist/src/build/downlevelAsyncForZone.d.ts +1 -0
- package/dist/src/build/fileRoutes.d.ts +65 -0
- package/dist/src/build/fonts/buildFonts.d.ts +25 -0
- package/dist/src/build/fonts/fallbackMetrics.d.ts +13 -0
- package/dist/src/build/fonts/googleFonts.d.ts +18 -0
- package/dist/src/build/fonts/injectFontTags.d.ts +7 -0
- package/dist/src/build/fonts/parseFontMetrics.d.ts +4 -0
- package/dist/src/build/generateReactIndexes.d.ts +7 -1
- package/dist/src/build/htmlIncludes.d.ts +16 -0
- package/dist/src/build/inlineSourceMapComment.d.ts +1 -0
- package/dist/src/build/scanConventions.d.ts +3 -0
- package/dist/src/build/vitals.d.ts +21 -0
- package/dist/src/client/formActions.d.ts +29 -0
- package/dist/src/client/index.d.ts +2 -0
- package/dist/src/client/navigation.d.ts +16 -0
- package/dist/src/client/prefetch.d.ts +2 -30
- package/dist/src/core/build.d.ts +2 -2
- package/dist/src/core/cspNonce.d.ts +12 -0
- package/dist/src/core/fileRouteAdapter.d.ts +15 -0
- package/dist/src/core/fileRoutes.d.ts +5 -0
- package/dist/src/core/formActionFlash.d.ts +25 -0
- package/dist/src/core/formActions.d.ts +249 -0
- package/dist/src/core/index.d.ts +5 -0
- package/dist/src/core/partialPrerender.d.ts +28 -0
- package/dist/src/core/partialPrerenderServe.d.ts +24 -0
- package/dist/src/core/precompressed.d.ts +11 -1
- package/dist/src/core/prerenderNonce.d.ts +9 -0
- package/dist/src/core/productionRuntime.d.ts +4 -2
- package/dist/src/core/serverOnlyStaticFiles.d.ts +8 -0
- package/dist/src/core/staticHtmlNonce.d.ts +2 -0
- package/dist/src/core/vitals.d.ts +108 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +1 -1
- package/dist/src/dev/client/cspNonce.d.ts +2 -0
- package/dist/src/dev/fileRouteRefresher.d.ts +5 -0
- package/dist/src/dev/importCost/instrument.d.ts +1 -1
- package/dist/src/dev/reactServerComponentsRebuild.d.ts +3 -0
- package/dist/src/i18n/defineMessages.d.ts +5 -0
- package/dist/src/i18n/formatMessage.d.ts +26 -0
- package/dist/src/i18n/index.d.ts +6 -0
- package/dist/src/i18n/intlCache.d.ts +5 -0
- package/dist/src/i18n/routing.d.ts +28 -0
- package/dist/src/i18n/translator.d.ts +11 -0
- package/dist/src/mobile/androidRelease.d.ts +2 -2
- package/dist/src/mobile/iosRelease.d.ts +4 -4
- package/dist/src/mobile/materializedBundle.d.ts +1 -1
- package/dist/src/mobile/mobileInspect.d.ts +1 -1
- package/dist/src/mobile/releaseArtifact.d.ts +2 -2
- package/dist/src/mobile/remoteMacProtocol.d.ts +2 -2
- package/dist/src/plugins/i18n.d.ts +30 -0
- package/dist/src/plugins/index.d.ts +2 -1
- package/dist/src/plugins/secureHeaders.d.ts +48 -0
- package/dist/src/react/components/Head.d.ts +1 -1
- package/dist/src/react/components/StreamSlot.browser.d.ts +1 -0
- package/dist/src/react/components/StreamSlot.d.ts +5 -1
- package/dist/src/react/components/SuspenseSlot.browser.d.ts +2 -0
- package/dist/src/react/components/SuspenseSlot.d.ts +12 -0
- package/dist/src/react/fileRoute.d.ts +18 -0
- package/dist/src/react/hooks/index.d.ts +4 -0
- package/dist/src/react/hooks/useFormAction.d.ts +42 -0
- package/dist/src/react/hooks/useI18n.d.ts +15 -0
- package/dist/src/react/index.d.ts +2 -0
- package/dist/src/react/server.d.ts +2 -0
- package/dist/src/react/serverComponents/constants.d.ts +11 -0
- package/dist/src/react/serverComponents/flightPayload.d.ts +2 -0
- package/dist/src/react/serverComponents/pageHandler.d.ts +14 -0
- package/dist/src/svelte/browser.d.ts +1 -0
- package/dist/src/svelte/fileRoute.d.ts +15 -0
- package/dist/src/svelte/i18n.d.ts +8 -0
- package/dist/src/svelte/index.d.ts +2 -0
- package/dist/src/svelte/lowerAwaitSlotSyntax.d.ts +5 -1
- package/dist/src/svelte/renderToReadableStream.d.ts +10 -2
- package/dist/src/svelte/router/browser.d.ts +3 -1
- package/dist/src/svelte/router/goto.d.ts +13 -10
- package/dist/src/svelte/router/guards.d.ts +43 -0
- package/dist/src/svelte/router/index.d.ts +3 -1
- package/dist/src/svelte/router/lazy.d.ts +17 -0
- package/dist/src/svelte/router/lazyModule.d.ts +29 -0
- package/dist/src/svelte/router/navigation.d.ts +55 -0
- package/dist/src/svelte/router/pushState.d.ts +4 -2
- package/dist/src/svelte/router/scroll.d.ts +34 -0
- package/dist/src/svelte/routerSsr.d.ts +9 -0
- package/dist/src/svelte/server.d.ts +1 -0
- package/dist/src/utils/cspNonceRef.d.ts +8 -0
- package/dist/src/utils/fontAssets.d.ts +17 -0
- package/dist/src/utils/formActionProtocol.d.ts +10 -0
- package/dist/src/utils/generateHeadElement.d.ts +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/inlinePageCss.d.ts +18 -0
- package/dist/src/utils/loadConfig.d.ts +5 -0
- package/dist/src/utils/localeRef.d.ts +10 -0
- package/dist/src/utils/resolveConvention.d.ts +6 -1
- package/dist/src/utils/streamingSlots.d.ts +5 -0
- package/dist/src/vue/browser.d.ts +2 -0
- package/dist/src/vue/components/Image.d.ts +2 -2
- package/dist/src/vue/index.d.ts +2 -0
- package/dist/src/vue/serverDataPayload.d.ts +32 -0
- package/dist/src/vue/serverDataState.d.ts +9 -0
- package/dist/src/vue/useServerData.browser.d.ts +6 -0
- package/dist/src/vue/useServerData.d.ts +24 -0
- package/dist/svelte/browser.js +330 -3
- package/dist/svelte/browser.js.map +8 -4
- package/dist/svelte/components/AwaitSlot.svelte +5 -0
- package/dist/svelte/components/Head.svelte +50 -0
- package/dist/svelte/components/JsonLd.svelte +9 -1
- package/dist/svelte/components/StreamSlot.svelte +5 -0
- package/dist/svelte/index.js +1017 -117
- package/dist/svelte/index.js.map +38 -24
- package/dist/svelte/router/Link.svelte +40 -8
- package/dist/svelte/router/Route.svelte +157 -12
- package/dist/svelte/router/Route.svelte.d.ts +39 -5
- package/dist/svelte/router/Router.svelte +140 -25
- package/dist/svelte/router/Router.svelte.d.ts +5 -1
- package/dist/svelte/router/browser.ts +10 -0
- package/dist/svelte/router/goto.ts +15 -86
- package/dist/svelte/router/guards.ts +112 -0
- package/dist/svelte/router/index.ts +10 -0
- package/dist/svelte/router/lazy.ts +82 -0
- package/dist/svelte/router/lazyModule.ts +74 -0
- package/dist/svelte/router/navigation.ts +412 -0
- package/dist/svelte/router/pushState.ts +7 -4
- package/dist/svelte/router/scroll.ts +286 -0
- package/dist/svelte/server.js +747 -252
- package/dist/svelte/server.js.map +30 -20
- package/dist/types/angular.d.ts +2 -0
- package/dist/types/build.d.ts +37 -0
- package/dist/types/conventions.d.ts +3 -0
- package/dist/types/fileRoutes.d.ts +72 -0
- package/dist/types/fonts.d.ts +86 -0
- package/dist/types/formAction.d.ts +54 -0
- package/dist/types/globals.d.ts +10 -0
- package/dist/types/i18n.d.ts +185 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/metadata.d.ts +11 -0
- package/dist/types/navigation.d.ts +37 -0
- package/dist/types/prefetch.d.ts +10 -0
- package/dist/types/sitemap.d.ts +4 -0
- package/dist/types/svelteRouter.d.ts +89 -2
- package/dist/types/svelteRouter.ts +112 -2
- package/dist/types/vue.d.ts +46 -1
- package/dist/utils/iconVersion.ts +34 -0
- package/dist/vue/browser.js +107 -11
- package/dist/vue/browser.js.map +7 -4
- package/dist/vue/components/index.js +5 -2
- package/dist/vue/components/index.js.map +5 -4
- package/dist/vue/index.js +712 -158
- package/dist/vue/index.js.map +32 -23
- package/dist/vue/server.js +310 -79
- package/dist/vue/server.js.map +20 -15
- package/package.json +9 -1
- package/dist/cli/prerender-mfnwsvyt.js +0 -7
- package/dist/src/plugins/pageRouter.d.ts +0 -1
- /package/dist/cli/{index-j7m8pq48.js → index-rervww4p.js} +0 -0
|
@@ -41,15 +41,15 @@ export declare const buildAbsoluteAndroidRelease: (options: BuildAbsoluteAndroid
|
|
|
41
41
|
artifactPath: string;
|
|
42
42
|
metadata: {
|
|
43
43
|
artifact: string;
|
|
44
|
+
bytes: number;
|
|
45
|
+
format: typeof ABSOLUTE_ANDROID_RELEASE_FORMAT;
|
|
44
46
|
sha256: string;
|
|
45
47
|
type: "aab";
|
|
46
|
-
format: typeof ABSOLUTE_ANDROID_RELEASE_FORMAT;
|
|
47
48
|
platform: "android";
|
|
48
49
|
releaseId: string;
|
|
49
50
|
runtime: string;
|
|
50
51
|
appBuild: string;
|
|
51
52
|
appId: string;
|
|
52
|
-
bytes: number;
|
|
53
53
|
engine: "capacitor" | "expo";
|
|
54
54
|
signed: boolean;
|
|
55
55
|
versionCode?: number | undefined;
|
|
@@ -98,15 +98,15 @@ export declare const buildAbsoluteIosRelease: (options: BuildAbsoluteIosReleaseO
|
|
|
98
98
|
artifactPath: string;
|
|
99
99
|
metadata: {
|
|
100
100
|
artifact: "App.ipa";
|
|
101
|
+
bytes: number;
|
|
102
|
+
format: typeof ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
101
103
|
sha256: string;
|
|
102
104
|
type: "ipa";
|
|
103
|
-
format: typeof ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
104
105
|
platform: "ios";
|
|
105
106
|
releaseId: string;
|
|
106
107
|
runtime: string;
|
|
107
108
|
appBuild: string;
|
|
108
109
|
appId: string;
|
|
109
|
-
bytes: number;
|
|
110
110
|
buildNumber?: number | undefined;
|
|
111
111
|
engine: "capacitor" | "expo";
|
|
112
112
|
marketingVersion: string;
|
|
@@ -124,15 +124,15 @@ export declare const installAbsoluteIosRelease: (options: InstallAbsoluteIosRele
|
|
|
124
124
|
artifactPath: string;
|
|
125
125
|
metadata: {
|
|
126
126
|
artifact: "App.ipa";
|
|
127
|
+
bytes: number;
|
|
128
|
+
format: typeof ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
127
129
|
sha256: string;
|
|
128
130
|
type: "ipa";
|
|
129
|
-
format: typeof ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
130
131
|
platform: "ios";
|
|
131
132
|
releaseId: string;
|
|
132
133
|
runtime: string;
|
|
133
134
|
appBuild: string;
|
|
134
135
|
appId: string;
|
|
135
|
-
bytes: number;
|
|
136
136
|
buildNumber?: number | undefined;
|
|
137
137
|
engine: "capacitor" | "expo";
|
|
138
138
|
marketingVersion: string;
|
|
@@ -23,9 +23,9 @@ export declare const materializeAbsoluteMobileCompatibilityBundle: (input: Absol
|
|
|
23
23
|
export declare const readAbsoluteMobileMaterializedReleases: (root: string) => Promise<{
|
|
24
24
|
artifact: {
|
|
25
25
|
releaseId: string;
|
|
26
|
+
format: typeof import("./releaseArtifact").ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
26
27
|
pages: import("./releaseArtifact").AbsoluteMobileCompatibilityPage[];
|
|
27
28
|
routes: import("./releaseArtifact").AbsoluteMobileCompatibilityRoute[];
|
|
28
|
-
format: typeof import("./releaseArtifact").ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
29
29
|
generation: number;
|
|
30
30
|
runtime: string;
|
|
31
31
|
appBuild: string;
|
|
@@ -52,9 +52,9 @@ export type AbsoluteMobileResolvedRelease = {
|
|
|
52
52
|
};
|
|
53
53
|
export declare const createAbsoluteMobileCompatibilityArtifact: (input: AbsoluteMobileCompatibilityArtifactInput) => {
|
|
54
54
|
releaseId: string;
|
|
55
|
+
format: typeof ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
55
56
|
pages: AbsoluteMobileCompatibilityPage[];
|
|
56
57
|
routes: AbsoluteMobileCompatibilityRoute[];
|
|
57
|
-
format: typeof ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
58
58
|
generation: number;
|
|
59
59
|
runtime: string;
|
|
60
60
|
appBuild: string;
|
|
@@ -64,9 +64,9 @@ export declare const createAbsoluteMobileCompatibilityArtifact: (input: Absolute
|
|
|
64
64
|
export declare const hashAbsoluteMobilePropsSchema: (schema: unknown) => string;
|
|
65
65
|
export declare const parseAbsoluteMobileCompatibilityArtifact: (value: unknown) => {
|
|
66
66
|
releaseId: string;
|
|
67
|
+
format: typeof ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
67
68
|
pages: AbsoluteMobileCompatibilityPage[];
|
|
68
69
|
routes: AbsoluteMobileCompatibilityRoute[];
|
|
69
|
-
format: typeof ABSOLUTE_MOBILE_COMPATIBILITY_FORMAT;
|
|
70
70
|
generation: number;
|
|
71
71
|
runtime: string;
|
|
72
72
|
appBuild: string;
|
|
@@ -258,15 +258,15 @@ export declare const buildAbsoluteRemoteIosRelease: (options: BuildAbsoluteRemot
|
|
|
258
258
|
artifactPath: string;
|
|
259
259
|
metadata: {
|
|
260
260
|
artifact: "App.ipa";
|
|
261
|
+
bytes: number;
|
|
262
|
+
format: typeof import("./iosRelease").ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
261
263
|
sha256: string;
|
|
262
264
|
type: "ipa";
|
|
263
|
-
format: typeof import("./iosRelease").ABSOLUTE_IOS_RELEASE_FORMAT;
|
|
264
265
|
platform: "ios";
|
|
265
266
|
releaseId: string;
|
|
266
267
|
runtime: string;
|
|
267
268
|
appBuild: string;
|
|
268
269
|
appId: string;
|
|
269
|
-
bytes: number;
|
|
270
270
|
buildNumber?: number | undefined;
|
|
271
271
|
engine: "capacitor" | "expo";
|
|
272
272
|
marketingVersion: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { I18nConfig, I18nInstance, MessageCatalog, RequestI18n } from '../../types/i18n';
|
|
3
|
+
import { type RequestLocale } from '../utils/localeRef';
|
|
4
|
+
export declare const defineI18n: <const Locale extends string, const Default extends Locale, const Catalog extends MessageCatalog>(config: I18nConfig<Locale, Default, Catalog>) => I18nInstance<Locale, Default, Catalog>;
|
|
5
|
+
/** The current request's locale, once `i18nPlugin()` resolved it. */
|
|
6
|
+
export declare const getRequestLocale: () => RequestLocale | undefined;
|
|
7
|
+
/** Resolves every request's locale into the context as `locale` and
|
|
8
|
+
* `i18n` (a translator plus `payload()`, `alternates()` and
|
|
9
|
+
* `localizePath()`), sets `Content-Language`, and 404s a `:locale` route
|
|
10
|
+
* param that is not a configured locale. */
|
|
11
|
+
export declare const i18nPlugin: <const Locale extends string, const Default extends Locale, const Catalog extends MessageCatalog>(i18n: I18nInstance<Locale, Default, Catalog>) => Elysia<"", "local", {
|
|
12
|
+
decorator: {};
|
|
13
|
+
store: {};
|
|
14
|
+
derive: {
|
|
15
|
+
readonly i18n: RequestI18n<Locale, Catalog>;
|
|
16
|
+
readonly locale: Locale;
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
typebox: {};
|
|
20
|
+
error: [];
|
|
21
|
+
}, {
|
|
22
|
+
schema: {};
|
|
23
|
+
schemas: {};
|
|
24
|
+
macro: {};
|
|
25
|
+
macroFn: {};
|
|
26
|
+
parser: {};
|
|
27
|
+
response: {
|
|
28
|
+
200: "Not Found";
|
|
29
|
+
};
|
|
30
|
+
}, {}, import("elysia").DefaultEphemeral, import("elysia").DefaultEphemeral>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
/** Directive name → sources. `false` removes a default directive. */
|
|
3
|
+
export type CspDirectives = Record<string, readonly string[] | false>;
|
|
4
|
+
export type SecureHeadersOptions = {
|
|
5
|
+
/** `false` sends no Content-Security-Policy. */
|
|
6
|
+
contentSecurityPolicy?: false | {
|
|
7
|
+
/** Merged over the defaults, directive by directive. */
|
|
8
|
+
directives?: CspDirectives;
|
|
9
|
+
/** Send `Content-Security-Policy-Report-Only` instead. */
|
|
10
|
+
reportOnly?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** `X-Content-Type-Options: nosniff`. Default on. */
|
|
13
|
+
contentTypeOptions?: boolean;
|
|
14
|
+
/** CSP `frame-ancestors`. Default `["'self'"]`; `false` omits it. */
|
|
15
|
+
frameAncestors?: readonly string[] | false;
|
|
16
|
+
/** Feature → allowlist (`[]` disables the feature). `false` omits the
|
|
17
|
+
* header. */
|
|
18
|
+
permissionsPolicy?: Record<string, readonly string[]> | false;
|
|
19
|
+
/** Default `strict-origin-when-cross-origin`; `false` omits it. */
|
|
20
|
+
referrerPolicy?: string | false;
|
|
21
|
+
};
|
|
22
|
+
export declare const buildContentSecurityPolicy: (directives: CspDirectives, nonce: string | undefined, extraConnectSources?: readonly string[], extraScriptSources?: readonly string[]) => string;
|
|
23
|
+
/** The headers `secureHeaders(options)` sends for `request`. */
|
|
24
|
+
export declare const securityHeadersFor: (request: Request, options?: SecureHeadersOptions) => Record<string, string>;
|
|
25
|
+
/** The headers the active `secureHeaders()` plugin sends for `request`, or
|
|
26
|
+
* null without one. For responses produced before the plugin's hook runs
|
|
27
|
+
* (pre-rendered pages). */
|
|
28
|
+
export declare const activeSecurityHeadersFor: (request: Request) => Record<string, string> | null;
|
|
29
|
+
/** @internal Test hook: forgets the active plugin and turns nonces off. */
|
|
30
|
+
export declare const resetSecureHeaders: () => void;
|
|
31
|
+
export declare const secureHeaders: (options?: SecureHeadersOptions) => Elysia<"", "local", {
|
|
32
|
+
decorator: {};
|
|
33
|
+
store: {};
|
|
34
|
+
derive: {
|
|
35
|
+
/** This request's CSP nonce, for your own inline scripts. */
|
|
36
|
+
readonly cspNonce: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
typebox: {};
|
|
40
|
+
error: [];
|
|
41
|
+
}, {
|
|
42
|
+
schema: {};
|
|
43
|
+
schemas: {};
|
|
44
|
+
macro: {};
|
|
45
|
+
macroFn: {};
|
|
46
|
+
parser: {};
|
|
47
|
+
response: {};
|
|
48
|
+
}, {}, import("elysia").DefaultEphemeral, import("elysia").DefaultEphemeral>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Metadata } from '../../../types/metadata';
|
|
2
|
-
export declare const Head: ({ title, description, icon, font, cssPath, canonical, openGraph, twitter, robots, meta, jsonLd, preload, speculationRules }?: Metadata) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Head: ({ title, description, icon, font, fonts, cssPath, canonical, alternates, openGraph, twitter, robots, meta, jsonLd, preload, speculationRules }?: Metadata) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
type StreamSlotProps = {
|
|
2
2
|
className?: string;
|
|
3
|
+
/** Stream this slot on every request even when the page is
|
|
4
|
+
* pre-rendered (partial prerendering): the cached shell keeps the
|
|
5
|
+
* fallback. Set it on anything that reads the request or must be fresh. */
|
|
6
|
+
dynamic?: boolean;
|
|
3
7
|
errorHtml?: string;
|
|
4
8
|
fallbackHtml?: string;
|
|
5
9
|
id: string;
|
|
6
10
|
resolve: () => Promise<string> | string;
|
|
7
11
|
timeoutMs?: number;
|
|
8
12
|
};
|
|
9
|
-
export declare const StreamSlot: ({ className, errorHtml, fallbackHtml, id, resolve, timeoutMs }: StreamSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const StreamSlot: ({ className, dynamic, errorHtml, fallbackHtml, id, resolve, timeoutMs }: StreamSlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
type LegacySuspenseSlotProps = {
|
|
3
3
|
className?: string;
|
|
4
|
+
dynamic?: boolean;
|
|
4
5
|
errorHtml?: string;
|
|
5
6
|
fallbackHtml?: string;
|
|
6
7
|
id: string;
|
|
@@ -10,6 +11,7 @@ type LegacySuspenseSlotProps = {
|
|
|
10
11
|
type FrameworkSuspenseSlotProps<T = unknown> = {
|
|
11
12
|
children?: ReactNode | ((value: T) => ReactNode);
|
|
12
13
|
className?: string;
|
|
14
|
+
dynamic?: boolean;
|
|
13
15
|
errorFallback?: ReactNode | ((error: unknown) => ReactNode);
|
|
14
16
|
id: string;
|
|
15
17
|
promise?: Promise<T>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
type LegacySuspenseSlotProps = {
|
|
3
3
|
className?: string;
|
|
4
|
+
/** Stream this slot on every request even when the page is
|
|
5
|
+
* pre-rendered (partial prerendering): the cached shell keeps the
|
|
6
|
+
* fallback. Set it on anything that reads the request or must be fresh. */
|
|
7
|
+
dynamic?: boolean;
|
|
4
8
|
errorHtml?: string;
|
|
5
9
|
fallbackHtml?: string;
|
|
6
10
|
id: string;
|
|
@@ -10,6 +14,10 @@ type LegacySuspenseSlotProps = {
|
|
|
10
14
|
type FrameworkSuspenseRenderProps<T = unknown> = {
|
|
11
15
|
children: (value: Awaited<T>) => ReactNode;
|
|
12
16
|
className?: string;
|
|
17
|
+
/** Stream this slot on every request even when the page is
|
|
18
|
+
* pre-rendered (partial prerendering): the cached shell keeps the
|
|
19
|
+
* fallback. Set it on anything that reads the request or must be fresh. */
|
|
20
|
+
dynamic?: boolean;
|
|
13
21
|
errorFallback?: ReactNode | ((error: unknown) => ReactNode);
|
|
14
22
|
id: string;
|
|
15
23
|
fallback?: ReactNode;
|
|
@@ -24,6 +32,10 @@ type FrameworkSuspenseRenderProps<T = unknown> = {
|
|
|
24
32
|
type FrameworkSuspenseNodeProps = {
|
|
25
33
|
children?: ReactNode;
|
|
26
34
|
className?: string;
|
|
35
|
+
/** Stream this slot on every request even when the page is
|
|
36
|
+
* pre-rendered (partial prerendering): the cached shell keeps the
|
|
37
|
+
* fallback. Set it on anything that reads the request or must be fresh. */
|
|
38
|
+
dynamic?: boolean;
|
|
27
39
|
errorFallback?: ReactNode | ((error: unknown) => ReactNode);
|
|
28
40
|
id: string;
|
|
29
41
|
promise?: Promise<ReactNode>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { FileRouteServerModuleFor } from '../../types/fileRoutes';
|
|
3
|
+
import { type FileRouteAdapterInput } from '../core/fileRouteAdapter';
|
|
4
|
+
type PagePropsOf<PageModule> = PageModule extends {
|
|
5
|
+
default: ComponentType<infer Props>;
|
|
6
|
+
} ? Props : never;
|
|
7
|
+
type ReactFileRouteInput<Path extends string, PageModule, ServerModule> = FileRouteAdapterInput<Path> & {
|
|
8
|
+
page: () => Promise<PageModule>;
|
|
9
|
+
server?: () => Promise<ServerModule>;
|
|
10
|
+
};
|
|
11
|
+
/** One React file route, as written by the generated route module. The
|
|
12
|
+
* type arguments check the route at compile time: `ServerModule`'s `load`
|
|
13
|
+
* must accept this path's params and return the page component's props
|
|
14
|
+
* (and must exist when the page has required props). */
|
|
15
|
+
export declare const reactFileRoute: <Path extends string, PageModule extends {
|
|
16
|
+
default: unknown;
|
|
17
|
+
}, ServerModule extends FileRouteServerModuleFor<Path, PagePropsOf<PageModule>>>(route: ReactFileRouteInput<Path, PageModule, ServerModule>) => import("..").FileRouteDefinition;
|
|
18
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { Breakpoint, Breakpoints } from '../../../types/mediaQuery';
|
|
2
|
+
export { I18nProvider, useI18n } from './useI18n';
|
|
2
3
|
export { useIslandStore } from './useIslandStore';
|
|
3
4
|
export { UserAgentProvider, useMediaQuery } from './useMediaQuery';
|
|
4
5
|
export { usePrefetch } from './usePrefetch';
|
|
5
6
|
export type { UsePrefetchOptions } from './usePrefetch';
|
|
6
7
|
export type { PrefetchKind, PrefetchMode } from '../../../types/prefetch';
|
|
8
|
+
export { useFormAction } from './useFormAction';
|
|
9
|
+
export type { UseFormActionOptions } from './useFormAction';
|
|
10
|
+
export { formActionReducer, submitFormAction } from '../../client/formActions';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type FormEvent } from 'react';
|
|
2
|
+
import type { ActionFields, ActionPath, ActionStateOf, AnyFormAction } from '../../../types/formAction';
|
|
3
|
+
export type UseFormActionOptions<Action extends AnyFormAction> = {
|
|
4
|
+
/** The result a submission without JavaScript left for this page:
|
|
5
|
+
* `getActionState(action)` in the route, passed down as a prop. */
|
|
6
|
+
initialState?: ActionStateOf<Action>;
|
|
7
|
+
/** Clear the form's fields after a successful submission that doesn't
|
|
8
|
+
* redirect. Default true. */
|
|
9
|
+
resetOnSuccess?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Progressive-enhancement form state for a `defineAction` action:
|
|
13
|
+
*
|
|
14
|
+
* const signup = useFormAction<typeof createUser>('/users', {
|
|
15
|
+
* initialState: props.signupState
|
|
16
|
+
* });
|
|
17
|
+
* <form {...signup.formProps}>
|
|
18
|
+
* <input name="name" defaultValue={signup.values.name} />
|
|
19
|
+
* {signup.errors.name && <p>{signup.errors.name}</p>}
|
|
20
|
+
* <button disabled={signup.pending}>Save</button>
|
|
21
|
+
* </form>
|
|
22
|
+
*
|
|
23
|
+
* `formProps` renders a real `method="post"` form, so it works before
|
|
24
|
+
* hydration and without JavaScript; once hydrated, submissions go through
|
|
25
|
+
* fetch and `state` / `pending` / `errors` update in place.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useFormAction: <Action extends AnyFormAction = AnyFormAction>(path: ActionPath<Action>, options?: UseFormActionOptions<Action>) => {
|
|
28
|
+
data: import("../..").ActionData<Action> | undefined;
|
|
29
|
+
errors: Partial<Record<ActionFields<Action>, string>>;
|
|
30
|
+
formProps: {
|
|
31
|
+
action: ActionPath<Action>;
|
|
32
|
+
encType: string;
|
|
33
|
+
method: string;
|
|
34
|
+
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
|
35
|
+
};
|
|
36
|
+
message: string | undefined;
|
|
37
|
+
pending: boolean;
|
|
38
|
+
reset: () => void;
|
|
39
|
+
state: ActionStateOf<Action>;
|
|
40
|
+
submit: (body: FormData) => Promise<import("../..").ActionResult<import("../..").ActionData<Action>, ActionFields<Action>>>;
|
|
41
|
+
values: Partial<Record<ActionFields<Action>, string | string[]>>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { I18nPayload, MessageCatalog } from '../../../types/i18n';
|
|
3
|
+
type I18nProviderProps = {
|
|
4
|
+
/** The payload from the server (`i18n.payload()`), passed down as a
|
|
5
|
+
* page prop so the browser hydrates with the same messages. */
|
|
6
|
+
value: I18nPayload;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** Makes a locale's messages available to `useI18n()` below it. */
|
|
10
|
+
export declare const I18nProvider: ({ value, children }: I18nProviderProps) => import("react").FunctionComponentElement<import("react").ProviderProps<I18nPayload | null>>;
|
|
11
|
+
/** The translator for the nearest `I18nProvider`. Pass your default
|
|
12
|
+
* catalog's type to type-check keys and ICU parameters:
|
|
13
|
+
* `const { t } = useI18n<typeof en>()`. */
|
|
14
|
+
export declare const useI18n: <Catalog = MessageCatalog>() => import("../..").Translator<Catalog>;
|
|
15
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { handleReactPageRequest } from './pageHandler';
|
|
2
|
+
export { reactFileRoute } from './fileRoute';
|
|
3
|
+
export { handleReactServerPageRequest } from './serverComponents/pageHandler';
|
|
2
4
|
export { Island } from './Island';
|
|
3
5
|
export { createTypedIsland } from './createIsland';
|
|
4
6
|
export { useIslandStore } from './hooks/useIslandStore';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Manifest key of the browser entry that hydrates every RSC page. */
|
|
2
|
+
export declare const REACT_SERVER_CLIENT_MANIFEST_KEY = "ReactServerClient";
|
|
3
|
+
/** `asset(manifest, '<Page>RSC')` names a page's react-server bundle. */
|
|
4
|
+
export declare const REACT_SERVER_PAGE_MANIFEST_SUFFIX = "RSC";
|
|
5
|
+
/** Global array the inline Flight payload scripts push into. */
|
|
6
|
+
export declare const REACT_SERVER_PAYLOAD_GLOBAL = "__absoluteReactServerPayload";
|
|
7
|
+
/** Manifest key of the server bundle that renders Flight to HTML. */
|
|
8
|
+
export declare const REACT_SERVER_RENDERER_MANIFEST_KEY = "ReactServerRenderer";
|
|
9
|
+
/** Written next to the react-server page bundles: where the SSR renderer and
|
|
10
|
+
* the hydration entry of the same build live. */
|
|
11
|
+
export declare const REACT_SERVER_RUNTIME_FILE = "react-server-runtime.json";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type StreamingSlotEnhancerOptions } from '../../core/responseEnhancers';
|
|
2
|
+
export type ReactServerPageRequestInput<Props extends Record<string, unknown> = Record<never, never>> = StreamingSlotEnhancerOptions & {
|
|
3
|
+
/** Buffer the response so it can carry a content-hash `ETag`. */
|
|
4
|
+
bufferStreamForEtag?: boolean;
|
|
5
|
+
collectStreamingSlots?: boolean;
|
|
6
|
+
/** `asset(manifest, '<Page>RSC')`: the page's react-server bundle. */
|
|
7
|
+
page: string;
|
|
8
|
+
request?: Request;
|
|
9
|
+
} & (keyof Props extends never ? {
|
|
10
|
+
props?: NoInfer<Props>;
|
|
11
|
+
} : {
|
|
12
|
+
props: NoInfer<Props>;
|
|
13
|
+
});
|
|
14
|
+
export declare const handleReactServerPageRequest: <Props extends Record<string, unknown> = Record<never, never>>(input: ReactServerPageRequestInput<Props>) => Promise<Response>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FileRouteServerModuleFor } from '../../types/fileRoutes';
|
|
2
|
+
import type { SveltePropsOf } from '../../types/svelte';
|
|
3
|
+
import { type FileRouteAdapterInput } from '../core/fileRouteAdapter';
|
|
4
|
+
type PagePropsOf<PageModule> = PageModule extends {
|
|
5
|
+
default: infer Page;
|
|
6
|
+
} ? SveltePropsOf<Page> : never;
|
|
7
|
+
/** One Svelte file route, as written by the generated route module. The page
|
|
8
|
+
* renders from its compiled module in the manifest; `PageModule` (the
|
|
9
|
+
* `.svelte` file's type) only types the props `load` has to return. */
|
|
10
|
+
export declare const svelteFileRoute: <Path extends string, PageModule extends {
|
|
11
|
+
default: unknown;
|
|
12
|
+
}, ServerModule extends FileRouteServerModuleFor<Path, PagePropsOf<PageModule>>>(route: FileRouteAdapterInput<Path> & {
|
|
13
|
+
server?: () => Promise<ServerModule>;
|
|
14
|
+
}) => import("..").FileRouteDefinition;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { I18nPayload, MessageCatalog } from '../../types/i18n';
|
|
2
|
+
/** The translator `setI18n()` shared from an ancestor component. */
|
|
3
|
+
export declare const getI18n: <Catalog = MessageCatalog>() => import("..").Translator<Catalog>;
|
|
4
|
+
/** Call in the page component with the payload prop from the server:
|
|
5
|
+
* shares the locale's messages with every component below (`getI18n()`)
|
|
6
|
+
* and returns this page's translator. Pass your default catalog's type
|
|
7
|
+
* to type-check keys and ICU parameters. */
|
|
8
|
+
export declare const setI18n: <Catalog = MessageCatalog>(payload: I18nPayload) => import("..").Translator<Catalog>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { handleSveltePageRequest } from './pageHandler';
|
|
2
|
+
export { svelteFileRoute } from './fileRoute';
|
|
3
|
+
export { getI18n, setI18n } from './i18n';
|
|
2
4
|
export { createTypedIsland } from './createIsland';
|
|
3
5
|
export { useIslandStore } from './islandStore';
|
|
4
6
|
export { renderIsland } from './renderIsland';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const AWAIT_STREAM_DIRECTIVE = "<!-- absolute:stream -->";
|
|
2
|
+
/** Lowers every `{#await}` marked with `AWAIT_STREAM_DIRECTIVE` to a
|
|
3
|
+
* streaming slot and leaves every other block to Svelte. Throws for a
|
|
4
|
+
* marked block it can't stream. */
|
|
5
|
+
export declare const lowerSvelteAwaitSlotSyntax: (source: string, filePath?: string) => {
|
|
2
6
|
code: string;
|
|
3
7
|
transformed: boolean;
|
|
4
8
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Component, ComponentProps } from 'svelte';
|
|
2
2
|
export declare const SVELTE_PAGE_ROOT_ID = "__absolute_svelte_root__";
|
|
3
3
|
export type RenderStreamOptions = {
|
|
4
|
-
|
|
4
|
+
/** Inline script before the bootstrap scripts. A function is called
|
|
5
|
+
* after the render, so it can describe what the render did. */
|
|
6
|
+
bootstrapScriptContent?: string | (() => string);
|
|
5
7
|
bootstrapScripts?: string[];
|
|
6
8
|
bootstrapModules?: string[];
|
|
7
9
|
nonce?: string;
|
|
@@ -10,5 +12,11 @@ export type RenderStreamOptions = {
|
|
|
10
12
|
signal?: AbortSignal;
|
|
11
13
|
headContent?: string;
|
|
12
14
|
bodyContent?: string;
|
|
15
|
+
/** Svelte context for the root component (`render(…, { context })`). */
|
|
16
|
+
context?: Map<unknown, unknown>;
|
|
17
|
+
/** Called after each render pass; resolve `true` to render again (up
|
|
18
|
+
* to {@link MAX_RENDER_PASSES} passes). The Svelte router uses it to
|
|
19
|
+
* await guards and lazy routes between passes. */
|
|
20
|
+
settle?: () => Promise<boolean>;
|
|
13
21
|
};
|
|
14
|
-
export declare const renderToReadableStream: <Comp extends Component<Record<string, unknown>>>(component: Comp, props?: ComponentProps<Comp>, { bootstrapScriptContent, bootstrapScripts, bootstrapModules, nonce, onError, progressiveChunkSize, signal, headContent, bodyContent }?: RenderStreamOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
22
|
+
export declare const renderToReadableStream: <Comp extends Component<Record<string, unknown>>>(component: Comp, props?: ComponentProps<Comp>, { bootstrapScriptContent, bootstrapScripts, bootstrapModules, nonce, onError, progressiveChunkSize, signal, headContent, bodyContent, context, settle }?: RenderStreamOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { goto } from './goto';
|
|
2
|
+
export { NavigationRedirect, redirect } from './guards';
|
|
3
|
+
export { beforeNavigate, preloadRoute } from './navigation';
|
|
2
4
|
export { page } from './page.svelte';
|
|
3
5
|
export { pushState, replaceState } from './pushState';
|
|
4
|
-
export type { ExtractRouteParams, GotoOptions, LinkPrefetchMode, PageState, RouterMode } from '../../../types/svelteRouter';
|
|
6
|
+
export type { ExtractRouteParams, GotoOptions, LazyRouteLoader, LazyRouteModule, LinkPrefetchMode, NavigationContext, NavigationOutcome, NavigationRedirectTarget, NavigationType, PageState, RouteGuard, RouteGuardResult, RouterMode } from '../../../types/svelteRouter';
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import type { GotoOptions
|
|
1
|
+
import type { GotoOptions } from '../../../types/svelteRouter';
|
|
2
|
+
export { setRouterMode } from './navigation';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* Programmatically navigate to a URL. Runs the navigation guards
|
|
5
|
+
* (`beforeNavigate`, `<Router guard>`, `<Route guard>`), then updates
|
|
6
|
+
* `page.url`, writes history, swaps the route (inside
|
|
7
|
+
* `document.startViewTransition` when supported) and scrolls: to the
|
|
8
|
+
* `#hash` target when the URL has one, otherwise to the top — unless
|
|
9
|
+
* `noScroll` is set.
|
|
10
|
+
*
|
|
11
|
+
* Resolves to what happened: `'committed'`, `'cancelled'` (a guard said
|
|
12
|
+
* no), `'redirected'`, `'superseded'` (a newer navigation started while a
|
|
13
|
+
* guard was pending) or `'external'` (another origin; the browser loads it).
|
|
11
14
|
*
|
|
12
15
|
* Mirrors SvelteKit's `goto` from `$app/navigation` — same name, same
|
|
13
16
|
* options shape, so a SvelteKit user finds the primitive familiar.
|
|
14
17
|
*/
|
|
15
|
-
export declare const goto: (target: string, options?: GotoOptions) => Promise<
|
|
18
|
+
export declare const goto: (target: string, options?: GotoOptions) => Promise<import("./browser").NavigationOutcome>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NavigationContext, NavigationRedirectTarget, RouteGuard } from '../../../types/svelteRouter';
|
|
2
|
+
export type GuardEntry = {
|
|
3
|
+
guard: RouteGuard;
|
|
4
|
+
params: Record<string, string | undefined>;
|
|
5
|
+
};
|
|
6
|
+
export type GuardDecision = {
|
|
7
|
+
kind: 'allow';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'cancel';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'redirect';
|
|
12
|
+
location: string;
|
|
13
|
+
replace: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'stale';
|
|
16
|
+
};
|
|
17
|
+
export type GuardRunContext = Omit<NavigationContext, 'params'>;
|
|
18
|
+
/** Thrown (or returned) by `redirect()`. An `Error` so a throw from deep
|
|
19
|
+
* inside a helper keeps a useful stack; recognised structurally, so a
|
|
20
|
+
* copy of the router bundled twice still understands it. */
|
|
21
|
+
export declare class NavigationRedirect extends Error implements NavigationRedirectTarget {
|
|
22
|
+
redirect: string;
|
|
23
|
+
replace: boolean;
|
|
24
|
+
constructor(location: string, replace: boolean);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Redirect from inside a guard. Return it, or throw it from a helper the
|
|
28
|
+
* guard calls — both short-circuit the guard chain the same way:
|
|
29
|
+
*
|
|
30
|
+
* guard={({ request }) => {
|
|
31
|
+
* if (!isSignedIn(request)) throw redirect('/login');
|
|
32
|
+
* }}
|
|
33
|
+
*
|
|
34
|
+
* In the browser the redirect adds a history entry unless
|
|
35
|
+
* `{ replace: true }`; on the server it is a 302.
|
|
36
|
+
*/
|
|
37
|
+
export declare const redirect: (location: string, options?: {
|
|
38
|
+
replace?: boolean;
|
|
39
|
+
}) => NavigationRedirect;
|
|
40
|
+
/** Run `entries` one after another; the first guard that cancels or
|
|
41
|
+
* redirects decides. `isStale` is checked after every guard so a newer
|
|
42
|
+
* navigation can abandon this one mid-chain. */
|
|
43
|
+
export declare const runGuardChain: (entries: GuardEntry[], context: GuardRunContext, isStale?: () => boolean) => Promise<GuardDecision>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { goto } from './goto';
|
|
2
|
+
export { NavigationRedirect, redirect } from './guards';
|
|
3
|
+
export { beforeNavigate, preloadRoute } from './navigation';
|
|
2
4
|
export { page } from './page.svelte';
|
|
3
5
|
export { pushState, replaceState } from './pushState';
|
|
4
|
-
export type { ExtractRouteParams, GotoOptions, LinkPrefetchMode, PageState, RouterMode } from '../../../types/svelteRouter';
|
|
6
|
+
export type { ExtractRouteParams, GotoOptions, LazyRouteLoader, LazyRouteModule, LinkPrefetchMode, NavigationContext, NavigationOutcome, NavigationRedirectTarget, NavigationType, PageState, RouteGuard, RouteGuardResult, RouterMode } from '../../../types/svelteRouter';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LazyRouteLoader } from '../../../types/svelteRouter';
|
|
2
|
+
import { type LazyComponent } from './lazyModule';
|
|
3
|
+
/** Forget a failed (or stale) load so the next attempt calls the loader
|
|
4
|
+
* again. */
|
|
5
|
+
export declare const forgetLazy: (key: string) => void;
|
|
6
|
+
export declare const hasPendingLazyLoads: () => boolean;
|
|
7
|
+
export declare const lazyCacheKey: (pattern: string, loader: LazyRouteLoader) => string;
|
|
8
|
+
/** Load (once) and cache the component behind `loader`. */
|
|
9
|
+
export declare const loadLazy: (key: string, loader: LazyRouteLoader) => Promise<LazyComponent>;
|
|
10
|
+
/** The component for `key` if it has already loaded — or, during the
|
|
11
|
+
* first hydration, the module the hydration entry loaded ahead of time
|
|
12
|
+
* for this route pattern. */
|
|
13
|
+
export declare const peekLazy: (key: string, pattern: string) => LazyComponent | undefined;
|
|
14
|
+
/** Resolves once every lazy route load in flight has settled, or after a
|
|
15
|
+
* few seconds — scroll restoration waits on this so it doesn't restore a
|
|
16
|
+
* position into content that hasn't rendered yet. */
|
|
17
|
+
export declare const whenLazySettled: () => Promise<void>;
|