@sveltejs/kit 1.0.0-next.193 → 1.0.0-next.194
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/runtime/internal/start.js +27 -21
- package/dist/cli.js +12 -6
- package/package.json +1 -1
|
@@ -655,28 +655,34 @@ class Renderer {
|
|
|
655
655
|
this._init(navigation_result);
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
if (!opts
|
|
659
|
-
|
|
660
|
-
}
|
|
658
|
+
if (!opts) {
|
|
659
|
+
await 0;
|
|
660
|
+
} else {
|
|
661
|
+
const { hash, scroll, keepfocus } = opts;
|
|
661
662
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
deep_linked
|
|
678
|
-
|
|
679
|
-
|
|
663
|
+
if (!keepfocus) {
|
|
664
|
+
document.body.focus();
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const oldPageYOffset = pageYOffset;
|
|
668
|
+
await 0;
|
|
669
|
+
const maxPageYOffset = document.body.scrollHeight - innerHeight;
|
|
670
|
+
|
|
671
|
+
// After `await 0`, the `onMount()` function in the component executed.
|
|
672
|
+
// If there was no scrolling happening (checked via `pageYOffset`),
|
|
673
|
+
// continue on our custom scroll handling
|
|
674
|
+
if (pageYOffset === Math.min(oldPageYOffset, maxPageYOffset)) {
|
|
675
|
+
const deep_linked = hash && document.getElementById(hash.slice(1));
|
|
676
|
+
if (scroll) {
|
|
677
|
+
scrollTo(scroll.x, scroll.y);
|
|
678
|
+
} else if (deep_linked) {
|
|
679
|
+
// Here we use `scrollIntoView` on the element instead of `scrollTo`
|
|
680
|
+
// because it natively supports the `scroll-margin` and `scroll-behavior`
|
|
681
|
+
// CSS properties.
|
|
682
|
+
deep_linked.scrollIntoView();
|
|
683
|
+
} else {
|
|
684
|
+
scrollTo(0, 0);
|
|
685
|
+
}
|
|
680
686
|
}
|
|
681
687
|
}
|
|
682
688
|
|
package/dist/cli.js
CHANGED
|
@@ -817,7 +817,7 @@ async function launch(port, https) {
|
|
|
817
817
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
820
|
+
const prog = sade('svelte-kit').version('1.0.0-next.194');
|
|
821
821
|
|
|
822
822
|
prog
|
|
823
823
|
.command('dev')
|
|
@@ -851,14 +851,17 @@ prog
|
|
|
851
851
|
watcher.vite.httpServer.address()
|
|
852
852
|
);
|
|
853
853
|
|
|
854
|
-
|
|
855
|
-
|
|
854
|
+
const vite_config = config.kit.vite();
|
|
855
|
+
|
|
856
|
+
https = https || !!vite_config.server?.https;
|
|
857
|
+
open = open || !!vite_config.server?.open;
|
|
856
858
|
|
|
857
859
|
welcome({
|
|
858
860
|
port: address_info.port,
|
|
859
861
|
host: address_info.address,
|
|
860
862
|
https,
|
|
861
863
|
open,
|
|
864
|
+
loose: vite_config.server?.fs?.strict === false,
|
|
862
865
|
allow: watcher.allowed_directories(),
|
|
863
866
|
cwd: watcher.cwd
|
|
864
867
|
});
|
|
@@ -971,14 +974,15 @@ async function check_port(port) {
|
|
|
971
974
|
* host: string;
|
|
972
975
|
* https: boolean;
|
|
973
976
|
* port: number;
|
|
977
|
+
* loose?: boolean;
|
|
974
978
|
* allow?: string[];
|
|
975
979
|
* cwd?: string;
|
|
976
980
|
* }} param0
|
|
977
981
|
*/
|
|
978
|
-
function welcome({ port, host, https, open, allow, cwd }) {
|
|
982
|
+
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
979
983
|
if (open) launch(port, https);
|
|
980
984
|
|
|
981
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
985
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.194'}\n`));
|
|
982
986
|
|
|
983
987
|
const protocol = https ? 'https:' : 'http:';
|
|
984
988
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
|
@@ -996,7 +1000,9 @@ function welcome({ port, host, https, open, allow, cwd }) {
|
|
|
996
1000
|
|
|
997
1001
|
if (exposed) {
|
|
998
1002
|
console.log(` ${$.gray('network:')} ${protocol}//${$.bold(`${details.address}:${port}`)}`);
|
|
999
|
-
if (
|
|
1003
|
+
if (loose) {
|
|
1004
|
+
console.log(`\n ${$.yellow('Serving with vite.server.fs.strict: false. Note that all files on your machine will be accessible to anyone on your network.')}`);
|
|
1005
|
+
} else if (allow?.length && cwd) {
|
|
1000
1006
|
console.log(`\n ${$.yellow('Note that all files in the following directories will be accessible to anyone on your network: ' + allow.map(a => relative(cwd, a)).join(', '))}`);
|
|
1001
1007
|
}
|
|
1002
1008
|
} else {
|