@ray-js/router-mp 1.7.25 → 1.7.27

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/lib/Router.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { RouteOptions, Router as TRouter } from '@ray-js/types';
2
2
  import { RouterScheduler } from './RouterScheduler';
3
3
  export declare class Router implements TRouter {
4
+ scheduler: RouterScheduler;
4
5
  private urlPrefix;
5
6
  /**
6
7
  * 功能页模式为 functional,使用相对路径模式
@@ -9,12 +10,12 @@ export declare class Router implements TRouter {
9
10
  * @private
10
11
  */
11
12
  private mode;
13
+ constructor();
12
14
  /**
13
15
  * setUrlPrefix
14
16
  */
15
17
  setUrlPrefix(prefix: string): void;
16
18
  setMode(mode: string): void;
17
- scheduler: RouterScheduler;
18
19
  /**
19
20
  * 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
20
21
  */
package/lib/Router.js CHANGED
@@ -29,14 +29,19 @@ function pathRelative(fromPath, toPath) {
29
29
  }
30
30
  export class Router {
31
31
  // 只有作为其他小程序的子包时,才设置urlPrefix
32
- urlPrefix = '';
32
+
33
33
  /**
34
34
  * 功能页模式为 functional,使用相对路径模式
35
35
  * 如果是绝对路径,表示跳转到宿主小程序
36
36
  *
37
37
  * @private
38
38
  */
39
- mode = 'miniprogram'; // functional
39
+
40
+ constructor() {
41
+ this.scheduler = new RouterScheduler();
42
+ this.urlPrefix = '';
43
+ this.mode = 'miniprogram'; // 默认小程序模式
44
+ }
40
45
 
41
46
  /**
42
47
  * setUrlPrefix
@@ -47,7 +52,6 @@ export class Router {
47
52
  setMode(mode) {
48
53
  this.mode = mode;
49
54
  }
50
- scheduler = (() => new RouterScheduler())();
51
55
 
52
56
  /**
53
57
  * 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
@@ -15,6 +15,7 @@ export declare class RouterScheduler extends IRouterScheduler<Route> {
15
15
  $entityMap: Route[];
16
16
  $subPackageRoute: Record<string, SubPackageRoute[]>;
17
17
  private $pathMap;
18
+ constructor();
18
19
  getCurrentRoute(): Route | undefined;
19
20
  /**
20
21
  * 将小程序地址栏转化为 web 地址
@@ -28,10 +28,12 @@ export function currentPage() {
28
28
  * 小程序路由别名机制,将标准化的 web pathname 转化为小程序的 path
29
29
  */
30
30
  export class RouterScheduler extends IRouterScheduler {
31
- $entityMap = [];
32
- $subPackageRoute = {};
33
- $pathMap = []; // 以小程序路径作为键存储关系
34
-
31
+ constructor() {
32
+ super();
33
+ this.$entityMap = [];
34
+ this.$subPackageRoute = {};
35
+ this.$pathMap = [];
36
+ }
35
37
  getCurrentRoute() {
36
38
  const {
37
39
  route,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/router-mp",
3
- "version": "1.7.25",
3
+ "version": "1.7.27",
4
4
  "description": "Ray Core",
5
5
  "keywords": [
6
6
  "ray"
@@ -26,20 +26,20 @@
26
26
  "@ray-js/api": "^1.6.32"
27
27
  },
28
28
  "dependencies": {
29
- "@ray-js/env": "1.7.25",
30
- "@ray-js/library": "1.7.25",
31
- "@ray-js/types": "1.7.25",
29
+ "@ray-js/env": "1.7.27",
30
+ "@ray-js/library": "1.7.27",
31
+ "@ray-js/types": "1.7.27",
32
32
  "@react-navigation/core": "^6.4.17",
33
33
  "path-to-regexp": "^6.3.0",
34
34
  "slash": "^5.1.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@ray-js/cli": "1.7.25",
37
+ "@ray-js/cli": "1.7.27",
38
38
  "typescript": "^5.8.3"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public",
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
- "gitHead": "ef8e38dc9f86bf83ea09461707952970c082c110"
44
+ "gitHead": "fbba848d7602d09deafd30c0df782f0ac45a2ff9"
45
45
  }