@sveltejs/kit 1.0.0-next.21 → 1.0.0-next.210
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/components/error.svelte +19 -3
- package/assets/kit.js +1912 -0
- package/assets/runtime/app/env.js +20 -0
- package/assets/runtime/app/navigation.js +45 -13
- package/assets/runtime/app/paths.js +1 -2
- package/assets/runtime/app/stores.js +15 -9
- package/assets/runtime/chunks/utils.js +13 -0
- package/assets/runtime/env.js +8 -0
- package/assets/runtime/internal/singletons.js +5 -11
- package/assets/runtime/internal/start.js +979 -355
- package/assets/runtime/paths.js +13 -0
- package/dist/chunks/cert.js +29255 -0
- package/dist/chunks/constants.js +8 -0
- package/dist/chunks/error.js +21 -0
- package/dist/chunks/index.js +4732 -0
- package/dist/chunks/index2.js +812 -0
- package/dist/chunks/index3.js +624 -0
- package/dist/chunks/index4.js +109 -0
- package/dist/chunks/index5.js +628 -0
- package/dist/chunks/index6.js +827 -0
- package/dist/chunks/index7.js +15575 -0
- package/dist/chunks/misc.js +3 -0
- package/dist/chunks/multipart-parser.js +449 -0
- package/dist/chunks/url.js +62 -0
- package/dist/cli.js +1012 -67
- package/dist/hooks.js +28 -0
- package/dist/install-fetch.js +6514 -0
- package/dist/node.js +51 -0
- package/dist/ssr.js +1842 -0
- package/package.json +90 -54
- package/svelte-kit.js +2 -0
- package/types/ambient-modules.d.ts +181 -0
- package/types/app.d.ts +45 -0
- package/types/config.d.ts +163 -0
- package/types/endpoint.d.ts +18 -0
- package/types/helper.d.ts +41 -0
- package/types/hooks.d.ts +48 -0
- package/types/index.d.ts +17 -0
- package/types/internal.d.ts +231 -0
- package/types/page.d.ts +71 -0
- package/CHANGELOG.md +0 -282
- package/assets/runtime/app/navigation.js.map +0 -1
- package/assets/runtime/app/paths.js.map +0 -1
- package/assets/runtime/app/stores.js.map +0 -1
- package/assets/runtime/internal/singletons.js.map +0 -1
- package/assets/runtime/internal/start.js.map +0 -1
- package/assets/runtime/utils-85ebcc60.js +0 -18
- package/assets/runtime/utils-85ebcc60.js.map +0 -1
- package/dist/api.js +0 -44
- package/dist/api.js.map +0 -1
- package/dist/build.js +0 -246
- package/dist/build.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/colors.js +0 -37
- package/dist/colors.js.map +0 -1
- package/dist/create_app.js +0 -578
- package/dist/create_app.js.map +0 -1
- package/dist/index.js +0 -12042
- package/dist/index.js.map +0 -1
- package/dist/index2.js +0 -544
- package/dist/index2.js.map +0 -1
- package/dist/index3.js +0 -71
- package/dist/index3.js.map +0 -1
- package/dist/index4.js +0 -466
- package/dist/index4.js.map +0 -1
- package/dist/index5.js +0 -729
- package/dist/index5.js.map +0 -1
- package/dist/index6.js +0 -713
- package/dist/index6.js.map +0 -1
- package/dist/logging.js +0 -43
- package/dist/logging.js.map +0 -1
- package/dist/package.js +0 -432
- package/dist/package.js.map +0 -1
- package/dist/renderer.js +0 -2391
- package/dist/renderer.js.map +0 -1
- package/dist/standard.js +0 -101
- package/dist/standard.js.map +0 -1
- package/dist/utils.js +0 -54
- package/dist/utils.js.map +0 -1
- package/svelte-kit +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { prerendering } from '../env.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('$app/env').browser}
|
|
5
|
+
*/
|
|
6
|
+
const browser = !import.meta.env.SSR;
|
|
7
|
+
/**
|
|
8
|
+
* @type {import('$app/env').dev}
|
|
9
|
+
*/
|
|
10
|
+
const dev = !!import.meta.env.DEV;
|
|
11
|
+
/**
|
|
12
|
+
* @type {import('$app/env').mode}
|
|
13
|
+
*/
|
|
14
|
+
const mode = import.meta.env.MODE;
|
|
15
|
+
/**
|
|
16
|
+
* @type {import('$app/env').amp}
|
|
17
|
+
*/
|
|
18
|
+
const amp = !!import.meta.env.VITE_SVELTEKIT_AMP;
|
|
19
|
+
|
|
20
|
+
export { amp, browser, dev, mode };
|
|
@@ -1,23 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { router as router$1 } from '../internal/singletons.js';
|
|
2
|
+
import { g as get_base_uri } from '../chunks/utils.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const router = /** @type {import('../client/router').Router} */ (router$1);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} name
|
|
8
|
+
*/
|
|
9
|
+
function guard(name) {
|
|
10
|
+
return () => {
|
|
11
|
+
throw new Error(`Cannot call ${name}(...) on the server`);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const goto = import.meta.env.SSR ? guard('goto') : goto_;
|
|
16
|
+
const invalidate = import.meta.env.SSR ? guard('invalidate') : invalidate_;
|
|
17
|
+
const prefetch = import.meta.env.SSR ? guard('prefetch') : prefetch_;
|
|
18
|
+
const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : prefetchRoutes_;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {import('$app/navigation').goto}
|
|
22
|
+
*/
|
|
23
|
+
async function goto_(href, opts) {
|
|
24
|
+
return router.goto(href, opts, []);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @type {import('$app/navigation').invalidate}
|
|
29
|
+
*/
|
|
30
|
+
async function invalidate_(resource) {
|
|
31
|
+
const { href } = new URL(resource, location.href);
|
|
32
|
+
return router.renderer.invalidate(href);
|
|
6
33
|
}
|
|
7
34
|
|
|
8
|
-
|
|
9
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @type {import('$app/navigation').prefetch}
|
|
37
|
+
*/
|
|
38
|
+
function prefetch_(href) {
|
|
39
|
+
return router.prefetch(new URL(href, get_base_uri(document)));
|
|
10
40
|
}
|
|
11
41
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @type {import('$app/navigation').prefetchRoutes}
|
|
44
|
+
*/
|
|
45
|
+
async function prefetchRoutes_(pathnames) {
|
|
46
|
+
const matching = pathnames
|
|
47
|
+
? router.routes.filter((route) => pathnames.some((pathname) => route[0].test(pathname)))
|
|
48
|
+
: router.routes;
|
|
16
49
|
|
|
17
|
-
const promises =
|
|
50
|
+
const promises = matching.map((r) => Promise.all(r[1].map((load) => load())));
|
|
18
51
|
|
|
19
52
|
await Promise.all(promises);
|
|
20
53
|
}
|
|
21
54
|
|
|
22
|
-
export { goto, prefetch, prefetchRoutes };
|
|
23
|
-
//# sourceMappingURL=navigation.js.map
|
|
55
|
+
export { goto, invalidate, prefetch, prefetchRoutes };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { assets, base } from '../
|
|
2
|
-
//# sourceMappingURL=paths.js.map
|
|
1
|
+
export { assets, base } from '../paths.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getContext } from 'svelte';
|
|
2
|
+
import { browser } from './env.js';
|
|
3
|
+
import '../env.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
const ssr = typeof window === 'undefined'; // TODO why doesn't previous line work in build?
|
|
5
|
+
const ssr = !browser;
|
|
5
6
|
|
|
6
7
|
// TODO remove this (for 1.0? after 1.0?)
|
|
7
8
|
let warned = false;
|
|
@@ -13,6 +14,9 @@ function stores() {
|
|
|
13
14
|
return getStores();
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @type {import('$app/stores').getStores}
|
|
19
|
+
*/
|
|
16
20
|
const getStores = () => {
|
|
17
21
|
const stores = getContext('__svelte__');
|
|
18
22
|
|
|
@@ -23,6 +27,8 @@ const getStores = () => {
|
|
|
23
27
|
navigating: {
|
|
24
28
|
subscribe: stores.navigating.subscribe
|
|
25
29
|
},
|
|
30
|
+
// TODO remove this (for 1.0? after 1.0?)
|
|
31
|
+
// @ts-expect-error - deprecated, not part of type definitions, but still callable
|
|
26
32
|
get preloading() {
|
|
27
33
|
console.error('stores.preloading is deprecated; use stores.navigating instead');
|
|
28
34
|
return {
|
|
@@ -33,13 +39,16 @@ const getStores = () => {
|
|
|
33
39
|
};
|
|
34
40
|
};
|
|
35
41
|
|
|
42
|
+
/** @type {typeof import('$app/stores').page} */
|
|
36
43
|
const page = {
|
|
44
|
+
/** @param {(value: any) => void} fn */
|
|
37
45
|
subscribe(fn) {
|
|
38
46
|
const store = getStores().page;
|
|
39
47
|
return store.subscribe(fn);
|
|
40
48
|
}
|
|
41
49
|
};
|
|
42
50
|
|
|
51
|
+
/** @type {typeof import('$app/stores').navigating} */
|
|
43
52
|
const navigating = {
|
|
44
53
|
subscribe(fn) {
|
|
45
54
|
const store = getStores().navigating;
|
|
@@ -47,6 +56,7 @@ const navigating = {
|
|
|
47
56
|
}
|
|
48
57
|
};
|
|
49
58
|
|
|
59
|
+
/** @param {string} verb */
|
|
50
60
|
const error = (verb) => {
|
|
51
61
|
throw new Error(
|
|
52
62
|
ssr
|
|
@@ -55,6 +65,7 @@ const error = (verb) => {
|
|
|
55
65
|
);
|
|
56
66
|
};
|
|
57
67
|
|
|
68
|
+
/** @type {typeof import('$app/stores').session} */
|
|
58
69
|
const session = {
|
|
59
70
|
subscribe(fn) {
|
|
60
71
|
const store = getStores().session;
|
|
@@ -66,13 +77,8 @@ const session = {
|
|
|
66
77
|
|
|
67
78
|
return store.subscribe(fn);
|
|
68
79
|
},
|
|
69
|
-
set: (
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
update: (updater) => {
|
|
73
|
-
error('update');
|
|
74
|
-
}
|
|
80
|
+
set: () => error('set'),
|
|
81
|
+
update: () => error('update')
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
export { getStores, navigating, page, session, stores };
|
|
78
|
-
//# sourceMappingURL=stores.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @param {HTMLDocument} doc */
|
|
2
|
+
function get_base_uri(doc) {
|
|
3
|
+
let baseURI = doc.baseURI;
|
|
4
|
+
|
|
5
|
+
if (!baseURI) {
|
|
6
|
+
const baseTags = doc.getElementsByTagName('base');
|
|
7
|
+
baseURI = baseTags.length ? baseTags[0].href : doc.URL;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return baseURI;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { get_base_uri as g };
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
/** @type {import('./router').Router?} */
|
|
1
2
|
let router;
|
|
2
|
-
let renderer;
|
|
3
|
-
let base;
|
|
4
|
-
let assets;
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/** @param {import('./router').Router?} _ */
|
|
5
|
+
function init(_) {
|
|
6
|
+
router = _;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
({ base, assets } = paths);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { assets, base, init, renderer, router, set_paths };
|
|
15
|
-
//# sourceMappingURL=singletons.js.map
|
|
9
|
+
export { init, router };
|