@sveltejs/kit 1.0.0-next.328 → 1.0.0-next.330
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/assets/client/start.js +5 -3
- package/dist/chunks/index.js +5 -2
- package/dist/chunks/sync.js +1 -1
- package/dist/cli.js +2 -2
- package/package.json +4 -3
- package/types/index.d.ts +5 -4
- package/types/private.d.ts +4 -0
package/assets/client/start.js
CHANGED
|
@@ -683,7 +683,7 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
683
683
|
|
|
684
684
|
getSelection()?.removeAllRanges();
|
|
685
685
|
root.tabIndex = -1;
|
|
686
|
-
root.focus();
|
|
686
|
+
root.focus({ preventScroll: true });
|
|
687
687
|
|
|
688
688
|
// restore `tabindex` as to prevent `root` from stealing input from elements
|
|
689
689
|
if (tabindex !== null) {
|
|
@@ -996,8 +996,10 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
996
996
|
/** @type {Error | null} */
|
|
997
997
|
let error = null;
|
|
998
998
|
|
|
999
|
-
// preload modules
|
|
1000
|
-
|
|
999
|
+
// preload modules to avoid waterfall, but handle rejections
|
|
1000
|
+
// so they don't get reported to Sentry et al (we don't need
|
|
1001
|
+
// to act on the failures at this point)
|
|
1002
|
+
a.forEach((loader) => loader().catch(() => {}));
|
|
1001
1003
|
|
|
1002
1004
|
load: for (let i = 0; i < a.length; i += 1) {
|
|
1003
1005
|
/** @type {import('./types').BranchNode | undefined} */
|
package/dist/chunks/index.js
CHANGED
|
@@ -26,6 +26,10 @@ import 'node:url';
|
|
|
26
26
|
import './write_tsconfig.js';
|
|
27
27
|
import 'stream';
|
|
28
28
|
|
|
29
|
+
// Vite doesn't expose this so we just copy the list for now
|
|
30
|
+
// https://github.com/vitejs/vite/blob/3edd1af56e980aef56641a5a51cf2932bb580d41/packages/vite/src/node/plugins/css.ts#L96
|
|
31
|
+
const style_pattern = /\.(css|less|sass|scss|styl|stylus|pcss|postcss)$/;
|
|
32
|
+
|
|
29
33
|
/**
|
|
30
34
|
* @param {import('types').ValidatedConfig} config
|
|
31
35
|
* @param {string} cwd
|
|
@@ -90,9 +94,8 @@ async function create_plugin(config, cwd) {
|
|
|
90
94
|
const parsed = new URL(dep.url, 'http://localhost/');
|
|
91
95
|
const query = parsed.searchParams;
|
|
92
96
|
|
|
93
|
-
// TODO what about .scss files, etc?
|
|
94
97
|
if (
|
|
95
|
-
dep.file
|
|
98
|
+
style_pattern.test(dep.file) ||
|
|
96
99
|
(query.has('svelte') && query.get('type') === 'style')
|
|
97
100
|
) {
|
|
98
101
|
try {
|
package/dist/chunks/sync.js
CHANGED
|
@@ -749,7 +749,7 @@ import type { ${imports} } from '@sveltejs/kit';`;
|
|
|
749
749
|
|
|
750
750
|
/** @param {string} arg */
|
|
751
751
|
const endpoint = (arg) => `
|
|
752
|
-
export type RequestHandler<Output
|
|
752
|
+
export type RequestHandler<Output = ResponseBody> = GenericRequestHandler<${arg}, Output>;`;
|
|
753
753
|
|
|
754
754
|
/** @param {string} arg */
|
|
755
755
|
const page = (arg) => `
|
package/dist/cli.js
CHANGED
|
@@ -870,7 +870,7 @@ async function launch(port, https, base) {
|
|
|
870
870
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
873
|
+
const prog = sade('svelte-kit').version('1.0.0-next.330');
|
|
874
874
|
|
|
875
875
|
prog
|
|
876
876
|
.command('dev')
|
|
@@ -1049,7 +1049,7 @@ async function check_port(port) {
|
|
|
1049
1049
|
function welcome({ port, host, https, open, base, loose, allow, cwd }) {
|
|
1050
1050
|
if (open) launch(port, https, base);
|
|
1051
1051
|
|
|
1052
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1052
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.330'}\n`));
|
|
1053
1053
|
|
|
1054
1054
|
const protocol = https ? 'https:' : 'http:';
|
|
1055
1055
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.330",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@playwright/test": "^1.21.0",
|
|
20
20
|
"@rollup/plugin-replace": "^4.0.0",
|
|
21
21
|
"@types/amphtml-validator": "^1.0.1",
|
|
22
|
+
"@types/connect": "^3.4.35",
|
|
22
23
|
"@types/cookie": "^0.5.0",
|
|
23
24
|
"@types/marked": "^4.0.1",
|
|
24
25
|
"@types/mime": "^2.0.3",
|
|
@@ -83,11 +84,11 @@
|
|
|
83
84
|
"dev": "rollup -cw",
|
|
84
85
|
"lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
|
|
85
86
|
"check": "tsc",
|
|
86
|
-
"check:all": "tsc && pnpm
|
|
87
|
+
"check:all": "tsc && pnpm -r --filter=\"./**\" check",
|
|
87
88
|
"format": "npm run check-format -- --write",
|
|
88
89
|
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
|
|
89
90
|
"test": "npm run test:unit && npm run test:typings && npm run test:packaging && npm run test:integration",
|
|
90
|
-
"test:integration": "pnpm run -r
|
|
91
|
+
"test:integration": "pnpm run -r --workspace-concurrency 1 --filter=\"./test/**\" test",
|
|
91
92
|
"test:unit": "uvu src \"(spec\\.js|test[\\\\/]index\\.js)\" -i packaging",
|
|
92
93
|
"test:typings": "tsc --project test/typings",
|
|
93
94
|
"test:packaging": "uvu src/packaging \"(spec\\.js|test[\\\\/]index\\.js)\"",
|
package/types/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import './ambient';
|
|
|
6
6
|
import { CompileOptions } from 'svelte/types/compiler/interfaces';
|
|
7
7
|
import {
|
|
8
8
|
AdapterEntry,
|
|
9
|
+
BodyValidator,
|
|
9
10
|
CspDirectives,
|
|
10
11
|
JSONValue,
|
|
11
12
|
Logger,
|
|
@@ -136,7 +137,7 @@ export interface Config {
|
|
|
136
137
|
crawl?: boolean;
|
|
137
138
|
default?: boolean;
|
|
138
139
|
enabled?: boolean;
|
|
139
|
-
entries?: string
|
|
140
|
+
entries?: Array<'*' | `/${string}`>;
|
|
140
141
|
onError?: PrerenderOnErrorValue;
|
|
141
142
|
};
|
|
142
143
|
routes?: (filepath: string) => boolean;
|
|
@@ -241,15 +242,15 @@ export interface ParamMatcher {
|
|
|
241
242
|
*/
|
|
242
243
|
export interface RequestHandler<
|
|
243
244
|
Params extends Record<string, string> = Record<string, string>,
|
|
244
|
-
Output
|
|
245
|
+
Output = ResponseBody
|
|
245
246
|
> {
|
|
246
247
|
(event: RequestEvent<Params>): MaybePromise<RequestHandlerOutput<Output>>;
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
export interface RequestHandlerOutput<Output
|
|
250
|
+
export interface RequestHandlerOutput<Output = ResponseBody> {
|
|
250
251
|
status?: number;
|
|
251
252
|
headers?: Headers | Partial<ResponseHeaders>;
|
|
252
|
-
body?: Output
|
|
253
|
+
body?: Output extends ResponseBody ? Output : BodyValidator<Output>;
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
export type ResponseBody = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
|
package/types/private.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export interface AdapterEntry {
|
|
|
26
26
|
}) => MaybePromise<void>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export type BodyValidator<T> = {
|
|
30
|
+
[P in keyof T]: T[P] extends JSONValue ? BodyValidator<T[P]> : never;
|
|
31
|
+
};
|
|
32
|
+
|
|
29
33
|
// Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
|
|
30
34
|
//
|
|
31
35
|
// MIT License
|