@xfe-repo/web-router 1.1.3 → 1.1.6

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/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { LoadableComponent, loadableReady } from '@loadable/component';
3
3
  import { ParsedQuery } from 'query-string';
4
4
  import React, { ReactElement, PropsWithChildren, ComponentType } from 'react';
5
5
  import { RegisterComponentStatic } from '@xfe-repo/web-register';
6
+ import { LinkProps as LinkProps$1 } from 'react-router-dom';
6
7
  export * from 'react-router-dom';
7
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
8
9
 
@@ -13,9 +14,12 @@ type RouteConfig = {
13
14
  };
14
15
  type GetRoutesConfig = {
15
16
  pagesIndexPath: string[];
17
+ getRoutePath?: (path: string) => string;
16
18
  getPageComponents: (path: string) => Promise<any>;
17
19
  fallback?: ReactElement;
18
20
  };
21
+ declare const routerIndexRegx: RegExp;
22
+ declare const routerDynamicRegx: RegExp;
19
23
  declare const getRoutes: (config: GetRoutesConfig) => RouteConfig[];
20
24
 
21
25
  type RouterProps = PropsWithChildren<{
@@ -26,13 +30,11 @@ type RouterProps = PropsWithChildren<{
26
30
  }>;
27
31
  declare const Router: React.MemoExoticComponent<(props: RouterProps) => react_jsx_runtime.JSX.Element>;
28
32
 
29
- type LinkProps = PropsWithChildren<{
33
+ type LinkProps = Omit<LinkProps$1, 'to'> & {
30
34
  to: string;
31
35
  reLaunch?: boolean;
32
- replace?: boolean;
33
36
  preload?: boolean;
34
- className?: string;
35
- }>;
37
+ };
36
38
  declare const Link: React.MemoExoticComponent<(props: LinkProps) => react_jsx_runtime.JSX.Element>;
37
39
 
38
40
  type NavigatorStack = {
@@ -54,4 +56,4 @@ declare function createNavigator(options: CreateNavigatorOptions): NavigatorType
54
56
  declare const getClientNavigator: () => NavigatorType;
55
57
  declare const routerReady: typeof loadableReady;
56
58
 
57
- export { type CreateNavigatorOptions, type GetRoutesConfig, Link, type NavigatorStack, type NavigatorType, type PageComponent, type RouteConfig, Router, createNavigator, getClientNavigator, getRoutes, routerReady };
59
+ export { type CreateNavigatorOptions, type GetRoutesConfig, Link, type NavigatorStack, type NavigatorType, type PageComponent, type RouteConfig, Router, createNavigator, getClientNavigator, getRoutes, routerDynamicRegx, routerIndexRegx, routerReady };
package/dist/index.js CHANGED
@@ -276,6 +276,12 @@ __export(src_exports, {
276
276
  getRoutes: function() {
277
277
  return getRoutes;
278
278
  },
279
+ routerDynamicRegx: function() {
280
+ return routerDynamicRegx;
281
+ },
282
+ routerIndexRegx: function() {
283
+ return routerIndexRegx;
284
+ },
279
285
  routerReady: function() {
280
286
  return routerReady;
281
287
  }
@@ -289,20 +295,23 @@ var import_env = require("@xfe-repo/web-utils/env");
289
295
  __reExport(src_exports, require("react-router-dom"), module.exports);
290
296
  // src/routes.ts
291
297
  var import_component = __toESM(require("@loadable/component"));
298
+ var routerIndexRegx = /^(?!.*component)(.*)?\/index(\[[^.]+])?\.(ts|js)x?$/;
299
+ var routerDynamicRegx = /\[([^.]+)]/;
292
300
  var getRoutes = function(config) {
293
- var pagesIndexPath = config.pagesIndexPath, getPageComponents = config.getPageComponents, fallback = config.fallback;
301
+ var pagesIndexPath = config.pagesIndexPath, getRoutePath = config.getRoutePath, getPageComponents = config.getPageComponents, fallback = config.fallback;
294
302
  var routes = [];
295
303
  pagesIndexPath.forEach(function(pageIndexPath) {
304
+ var _pageIndexPath_match;
296
305
  if (pageIndexPath.startsWith("./")) return;
297
- var regExpResult = pageIndexPath.match(RegExp("(?<=pages\\/).*(?=\\/index.(?:tsx|js))"));
298
- var pageRelativePath = regExpResult ? regExpResult[0].toLowerCase() : "";
299
306
  var pageComponent = (0, import_component.default)(function() {
300
- return getPageComponents(pageRelativePath);
307
+ return getPageComponents(pageIndexPath);
301
308
  }, {
302
309
  fallback: fallback
303
310
  });
304
- var routerPath = "/".concat(pageRelativePath);
305
- if (routerPath === "/home" || routerPath === "/index") routerPath = "/";
311
+ var routerPath = getRoutePath ? getRoutePath(pageIndexPath) : pageIndexPath.replace(routerIndexRegx, "$1");
312
+ if (routerPath === "home" || routerPath === "index") routerPath = "/";
313
+ var dynamicRoute = ((_pageIndexPath_match = pageIndexPath.match(routerDynamicRegx)) === null || _pageIndexPath_match === void 0 ? void 0 : _pageIndexPath_match[1]) || "";
314
+ if (dynamicRoute) routerPath = "".concat(routerPath, "/").concat(dynamicRoute);
306
315
  var config2 = {
307
316
  path: routerPath,
308
317
  Component: pageComponent
@@ -542,5 +551,7 @@ var routerReady = import_component2.loadableReady;
542
551
  createNavigator: createNavigator,
543
552
  getClientNavigator: getClientNavigator,
544
553
  getRoutes: getRoutes,
554
+ routerDynamicRegx: routerDynamicRegx,
555
+ routerIndexRegx: routerIndexRegx,
545
556
  routerReady: routerReady
546
557
  }, require("react-router-dom")));
package/package.json CHANGED
@@ -1,21 +1,9 @@
1
1
  {
2
2
  "name": "@xfe-repo/web-router",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "sideEffects": false,
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "import": {
10
- "types": "./dist/index.d.mts",
11
- "default": "./dist/index.mjs"
12
- },
13
- "require": {
14
- "types": "./dist/index.d.ts",
15
- "default": "./dist/index.js"
16
- }
17
- }
18
- },
19
7
  "files": [
20
8
  "dist"
21
9
  ],
@@ -23,8 +11,8 @@
23
11
  "@loadable/component": "^5.16.4",
24
12
  "history": "^5.3.0",
25
13
  "query-string": "^7.1.3",
26
- "react-router-dom": "^6.26.2",
27
- "@xfe-repo/web-utils": "1.1.3"
14
+ "react-router-dom": "6.28.0",
15
+ "@xfe-repo/web-utils": "1.1.4"
28
16
  },
29
17
  "devDependencies": {
30
18
  "@types/loadable__component": "^5.13.9",
package/dist/index.d.mts DELETED
@@ -1,57 +0,0 @@
1
- import { History } from 'history';
2
- import { LoadableComponent, loadableReady } from '@loadable/component';
3
- import { ParsedQuery } from 'query-string';
4
- import React, { ReactElement, PropsWithChildren, ComponentType } from 'react';
5
- import { RegisterComponentStatic } from '@xfe-repo/web-register';
6
- export * from 'react-router-dom';
7
- import * as react_jsx_runtime from 'react/jsx-runtime';
8
-
9
- type PageComponent = LoadableComponent<any> & RegisterComponentStatic;
10
- type RouteConfig = {
11
- path: string;
12
- Component: PageComponent;
13
- };
14
- type GetRoutesConfig = {
15
- pagesIndexPath: string[];
16
- getPageComponents: (path: string) => Promise<any>;
17
- fallback?: ReactElement;
18
- };
19
- declare const getRoutes: (config: GetRoutesConfig) => RouteConfig[];
20
-
21
- type RouterProps = PropsWithChildren<{
22
- navigator: NavigatorType;
23
- routes: RouteConfig[];
24
- basename?: string;
25
- NotFoundPageComponent?: ComponentType;
26
- }>;
27
- declare const Router: React.MemoExoticComponent<(props: RouterProps) => react_jsx_runtime.JSX.Element>;
28
-
29
- type LinkProps = PropsWithChildren<{
30
- to: string;
31
- reLaunch?: boolean;
32
- replace?: boolean;
33
- preload?: boolean;
34
- className?: string;
35
- }>;
36
- declare const Link: React.MemoExoticComponent<(props: LinkProps) => react_jsx_runtime.JSX.Element>;
37
-
38
- type NavigatorStack = {
39
- pathname: string;
40
- };
41
- interface NavigatorType extends History {
42
- stack: NavigatorStack[];
43
- reLaunch: (path: string, state?: any) => void;
44
- preload: (path: string, isReplace?: boolean, query?: ParsedQuery<string | number | boolean>) => Promise<void>;
45
- leave: (path: string) => void;
46
- }
47
- type CreateNavigatorOptions = {
48
- mode: 'static' | 'browser' | 'hash';
49
- routes: RouteConfig[];
50
- initPathname?: string;
51
- redirect?: (path: string) => void;
52
- };
53
- declare function createNavigator(options: CreateNavigatorOptions): NavigatorType;
54
- declare const getClientNavigator: () => NavigatorType;
55
- declare const routerReady: typeof loadableReady;
56
-
57
- export { type CreateNavigatorOptions, type GetRoutesConfig, Link, type NavigatorStack, type NavigatorType, type PageComponent, type RouteConfig, Router, createNavigator, getClientNavigator, getRoutes, routerReady };
package/dist/index.mjs DELETED
@@ -1,454 +0,0 @@
1
- // src/index.ts
2
- function _array_like_to_array(arr, len) {
3
- if (len == null || len > arr.length) len = arr.length;
4
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
- return arr2;
6
- }
7
- function _array_with_holes(arr) {
8
- if (Array.isArray(arr)) return arr;
9
- }
10
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
- try {
12
- var info = gen[key](arg);
13
- var value = info.value;
14
- } catch (error) {
15
- reject(error);
16
- return;
17
- }
18
- if (info.done) {
19
- resolve(value);
20
- } else {
21
- Promise.resolve(value).then(_next, _throw);
22
- }
23
- }
24
- function _async_to_generator(fn) {
25
- return function() {
26
- var self = this, args = arguments;
27
- return new Promise(function(resolve, reject) {
28
- var gen = fn.apply(self, args);
29
- function _next(value) {
30
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
- }
32
- function _throw(err) {
33
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
- }
35
- _next(undefined);
36
- });
37
- };
38
- }
39
- function _define_property(obj, key, value) {
40
- if (key in obj) {
41
- Object.defineProperty(obj, key, {
42
- value: value,
43
- enumerable: true,
44
- configurable: true,
45
- writable: true
46
- });
47
- } else {
48
- obj[key] = value;
49
- }
50
- return obj;
51
- }
52
- function _iterable_to_array_limit(arr, i) {
53
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
54
- if (_i == null) return;
55
- var _arr = [];
56
- var _n = true;
57
- var _d = false;
58
- var _s, _e;
59
- try {
60
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
61
- _arr.push(_s.value);
62
- if (i && _arr.length === i) break;
63
- }
64
- } catch (err) {
65
- _d = true;
66
- _e = err;
67
- } finally{
68
- try {
69
- if (!_n && _i["return"] != null) _i["return"]();
70
- } finally{
71
- if (_d) throw _e;
72
- }
73
- }
74
- return _arr;
75
- }
76
- function _non_iterable_rest() {
77
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
78
- }
79
- function _object_spread(target) {
80
- for(var i = 1; i < arguments.length; i++){
81
- var source = arguments[i] != null ? arguments[i] : {};
82
- var ownKeys = Object.keys(source);
83
- if (typeof Object.getOwnPropertySymbols === "function") {
84
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
85
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
86
- }));
87
- }
88
- ownKeys.forEach(function(key) {
89
- _define_property(target, key, source[key]);
90
- });
91
- }
92
- return target;
93
- }
94
- function _sliced_to_array(arr, i) {
95
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
96
- }
97
- function _unsupported_iterable_to_array(o, minLen) {
98
- if (!o) return;
99
- if (typeof o === "string") return _array_like_to_array(o, minLen);
100
- var n = Object.prototype.toString.call(o).slice(8, -1);
101
- if (n === "Object" && o.constructor) n = o.constructor.name;
102
- if (n === "Map" || n === "Set") return Array.from(n);
103
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
104
- }
105
- function _ts_generator(thisArg, body) {
106
- var f, y, t, g, _ = {
107
- label: 0,
108
- sent: function() {
109
- if (t[0] & 1) throw t[1];
110
- return t[1];
111
- },
112
- trys: [],
113
- ops: []
114
- };
115
- return g = {
116
- next: verb(0),
117
- "throw": verb(1),
118
- "return": verb(2)
119
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
120
- return this;
121
- }), g;
122
- function verb(n) {
123
- return function(v) {
124
- return step([
125
- n,
126
- v
127
- ]);
128
- };
129
- }
130
- function step(op) {
131
- if (f) throw new TypeError("Generator is already executing.");
132
- while(_)try {
133
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
134
- if (y = 0, t) op = [
135
- op[0] & 2,
136
- t.value
137
- ];
138
- switch(op[0]){
139
- case 0:
140
- case 1:
141
- t = op;
142
- break;
143
- case 4:
144
- _.label++;
145
- return {
146
- value: op[1],
147
- done: false
148
- };
149
- case 5:
150
- _.label++;
151
- y = op[1];
152
- op = [
153
- 0
154
- ];
155
- continue;
156
- case 7:
157
- op = _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- default:
161
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
162
- _ = 0;
163
- continue;
164
- }
165
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
166
- _.label = op[1];
167
- break;
168
- }
169
- if (op[0] === 6 && _.label < t[1]) {
170
- _.label = t[1];
171
- t = op;
172
- break;
173
- }
174
- if (t && _.label < t[2]) {
175
- _.label = t[2];
176
- _.ops.push(op);
177
- break;
178
- }
179
- if (t[2]) _.ops.pop();
180
- _.trys.pop();
181
- continue;
182
- }
183
- op = body.call(thisArg, _);
184
- } catch (e) {
185
- op = [
186
- 6,
187
- e
188
- ];
189
- y = 0;
190
- } finally{
191
- f = t = 0;
192
- }
193
- if (op[0] & 5) throw op[1];
194
- return {
195
- value: op[0] ? op[1] : void 0,
196
- done: true
197
- };
198
- }
199
- }
200
- import { createHashHistory, createBrowserHistory, createMemoryHistory } from "history";
201
- import { loadableReady } from "@loadable/component";
202
- import { matchRoutes } from "react-router-dom";
203
- import queryString from "query-string";
204
- import { isProduction } from "@xfe-repo/web-utils/env";
205
- export * from "react-router-dom";
206
- // src/routes.ts
207
- import loadable from "@loadable/component";
208
- var getRoutes = function(config) {
209
- var pagesIndexPath = config.pagesIndexPath, getPageComponents = config.getPageComponents, fallback = config.fallback;
210
- var routes = [];
211
- pagesIndexPath.forEach(function(pageIndexPath) {
212
- if (pageIndexPath.startsWith("./")) return;
213
- var regExpResult = pageIndexPath.match(RegExp("(?<=pages\\/).*(?=\\/index.(?:tsx|js))"));
214
- var pageRelativePath = regExpResult ? regExpResult[0].toLowerCase() : "";
215
- var pageComponent = loadable(function() {
216
- return getPageComponents(pageRelativePath);
217
- }, {
218
- fallback: fallback
219
- });
220
- var routerPath = "/".concat(pageRelativePath);
221
- if (routerPath === "/home" || routerPath === "/index") routerPath = "/";
222
- var config2 = {
223
- path: routerPath,
224
- Component: pageComponent
225
- };
226
- routes.push(config2);
227
- });
228
- return routes;
229
- };
230
- // src/Router.tsx
231
- import { memo, useState, useEffect } from "react";
232
- import { Router as OriginalRouter, Routes, Route } from "react-router-dom";
233
- import { jsx, jsxs } from "react/jsx-runtime";
234
- var Router = memo(function(props) {
235
- var navigator = props.navigator, routes = props.routes, _props_basename = props.basename, basename = _props_basename === void 0 ? "/" : _props_basename, children = props.children, NotFoundPageComponent = props.NotFoundPageComponent;
236
- var _useState = _sliced_to_array(useState({
237
- action: navigator.action,
238
- location: navigator.location
239
- }), 2), navigatorState = _useState[0], setNavigatorState = _useState[1];
240
- useEffect(function() {
241
- return navigator.listen(setNavigatorState);
242
- }, [
243
- navigator
244
- ]);
245
- return /* @__PURE__ */ jsx(OriginalRouter, {
246
- navigator: navigator,
247
- navigationType: navigatorState.action,
248
- location: navigatorState.location,
249
- basename: basename,
250
- children: /* @__PURE__ */ jsx(Routes, {
251
- children: /* @__PURE__ */ jsxs(Route, {
252
- path: "/",
253
- element: children,
254
- children: [
255
- routes.map(function(param) {
256
- var path = param.path, Component = param.Component;
257
- return /* @__PURE__ */ jsx(Route, {
258
- path: path,
259
- Component: Component
260
- }, path);
261
- }),
262
- NotFoundPageComponent && /* @__PURE__ */ jsx(Route, {
263
- path: "*",
264
- Component: NotFoundPageComponent
265
- })
266
- ]
267
- })
268
- })
269
- });
270
- });
271
- // src/Link.tsx
272
- import { memo as memo2, useMemo } from "react";
273
- import { Link as OriginalLink } from "react-router-dom";
274
- import { jsx as jsx2 } from "react/jsx-runtime";
275
- var Link = memo2(function(props) {
276
- var to = props.to, children = props.children, reLaunch = props.reLaunch, preload = props.preload, replace = props.replace, className = props.className;
277
- var _navigator2 = useMemo(function() {
278
- return getClientNavigator();
279
- }, []);
280
- if (/http(s)?:\/{2}/.test(to)) {
281
- var handleLink = function(e) {
282
- e.preventDefault();
283
- window.location.href = to;
284
- };
285
- return /* @__PURE__ */ jsx2("a", {
286
- href: to,
287
- onClick: handleLink,
288
- className: className,
289
- children: children
290
- });
291
- }
292
- if (reLaunch) {
293
- var handleLink1 = function(e) {
294
- e.preventDefault();
295
- _navigator2.reLaunch(to);
296
- };
297
- return /* @__PURE__ */ jsx2("a", {
298
- href: to,
299
- onClick: handleLink1,
300
- className: className,
301
- children: children
302
- });
303
- }
304
- if (preload) {
305
- var handleLink2 = function() {
306
- var _ref = _async_to_generator(function(e) {
307
- return _ts_generator(this, function(_state) {
308
- switch(_state.label){
309
- case 0:
310
- e.preventDefault();
311
- return [
312
- 4,
313
- _navigator2.preload(to, replace)
314
- ];
315
- case 1:
316
- _state.sent();
317
- return [
318
- 2
319
- ];
320
- }
321
- });
322
- });
323
- return function handleLink2(e) {
324
- return _ref.apply(this, arguments);
325
- };
326
- }();
327
- return /* @__PURE__ */ jsx2("a", {
328
- href: to,
329
- onClick: handleLink2,
330
- className: className,
331
- children: children
332
- });
333
- }
334
- return /* @__PURE__ */ jsx2(OriginalLink, _object_spread({}, props));
335
- });
336
- // src/index.ts
337
- var _navigator;
338
- function createNavigator(options) {
339
- var mode = options.mode, _options_initPathname = options.initPathname, initPathname = _options_initPathname === void 0 ? "/" : _options_initPathname, routes = options.routes;
340
- var originHistory;
341
- if (mode === "static") {
342
- originHistory = createMemoryHistory({
343
- initialEntries: [
344
- initPathname
345
- ]
346
- });
347
- } else if (mode === "browser") {
348
- originHistory = createBrowserHistory();
349
- } else {
350
- originHistory = createHashHistory();
351
- }
352
- _navigator = originHistory;
353
- var initialStack = [
354
- {
355
- pathname: _navigator.location.pathname
356
- }
357
- ];
358
- var stack = _navigator.stack = initialStack;
359
- _navigator.listen(function(param) {
360
- var location = param.location, action = param.action;
361
- var pathname = location.pathname;
362
- if (action === "PUSH") {
363
- stack.push({
364
- pathname: pathname
365
- });
366
- } else if (action === "REPLACE") {
367
- stack.pop();
368
- stack.push({
369
- pathname: pathname
370
- });
371
- } else if (action === "POP") {
372
- stack.pop();
373
- }
374
- if (!isProduction) console.log("router", action, pathname, stack);
375
- });
376
- _navigator.reLaunch = function(path, state) {
377
- var _stack_;
378
- var shouldBlack = -stack.length + 1;
379
- if (shouldBlack < 0) _navigator.go(shouldBlack);
380
- if (((_stack_ = stack[0]) === null || _stack_ === void 0 ? void 0 : _stack_.pathname) === path) return;
381
- setTimeout(function() {
382
- _navigator.replace(path, state);
383
- }, 1);
384
- };
385
- _navigator.preload = function() {
386
- var _ref = _async_to_generator(function(path, isReplace, query) {
387
- var _matchRoutes_, _matchRoutes, _path_split, tmp, originPath, tmp1, search, matchPath, currentRoute, _pageModule_default_emitOnLoad, _pageModule_default, pageModule, _currentRoute_Component_emitOnLoad, _currentRoute_Component;
388
- return _ts_generator(this, function(_state) {
389
- switch(_state.label){
390
- case 0:
391
- _path_split = _sliced_to_array(path.split("?"), 2), tmp = _path_split[0], originPath = tmp === void 0 ? "" : tmp, tmp1 = _path_split[1], search = tmp1 === void 0 ? "" : tmp1;
392
- matchPath = originPath.toLowerCase();
393
- currentRoute = (_matchRoutes = matchRoutes(routes, matchPath)) === null || _matchRoutes === void 0 ? void 0 : (_matchRoutes_ = _matchRoutes[0]) === null || _matchRoutes_ === void 0 ? void 0 : _matchRoutes_.route;
394
- query = query || queryString.parse(search, {
395
- parseBooleans: true,
396
- parseNumbers: true
397
- });
398
- if (!!(currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.Component.config)) return [
399
- 3,
400
- 3
401
- ];
402
- return [
403
- 4,
404
- currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.Component.load()
405
- ];
406
- case 1:
407
- pageModule = _state.sent();
408
- return [
409
- 4,
410
- (_pageModule_default = pageModule.default) === null || _pageModule_default === void 0 ? void 0 : (_pageModule_default_emitOnLoad = _pageModule_default.emitOnLoad) === null || _pageModule_default_emitOnLoad === void 0 ? void 0 : _pageModule_default_emitOnLoad.call(_pageModule_default, {
411
- isPreload: true,
412
- query: query
413
- })
414
- ];
415
- case 2:
416
- _state.sent();
417
- return [
418
- 3,
419
- 5
420
- ];
421
- case 3:
422
- return [
423
- 4,
424
- currentRoute === null || currentRoute === void 0 ? void 0 : (_currentRoute_Component = currentRoute.Component) === null || _currentRoute_Component === void 0 ? void 0 : (_currentRoute_Component_emitOnLoad = _currentRoute_Component.emitOnLoad) === null || _currentRoute_Component_emitOnLoad === void 0 ? void 0 : _currentRoute_Component_emitOnLoad.call(_currentRoute_Component, {
425
- isPreload: true,
426
- query: query
427
- })
428
- ];
429
- case 4:
430
- _state.sent();
431
- _state.label = 5;
432
- case 5:
433
- if (isReplace) {
434
- _navigator.replace(path);
435
- } else {
436
- _navigator.push(path);
437
- }
438
- return [
439
- 2
440
- ];
441
- }
442
- });
443
- });
444
- return function(path, isReplace, query) {
445
- return _ref.apply(this, arguments);
446
- };
447
- }();
448
- return _navigator;
449
- }
450
- var getClientNavigator = function() {
451
- return _navigator;
452
- };
453
- var routerReady = loadableReady;
454
- export { Link, Router, createNavigator, getClientNavigator, getRoutes, routerReady };