@bleedingdev/modern-js-i18n-runtime-extensions 3.9.0-ultramodern.11 → 3.9.0-ultramodern.13
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/cjs/index.js +10 -10
- package/dist/cjs/localeRedirectPolicy.js +6 -6
- package/dist/cjs/paths.js +3 -3
- package/dist/cjs/router-navigation/adapter.js +24 -166
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/localeRedirectPolicy.mjs +1 -1
- package/dist/esm/paths.mjs +1 -1
- package/dist/esm/router-navigation/adapter.mjs +26 -168
- package/dist/esm-node/index.mjs +1 -1
- package/dist/esm-node/localeRedirectPolicy.mjs +1 -1
- package/dist/esm-node/paths.mjs +1 -1
- package/dist/esm-node/router-navigation/adapter.mjs +26 -168
- package/dist/types/index.d.ts +1 -1
- package/dist/types/localeRedirectPolicy.d.ts +1 -1
- package/dist/types/paths.d.ts +1 -1
- package/dist/types/router-navigation/adapter.d.ts +7 -55
- package/package.json +9 -9
- package/src/index.ts +1 -1
- package/src/localeRedirectPolicy.ts +2 -2
- package/src/paths.ts +2 -2
- package/src/router-navigation/adapter.tsx +62 -478
- package/tests/routerNavigation.test.tsx +80 -0
- package/dist/cjs/localisedUrls/config.js +0 -49
- package/dist/cjs/localisedUrls/index.js +0 -98
- package/dist/cjs/localisedUrls/normalise.js +0 -87
- package/dist/cjs/localisedUrls/pathname.js +0 -68
- package/dist/cjs/localisedUrls/patterns.js +0 -214
- package/dist/cjs/localisedUrls/redirect.js +0 -100
- package/dist/cjs/localisedUrls/resolve.js +0 -78
- package/dist/cjs/localisedUrls/routeIdentity.js +0 -118
- package/dist/cjs/localisedUrls/routes.js +0 -210
- package/dist/cjs/localisedUrls/types.js +0 -18
- package/dist/esm/localisedUrls/config.mjs +0 -11
- package/dist/esm/localisedUrls/index.mjs +0 -8
- package/dist/esm/localisedUrls/normalise.mjs +0 -37
- package/dist/esm/localisedUrls/pathname.mjs +0 -24
- package/dist/esm/localisedUrls/patterns.mjs +0 -152
- package/dist/esm/localisedUrls/redirect.mjs +0 -53
- package/dist/esm/localisedUrls/resolve.mjs +0 -37
- package/dist/esm/localisedUrls/routeIdentity.mjs +0 -77
- package/dist/esm/localisedUrls/routes.mjs +0 -169
- package/dist/esm/localisedUrls/types.mjs +0 -0
- package/dist/esm-node/localisedUrls/config.mjs +0 -12
- package/dist/esm-node/localisedUrls/index.mjs +0 -9
- package/dist/esm-node/localisedUrls/normalise.mjs +0 -38
- package/dist/esm-node/localisedUrls/pathname.mjs +0 -25
- package/dist/esm-node/localisedUrls/patterns.mjs +0 -153
- package/dist/esm-node/localisedUrls/redirect.mjs +0 -54
- package/dist/esm-node/localisedUrls/resolve.mjs +0 -38
- package/dist/esm-node/localisedUrls/routeIdentity.mjs +0 -78
- package/dist/esm-node/localisedUrls/routes.mjs +0 -170
- package/dist/esm-node/localisedUrls/types.mjs +0 -1
- package/dist/types/localisedUrls/config.d.ts +0 -9
- package/dist/types/localisedUrls/index.d.ts +0 -10
- package/dist/types/localisedUrls/normalise.d.ts +0 -10
- package/dist/types/localisedUrls/pathname.d.ts +0 -4
- package/dist/types/localisedUrls/patterns.d.ts +0 -11
- package/dist/types/localisedUrls/redirect.d.ts +0 -19
- package/dist/types/localisedUrls/resolve.d.ts +0 -7
- package/dist/types/localisedUrls/routeIdentity.d.ts +0 -24
- package/dist/types/localisedUrls/routes.d.ts +0 -3
- package/dist/types/localisedUrls/types.d.ts +0 -14
- package/src/localisedUrls/config.ts +0 -18
- package/src/localisedUrls/index.ts +0 -28
- package/src/localisedUrls/normalise.ts +0 -62
- package/src/localisedUrls/pathname.ts +0 -60
- package/src/localisedUrls/patterns.ts +0 -283
- package/src/localisedUrls/redirect.ts +0 -107
- package/src/localisedUrls/resolve.ts +0 -106
- package/src/localisedUrls/routeIdentity.ts +0 -107
- package/src/localisedUrls/routes.ts +0 -432
- package/src/localisedUrls/types.ts +0 -18
- package/tests/localisedUrls.test.ts +0 -532
|
@@ -1,192 +1,50 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import {
|
|
3
|
-
import { RuntimeContext
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { RuntimeContext } from "@modern-js/runtime";
|
|
4
4
|
import { InternalRuntimeContext } from "@modern-js/runtime/context";
|
|
5
5
|
import { getRouterRuntimeState, subscribeRouterRuntimeState } from "@modern-js/runtime-extensions/router-state";
|
|
6
6
|
import { useCallback, useContext, useSyncExternalStore } from "react";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
return value.startsWith(prefix) ? value : `${prefix}${value}`;
|
|
10
|
-
};
|
|
11
|
-
const normalizeLocation = (location)=>{
|
|
12
|
-
if (!location || 'object' != typeof location) return null;
|
|
13
|
-
const locationValue = location;
|
|
14
|
-
if ('string' != typeof locationValue.pathname) return null;
|
|
15
|
-
return {
|
|
16
|
-
pathname: locationValue.pathname,
|
|
17
|
-
search: normalizeUrlPart('string' == typeof locationValue.search ? locationValue.search : locationValue.searchStr, '?'),
|
|
18
|
-
hash: normalizeUrlPart(locationValue.hash, '#')
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
const getWindowLocation = ()=>{
|
|
22
|
-
if (!isBrowser()) return null;
|
|
23
|
-
return {
|
|
24
|
-
pathname: window.location.pathname,
|
|
25
|
-
search: window.location.search,
|
|
26
|
-
hash: window.location.hash
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const getRouterFramework = (runtimeContext, internalContext, inReactRouter)=>{
|
|
30
|
-
const framework = getRouterRuntimeState(internalContext)?.framework || getRouterRuntimeState(runtimeContext)?.framework;
|
|
31
|
-
if (framework) return framework;
|
|
32
|
-
if (internalContext.router?.useRouter || runtimeContext.router?.useRouter) return 'tanstack';
|
|
33
|
-
if (internalContext.router?.useLocation || internalContext.router?.useHref || runtimeContext.router?.useLocation || runtimeContext.router?.useHref) return 'react-router';
|
|
34
|
-
if (inReactRouter) return 'react-router';
|
|
35
|
-
};
|
|
36
|
-
const getRouterInstance = (internalContext, contextRouter)=>{
|
|
37
|
-
if (contextRouter) return contextRouter;
|
|
38
|
-
const router = getRouterRuntimeState(internalContext)?.instance;
|
|
39
|
-
if (!router || 'object' != typeof router) return null;
|
|
40
|
-
return router;
|
|
41
|
-
};
|
|
42
|
-
const getRouterStateLocation = (internalContext, contextRouter)=>{
|
|
43
|
-
const router = getRouterInstance(internalContext, contextRouter);
|
|
44
|
-
return normalizeLocation(router?.stores?.location?.get?.()) || normalizeLocation(router?.state?.location);
|
|
45
|
-
};
|
|
46
|
-
const getRouterParams = (internalContext, contextRouter)=>{
|
|
47
|
-
const router = getRouterInstance(internalContext, contextRouter);
|
|
48
|
-
const matches = router?.stores?.matches?.get?.() || router?.state?.matches;
|
|
49
|
-
if (!Array.isArray(matches)) return {};
|
|
50
|
-
return matches.reduce((params, match)=>{
|
|
51
|
-
if (match?.params) Object.assign(params, match.params);
|
|
52
|
-
return params;
|
|
53
|
-
}, {});
|
|
54
|
-
};
|
|
55
|
-
const getRouterSnapshot = (internalContext, contextRouter)=>{
|
|
56
|
-
const location = getRouterStateLocation(internalContext, contextRouter);
|
|
57
|
-
const params = getRouterParams(internalContext, contextRouter);
|
|
58
|
-
return JSON.stringify([
|
|
59
|
-
location?.pathname ?? '',
|
|
60
|
-
location?.search ?? '',
|
|
61
|
-
location?.hash ?? '',
|
|
62
|
-
Object.entries(params).sort(([left], [right])=>left.localeCompare(right))
|
|
63
|
-
]);
|
|
64
|
-
};
|
|
7
|
+
const subscribeNone = ()=>()=>{};
|
|
8
|
+
const getEmptySnapshot = ()=>null;
|
|
65
9
|
const createI18nRouterNavigation = ({ I18nNavigationProvider, useNativeI18nRouterAdapter })=>{
|
|
10
|
+
const NavigationProvider = I18nNavigationProvider;
|
|
66
11
|
const useIntegratedRouterAdapter = ()=>{
|
|
67
12
|
const runtimeContext = useContext(RuntimeContext);
|
|
68
13
|
const internalContext = useContext(InternalRuntimeContext);
|
|
69
|
-
const routerApi = internalContext.router || runtimeContext.router;
|
|
70
14
|
const native = useNativeI18nRouterAdapter();
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
warn: false
|
|
79
|
-
}) : null;
|
|
80
|
-
const slotRouter = getRouterInstance(internalContext, contextRouter);
|
|
81
|
-
const drivableSlotRouter = ('tanstack' === framework || 'react-router' === framework) && 'function' == typeof slotRouter?.navigate;
|
|
82
|
-
const hasRouter = Boolean(reactRouterNavigate) || drivableSlotRouter;
|
|
83
|
-
const subscribeToRouter = useCallback((update)=>{
|
|
84
|
-
const unsubscribers = [];
|
|
85
|
-
const unsubscribeFromSlot = subscribeRouterRuntimeState(internalContext, update);
|
|
86
|
-
if ('function' == typeof unsubscribeFromSlot) unsubscribers.push(unsubscribeFromSlot);
|
|
87
|
-
const router = getRouterInstance(internalContext, contextRouter);
|
|
88
|
-
if (!router) return ()=>{
|
|
89
|
-
for (const unsubscribe of unsubscribers)unsubscribe();
|
|
90
|
-
};
|
|
91
|
-
if ('react-router' === framework && !inReactRouter && 'function' == typeof router.subscribe) {
|
|
92
|
-
const subscribe = router.subscribe;
|
|
93
|
-
const unsubscribe = subscribe.call(router, update);
|
|
94
|
-
if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
|
|
95
|
-
}
|
|
96
|
-
if ('tanstack' === framework && 'function' == typeof router.stores?.location?.subscribe) {
|
|
97
|
-
const unsubscribe = router.stores.location.subscribe(update);
|
|
98
|
-
if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
|
|
99
|
-
}
|
|
100
|
-
if ('tanstack' === framework && 'function' == typeof router.subscribe) {
|
|
101
|
-
const subscribe = router.subscribe;
|
|
102
|
-
for (const eventType of [
|
|
103
|
-
'onBeforeNavigate',
|
|
104
|
-
'onBeforeLoad'
|
|
105
|
-
]){
|
|
106
|
-
const unsubscribe = subscribe.call(router, eventType, update);
|
|
107
|
-
if ('function' == typeof unsubscribe) unsubscribers.push(unsubscribe);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
15
|
+
const getCapability = useCallback(()=>getRouterRuntimeState(internalContext)?.navigation ?? getRouterRuntimeState(runtimeContext)?.navigation, [
|
|
16
|
+
internalContext,
|
|
17
|
+
runtimeContext
|
|
18
|
+
]);
|
|
19
|
+
const subscribeCapability = useCallback((update)=>{
|
|
20
|
+
const stopInternal = subscribeRouterRuntimeState(internalContext, update);
|
|
21
|
+
const stopPublic = internalContext === runtimeContext ? void 0 : subscribeRouterRuntimeState(runtimeContext, update);
|
|
110
22
|
return ()=>{
|
|
111
|
-
|
|
23
|
+
stopInternal();
|
|
24
|
+
stopPublic?.();
|
|
112
25
|
};
|
|
113
26
|
}, [
|
|
114
|
-
contextRouter,
|
|
115
|
-
framework,
|
|
116
|
-
inReactRouter,
|
|
117
|
-
internalContext
|
|
118
|
-
]);
|
|
119
|
-
const getSnapshot = useCallback(()=>getRouterSnapshot(internalContext, contextRouter), [
|
|
120
|
-
contextRouter,
|
|
121
|
-
internalContext
|
|
122
|
-
]);
|
|
123
|
-
useSyncExternalStore(subscribeToRouter, getSnapshot, getSnapshot);
|
|
124
|
-
const navigate = useCallback((href, options)=>{
|
|
125
|
-
const router = getRouterInstance(internalContext, contextRouter);
|
|
126
|
-
const activeFramework = getRouterFramework(runtimeContext, internalContext, inReactRouter);
|
|
127
|
-
if ('tanstack' === activeFramework) {
|
|
128
|
-
if ('function' == typeof router?.navigate) return router.navigate({
|
|
129
|
-
to: href,
|
|
130
|
-
replace: options?.replace,
|
|
131
|
-
...options?.state === void 0 ? {} : {
|
|
132
|
-
state: options.state
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
throw new Error('TanStack router instance is not available.');
|
|
136
|
-
}
|
|
137
|
-
if (reactRouterNavigate) return reactRouterNavigate(href, options);
|
|
138
|
-
if ('react-router' === activeFramework) {
|
|
139
|
-
if ('function' == typeof router?.navigate) return router.navigate(href, options);
|
|
140
|
-
throw new Error('React Router instance is not available.');
|
|
141
|
-
}
|
|
142
|
-
}, [
|
|
143
|
-
contextRouter,
|
|
144
27
|
internalContext,
|
|
145
|
-
inReactRouter,
|
|
146
|
-
reactRouterNavigate,
|
|
147
28
|
runtimeContext
|
|
148
29
|
]);
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
framework,
|
|
154
|
-
hasRouter,
|
|
155
|
-
location,
|
|
156
|
-
navigate: hasRouter ? navigate : null,
|
|
157
|
-
Link,
|
|
158
|
-
params,
|
|
159
|
-
...'tanstack' === framework ? {
|
|
160
|
-
createLinkProps: createTanstackLinkProps
|
|
161
|
-
} : {}
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
const createTanstackLinkProps = (target)=>{
|
|
165
|
-
const preload = void 0 !== target.preload ? target.preload : 'none' === target.prefetch ? false : target.prefetch;
|
|
30
|
+
const capability = useSyncExternalStore(subscribeCapability, getCapability, getCapability);
|
|
31
|
+
const snapshot = useSyncExternalStore(capability?.subscribe ?? subscribeNone, capability?.getSnapshot ?? getEmptySnapshot, capability?.getSnapshot ?? getEmptySnapshot);
|
|
32
|
+
if (native.hasRouter || !capability || !snapshot) return native;
|
|
33
|
+
const internalState = getRouterRuntimeState(internalContext);
|
|
166
34
|
return {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
} : {},
|
|
174
|
-
...void 0 === target.hashScrollIntoView ? {} : {
|
|
175
|
-
hashScrollIntoView: target.hashScrollIntoView
|
|
176
|
-
},
|
|
177
|
-
...void 0 === preload ? {} : {
|
|
178
|
-
preload
|
|
179
|
-
}
|
|
35
|
+
framework: internalState?.navigation === capability ? internalState.framework : getRouterRuntimeState(runtimeContext)?.framework,
|
|
36
|
+
hasRouter: true,
|
|
37
|
+
...snapshot,
|
|
38
|
+
navigate: capability.navigate,
|
|
39
|
+
Link: capability.Link,
|
|
40
|
+
createLinkProps: capability.createLinkProps
|
|
180
41
|
};
|
|
181
42
|
};
|
|
182
43
|
const I18nRouterNavigationProvider = ({ children })=>{
|
|
183
44
|
const value = useIntegratedRouterAdapter();
|
|
184
45
|
const native = useNativeI18nRouterAdapter();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
return /*#__PURE__*/ jsx(I18nNavigationProvider, {
|
|
189
|
-
value: value,
|
|
46
|
+
return /*#__PURE__*/ jsx(NavigationProvider, {
|
|
47
|
+
value: value.hasRouter && !native.hasRouter ? value : null,
|
|
190
48
|
children: children
|
|
191
49
|
});
|
|
192
50
|
};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/paths.d.ts
CHANGED
|
@@ -1,70 +1,22 @@
|
|
|
1
|
+
import { type RouterLinkTarget, type RouterNavigationCapability, type RouterNavigationSnapshot } from '@modern-js/runtime-extensions/router-state';
|
|
1
2
|
import type React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Fork-owned: the selected-router navigation adapter.
|
|
4
|
-
*
|
|
5
|
-
* `useNativeI18nRouterAdapter` only knows react-router's own hooks, so a bare
|
|
6
|
-
* `appTools() + i18nPlugin()` app running the TanStack router would fall back
|
|
7
|
-
* to plain `<a>` links and a non-reactive `window.location`. That breaks
|
|
8
|
-
* language-invariant active state and, worse, leaves the i18n language stuck
|
|
9
|
-
* after a client-side navigation to a localized URL.
|
|
10
|
-
*
|
|
11
|
-
* The subsystem lives in this fork-owned package rather than inside
|
|
12
|
-
* upstream-owned `@modern-js/plugin-i18n`: that package only wires it in
|
|
13
|
-
* through its existing `NavigationProvider` extension point, so the upstream
|
|
14
|
-
* package keeps a seam instead of gaining a fork subsystem. The primitives the
|
|
15
|
-
* adapter composes with - the navigation context provider, the native
|
|
16
|
-
* react-router adapter and the adapter shape - are injected by that seam, so
|
|
17
|
-
* nothing here imports `@modern-js/plugin-i18n` and no dependency cycle is
|
|
18
|
-
* created.
|
|
19
|
-
*
|
|
20
|
-
* The adapter reads the actual selected router out of the fork-owned router
|
|
21
|
-
* runtime-state slot, so it serves both routers without either plugin having
|
|
22
|
-
* to know about i18n.
|
|
23
|
-
*/
|
|
24
|
-
/** The primitives the host plugin injects; see `createI18nRouterNavigation`. */
|
|
25
3
|
export interface I18nRouterNavigationDependencies<Adapter extends I18nRouterAdapterShape> {
|
|
26
4
|
I18nNavigationProvider: React.ComponentType<React.PropsWithChildren<{
|
|
27
5
|
value: Adapter;
|
|
28
6
|
}>>;
|
|
29
7
|
useNativeI18nRouterAdapter: () => Adapter;
|
|
30
8
|
}
|
|
31
|
-
export
|
|
32
|
-
pathname: string;
|
|
33
|
-
href: string;
|
|
34
|
-
search?: Record<string, unknown>;
|
|
35
|
-
hash?: string;
|
|
36
|
-
hashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
37
|
-
prefetch?: 'intent' | 'render' | 'viewport' | 'none';
|
|
38
|
-
preload?: unknown;
|
|
39
|
-
}
|
|
9
|
+
export type I18nRouterLinkTarget = RouterLinkTarget;
|
|
40
10
|
export interface I18nRouterAdapterShape {
|
|
41
11
|
framework?: string;
|
|
42
12
|
hasRouter: boolean;
|
|
43
|
-
location:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
hash: string;
|
|
47
|
-
} | null;
|
|
48
|
-
navigate: ((href: string, options?: {
|
|
49
|
-
replace?: boolean;
|
|
50
|
-
state?: unknown;
|
|
51
|
-
}) => void | Promise<void>) | null;
|
|
52
|
-
Link: React.ComponentType<{
|
|
53
|
-
to: string;
|
|
54
|
-
children?: React.ReactNode;
|
|
55
|
-
[key: string]: unknown;
|
|
56
|
-
}> | null;
|
|
13
|
+
location: RouterNavigationSnapshot['location'] | null;
|
|
14
|
+
navigate: RouterNavigationCapability['navigate'] | null;
|
|
15
|
+
Link: RouterNavigationCapability['Link'] | null;
|
|
57
16
|
params: Record<string, string>;
|
|
58
|
-
createLinkProps?:
|
|
59
|
-
to: string;
|
|
60
|
-
[key: string]: unknown;
|
|
61
|
-
};
|
|
17
|
+
createLinkProps?: RouterNavigationCapability['createLinkProps'];
|
|
62
18
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Build the selected-router navigation hook and provider from the host
|
|
65
|
-
* plugin's own primitives. Injecting them is what keeps this fork-owned
|
|
66
|
-
* subsystem free of any import edge back into the plugin that installs it.
|
|
67
|
-
*/
|
|
19
|
+
/** The router provider owns navigation; this seam only observes its capability. */
|
|
68
20
|
export declare const createI18nRouterNavigation: <Adapter extends I18nRouterAdapterShape>({ I18nNavigationProvider, useNativeI18nRouterAdapter, }: I18nRouterNavigationDependencies<Adapter>) => {
|
|
69
21
|
useIntegratedRouterAdapter: () => Adapter;
|
|
70
22
|
I18nRouterNavigationProvider: ({ children, }: React.PropsWithChildren) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern.js",
|
|
18
18
|
"i18n"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.0-ultramodern.
|
|
20
|
+
"version": "3.9.0-ultramodern.13",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"module": "./dist/esm/index.mjs",
|
|
@@ -66,22 +66,22 @@
|
|
|
66
66
|
"node": ">=26.7.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
70
|
-
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.
|
|
69
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.13",
|
|
70
|
+
"@modern-js/runtime-utils": "npm:@bleedingdev/modern-js-runtime-utils@3.9.0-ultramodern.13",
|
|
71
71
|
"i18next-browser-languagedetector": "^8.2.1"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@modern-js/runtime": "3.9.0-ultramodern.
|
|
74
|
+
"@modern-js/runtime": "3.9.0-ultramodern.13",
|
|
75
75
|
"react": "^19.2.8"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.
|
|
79
|
-
"@rslib/core": "1.0.
|
|
78
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.13",
|
|
79
|
+
"@rslib/core": "1.0.2",
|
|
80
80
|
"@scripts/rstest-config": "2.66.0",
|
|
81
|
-
"@types/node": "^26.
|
|
81
|
+
"@types/node": "^26.6.2",
|
|
82
82
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
83
|
-
"react": "^19.
|
|
84
|
-
"react-dom": "^19.
|
|
83
|
+
"react": "^19.3.0",
|
|
84
|
+
"react-dom": "^19.3.0"
|
|
85
85
|
},
|
|
86
86
|
"sideEffects": false,
|
|
87
87
|
"publishConfig": {
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { LocalisedUrlsOption } from '
|
|
1
|
+
import type { LocalisedUrlsOption } from '@modern-js/runtime-extensions/localised-urls';
|
|
2
2
|
import {
|
|
3
3
|
isDefaultLocaleRedirectSkipPath,
|
|
4
4
|
localiseTargetPathname,
|
|
5
5
|
matchesPathPrefix,
|
|
6
6
|
shouldSkipLocaleRedirect,
|
|
7
7
|
stripLanguagePrefix,
|
|
8
|
-
} from '
|
|
8
|
+
} from '@modern-js/runtime-extensions/localised-urls';
|
|
9
9
|
|
|
10
10
|
interface LocaleRedirectRequest {
|
|
11
11
|
url: string;
|
package/src/paths.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { splitUrlTarget } from '@modern-js/runtime-utils/url';
|
|
2
1
|
import {
|
|
3
2
|
canonicalTargetPathname,
|
|
4
3
|
type LocalisedUrlsOption,
|
|
5
4
|
localiseTargetPathname,
|
|
6
|
-
} from '
|
|
5
|
+
} from '@modern-js/runtime-extensions/localised-urls';
|
|
6
|
+
import { splitUrlTarget } from '@modern-js/runtime-utils/url';
|
|
7
7
|
|
|
8
8
|
export interface LocalizedPathsConfig {
|
|
9
9
|
languages: string[];
|