@bleedingdev/modern-js-i18n-integration 3.9.0-ultramodern.8 → 3.9.3-ultramodern.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/dist/cjs/cli.js +5 -31
- package/dist/cjs/runtimeComposition.js +2 -2
- package/dist/esm/cli.mjs +0 -26
- package/dist/esm/runtimeComposition.mjs +1 -1
- package/dist/esm-node/cli.mjs +0 -26
- package/dist/esm-node/runtimeComposition.mjs +1 -1
- package/dist/types/federation/registration.d.ts +1 -1
- package/dist/types/options.d.ts +0 -4
- package/dist/types/runtimeComposition.d.ts +1 -1
- package/package.json +27 -37
- package/src/cli.ts +7 -44
- package/src/federation/registration.ts +3 -1
- package/src/options.ts +0 -5
- package/src/runtimeComposition.ts +4 -2
- package/dist/cjs/navigation.js +0 -220
- package/dist/cjs/server.js +0 -50
- package/dist/esm/navigation.mjs +0 -182
- package/dist/esm/server.mjs +0 -10
- package/dist/esm-node/navigation.mjs +0 -183
- package/dist/esm-node/server.mjs +0 -11
- package/dist/types/navigation.d.ts +0 -3
- package/dist/types/server.d.ts +0 -3
- package/src/navigation.tsx +0 -399
- package/src/server.ts +0 -27
package/dist/cjs/cli.js
CHANGED
|
@@ -27,11 +27,6 @@ var __webpack_require__ = {};
|
|
|
27
27
|
})();
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
default: ()=>cli,
|
|
32
|
-
ultramodernI18nIntegrationPlugin: ()=>ultramodernI18nIntegrationPlugin
|
|
33
|
-
});
|
|
34
|
-
const i18n_runtime_extensions_namespaceObject = require("@modern-js/i18n-runtime-extensions");
|
|
35
30
|
const runtimePaths = new Map([
|
|
36
31
|
[
|
|
37
32
|
'@modern-js/plugin-i18n/runtime',
|
|
@@ -42,7 +37,6 @@ const runtimePaths = new Map([
|
|
|
42
37
|
'@modern-js/i18n-integration/runtime/no-react-i18next'
|
|
43
38
|
]
|
|
44
39
|
]);
|
|
45
|
-
const integrationRuntimePaths = new Set(runtimePaths.values());
|
|
46
40
|
const ultramodernI18nIntegrationPlugin = ()=>({
|
|
47
41
|
name: '@modern-js/i18n-integration',
|
|
48
42
|
pre: [
|
|
@@ -59,33 +53,13 @@ const ultramodernI18nIntegrationPlugin = ()=>({
|
|
|
59
53
|
} : plugin;
|
|
60
54
|
})
|
|
61
55
|
}));
|
|
62
|
-
api._internalServerPlugins(({ plugins })=>({
|
|
63
|
-
plugins: plugins.map((plugin)=>'@modern-js/plugin-i18n/server' === plugin.name ? {
|
|
64
|
-
...plugin,
|
|
65
|
-
name: '@modern-js/i18n-integration/server'
|
|
66
|
-
} : plugin)
|
|
67
|
-
}));
|
|
68
|
-
api.modifyFileSystemRoutes(async ({ entrypoint, routes })=>{
|
|
69
|
-
const { plugins } = await api.getHooks()._internalRuntimePlugins.call({
|
|
70
|
-
entrypoint,
|
|
71
|
-
plugins: []
|
|
72
|
-
});
|
|
73
|
-
const descriptor = plugins.find((plugin)=>integrationRuntimePaths.has(plugin.path));
|
|
74
|
-
const config = descriptor?.config;
|
|
75
|
-
const { localePathRedirect, languages = [], localisedUrls } = config?.localeDetection ?? {};
|
|
76
|
-
const resolved = (0, i18n_runtime_extensions_namespaceObject.resolveLocalisedUrlsConfig)(localisedUrls);
|
|
77
|
-
if (!localePathRedirect || !languages.length || !resolved.enabled) return {
|
|
78
|
-
entrypoint,
|
|
79
|
-
routes
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
entrypoint,
|
|
83
|
-
routes: (0, i18n_runtime_extensions_namespaceObject.applyLocalisedUrlsToRoutes)(routes, languages, resolved.map)
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
56
|
}
|
|
87
57
|
});
|
|
88
|
-
const
|
|
58
|
+
const __rspack_default_export = ultramodernI18nIntegrationPlugin;
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
60
|
+
default: __rspack_default_export,
|
|
61
|
+
ultramodernI18nIntegrationPlugin: ultramodernI18nIntegrationPlugin
|
|
62
|
+
});
|
|
89
63
|
exports["default"] = __webpack_exports__["default"];
|
|
90
64
|
exports.ultramodernI18nIntegrationPlugin = __webpack_exports__.ultramodernI18nIntegrationPlugin;
|
|
91
65
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -30,9 +30,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
31
|
composeI18nPlugin: ()=>composeI18nPlugin
|
|
32
32
|
});
|
|
33
|
+
const no_react_i18next_namespaceObject = require("@modern-js/plugin-i18n/runtime/no-react-i18next");
|
|
33
34
|
const registration_js_namespaceObject = require("./federation/registration.js");
|
|
34
35
|
const external_languageSynchronization_js_namespaceObject = require("./languageSynchronization.js");
|
|
35
|
-
const external_navigation_js_namespaceObject = require("./navigation.js");
|
|
36
36
|
const external_urlStrategy_js_namespaceObject = require("./urlStrategy.js");
|
|
37
37
|
const composeI18nPlugin = (nativeI18nPlugin)=>(options = {})=>{
|
|
38
38
|
const { localisedUrls, localeDetectionByEntry: _entryOptions, ...nativeLocaleDetection } = options.localeDetection ?? {};
|
|
@@ -40,7 +40,7 @@ const composeI18nPlugin = (nativeI18nPlugin)=>(options = {})=>{
|
|
|
40
40
|
...options,
|
|
41
41
|
localeDetection: nativeLocaleDetection,
|
|
42
42
|
urlStrategy: options.urlStrategy ?? (0, external_urlStrategy_js_namespaceObject.createI18nUrlStrategy)(localisedUrls),
|
|
43
|
-
NavigationProvider: options.NavigationProvider ??
|
|
43
|
+
NavigationProvider: options.NavigationProvider ?? no_react_i18next_namespaceObject.I18nRouterNavigationProvider,
|
|
44
44
|
LanguageSynchronization: options.LanguageSynchronization ?? external_languageSynchronization_js_namespaceObject.I18nLanguageSynchronization
|
|
45
45
|
});
|
|
46
46
|
return {
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { applyLocalisedUrlsToRoutes, resolveLocalisedUrlsConfig } from "@modern-js/i18n-runtime-extensions";
|
|
2
1
|
const runtimePaths = new Map([
|
|
3
2
|
[
|
|
4
3
|
'@modern-js/plugin-i18n/runtime',
|
|
@@ -9,7 +8,6 @@ const runtimePaths = new Map([
|
|
|
9
8
|
'@modern-js/i18n-integration/runtime/no-react-i18next'
|
|
10
9
|
]
|
|
11
10
|
]);
|
|
12
|
-
const integrationRuntimePaths = new Set(runtimePaths.values());
|
|
13
11
|
const ultramodernI18nIntegrationPlugin = ()=>({
|
|
14
12
|
name: '@modern-js/i18n-integration',
|
|
15
13
|
pre: [
|
|
@@ -26,30 +24,6 @@ const ultramodernI18nIntegrationPlugin = ()=>({
|
|
|
26
24
|
} : plugin;
|
|
27
25
|
})
|
|
28
26
|
}));
|
|
29
|
-
api._internalServerPlugins(({ plugins })=>({
|
|
30
|
-
plugins: plugins.map((plugin)=>'@modern-js/plugin-i18n/server' === plugin.name ? {
|
|
31
|
-
...plugin,
|
|
32
|
-
name: '@modern-js/i18n-integration/server'
|
|
33
|
-
} : plugin)
|
|
34
|
-
}));
|
|
35
|
-
api.modifyFileSystemRoutes(async ({ entrypoint, routes })=>{
|
|
36
|
-
const { plugins } = await api.getHooks()._internalRuntimePlugins.call({
|
|
37
|
-
entrypoint,
|
|
38
|
-
plugins: []
|
|
39
|
-
});
|
|
40
|
-
const descriptor = plugins.find((plugin)=>integrationRuntimePaths.has(plugin.path));
|
|
41
|
-
const config = descriptor?.config;
|
|
42
|
-
const { localePathRedirect, languages = [], localisedUrls } = config?.localeDetection ?? {};
|
|
43
|
-
const resolved = resolveLocalisedUrlsConfig(localisedUrls);
|
|
44
|
-
if (!localePathRedirect || !languages.length || !resolved.enabled) return {
|
|
45
|
-
entrypoint,
|
|
46
|
-
routes
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
entrypoint,
|
|
50
|
-
routes: applyLocalisedUrlsToRoutes(routes, languages, resolved.map)
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
27
|
}
|
|
54
28
|
});
|
|
55
29
|
const cli = ultramodernI18nIntegrationPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { I18nRouterNavigationProvider } from "@modern-js/plugin-i18n/runtime/no-react-i18next";
|
|
1
2
|
import { registerFederatedI18nBoundary } from "./federation/registration.mjs";
|
|
2
3
|
import { I18nLanguageSynchronization } from "./languageSynchronization.mjs";
|
|
3
|
-
import { I18nRouterNavigationProvider } from "./navigation.mjs";
|
|
4
4
|
import { createI18nUrlStrategy } from "./urlStrategy.mjs";
|
|
5
5
|
const composeI18nPlugin = (nativeI18nPlugin)=>(options = {})=>{
|
|
6
6
|
const { localisedUrls, localeDetectionByEntry: _entryOptions, ...nativeLocaleDetection } = options.localeDetection ?? {};
|
package/dist/esm-node/cli.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { applyLocalisedUrlsToRoutes, resolveLocalisedUrlsConfig } from "@modern-js/i18n-runtime-extensions";
|
|
3
2
|
const runtimePaths = new Map([
|
|
4
3
|
[
|
|
5
4
|
'@modern-js/plugin-i18n/runtime',
|
|
@@ -10,7 +9,6 @@ const runtimePaths = new Map([
|
|
|
10
9
|
'@modern-js/i18n-integration/runtime/no-react-i18next'
|
|
11
10
|
]
|
|
12
11
|
]);
|
|
13
|
-
const integrationRuntimePaths = new Set(runtimePaths.values());
|
|
14
12
|
const ultramodernI18nIntegrationPlugin = ()=>({
|
|
15
13
|
name: '@modern-js/i18n-integration',
|
|
16
14
|
pre: [
|
|
@@ -27,30 +25,6 @@ const ultramodernI18nIntegrationPlugin = ()=>({
|
|
|
27
25
|
} : plugin;
|
|
28
26
|
})
|
|
29
27
|
}));
|
|
30
|
-
api._internalServerPlugins(({ plugins })=>({
|
|
31
|
-
plugins: plugins.map((plugin)=>'@modern-js/plugin-i18n/server' === plugin.name ? {
|
|
32
|
-
...plugin,
|
|
33
|
-
name: '@modern-js/i18n-integration/server'
|
|
34
|
-
} : plugin)
|
|
35
|
-
}));
|
|
36
|
-
api.modifyFileSystemRoutes(async ({ entrypoint, routes })=>{
|
|
37
|
-
const { plugins } = await api.getHooks()._internalRuntimePlugins.call({
|
|
38
|
-
entrypoint,
|
|
39
|
-
plugins: []
|
|
40
|
-
});
|
|
41
|
-
const descriptor = plugins.find((plugin)=>integrationRuntimePaths.has(plugin.path));
|
|
42
|
-
const config = descriptor?.config;
|
|
43
|
-
const { localePathRedirect, languages = [], localisedUrls } = config?.localeDetection ?? {};
|
|
44
|
-
const resolved = resolveLocalisedUrlsConfig(localisedUrls);
|
|
45
|
-
if (!localePathRedirect || !languages.length || !resolved.enabled) return {
|
|
46
|
-
entrypoint,
|
|
47
|
-
routes
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
entrypoint,
|
|
51
|
-
routes: applyLocalisedUrlsToRoutes(routes, languages, resolved.map)
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
28
|
}
|
|
55
29
|
});
|
|
56
30
|
const cli = ultramodernI18nIntegrationPlugin;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { I18nRouterNavigationProvider } from "@modern-js/plugin-i18n/runtime/no-react-i18next";
|
|
2
3
|
import { registerFederatedI18nBoundary } from "./federation/registration.mjs";
|
|
3
4
|
import { I18nLanguageSynchronization } from "./languageSynchronization.mjs";
|
|
4
|
-
import { I18nRouterNavigationProvider } from "./navigation.mjs";
|
|
5
5
|
import { createI18nUrlStrategy } from "./urlStrategy.mjs";
|
|
6
6
|
const composeI18nPlugin = (nativeI18nPlugin)=>(options = {})=>{
|
|
7
7
|
const { localisedUrls, localeDetectionByEntry: _entryOptions, ...nativeLocaleDetection } = options.localeDetection ?? {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RuntimePluginAPI } from '@modern-js/plugin/runtime';
|
|
2
|
-
export declare function registerFederatedI18nBoundary(api: RuntimePluginAPI<{}>): void;
|
|
2
|
+
export declare function registerFederatedI18nBoundary(api: Pick<RuntimePluginAPI<{}>, 'resolveComponent'>): void;
|
package/dist/types/options.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LocalisedUrlsOption } from '@modern-js/i18n-runtime-extensions';
|
|
2
2
|
import type { I18nPluginOptions as NativeRuntimeOptions } from '@modern-js/plugin-i18n/runtime/no-react-i18next';
|
|
3
|
-
import type { I18nPluginOptions as NativeServerOptions } from '@modern-js/plugin-i18n/server';
|
|
4
3
|
export type IntegratedLocaleDetectionOptions = NonNullable<NativeRuntimeOptions['localeDetection']> & {
|
|
5
4
|
localisedUrls?: LocalisedUrlsOption;
|
|
6
5
|
localeDetectionByEntry?: Record<string, IntegratedLocaleDetectionOptions>;
|
|
@@ -8,6 +7,3 @@ export type IntegratedLocaleDetectionOptions = NonNullable<NativeRuntimeOptions[
|
|
|
8
7
|
export type I18nPluginOptions = NativeRuntimeOptions & {
|
|
9
8
|
localeDetection?: IntegratedLocaleDetectionOptions;
|
|
10
9
|
};
|
|
11
|
-
export type I18nServerPluginOptions = NativeServerOptions & {
|
|
12
|
-
localeDetection: IntegratedLocaleDetectionOptions;
|
|
13
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type I18nPluginOptions as NativeI18nPluginOptions } from '@modern-js/plugin-i18n/runtime/no-react-i18next';
|
|
2
2
|
import type { RuntimePlugin } from '@modern-js/runtime';
|
|
3
3
|
import type { I18nPluginOptions } from './options.js';
|
|
4
4
|
export declare const composeI18nPlugin: (nativeI18nPlugin: (options: NativeI18nPluginOptions) => RuntimePlugin) => (options?: I18nPluginOptions) => RuntimePlugin;
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-i18n-integration",
|
|
3
3
|
"description": "UltraModern.js localized routing and federated resource integration through native Modern.js i18n plugins.",
|
|
4
|
-
"homepage": "https://github.com/
|
|
4
|
+
"homepage": "https://github.com/ultramodernjs/ultramodern.js#readme",
|
|
5
5
|
"bugs": {
|
|
6
|
-
"url": "https://github.com/
|
|
6
|
+
"url": "https://github.com/ultramodernjs/ultramodern.js/issues"
|
|
7
7
|
},
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/ultramodernjs/ultramodern.js.git",
|
|
11
11
|
"directory": "packages/runtime/i18n-integration"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "3.9.
|
|
14
|
+
"version": "3.9.3-ultramodern.1",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src"
|
|
18
18
|
],
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=26.
|
|
20
|
+
"node": ">=26.10.0"
|
|
21
21
|
},
|
|
22
22
|
"types": "./dist/types/cli.d.ts",
|
|
23
23
|
"main": "./dist/cjs/cli.js",
|
|
@@ -54,14 +54,6 @@
|
|
|
54
54
|
},
|
|
55
55
|
"default": "./dist/esm/runtime-no-react-i18next.mjs"
|
|
56
56
|
},
|
|
57
|
-
"./server": {
|
|
58
|
-
"types": "./dist/types/server.d.ts",
|
|
59
|
-
"node": {
|
|
60
|
-
"import": "./dist/esm-node/server.mjs",
|
|
61
|
-
"require": "./dist/cjs/server.js"
|
|
62
|
-
},
|
|
63
|
-
"default": "./dist/cjs/server.js"
|
|
64
|
-
},
|
|
65
57
|
"./federation": {
|
|
66
58
|
"types": "./dist/types/federation/boundary.d.ts",
|
|
67
59
|
"node": {
|
|
@@ -94,9 +86,6 @@
|
|
|
94
86
|
"runtime/no-react-i18next": [
|
|
95
87
|
"./dist/types/runtime-no-react-i18next.d.ts"
|
|
96
88
|
],
|
|
97
|
-
"server": [
|
|
98
|
-
"./dist/types/server.d.ts"
|
|
99
|
-
],
|
|
100
89
|
"federation": [
|
|
101
90
|
"./dist/types/federation/boundary.d.ts"
|
|
102
91
|
],
|
|
@@ -106,37 +95,35 @@
|
|
|
106
95
|
}
|
|
107
96
|
},
|
|
108
97
|
"dependencies": {
|
|
109
|
-
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.
|
|
110
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.
|
|
111
|
-
"@modern-js/plugin-i18n": "npm:@bleedingdev/modern-js-plugin-i18n@3.9.
|
|
112
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.
|
|
113
|
-
"@modern-js/server-runtime": "npm:@bleedingdev/modern-js-server-runtime@3.9.0-ultramodern.8",
|
|
114
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.8"
|
|
98
|
+
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.3-ultramodern.1",
|
|
99
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.3-ultramodern.1",
|
|
100
|
+
"@modern-js/plugin-i18n": "npm:@bleedingdev/modern-js-plugin-i18n@3.9.3-ultramodern.1",
|
|
101
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.3-ultramodern.1"
|
|
115
102
|
},
|
|
116
103
|
"peerDependencies": {
|
|
117
|
-
"@modern-js/app-tools": "3.9.
|
|
118
|
-
"@modern-js/runtime": "3.9.
|
|
104
|
+
"@modern-js/app-tools": "3.9.3-ultramodern.1",
|
|
105
|
+
"@modern-js/runtime": "3.9.3-ultramodern.1",
|
|
119
106
|
"react": "^19.2.8"
|
|
120
107
|
},
|
|
121
108
|
"peerDependenciesMeta": {},
|
|
122
109
|
"optionalDependencies": {},
|
|
123
110
|
"devDependencies": {
|
|
124
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.
|
|
125
|
-
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.
|
|
126
|
-
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.
|
|
127
|
-
"@
|
|
128
|
-
"@
|
|
111
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.3-ultramodern.1",
|
|
112
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.3-ultramodern.1",
|
|
113
|
+
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.3-ultramodern.1",
|
|
114
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.3-ultramodern.1",
|
|
115
|
+
"@rslib/core": "1.0.3",
|
|
116
|
+
"@rstest/core": "0.12.3",
|
|
129
117
|
"@scripts/rstest-config": "2.66.0",
|
|
130
|
-
"@types/node": "^26.
|
|
131
|
-
"@types/react": "^19.
|
|
132
|
-
"@types/react-dom": "^19.
|
|
133
|
-
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
118
|
+
"@types/node": "^26.6.3",
|
|
119
|
+
"@types/react": "^19.3.0",
|
|
120
|
+
"@types/react-dom": "^19.3.0",
|
|
134
121
|
"esbuild": "^0.28.2",
|
|
135
122
|
"i18next": "26.4.2",
|
|
136
|
-
"react": "^19.
|
|
137
|
-
"react-dom": "^19.
|
|
138
|
-
"react-i18next": "17.0.
|
|
139
|
-
"typescript": "
|
|
123
|
+
"react": "^19.3.0",
|
|
124
|
+
"react-dom": "^19.3.0",
|
|
125
|
+
"react-i18next": "17.0.15",
|
|
126
|
+
"typescript": "7.0.2"
|
|
140
127
|
},
|
|
141
128
|
"sideEffects": false,
|
|
142
129
|
"publishConfig": {
|
|
@@ -146,5 +133,8 @@
|
|
|
146
133
|
"dev": "rslib build --watch",
|
|
147
134
|
"build": "rslib build",
|
|
148
135
|
"test": "rstest"
|
|
136
|
+
},
|
|
137
|
+
"ultramodern": {
|
|
138
|
+
"sourceName": "@modern-js/i18n-integration"
|
|
149
139
|
}
|
|
150
140
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
|
-
import {
|
|
3
|
-
applyLocalisedUrlsToRoutes,
|
|
4
|
-
resolveLocalisedUrlsConfig,
|
|
5
|
-
} from '@modern-js/i18n-runtime-extensions';
|
|
6
|
-
import type { NestedRouteForCli, PageRoute } from '@modern-js/types';
|
|
7
|
-
import type { I18nPluginOptions } from './options';
|
|
8
2
|
|
|
9
3
|
const runtimePaths = new Map([
|
|
10
4
|
['@modern-js/plugin-i18n/runtime', '@modern-js/i18n-integration/runtime'],
|
|
@@ -13,7 +7,6 @@ const runtimePaths = new Map([
|
|
|
13
7
|
'@modern-js/i18n-integration/runtime/no-react-i18next',
|
|
14
8
|
],
|
|
15
9
|
]);
|
|
16
|
-
const integrationRuntimePaths = new Set(runtimePaths.values());
|
|
17
10
|
|
|
18
11
|
/** Compose fork policy with the native plugin's own descriptor generation. */
|
|
19
12
|
export const ultramodernI18nIntegrationPlugin = (): CliPlugin<AppTools> => ({
|
|
@@ -28,44 +21,14 @@ export const ultramodernI18nIntegrationPlugin = (): CliPlugin<AppTools> => ({
|
|
|
28
21
|
}),
|
|
29
22
|
}));
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
plugin.name === '@modern-js/plugin-i18n/server'
|
|
34
|
-
? { ...plugin, name: '@modern-js/i18n-integration/server' }
|
|
35
|
-
: plugin,
|
|
36
|
-
),
|
|
37
|
-
}));
|
|
24
|
+
// The native server plugin derives its URL policy from
|
|
25
|
+
// `localeDetection.localisedUrls`, so its descriptor needs no replacement.
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
entrypoint,
|
|
45
|
-
plugins: [],
|
|
46
|
-
});
|
|
47
|
-
const descriptor = plugins.find(plugin =>
|
|
48
|
-
integrationRuntimePaths.has(plugin.path),
|
|
49
|
-
);
|
|
50
|
-
const config = descriptor?.config as I18nPluginOptions | undefined;
|
|
51
|
-
const {
|
|
52
|
-
localePathRedirect,
|
|
53
|
-
languages = [],
|
|
54
|
-
localisedUrls,
|
|
55
|
-
} = config?.localeDetection ?? {};
|
|
56
|
-
const resolved = resolveLocalisedUrlsConfig(localisedUrls);
|
|
57
|
-
if (!localePathRedirect || !languages.length || !resolved.enabled) {
|
|
58
|
-
return { entrypoint, routes };
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
entrypoint,
|
|
62
|
-
routes: applyLocalisedUrlsToRoutes(
|
|
63
|
-
routes as (NestedRouteForCli | PageRoute)[],
|
|
64
|
-
languages,
|
|
65
|
-
resolved.map,
|
|
66
|
-
) as (NestedRouteForCli | PageRoute)[],
|
|
67
|
-
};
|
|
68
|
-
});
|
|
27
|
+
// Localised route generation used to live here. It now ships in
|
|
28
|
+
// `@modern-js/plugin-i18n`'s own CLI plugin so a bare `appTools()`
|
|
29
|
+
// consumer gets it too; registering it in both places would expand the
|
|
30
|
+
// route tree twice. This plugin keeps only the fork's runtime-module
|
|
31
|
+
// swap, which is the part that genuinely needs the integration runtime.
|
|
69
32
|
},
|
|
70
33
|
});
|
|
71
34
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { RuntimePluginAPI } from '@modern-js/plugin/runtime';
|
|
2
2
|
import { FederatedI18nBoundary } from './boundary';
|
|
3
3
|
|
|
4
|
-
export function registerFederatedI18nBoundary(
|
|
4
|
+
export function registerFederatedI18nBoundary(
|
|
5
|
+
api: Pick<RuntimePluginAPI<{}>, 'resolveComponent'>,
|
|
6
|
+
): void {
|
|
5
7
|
api.resolveComponent((component, { name }) =>
|
|
6
8
|
name === 'i18n.FederatedI18nBoundary' ? FederatedI18nBoundary : component,
|
|
7
9
|
);
|
package/src/options.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LocalisedUrlsOption } from '@modern-js/i18n-runtime-extensions';
|
|
2
2
|
import type { I18nPluginOptions as NativeRuntimeOptions } from '@modern-js/plugin-i18n/runtime/no-react-i18next';
|
|
3
|
-
import type { I18nPluginOptions as NativeServerOptions } from '@modern-js/plugin-i18n/server';
|
|
4
3
|
|
|
5
4
|
export type IntegratedLocaleDetectionOptions = NonNullable<
|
|
6
5
|
NativeRuntimeOptions['localeDetection']
|
|
@@ -12,7 +11,3 @@ export type IntegratedLocaleDetectionOptions = NonNullable<
|
|
|
12
11
|
export type I18nPluginOptions = NativeRuntimeOptions & {
|
|
13
12
|
localeDetection?: IntegratedLocaleDetectionOptions;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
export type I18nServerPluginOptions = NativeServerOptions & {
|
|
17
|
-
localeDetection: IntegratedLocaleDetectionOptions;
|
|
18
|
-
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
I18nRouterNavigationProvider,
|
|
3
|
+
type I18nPluginOptions as NativeI18nPluginOptions,
|
|
4
|
+
} from '@modern-js/plugin-i18n/runtime/no-react-i18next';
|
|
2
5
|
import type { RuntimePlugin } from '@modern-js/runtime';
|
|
3
6
|
import { registerFederatedI18nBoundary } from './federation/registration';
|
|
4
7
|
import { I18nLanguageSynchronization } from './languageSynchronization';
|
|
5
|
-
import { I18nRouterNavigationProvider } from './navigation';
|
|
6
8
|
import type { I18nPluginOptions } from './options';
|
|
7
9
|
import { createI18nUrlStrategy } from './urlStrategy';
|
|
8
10
|
|