@spscommerce/i18n 4.11.0 → 4.13.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/lib/SpsLanguage.d.ts +2 -2
- package/lib/index.cjs.js +2 -5641
- package/lib/index.d.ts +3 -3
- package/lib/index.es.js +4214 -0
- package/lib/localize.d.ts +21 -21
- package/lib/useSpsLanguage.d.ts +1 -1
- package/package.json +12 -10
- package/vite.config.js +20 -0
- package/lib/index.esm.js +0 -5606
- package/rollup.config.js +0 -24
package/lib/localize.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { InitOptions } from
|
|
2
|
-
export interface IDetectorOptions {
|
|
3
|
-
order?:
|
|
4
|
-
lookupQuerystring?: string;
|
|
5
|
-
lookupCookie?: string;
|
|
6
|
-
lookupSessionStorage?: string;
|
|
7
|
-
lookupLocalStorage?: string;
|
|
8
|
-
caches?:
|
|
9
|
-
excludeCacheFor?:
|
|
10
|
-
cookieOptions?: any;
|
|
11
|
-
}
|
|
12
|
-
export interface ILocalizeOptions extends InitOptions {
|
|
13
|
-
detectorConfig?: IDetectorOptions;
|
|
14
|
-
customDetectors?: {
|
|
15
|
-
name: string;
|
|
16
|
-
lookup: (options: IDetectorOptions) => string | undefined;
|
|
17
|
-
cacheUserLanguage?: (lang: string, options: IDetectorOptions) => void;
|
|
18
|
-
}
|
|
19
|
-
translationPath?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function localize({ detectorConfig, translationPath, customDetectors, ...i18nConfig }: ILocalizeOptions): Promise<import("i18next").TFunction>;
|
|
1
|
+
import type { InitOptions } from "i18next";
|
|
2
|
+
export interface IDetectorOptions {
|
|
3
|
+
order?: string[];
|
|
4
|
+
lookupQuerystring?: string;
|
|
5
|
+
lookupCookie?: string;
|
|
6
|
+
lookupSessionStorage?: string;
|
|
7
|
+
lookupLocalStorage?: string;
|
|
8
|
+
caches?: string[];
|
|
9
|
+
excludeCacheFor?: string[];
|
|
10
|
+
cookieOptions?: any;
|
|
11
|
+
}
|
|
12
|
+
export interface ILocalizeOptions extends InitOptions {
|
|
13
|
+
detectorConfig?: IDetectorOptions;
|
|
14
|
+
customDetectors?: Array<{
|
|
15
|
+
name: string;
|
|
16
|
+
lookup: (options: IDetectorOptions) => string | undefined;
|
|
17
|
+
cacheUserLanguage?: (lang: string, options: IDetectorOptions) => void;
|
|
18
|
+
}>;
|
|
19
|
+
translationPath?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function localize({ detectorConfig, translationPath, customDetectors, ...i18nConfig }: ILocalizeOptions): Promise<import("i18next").TFunction>;
|
package/lib/useSpsLanguage.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useSpsLanguage(ns?: string, options?: any): import("react-i18next").UseTranslationResponse<string[]>;
|
|
1
|
+
export declare function useSpsLanguage(ns?: string, options?: any): import("react-i18next").UseTranslationResponse<string[]>;
|
package/package.json
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/i18n",
|
|
3
3
|
"description": "SPS Design System React components",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.13.1",
|
|
5
5
|
"author": "SPS Commerce",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/i18n",
|
|
8
8
|
"homepage": "https://github.com/spscommerce/design-system/tree/master/packages/@spscommerce/i18n#readme",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "yarn run build:rollup",
|
|
11
|
-
"build:rollup": "npx rollup -c rollup.config.js",
|
|
12
|
-
"clean": "git clean -fdX",
|
|
13
|
-
"pub": "node ../../../scripts/publish-package.js"
|
|
14
|
-
},
|
|
15
9
|
"main": "./lib/index.cjs.js",
|
|
16
|
-
"module": "./lib/index.
|
|
10
|
+
"module": "./lib/index.es.js",
|
|
17
11
|
"types": "./lib/index.d.ts",
|
|
18
12
|
"bin": {
|
|
19
13
|
"sps-i18n-update": "./update.js"
|
|
@@ -31,8 +25,16 @@
|
|
|
31
25
|
"react": "^16.9.0"
|
|
32
26
|
},
|
|
33
27
|
"devDependencies": {
|
|
34
|
-
"@types/react": "^16.
|
|
28
|
+
"@types/react": "^16.9.0",
|
|
35
29
|
"react": "^16.9.0",
|
|
36
|
-
"typescript": "^
|
|
30
|
+
"typescript": "^4.4.4"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "pnpm run build:js && pnpm run build:types",
|
|
34
|
+
"build:js": "vite build",
|
|
35
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
|
36
|
+
"watch": "vite build --watch",
|
|
37
|
+
"clean": "git clean -fdX",
|
|
38
|
+
"pub": "pnpm pack && node ../../scripts/publish-package.js"
|
|
37
39
|
}
|
|
38
40
|
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
|
|
5
|
+
import pkg from './package.json';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
build: {
|
|
9
|
+
lib: {
|
|
10
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
11
|
+
formats: ['es', 'cjs'],
|
|
12
|
+
fileName: (format) => `index.${format}.js`,
|
|
13
|
+
},
|
|
14
|
+
outDir: path.resolve(__dirname, './lib'),
|
|
15
|
+
emptyOutDir: false,
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|