space-router 0.9.4 → 0.9.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.9.5
2
+
3
+ - Upgrade all depedencies.
4
+
1
5
  ## 0.9.4
2
6
 
3
7
  - Upgrade all depedencies.
@@ -30,7 +30,7 @@ function createHistory(options) {
30
30
  }
31
31
  }
32
32
  function listen(onChange) {
33
- onPop = function() {
33
+ onPop = function onPop() {
34
34
  return onChange(getUrl());
35
35
  };
36
36
  if (mode !== 'memory') {
@@ -39,7 +39,7 @@ function createHistory(options) {
39
39
  }
40
40
  return function() {
41
41
  destroyed = true;
42
- off && off();
42
+ if (off) off();
43
43
  };
44
44
  }
45
45
  return {
@@ -61,7 +61,11 @@ function createHistory(options) {
61
61
  } else if (mode === 'hash') {
62
62
  location[replace ? 'replace' : 'assign']('#' + url);
63
63
  } else if (mode === 'memory') {
64
- replace ? memory[memory.length - 1] = url : memory.push(url);
64
+ if (replace) {
65
+ memory[memory.length - 1] = url;
66
+ } else {
67
+ memory.push(url);
68
+ }
65
69
  raf(onPop);
66
70
  }
67
71
  }
@@ -76,12 +76,22 @@ function _object_spread_props(target, source) {
76
76
  }
77
77
  function _object_without_properties(source, excluded) {
78
78
  if (source == null) return {};
79
- var target = _object_without_properties_loose(source, excluded);
80
- var key, i;
79
+ var target = {}, sourceKeys, key, i;
80
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
81
+ sourceKeys = Reflect.ownKeys(Object(source));
82
+ for(i = 0; i < sourceKeys.length; i++){
83
+ key = sourceKeys[i];
84
+ if (excluded.indexOf(key) >= 0) continue;
85
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
86
+ target[key] = source[key];
87
+ }
88
+ return target;
89
+ }
90
+ target = _object_without_properties_loose(source, excluded);
81
91
  if (Object.getOwnPropertySymbols) {
82
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
83
- for(i = 0; i < sourceSymbolKeys.length; i++){
84
- key = sourceSymbolKeys[i];
92
+ sourceKeys = Object.getOwnPropertySymbols(source);
93
+ for(i = 0; i < sourceKeys.length; i++){
94
+ key = sourceKeys[i];
85
95
  if (excluded.indexOf(key) >= 0) continue;
86
96
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
87
97
  target[key] = source[key];
@@ -91,12 +101,11 @@ function _object_without_properties(source, excluded) {
91
101
  }
92
102
  function _object_without_properties_loose(source, excluded) {
93
103
  if (source == null) return {};
94
- var target = {};
95
- var sourceKeys = Object.keys(source);
96
- var key, i;
104
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
97
105
  for(i = 0; i < sourceKeys.length; i++){
98
106
  key = sourceKeys[i];
99
107
  if (excluded.indexOf(key) >= 0) continue;
108
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
100
109
  target[key] = source[key];
101
110
  }
102
111
  return target;
@@ -239,7 +248,7 @@ function transition(router, url, onNavigated) {
239
248
  }
240
249
  }
241
250
  }
242
- onNavigated && onNavigated(route);
251
+ if (onNavigated) onNavigated(route);
243
252
  }
244
253
  }
245
254
  function redirectUrl(router, redirect, matchingRoute) {
@@ -20,7 +20,7 @@ export function createHistory(options) {
20
20
  }
21
21
  }
22
22
  function listen(onChange) {
23
- onPop = function() {
23
+ onPop = function onPop() {
24
24
  return onChange(getUrl());
25
25
  };
26
26
  if (mode !== 'memory') {
@@ -29,7 +29,7 @@ export function createHistory(options) {
29
29
  }
30
30
  return function() {
31
31
  destroyed = true;
32
- off && off();
32
+ if (off) off();
33
33
  };
34
34
  }
35
35
  return {
@@ -51,7 +51,11 @@ export function createHistory(options) {
51
51
  } else if (mode === 'hash') {
52
52
  location[replace ? 'replace' : 'assign']('#' + url);
53
53
  } else if (mode === 'memory') {
54
- replace ? memory[memory.length - 1] = url : memory.push(url);
54
+ if (replace) {
55
+ memory[memory.length - 1] = url;
56
+ } else {
57
+ memory.push(url);
58
+ }
55
59
  raf(onPop);
56
60
  }
57
61
  }
@@ -52,12 +52,22 @@ function _object_spread_props(target, source) {
52
52
  }
53
53
  function _object_without_properties(source, excluded) {
54
54
  if (source == null) return {};
55
- var target = _object_without_properties_loose(source, excluded);
56
- var key, i;
55
+ var target = {}, sourceKeys, key, i;
56
+ if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
57
+ sourceKeys = Reflect.ownKeys(Object(source));
58
+ for(i = 0; i < sourceKeys.length; i++){
59
+ key = sourceKeys[i];
60
+ if (excluded.indexOf(key) >= 0) continue;
61
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
62
+ target[key] = source[key];
63
+ }
64
+ return target;
65
+ }
66
+ target = _object_without_properties_loose(source, excluded);
57
67
  if (Object.getOwnPropertySymbols) {
58
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
59
- for(i = 0; i < sourceSymbolKeys.length; i++){
60
- key = sourceSymbolKeys[i];
68
+ sourceKeys = Object.getOwnPropertySymbols(source);
69
+ for(i = 0; i < sourceKeys.length; i++){
70
+ key = sourceKeys[i];
61
71
  if (excluded.indexOf(key) >= 0) continue;
62
72
  if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
63
73
  target[key] = source[key];
@@ -67,12 +77,11 @@ function _object_without_properties(source, excluded) {
67
77
  }
68
78
  function _object_without_properties_loose(source, excluded) {
69
79
  if (source == null) return {};
70
- var target = {};
71
- var sourceKeys = Object.keys(source);
72
- var key, i;
80
+ var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
73
81
  for(i = 0; i < sourceKeys.length; i++){
74
82
  key = sourceKeys[i];
75
83
  if (excluded.indexOf(key) >= 0) continue;
84
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
76
85
  target[key] = source[key];
77
86
  }
78
87
  return target;
@@ -218,7 +227,7 @@ function transition(router, url, onNavigated) {
218
227
  }
219
228
  }
220
229
  }
221
- onNavigated && onNavigated(route);
230
+ if (onNavigated) onNavigated(route);
222
231
  }
223
232
  }
224
233
  function redirectUrl(router, redirect, matchingRoute) {
package/oxlintrc.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "env": {
3
+ "browser": true
4
+ },
5
+ "ignorePatterns": ["dist", "docs/static/js", "docs/assets/js"]
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "space-router",
3
3
  "description": "All the routing essentials.",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "main": "dist/cjs",
6
6
  "module": "dist/esm",
7
7
  "license": "ICS",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "author": "Karolis Narkevicius",
26
26
  "scripts": {
27
- "test": "npm run build && healthier && prettier --check '**/*.{js,css,yml}' && c8 ava",
27
+ "test": "npm run build && oxlint -c oxlintrc.json && prettier --check '**/*.{js,css,yml}' && c8 ava",
28
28
  "format": "prettier --write '**/*.{js,css,yml}'",
29
29
  "coverage": "c8 --reporter=html ava",
30
30
  "build": "node ./tasks/build.js",
@@ -35,29 +35,21 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@swc-node/register": "^1.11.1",
38
- "@swc/cli": "^0.7.9",
39
- "@swc/core": "^1.15.3",
38
+ "@swc/cli": "^0.8.0",
39
+ "@swc/core": "^1.15.13",
40
40
  "ava": "^6.4.1",
41
- "c8": "^10.1.3",
42
- "execa": "^9.6.0",
41
+ "c8": "^11.0.0",
42
+ "execa": "^9.6.1",
43
43
  "gh-pages": "^6.3.0",
44
- "healthier": "^7.0.0",
45
- "prettier": "^3.6.2"
46
- },
47
- "healthier": {
48
- "global": [
49
- "location",
50
- "history",
51
- "requestAnimationFrame"
52
- ],
53
- "ignore": [
54
- "docs/static/js",
55
- "docs/assets/js"
56
- ]
44
+ "oxlint": "^1.50.0",
45
+ "prettier": "^3.8.1"
57
46
  },
58
47
  "ava": {
59
48
  "require": [
60
49
  "@swc-node/register"
61
50
  ]
51
+ },
52
+ "overrides": {
53
+ "minimatch": ">=10.2.1"
62
54
  }
63
55
  }
package/src/history.js CHANGED
@@ -28,7 +28,7 @@ export function createHistory(options) {
28
28
 
29
29
  return () => {
30
30
  destroyed = true
31
- off && off()
31
+ if (off) off()
32
32
  }
33
33
  }
34
34
 
@@ -52,7 +52,11 @@ export function createHistory(options) {
52
52
  } else if (mode === 'hash') {
53
53
  location[replace ? 'replace' : 'assign']('#' + url)
54
54
  } else if (mode === 'memory') {
55
- replace ? (memory[memory.length - 1] = url) : memory.push(url)
55
+ if (replace) {
56
+ memory[memory.length - 1] = url
57
+ } else {
58
+ memory.push(url)
59
+ }
56
60
  raf(onPop)
57
61
  }
58
62
  }
package/src/router.js CHANGED
@@ -119,7 +119,7 @@ function transition(router, url, onNavigated) {
119
119
  return router.navigate({ url, replace: true })
120
120
  }
121
121
  }
122
- onNavigated && onNavigated(route)
122
+ if (onNavigated) onNavigated(route)
123
123
  }
124
124
  }
125
125
 
@@ -139,7 +139,7 @@ function createTestRouter(cb, { withoutCatchAll = false } = {}) {
139
139
  { path: '/redirect-via-obj-1', redirect: 'bar' },
140
140
  { path: '/redirect-via-obj-2', redirect: { pathname: '/user/:id', params: { id: 1 } } },
141
141
  { path: '/redirect-via-fn-1/:id', redirect: ({ params }) => ({ pathname: '/user/:id', params }) },
142
- { path: '/redirect-via-fn-2/:id', redirect: ({ params }) => ({ url: '/foo' }) },
142
+ { path: '/redirect-via-fn-2/:id', redirect: () => ({ url: '/foo' }) },
143
143
  {
144
144
  path: '/user/:id',
145
145
  render: (params, query, hash = '') => {