@sveltejs/kit 1.0.0-next.40 → 1.0.0-next.400
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/README.md +12 -9
- package/assets/app/env.js +13 -0
- package/assets/app/navigation.js +24 -0
- package/assets/app/paths.js +1 -0
- package/assets/{runtime/app → app}/stores.js +33 -29
- package/assets/client/singletons.js +13 -0
- package/assets/client/start.js +1845 -0
- package/assets/components/error.svelte +18 -2
- package/assets/env/dynamic/private.js +1 -0
- package/assets/env/dynamic/public.js +1 -0
- package/assets/env-private.js +9 -0
- package/assets/env-public.js +9 -0
- package/assets/env.js +8 -0
- package/assets/{runtime/chunks/paths.js → paths.js} +4 -3
- package/assets/server/index.js +3579 -0
- package/dist/chunks/error.js +12 -0
- package/dist/chunks/filesystem.js +110 -0
- package/dist/chunks/index.js +541 -3385
- package/dist/chunks/index2.js +15631 -473
- package/dist/chunks/index3.js +189 -217
- package/dist/chunks/multipart-parser.js +458 -0
- package/dist/chunks/sync.js +1368 -0
- package/dist/chunks/utils.js +40 -57
- package/dist/chunks/write_tsconfig.js +273 -0
- package/dist/cli.js +84 -513
- package/dist/hooks.js +28 -0
- package/dist/node/polyfills.js +17778 -0
- package/dist/node.js +348 -0
- package/dist/prerender.js +788 -0
- package/dist/vite.js +2520 -0
- package/package.json +98 -64
- package/svelte-kit.js +10 -1
- package/types/ambient.d.ts +375 -0
- package/types/index.d.ts +298 -0
- package/types/internal.d.ts +335 -0
- package/types/private.d.ts +235 -0
- package/CHANGELOG.md +0 -411
- package/assets/runtime/app/env.js +0 -5
- package/assets/runtime/app/navigation.js +0 -41
- package/assets/runtime/app/paths.js +0 -1
- package/assets/runtime/chunks/utils.js +0 -19
- package/assets/runtime/internal/singletons.js +0 -23
- package/assets/runtime/internal/start.js +0 -770
- package/dist/chunks/index4.js +0 -526
- package/dist/chunks/index5.js +0 -761
- package/dist/chunks/index6.js +0 -322
- package/dist/chunks/standard.js +0 -99
- package/dist/ssr.js +0 -2523
package/README.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# The fastest way to build Svelte apps
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the [SvelteKit](https://kit.svelte.dev) framework and CLI.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The quickest way to get started is via the [create-svelte](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) package:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm create svelte@latest my-app
|
|
9
|
+
cd my-app
|
|
10
|
+
npm install
|
|
11
|
+
npm run dev
|
|
12
|
+
```
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
See the [documentation](https://kit.svelte.dev/docs) to learn more.
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Changelog
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Then, clone the corresponding [svelte-app-demo](https://github.com/sveltejs/svelte-app-demo) repo and follow the instructions therein.
|
|
18
|
+
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { client } from '../client/singletons.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} name
|
|
5
|
+
*/
|
|
6
|
+
function guard(name) {
|
|
7
|
+
return () => {
|
|
8
|
+
throw new Error(`Cannot call ${name}(...) on the server`);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ssr = import.meta.env.SSR;
|
|
13
|
+
|
|
14
|
+
const disableScrollHandling = ssr
|
|
15
|
+
? guard('disableScrollHandling')
|
|
16
|
+
: client.disable_scroll_handling;
|
|
17
|
+
const goto = ssr ? guard('goto') : client.goto;
|
|
18
|
+
const invalidate = ssr ? guard('invalidate') : client.invalidate;
|
|
19
|
+
const prefetch = ssr ? guard('prefetch') : client.prefetch;
|
|
20
|
+
const prefetchRoutes = ssr ? guard('prefetchRoutes') : client.prefetch_routes;
|
|
21
|
+
const beforeNavigate = ssr ? () => {} : client.before_navigate;
|
|
22
|
+
const afterNavigate = ssr ? () => {} : client.after_navigate;
|
|
23
|
+
|
|
24
|
+
export { afterNavigate, beforeNavigate, disableScrollHandling, goto, invalidate, prefetch, prefetchRoutes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { assets, base } from '../paths.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getContext } from 'svelte';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ssr = typeof window === 'undefined'; // TODO why doesn't previous line work in build?
|
|
2
|
+
import { browser } from './env.js';
|
|
3
|
+
import '../env.js';
|
|
5
4
|
|
|
6
5
|
// TODO remove this (for 1.0? after 1.0?)
|
|
7
6
|
let warned = false;
|
|
@@ -13,37 +12,33 @@ function stores() {
|
|
|
13
12
|
return getStores();
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
* query: URLSearchParams;
|
|
20
|
-
* params: Record<string, string | string[]>
|
|
21
|
-
* }>} PageStore */
|
|
22
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @type {import('$app/stores').getStores}
|
|
17
|
+
*/
|
|
23
18
|
const getStores = () => {
|
|
24
19
|
const stores = getContext('__svelte__');
|
|
25
20
|
|
|
26
21
|
return {
|
|
27
|
-
/** @type {PageStore} */
|
|
28
22
|
page: {
|
|
29
23
|
subscribe: stores.page.subscribe
|
|
30
24
|
},
|
|
31
|
-
/** @type {import('svelte/store').Readable<boolean>} */
|
|
32
25
|
navigating: {
|
|
33
26
|
subscribe: stores.navigating.subscribe
|
|
34
27
|
},
|
|
28
|
+
// TODO remove this (for 1.0? after 1.0?)
|
|
29
|
+
// @ts-expect-error - deprecated, not part of type definitions, but still callable
|
|
35
30
|
get preloading() {
|
|
36
31
|
console.error('stores.preloading is deprecated; use stores.navigating instead');
|
|
37
32
|
return {
|
|
38
33
|
subscribe: stores.navigating.subscribe
|
|
39
34
|
};
|
|
40
35
|
},
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
session: stores.session,
|
|
37
|
+
updated: stores.updated
|
|
43
38
|
};
|
|
44
39
|
};
|
|
45
40
|
|
|
46
|
-
/** @type {
|
|
41
|
+
/** @type {typeof import('$app/stores').page} */
|
|
47
42
|
const page = {
|
|
48
43
|
/** @param {(value: any) => void} fn */
|
|
49
44
|
subscribe(fn) {
|
|
@@ -52,9 +47,8 @@ const page = {
|
|
|
52
47
|
}
|
|
53
48
|
};
|
|
54
49
|
|
|
55
|
-
/** @type {import('
|
|
50
|
+
/** @type {typeof import('$app/stores').navigating} */
|
|
56
51
|
const navigating = {
|
|
57
|
-
/** @param {(value: any) => void} fn */
|
|
58
52
|
subscribe(fn) {
|
|
59
53
|
const store = getStores().navigating;
|
|
60
54
|
return store.subscribe(fn);
|
|
@@ -62,32 +56,42 @@ const navigating = {
|
|
|
62
56
|
};
|
|
63
57
|
|
|
64
58
|
/** @param {string} verb */
|
|
65
|
-
const
|
|
59
|
+
const throw_error = (verb) => {
|
|
66
60
|
throw new Error(
|
|
67
|
-
|
|
68
|
-
? `
|
|
69
|
-
: `
|
|
61
|
+
browser
|
|
62
|
+
? `Cannot ${verb} session store before subscribing`
|
|
63
|
+
: `Can only ${verb} session store in browser`
|
|
70
64
|
);
|
|
71
65
|
};
|
|
72
66
|
|
|
73
|
-
/** @type {import('
|
|
67
|
+
/** @type {typeof import('$app/stores').session} */
|
|
74
68
|
const session = {
|
|
75
69
|
subscribe(fn) {
|
|
76
70
|
const store = getStores().session;
|
|
77
71
|
|
|
78
|
-
if (
|
|
72
|
+
if (browser) {
|
|
79
73
|
session.set = store.set;
|
|
80
74
|
session.update = store.update;
|
|
81
75
|
}
|
|
82
76
|
|
|
83
77
|
return store.subscribe(fn);
|
|
84
78
|
},
|
|
85
|
-
set: (
|
|
86
|
-
|
|
79
|
+
set: () => throw_error('set'),
|
|
80
|
+
update: () => throw_error('update')
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** @type {typeof import('$app/stores').updated} */
|
|
84
|
+
const updated = {
|
|
85
|
+
subscribe(fn) {
|
|
86
|
+
const store = getStores().updated;
|
|
87
|
+
|
|
88
|
+
if (browser) {
|
|
89
|
+
updated.check = store.check;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return store.subscribe(fn);
|
|
87
93
|
},
|
|
88
|
-
|
|
89
|
-
error('update');
|
|
90
|
-
}
|
|
94
|
+
check: () => throw_error('check')
|
|
91
95
|
};
|
|
92
96
|
|
|
93
|
-
export { getStores, navigating, page, session, stores };
|
|
97
|
+
export { getStores, navigating, page, session, stores, updated };
|