@sveltejs/kit 1.0.0-next.350 → 1.0.0-next.353

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,