@domql/router 3.6.7 → 3.6.8

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/dist/cjs/index.js CHANGED
@@ -168,7 +168,8 @@ const router = (path, el, state = {}, options = {}) => {
168
168
  ref.contentElementKey = opts.contentElementKey || "content";
169
169
  }
170
170
  const contentElementKey = (0, import_set.setContentKey)(element, opts);
171
- const urlObj = new win.URL(win.location.origin + path);
171
+ const origin = win.location.origin !== "null" ? win.location.origin : "http://localhost";
172
+ const urlObj = new win.URL(origin + path);
172
173
  const { pathname, search, hash } = urlObj;
173
174
  const query = parseQuery(search);
174
175
  const rootNode = element.node;
package/dist/esm/index.js CHANGED
@@ -137,7 +137,8 @@ const router = (path, el, state = {}, options = {}) => {
137
137
  ref.contentElementKey = opts.contentElementKey || "content";
138
138
  }
139
139
  const contentElementKey = setContentKey(element, opts);
140
- const urlObj = new win.URL(win.location.origin + path);
140
+ const origin = win.location.origin !== "null" ? win.location.origin : "http://localhost";
141
+ const urlObj = new win.URL(origin + path);
141
142
  const { pathname, search, hash } = urlObj;
142
143
  const query = parseQuery(search);
143
144
  const rootNode = element.node;
@@ -256,13 +256,13 @@ var DomqlRouter = (() => {
256
256
  if (result && typeof result.then === "function") {
257
257
  result.catch((err) => {
258
258
  element.error = err;
259
- console.error("[DomQL] Async event error:", err);
259
+ console.error("[DOMQL] Async event error:", err);
260
260
  });
261
261
  }
262
262
  return result;
263
263
  } catch (err) {
264
264
  element.error = err;
265
- console.error("[DomQL] Event handler error:", err);
265
+ console.error("[DOMQL] Event handler error:", err);
266
266
  if (element.context?.strictMode) throw err;
267
267
  }
268
268
  };
@@ -490,7 +490,8 @@ var DomqlRouter = (() => {
490
490
  ref.contentElementKey = opts.contentElementKey || "content";
491
491
  }
492
492
  const contentElementKey = setContentKey(element, opts);
493
- const urlObj = new win.URL(win.location.origin + path);
493
+ const origin = win.location.origin !== "null" ? win.location.origin : "http://localhost";
494
+ const urlObj = new win.URL(origin + path);
494
495
  const { pathname, search, hash } = urlObj;
495
496
  const query = parseQuery(search);
496
497
  const rootNode = element.node;
package/index.js CHANGED
@@ -180,7 +180,8 @@ export const router = (path, el, state = {}, options = {}) => {
180
180
 
181
181
  const contentElementKey = setContentKey(element, opts)
182
182
 
183
- const urlObj = new win.URL(win.location.origin + path)
183
+ const origin = win.location.origin !== 'null' ? win.location.origin : 'http://localhost'
184
+ const urlObj = new win.URL(origin + path)
184
185
  const { pathname, search, hash } = urlObj
185
186
 
186
187
  const query = parseQuery(search)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -27,8 +27,8 @@
27
27
  "prepublish": "npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/element": "^3.6.7",
31
- "@domql/utils": "^3.6.7"
30
+ "@domql/element": "^3.6.8",
31
+ "@domql/utils": "^3.6.8"
32
32
  },
33
33
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
34
34
  "devDependencies": {