@modern-js/plugin-i18n 3.1.0 → 3.1.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/esm/cli/index.mjs +2 -1
- package/dist/esm/rslib-runtime.mjs +39 -0
- package/dist/esm/runtime/I18nLink.mjs +2 -1
- package/dist/esm/runtime/i18n/detection/index.mjs +1 -1
- package/dist/esm/runtime/i18n/index.mjs +2 -3
- package/dist/esm/runtime/index.mjs +3 -2
- package/dist/esm/runtime/utils.mjs +5 -14
- package/dist/esm/server/index.mjs +3 -23
- package/dist/esm-node/cli/index.mjs +2 -1
- package/dist/esm-node/rslib-runtime.mjs +40 -0
- package/dist/esm-node/runtime/I18nLink.mjs +2 -1
- package/dist/esm-node/runtime/i18n/detection/index.mjs +1 -1
- package/dist/esm-node/runtime/i18n/index.mjs +2 -3
- package/dist/esm-node/runtime/index.mjs +3 -2
- package/dist/esm-node/runtime/utils.mjs +5 -14
- package/dist/esm-node/server/index.mjs +3 -23
- package/package.json +11 -11
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
15
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: definition[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.add = function(modules) {
|
|
23
|
+
Object.assign(__webpack_require__.m, modules);
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.r = (exports)=>{
|
|
31
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
32
|
+
value: 'Module'
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
export { __webpack_require__ };
|
|
@@ -257,4 +257,4 @@ const detection_mergeDetectionOptions = (i18nextDetector, detection, localePathR
|
|
|
257
257
|
if (localePathRedirect && mergedDetection.order) mergedDetection.order = mergedDetection.order.filter((item)=>'path' !== item);
|
|
258
258
|
return mergedDetection;
|
|
259
259
|
};
|
|
260
|
-
export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority,
|
|
260
|
+
export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority, detection_mergeDetectionOptions as mergeDetectionOptions, exportServerLngToWindow, getLanguageFromSSRData };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { assertI18nInstance, getI18nInstance, isI18nInstance };
|
|
1
|
+
export { getI18nInstance, isI18nInstance } from "./instance.mjs";
|
|
2
|
+
export { assertI18nInstance } from "./utils.mjs";
|
|
@@ -14,7 +14,6 @@ import { getI18nextInstanceForProvider, getI18nextProvider, getInitReactI18next
|
|
|
14
14
|
import { changeI18nLanguage, ensureLanguageMatch, initializeI18nInstance, setupClonedInstance } from "./i18n/utils.mjs";
|
|
15
15
|
import { getPathname } from "./utils.mjs";
|
|
16
16
|
import "./types.mjs";
|
|
17
|
-
import { I18nLink } from "./I18nLink.mjs";
|
|
18
17
|
const i18nPlugin = (options)=>({
|
|
19
18
|
name: '@modern-js/plugin-i18n',
|
|
20
19
|
setup: (api)=>{
|
|
@@ -126,4 +125,6 @@ const i18nPlugin = (options)=>({
|
|
|
126
125
|
}
|
|
127
126
|
});
|
|
128
127
|
const runtime = i18nPlugin;
|
|
129
|
-
export { I18nLink
|
|
128
|
+
export { I18nLink } from "./I18nLink.mjs";
|
|
129
|
+
export default runtime;
|
|
130
|
+
export { i18nPlugin, useModernI18n };
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
|
|
2
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
2
3
|
import { isBrowser } from "@modern-js/runtime";
|
|
3
4
|
import { getGlobalBasename } from "@modern-js/runtime/context";
|
|
4
|
-
|
|
5
|
-
"@modern-js/runtime/router" (module) {
|
|
5
|
+
__webpack_require__.add({
|
|
6
|
+
"@modern-js/runtime/router?f1fa" (module) {
|
|
6
7
|
module.exports = __rspack_external__modern_js_runtime_router_2dfd0c78;
|
|
7
8
|
}
|
|
8
|
-
};
|
|
9
|
-
var __webpack_module_cache__ = {};
|
|
10
|
-
function __webpack_require__(moduleId) {
|
|
11
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
12
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
13
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
14
|
-
exports: {}
|
|
15
|
-
};
|
|
16
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
17
|
-
return module.exports;
|
|
18
|
-
}
|
|
9
|
+
});
|
|
19
10
|
const getPathname = (context)=>{
|
|
20
11
|
if (isBrowser()) return window.location.pathname;
|
|
21
12
|
return context.ssrContext?.request?.pathname || '/';
|
|
@@ -65,7 +56,7 @@ const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>{
|
|
|
65
56
|
};
|
|
66
57
|
const useRouterHooks = ()=>{
|
|
67
58
|
try {
|
|
68
|
-
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router");
|
|
59
|
+
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router?f1fa");
|
|
69
60
|
return {
|
|
70
61
|
navigate: useNavigate(),
|
|
71
62
|
location: useLocation(),
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
1
2
|
import { languageDetector } from "@modern-js/server-core/hono";
|
|
2
3
|
import { DEFAULT_I18NEXT_DETECTION_OPTIONS, mergeDetectionOptions } from "../runtime/i18n/detection/config.mjs";
|
|
3
4
|
import { getLocaleDetectionOptions } from "../shared/utils.mjs";
|
|
4
|
-
var __webpack_require__ = {};
|
|
5
|
-
(()=>{
|
|
6
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
7
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: definition[key]
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
(()=>{
|
|
14
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
15
|
-
})();
|
|
16
|
-
(()=>{
|
|
17
|
-
__webpack_require__.r = (exports)=>{
|
|
18
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
19
|
-
value: 'Module'
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(exports, '__esModule', {
|
|
22
|
-
value: true
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
})();
|
|
26
5
|
var hono_namespaceObject = {};
|
|
27
6
|
__webpack_require__.r(hono_namespaceObject);
|
|
28
7
|
__webpack_require__.d(hono_namespaceObject, {
|
|
@@ -186,4 +165,5 @@ const i18nServerPlugin = (options)=>({
|
|
|
186
165
|
}
|
|
187
166
|
});
|
|
188
167
|
const server = i18nServerPlugin;
|
|
189
|
-
export
|
|
168
|
+
export default server;
|
|
169
|
+
export { i18nServerPlugin };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
var __webpack_modules__ = {};
|
|
3
|
+
var __webpack_module_cache__ = {};
|
|
4
|
+
function __webpack_require__(moduleId) {
|
|
5
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
6
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
7
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
8
|
+
exports: {}
|
|
9
|
+
};
|
|
10
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
11
|
+
return module.exports;
|
|
12
|
+
}
|
|
13
|
+
__webpack_require__.m = __webpack_modules__;
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
16
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: definition[key]
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
})();
|
|
22
|
+
(()=>{
|
|
23
|
+
__webpack_require__.add = function(modules) {
|
|
24
|
+
Object.assign(__webpack_require__.m, modules);
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
(()=>{
|
|
28
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
29
|
+
})();
|
|
30
|
+
(()=>{
|
|
31
|
+
__webpack_require__.r = (exports)=>{
|
|
32
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
33
|
+
value: 'Module'
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, '__esModule', {
|
|
36
|
+
value: true
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
export { __webpack_require__ };
|
|
@@ -258,4 +258,4 @@ const detection_mergeDetectionOptions = (i18nextDetector, detection, localePathR
|
|
|
258
258
|
if (localePathRedirect && mergedDetection.order) mergedDetection.order = mergedDetection.order.filter((item)=>'path' !== item);
|
|
259
259
|
return mergedDetection;
|
|
260
260
|
};
|
|
261
|
-
export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority,
|
|
261
|
+
export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority, detection_mergeDetectionOptions as mergeDetectionOptions, exportServerLngToWindow, getLanguageFromSSRData };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { assertI18nInstance, getI18nInstance, isI18nInstance };
|
|
2
|
+
export { getI18nInstance, isI18nInstance } from "./instance.mjs";
|
|
3
|
+
export { assertI18nInstance } from "./utils.mjs";
|
|
@@ -15,7 +15,6 @@ import { getI18nextInstanceForProvider, getI18nextProvider, getInitReactI18next
|
|
|
15
15
|
import { changeI18nLanguage, ensureLanguageMatch, initializeI18nInstance, setupClonedInstance } from "./i18n/utils.mjs";
|
|
16
16
|
import { getPathname } from "./utils.mjs";
|
|
17
17
|
import "./types.mjs";
|
|
18
|
-
import { I18nLink } from "./I18nLink.mjs";
|
|
19
18
|
const i18nPlugin = (options)=>({
|
|
20
19
|
name: '@modern-js/plugin-i18n',
|
|
21
20
|
setup: (api)=>{
|
|
@@ -127,4 +126,6 @@ const i18nPlugin = (options)=>({
|
|
|
127
126
|
}
|
|
128
127
|
});
|
|
129
128
|
const runtime = i18nPlugin;
|
|
130
|
-
export { I18nLink
|
|
129
|
+
export { I18nLink } from "./I18nLink.mjs";
|
|
130
|
+
export default runtime;
|
|
131
|
+
export { i18nPlugin, useModernI18n };
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
|
|
3
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
3
4
|
import { isBrowser } from "@modern-js/runtime";
|
|
4
5
|
import { getGlobalBasename } from "@modern-js/runtime/context";
|
|
5
|
-
|
|
6
|
-
"@modern-js/runtime/router" (module) {
|
|
6
|
+
__webpack_require__.add({
|
|
7
|
+
"@modern-js/runtime/router?f1fa" (module) {
|
|
7
8
|
module.exports = __rspack_external__modern_js_runtime_router_2dfd0c78;
|
|
8
9
|
}
|
|
9
|
-
};
|
|
10
|
-
var __webpack_module_cache__ = {};
|
|
11
|
-
function __webpack_require__(moduleId) {
|
|
12
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
15
|
-
exports: {}
|
|
16
|
-
};
|
|
17
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
18
|
-
return module.exports;
|
|
19
|
-
}
|
|
10
|
+
});
|
|
20
11
|
const getPathname = (context)=>{
|
|
21
12
|
if (isBrowser()) return window.location.pathname;
|
|
22
13
|
return context.ssrContext?.request?.pathname || '/';
|
|
@@ -66,7 +57,7 @@ const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>{
|
|
|
66
57
|
};
|
|
67
58
|
const useRouterHooks = ()=>{
|
|
68
59
|
try {
|
|
69
|
-
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router");
|
|
60
|
+
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router?f1fa");
|
|
70
61
|
return {
|
|
71
62
|
navigate: useNavigate(),
|
|
72
63
|
location: useLocation(),
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
2
3
|
import { languageDetector } from "@modern-js/server-core/hono";
|
|
3
4
|
import { DEFAULT_I18NEXT_DETECTION_OPTIONS, mergeDetectionOptions } from "../runtime/i18n/detection/config.mjs";
|
|
4
5
|
import { getLocaleDetectionOptions } from "../shared/utils.mjs";
|
|
5
|
-
var __webpack_require__ = {};
|
|
6
|
-
(()=>{
|
|
7
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
8
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: definition[key]
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
16
|
-
})();
|
|
17
|
-
(()=>{
|
|
18
|
-
__webpack_require__.r = (exports)=>{
|
|
19
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
20
|
-
value: 'Module'
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, '__esModule', {
|
|
23
|
-
value: true
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
})();
|
|
27
6
|
var hono_namespaceObject = {};
|
|
28
7
|
__webpack_require__.r(hono_namespaceObject);
|
|
29
8
|
__webpack_require__.d(hono_namespaceObject, {
|
|
@@ -187,4 +166,5 @@ const i18nServerPlugin = (options)=>({
|
|
|
187
166
|
}
|
|
188
167
|
});
|
|
189
168
|
const server = i18nServerPlugin;
|
|
190
|
-
export
|
|
169
|
+
export default server;
|
|
170
|
+
export { i18nServerPlugin };
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.1.
|
|
18
|
+
"version": "3.1.1",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -85,19 +85,19 @@
|
|
|
85
85
|
"i18next-fs-backend": "^2.6.1",
|
|
86
86
|
"i18next-http-backend": "^3.0.2",
|
|
87
87
|
"i18next-http-middleware": "^3.9.2",
|
|
88
|
-
"@modern-js/plugin": "3.1.
|
|
89
|
-
"@modern-js/runtime-utils": "3.1.
|
|
90
|
-
"@modern-js/server-core": "3.1.
|
|
91
|
-
"@modern-js/server-runtime": "3.1.
|
|
92
|
-
"@modern-js/types": "3.1.
|
|
93
|
-
"@modern-js/utils": "3.1.
|
|
88
|
+
"@modern-js/plugin": "3.1.1",
|
|
89
|
+
"@modern-js/runtime-utils": "3.1.1",
|
|
90
|
+
"@modern-js/server-core": "3.1.1",
|
|
91
|
+
"@modern-js/server-runtime": "3.1.1",
|
|
92
|
+
"@modern-js/types": "3.1.1",
|
|
93
|
+
"@modern-js/utils": "3.1.1"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"react": ">=17.0.2",
|
|
97
97
|
"react-dom": ">=17.0.2",
|
|
98
98
|
"i18next": ">=25.7.4",
|
|
99
99
|
"react-i18next": ">=15.7.4",
|
|
100
|
-
"@modern-js/runtime": "^3.1.
|
|
100
|
+
"@modern-js/runtime": "^3.1.1"
|
|
101
101
|
},
|
|
102
102
|
"peerDependenciesMeta": {
|
|
103
103
|
"i18next": {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@rslib/core": "0.
|
|
111
|
+
"@rslib/core": "0.20.0",
|
|
112
112
|
"@types/jest": "^29.5.14",
|
|
113
113
|
"@types/node": "^20",
|
|
114
114
|
"i18next": "25.7.4",
|
|
@@ -119,9 +119,9 @@
|
|
|
119
119
|
"ts-jest": "^29.4.6",
|
|
120
120
|
"ts-node": "^10.9.2",
|
|
121
121
|
"typescript": "^5",
|
|
122
|
-
"@modern-js/app-tools": "3.1.
|
|
122
|
+
"@modern-js/app-tools": "3.1.1",
|
|
123
123
|
"@modern-js/rslib": "2.68.10",
|
|
124
|
-
"@modern-js/runtime": "3.1.
|
|
124
|
+
"@modern-js/runtime": "3.1.1"
|
|
125
125
|
},
|
|
126
126
|
"sideEffects": false,
|
|
127
127
|
"publishConfig": {
|