@sveltejs/kit 2.7.1 → 2.7.3
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 +4 -4
- package/package.json +2 -2
- package/src/core/config/index.js +1 -1
- package/src/core/config/options.js +8 -8
- package/src/core/postbuild/prerender.js +6 -6
- package/src/core/sync/write_ambient.js +1 -1
- package/src/core/sync/write_tsconfig.js +1 -1
- package/src/exports/hooks/sequence.js +4 -1
- package/src/exports/public.d.ts +58 -59
- package/src/exports/vite/dev/index.js +1 -1
- package/src/exports/vite/index.js +19 -3
- package/src/exports/vite/preview/index.js +7 -0
- package/src/runtime/app/paths/types.d.ts +5 -3
- package/src/runtime/app/stores.js +2 -2
- package/src/runtime/client/client.js +5 -5
- package/src/runtime/client/fetcher.js +1 -1
- package/src/runtime/server/fetch.js +1 -1
- package/src/runtime/server/page/actions.js +9 -1
- package/src/runtime/server/page/index.js +2 -2
- package/src/runtime/server/page/load_data.js +1 -1
- package/src/runtime/server/page/render.js +3 -4
- package/src/types/ambient.d.ts +7 -7
- package/src/types/synthetic/$env+dynamic+private.md +1 -1
- package/src/types/synthetic/$env+dynamic+public.md +1 -1
- package/src/types/synthetic/$env+static+private.md +2 -2
- package/src/types/synthetic/$env+static+public.md +1 -1
- package/src/types/synthetic/$lib.md +2 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +78 -74
- package/types/index.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# The fastest way to build Svelte apps
|
|
2
2
|
|
|
3
|
-
This is the [SvelteKit](https://
|
|
3
|
+
This is the [SvelteKit](https://svelte.dev/docs/kit) framework and CLI.
|
|
4
4
|
|
|
5
|
-
The quickest way to get started is via the [
|
|
5
|
+
The quickest way to get started is via the [sv](https://npmjs.com/package/sv) package:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
npx sv create my-app
|
|
9
9
|
cd my-app
|
|
10
10
|
npm install
|
|
11
11
|
npm run dev
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
See the [documentation](https://
|
|
14
|
+
See the [documentation](https://svelte.dev/docs/kit) to learn more.
|
|
15
15
|
|
|
16
16
|
## Changelog
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "SvelteKit is the fastest way to build Svelte apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"directory": "packages/kit"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"homepage": "https://
|
|
18
|
+
"homepage": "https://svelte.dev",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@types/cookie": "^0.6.0",
|
package/src/core/config/index.js
CHANGED
|
@@ -111,7 +111,7 @@ function process_config(config, { cwd = process.cwd() } = {}) {
|
|
|
111
111
|
export function validate_config(config) {
|
|
112
112
|
if (typeof config !== 'object') {
|
|
113
113
|
throw new Error(
|
|
114
|
-
'svelte.config.js must have a configuration object as its default export. See https://
|
|
114
|
+
'svelte.config.js must have a configuration object as its default export. See https://svelte.dev/docs/kit/configuration'
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -68,7 +68,7 @@ const options = object(
|
|
|
68
68
|
message += ', rather than the name of an adapter';
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
throw new Error(`${message}. See https://
|
|
71
|
+
throw new Error(`${message}. See https://svelte.dev/docs/kit/adapters`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
return input;
|
|
@@ -92,7 +92,7 @@ const options = object(
|
|
|
92
92
|
if (input) {
|
|
93
93
|
if (input.startsWith('/') || input.endsWith('/')) {
|
|
94
94
|
throw new Error(
|
|
95
|
-
"config.kit.appDir cannot start or end with '/'. See https://
|
|
95
|
+
"config.kit.appDir cannot start or end with '/'. See https://svelte.dev/docs/kit/configuration"
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
} else {
|
|
@@ -151,7 +151,7 @@ const options = object(
|
|
|
151
151
|
|
|
152
152
|
if (input !== '' && (input.endsWith('/') || !input.startsWith('/'))) {
|
|
153
153
|
throw new Error(
|
|
154
|
-
`${keypath} option must either be the empty string or a root-relative path that starts but doesn't end with '/'. See https://
|
|
154
|
+
`${keypath} option must either be the empty string or a root-relative path that starts but doesn't end with '/'. See https://svelte.dev/docs/kit/configuration#paths`
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -163,13 +163,13 @@ const options = object(
|
|
|
163
163
|
if (input) {
|
|
164
164
|
if (!/^[a-z]+:\/\//.test(input)) {
|
|
165
165
|
throw new Error(
|
|
166
|
-
`${keypath} option must be an absolute path, if specified. See https://
|
|
166
|
+
`${keypath} option must be an absolute path, if specified. See https://svelte.dev/docs/kit/configuration#paths`
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
if (input.endsWith('/')) {
|
|
171
171
|
throw new Error(
|
|
172
|
-
`${keypath} option must not end with '/'. See https://
|
|
172
|
+
`${keypath} option must not end with '/'. See https://svelte.dev/docs/kit/configuration#paths`
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -202,7 +202,7 @@ const options = object(
|
|
|
202
202
|
(/** @type {any} */ { message }) => {
|
|
203
203
|
throw new Error(
|
|
204
204
|
message +
|
|
205
|
-
'\nTo suppress or handle this error, implement `handleHttpError` in https://
|
|
205
|
+
'\nTo suppress or handle this error, implement `handleHttpError` in https://svelte.dev/docs/kit/configuration#prerender'
|
|
206
206
|
);
|
|
207
207
|
},
|
|
208
208
|
(input, keypath) => {
|
|
@@ -216,7 +216,7 @@ const options = object(
|
|
|
216
216
|
(/** @type {any} */ { message }) => {
|
|
217
217
|
throw new Error(
|
|
218
218
|
message +
|
|
219
|
-
'\nTo suppress or handle this error, implement `handleMissingId` in https://
|
|
219
|
+
'\nTo suppress or handle this error, implement `handleMissingId` in https://svelte.dev/docs/kit/configuration#prerender'
|
|
220
220
|
);
|
|
221
221
|
},
|
|
222
222
|
(input, keypath) => {
|
|
@@ -230,7 +230,7 @@ const options = object(
|
|
|
230
230
|
(/** @type {any} */ { message }) => {
|
|
231
231
|
throw new Error(
|
|
232
232
|
message +
|
|
233
|
-
'\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://
|
|
233
|
+
'\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://svelte.dev/docs/kit/configuration#prerender'
|
|
234
234
|
);
|
|
235
235
|
},
|
|
236
236
|
(input, keypath) => {
|
|
@@ -114,7 +114,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
114
114
|
({ status, path, referrer, referenceType }) => {
|
|
115
115
|
const message =
|
|
116
116
|
status === 404 && !path.startsWith(config.paths.base)
|
|
117
|
-
? `${path} does not begin with \`base\`, which is configured in \`paths.base\` and can be imported from \`$app/paths\` - see https://
|
|
117
|
+
? `${path} does not begin with \`base\`, which is configured in \`paths.base\` and can be imported from \`$app/paths\` - see https://svelte.dev/docs/kit/configuration#paths for more info`
|
|
118
118
|
: path;
|
|
119
119
|
|
|
120
120
|
return `${status} ${message}${referrer ? ` (${referenceType} from ${referrer})` : ''}`;
|
|
@@ -126,7 +126,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
126
126
|
config.prerender.handleMissingId,
|
|
127
127
|
({ path, id, referrers }) => {
|
|
128
128
|
return (
|
|
129
|
-
`The following pages contain links to ${path}#${id}, but no element with id="${id}" exists on ${path} - see the \`handleMissingId\` option in https://
|
|
129
|
+
`The following pages contain links to ${path}#${id}, but no element with id="${id}" exists on ${path} - see the \`handleMissingId\` option in https://svelte.dev/docs/kit/configuration#prerender for more info:` +
|
|
130
130
|
referrers.map((l) => `\n - ${l}`).join('')
|
|
131
131
|
);
|
|
132
132
|
}
|
|
@@ -136,7 +136,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
136
136
|
log,
|
|
137
137
|
config.prerender.handleEntryGeneratorMismatch,
|
|
138
138
|
({ generatedFromId, entry, matchedId }) => {
|
|
139
|
-
return `The entries export from ${generatedFromId} generated entry ${entry}, which was matched by ${matchedId} - see the \`handleEntryGeneratorMismatch\` option in https://
|
|
139
|
+
return `The entries export from ${generatedFromId} generated entry ${entry}, which was matched by ${matchedId} - see the \`handleEntryGeneratorMismatch\` option in https://svelte.dev/docs/kit/configuration#prerender for more info.`;
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
142
|
|
|
@@ -385,7 +385,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
385
385
|
if (response.status === 200) {
|
|
386
386
|
if (existsSync(dest) && statSync(dest).isDirectory()) {
|
|
387
387
|
throw new Error(
|
|
388
|
-
`Cannot save ${decoded} as it is already a directory. See https://
|
|
388
|
+
`Cannot save ${decoded} as it is already a directory. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information`
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
391
|
|
|
@@ -394,7 +394,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
394
394
|
if (existsSync(dir) && !statSync(dir).isDirectory()) {
|
|
395
395
|
const parent = decoded.split('/').slice(0, -1).join('/');
|
|
396
396
|
throw new Error(
|
|
397
|
-
`Cannot save ${decoded} as ${parent} is already a file. See https://
|
|
397
|
+
`Cannot save ${decoded} as ${parent} is already a file. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information`
|
|
398
398
|
);
|
|
399
399
|
}
|
|
400
400
|
|
|
@@ -509,7 +509,7 @@ async function prerender({ out, manifest_path, metadata, verbose, env }) {
|
|
|
509
509
|
const list = not_prerendered.map((id) => ` - ${id}`).join('\n');
|
|
510
510
|
|
|
511
511
|
throw new Error(
|
|
512
|
-
`The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${list}\n\nSee https://
|
|
512
|
+
`The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${list}\n\nSee https://svelte.dev/docs/kit/page-options#prerender-troubleshooting for info on how to solve this`
|
|
513
513
|
);
|
|
514
514
|
}
|
|
515
515
|
|
|
@@ -7,7 +7,7 @@ import { create_dynamic_types, create_static_types } from '../env.js';
|
|
|
7
7
|
import { write_if_changed } from './utils.js';
|
|
8
8
|
|
|
9
9
|
// TODO these types should be described in a neutral place, rather than
|
|
10
|
-
// inside either `packages/kit` or `
|
|
10
|
+
// inside either `packages/kit` or `svelte.dev/docs/kit`
|
|
11
11
|
const descriptions_dir = fileURLToPath(new URL('../../../src/types/synthetic', import.meta.url));
|
|
12
12
|
|
|
13
13
|
/** @param {string} filename */
|
|
@@ -166,7 +166,7 @@ function validate_user_config(cwd, out, config) {
|
|
|
166
166
|
.bold()
|
|
167
167
|
.yellow(
|
|
168
168
|
`You have specified a baseUrl and/or paths in your ${config.kind} which interferes with SvelteKit's auto-generated tsconfig.json. ` +
|
|
169
|
-
'Remove it to avoid problems with intellisense. For path aliases, use `kit.alias` instead: https://
|
|
169
|
+
'Remove it to avoid problems with intellisense. For path aliases, use `kit.alias` instead: https://svelte.dev/docs/kit/configuration#alias'
|
|
170
170
|
)
|
|
171
171
|
);
|
|
172
172
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* preload: () => {
|
|
22
22
|
* // this one wins as it's the first defined in the chain
|
|
23
23
|
* console.log('first preload');
|
|
24
|
+
* return true;
|
|
24
25
|
* }
|
|
25
26
|
* });
|
|
26
27
|
* console.log('first post-processing');
|
|
@@ -37,10 +38,12 @@
|
|
|
37
38
|
* },
|
|
38
39
|
* preload: () => {
|
|
39
40
|
* console.log('second preload');
|
|
41
|
+
* return true;
|
|
40
42
|
* },
|
|
41
43
|
* filterSerializedResponseHeaders: () => {
|
|
42
44
|
* // this one wins as it's the first defined in the chain
|
|
43
|
-
*
|
|
45
|
+
* console.log('second filterSerializedResponseHeaders');
|
|
46
|
+
* return true;
|
|
44
47
|
* }
|
|
45
48
|
* });
|
|
46
49
|
* console.log('second post-processing');
|