@modern-js/plugin-i18n 3.8.3 → 3.9.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/runtime/utils.mjs +4 -5
- package/dist/esm-node/runtime/utils.mjs +6 -5
- package/dist/types/cli/index.d.ts +2 -2
- package/dist/types/cli/locales.d.ts +1 -1
- package/dist/types/runtime/context.d.ts +1 -1
- package/dist/types/runtime/hooks.d.ts +1 -1
- package/dist/types/runtime/i18n/backend/config.d.ts +1 -1
- package/dist/types/runtime/i18n/backend/index.d.ts +2 -2
- package/dist/types/runtime/i18n/backend/middleware.common.d.ts +2 -2
- package/dist/types/runtime/i18n/backend/middleware.d.ts +2 -2
- package/dist/types/runtime/i18n/backend/middleware.node.d.ts +2 -2
- package/dist/types/runtime/i18n/backend/sdk-backend.d.ts +1 -1
- package/dist/types/runtime/i18n/detection/config.d.ts +1 -1
- package/dist/types/runtime/i18n/detection/index.d.ts +2 -2
- package/dist/types/runtime/i18n/detection/middleware.d.ts +1 -1
- package/dist/types/runtime/i18n/detection/middleware.node.d.ts +1 -1
- package/dist/types/runtime/i18n/index.d.ts +3 -3
- package/dist/types/runtime/i18n/instance.d.ts +1 -1
- package/dist/types/runtime/i18n/utils.d.ts +2 -2
- package/dist/types/runtime/index.d.ts +7 -7
- package/dist/types/runtime/types.d.ts +1 -1
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/shared/detection.d.ts +1 -1
- package/dist/types/shared/type.d.ts +1 -1
- package/dist/types/shared/utils.d.ts +1 -1
- package/package.json +11 -11
- /package/dist/esm/{rslib-runtime.mjs → rslib-runtime~1.mjs} +0 -0
- /package/dist/esm-node/{rslib-runtime.mjs → rslib-runtime~0.mjs} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isBrowser } from "@modern-js/runtime";
|
|
2
2
|
import { getGlobalBasename } from "@modern-js/runtime/context";
|
|
3
|
-
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
4
|
-
import * as __rspack_external__modern_js_runtime_router_f3bd0c2c from "@modern-js/runtime/router";
|
|
3
|
+
import { __webpack_require__ } from "../rslib-runtime~1.mjs";
|
|
5
4
|
__webpack_require__.add({
|
|
6
|
-
|
|
7
|
-
module.exports =
|
|
5
|
+
4734 (module) {
|
|
6
|
+
module.exports = require("@modern-js/runtime/router");
|
|
8
7
|
}
|
|
9
8
|
});
|
|
10
9
|
const getPathname = (context)=>{
|
|
@@ -56,7 +55,7 @@ const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>{
|
|
|
56
55
|
};
|
|
57
56
|
const useRouterHooks = ()=>{
|
|
58
57
|
try {
|
|
59
|
-
const { useLocation, useNavigate, useParams } = __webpack_require__(
|
|
58
|
+
const { useLocation, useNavigate, useParams } = __webpack_require__(4734);
|
|
60
59
|
return {
|
|
61
60
|
navigate: useNavigate(),
|
|
62
61
|
location: useLocation(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { isBrowser } from "@modern-js/runtime";
|
|
3
3
|
import { getGlobalBasename } from "@modern-js/runtime/context";
|
|
4
|
-
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
5
|
-
import
|
|
4
|
+
import { __webpack_require__ } from "../rslib-runtime~0.mjs";
|
|
5
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
6
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
6
7
|
__webpack_require__.add({
|
|
7
|
-
"@modern-js/runtime/router?
|
|
8
|
-
module.exports =
|
|
8
|
+
"@modern-js/runtime/router?a7f7" (module) {
|
|
9
|
+
module.exports = __rspack_createRequire_require("@modern-js/runtime/router");
|
|
9
10
|
}
|
|
10
11
|
});
|
|
11
12
|
const getPathname = (context)=>{
|
|
@@ -57,7 +58,7 @@ const shouldIgnoreRedirect = (pathname, languages, ignoreRedirectRoutes)=>{
|
|
|
57
58
|
};
|
|
58
59
|
const useRouterHooks = ()=>{
|
|
59
60
|
try {
|
|
60
|
-
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router?
|
|
61
|
+
const { useLocation, useNavigate, useParams } = __webpack_require__("@modern-js/runtime/router?a7f7");
|
|
61
62
|
return {
|
|
62
63
|
navigate: useNavigate(),
|
|
63
64
|
location: useLocation(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AppTools, CliPlugin } from '@modern-js/app-tools';
|
|
2
2
|
import type { Entrypoint } from '@modern-js/types';
|
|
3
|
-
import type { BackendOptions, LocaleDetectionOptions } from '../shared/type';
|
|
4
|
-
import '../runtime/types';
|
|
3
|
+
import type { BackendOptions, LocaleDetectionOptions } from '../shared/type.js';
|
|
4
|
+
import '../runtime/types.js';
|
|
5
5
|
export type TransformRuntimeConfigFn = (extendedConfig: Record<string, any>, entrypoint: Entrypoint) => Record<string, any>;
|
|
6
6
|
export interface I18nPluginOptions {
|
|
7
7
|
localeDetection?: LocaleDetectionOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TRuntimeContext } from '@modern-js/runtime';
|
|
2
2
|
import type React from 'react';
|
|
3
|
-
import type { I18nInstance } from './i18n';
|
|
3
|
+
import type { I18nInstance } from './i18n/index.js';
|
|
4
4
|
interface RuntimeContextWithI18n extends TRuntimeContext {
|
|
5
5
|
i18nInstance?: I18nInstance;
|
|
6
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BackendOptions } from '../instance';
|
|
1
|
+
import type { BackendOptions } from '../instance.js';
|
|
2
2
|
export declare function mergeBackendOptions(defaultOptions: BackendOptions, cliOptions?: BackendOptions, userOptions?: BackendOptions): BackendOptions;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BaseBackendOptions } from '../../../shared/type';
|
|
2
|
-
import type { BackendOptions, I18nInitOptions } from '../instance';
|
|
1
|
+
import type { BaseBackendOptions } from '../../../shared/type.js';
|
|
2
|
+
import type { BackendOptions, I18nInitOptions } from '../instance.js';
|
|
3
3
|
export declare const mergeBackendOptions: (backend?: BaseBackendOptions, userInitOptions?: I18nInitOptions) => BackendOptions | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseBackendOptions, ChainedBackendConfig } from '../../../shared/type';
|
|
2
|
-
import type { I18nInstance } from '../instance';
|
|
1
|
+
import type { BaseBackendOptions, ChainedBackendConfig } from '../../../shared/type.js';
|
|
2
|
+
import type { I18nInstance } from '../instance.js';
|
|
3
3
|
type BackendConfigWithChained = BaseBackendOptions & Partial<ChainedBackendConfig>;
|
|
4
4
|
/**
|
|
5
5
|
* Common logic for using i18next backend
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Backend from 'i18next-http-backend';
|
|
2
|
-
import type { ExtendedBackendOptions } from '../../../shared/type';
|
|
3
|
-
import type { I18nInstance } from '../instance';
|
|
2
|
+
import type { ExtendedBackendOptions } from '../../../shared/type.js';
|
|
3
|
+
import type { I18nInstance } from '../instance.js';
|
|
4
4
|
/**
|
|
5
5
|
* Wrapper for HTTP backend to add a no-op save method
|
|
6
6
|
* This is required for i18next-chained-backend to trigger refresh logic
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Backend from 'i18next-fs-backend';
|
|
2
|
-
import type { ExtendedBackendOptions } from '../../../shared/type';
|
|
3
|
-
import type { I18nInstance } from '../instance';
|
|
2
|
+
import type { ExtendedBackendOptions } from '../../../shared/type.js';
|
|
3
|
+
import type { I18nInstance } from '../instance.js';
|
|
4
4
|
/**
|
|
5
5
|
* Wrapper for FS backend to add a no-op save method
|
|
6
6
|
* This is required for i18next-chained-backend to trigger refresh logic
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TRuntimeContext } from '@modern-js/runtime';
|
|
2
|
-
import type { I18nInitOptions, I18nInstance, LanguageDetectorOptions } from '../instance';
|
|
3
|
-
import { cacheUserLanguage } from './middleware';
|
|
2
|
+
import type { I18nInitOptions, I18nInstance, LanguageDetectorOptions } from '../instance.js';
|
|
3
|
+
import { cacheUserLanguage } from './middleware.js';
|
|
4
4
|
export { cacheUserLanguage };
|
|
5
5
|
export declare function exportServerLngToWindow(context: TRuntimeContext, lng: string): void;
|
|
6
6
|
export declare const getLanguageFromSSRData: (window: Window) => string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { I18nInstance } from '../instance';
|
|
1
|
+
import type { I18nInstance } from '../instance.js';
|
|
2
2
|
export declare const cacheUserLanguage: (_i18nInstance: I18nInstance, _language: string, _detectionOptions?: any) => void;
|
|
3
3
|
/**
|
|
4
4
|
* Read language directly from storage (localStorage/cookie)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { I18nInstance, I18nInitOptions, } from './instance';
|
|
2
|
-
export { isI18nInstance, getI18nInstance } from './instance';
|
|
3
|
-
export { assertI18nInstance } from './utils';
|
|
1
|
+
export type { I18nInstance, I18nInitOptions, } from './instance.js';
|
|
2
|
+
export { isI18nInstance, getI18nInstance } from './instance.js';
|
|
3
|
+
export { assertI18nInstance } from './utils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseBackendOptions } from '../../shared/type';
|
|
2
|
-
import type { I18nInitOptions, I18nInstance } from './instance';
|
|
1
|
+
import type { BaseBackendOptions } from '../../shared/type.js';
|
|
2
|
+
import type { I18nInitOptions, I18nInstance } from './instance.js';
|
|
3
3
|
export declare function assertI18nInstance(obj: any): asserts obj is I18nInstance;
|
|
4
4
|
/**
|
|
5
5
|
* Build initialization options for i18n instance
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type RuntimePlugin } from '@modern-js/runtime';
|
|
2
|
-
import type { BaseBackendOptions, BaseLocaleDetectionOptions } from '../shared/type';
|
|
3
|
-
import type { I18nInitOptions, I18nInstance } from './i18n';
|
|
4
|
-
import './types';
|
|
5
|
-
export type { I18nSdkLoader, I18nSdkLoadOptions } from '../shared/type';
|
|
6
|
-
export type { Resources } from './i18n/instance';
|
|
2
|
+
import type { BaseBackendOptions, BaseLocaleDetectionOptions } from '../shared/type.js';
|
|
3
|
+
import type { I18nInitOptions, I18nInstance } from './i18n/index.js';
|
|
4
|
+
import './types.js';
|
|
5
|
+
export type { I18nSdkLoader, I18nSdkLoadOptions } from '../shared/type.js';
|
|
6
|
+
export type { Resources } from './i18n/instance.js';
|
|
7
7
|
export interface I18nPluginOptions {
|
|
8
8
|
entryName?: string;
|
|
9
9
|
localeDetection?: BaseLocaleDetectionOptions;
|
|
@@ -15,6 +15,6 @@ export interface I18nPluginOptions {
|
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
}
|
|
17
17
|
export declare const i18nPlugin: (options: I18nPluginOptions) => RuntimePlugin;
|
|
18
|
-
export { useModernI18n } from './context';
|
|
19
|
-
export { I18nLink } from './I18nLink';
|
|
18
|
+
export { useModernI18n } from './context.js';
|
|
19
|
+
export { I18nLink } from './I18nLink.js';
|
|
20
20
|
export default i18nPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ServerPlugin } from '@modern-js/server-runtime';
|
|
2
|
-
import type { LocaleDetectionOptions } from '../shared/type';
|
|
2
|
+
import type { LocaleDetectionOptions } from '../shared/type.js';
|
|
3
3
|
export interface I18nPluginOptions {
|
|
4
4
|
localeDetection: LocaleDetectionOptions;
|
|
5
5
|
staticRoutePrefixes: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LanguageDetectorOptions } from '../runtime/i18n/instance';
|
|
1
|
+
import type { LanguageDetectorOptions } from '../runtime/i18n/instance.js';
|
|
2
2
|
/**
|
|
3
3
|
* Detect language from request using the same detection logic as i18next
|
|
4
4
|
* This ensures consistency between server-side and client-side detection
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LanguageDetectorOptions, Resources } from '../runtime/i18n/instance';
|
|
1
|
+
import type { LanguageDetectorOptions, Resources } from '../runtime/i18n/instance.js';
|
|
2
2
|
export interface BaseLocaleDetectionOptions {
|
|
3
3
|
localePathRedirect?: boolean;
|
|
4
4
|
i18nextDetector?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseBackendOptions, BaseLocaleDetectionOptions } from './type';
|
|
1
|
+
import type { BaseBackendOptions, BaseLocaleDetectionOptions } from './type.js';
|
|
2
2
|
export declare function getEntryConfig<T extends Record<string, any>>(entryName: string, config: T, entryKey: string): T | undefined;
|
|
3
3
|
export declare function removeEntryConfigKey<T extends Record<string, any>>(config: T, entryKey: string): Omit<T, typeof entryKey>;
|
|
4
4
|
export declare function getLocaleDetectionOptions(entryName: string, localeDetection: BaseLocaleDetectionOptions): BaseLocaleDetectionOptions;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.
|
|
18
|
+
"version": "3.9.1",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=20"
|
|
21
21
|
},
|
|
@@ -85,19 +85,19 @@
|
|
|
85
85
|
"i18next-fs-backend": "^2.6.7",
|
|
86
86
|
"i18next-http-backend": "^3.0.6",
|
|
87
87
|
"i18next-http-middleware": "^3.9.8",
|
|
88
|
-
"@modern-js/plugin": "3.
|
|
89
|
-
"@modern-js/runtime-utils": "3.
|
|
90
|
-
"@modern-js/server-
|
|
91
|
-
"@modern-js/server-
|
|
92
|
-
"@modern-js/types": "3.
|
|
93
|
-
"@modern-js/utils": "3.
|
|
88
|
+
"@modern-js/plugin": "3.9.1",
|
|
89
|
+
"@modern-js/runtime-utils": "3.9.1",
|
|
90
|
+
"@modern-js/server-runtime": "3.9.1",
|
|
91
|
+
"@modern-js/server-core": "3.9.1",
|
|
92
|
+
"@modern-js/types": "3.9.1",
|
|
93
|
+
"@modern-js/utils": "3.9.1"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"react": ">=18.3.1",
|
|
97
97
|
"react-dom": ">=18.3.1",
|
|
98
98
|
"i18next": ">=25.7.4",
|
|
99
99
|
"react-i18next": ">=15.7.4",
|
|
100
|
-
"@modern-js/runtime": "^3.
|
|
100
|
+
"@modern-js/runtime": "^3.9.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": "1.0.0",
|
|
112
112
|
"@types/node": "^20",
|
|
113
113
|
"i18next": "25.7.4",
|
|
114
114
|
"react": "^19.2.8",
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
"react-i18next": "15.7.4",
|
|
117
117
|
"ts-node": "^10.9.2",
|
|
118
118
|
"typescript": "^5",
|
|
119
|
+
"@modern-js/app-tools": "3.9.1",
|
|
119
120
|
"@modern-js/rslib": "2.68.10",
|
|
120
|
-
"@modern-js/
|
|
121
|
-
"@modern-js/runtime": "3.8.3"
|
|
121
|
+
"@modern-js/runtime": "3.9.1"
|
|
122
122
|
},
|
|
123
123
|
"sideEffects": false,
|
|
124
124
|
"publishConfig": {
|
|
File without changes
|
|
File without changes
|