@sveltejs/kit 1.0.0-next.382 → 1.0.0-next.385

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/app/env.js CHANGED
@@ -5,24 +5,9 @@ export { prerendering } from '../env.js';
5
5
  */
6
6
  const browser = !import.meta.env.SSR;
7
7
 
8
- /**
9
- * @type {import('$app/env').server}
10
- */
11
- const server = !!import.meta.env.SSR;
12
-
13
8
  /**
14
9
  * @type {import('$app/env').dev}
15
10
  */
16
- const dev = !!import.meta.env.DEV;
17
-
18
- /**
19
- * @type {import('$app/env').prod}
20
- */
21
- const prod = !import.meta.env.DEV;
22
-
23
- /**
24
- * @type {import('$app/env').mode}
25
- */
26
- const mode = import.meta.env.MODE;
11
+ const dev = __SVELTEKIT_DEV__;
27
12
 
28
- export { browser, dev, mode, prod, server };
13
+ export { browser, dev };
@@ -117,6 +117,28 @@ function normalize_path(path, trailing_slash) {
117
117
  return path;
118
118
  }
119
119
 
120
+ /** @param {Record<string, string>} params */
121
+ function decode_params(params) {
122
+ for (const key in params) {
123
+ // input has already been decoded by decodeURI
124
+ // now handle the rest that decodeURIComponent would do
125
+ params[key] = params[key]
126
+ .replace(/%23/g, '#')
127
+ .replace(/%3[Bb]/g, ';')
128
+ .replace(/%2[Cc]/g, ',')
129
+ .replace(/%2[Ff]/g, '/')
130
+ .replace(/%3[Ff]/g, '?')
131
+ .replace(/%3[Aa]/g, ':')
132
+ .replace(/%40/g, '@')
133
+ .replace(/%26/g, '&')
134
+ .replace(/%3[Dd]/g, '=')
135
+ .replace(/%2[Bb]/g, '+')
136
+ .replace(/%24/g, '$');
137
+ }
138
+
139
+ return params;
140
+ }
141
+
120
142
  class LoadURL extends URL {
121
143
  /** @returns {string} */
122
144
  get hash() {
@@ -1323,7 +1345,7 @@ function create_client({ target, session, base, trailing_slash }) {
1323
1345
  if (params) {
1324
1346
  const id = normalize_path(url.pathname, trailing_slash) + url.search;
1325
1347
  /** @type {import('./types').NavigationIntent} */
1326
- const intent = { id, route, params, url };
1348
+ const intent = { id, route, params: decode_params(params), url };
1327
1349
  return intent;
1328
1350
  }
1329
1351
  }
@@ -105,28 +105,6 @@ function lowercase_keys(obj) {
105
105
  return clone;
106
106
  }
107
107
 
108
- /** @param {Record<string, string>} params */
109
- function decode_params(params) {
110
- for (const key in params) {
111
- // input has already been decoded by decodeURI
112
- // now handle the rest that decodeURIComponent would do
113
- params[key] = params[key]
114
- .replace(/%23/g, '#')
115
- .replace(/%3[Bb]/g, ';')
116
- .replace(/%2[Cc]/g, ',')
117
- .replace(/%2[Ff]/g, '/')
118
- .replace(/%3[Ff]/g, '?')
119
- .replace(/%3[Aa]/g, ':')
120
- .replace(/%40/g, '@')
121
- .replace(/%26/g, '&')
122
- .replace(/%3[Dd]/g, '=')
123
- .replace(/%2[Bb]/g, '+')
124
- .replace(/%24/g, '$');
125
- }
126
-
127
- return params;
128
- }
129
-
130
108
  /** @param {any} body */
131
109
  function is_pojo(body) {
132
110
  if (typeof body !== 'object') return false;
@@ -1290,6 +1268,28 @@ function normalize_path(path, trailing_slash) {
1290
1268
  return path;
1291
1269
  }
1292
1270
 
1271
+ /** @param {Record<string, string>} params */
1272
+ function decode_params(params) {
1273
+ for (const key in params) {
1274
+ // input has already been decoded by decodeURI
1275
+ // now handle the rest that decodeURIComponent would do
1276
+ params[key] = params[key]
1277
+ .replace(/%23/g, '#')
1278
+ .replace(/%3[Bb]/g, ';')
1279
+ .replace(/%2[Cc]/g, ',')
1280
+ .replace(/%2[Ff]/g, '/')
1281
+ .replace(/%3[Ff]/g, '?')
1282
+ .replace(/%3[Aa]/g, ':')
1283
+ .replace(/%40/g, '@')
1284
+ .replace(/%26/g, '&')
1285
+ .replace(/%3[Dd]/g, '=')
1286
+ .replace(/%2[Bb]/g, '+')
1287
+ .replace(/%24/g, '$');
1288
+ }
1289
+
1290
+ return params;
1291
+ }
1292
+
1293
1293
  class LoadURL extends URL {
1294
1294
  /** @returns {string} */
1295
1295
  get hash() {
@@ -365,6 +365,24 @@ const options = object(
365
365
  );
366
366
  }),
367
367
 
368
+ origin: validate('http://sveltekit-prerender', (input, keypath) => {
369
+ assert_string(input, keypath);
370
+
371
+ let origin;
372
+
373
+ try {
374
+ origin = new URL(input).origin;
375
+ } catch (e) {
376
+ throw new Error(`${keypath} must be a valid origin`);
377
+ }
378
+
379
+ if (input !== origin) {
380
+ throw new Error(`${keypath} must be a valid origin (${origin} rather than ${input})`);
381
+ }
382
+
383
+ return origin;
384
+ }),
385
+
368
386
  // TODO: remove this for the 1.0 release
369
387
  pages: error((keypath) => `${keypath} has been renamed to \`entries\`.`)
370
388
  }),
@@ -19,13 +19,9 @@ import 'perf_hooks';
19
19
  import 'util/types';
20
20
  import 'events';
21
21
  import 'tls';
22
- import './_commonjsHelpers.js';
23
22
  import 'async_hooks';
24
23
  import 'console';
25
24
  import 'zlib';
26
- import 'crypto';
27
- import 'querystring';
28
- import '../node.js';
29
25
  import 'node:http';
30
26
  import 'node:https';
31
27
  import 'node:zlib';
@@ -36,6 +32,9 @@ import 'node:url';
36
32
  import 'node:net';
37
33
  import 'node:fs';
38
34
  import 'node:path';
35
+ import 'crypto';
36
+ import 'querystring';
37
+ import '../node.js';
39
38
 
40
39
  /**
41
40
  * Creates the Builder which is passed to adapters for building the application.
@@ -1,16 +1,29 @@
1
1
  import 'node:fs';
2
2
  import 'node:path';
3
- import { F as FormData, a as File } from '../node.js';
3
+ import { F as FormData, a as File } from '../node/polyfills.js';
4
+ import 'assert';
5
+ import 'net';
6
+ import 'http';
7
+ import 'stream';
8
+ import 'buffer';
9
+ import 'util';
10
+ import 'stream/web';
11
+ import 'perf_hooks';
12
+ import 'util/types';
13
+ import 'events';
14
+ import 'tls';
15
+ import 'async_hooks';
16
+ import 'console';
17
+ import 'zlib';
4
18
  import 'node:http';
5
19
  import 'node:https';
6
20
  import 'node:zlib';
7
21
  import 'node:stream';
8
22
  import 'node:buffer';
9
23
  import 'node:util';
10
- import './_commonjsHelpers.js';
11
24
  import 'node:url';
12
25
  import 'node:net';
13
- import 'stream';
26
+ import 'crypto';
14
27
 
15
28
  let s = 0;
16
29
  const S = {
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ function handle_error(e) {
18
18
  process.exit(1);
19
19
  }
20
20
 
21
- const prog = sade('svelte-kit').version('1.0.0-next.382');
21
+ const prog = sade('svelte-kit').version('1.0.0-next.385');
22
22
 
23
23
  prog
24
24
  .command('package')