@ray-js/router-mp 1.5.40 → 1.5.41

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,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,15 @@ 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
46
40
 
47
41
  /**
48
42
  * setUrlPrefix
@@ -53,6 +47,8 @@ export class Router {
53
47
  setMode(mode) {
54
48
  this.mode = mode;
55
49
  }
50
+ scheduler = (() => new RouterScheduler())();
51
+
56
52
  /**
57
53
  * 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
58
54
  */
@@ -177,7 +173,7 @@ export class Router {
177
173
  const page = currentPage();
178
174
  const reg = RegExp('^' + this.urlPrefix + '/');
179
175
  const r = page.route.replace(reg, '');
180
- const path = url.params("/".concat(r), page.options);
176
+ const path = url.params(`/${r}`, page.options);
181
177
  const {
182
178
  pathname,
183
179
  query,
@@ -1,6 +1,8 @@
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
+ import "core-js/modules/esnext.iterator.constructor.js";
3
+ import "core-js/modules/esnext.iterator.find.js";
4
+ import "core-js/modules/esnext.iterator.for-each.js";
5
+ import "core-js/modules/esnext.iterator.some.js";
4
6
  import { compile, match, pathToRegexp } from 'path-to-regexp';
5
7
  import { url } from '@ray-js/library';
6
8
  import slash from 'slash';
@@ -26,13 +28,9 @@ export function currentPage() {
26
28
  * 小程序路由别名机制,将标准化的 web pathname 转化为小程序的 path
27
29
  */
28
30
  export class RouterScheduler extends IRouterScheduler {
29
- constructor() {
30
- super(...arguments);
31
- _defineProperty(this, "$entityMap", []);
32
- _defineProperty(this, "$subPackageRoute", {});
33
- _defineProperty(this, "$pathMap", []);
34
- }
35
- // 以小程序路径作为键存储关系
31
+ $entityMap = [];
32
+ $subPackageRoute = {};
33
+ $pathMap = []; // 以小程序路径作为键存储关系
36
34
 
37
35
  getCurrentRoute() {
38
36
  const {
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "core-js/modules/esnext.iterator.map.js";
1
2
  import { router } from './Router';
2
3
  import { normalizeTabBar } from '@ray-js/framework-shared';
3
4
  export function createRouter(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/router-mp",
3
- "version": "1.5.40",
3
+ "version": "1.5.41",
4
4
  "description": "Ray Core",
5
5
  "keywords": [
6
6
  "ray"
@@ -26,19 +26,19 @@
26
26
  "@ray-js/api": "1.5.17"
27
27
  },
28
28
  "dependencies": {
29
- "@ray-js/env": "1.5.40",
30
- "@ray-js/library": "1.5.40",
31
- "@ray-js/types": "1.5.40",
32
- "@react-navigation/core": "^6.4.16",
33
- "path-to-regexp": "^6.2.2",
29
+ "@ray-js/env": "1.5.41",
30
+ "@ray-js/library": "1.5.41",
31
+ "@ray-js/types": "1.5.41",
32
+ "@react-navigation/core": "^6.4.17",
33
+ "path-to-regexp": "^6.3.0",
34
34
  "slash": "^5.1.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@ray-js/cli": "1.5.40"
37
+ "@ray-js/cli": "1.5.41"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",
41
41
  "registry": "https://registry.npmjs.com"
42
42
  },
43
- "gitHead": "e8a643ccba2beedc367608816be210c5f55120cf"
43
+ "gitHead": "08f9269589769f029e63b3835dfa92b48c6a6f15"
44
44
  }