@sveltejs/kit 1.0.0-next.283 → 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.
@@ -8,7 +8,7 @@ import { init } from './singletons.js';
8
8
 
9
9
  /**
10
10
  * @param {string} path
11
- * @param {'always' | 'never' | 'ignore'} trailing_slash
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;
@@ -200,6 +200,7 @@ class Router {
200
200
 
201
201
  if (!a.href) return;
202
202
 
203
+ const is_svg_a_element = a instanceof SVGAElement;
203
204
  const url = get_href(a);
204
205
  const url_string = url.toString();
205
206
  if (url_string === location.href) {
@@ -207,6 +208,11 @@ class Router {
207
208
  return;
208
209
  }
209
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
+
210
216
  // Ignore if tag has
211
217
  // 1. 'download' attribute
212
218
  // 2. 'rel' attribute includes external
@@ -217,7 +223,7 @@ class Router {
217
223
  }
218
224
 
219
225
  // Ignore if <a> has a target
220
- if (a instanceof SVGAElement ? a.target.baseVal : a.target) return;
226
+ if (is_svg_a_element ? a.target.baseVal : a.target) return;
221
227
 
222
228
  // Check if new url only differs by hash and use the browser default behavior in that case
223
229
  // This will ensure the `hashchange` event is fired
@@ -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 {'always' | 'never' | 'ignore'} trailing_slash
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;
@@ -57,7 +57,7 @@ function is_root_relative(path) {
57
57
 
58
58
  /**
59
59
  * @param {string} path
60
- * @param {'always' | 'never' | 'ignore'} trailing_slash
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.283');
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.283'}\n`));
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.283",
3
+ "version": "1.0.0-next.284",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -1,5 +1,3 @@
1
- /* eslint-disable import/no-duplicates */
2
-
3
1
  declare namespace App {
4
2
  interface Locals {}
5
3
  interface Platform {}
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
- Logger,
7
- PrerenderOnErrorValue,
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
- Body
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: 'always' | 'never' | 'ignore';
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}` | `localhost`;
175
+ type HostNameScheme = `${string}.${string}` | 'localhost';
175
176
  type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
176
177
  type HostProtocolSchemes = `${string}://` | '';
177
178
  type HttpDelineator = '/' | '?' | '#' | '\\';