@bleedingdev/modern-js-plugin-i18n 3.9.0-ultramodern.1 → 3.9.0-ultramodern.11

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.
Files changed (115) hide show
  1. package/dist/cjs/cli/index.js +10 -21
  2. package/dist/cjs/cli/localisedRoutes.js +46 -0
  3. package/dist/cjs/runtime/Link.js +19 -32
  4. package/dist/cjs/runtime/context.js +26 -61
  5. package/dist/cjs/runtime/contextHelpers.js +5 -5
  6. package/dist/cjs/runtime/core.js +27 -14
  7. package/dist/cjs/runtime/hooks.js +7 -8
  8. package/dist/cjs/runtime/localizedPaths.js +11 -9
  9. package/dist/cjs/runtime/navigation.js +48 -0
  10. package/dist/cjs/runtime/providerComposition.js +37 -13
  11. package/dist/cjs/runtime/routerAdapter.js +35 -140
  12. package/dist/cjs/runtime/utils.js +21 -19
  13. package/dist/cjs/server/defaultUrlStrategy.js +48 -0
  14. package/dist/cjs/server/index.js +11 -7
  15. package/dist/cjs/server/mappedUrlStrategy.js +43 -0
  16. package/dist/cjs/server/redirectPolicy.js +33 -24
  17. package/dist/cjs/shared/mappedUrlStrategy.js +63 -0
  18. package/dist/cjs/shared/urlStrategy.js +48 -0
  19. package/dist/esm/cli/index.mjs +10 -21
  20. package/dist/esm/cli/localisedRoutes.mjs +8 -0
  21. package/dist/esm/runtime/Link.mjs +19 -32
  22. package/dist/esm/runtime/context.mjs +18 -62
  23. package/dist/esm/runtime/contextHelpers.mjs +5 -5
  24. package/dist/esm/runtime/core.mjs +13 -6
  25. package/dist/esm/runtime/hooks.mjs +7 -8
  26. package/dist/esm/runtime/localizedPaths.mjs +11 -9
  27. package/dist/esm/runtime/navigation.mjs +7 -0
  28. package/dist/esm/runtime/providerComposition.mjs +38 -14
  29. package/dist/esm/runtime/routerAdapter.mjs +30 -141
  30. package/dist/esm/runtime/utils.mjs +19 -17
  31. package/dist/esm/server/defaultUrlStrategy.mjs +7 -0
  32. package/dist/esm/server/index.mjs +11 -7
  33. package/dist/esm/server/mappedUrlStrategy.mjs +1 -0
  34. package/dist/esm/server/redirectPolicy.mjs +33 -24
  35. package/dist/esm/shared/mappedUrlStrategy.mjs +19 -0
  36. package/dist/esm/shared/urlStrategy.mjs +7 -0
  37. package/dist/esm-node/cli/index.mjs +10 -21
  38. package/dist/esm-node/cli/localisedRoutes.mjs +9 -0
  39. package/dist/esm-node/runtime/Link.mjs +19 -32
  40. package/dist/esm-node/runtime/context.mjs +18 -62
  41. package/dist/esm-node/runtime/contextHelpers.mjs +5 -5
  42. package/dist/esm-node/runtime/core.mjs +13 -6
  43. package/dist/esm-node/runtime/hooks.mjs +7 -8
  44. package/dist/esm-node/runtime/localizedPaths.mjs +11 -9
  45. package/dist/esm-node/runtime/navigation.mjs +8 -0
  46. package/dist/esm-node/runtime/providerComposition.mjs +38 -14
  47. package/dist/esm-node/runtime/routerAdapter.mjs +30 -141
  48. package/dist/esm-node/runtime/utils.mjs +19 -17
  49. package/dist/esm-node/server/defaultUrlStrategy.mjs +8 -0
  50. package/dist/esm-node/server/index.mjs +11 -7
  51. package/dist/esm-node/server/mappedUrlStrategy.mjs +2 -0
  52. package/dist/esm-node/server/redirectPolicy.mjs +33 -24
  53. package/dist/esm-node/shared/mappedUrlStrategy.mjs +20 -0
  54. package/dist/esm-node/shared/urlStrategy.mjs +8 -0
  55. package/dist/types/cli/localisedRoutes.d.ts +18 -0
  56. package/dist/types/runtime/context.d.ts +8 -11
  57. package/dist/types/runtime/contextHelpers.d.ts +2 -2
  58. package/dist/types/runtime/core.d.ts +12 -2
  59. package/dist/types/runtime/hooks.d.ts +4 -5
  60. package/dist/types/runtime/localizedPaths.d.ts +4 -4
  61. package/dist/types/runtime/navigation.d.ts +10 -0
  62. package/dist/types/runtime/providerComposition.d.ts +13 -1
  63. package/dist/types/runtime/routerAdapter.d.ts +23 -6
  64. package/dist/types/runtime/utils.d.ts +4 -12
  65. package/dist/types/server/defaultUrlStrategy.d.ts +11 -0
  66. package/dist/types/server/index.d.ts +2 -0
  67. package/dist/types/server/mappedUrlStrategy.d.ts +7 -0
  68. package/dist/types/server/redirectPolicy.d.ts +5 -13
  69. package/dist/types/shared/mappedUrlStrategy.d.ts +27 -0
  70. package/dist/types/shared/type.d.ts +7 -11
  71. package/dist/types/shared/urlStrategy.d.ts +18 -0
  72. package/package.json +29 -17
  73. package/rstest.config.mts +6 -5
  74. package/src/cli/index.ts +42 -43
  75. package/src/cli/localisedRoutes.ts +43 -0
  76. package/src/runtime/Link.tsx +20 -40
  77. package/src/runtime/context.tsx +34 -133
  78. package/src/runtime/contextHelpers.ts +7 -5
  79. package/src/runtime/core.tsx +53 -6
  80. package/src/runtime/hooks.ts +14 -9
  81. package/src/runtime/i18n/instance.ts +1 -2
  82. package/src/runtime/localizedPaths.ts +24 -19
  83. package/src/runtime/navigation.tsx +20 -0
  84. package/src/runtime/providerComposition.tsx +71 -23
  85. package/src/runtime/routerAdapter.tsx +73 -338
  86. package/src/runtime/utils.ts +49 -31
  87. package/src/server/defaultUrlStrategy.ts +27 -0
  88. package/src/server/index.ts +39 -9
  89. package/src/server/mappedUrlStrategy.ts +10 -0
  90. package/src/server/redirectPolicy.ts +85 -70
  91. package/src/shared/mappedUrlStrategy.ts +59 -0
  92. package/src/shared/type.ts +7 -11
  93. package/src/shared/urlStrategy.ts +38 -0
  94. package/tests/backendDefaults.test.ts +2 -23
  95. package/tests/defaultUrlStrategy.test.ts +107 -0
  96. package/tests/federatedI18nBoundaryResolver.test.tsx +65 -0
  97. package/tests/i18nUtils.test.ts +31 -65
  98. package/tests/link.test.tsx +13 -511
  99. package/tests/localisedRouteGeneration.test.ts +159 -0
  100. package/tests/localisedUrls.test.ts +16 -208
  101. package/tests/mappedUrlStrategyDerivation.test.ts +62 -0
  102. package/tests/navigation.test.tsx +365 -0
  103. package/tests/reactI18nextRuntimeBoundary.test.ts +1 -82
  104. package/tests/redirectPolicy.test.ts +89 -27
  105. package/tests/routerAdapter.test.tsx +98 -1171
  106. package/tests/urlStrategySerialization.test.ts +122 -0
  107. package/tests/federatedI18nBoundary.client.test.tsx +0 -129
  108. package/tests/federatedI18nBoundary.test.tsx +0 -132
  109. package/tests/linkTypes.test.ts +0 -59
  110. package/tests/localisedUrlRewriteMatrix.fork.test.ts +0 -147
  111. package/tests/peerCohort.test.ts +0 -25
  112. package/tests/type-fixture/fixture-globals.d.ts +0 -11
  113. package/tests/type-fixture/i18nInstanceTypes.fixture.ts +0 -29
  114. package/tests/type-fixture/linkTypes.fixture.tsx +0 -51
  115. package/tests/type-fixture/tsconfig.json +0 -16
