@sveltejs/kit 1.0.0-next.349 → 1.0.0-next.351

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.
@@ -110,6 +110,15 @@ function normalize_path(path, trailing_slash) {
110
110
  return path;
111
111
  }
112
112
 
113
+ class LoadURL extends URL {
114
+ /** @returns {string} */
115
+ get hash() {
116
+ throw new Error(
117
+ 'url.hash is inaccessible from load. Consider accessing hash from the page store within the script tag of your component.'
118
+ );
119
+ }
120
+ }
121
+
113
122
  /** @param {HTMLDocument} doc */
114
123
  function get_base_uri(doc) {
115
124
  let baseURI = doc.baseURI;
@@ -939,6 +948,7 @@ function create_client({ target, session, base, trailing_slash }) {
939
948
  }
940
949
 
941
950
  const session = $session;
951
+ const load_url = new LoadURL(url);
942
952
 
943
953
  if (module.load) {
944
954
  /** @type {import('types').LoadEvent} */
@@ -948,18 +958,7 @@ function create_client({ target, session, base, trailing_slash }) {
948
958
  props: props || {},
949
959
  get url() {
950
960
  node.uses.url = true;
951
-
952
- return new Proxy(url, {
953
- get: (target, property) => {
954
- if (property === 'hash') {
955
- throw new Error(
956
- 'url.hash is inaccessible from load. Consider accessing hash from the page store within the script tag of your component.'
957
- );
958
- }
959
-
960
- return Reflect.get(target, property, target);
961
- }
962
- });
961
+ return load_url;
963
962
  },
964
963
  get session() {
965
964
  node.uses.session = true;
@@ -2001,6 +2001,15 @@ function normalize_path(path, trailing_slash) {
2001
2001
  return path;
2002
2002
  }
2003
2003
 
2004
+ class LoadURL extends URL {
2005
+ /** @returns {string} */
2006
+ get hash() {
2007
+ throw new Error(
2008
+ 'url.hash is inaccessible from load. Consider accessing hash from the page store within the script tag of your component.'
2009
+ );
2010
+ }
2011
+ }
2012
+
2004
2013
  /**
2005
2014
  * @param {string} hostname
2006
2015
  * @param {string} [constraint]
@@ -2103,7 +2112,7 @@ async function load_node({
2103
2112
  } else if (module.load) {
2104
2113
  /** @type {import('types').LoadEvent} */
2105
2114
  const load_input = {
2106
- url: state.prerendering ? create_prerendering_url_proxy(event.url) : event.url,
2115
+ url: state.prerendering ? create_prerendering_url_proxy(event.url) : new LoadURL(event.url),
2107
2116
  params: event.params,
2108
2117
  props: shadow.body || {},
2109
2118
  routeId: event.routeId,
@@ -161,6 +161,10 @@ const get_default_config = function ({ client_out_dir, config, input, output_dir
161
161
  plugins: [
162
162
  svelte({
163
163
  ...config,
164
+ compilerOptions: {
165
+ ...config.compilerOptions,
166
+ hydratable: !!config.kit.browser.hydrate
167
+ },
164
168
  configFile: false
165
169
  })
166
170
  ],
@@ -405,7 +409,7 @@ export class Server {
405
409
  error.stack = this.options.get_stack(error);
406
410
  },
407
411
  hooks: null,
408
- hydrate: ${s(config.compilerOptions.hydratable)},
412
+ hydrate: ${s(config.kit.browser.hydrate)},
409
413
  manifest,
410
414
  method_override: ${s(config.kit.methodOverride)},
411
415
  paths: { base, assets },
@@ -388,7 +388,7 @@ const sveltekit = function (svelte_config) {
388
388
  });
389
389
  },
390
390
  hooks,
391
- hydrate: svelte_config.compilerOptions.hydratable,
391
+ hydrate: svelte_config.kit.browser.hydrate,
392
392
  manifest,
393
393
  method_override: svelte_config.kit.methodOverride,
394
394
  paths: {
@@ -536,6 +536,10 @@ function has_correct_case(file, assets) {
536
536
  const svelte = function (svelte_config) {
537
537
  return svelte$1({
538
538
  ...svelte_config,
539
+ compilerOptions: {
540
+ ...svelte_config.compilerOptions,
541
+ hydratable: !!svelte_config.kit.browser.hydrate
542
+ },
539
543
  configFile: false
540
544
  });
541
545
  };
package/dist/cli.js CHANGED
@@ -211,10 +211,6 @@ function get_aliases(config) {
211
211
  /** @type {Validator} */
212
212
  const options = object(
213
213
  {
214
- compilerOptions: object({
215
- hydratable: boolean(true)
216
- }),
217
-
218
214
  extensions: validate(['.svelte'], (input, keypath) => {
219
215
  if (!Array.isArray(input) || !input.every((page) => typeof page === 'string')) {
220
216
  throw new Error(`${keypath} must be an array of strings`);
@@ -284,10 +280,7 @@ const options = object(
284
280
  }),
285
281
 
286
282
  browser: object({
287
- // TODO remove for 1.0
288
- hydrate: error(
289
- (keypath) => `${keypath} has been moved to config.compilerOptions.hydratable`
290
- ),
283
+ hydrate: boolean(true),
291
284
  router: boolean(true)
292
285
  }),
293
286
 
@@ -355,7 +348,7 @@ const options = object(
355
348
  ),
356
349
 
357
350
  // TODO remove for 1.0
358
- hydrate: error((keypath) => `${keypath} has been moved to config.compilerOptions.hydratable`),
351
+ hydrate: error((keypath) => `${keypath} has been moved to config.kit.browser.hydrate`),
359
352
 
360
353
  inlineStyleThreshold: number(0),
361
354
 
@@ -818,7 +811,7 @@ async function launch(port, https, base) {
818
811
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
819
812
  }
820
813
 
821
- const prog = sade('svelte-kit').version('1.0.0-next.349');
814
+ const prog = sade('svelte-kit').version('1.0.0-next.351');
822
815
 
823
816
  prog
824
817
  .command('dev')
@@ -1058,7 +1051,7 @@ prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
1058
1051
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
1059
1052
  if (open) launch(port, https, base);
1060
1053
 
1061
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.349'}\n`));
1054
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.351'}\n`));
1062
1055
 
1063
1056
  const protocol = https ? 'https:' : 'http:';
1064
1057
  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.349",
3
+ "version": "1.0.0-next.351",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://kit.svelte.dev",
11
11
  "type": "module",
12
12
  "dependencies": {
13
- "@sveltejs/vite-plugin-svelte": "^1.0.0-next.46",
13
+ "@sveltejs/vite-plugin-svelte": "^1.0.0-next.48",
14
14
  "chokidar": "^3.5.3",
15
15
  "sade": "^1.8.1",
16
16
  "vite": "^2.9.10"