@sveltejs/kit 3.0.0-next.0 → 3.0.0-next.10
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/package.json +33 -21
- package/src/core/adapt/builder.js +29 -43
- package/src/core/adapt/index.js +1 -4
- package/src/core/config/index.js +132 -71
- package/src/core/config/options.js +294 -244
- package/src/core/config/types.d.ts +1 -1
- package/src/core/env.js +121 -5
- package/src/core/generate_manifest/index.js +12 -15
- package/src/core/postbuild/analyse.js +7 -19
- package/src/core/postbuild/crawl.js +22 -6
- package/src/core/postbuild/prerender.js +42 -23
- package/src/core/sync/create_manifest_data/index.js +53 -50
- package/src/core/sync/sync.js +0 -2
- package/src/core/sync/write_client_manifest.js +8 -15
- package/src/core/sync/write_env.js +2 -1
- package/src/core/sync/write_non_ambient.js +12 -9
- package/src/core/sync/write_server.js +13 -14
- package/src/core/sync/write_tsconfig.js +16 -8
- package/src/core/sync/write_tsconfig_test/package.json +7 -0
- package/src/core/sync/write_types/index.js +28 -24
- package/src/core/utils.js +2 -2
- package/src/exports/env/index.js +12 -0
- package/src/exports/hooks/index.js +3 -9
- package/src/exports/hooks/sequence.js +3 -2
- package/src/exports/index.js +35 -13
- package/src/exports/internal/client.js +5 -0
- package/src/exports/internal/env.js +2 -2
- package/src/exports/internal/index.js +1 -90
- package/src/exports/internal/{event.js → server/event.js} +1 -2
- package/src/exports/internal/server/index.js +33 -0
- package/src/exports/internal/shared.js +89 -0
- package/src/exports/node/index.js +62 -15
- package/src/exports/params.js +63 -0
- package/src/exports/public.d.ts +323 -170
- package/src/exports/url.js +86 -0
- package/src/exports/vite/build/build_server.js +53 -59
- package/src/exports/vite/build/remote.js +18 -11
- package/src/exports/vite/build/utils.js +0 -8
- package/src/exports/vite/dev/index.js +42 -44
- package/src/exports/vite/index.js +810 -593
- package/src/exports/vite/preview/index.js +29 -22
- package/src/exports/vite/static_analysis/index.js +2 -4
- package/src/exports/vite/static_analysis/types.d.ts +14 -0
- package/src/exports/vite/utils.js +21 -36
- package/src/runtime/app/env/internal.js +4 -4
- package/src/runtime/app/env/types.d.ts +1 -1
- package/src/runtime/app/environment/index.js +6 -0
- package/src/runtime/app/forms.js +24 -7
- package/src/runtime/app/paths/client.js +4 -10
- package/src/runtime/app/paths/internal/client.js +4 -2
- package/src/runtime/app/paths/internal/server.js +2 -23
- package/src/runtime/app/paths/public.d.ts +0 -28
- package/src/runtime/app/paths/server.js +9 -5
- package/src/runtime/app/server/remote/command.js +0 -3
- package/src/runtime/app/server/remote/form.js +27 -15
- package/src/runtime/app/server/remote/prerender.js +29 -36
- package/src/runtime/app/server/remote/query.js +101 -99
- package/src/runtime/app/server/remote/requested.js +22 -14
- package/src/runtime/app/server/remote/shared.js +30 -26
- package/src/runtime/app/state/client.js +1 -2
- package/src/runtime/app/stores.js +13 -76
- package/src/runtime/client/bundle.js +1 -1
- package/src/runtime/client/client-entry.js +3 -0
- package/src/runtime/client/client.js +411 -318
- package/src/runtime/client/entry.js +24 -3
- package/src/runtime/client/fetcher.js +3 -2
- package/src/runtime/client/ndjson.js +6 -33
- package/src/runtime/client/payload.js +17 -0
- package/src/runtime/client/remote-functions/cache.svelte.js +3 -1
- package/src/runtime/client/remote-functions/command.svelte.js +7 -32
- package/src/runtime/client/remote-functions/form.svelte.js +183 -112
- package/src/runtime/client/remote-functions/prerender.svelte.js +29 -8
- package/src/runtime/client/remote-functions/query/index.js +7 -14
- package/src/runtime/client/remote-functions/query/instance.svelte.js +63 -18
- package/src/runtime/client/remote-functions/query/proxy.js +3 -3
- package/src/runtime/client/remote-functions/query-batch.svelte.js +60 -68
- package/src/runtime/client/remote-functions/query-live/instance.svelte.js +60 -18
- package/src/runtime/client/remote-functions/query-live/iterator.js +36 -55
- package/src/runtime/client/remote-functions/shared.svelte.js +88 -62
- package/src/runtime/client/sse.js +32 -0
- package/src/runtime/client/state.svelte.js +65 -49
- package/src/runtime/client/stream.js +38 -0
- package/src/runtime/client/types.d.ts +11 -7
- package/src/runtime/client/utils.js +0 -96
- package/src/runtime/components/root.svelte +66 -0
- package/src/runtime/env/dynamic/private.js +7 -0
- package/src/runtime/env/dynamic/public.js +7 -0
- package/src/runtime/env/static/private.js +6 -0
- package/src/runtime/env/static/public.js +6 -0
- package/src/runtime/form-utils.js +100 -22
- package/src/runtime/server/cookie.js +69 -52
- package/src/runtime/server/csrf.js +65 -0
- package/src/runtime/server/data/index.js +14 -18
- package/src/runtime/server/env_module.js +0 -5
- package/src/runtime/server/index.js +2 -2
- package/src/runtime/server/page/actions.js +41 -26
- package/src/runtime/server/page/index.js +9 -15
- package/src/runtime/server/page/load_data.js +1 -1
- package/src/runtime/server/page/render.js +112 -187
- package/src/runtime/server/page/respond_with_error.js +7 -8
- package/src/runtime/server/page/server_routing.js +27 -18
- package/src/runtime/server/remote.js +355 -216
- package/src/runtime/server/respond.js +97 -61
- package/src/runtime/server/utils.js +32 -9
- package/src/runtime/shared.js +83 -13
- package/src/runtime/telemetry/otel.js +1 -1
- package/src/runtime/types.d.ts +8 -0
- package/src/types/ambient.d.ts +10 -5
- package/src/types/global-private.d.ts +15 -22
- package/src/types/internal.d.ts +89 -74
- package/src/types/private.d.ts +33 -1
- package/src/utils/error.js +24 -4
- package/src/utils/import.js +6 -1
- package/src/utils/imports.js +83 -0
- package/src/utils/mime.js +9 -0
- package/src/utils/params.js +66 -0
- package/src/utils/routing.js +90 -44
- package/src/utils/shared-iterator.js +5 -0
- package/src/utils/streaming.js +14 -4
- package/src/utils/url.js +20 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +467 -537
- package/types/index.d.ts.map +22 -39
- package/src/core/sync/write_root.js +0 -148
- package/src/exports/internal/server.js +0 -22
- package/src/types/synthetic/$lib.md +0 -5
- /package/src/exports/internal/{remote-functions.js → server/remote-functions.js} +0 -0
|
@@ -1,101 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// TODO: remove this file when enough people have migrated to Kit 3
|
|
2
|
+
|
|
3
|
+
/** @returns {never} */
|
|
4
|
+
function removed() {
|
|
5
|
+
throw new Error(
|
|
6
|
+
'`$app/stores` has been removed in favour of `$app/state`. See https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated'
|
|
7
|
+
);
|
|
8
|
+
}
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
|
-
* A function that returns all of the contextual stores. On the server, this must be called during component initialization.
|
|
7
|
-
* Only use this if you need to defer store subscription until after the component has mounted, for some reason.
|
|
8
|
-
*
|
|
9
11
|
* @deprecated Use `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
10
12
|
*/
|
|
11
|
-
export const getStores =
|
|
12
|
-
const stores = BROWSER ? browser_stores : getContext('__svelte__');
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
/** @type {typeof page} */
|
|
16
|
-
page: {
|
|
17
|
-
subscribe: stores.page.subscribe
|
|
18
|
-
},
|
|
19
|
-
/** @type {typeof navigating} */
|
|
20
|
-
navigating: {
|
|
21
|
-
subscribe: stores.navigating.subscribe
|
|
22
|
-
},
|
|
23
|
-
/** @type {typeof updated} */
|
|
24
|
-
updated: stores.updated
|
|
25
|
-
};
|
|
26
|
-
};
|
|
13
|
+
export const getStores = removed;
|
|
27
14
|
|
|
28
15
|
/**
|
|
29
|
-
* A readable store whose value contains page data.
|
|
30
|
-
*
|
|
31
|
-
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
32
|
-
*
|
|
33
16
|
* @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
34
17
|
* @type {import('svelte/store').Readable<import('@sveltejs/kit').Page>}
|
|
35
18
|
*/
|
|
36
19
|
export const page = {
|
|
37
|
-
subscribe
|
|
38
|
-
const store = DEV ? get_store('page') : getStores().page;
|
|
39
|
-
return store.subscribe(fn);
|
|
40
|
-
}
|
|
20
|
+
subscribe: removed
|
|
41
21
|
};
|
|
42
22
|
|
|
43
23
|
/**
|
|
44
|
-
* A readable store.
|
|
45
|
-
* When navigating starts, its value is a `Navigation` object with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties.
|
|
46
|
-
* When navigating finishes, its value reverts to `null`.
|
|
47
|
-
*
|
|
48
|
-
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
49
|
-
*
|
|
50
24
|
* @deprecated Use `navigating` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
51
25
|
* @type {import('svelte/store').Readable<import('@sveltejs/kit').Navigation | null>}
|
|
52
26
|
*/
|
|
53
27
|
export const navigating = {
|
|
54
|
-
subscribe
|
|
55
|
-
const store = DEV ? get_store('navigating') : getStores().navigating;
|
|
56
|
-
return store.subscribe(fn);
|
|
57
|
-
}
|
|
28
|
+
subscribe: removed
|
|
58
29
|
};
|
|
59
30
|
|
|
60
31
|
/**
|
|
61
|
-
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling.
|
|
62
|
-
*
|
|
63
|
-
* On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time.
|
|
64
|
-
*
|
|
65
32
|
* @deprecated Use `updated` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
|
|
66
33
|
* @type {import('svelte/store').Readable<boolean> & { check(): Promise<boolean> }}
|
|
67
34
|
*/
|
|
68
35
|
export const updated = {
|
|
69
|
-
subscribe
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (BROWSER) {
|
|
73
|
-
updated.check = store.check;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return store.subscribe(fn);
|
|
77
|
-
},
|
|
78
|
-
check: () => {
|
|
79
|
-
throw new Error(
|
|
80
|
-
BROWSER
|
|
81
|
-
? 'Cannot check updated store before subscribing'
|
|
82
|
-
: 'Can only check updated store in browser'
|
|
83
|
-
);
|
|
84
|
-
}
|
|
36
|
+
subscribe: removed,
|
|
37
|
+
check: removed
|
|
85
38
|
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* @template {keyof ReturnType<typeof getStores>} Name
|
|
89
|
-
* @param {Name} name
|
|
90
|
-
* @returns {ReturnType<typeof getStores>[Name]}
|
|
91
|
-
*/
|
|
92
|
-
function get_store(name) {
|
|
93
|
-
try {
|
|
94
|
-
return getStores()[name];
|
|
95
|
-
} catch {
|
|
96
|
-
throw new Error(
|
|
97
|
-
`Cannot subscribe to '${name}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.` +
|
|
98
|
-
'For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server'
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
}
|