@sveltejs/kit 1.0.0-next.281 → 1.0.0-next.284
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 +16 -9
- package/assets/server/index.js +3 -3
- package/dist/chunks/index5.js +1 -1
- package/dist/cli.js +2 -2
- package/package.json +2 -2
- package/types/ambient.d.ts +0 -2
- package/types/index.d.ts +14 -13
package/assets/client/start.js
CHANGED
|
@@ -8,7 +8,7 @@ import { init } from './singletons.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {string} path
|
|
11
|
-
* @param {'
|
|
11
|
+
* @param {import('types').TrailingSlash} trailing_slash
|
|
12
12
|
*/
|
|
13
13
|
function normalize_path(path, trailing_slash) {
|
|
14
14
|
if (path === '/' || trailing_slash === 'ignore') return path;
|
|
@@ -37,6 +37,11 @@ try {
|
|
|
37
37
|
// do nothing
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/** @param {number} index */
|
|
41
|
+
function update_scroll_positions(index) {
|
|
42
|
+
scroll_positions[index] = scroll_state();
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
function scroll_state() {
|
|
41
46
|
return {
|
|
42
47
|
x: pageXOffset,
|
|
@@ -143,7 +148,7 @@ class Router {
|
|
|
143
148
|
|
|
144
149
|
addEventListener('visibilitychange', () => {
|
|
145
150
|
if (document.visibilityState === 'hidden') {
|
|
146
|
-
|
|
151
|
+
update_scroll_positions(this.current_history_index);
|
|
147
152
|
|
|
148
153
|
try {
|
|
149
154
|
sessionStorage[SCROLL_KEY] = JSON.stringify(scroll_positions);
|
|
@@ -195,6 +200,7 @@ class Router {
|
|
|
195
200
|
|
|
196
201
|
if (!a.href) return;
|
|
197
202
|
|
|
203
|
+
const is_svg_a_element = a instanceof SVGAElement;
|
|
198
204
|
const url = get_href(a);
|
|
199
205
|
const url_string = url.toString();
|
|
200
206
|
if (url_string === location.href) {
|
|
@@ -202,6 +208,11 @@ class Router {
|
|
|
202
208
|
return;
|
|
203
209
|
}
|
|
204
210
|
|
|
211
|
+
// Ignore if url does not have origin (e.g. `mailto:`, `tel:`.)
|
|
212
|
+
// MEMO: Without this condition, firefox will open mailer twice.
|
|
213
|
+
// See: https://github.com/sveltejs/kit/issues/4045
|
|
214
|
+
if (!is_svg_a_element && url.origin === 'null') return;
|
|
215
|
+
|
|
205
216
|
// Ignore if tag has
|
|
206
217
|
// 1. 'download' attribute
|
|
207
218
|
// 2. 'rel' attribute includes external
|
|
@@ -212,7 +223,7 @@ class Router {
|
|
|
212
223
|
}
|
|
213
224
|
|
|
214
225
|
// Ignore if <a> has a target
|
|
215
|
-
if (
|
|
226
|
+
if (is_svg_a_element ? a.target.baseVal : a.target) return;
|
|
216
227
|
|
|
217
228
|
// Check if new url only differs by hash and use the browser default behavior in that case
|
|
218
229
|
// This will ensure the `hashchange` event is fired
|
|
@@ -223,7 +234,7 @@ class Router {
|
|
|
223
234
|
// clicking a hash link and those triggered by popstate
|
|
224
235
|
this.hash_navigating = true;
|
|
225
236
|
|
|
226
|
-
|
|
237
|
+
update_scroll_positions(this.current_history_index);
|
|
227
238
|
this.renderer.update_page_store(new URL(url.href));
|
|
228
239
|
|
|
229
240
|
return;
|
|
@@ -282,10 +293,6 @@ class Router {
|
|
|
282
293
|
this.initialized = true;
|
|
283
294
|
}
|
|
284
295
|
|
|
285
|
-
#update_scroll_positions() {
|
|
286
|
-
scroll_positions[this.current_history_index] = scroll_state();
|
|
287
|
-
}
|
|
288
|
-
|
|
289
296
|
/**
|
|
290
297
|
* Returns true if `url` has the same origin and basepath as the app
|
|
291
298
|
* @param {URL} url
|
|
@@ -434,7 +441,7 @@ class Router {
|
|
|
434
441
|
});
|
|
435
442
|
}
|
|
436
443
|
|
|
437
|
-
|
|
444
|
+
update_scroll_positions(this.current_history_index);
|
|
438
445
|
|
|
439
446
|
accepted();
|
|
440
447
|
|
package/assets/server/index.js
CHANGED
|
@@ -1305,7 +1305,7 @@ async function render_response({
|
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
1307
|
|
|
1308
|
-
if (state.prerender) {
|
|
1308
|
+
if (state.prerender && !options.amp) {
|
|
1309
1309
|
const http_equiv = [];
|
|
1310
1310
|
|
|
1311
1311
|
const csp_headers = csp.get_meta();
|
|
@@ -1491,7 +1491,7 @@ function is_root_relative(path) {
|
|
|
1491
1491
|
|
|
1492
1492
|
/**
|
|
1493
1493
|
* @param {string} path
|
|
1494
|
-
* @param {'
|
|
1494
|
+
* @param {import('types').TrailingSlash} trailing_slash
|
|
1495
1495
|
*/
|
|
1496
1496
|
function normalize_path(path, trailing_slash) {
|
|
1497
1497
|
if (path === '/' || trailing_slash === 'ignore') return path;
|
|
@@ -1844,7 +1844,7 @@ async function load_node({
|
|
|
1844
1844
|
|
|
1845
1845
|
// generate __data.json files when prerendering
|
|
1846
1846
|
if (shadow.body && state.prerender) {
|
|
1847
|
-
const pathname = `${event.url.pathname}/__data.json`;
|
|
1847
|
+
const pathname = `${event.url.pathname.replace(/\/$/, '')}/__data.json`;
|
|
1848
1848
|
|
|
1849
1849
|
const dependency = {
|
|
1850
1850
|
response: new Response(undefined),
|
package/dist/chunks/index5.js
CHANGED
|
@@ -57,7 +57,7 @@ function is_root_relative(path) {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* @param {string} path
|
|
60
|
-
* @param {'
|
|
60
|
+
* @param {import('types').TrailingSlash} trailing_slash
|
|
61
61
|
*/
|
|
62
62
|
function normalize_path(path, trailing_slash) {
|
|
63
63
|
if (path === '/' || trailing_slash === 'ignore') return path;
|
package/dist/cli.js
CHANGED
|
@@ -998,7 +998,7 @@ async function launch(port, https) {
|
|
|
998
998
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
1001
|
+
const prog = sade('svelte-kit').version('1.0.0-next.284');
|
|
1002
1002
|
|
|
1003
1003
|
prog
|
|
1004
1004
|
.command('dev')
|
|
@@ -1156,7 +1156,7 @@ async function check_port(port) {
|
|
|
1156
1156
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1157
1157
|
if (open) launch(port, https);
|
|
1158
1158
|
|
|
1159
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1159
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.284'}\n`));
|
|
1160
1160
|
|
|
1161
1161
|
const protocol = https ? 'https:' : 'http:';
|
|
1162
1162
|
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.284",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@playwright/test": "^1.17.1",
|
|
19
|
-
"@rollup/plugin-replace": "^
|
|
19
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
20
20
|
"@types/amphtml-validator": "^1.0.1",
|
|
21
21
|
"@types/cookie": "^0.4.1",
|
|
22
22
|
"@types/marked": "^4.0.1",
|
package/types/ambient.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
/// <reference types="vite/client" />
|
|
3
3
|
|
|
4
|
+
import './ambient';
|
|
5
|
+
|
|
4
6
|
import { CompileOptions } from 'svelte/types/compiler/interfaces';
|
|
5
7
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
SSRNodeLoader,
|
|
9
|
-
SSRRoute,
|
|
10
|
-
TrailingSlash,
|
|
8
|
+
AdapterEntry,
|
|
9
|
+
Body,
|
|
11
10
|
Either,
|
|
11
|
+
Fallthrough,
|
|
12
|
+
Logger,
|
|
12
13
|
MaybePromise,
|
|
14
|
+
PrerenderOnErrorValue,
|
|
13
15
|
RecursiveRequired,
|
|
14
|
-
RouteDefinition,
|
|
15
|
-
AdapterEntry,
|
|
16
|
-
ResponseHeaders,
|
|
17
|
-
Fallthrough,
|
|
18
16
|
RequiredResolveOptions,
|
|
19
|
-
|
|
17
|
+
ResponseHeaders,
|
|
18
|
+
RouteDefinition,
|
|
19
|
+
SSRNodeLoader,
|
|
20
|
+
SSRRoute,
|
|
21
|
+
TrailingSlash
|
|
20
22
|
} from './internal';
|
|
21
|
-
import './ambient';
|
|
22
23
|
|
|
23
24
|
export interface Adapter {
|
|
24
25
|
name: string;
|
|
@@ -31,7 +32,7 @@ export interface Builder {
|
|
|
31
32
|
mkdirp(dir: string): void;
|
|
32
33
|
|
|
33
34
|
appDir: string;
|
|
34
|
-
trailingSlash:
|
|
35
|
+
trailingSlash: TrailingSlash;
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Create entry points that map to individual functions
|
|
@@ -171,7 +172,7 @@ export namespace Csp {
|
|
|
171
172
|
type BaseSource = 'self' | 'unsafe-eval' | 'unsafe-hashes' | 'unsafe-inline' | 'none';
|
|
172
173
|
type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`;
|
|
173
174
|
type FrameSource = HostSource | SchemeSource | 'self' | 'none';
|
|
174
|
-
type HostNameScheme = `${string}.${string}` |
|
|
175
|
+
type HostNameScheme = `${string}.${string}` | 'localhost';
|
|
175
176
|
type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
|
|
176
177
|
type HostProtocolSchemes = `${string}://` | '';
|
|
177
178
|
type HttpDelineator = '/' | '?' | '#' | '\\';
|