@sveltejs/kit 3.0.0-next.11 → 3.0.0-next.13
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 +10 -10
- package/src/cli.js +8 -8
- package/src/constants.js +1 -1
- package/src/core/config/options.js +43 -35
- package/src/core/env.js +25 -11
- package/src/core/postbuild/prerender.js +3 -3
- package/src/core/sync/sync.js +11 -14
- package/src/core/sync/utils.js +21 -1
- package/src/core/sync/{write_non_ambient.js → write_app_types.js} +24 -23
- package/src/core/sync/write_client_manifest.js +4 -12
- package/src/core/sync/write_env.js +6 -4
- package/src/core/sync/write_server.js +10 -15
- package/src/core/sync/write_tsconfig/index.js +257 -0
- package/src/core/sync/write_tsconfig/utils.js +162 -0
- package/src/core/sync/write_types/index.js +80 -88
- package/src/exports/index.js +23 -12
- package/src/exports/internal/server/index.js +3 -1
- package/src/exports/internal/shared.js +4 -12
- package/src/exports/public.d.ts +87 -62
- package/src/exports/vite/build/remote.js +10 -12
- package/src/exports/vite/dev/index.js +113 -88
- package/src/exports/vite/index.js +452 -237
- package/src/exports/vite/module_ids.js +3 -1
- package/src/exports/vite/utils.js +1 -10
- package/src/runner.js +13 -0
- package/src/runtime/app/forms.js +4 -0
- package/src/runtime/app/manifest/index.js +1 -0
- package/src/runtime/app/paths/client.js +30 -30
- package/src/runtime/app/paths/internal/client.js +26 -0
- package/src/runtime/app/paths/server.js +22 -9
- package/src/runtime/app/paths/types.d.ts +11 -19
- package/src/runtime/app/server/remote/command.js +12 -7
- package/src/runtime/app/server/remote/form.js +37 -26
- package/src/runtime/app/server/remote/prerender.js +22 -11
- package/src/runtime/app/server/remote/query.js +5 -4
- package/src/runtime/app/server/remote/requested.js +4 -4
- package/src/runtime/app/server/remote/shared.js +48 -30
- package/src/runtime/app/service-worker/index.js +24 -0
- package/src/runtime/app/state/client.js +3 -0
- package/src/runtime/app/state/index.js +3 -3
- package/src/runtime/app/state/server.js +3 -0
- package/src/runtime/client/client.js +627 -311
- package/src/runtime/client/constants.js +2 -6
- package/src/runtime/client/fetcher.js +27 -17
- package/src/runtime/client/remote-functions/form.svelte.js +82 -58
- package/src/runtime/client/remote-functions/prerender.svelte.js +1 -1
- package/src/runtime/client/remote-functions/query/index.js +2 -2
- package/src/runtime/client/remote-functions/query/instance.svelte.js +2 -2
- package/src/runtime/client/remote-functions/query-batch.svelte.js +3 -4
- package/src/runtime/client/remote-functions/query-live/instance.svelte.js +2 -2
- package/src/runtime/client/remote-functions/query-live/iterator.js +15 -10
- package/src/runtime/client/remote-functions/shared.svelte.js +15 -11
- package/src/runtime/client/state.svelte.js +54 -33
- package/src/runtime/client/types.d.ts +1 -2
- package/src/runtime/client/utils.js +21 -14
- package/src/runtime/components/root.svelte +4 -14
- package/src/runtime/form-utils.js +89 -54
- package/src/runtime/props.svelte.js +71 -0
- package/src/runtime/server/cookie.js +1 -1
- package/src/runtime/server/data/index.js +31 -28
- package/src/runtime/server/errors.js +1 -1
- package/src/runtime/server/fetch.js +4 -6
- package/src/runtime/server/page/actions.js +3 -3
- package/src/runtime/server/page/csp.js +86 -103
- package/src/runtime/server/page/index.js +1 -2
- package/src/runtime/server/page/load_data.js +15 -5
- package/src/runtime/server/page/render.js +46 -52
- package/src/runtime/server/page/respond_with_error.js +1 -3
- package/src/runtime/server/remote-functions.js +66 -35
- package/src/runtime/server/respond.js +56 -16
- package/src/runtime/server/utils.js +10 -0
- package/src/types/ambient-private.d.ts +9 -1
- package/src/types/ambient.d.ts +23 -28
- package/src/types/global-private.d.ts +12 -0
- package/src/types/internal.d.ts +15 -10
- package/src/types/private.d.ts +3 -12
- package/src/utils/url.js +12 -0
- package/src/version.js +1 -1
- package/types/index.d.ts +172 -155
- package/types/index.d.ts.map +5 -1
- package/src/core/sync/write_ambient.js +0 -18
- package/src/core/sync/write_tsconfig.js +0 -258
- package/src/runtime/types.d.ts +0 -8
- /package/src/core/sync/{write_tsconfig_test → write_tsconfig/test-app}/package.json +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference no-default-lib="true"/>
|
|
2
|
+
/// <reference lib="esnext" />
|
|
3
|
+
/// <reference lib="webworker" />
|
|
4
|
+
|
|
5
|
+
import { DEV } from 'esm-env';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The execution context of a service worker. This export exists to make it easier to
|
|
9
|
+
* use service workers with the correct types, provided the importing module is governed
|
|
10
|
+
* by a `tsconfig.json` that extends [`$app/tsconfig/service-worker`](https://svelte.dev/docs/kit/$app-tsconfig-service-worker).
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export const self = /** @type {ServiceWorkerGlobalScope} */ (
|
|
14
|
+
/** @type {unknown} */ (globalThis.self)
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
if (DEV) {
|
|
18
|
+
if (
|
|
19
|
+
typeof ServiceWorkerGlobalScope === 'undefined' ||
|
|
20
|
+
!(self instanceof ServiceWorkerGlobalScope)
|
|
21
|
+
) {
|
|
22
|
+
throw new Error('The `$app/service-worker` module can only be imported into a service worker');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -14,8 +14,8 @@ import { BROWSER } from 'esm-env';
|
|
|
14
14
|
* A read-only reactive object with information about the current page, serving several use cases:
|
|
15
15
|
* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))
|
|
16
16
|
* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))
|
|
17
|
-
* - retrieving the page state that was set through `goto
|
|
18
|
-
* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error
|
|
17
|
+
* - retrieving the page state that was set through `goto` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))
|
|
18
|
+
* - retrieving metadata such as the URL you're on, the current route and its parameters, the target of a shallow navigation, and whether or not there was an error
|
|
19
19
|
*
|
|
20
20
|
* ```svelte
|
|
21
21
|
* <!--- file: +layout.svelte --->
|
|
@@ -58,7 +58,7 @@ export const page = BROWSER ? client_page : server_page;
|
|
|
58
58
|
export const navigating = BROWSER ? client_navigating : server_navigating;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* A read-only reactive value that's initially `false`.
|
|
61
|
+
* A read-only reactive value that's initially `false`. SvelteKit checks for new versions on data, remote, and form action responses (via the `x-sveltekit-version` header), when the tab regains focus or becomes visible, and on a poll interval (see [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version)). `updated.current` is set to `true` when a new version is detected. `updated.check()` will force an immediate check, regardless of polling.
|
|
62
62
|
* @type {{ get current(): boolean; check(): Promise<boolean>; }}
|
|
63
63
|
*/
|
|
64
64
|
export const updated = BROWSER ? client_updated : server_updated;
|
|
@@ -33,6 +33,9 @@ export const page = {
|
|
|
33
33
|
get route() {
|
|
34
34
|
return (DEV ? context_dev('page.route') : context()).page.route;
|
|
35
35
|
},
|
|
36
|
+
get shallow() {
|
|
37
|
+
return (DEV ? context_dev('page.shallow') : context()).page.shallow;
|
|
38
|
+
},
|
|
36
39
|
get state() {
|
|
37
40
|
return (DEV ? context_dev('page.state') : context()).page.state;
|
|
38
41
|
},
|