@sveltejs/kit 1.20.3 → 1.20.5
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/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import glob from 'tiny-glob/sync.js';
|
|
4
3
|
import { load_config } from './src/core/config/index.js';
|
|
4
|
+
import { list_files } from './src/core/utils.js';
|
|
5
5
|
import * as sync from './src/core/sync/sync.js';
|
|
6
6
|
|
|
7
7
|
try {
|
|
@@ -18,7 +18,7 @@ try {
|
|
|
18
18
|
const packages = Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces.packages;
|
|
19
19
|
|
|
20
20
|
for (const directory of packages) {
|
|
21
|
-
directories.push(...
|
|
21
|
+
directories.push(...list_files(directory).map((dir) => path.resolve(cwd, dir)));
|
|
22
22
|
}
|
|
23
23
|
} else {
|
|
24
24
|
directories.push(cwd);
|
|
@@ -37,11 +37,11 @@ try {
|
|
|
37
37
|
const config = await load_config();
|
|
38
38
|
await sync.all(config, 'development');
|
|
39
39
|
} catch (error) {
|
|
40
|
-
console.
|
|
41
|
-
console.
|
|
40
|
+
console.error('Error while trying to sync SvelteKit config');
|
|
41
|
+
console.error(error);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
} catch (error) {
|
|
46
|
-
console.error(error
|
|
46
|
+
console.error(error);
|
|
47
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { existsSync, statSync, createReadStream, createWriteStream } from 'node:fs';
|
|
2
|
-
import { extname, join } from 'node:path
|
|
2
|
+
import { extname, join, resolve } from 'node:path';
|
|
3
3
|
import { pipeline } from 'node:stream';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
5
|
import zlib from 'node:zlib';
|
|
@@ -12,7 +12,7 @@ import { write } from '../sync/utils.js';
|
|
|
12
12
|
import { list_files } from '../utils.js';
|
|
13
13
|
|
|
14
14
|
const pipe = promisify(pipeline);
|
|
15
|
-
const extensions = ['html', 'js', 'mjs', 'json', 'css', 'svg', 'xml', 'wasm'];
|
|
15
|
+
const extensions = ['.html', '.js', '.mjs', '.json', '.css', '.svg', '.xml', '.wasm'];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Creates the Builder which is passed to adapters for building the application.
|
|
@@ -84,9 +84,12 @@ export function create_builder({
|
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
const files = list_files(directory, (file) => extensions.includes(extname(file)))
|
|
87
|
+
const files = list_files(directory, (file) => extensions.includes(extname(file))).map(
|
|
88
|
+
(file) => resolve(directory, file)
|
|
89
|
+
);
|
|
90
|
+
|
|
88
91
|
await Promise.all(
|
|
89
|
-
files.
|
|
92
|
+
files.flatMap((file) => [compress_file(file, 'gz'), compress_file(file, 'br')])
|
|
90
93
|
);
|
|
91
94
|
},
|
|
92
95
|
|
package/src/exports/index.js
CHANGED
|
@@ -104,7 +104,7 @@ export function fail(status, data) {
|
|
|
104
104
|
return new ActionFailure(status, data);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
const basic_param_pattern = /\[(\[)?(
|
|
107
|
+
const basic_param_pattern = /\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Populate a route ID with params to resolve a pathname.
|
|
@@ -128,12 +128,13 @@ export function resolvePath(id, params) {
|
|
|
128
128
|
'/' +
|
|
129
129
|
segments
|
|
130
130
|
.map((segment) =>
|
|
131
|
-
segment.replace(basic_param_pattern, (_, optional, name) => {
|
|
131
|
+
segment.replace(basic_param_pattern, (_, optional, rest, name) => {
|
|
132
132
|
const param_value = params[name];
|
|
133
133
|
|
|
134
134
|
// This is nested so TS correctly narrows the type
|
|
135
135
|
if (!param_value) {
|
|
136
136
|
if (optional) return '';
|
|
137
|
+
if (rest && param_value !== undefined) return '';
|
|
137
138
|
throw new Error(`Missing parameter '${name}' in route ${id}`);
|
|
138
139
|
}
|
|
139
140
|
|
package/src/runtime/app/forms.js
CHANGED
|
@@ -130,6 +130,11 @@ export function enhance(form_element, submit = () => {}) {
|
|
|
130
130
|
|
|
131
131
|
/** @param {SubmitEvent} event */
|
|
132
132
|
async function handle_submit(event) {
|
|
133
|
+
const method = event.submitter?.hasAttribute('formmethod')
|
|
134
|
+
? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formMethod
|
|
135
|
+
: clone(form_element).method;
|
|
136
|
+
if (method !== 'post') return;
|
|
137
|
+
|
|
133
138
|
event.preventDefault();
|
|
134
139
|
|
|
135
140
|
const action = new URL(
|
|
@@ -153,6 +153,7 @@ export function create_client(app, target) {
|
|
|
153
153
|
// but batch multiple synchronous invalidations.
|
|
154
154
|
pending_invalidate = pending_invalidate || Promise.resolve();
|
|
155
155
|
await pending_invalidate;
|
|
156
|
+
if (!pending_invalidate) return;
|
|
156
157
|
pending_invalidate = null;
|
|
157
158
|
|
|
158
159
|
const url = new URL(location.href);
|