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