@sveltejs/kit 1.0.0-next.379 → 1.0.0-next.381
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 +10 -0
- package/dist/chunks/index2.js +12 -4
- package/dist/cli.js +1 -1
- package/dist/node.js +27 -17
- package/dist/vite.js +9 -4
- package/package.json +1 -1
- package/types/index.d.ts +0 -5
package/assets/client/start.js
CHANGED
|
@@ -1649,6 +1649,16 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1649
1649
|
);
|
|
1650
1650
|
}
|
|
1651
1651
|
});
|
|
1652
|
+
|
|
1653
|
+
addEventListener('pageshow', (event) => {
|
|
1654
|
+
// If the user navigates to another site and then uses the back button and
|
|
1655
|
+
// bfcache hits, we need to set navigating to null, the site doesn't know
|
|
1656
|
+
// the navigation away from it was successful.
|
|
1657
|
+
// Info about bfcache here: https://web.dev/bfcache
|
|
1658
|
+
if (event.persisted) {
|
|
1659
|
+
stores.navigating.set(null);
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1652
1662
|
},
|
|
1653
1663
|
|
|
1654
1664
|
_hydrate: async ({ status, error, nodes, params, routeId }) => {
|
package/dist/chunks/index2.js
CHANGED
|
@@ -158,7 +158,10 @@ function create_builder({ config, build_data, prerendered, log }) {
|
|
|
158
158
|
},
|
|
159
159
|
|
|
160
160
|
writeClient(dest) {
|
|
161
|
-
return
|
|
161
|
+
return [
|
|
162
|
+
...copy(`${config.kit.outDir}/output/client`, dest),
|
|
163
|
+
...copy(config.kit.files.assets, dest)
|
|
164
|
+
];
|
|
162
165
|
},
|
|
163
166
|
|
|
164
167
|
writePrerendered(dest, { fallback } = {}) {
|
|
@@ -177,11 +180,16 @@ function create_builder({ config, build_data, prerendered, log }) {
|
|
|
177
180
|
return copy(`${config.kit.outDir}/output/server`, dest);
|
|
178
181
|
},
|
|
179
182
|
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
// TODO remove these methods for 1.0
|
|
184
|
+
// @ts-expect-error
|
|
185
|
+
writeStatic() {
|
|
186
|
+
throw new Error(
|
|
187
|
+
`writeStatic has been removed. Please ensure you are using the latest version of ${
|
|
188
|
+
config.kit.adapter.name || 'your adapter'
|
|
189
|
+
}`
|
|
190
|
+
);
|
|
182
191
|
},
|
|
183
192
|
|
|
184
|
-
// @ts-expect-error
|
|
185
193
|
async prerender() {
|
|
186
194
|
throw new Error(
|
|
187
195
|
'builder.prerender() has been removed. Prerendering now takes place in the build phase — see builder.prerender and builder.writePrerendered'
|
package/dist/cli.js
CHANGED
package/dist/node.js
CHANGED
|
@@ -5839,26 +5839,35 @@ async function setResponse(res, response) {
|
|
|
5839
5839
|
|
|
5840
5840
|
res.writeHead(response.status, headers);
|
|
5841
5841
|
|
|
5842
|
-
if (response.body) {
|
|
5843
|
-
|
|
5842
|
+
if (!response.body) {
|
|
5843
|
+
res.end();
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5844
5846
|
|
|
5845
|
-
|
|
5846
|
-
reader.cancel();
|
|
5847
|
-
return;
|
|
5848
|
-
}
|
|
5847
|
+
const reader = response.body.getReader();
|
|
5849
5848
|
|
|
5850
|
-
|
|
5849
|
+
if (res.destroyed) {
|
|
5850
|
+
reader.cancel();
|
|
5851
|
+
return;
|
|
5852
|
+
}
|
|
5851
5853
|
|
|
5852
|
-
|
|
5853
|
-
reader.cancel();
|
|
5854
|
-
cancelled = true;
|
|
5855
|
-
});
|
|
5854
|
+
let cancelled = false;
|
|
5856
5855
|
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5856
|
+
res.on('close', () => {
|
|
5857
|
+
if (cancelled) return;
|
|
5858
|
+
cancelled = true;
|
|
5859
|
+
reader.cancel();
|
|
5860
|
+
res.emit('drain');
|
|
5861
|
+
});
|
|
5862
|
+
|
|
5863
|
+
res.on('error', (error) => {
|
|
5864
|
+
if (cancelled) return;
|
|
5865
|
+
cancelled = true;
|
|
5866
|
+
reader.cancel(error);
|
|
5867
|
+
res.emit('drain');
|
|
5868
|
+
});
|
|
5861
5869
|
|
|
5870
|
+
try {
|
|
5862
5871
|
for (;;) {
|
|
5863
5872
|
const { done, value } = await reader.read();
|
|
5864
5873
|
|
|
@@ -5875,8 +5884,9 @@ async function setResponse(res, response) {
|
|
|
5875
5884
|
await new Promise((fulfil) => res.once('drain', fulfil));
|
|
5876
5885
|
}
|
|
5877
5886
|
}
|
|
5878
|
-
}
|
|
5879
|
-
|
|
5887
|
+
} catch (error) {
|
|
5888
|
+
cancelled = true;
|
|
5889
|
+
res.destroy(error instanceof Error ? error : undefined);
|
|
5880
5890
|
}
|
|
5881
5891
|
}
|
|
5882
5892
|
|
package/dist/vite.js
CHANGED
|
@@ -203,6 +203,9 @@ async function create_build(config) {
|
|
|
203
203
|
* @param {boolean} add_dynamic_css
|
|
204
204
|
*/
|
|
205
205
|
function find_deps$1(manifest, entry, add_dynamic_css) {
|
|
206
|
+
/** @type {Set<string>} */
|
|
207
|
+
const seen = new Set();
|
|
208
|
+
|
|
206
209
|
/** @type {Set<string>} */
|
|
207
210
|
const imports = new Set();
|
|
208
211
|
|
|
@@ -214,9 +217,11 @@ function find_deps$1(manifest, entry, add_dynamic_css) {
|
|
|
214
217
|
* @param {boolean} add_js
|
|
215
218
|
*/
|
|
216
219
|
function traverse(file, add_js) {
|
|
220
|
+
if (seen.has(file)) return;
|
|
221
|
+
seen.add(file);
|
|
222
|
+
|
|
217
223
|
const chunk = manifest[file];
|
|
218
224
|
|
|
219
|
-
if (imports.has(chunk.file)) return;
|
|
220
225
|
if (add_js) imports.add(chunk.file);
|
|
221
226
|
|
|
222
227
|
if (chunk.css) {
|
|
@@ -1233,9 +1238,9 @@ async function prerender({ config, entries, files, log }) {
|
|
|
1233
1238
|
}
|
|
1234
1239
|
});
|
|
1235
1240
|
|
|
1236
|
-
const
|
|
1241
|
+
const body = Buffer.from(await response.arrayBuffer());
|
|
1237
1242
|
|
|
1238
|
-
save('pages', response,
|
|
1243
|
+
save('pages', response, body, decoded, encoded, referrer, 'linked');
|
|
1239
1244
|
|
|
1240
1245
|
for (const [dependency_path, result] of dependencies) {
|
|
1241
1246
|
// this seems circuitous, but using new URL allows us to not care
|
|
@@ -1256,7 +1261,7 @@ async function prerender({ config, entries, files, log }) {
|
|
|
1256
1261
|
}
|
|
1257
1262
|
|
|
1258
1263
|
if (config.prerender.crawl && response.headers.get('content-type') === 'text/html') {
|
|
1259
|
-
for (const href of crawl(
|
|
1264
|
+
for (const href of crawl(body.toString())) {
|
|
1260
1265
|
if (href.startsWith('data:') || href.startsWith('#')) continue;
|
|
1261
1266
|
|
|
1262
1267
|
const resolved = resolve(encoded, href);
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -65,11 +65,6 @@ export interface Builder {
|
|
|
65
65
|
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
66
66
|
*/
|
|
67
67
|
writeServer(dest: string): string[];
|
|
68
|
-
/**
|
|
69
|
-
* @param dest the destination folder to which files should be copied
|
|
70
|
-
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
71
|
-
*/
|
|
72
|
-
writeStatic(dest: string): string[];
|
|
73
68
|
/**
|
|
74
69
|
* @param from the source file or folder
|
|
75
70
|
* @param to the destination file or folder
|