@sveltejs/kit 1.0.0-next.333 → 1.0.0-next.334
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/dist/chunks/index.js +28 -6
- package/dist/cli.js +2 -2
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -85,7 +85,7 @@ async function create_plugin(config, cwd) {
|
|
|
85
85
|
if (!node) throw new Error(`Could not find node for ${url}`);
|
|
86
86
|
|
|
87
87
|
const deps = new Set();
|
|
88
|
-
find_deps(node, deps);
|
|
88
|
+
await find_deps(vite, node, deps);
|
|
89
89
|
|
|
90
90
|
/** @type {Record<string, string>} */
|
|
91
91
|
const styles = {};
|
|
@@ -399,16 +399,38 @@ function remove_html_middlewares(server) {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
/**
|
|
402
|
+
* @param {import('vite').ViteDevServer} vite
|
|
402
403
|
* @param {import('vite').ModuleNode} node
|
|
403
404
|
* @param {Set<import('vite').ModuleNode>} deps
|
|
404
405
|
*/
|
|
405
|
-
function find_deps(node, deps) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
function find_deps(vite, node, deps) {
|
|
407
|
+
// since `ssrTransformResult.deps` contains URLs instead of `ModuleNode`s, this process is asynchronous.
|
|
408
|
+
// instead of using `await`, we resolve all branches in parallel.
|
|
409
|
+
/** @type {Promise<void>[]} */
|
|
410
|
+
const branches = [];
|
|
411
|
+
|
|
412
|
+
/** @param {import('vite').ModuleNode} node */
|
|
413
|
+
function add(node) {
|
|
414
|
+
if (!deps.has(node)) {
|
|
415
|
+
deps.add(node);
|
|
416
|
+
branches.push(find_deps(vite, node, deps));
|
|
410
417
|
}
|
|
411
418
|
}
|
|
419
|
+
|
|
420
|
+
/** @param {string} url */
|
|
421
|
+
async function add_by_url(url) {
|
|
422
|
+
branches.push(vite.moduleGraph.getModuleByUrl(url).then((node) => node && add(node)));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (node.ssrTransformResult) {
|
|
426
|
+
if (node.ssrTransformResult.deps) {
|
|
427
|
+
node.ssrTransformResult.deps.forEach(add_by_url);
|
|
428
|
+
}
|
|
429
|
+
} else {
|
|
430
|
+
node.importedModules.forEach(add);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return Promise.all(branches).then(() => {});
|
|
412
434
|
}
|
|
413
435
|
|
|
414
436
|
/**
|
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.334');
|
|
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.334'}\n`));
|
|
1053
1053
|
|
|
1054
1054
|
const protocol = https ? 'https:' : 'http:';
|
|
1055
1055
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|