@bleedingdev/modern-js-i18n-integration 3.9.0-ultramodern.7 → 3.9.0-ultramodern.9
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/esm/cli.mjs +0 -26
- package/dist/esm-node/cli.mjs +0 -26
- package/package.json +12 -12
- package/src/cli.ts +10 -44
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 === [
|
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;
|
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;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/runtime/i18n-integration"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "3.9.0-ultramodern.
|
|
14
|
+
"version": "3.9.0-ultramodern.9",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src"
|
|
@@ -106,24 +106,24 @@
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.0-ultramodern.
|
|
110
|
-
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.
|
|
111
|
-
"@modern-js/plugin-i18n": "npm:@bleedingdev/modern-js-plugin-i18n@3.9.0-ultramodern.
|
|
112
|
-
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.
|
|
113
|
-
"@modern-js/server-runtime": "npm:@bleedingdev/modern-js-server-runtime@3.9.0-ultramodern.
|
|
114
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
109
|
+
"@modern-js/i18n-runtime-extensions": "npm:@bleedingdev/modern-js-i18n-runtime-extensions@3.9.0-ultramodern.9",
|
|
110
|
+
"@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.9.0-ultramodern.9",
|
|
111
|
+
"@modern-js/plugin-i18n": "npm:@bleedingdev/modern-js-plugin-i18n@3.9.0-ultramodern.9",
|
|
112
|
+
"@modern-js/runtime-extensions": "npm:@bleedingdev/modern-js-runtime-extensions@3.9.0-ultramodern.9",
|
|
113
|
+
"@modern-js/server-runtime": "npm:@bleedingdev/modern-js-server-runtime@3.9.0-ultramodern.9",
|
|
114
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.9"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
|
-
"@modern-js/app-tools": "3.9.0-ultramodern.
|
|
118
|
-
"@modern-js/runtime": "3.9.0-ultramodern.
|
|
117
|
+
"@modern-js/app-tools": "3.9.0-ultramodern.9",
|
|
118
|
+
"@modern-js/runtime": "3.9.0-ultramodern.9",
|
|
119
119
|
"react": "^19.2.8"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {},
|
|
122
122
|
"optionalDependencies": {},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
125
|
-
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.
|
|
126
|
-
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.
|
|
124
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.9",
|
|
125
|
+
"@modern-js/runtime": "npm:@bleedingdev/modern-js-runtime@3.9.0-ultramodern.9",
|
|
126
|
+
"@modern-js/tsconfig": "npm:@bleedingdev/modern-js-tsconfig@3.9.0-ultramodern.9",
|
|
127
127
|
"@rslib/core": "1.0.0",
|
|
128
128
|
"@rstest/core": "0.11.12",
|
|
129
129
|
"@scripts/rstest-config": "2.66.0",
|
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,17 @@ export const ultramodernI18nIntegrationPlugin = (): CliPlugin<AppTools> => ({
|
|
|
28
21
|
}),
|
|
29
22
|
}));
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
),
|
|
37
|
-
}));
|
|
24
|
+
// The native server plugin derives its URL policy from
|
|
25
|
+
// `localeDetection.localisedUrls` on its own, so the descriptor is left
|
|
26
|
+
// alone. Rewriting it to `@modern-js/i18n-integration/server` would make
|
|
27
|
+
// the server unbootable for an app that only declares
|
|
28
|
+
// `@modern-js/ultramodern-app-tools`.
|
|
38
29
|
|
|
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
|
-
});
|
|
30
|
+
// Localised route generation used to live here. It now ships in
|
|
31
|
+
// `@modern-js/plugin-i18n`'s own CLI plugin so a bare `appTools()`
|
|
32
|
+
// consumer gets it too; registering it in both places would expand the
|
|
33
|
+
// route tree twice. This plugin keeps only the fork's runtime-module
|
|
34
|
+
// swap, which is the part that genuinely needs the integration runtime.
|
|
69
35
|
},
|
|
70
36
|
});
|
|
71
37
|
|