@@ -31,7 +31,6 @@ __webpack_require__.d(__webpack_exports__, {
31
31
  createI18nRootWrapper: ()=>createI18nRootWrapper
32
32
  });
33
33
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
34
- const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
35
34
  const runtime_namespaceObject = require("@modern-js/runtime");
36
35
  const head_namespaceObject = require("@modern-js/runtime/head");
37
36
  const external_react_namespaceObject = require("react");
@@ -39,8 +38,14 @@ const external_context_js_namespaceObject = require("./context.js");
39
38
  const external_hooks_js_namespaceObject = require("./hooks.js");
40
39
  const instance_js_namespaceObject = require("./i18n/instance.js");
41
40
  const external_routerAdapter_js_namespaceObject = require("./routerAdapter.js");
42
- const createI18nRootWrapper = (options)=>(App)=>(props)=>{
43
- const { entryName, htmlLangAttr, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, localisedUrls, getLatestI18nInstance, getI18nextProvider } = options;
41
+ const NativeLanguageSynchronization = ({ i18nInstance, localePathRedirect, languages, pathname, prevLangRef, setLang, children })=>{
42
+ const synchronizeLanguage = (0, external_hooks_js_namespaceObject.useLanguageSync)(i18nInstance, localePathRedirect, languages, pathname, prevLangRef, setLang);
43
+ return children(synchronizeLanguage);
44
+ };
45
+ const createI18nRootWrapper = (options)=>(App)=>{
46
+ const LanguageSynchronization = options.LanguageSynchronization ?? NativeLanguageSynchronization;
47
+ const I18nRoot = (props)=>{
48
+ const { entryName, htmlLangAttr, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, urlStrategy, getLatestI18nInstance, getI18nextProvider } = options;
44
49
  const runtimeContext = (0, external_react_namespaceObject.useContext)(runtime_namespaceObject.RuntimeContext);
45
50
  const i18nInstance = runtimeContext.i18nInstance || getLatestI18nInstance();
46
51
  const initialLang = (0, external_react_namespaceObject.useMemo)(()=>i18nInstance?.language || fallbackLanguage, [
@@ -65,18 +70,16 @@ const createI18nRootWrapper = (options)=>(App)=>(props)=>{
65
70
  lang
66
71
  ]);
67
72
  (0, external_hooks_js_namespaceObject.useSdkResourcesLoader)(i18nInstance, setForceUpdate);
68
- const synchronizeLanguage = (0, i18n_runtime_extensions_namespaceObject.useLanguageSync)(i18nInstance, localePathRedirect, languages, location?.pathname, prevLangRef, setLang);
69
- (0, external_hooks_js_namespaceObject.useClientSideRedirect)(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, localisedUrls);
70
- const contextValue = (0, external_react_namespaceObject.useMemo)(()=>(0, external_hooks_js_namespaceObject.createContextValue)(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, localisedUrls, setLang, synchronizeLanguage), [
73
+ (0, external_hooks_js_namespaceObject.useClientSideRedirect)(i18nInstance, localePathRedirect, languages, fallbackLanguage, ignoreRedirectRoutes, urlStrategy);
74
+ const contextValue = (0, external_react_namespaceObject.useMemo)(()=>(0, external_hooks_js_namespaceObject.createContextValue)(lang, i18nInstance, entryName, languages, localePathRedirect, ignoreRedirectRoutes, setLang, urlStrategy), [
71
75
  lang,
72
76
  i18nInstance,
73
77
  entryName,
74
78
  languages,
75
79
  localePathRedirect,
76
80
  ignoreRedirectRoutes,
77
- localisedUrls,
78
- forceUpdate,
79
- synchronizeLanguage
81
+ urlStrategy,
82
+ forceUpdate
80
83
  ]);
81
84
  const I18nextProvider = getI18nextProvider();
82
85
  const i18nextInstanceForProvider = (0, external_react_namespaceObject.useMemo)(()=>i18nInstance ? (0, instance_js_namespaceObject.getI18nextInstanceForProvider)(i18nInstance, lang) : void 0, [
@@ -99,14 +102,35 @@ const createI18nRootWrapper = (options)=>(App)=>(props)=>{
99
102
  lang
100
103
  }
101
104
  }),
102
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_context_js_namespaceObject.ModernI18nProvider, {
103
- i18nextProvider: I18nextProvider,
104
- value: contextValue,
105
- children: appContent
105
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(LanguageSynchronization, {
106
+ i18nInstance: i18nInstance,
107
+ localePathRedirect: localePathRedirect,
108
+ languages: languages,
109
+ pathname: location?.pathname,
110
+ prevLangRef: prevLangRef,
111
+ setLang: setLang,
112
+ children: (synchronizeLanguage)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_context_js_namespaceObject.ModernI18nProvider, {
113
+ i18nextProvider: I18nextProvider,
114
+ value: {
115
+ ...contextValue,
116
+ synchronizeLanguage
117
+ },
118
+ children: appContent
119
+ })
106
120
  })
107
121
  ]
108
122
  });
109
123
  };
124
+ const { NavigationProvider } = options;
125
+ if (!NavigationProvider) return I18nRoot;
126
+ return function(props) {
127
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NavigationProvider, {
128
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(I18nRoot, {
129
+ ...props
130
+ })
131
+ });
132
+ };
133
+ };
110
134
  exports.createI18nRootWrapper = __webpack_exports__.createI18nRootWrapper;
