@modern-js/plugin-i18n 3.1.0 → 3.1.2

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.
@@ -103,4 +103,5 @@ const i18nPlugin = (options = {})=>({
103
103
  }
104
104
  });
105
105
  const cli = i18nPlugin;
106
- export { cli as default, i18nPlugin };
106
+ export default cli;
107
+ export { i18nPlugin };
@@ -0,0 +1,18 @@
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__.add = function(modules) {
15
+ Object.assign(__webpack_require__.m, modules);
16
+ };
17
+ })();
18
+ export { __webpack_require__ };
@@ -28,4 +28,5 @@ const I18nLink = ({ to, children, ...props })=>{
28
28
  });
29
29
  };
30
30
  const runtime_I18nLink = I18nLink;
31
- export { I18nLink, runtime_I18nLink as default };
31
+ export default runtime_I18nLink;
32
+ export { I18nLink };
@@ -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, exportServerLngToWindow, getLanguageFromSSRData, detection_mergeDetectionOptions as mergeDetectionOptions };
260
+ export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority, detection_mergeDetectionOptions as mergeDetectionOptions, exportServerLngToWindow, getLanguageFromSSRData };
@@ -1,3 +1,2 @@
1
- import { getI18nInstance, isI18nInstance } from "./instance.mjs";
2
- import { assertI18nInstance } from "./utils.mjs";
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, runtime as default, i18nPlugin, useModernI18n };
128
+ export { I18nLink } from "./I18nLink.mjs";
129
+ export default runtime;
130
+ export { i18nPlugin, useModernI18n };
@@ -1,21 +1,12 @@
1
- import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
2
1
  import { isBrowser } from "@modern-js/runtime";
3
2
  import { getGlobalBasename } from "@modern-js/runtime/context";
