router-kit 0.1.6 → 0.1.7

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.
@@ -1,4 +1,4 @@
1
1
  import type { Route } from "../types";
2
- export declare let routes: Route[];
3
2
  declare function createRouter(inputRoutes: Route[]): Route[];
3
+ export declare const routes: Route[];
4
4
  export default createRouter;
@@ -1,4 +1,3 @@
1
- export let routes = [];
2
1
  function normalizeRoutes(inputRoutes) {
3
2
  const normalizedRoutes = inputRoutes.map((route) => {
4
3
  var _a, _b;
@@ -14,10 +13,13 @@ function normalizeRoutes(inputRoutes) {
14
13
  }
15
14
  return normalized;
16
15
  });
17
- routes = normalizedRoutes;
18
- return normalizedRoutes;
16
+ routes.length = 0;
17
+ routes.push(...normalizedRoutes);
18
+ return routes;
19
19
  }
20
20
  function createRouter(inputRoutes) {
21
- return (routes = normalizeRoutes(inputRoutes));
21
+ // normalize and mutate the exported `routes` array in-place
22
+ return normalizeRoutes(inputRoutes);
22
23
  }
24
+ export const routes = [];
23
25
  export default createRouter;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "mohammed.bencheikh.dev@gmail.com",
6
6
  "url": "https://mohammedbencheikh.com/"
7
7
  },
8
- "version": "0.1.6",
8
+ "version": "0.1.7",
9
9
  "description": "A small React routing provider library",
10
10
  "main": "dist/index.js",
11
11
  "types": "dist/index.d.ts",