111
135
  for(var __rspack_i in __webpack_exports__)if (-1 === [
112
136
  "createI18nRootWrapper"
@@ -28,160 +28,55 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
- useI18nRouterAdapter: ()=>useI18nRouterAdapter
31
+ I18nNavigationProvider: ()=>I18nNavigationProvider,
32
+ useI18nRouterAdapter: ()=>useI18nRouterAdapter,
33
+ useNativeI18nRouterAdapter: ()=>useNativeI18nRouterAdapter
32
34
  });
35
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
36
  const runtime_namespaceObject = require("@modern-js/runtime");
34
37
  const context_namespaceObject = require("@modern-js/runtime/context");
35
38
  const external_react_namespaceObject = require("react");
36
- const normalizeUrlPart = (value, prefix)=>{
37
- if ('string' != typeof value || !value) return '';
38
- return value.startsWith(prefix) ? value : `${prefix}${value}`;
39
- };
40
- const normalizeLocation = (location)=>{
41
- if (!location || 'object' != typeof location) return null;
42
- const locationValue = location;
43
- if ('string' != typeof locationValue.pathname) return null;
44
- return {
45
- pathname: locationValue.pathname,
46
- search: normalizeUrlPart('string' == typeof locationValue.search ? locationValue.search : locationValue.searchStr, '?'),
47
- hash: normalizeUrlPart(locationValue.hash, '#')
48
- };
49
- };
50
- const getWindowLocation = ()=>{
51
- if (!(0, runtime_namespaceObject.isBrowser)()) return null;
52
- return {
53
- pathname: window.location.pathname,
54
- search: window.location.search,
55
- hash: window.location.hash
56
- };
57
- };
58
- const getRouterFramework = (runtimeContext, internalContext, inReactRouter)=>{
59
- const framework = (0, context_namespaceObject.getRouterRuntimeState)(internalContext)?.framework || (0, context_namespaceObject.getRouterRuntimeState)(runtimeContext)?.framework;
60
- if (framework) return framework;
61
- if (internalContext.router?.useRouter || runtimeContext.router?.useRouter) return 'tanstack';
62
- if (internalContext.router?.useLocation || internalContext.router?.useHref || runtimeContext.router?.useLocation || runtimeContext.router?.useHref) return 'react-router';
63
- if (inReactRouter) return 'react-router';
64
- };
65
- const getRouterInstance = (internalContext, contextRouter)=>{
66
- if (contextRouter) return contextRouter;
67
- const router = (0, context_namespaceObject.getRouterRuntimeState)(internalContext)?.instance;
68
- if (!router || 'object' != typeof router) return null;
69
- return router;
70
- };
71
- const getRouterStateLocation = (internalContext, contextRouter)=>{
72
- const router = getRouterInstance(internalContext, contextRouter);
73
- return normalizeLocation(router?.stores?.location?.get?.()) || normalizeLocation(router?.state?.location);
74
- };
75
- const getRouterParams = (internalContext, contextRouter)=>{
76
- const router = getRouterInstance(internalContext, contextRouter);
77
- const matches = router?.stores?.matches?.get?.() || router?.state?.matches;
78
- if (!Array.isArray(matches)) return {};
79
- return matches.reduce((params, match)=>{
80
- if (match?.params) Object.assign(params, match.params);
81
- return params;
82
- }, {});
83
- };
84
- const getRouterSnapshot = (internalContext, contextRouter)=>{
85
- const location = getRouterStateLocation(internalContext, contextRouter);
86
- const params = getRouterParams(internalContext, contextRouter);
87
- return JSON.stringify([
88
- location?.pathname ?? '',
89
- location?.search ?? '',
90
- location?.hash ?? '',
91
- Object.entries(params).sort(([left], [right])=>left.localeCompare(right))
92
- ]);
93
- };
94
- const useI18nRouterAdapter = ()=>{
39
+ const navigationContextKey = Symbol.for('@modern-js/plugin-i18n/runtime/I18nNavigationContext');
40
+ const contextStore = globalThis;
41
+ const I18nNavigationContext = contextStore[navigationContextKey] ??= /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
42
+ const I18nNavigationProvider = ({ children, value })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(I18nNavigationContext.Provider, {
43
+ value: value,
44
+ children: children
45
+ });
46
+ const useNativeI18nRouterAdapter = ()=>{
95
47
  const runtimeContext = (0, external_react_namespaceObject.useContext)(runtime_namespaceObject.RuntimeContext);
96
48
  const internalContext = (0, external_react_namespaceObject.useContext)(context_namespaceObject.InternalRuntimeContext);
97
49
  const routerApi = internalContext.router || runtimeContext.router;
98
- const inReactRouter = routerApi?.useInRouterContext?.() ?? false;
99
- const reactRouterNavigate = inReactRouter ? routerApi?.useNavigate?.() ?? null : null;
100
- const reactRouterLocation = inReactRouter ? routerApi?.useLocation?.() ?? null : null;
101
- const reactRouterParams = inReactRouter ? routerApi?.useParams?.() ?? {} : {};
102
- const framework = getRouterFramework(runtimeContext, internalContext, inReactRouter);
103
- const contextUseRouter = inReactRouter || 'tanstack' !== framework ? void 0 : internalContext.router?.useRouter || runtimeContext.router?.useRouter;
104
- const contextRouter = contextUseRouter ? contextUseRouter({
105
- warn: false
106
- }) : null;
107
- const hasRouter = 'tanstack' === framework || 'react-router' === framework || Boolean(reactRouterNavigate);
108
- const subscribeToRouter = (0, external_react_namespaceObject.useCallback)((update)=>{
109
- const router = getRouterInstance(internalContext, contextRouter);
110
- if (!router) return ()=>void 0;
111
- const unsubscribers = [];
112
- if ('react-router' === framework && !inReactRouter && 'function' == typeof router.subscribe) {
113
- const subscribe = router.subscribe;
114
- const unsubscribe = subscribe.call(router, update);
115
- if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
116
- }
117
- if ('tanstack' === framework && 'function' == typeof router.stores?.location?.subscribe) {
118
- const unsubscribe = router.stores.location.subscribe(update);
119
- if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
120
- }
121
- if ('tanstack' === framework && 'function' == typeof router.subscribe) {
122
- const subscribe = router.subscribe;
123
- for (const eventType of [
124
- 'onBeforeNavigate',
125
- 'onBeforeLoad'
126
- ]){
127
- const unsubscribe = subscribe.call(router, eventType, update);
128
- if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
129
- }
130
- }
131
- return ()=>{
132
- for (const unsubscribe of unsubscribers)unsubscribe();
133
- };
134
- }, [
135
- contextRouter,
136
- framework,
137
- inReactRouter,
138
- internalContext
139
- ]);
140
- const getSnapshot = (0, external_react_namespaceObject.useCallback)(()=>getRouterSnapshot(internalContext, contextRouter), [
141
- contextRouter,
142
- internalContext
143
- ]);
144
- (0, external_react_namespaceObject.useSyncExternalStore)(subscribeToRouter, getSnapshot, getSnapshot);
145
- const navigate = (0, external_react_namespaceObject.useCallback)((href, options)=>{
146
- const router = getRouterInstance(internalContext, contextRouter);
147
- const activeFramework = getRouterFramework(runtimeContext, internalContext, inReactRouter);
148
- if ('tanstack' === activeFramework) {
149
- if ('function' == typeof router?.navigate) return router.navigate({
150
- to: href,
151
- replace: options?.replace,
152
- ...options?.state === void 0 ? {} : {
153
- state: options.state
154
- }
155
- });
156
- throw new Error('TanStack router instance is not available.');
157
- }
158
- if (reactRouterNavigate) return reactRouterNavigate(href, options);
159
- if ('react-router' === activeFramework) {
160
- if ('function' == typeof router?.navigate) return router.navigate(href, options);
161
- throw new Error('React Router instance is not available.');
162
- }
163
- }, [
164
- contextRouter,
165
- internalContext,
166
- inReactRouter,
167
- reactRouterNavigate,
168
- runtimeContext
169
- ]);
170
- const location = (reactRouterLocation ? normalizeLocation(reactRouterLocation) : getRouterStateLocation(internalContext, contextRouter)) || getWindowLocation();
171
- const params = inReactRouter ? reactRouterParams : getRouterParams(internalContext, contextRouter);
172
- const Link = 'tanstack' === framework ? internalContext.router?.Link || runtimeContext.router?.Link || null : 'react-router' === framework || inReactRouter ? routerApi?.Link ?? null : null;
50
+ const hasRouter = routerApi?.useInRouterContext?.() ?? false;
51
+ const navigate = hasRouter ? routerApi?.useNavigate?.() ?? null : null;
52
+ const routerLocation = hasRouter ? routerApi?.useLocation?.() ?? null : null;
53
+ const params = hasRouter ? routerApi?.useParams?.() ?? {} : {};
54
+ const location = routerLocation ?? ((0, runtime_namespaceObject.isBrowser)() ? {
55
+ pathname: window.location.pathname,
56
+ search: window.location.search,
57
+ hash: window.location.hash
58
+ } : null);
173
59
  return {
174
- framework,
60
+ framework: hasRouter ? 'react-router' : void 0,
175
61
  hasRouter,
62
+ navigate,
176
63
  location,
177
- navigate: hasRouter ? navigate : null,
178
- Link,
179
- params
64
+ params,
65
+ Link: hasRouter ? routerApi?.Link ?? null : null
180
66
  };
181
67
  };
68
+ const useI18nRouterAdapter = ()=>{
69
+ const provided = (0, external_react_namespaceObject.useContext)(I18nNavigationContext);
70
+ const native = useNativeI18nRouterAdapter();
71
+ return provided ?? native;
72
+ };
73
+ exports.I18nNavigationProvider = __webpack_exports__.I18nNavigationProvider;
182
74
  exports.useI18nRouterAdapter = __webpack_exports__.useI18nRouterAdapter;
75
+ exports.useNativeI18nRouterAdapter = __webpack_exports__.useNativeI18nRouterAdapter;
183
76
  for(var __rspack_i in __webpack_exports__)if (-1 === [
184
- "useI18nRouterAdapter"
77
+ "I18nNavigationProvider",
78
+ "useI18nRouterAdapter",
79
+ "useNativeI18nRouterAdapter"
185
80
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
186
81
  Object.defineProperty(exports, '__esModule', {
187
82
  value: true
@@ -34,11 +34,13 @@ __webpack_require__.d(__webpack_exports__, {
34
34
  getLanguageFromPath: ()=>getLanguageFromPath,
35
35
  getPathname: ()=>getPathname,
36
36
  shouldIgnoreRedirect: ()=>shouldIgnoreRedirect,
37
- splitUrlTarget: ()=>splitUrlTarget
37
+ splitUrlTarget: ()=>url_namespaceObject.splitUrlTarget
38
38
  });
39
- const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
40
39
  const runtime_namespaceObject = require("@modern-js/runtime");
41
40
  const context_namespaceObject = require("@modern-js/runtime/context");
41
+ const url_namespaceObject = require("@modern-js/runtime-utils/url");
42
+ const mappedUrlStrategy_js_namespaceObject = require("../shared/mappedUrlStrategy.js");
43
+ const urlStrategy_js_namespaceObject = require("../shared/urlStrategy.js");
42
44
  const getPathname = (context)=>{
43
45
  if ((0, runtime_namespaceObject.isBrowser)()) return window.location.pathname;
44
46
  return context.ssrContext?.request?.pathname || '/';
@@ -54,22 +56,14 @@ const getLanguageFromPath = (pathname, languages, fallbackLanguage)=>{
54
56
  if (languages.includes(firstSegment)) return firstSegment;
55
57
  return fallbackLanguage;
56
58
  };
57
- const splitUrlTarget = (target)=>{
58
- const hashIndex = target.indexOf('#');
59
- const hash = hashIndex >= 0 ? target.slice(hashIndex) : '';
60
- const beforeHash = hashIndex >= 0 ? target.slice(0, hashIndex) : target;
61
- const searchIndex = beforeHash.indexOf('?');
62
- const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : '';
63
- const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
64
- return {
65
- pathname,
66
- search,
67
- hash
68
- };
69
- };
70
- const buildLocalizedUrl = (target, language, languages, localisedUrls)=>{
71
- const { pathname, search, hash } = splitUrlTarget(target);
72
- const localizedPathname = (0, i18n_runtime_extensions_namespaceObject.localiseTargetPathname)(pathname, language, languages, localisedUrls);
59
+ const buildLocalizedUrl = (target, language, languages, urlStrategy)=>{
60
+ const { pathname, search, hash } = (0, url_namespaceObject.splitUrlTarget)(target);
61
+ const strategy = (0, urlStrategy_js_namespaceObject.asI18nUrlStrategy)(urlStrategy);
62
+ if (strategy) return `${strategy.localizePathname(pathname, language, languages)}${search}${hash}`;
63
+ const segments = pathname.split('/').filter(Boolean);
64
+ if (segments[0] && languages.some((item)=>item.toLowerCase() === segments[0].toLowerCase())) segments[0] = language;
65
+ else segments.unshift(language);
66
+ const localizedPathname = `/${segments.join('/')}`;
73
67
  return `${localizedPathname}${search}${hash}`;
74
68
  };
75
69
  const detectLanguageFromPath = (pathname, languages, localePathRedirect)=>{
@@ -89,7 +83,15 @@ const detectLanguageFromPath = (pathname, languages, localePathRedirect)=>{
89
83
  detected: false
90
84
  };
91
85
  };
92
- const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>(0, i18n_runtime_extensions_namespaceObject.shouldSkipLocaleRedirect)(pathname, languages, ignoreRedirectRoutes);
86
+ const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes, urlStrategy)=>{
87
+ if ((0, mappedUrlStrategy_js_namespaceObject.isDefaultLocaleRedirectSkipPath)(pathname, languages)) return true;
88
+ if ((0, urlStrategy_js_namespaceObject.asI18nUrlStrategy)(urlStrategy)?.shouldSkipRedirect?.(pathname, languages)) return true;
89
+ if (!ignoreRedirectRoutes) return false;
90
+ const segments = pathname.split('/').filter(Boolean);
91
+ if (segments[0] && languages.some((item)=>item.toLowerCase() === segments[0].toLowerCase())) segments.shift();
92
+ const normalizedPath = `/${segments.join('/')}`;
93
+ return 'function' == typeof ignoreRedirectRoutes ? ignoreRedirectRoutes(normalizedPath) : ignoreRedirectRoutes.some((pattern)=>normalizedPath === pattern || normalizedPath.startsWith(`${pattern}/`));
94
+ };
93
95
  exports.buildLocalizedUrl = __webpack_exports__.buildLocalizedUrl;
94
96
  exports.detectLanguageFromPath = __webpack_exports__.detectLanguageFromPath;
95
97
  exports.getEntryPath = __webpack_exports__.getEntryPath;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createDefaultUrlStrategy: ()=>createDefaultUrlStrategy,
32
+ resolveDefaultUrlStrategy: ()=>resolveDefaultUrlStrategy
33
+ });
34
+ const external_mappedUrlStrategy_js_namespaceObject = require("./mappedUrlStrategy.js");
35
+ const createDefaultUrlStrategy = (localisedUrls)=>(0, external_mappedUrlStrategy_js_namespaceObject.createMappedUrlStrategy)(localisedUrls);
36
+ const resolveDefaultUrlStrategy = (localisedUrls)=>{
37
+ if (!localisedUrls || 'object' != typeof localisedUrls || 0 === Object.keys(localisedUrls).length) return;
38
+ return createDefaultUrlStrategy(localisedUrls);
39
+ };
40
+ exports.createDefaultUrlStrategy = __webpack_exports__.createDefaultUrlStrategy;
41
+ exports.resolveDefaultUrlStrategy = __webpack_exports__.resolveDefaultUrlStrategy;
42
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
43
+ "createDefaultUrlStrategy",
44
+ "resolveDefaultUrlStrategy"
45
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
46
+ Object.defineProperty(exports, '__esModule', {
47
+ value: true
48
+ });
@@ -33,10 +33,11 @@ __webpack_require__.d(__webpack_exports__, {
33
33
  i18nServerPlugin: ()=>i18nServerPlugin,
34
34
  matchesApiPrefix: ()=>external_apiPrefix_js_namespaceObject.matchesApiPrefix
35
35
  });
36
- const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
37
36
  const hono_namespaceObject = require("@modern-js/server-core/hono");
37
+ const urlStrategy_js_namespaceObject = require("../shared/urlStrategy.js");
38
38
  const utils_js_namespaceObject = require("../shared/utils.js");
39
39
  const external_apiPrefix_js_namespaceObject = require("./apiPrefix.js");
40
+ const external_defaultUrlStrategy_js_namespaceObject = require("./defaultUrlStrategy.js");
40
41
  const external_detectorOptions_js_namespaceObject = require("./detectorOptions.js");
41
42
  const external_redirectPolicy_js_namespaceObject = require("./redirectPolicy.js");
42
43
  const { languageDetector } = hono_namespaceObject;
@@ -59,7 +60,10 @@ const i18nServerPlugin = (options)=>({
59
60
  const { entryName } = route;
60
61
  if (!entryName) return;
61
62
  if (!options.localeDetection) return;
62
- const { localePathRedirect, i18nextDetector = true, languages = [], fallbackLanguage = 'en', detection, ignoreRedirectRoutes, localisedUrls } = (0, utils_js_namespaceObject.getLocaleDetectionOptions)(entryName, options.localeDetection);
63
+ const entryLocaleDetection = (0, utils_js_namespaceObject.getLocaleDetectionOptions)(entryName, options.localeDetection);
64
+ const { localePathRedirect, i18nextDetector = true, languages = [], fallbackLanguage = 'en', detection, ignoreRedirectRoutes } = entryLocaleDetection;
65
+ const legacyLocalisedUrls = Reflect.get(entryLocaleDetection, 'localisedUrls');
66
+ const urlStrategy = (0, urlStrategy_js_namespaceObject.asI18nUrlStrategy)(options.resolveUrlStrategy?.(entryName)) ?? (0, external_defaultUrlStrategy_js_namespaceObject.resolveDefaultUrlStrategy)(legacyLocalisedUrls);
63
67
  const staticRoutePrefixes = options.staticRoutePrefixes;
64
68
  const originUrlPath = route.urlPath;
65
69
  const urlPath = originUrlPath.endsWith('/') ? `${originUrlPath}*` : `${originUrlPath}/*`;
@@ -74,6 +78,7 @@ const i18nServerPlugin = (options)=>({
74
78
  const url = new URL(c.req.url);
75
79
  const pathname = url.pathname;
76
80
  if ((0, external_apiPrefix_js_namespaceObject.matchesApiPrefix)(pathname, apiPrefixes)) return await next();
81
+ if ((0, external_redirectPolicy_js_namespaceObject.shouldIgnoreRedirect)(pathname, urlPath, ignoreRedirectRoutes, urlStrategy, languages)) return await next();
77
82
  if ((0, external_redirectPolicy_js_namespaceObject.isStaticResourceRequest)(pathname, staticRoutePrefixes, languages)) return await next();
78
83
  if ('/' === originUrlPath) {
79
84
  const pathSegments = pathname.split('/').filter(Boolean);
@@ -94,7 +99,7 @@ const i18nServerPlugin = (options)=>({
94
99
  const pathname = url.pathname;
95
100
  if ((0, external_apiPrefix_js_namespaceObject.matchesApiPrefix)(pathname, apiPrefixes)) return await next();
96
101
  if ((0, external_redirectPolicy_js_namespaceObject.isStaticResourceRequest)(pathname, staticRoutePrefixes, languages)) return await next();
97
- if ((0, external_redirectPolicy_js_namespaceObject.shouldIgnoreRedirect)(pathname, urlPath, ignoreRedirectRoutes)) return await next();
102
+ if ((0, external_redirectPolicy_js_namespaceObject.shouldIgnoreRedirect)(pathname, urlPath, ignoreRedirectRoutes, urlStrategy, languages)) return await next();
98
103
  if ('/' === originUrlPath) {
99
104
  const pathSegments = pathname.split('/').filter(Boolean);
100
105
  if (pathSegments.length > 0) {
@@ -107,12 +112,11 @@ const i18nServerPlugin = (options)=>({
107
112
  let detectedLanguage = null;
108
113
  if (i18nextDetector) detectedLanguage = c.get('language') || null;
109
114
  const targetLanguage = detectedLanguage || fallbackLanguage;
110
- const localizedUrl = (0, external_redirectPolicy_js_namespaceObject.buildLocalizedUrl)(c.req, originUrlPath, targetLanguage, languages, localisedUrls);
115
+ const localizedUrl = (0, external_redirectPolicy_js_namespaceObject.buildLocalizedUrl)(c.req, originUrlPath, targetLanguage, languages, urlStrategy);
111
116
  return (0, external_redirectPolicy_js_namespaceObject.createLocaleRedirectResponse)(localizedUrl);
112
117
  }
113
- const localisedUrlsConfig = (0, i18n_runtime_extensions_namespaceObject.resolveLocalisedUrlsConfig)(localisedUrls);
114
- if (localisedUrlsConfig.enabled) {
115
- const expectedUrl = (0, external_redirectPolicy_js_namespaceObject.buildLocalizedUrl)(c.req, originUrlPath, language, languages, localisedUrls);
118
+ if (urlStrategy) {
119
+ const expectedUrl = (0, external_redirectPolicy_js_namespaceObject.buildLocalizedUrl)(c.req, originUrlPath, language, languages, urlStrategy);
116
120
  if (expectedUrl !== `${pathname}${url.search}${url.hash}`) return (0, external_redirectPolicy_js_namespaceObject.createLocaleRedirectResponse)(expectedUrl);
117
121
  }
118
122
  await next();
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createMappedUrlStrategy: ()=>mappedUrlStrategy_js_namespaceObject.createMappedUrlStrategy,
32
+ resolveMappedUrlStrategy: ()=>mappedUrlStrategy_js_namespaceObject.resolveMappedUrlStrategy
33
+ });
34
+ const mappedUrlStrategy_js_namespaceObject = require("../shared/mappedUrlStrategy.js");
35
+ exports.createMappedUrlStrategy = __webpack_exports__.createMappedUrlStrategy;
36
+ exports.resolveMappedUrlStrategy = __webpack_exports__.resolveMappedUrlStrategy;
37
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
38
+ "createMappedUrlStrategy",
39
+ "resolveMappedUrlStrategy"
40
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
41
+ Object.defineProperty(exports, '__esModule', {
42
+ value: true
43
+ });
@@ -34,42 +34,51 @@ __webpack_require__.d(__webpack_exports__, {
34
34
  isStaticResourceRequest: ()=>isStaticResourceRequest,
35
35
  shouldIgnoreRedirect: ()=>shouldIgnoreRedirect
36
36
  });
37
- const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
37
+ const mappedUrlStrategy_js_namespaceObject = require("../shared/mappedUrlStrategy.js");
38
+ const urlStrategy_js_namespaceObject = require("../shared/urlStrategy.js");
38
39
  const stripUrlPathPrefix = (pathname, urlPath)=>{
39
40
  const basePath = urlPath.replace('/*', '');
40
41
  if (!basePath || '/' === basePath) return pathname;
41
- const remainingPath = pathname.startsWith(basePath) ? pathname.slice(basePath.length) : pathname;
42
- return remainingPath || '/';
42
+ return pathname === basePath || pathname.startsWith(`${basePath}/`) ? pathname.slice(basePath.length) || '/' : pathname;
43
43
  };
44
- const shouldIgnoreRedirect = (pathname, urlPath, ignoreRedirectRoutes)=>{
44
+ const shouldIgnoreRedirect = (pathname, urlPath, ignoreRedirectRoutes, urlStrategy, languages = [])=>{
45
45
  const remainingPath = stripUrlPathPrefix(pathname, urlPath);
46
- return (0, i18n_runtime_extensions_namespaceObject.shouldSkipLocaleRedirect)(remainingPath, [], ignoreRedirectRoutes);
46
+ if ((0, mappedUrlStrategy_js_namespaceObject.isDefaultLocaleRedirectSkipPath)(remainingPath, languages)) return true;
47
+ if ((0, urlStrategy_js_namespaceObject.asI18nUrlStrategy)(urlStrategy)?.shouldSkipRedirect?.(remainingPath, languages)) return true;
48
+ if (!ignoreRedirectRoutes) return false;
49
+ const segments = remainingPath.split('/').filter(Boolean);
50
+ if (segments[0] && languages.some((language)=>language.toLowerCase() === segments[0].toLowerCase())) segments.shift();
51
+ const normalizedPath = `/${segments.join('/')}`;
52
+ return 'function' == typeof ignoreRedirectRoutes ? ignoreRedirectRoutes(normalizedPath) : ignoreRedirectRoutes.some((pattern)=>normalizedPath === pattern || normalizedPath.startsWith(`${pattern}/`));
47
53
  };
48
54
  const isStaticResourceRequest = (pathname, staticRoutePrefixes, languages = [])=>{
49
- if ((0, i18n_runtime_extensions_namespaceObject.isDefaultLocaleRedirectSkipPath)(pathname, languages)) return true;
50
- const matchesStaticRoutePrefix = (targetPathname)=>staticRoutePrefixes.some((prefix)=>(0, i18n_runtime_extensions_namespaceObject.matchesPathPrefix)(targetPathname, prefix));
51
- if (matchesStaticRoutePrefix(pathname)) return true;
52
- const pathWithoutLanguage = (0, i18n_runtime_extensions_namespaceObject.stripLanguagePrefix)(pathname, languages);
53
- return pathWithoutLanguage !== pathname && matchesStaticRoutePrefix(pathWithoutLanguage);
55
+ const prefixes = [
56
+ ...staticRoutePrefixes,
57
+ '/static',
58
+ '/upload'
59
+ ];
60
+ const matches = (target)=>prefixes.some((prefix)=>target === prefix || target.startsWith(`${prefix}/`));
61
+ if (matches(pathname)) return true;
62
+ const segments = pathname.split('/').filter(Boolean);
63
+ if (segments[0] && languages.some((language)=>language.toLowerCase() === segments[0].toLowerCase())) return matches(`/${segments.slice(1).join('/')}`);
64
+ return false;
54
65
  };
55
66
  const getLanguageFromPath = (req, urlPath, languages)=>{
56
- const url = new URL(req.url, `http://${req.header().host}`);
57
- const pathname = url.pathname;
58
- const remainingPath = stripUrlPathPrefix(pathname, urlPath);
59
- const segments = remainingPath.split('/').filter(Boolean);
60
- const firstSegment = segments[0];
61
- if (languages.includes(firstSegment)) return firstSegment;
62
- return null;
67
+ const host = req.header?.().host;
68
+ const url = new URL(req.url, host ? `http://${host}` : void 0);
69
+ const firstSegment = stripUrlPathPrefix(url.pathname, urlPath).split('/').filter(Boolean)[0];
70
+ return languages.find((language)=>language.toLowerCase() === firstSegment?.toLowerCase()) ?? null;
63
71
  };
64
- const buildLocalizedUrl = (req, urlPath, language, languages, localisedUrls)=>{
72
+ const buildLocalizedUrl = (req, urlPath, language, languages, urlStrategy)=>{
65
73
  const url = new URL(req.url);
66
- const pathname = url.pathname;
67
74
  const basePath = urlPath.replace('/*', '');
68
- const remainingPath = stripUrlPathPrefix(pathname, urlPath);
69
- const newPathname = (0, i18n_runtime_extensions_namespaceObject.localiseTargetPathname)(remainingPath, language, languages, localisedUrls);
70
- const suffix = `${url.search}${url.hash}`;
71
- const localizedUrl = '/' === basePath ? newPathname + suffix : basePath + newPathname + suffix;
72
- return localizedUrl;
75
+ const remainingPath = stripUrlPathPrefix(url.pathname, urlPath);
76
+ const segments = remainingPath.split('/').filter(Boolean);
77
+ if (segments[0] && languages.some((item)=>item.toLowerCase() === segments[0].toLowerCase())) segments[0] = language;
78
+ else segments.unshift(language);
79
+ const strategy = (0, urlStrategy_js_namespaceObject.asI18nUrlStrategy)(urlStrategy);
80
+ const pathname = strategy ? strategy.localizePathname(remainingPath, language, languages) : `/${segments.join('/')}`;
81
+ return `${'/' === basePath ? '' : basePath}${pathname}${url.search}${url.hash}`;
73
82
  };
74
83
  const createLocaleRedirectResponse = (location)=>new Response(null, {
75
84
  status: 302,
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ __webpack_require__.d(__webpack_exports__, {
31
+ createMappedUrlStrategy: ()=>createMappedUrlStrategy,
32
+ isDefaultLocaleRedirectSkipPath: ()=>i18n_runtime_extensions_namespaceObject.isDefaultLocaleRedirectSkipPath,
33
+ resolveMappedUrlStrategy: ()=>resolveMappedUrlStrategy
34
+ });
35
+ const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
36
+ const createMappedUrlStrategy = (localisedUrls)=>({
37
+ localizePathname: (pathname, language, languages)=>(0, i18n_runtime_extensions_namespaceObject.localiseTargetPathname)(pathname, language, [
38
+ ...languages
39
+ ], localisedUrls),
40
+ canonicalPathname: (pathname, languages)=>(0, i18n_runtime_extensions_namespaceObject.canonicalTargetPathname)(pathname, [
41
+ ...languages
42
+ ], localisedUrls),
43
+ shouldSkipRedirect: (pathname, languages)=>(0, i18n_runtime_extensions_namespaceObject.isDefaultLocaleRedirectSkipPath)(pathname, [
44
+ ...languages
45
+ ])
46
+ });
47
+ const resolveMappedUrlStrategy = (localeDetection)=>{
48
+ if (!localeDetection || 'object' != typeof localeDetection) return;
49
+ const localisedUrls = Reflect.get(localeDetection, 'localisedUrls');
50
+ if (!localisedUrls || 'object' != typeof localisedUrls || 0 === Object.keys(localisedUrls).length) return;
51
+ return createMappedUrlStrategy(localisedUrls);
52
+ };
53
+ exports.createMappedUrlStrategy = __webpack_exports__.createMappedUrlStrategy;
54
+ exports.isDefaultLocaleRedirectSkipPath = __webpack_exports__.isDefaultLocaleRedirectSkipPath;
55
+ exports.resolveMappedUrlStrategy = __webpack_exports__.resolveMappedUrlStrategy;
56
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
57
+ "createMappedUrlStrategy",
58
+ "isDefaultLocaleRedirectSkipPath",
59
+ "resolveMappedUrlStrategy"
60
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
61
+ Object.defineProperty(exports, '__esModule', {
62
+ value: true
63
+ });