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

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