@ray-js/router-mp 1.5.0-beta.12 → 1.5.0

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.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import "core-js/modules/es.string.replace.js";
2
4
  import { url } from '@ray-js/library';
3
5
  import { navigateBack, navigateTo, reLaunch, switchTab, redirectTo } from '@ray-js/api';
4
6
  import { RouterScheduler, currentPage } from './RouterScheduler';
@@ -28,15 +30,19 @@ function pathRelative(fromPath, toPath) {
28
30
  return result;
29
31
  }
30
32
  export class Router {
31
- // 只有作为其他小程序的子包时,才设置urlPrefix
32
- urlPrefix = '';
33
- /**
34
- * 功能页模式为 functional,使用相对路径模式
35
- * 如果是绝对路径,表示跳转到宿主小程序
36
- *
37
- * @private
38
- */
39
- mode = 'miniprogram'; // functional
33
+ constructor() {
34
+ // 只有作为其他小程序的子包时,才设置urlPrefix
35
+ _defineProperty(this, "urlPrefix", '');
36
+ /**
37
+ * 功能页模式为 functional,使用相对路径模式
38
+ * 如果是绝对路径,表示跳转到宿主小程序
39
+ *
40
+ * @private
41
+ */
42
+ _defineProperty(this, "mode", 'miniprogram');
43
+ _defineProperty(this, "scheduler", new RouterScheduler());
44
+ }
45
+ // functional
40
46
 
41
47
  /**
42
48
  * setUrlPrefix
@@ -47,8 +53,6 @@ export class Router {
47
53
  setMode(mode) {
48
54
  this.mode = mode;
49
55
  }
50
- scheduler = new RouterScheduler();
51
-
52
56
  /**
53
57
  * 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
54
58
  */
@@ -173,7 +177,7 @@ export class Router {
173
177
  const page = currentPage();
174
178
  const reg = RegExp('^' + this.urlPrefix + '/');
175
179
  const r = page.route.replace(reg, '');
176
- const path = url.params(`/${r}`, page.options);
180
+ const path = url.params("/".concat(r), page.options);
177
181
  const {
178
182
  pathname,
179
183
  query,
@@ -1,4 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import "core-js/modules/web.dom-collections.iterator.js";
2
4
  import { compile, match, pathToRegexp } from 'path-to-regexp';
3
5
  import { url } from '@ray-js/library';
4
6
  import slash from 'slash';
@@ -24,9 +26,13 @@ export function currentPage() {
24
26
  * 小程序路由别名机制,将标准化的 web pathname 转化为小程序的 path
25
27
  */
26
28
  export class RouterScheduler extends IRouterScheduler {
27
- $entityMap = [];
28
- $subPackageRoute = {};
29
- $pathMap = []; // 以小程序路径作为键存储关系
29
+ constructor() {
30
+ super(...arguments);
31
+ _defineProperty(this, "$entityMap", []);
32
+ _defineProperty(this, "$subPackageRoute", {});
33
+ _defineProperty(this, "$pathMap", []);
34
+ }
35
+ // 以小程序路径作为键存储关系
30
36
 
31
37
  getCurrentRoute() {
32
38
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/router-mp",
3
- "version": "1.5.0-beta.12",
3
+ "version": "1.5.0",
4
4
  "description": "Ray Core",
5
5
  "keywords": [
6
6
  "ray"
@@ -23,20 +23,20 @@
23
23
  "watch": "tsc -p ./tsconfig.build.json --module esnext --outDir lib --watch"
24
24
  },
25
25
  "dependencies": {
26
- "@ray-js/api": "^1.5.0-beta.12",
27
- "@ray-js/env": "^1.5.0-beta.12",
28
- "@ray-js/library": "^1.5.0-beta.12",
29
- "@ray-js/types": "^1.5.0-beta.12",
30
- "@react-navigation/core": "^6.4.10",
26
+ "@ray-js/api": "1.5.0",
27
+ "@ray-js/env": "1.5.0",
28
+ "@ray-js/library": "1.5.0",
29
+ "@ray-js/types": "1.5.0",
30
+ "@react-navigation/core": "^6.4.16",
31
31
  "path-to-regexp": "^6.2.1",
32
32
  "slash": "^5.1.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@ray-js/cli": "^1.5.0-beta.12"
35
+ "@ray-js/cli": "1.5.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public",
39
39
  "registry": "https://registry.npmjs.org"
40
40
  },
41
- "gitHead": "7fb9ae94b8896c81a6b6556099107cb2daab9c9b"
41
+ "gitHead": "acb0b960e4f0cda492b34c950bf9cd8d5b27ec8a"
42
42
  }