@xfe-repo/web-router 1.0.0 → 1.0.1

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/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { History } from 'history';
2
2
  import { LoadableComponent, loadableReady } from '@loadable/component';
3
- import { ParsedQs } from 'qs';
3
+ import { ParsedQuery } from 'query-string';
4
4
  import { RegisterComponentStatic } from '@xfe-repo/web-register';
5
5
  export * from 'react-router-dom';
6
6
  import React, { ReactElement, ComponentType } from 'react';
@@ -37,7 +37,7 @@ type NavigatorStack = {
37
37
  interface NavigatorType extends History {
38
38
  stack: NavigatorStack[];
39
39
  reLaunch: (path: string, state?: any) => void;
40
- preload: (path: string, isReplace?: boolean, query?: ParsedQs) => Promise<void>;
40
+ preload: (path: string, isReplace?: boolean, query?: ParsedQuery<string | number | boolean>) => Promise<void>;
41
41
  leave: (path: string) => void;
42
42
  }
43
43
  type CreateNavigatorOptions = {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { History } from 'history';
2
2
  import { LoadableComponent, loadableReady } from '@loadable/component';
3
- import { ParsedQs } from 'qs';
3
+ import { ParsedQuery } from 'query-string';
4
4
  import { RegisterComponentStatic } from '@xfe-repo/web-register';
5
5
  export * from 'react-router-dom';
6
6
  import React, { ReactElement, ComponentType } from 'react';
@@ -37,7 +37,7 @@ type NavigatorStack = {
37
37
  interface NavigatorType extends History {
38
38
  stack: NavigatorStack[];
39
39
  reLaunch: (path: string, state?: any) => void;
40
- preload: (path: string, isReplace?: boolean, query?: ParsedQs) => Promise<void>;
40
+ preload: (path: string, isReplace?: boolean, query?: ParsedQuery<string | number | boolean>) => Promise<void>;
41
41
  leave: (path: string) => void;
42
42
  }
43
43
  type CreateNavigatorOptions = {
package/dist/index.js CHANGED
@@ -284,7 +284,7 @@ module.exports = __toCommonJS(src_exports);
284
284
  var import_history = require("history");
285
285
  var import_component2 = require("@loadable/component");
286
286
  var import_react_router_dom3 = require("react-router-dom");
287
- var import_qs = __toESM(require("qs"));
287
+ var import_query_string = __toESM(require("query-string"));
288
288
  __reExport(src_exports, require("react-router-dom"), module.exports);
289
289
  // src/routes.ts
290
290
  var import_react = require("react");
@@ -477,7 +477,10 @@ function createNavigator(options) {
477
477
  _path_split = _sliced_to_array(path.split("?"), 2), tmp = _path_split[0], originPath = tmp === void 0 ? "" : tmp, tmp1 = _path_split[1], search = tmp1 === void 0 ? "" : tmp1;
478
478
  matchPath = originPath.toLowerCase();
479
479
  currentRoute = (_this = (0, import_react_router_dom3.matchRoutes)(routes, matchPath)) === null || _this === void 0 ? void 0 : (_ = _this[0]) === null || _ === void 0 ? void 0 : _.route;
480
- query = query || import_qs.default.parse(search);
480
+ query = query || import_query_string.default.parse(search, {
481
+ parseBooleans: true,
482
+ parseNumbers: true
483
+ });
481
484
  if (!!(currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.Component.config)) return [
482
485
  3,
483
486
  3
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createHashHistory, createBrowserHistory, createMemoryHistory } from "history";
3
3
  import { loadableReady } from "@loadable/component";
4
4
  import { matchRoutes } from "react-router-dom";
5
- import qs from "qs";
5
+ import queryString from "query-string";
6
6
  export * from "react-router-dom";
7
7
 
8
8
  // src/routes.ts
@@ -122,7 +122,7 @@ function createNavigator(options) {
122
122
  const [originPath = "", search = ""] = path.split("?");
123
123
  let matchPath = originPath.toLowerCase();
124
124
  const currentRoute = matchRoutes(routes, matchPath)?.[0]?.route;
125
- query = query || qs.parse(search);
125
+ query = query || queryString.parse(search, { parseBooleans: true, parseNumbers: true });
126
126
  if (!currentRoute?.Component.config) {
127
127
  const pageModule = await currentRoute?.Component.load();
128
128
  await pageModule.default?.emitOnLoad?.({ isPreload: true, query });
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-router",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "sideEffects": false,
5
5
  "exports": {
6
6
  ".": {
7
- "import": "./dist/index.mjs",
8
- "require": "./dist/index.js",
9
- "types": "./dist/index.d.ts"
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "require": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "default": "./dist/index.js"
10
16
  }
11
17
  },
12
18
  "files": [
@@ -15,22 +21,17 @@
15
21
  "dependencies": {
16
22
  "@loadable/component": "^5.15.3",
17
23
  "history": "^5.3.0",
18
- "qs": "^6.11.2",
24
+ "query-string": "^7.1.3",
19
25
  "react-router-dom": "^6.11.1",
20
- "@xfe-repo/web-components": "1.0.0"
26
+ "@xfe-repo/web-components": "1.0.1"
21
27
  },
22
28
  "devDependencies": {
23
29
  "@types/loadable__component": "^5.13.8",
24
30
  "@types/node": "^20.10.4",
25
- "@types/qs": "^6.9.10",
26
31
  "@types/react": "^18.2.0",
27
- "eslint": "^8.53.0",
28
- "react": "^18.2.0",
29
- "tsup": "^8.0.1",
30
- "typescript": "^5.2.2",
31
- "@xfe-repo/typescript-config": "0.0.0",
32
- "@xfe-repo/web-register": "1.0.0",
33
- "@xfe-repo/eslint-config": "0.0.0"
32
+ "@xfe-repo/typescript-config": "0.0.3",
33
+ "@xfe-repo/eslint-config": "0.0.1",
34
+ "@xfe-repo/web-register": "1.0.2"
34
35
  },
35
36
  "scripts": {
36
37
  "build": "tsup",