@sveltejs/kit 1.0.0-next.98 → 1.0.0
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 +5 -1
- package/package.json +91 -77
- package/postinstall.js +47 -0
- package/src/cli.js +44 -0
- package/src/constants.js +5 -0
- package/src/core/adapt/builder.js +221 -0
- package/src/core/adapt/index.js +31 -0
- package/src/core/config/default-error.html +56 -0
- package/src/core/config/index.js +100 -0
- package/src/core/config/options.js +387 -0
- package/src/core/config/types.d.ts +1 -0
- package/src/core/env.js +138 -0
- package/src/core/generate_manifest/index.js +116 -0
- package/src/core/prerender/crawl.js +207 -0
- package/src/core/prerender/entities.js +2252 -0
- package/src/core/prerender/fallback.js +43 -0
- package/src/core/prerender/prerender.js +459 -0
- package/src/core/prerender/queue.js +80 -0
- package/src/core/sync/create_manifest_data/conflict.js +0 -0
- package/src/core/sync/create_manifest_data/index.js +523 -0
- package/src/core/sync/create_manifest_data/sort.js +161 -0
- package/src/core/sync/create_manifest_data/types.d.ts +37 -0
- package/src/core/sync/sync.js +59 -0
- package/src/core/sync/utils.js +33 -0
- package/src/core/sync/write_ambient.js +58 -0
- package/src/core/sync/write_client_manifest.js +107 -0
- package/src/core/sync/write_matchers.js +25 -0
- package/src/core/sync/write_root.js +91 -0
- package/src/core/sync/write_tsconfig.js +195 -0
- package/src/core/sync/write_types/index.js +809 -0
- package/src/core/utils.js +67 -0
- package/src/exports/hooks/index.js +1 -0
- package/src/exports/hooks/sequence.js +44 -0
- package/src/exports/index.js +55 -0
- package/src/exports/node/index.js +172 -0
- package/src/exports/node/polyfills.js +28 -0
- package/src/exports/vite/build/build_server.js +359 -0
- package/src/exports/vite/build/build_service_worker.js +85 -0
- package/src/exports/vite/build/utils.js +230 -0
- package/src/exports/vite/dev/index.js +597 -0
- package/src/exports/vite/graph_analysis/index.js +99 -0
- package/src/exports/vite/graph_analysis/types.d.ts +5 -0
- package/src/exports/vite/graph_analysis/utils.js +6 -0
- package/src/exports/vite/index.js +708 -0
- package/src/exports/vite/preview/index.js +194 -0
- package/src/exports/vite/types.d.ts +3 -0
- package/src/exports/vite/utils.js +184 -0
- package/src/runtime/app/env.js +1 -0
- package/src/runtime/app/environment.js +13 -0
- package/src/runtime/app/forms.js +135 -0
- package/src/runtime/app/navigation.js +22 -0
- package/src/runtime/app/paths.js +1 -0
- package/src/runtime/app/stores.js +57 -0
- package/src/runtime/client/ambient.d.ts +30 -0
- package/src/runtime/client/client.js +1725 -0
- package/src/runtime/client/constants.js +10 -0
- package/src/runtime/client/fetcher.js +127 -0
- package/src/runtime/client/parse.js +60 -0
- package/src/runtime/client/singletons.js +21 -0
- package/src/runtime/client/start.js +45 -0
- package/src/runtime/client/types.d.ts +86 -0
- package/src/runtime/client/utils.js +257 -0
- package/src/runtime/components/error.svelte +6 -0
- package/{assets → src/runtime}/components/layout.svelte +0 -0
- package/src/runtime/control.js +45 -0
- package/src/runtime/env/dynamic/private.js +1 -0
- package/src/runtime/env/dynamic/public.js +1 -0
- package/src/runtime/env-private.js +6 -0
- package/src/runtime/env-public.js +6 -0
- package/src/runtime/env.js +12 -0
- package/src/runtime/hash.js +20 -0
- package/src/runtime/paths.js +11 -0
- package/src/runtime/server/cookie.js +228 -0
- package/src/runtime/server/data/index.js +158 -0
- package/src/runtime/server/endpoint.js +86 -0
- package/src/runtime/server/fetch.js +175 -0
- package/src/runtime/server/index.js +405 -0
- package/src/runtime/server/page/actions.js +267 -0
- package/src/runtime/server/page/crypto.js +239 -0
- package/src/runtime/server/page/csp.js +250 -0
- package/src/runtime/server/page/index.js +326 -0
- package/src/runtime/server/page/load_data.js +270 -0
- package/src/runtime/server/page/render.js +393 -0
- package/src/runtime/server/page/respond_with_error.js +103 -0
- package/src/runtime/server/page/serialize_data.js +87 -0
- package/src/runtime/server/page/types.d.ts +35 -0
- package/src/runtime/server/utils.js +179 -0
- package/src/utils/array.js +9 -0
- package/src/utils/error.js +22 -0
- package/src/utils/escape.js +46 -0
- package/src/utils/exports.js +54 -0
- package/src/utils/filesystem.js +178 -0
- package/src/utils/functions.js +16 -0
- package/src/utils/http.js +72 -0
- package/src/utils/misc.js +1 -0
- package/src/utils/promises.js +17 -0
- package/src/utils/routing.js +201 -0
- package/src/utils/unit_test.js +11 -0
- package/src/utils/url.js +161 -0
- package/svelte-kit.js +1 -1
- package/types/ambient.d.ts +451 -0
- package/types/index.d.ts +1168 -5
- package/types/internal.d.ts +348 -160
- package/types/private.d.ts +237 -0
- package/types/synthetic/$env+dynamic+private.md +10 -0
- package/types/synthetic/$env+dynamic+public.md +8 -0
- package/types/synthetic/$env+static+private.md +19 -0
- package/types/synthetic/$env+static+public.md +7 -0
- package/types/synthetic/$lib.md +5 -0
- package/CHANGELOG.md +0 -819
- package/assets/components/error.svelte +0 -21
- package/assets/runtime/app/env.js +0 -16
- package/assets/runtime/app/navigation.js +0 -53
- package/assets/runtime/app/paths.js +0 -1
- package/assets/runtime/app/stores.js +0 -87
- package/assets/runtime/chunks/utils.js +0 -13
- package/assets/runtime/env.js +0 -8
- package/assets/runtime/internal/singletons.js +0 -20
- package/assets/runtime/internal/start.js +0 -1061
- package/assets/runtime/paths.js +0 -12
- package/dist/chunks/_commonjsHelpers.js +0 -8
- package/dist/chunks/cert.js +0 -29079
- package/dist/chunks/constants.js +0 -3
- package/dist/chunks/index.js +0 -3526
- package/dist/chunks/index2.js +0 -583
- package/dist/chunks/index3.js +0 -31
- package/dist/chunks/index4.js +0 -1005
- package/dist/chunks/index5.js +0 -327
- package/dist/chunks/index6.js +0 -325
- package/dist/chunks/standard.js +0 -99
- package/dist/chunks/utils.js +0 -149
- package/dist/cli.js +0 -711
- package/dist/http.js +0 -66
- package/dist/install-fetch.js +0 -1699
- package/dist/ssr.js +0 -1529
- package/types/ambient-modules.d.ts +0 -115
- package/types/config.d.ts +0 -101
- package/types/endpoint.d.ts +0 -23
- package/types/helper.d.ts +0 -19
- package/types/hooks.d.ts +0 -23
- package/types/page.d.ts +0 -30
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script context="module">
|
|
2
|
-
export function load({ error, status }) {
|
|
3
|
-
return {
|
|
4
|
-
props: { error, status }
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
export let status;
|
|
11
|
-
export let error;
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<h1>{status}</h1>
|
|
15
|
-
|
|
16
|
-
<p>{error.message}</p>
|
|
17
|
-
|
|
18
|
-
<!-- TODO figure out what to do with stacktraces in prod -->
|
|
19
|
-
{#if error.stack}
|
|
20
|
-
<pre>{error.stack}</pre>
|
|
21
|
-
{/if}
|
|
@@ -1,16 +0,0 @@
|
|
|
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').amp}
|
|
13
|
-
*/
|
|
14
|
-
const amp = !!import.meta.env.VITE_SVELTEKIT_AMP;
|
|
15
|
-
|
|
16
|
-
export { amp, browser, dev };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { router } from '../internal/singletons.js';
|
|
2
|
-
import { g as get_base_uri } from '../chunks/utils.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {string} name
|
|
6
|
-
*/
|
|
7
|
-
function guard(name) {
|
|
8
|
-
return () => {
|
|
9
|
-
throw new Error(`Cannot call ${name}(...) on the server`);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const goto = import.meta.env.SSR ? guard('goto') : goto_;
|
|
14
|
-
const invalidate = import.meta.env.SSR ? guard('invalidate') : invalidate_;
|
|
15
|
-
const prefetch = import.meta.env.SSR ? guard('prefetch') : prefetch_;
|
|
16
|
-
const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : prefetchRoutes_;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @type {import('$app/navigation').goto}
|
|
20
|
-
*/
|
|
21
|
-
async function goto_(href, opts) {
|
|
22
|
-
return router.goto(href, opts, []);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @type {import('$app/navigation').invalidate}
|
|
27
|
-
*/
|
|
28
|
-
async function invalidate_(resource) {
|
|
29
|
-
const { href } = new URL(resource, location.href);
|
|
30
|
-
return router.renderer.invalidate(href);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @type {import('$app/navigation').prefetch}
|
|
35
|
-
*/
|
|
36
|
-
function prefetch_(href) {
|
|
37
|
-
return router.prefetch(new URL(href, get_base_uri(document)));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @type {import('$app/navigation').prefetchRoutes}
|
|
42
|
-
*/
|
|
43
|
-
async function prefetchRoutes_(pathnames) {
|
|
44
|
-
const matching = pathnames
|
|
45
|
-
? router.routes.filter((route) => pathnames.some((pathname) => route[0].test(pathname)))
|
|
46
|
-
: router.routes;
|
|
47
|
-
|
|
48
|
-
const promises = matching.map((r) => r.length !== 1 && Promise.all(r[1].map((load) => load())));
|
|
49
|
-
|
|
50
|
-
await Promise.all(promises);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { goto, invalidate, prefetch, prefetchRoutes };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { assets, base } from '../paths.js';
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { getContext } from 'svelte';
|
|
2
|
-
|
|
3
|
-
// const ssr = (import.meta as any).env.SSR;
|
|
4
|
-
const ssr = typeof window === 'undefined'; // TODO why doesn't previous line work in build?
|
|
5
|
-
|
|
6
|
-
// TODO remove this (for 1.0? after 1.0?)
|
|
7
|
-
let warned = false;
|
|
8
|
-
function stores() {
|
|
9
|
-
if (!warned) {
|
|
10
|
-
console.error('stores() is deprecated; use getStores() instead');
|
|
11
|
-
warned = true;
|
|
12
|
-
}
|
|
13
|
-
return getStores();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @type {import('$app/stores').getStores}
|
|
18
|
-
*/
|
|
19
|
-
const getStores = () => {
|
|
20
|
-
const stores = getContext('__svelte__');
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
page: {
|
|
24
|
-
subscribe: stores.page.subscribe
|
|
25
|
-
},
|
|
26
|
-
navigating: {
|
|
27
|
-
subscribe: stores.navigating.subscribe
|
|
28
|
-
},
|
|
29
|
-
// @ts-ignore - deprecated, not part of type definitions, but still callable
|
|
30
|
-
get preloading() {
|
|
31
|
-
console.error('stores.preloading is deprecated; use stores.navigating instead');
|
|
32
|
-
return {
|
|
33
|
-
subscribe: stores.navigating.subscribe
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
session: stores.session
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/** @type {typeof import('$app/stores').page} */
|
|
41
|
-
const page = {
|
|
42
|
-
/** @param {(value: any) => void} fn */
|
|
43
|
-
subscribe(fn) {
|
|
44
|
-
const store = getStores().page;
|
|
45
|
-
return store.subscribe(fn);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/** @type {typeof import('$app/stores').navigating} */
|
|
50
|
-
const navigating = {
|
|
51
|
-
/** @param {(value: any) => void} fn */
|
|
52
|
-
subscribe(fn) {
|
|
53
|
-
const store = getStores().navigating;
|
|
54
|
-
return store.subscribe(fn);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/** @param {string} verb */
|
|
59
|
-
const error = (verb) => {
|
|
60
|
-
throw new Error(
|
|
61
|
-
ssr
|
|
62
|
-
? `Can only ${verb} session store in browser`
|
|
63
|
-
: `Cannot ${verb} session store before subscribing`
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
/** @type {typeof import('$app/stores').session} */
|
|
68
|
-
const session = {
|
|
69
|
-
subscribe(fn) {
|
|
70
|
-
const store = getStores().session;
|
|
71
|
-
|
|
72
|
-
if (!ssr) {
|
|
73
|
-
session.set = store.set;
|
|
74
|
-
session.update = store.update;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return store.subscribe(fn);
|
|
78
|
-
},
|
|
79
|
-
set: (value) => {
|
|
80
|
-
error('set');
|
|
81
|
-
},
|
|
82
|
-
update: (updater) => {
|
|
83
|
-
error('update');
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export { getStores, navigating, page, session, stores };
|
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
package/assets/runtime/env.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** @type {import('./router').Router} */
|
|
2
|
-
let router;
|
|
3
|
-
|
|
4
|
-
/** @type {string} */
|
|
5
|
-
let base = '';
|
|
6
|
-
|
|
7
|
-
/** @type {string} */
|
|
8
|
-
let assets = '/.';
|
|
9
|
-
|
|
10
|
-
/** @param {import('./router').Router} _ */
|
|
11
|
-
function init(_) {
|
|
12
|
-
router = _;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** @param {{ base: string, assets: string }} paths */
|
|
16
|
-
function set_paths(paths) {
|
|
17
|
-
({ base, assets } = paths);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { assets, base, init, router, set_paths };
|