4
- var __webpack_modules__ = {
5
- "@modern-js/runtime/router" (module) {
3
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
4
+ import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
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,34 +1,7 @@
1
- import { languageDetector } from "@modern-js/server-core/hono";
2
1
  import { DEFAULT_I18NEXT_DETECTION_OPTIONS, mergeDetectionOptions } from "../runtime/i18n/detection/config.mjs";
3
2
  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
- var hono_namespaceObject = {};
27
- __webpack_require__.r(hono_namespaceObject);
28
- __webpack_require__.d(hono_namespaceObject, {
29
- languageDetector: ()=>languageDetector
30
- });
31
- const { languageDetector: server_languageDetector } = hono_namespaceObject;
3
+ import * as __rspack_external__modern_js_server_core_hono_a76ca254 from "@modern-js/server-core/hono";
4
+ const { languageDetector: languageDetector } = __rspack_external__modern_js_server_core_hono_a76ca254;
32
5
  const convertToHonoLanguageDetectorOptions = (languages, fallbackLanguage, detectionOptions)=>{
33
6
  const mergedDetection = detectionOptions ? mergeDetectionOptions(detectionOptions) : DEFAULT_I18NEXT_DETECTION_OPTIONS;
34
7
  const order = (mergedDetection.order || []).filter((item)=>![
@@ -135,7 +108,7 @@ const i18nServerPlugin = (options)=>({
135
108
  if (localePathRedirect) {
136
109
  if (i18nextDetector) {
137
110
  const detectorOptions = convertToHonoLanguageDetectorOptions(languages, fallbackLanguage, detection);
138
- const detectorHandler = server_languageDetector(detectorOptions);
111
+ const detectorHandler = languageDetector(detectorOptions);
139
112
  middlewares.push({
140
113
  name: 'i18n-language-detector',
141
114
  path: urlPath,
@@ -186,4 +159,5 @@ const i18nServerPlugin = (options)=>({
186
159
  }
187
160
  });
188
161
  const server = i18nServerPlugin;
189
- export { server as default, i18nServerPlugin };
162
+ export default server;
163
+ export { i18nServerPlugin };
@@ -104,4 +104,5 @@ const i18nPlugin = (options = {})=>({
104
104
  }
105
105
  });
106
106
  const cli = i18nPlugin;
107
- export { cli as default, i18nPlugin };
107
+ export default cli;
108
+ export { i18nPlugin };
@@ -0,0 +1,19 @@
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__.add = function(modules) {
16
+ Object.assign(__webpack_require__.m, modules);
17
+ };
18
+ })();
19
+ export { __webpack_require__ };
@@ -29,4 +29,5 @@ const I18nLink = ({ to, children, ...props })=>{
29
29
  });
30
30
  };
31
31
  const runtime_I18nLink = I18nLink;
32
- export { I18nLink, runtime_I18nLink as default };
32
+ export default runtime_I18nLink;
33
+ export { I18nLink };
@@ -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, exportServerLngToWindow, getLanguageFromSSRData, detection_mergeDetectionOptions as mergeDetectionOptions };
261
+ export { buildInitOptions, cacheUserLanguage, detectLanguageWithPriority, detection_mergeDetectionOptions as mergeDetectionOptions, exportServerLngToWindow, getLanguageFromSSRData };
@@ -1,4 +1,3 @@
1
1
  import "node:module";
2
- import { getI18nInstance, isI18nInstance } from "./instance.mjs";
3
- import { assertI18nInstance } from "./utils.mjs";
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, runtime as default, i18nPlugin, useModernI18n };
129
+ export { I18nLink } from "./I18nLink.mjs";
130
+ export default runtime;
131
+ export { i18nPlugin, useModernI18n };
@@ -1,22 +1,13 @@
1
1
  import "node:module";
2
- import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
3
2
  import { isBrowser } from "@modern-js/runtime";
4
3
  import { getGlobalBasename } from "@modern-js/runtime/context";
5
- var __webpack_modules__ = {
6
- "@modern-js/runtime/router" (module) {
4
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
5
+ import * as __rspack_external__modern_js_runtime_router_2dfd0c78 from "@modern-js/runtime/router";
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,35 +1,8 @@
1
1
  import "node:module";
2
- import { languageDetector } from "@modern-js/server-core/hono";
3
2
  import { DEFAULT_I18NEXT_DETECTION_OPTIONS, mergeDetectionOptions } from "../runtime/i18n/detection/config.mjs";
4
3
  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
- var hono_namespaceObject = {};
28
- __webpack_require__.r(hono_namespaceObject);
29
- __webpack_require__.d(hono_namespaceObject, {
30
- languageDetector: ()=>languageDetector
31
- });
32
- const { languageDetector: server_languageDetector } = hono_namespaceObject;
4
+ import * as __rspack_external__modern_js_server_core_hono_a76ca254 from "@modern-js/server-core/hono";
5
+ const { languageDetector: languageDetector } = __rspack_external__modern_js_server_core_hono_a76ca254;
33
6
  const convertToHonoLanguageDetectorOptions = (languages, fallbackLanguage, detectionOptions)=>{
34
7
  const mergedDetection = detectionOptions ? mergeDetectionOptions(detectionOptions) : DEFAULT_I18NEXT_DETECTION_OPTIONS;
35
8
  const order = (mergedDetection.order || []).filter((item)=>![
@@ -136,7 +109,7 @@ const i18nServerPlugin = (options)=>({
136
109
  if (localePathRedirect) {
137
110
  if (i18nextDetector) {
138
111
  const detectorOptions = convertToHonoLanguageDetectorOptions(languages, fallbackLanguage, detection);
139
- const detectorHandler = server_languageDetector(detectorOptions);
112
+ const detectorHandler = languageDetector(detectorOptions);
140
113
  middlewares.push({
141
114
  name: 'i18n-language-detector',
142
115
  path: urlPath,
@@ -187,4 +160,5 @@ const i18nServerPlugin = (options)=>({
187
160
  }
188
161
  });
189
162
  const server = i18nServerPlugin;
190
- export { server as default, i18nServerPlugin };
163
+ export default server;
164
+ export { i18nServerPlugin };
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.0",
18
+ "version": "3.1.2",
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.0",
89
- "@modern-js/runtime-utils": "3.1.0",
90
- "@modern-js/server-core": "3.1.0",
91
- "@modern-js/server-runtime": "3.1.0",
92
- "@modern-js/types": "3.1.0",
93
- "@modern-js/utils": "3.1.0"
88
+ "@modern-js/runtime-utils": "3.1.2",
89
+ "@modern-js/server-core": "3.1.2",
90
+ "@modern-js/server-runtime": "3.1.2",
91
+ "@modern-js/plugin": "3.1.2",
92
+ "@modern-js/utils": "3.1.2",
93
+ "@modern-js/types": "3.1.2"
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.0"
100
+ "@modern-js/runtime": "^3.1.2"
101
101
  },
102
102
  "peerDependenciesMeta": {
103
103
  "i18next": {
@@ -108,7 +108,7 @@
108
108
  }
109
109
  },
110
110
  "devDependencies": {
111
- "@rslib/core": "0.19.6",
111
+ "@rslib/core": "0.20.3",
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.0",
122
+ "@modern-js/app-tools": "3.1.2",
123
123
  "@modern-js/rslib": "2.68.10",
124
- "@modern-js/runtime": "3.1.0"
124
+ "@modern-js/runtime": "3.1.2"
125
125
  },
126
126
  "sideEffects": false,
127
127
  "publishConfig": {