@intlayer/use-intl 9.0.0-canary.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.
- package/README.md +330 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/cjs/core/createFormatter.cjs +23 -0
- package/dist/cjs/core/createFormatter.cjs.map +1 -0
- package/dist/cjs/core/createTranslator.cjs +30 -0
- package/dist/cjs/core/createTranslator.cjs.map +1 -0
- package/dist/cjs/core/errors.cjs +42 -0
- package/dist/cjs/core/errors.cjs.map +1 -0
- package/dist/cjs/core/hasLocale.cjs +23 -0
- package/dist/cjs/core/hasLocale.cjs.map +1 -0
- package/dist/cjs/core/index.cjs +13 -0
- package/dist/cjs/core/initializeConfig.cjs +25 -0
- package/dist/cjs/core/initializeConfig.cjs.map +1 -0
- package/dist/cjs/core/types.cjs +0 -0
- package/dist/cjs/index.cjs +30 -0
- package/dist/cjs/plugin/index.cjs +80 -0
- package/dist/cjs/plugin/index.cjs.map +1 -0
- package/dist/cjs/react/IntlProvider.cjs +30 -0
- package/dist/cjs/react/IntlProvider.cjs.map +1 -0
- package/dist/cjs/react/helpers.cjs +49 -0
- package/dist/cjs/react/helpers.cjs.map +1 -0
- package/dist/cjs/react/index.cjs +27 -0
- package/dist/cjs/react/index.cjs.map +1 -0
- package/dist/cjs/react/useLocale.cjs +20 -0
- package/dist/cjs/react/useLocale.cjs.map +1 -0
- package/dist/cjs/react/useTranslations.cjs +39 -0
- package/dist/cjs/react/useTranslations.cjs.map +1 -0
- package/dist/cjs/shared/intlFormatter.cjs +63 -0
- package/dist/cjs/shared/intlFormatter.cjs.map +1 -0
- package/dist/cjs/shared/namespaceTranslator.cjs +122 -0
- package/dist/cjs/shared/namespaceTranslator.cjs.map +1 -0
- package/dist/cjs/shared/translateFunctionTypes.cjs +0 -0
- package/dist/cjs/useDictionary.cjs +37 -0
- package/dist/cjs/useDictionary.cjs.map +1 -0
- package/dist/cjs/useDictionaryDynamic.cjs +31 -0
- package/dist/cjs/useDictionaryDynamic.cjs.map +1 -0
- package/dist/esm/core/createFormatter.mjs +22 -0
- package/dist/esm/core/createFormatter.mjs.map +1 -0
- package/dist/esm/core/createTranslator.mjs +28 -0
- package/dist/esm/core/createTranslator.mjs.map +1 -0
- package/dist/esm/core/errors.mjs +39 -0
- package/dist/esm/core/errors.mjs.map +1 -0
- package/dist/esm/core/hasLocale.mjs +21 -0
- package/dist/esm/core/hasLocale.mjs.map +1 -0
- package/dist/esm/core/index.mjs +7 -0
- package/dist/esm/core/initializeConfig.mjs +23 -0
- package/dist/esm/core/initializeConfig.mjs.map +1 -0
- package/dist/esm/core/types.mjs +0 -0
- package/dist/esm/index.mjs +14 -0
- package/dist/esm/plugin/index.mjs +76 -0
- package/dist/esm/plugin/index.mjs.map +1 -0
- package/dist/esm/react/IntlProvider.mjs +28 -0
- package/dist/esm/react/IntlProvider.mjs.map +1 -0
- package/dist/esm/react/helpers.mjs +44 -0
- package/dist/esm/react/helpers.mjs.map +1 -0
- package/dist/esm/react/index.mjs +17 -0
- package/dist/esm/react/index.mjs.map +1 -0
- package/dist/esm/react/useLocale.mjs +18 -0
- package/dist/esm/react/useLocale.mjs.map +1 -0
- package/dist/esm/react/useTranslations.mjs +37 -0
- package/dist/esm/react/useTranslations.mjs.map +1 -0
- package/dist/esm/shared/intlFormatter.mjs +61 -0
- package/dist/esm/shared/intlFormatter.mjs.map +1 -0
- package/dist/esm/shared/namespaceTranslator.mjs +119 -0
- package/dist/esm/shared/namespaceTranslator.mjs.map +1 -0
- package/dist/esm/shared/translateFunctionTypes.mjs +0 -0
- package/dist/esm/useDictionary.mjs +35 -0
- package/dist/esm/useDictionary.mjs.map +1 -0
- package/dist/esm/useDictionaryDynamic.mjs +29 -0
- package/dist/esm/useDictionaryDynamic.mjs.map +1 -0
- package/dist/types/core/createFormatter.d.ts +21 -0
- package/dist/types/core/createFormatter.d.ts.map +1 -0
- package/dist/types/core/createTranslator.d.ts +56 -0
- package/dist/types/core/createTranslator.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +31 -0
- package/dist/types/core/errors.d.ts.map +1 -0
- package/dist/types/core/hasLocale.d.ts +18 -0
- package/dist/types/core/hasLocale.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +7 -0
- package/dist/types/core/initializeConfig.d.ts +14 -0
- package/dist/types/core/initializeConfig.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +2 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/plugin/index.d.ts +22 -0
- package/dist/types/plugin/index.d.ts.map +1 -0
- package/dist/types/react/IntlProvider.d.ts +29 -0
- package/dist/types/react/IntlProvider.d.ts.map +1 -0
- package/dist/types/react/helpers.d.ts +31 -0
- package/dist/types/react/helpers.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +16 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/useLocale.d.ts +12 -0
- package/dist/types/react/useLocale.d.ts.map +1 -0
- package/dist/types/react/useTranslations.d.ts +44 -0
- package/dist/types/react/useTranslations.d.ts.map +1 -0
- package/dist/types/shared/intlFormatter.d.ts +19 -0
- package/dist/types/shared/intlFormatter.d.ts.map +1 -0
- package/dist/types/shared/namespaceTranslator.d.ts +51 -0
- package/dist/types/shared/namespaceTranslator.d.ts.map +1 -0
- package/dist/types/shared/translateFunctionTypes.d.ts +34 -0
- package/dist/types/shared/translateFunctionTypes.d.ts.map +1 -0
- package/dist/types/useDictionary.d.ts +23 -0
- package/dist/types/useDictionary.d.ts.map +1 -0
- package/dist/types/useDictionaryDynamic.d.ts +18 -0
- package/dist/types/useDictionaryDynamic.d.ts.map +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
2
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
+
|
|
4
|
+
//#region src/useDictionary.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Dictionary-accepting variant of `useTranslations`.
|
|
7
|
+
*
|
|
8
|
+
* Used internally by the build-time optimization: instead of looking up the
|
|
9
|
+
* dictionary at runtime by key, the babel/swc plugin pre-imports the dictionary
|
|
10
|
+
* JSON at build time and passes it directly here. This enables tree-shaking of
|
|
11
|
+
* unused locale content.
|
|
12
|
+
*
|
|
13
|
+
* @example (generated by the plugin, not written manually)
|
|
14
|
+
* import _abc from '.intlayer/dictionaries/about.json' with { type: 'json' };
|
|
15
|
+
* const t = useDictionary(_abc);
|
|
16
|
+
*/
|
|
17
|
+
declare const useDictionary: <T extends Dictionary>(dictionary: T, namespacePrefix?: string) => (<P extends ValidDotPathsFor<string>>(lookup: P, params?: Record<string, unknown>) => string) & {
|
|
18
|
+
has: <P extends ValidDotPathsFor<string>>(lookup: P) => boolean;
|
|
19
|
+
raw: <P extends ValidDotPathsFor<string>>(lookup: P) => unknown;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useDictionary };
|
|
23
|
+
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":";;;;;;AAmBA;;;;;;;;;;cAAa,aAAA,aAA2B,UAAA,EACtC,UAAA,EAAY,CAAA,EACZ,eAAA,0BAQa,gBAAA,UAAwB,MAAA,EACzB,CAAA,EAAC,MAAA,GACA,MAAA;kBAUO,gBAAA,UAAwB,MAAA,EAAU,CAAA;kBAElC,gBAAA,UAAwB,MAAA,EAAU,CAAA;AAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StrictModeLocaleMap } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { ValidDotPathsFor } from "@intlayer/core/transpiler";
|
|
3
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
4
|
+
|
|
5
|
+
//#region src/useDictionaryDynamic.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Dynamic dictionary-accepting variant of `useTranslations`.
|
|
8
|
+
*
|
|
9
|
+
* Counterpart to {@link useDictionary} for dictionaries imported lazily per
|
|
10
|
+
* locale. Used internally by the build-time optimization.
|
|
11
|
+
*/
|
|
12
|
+
declare const useDictionaryDynamic: <const T extends Dictionary, const K extends string>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, key: K, namespacePrefix?: string) => (<P extends ValidDotPathsFor<string>>(lookup: P, params?: Record<string, unknown>) => string) & {
|
|
13
|
+
has: <P extends ValidDotPathsFor<string>>(lookup: P) => boolean;
|
|
14
|
+
raw: <P extends ValidDotPathsFor<string>>(lookup: P) => unknown;
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useDictionaryDynamic };
|
|
18
|
+
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","names":[],"sources":["../../src/useDictionaryDynamic.ts"],"mappings":";;;;;;;AAcA;;;;cAAa,oBAAA,mBACK,UAAA,0BAGhB,iBAAA,EAAmB,mBAAA,OAA0B,OAAA,CAAQ,CAAA,IACrD,GAAA,EAAK,CAAA,EACL,eAAA,0BAQa,gBAAA,UAAwB,MAAA,EACzB,CAAA,EAAC,MAAA,GACA,MAAA;kBAUO,gBAAA,UAAwB,MAAA,EAAU,CAAA;kBAElC,gBAAA,UAAwB,MAAA,EAAU,CAAA;AAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@intlayer/use-intl",
|
|
3
|
+
"version": "9.0.0-canary.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "use-intl API adapter for intlayer — useTranslations, useLocale, useFormatter, IntlProvider, createTranslator backed by react-intlayer",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"intlayer",
|
|
8
|
+
"use-intl",
|
|
9
|
+
"react",
|
|
10
|
+
"i18n",
|
|
11
|
+
"adapter",
|
|
12
|
+
"compatibility"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://intlayer.org",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "Aymeric PINEAU",
|
|
25
|
+
"url": "https://github.com/aymericzip"
|
|
26
|
+
},
|
|
27
|
+
"contributors": [
|
|
28
|
+
{
|
|
29
|
+
"name": "Aymeric Pineau",
|
|
30
|
+
"email": "ay.pineau@gmail.com",
|
|
31
|
+
"url": "https://github.com/aymericzip"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/types/index.d.ts",
|
|
38
|
+
"require": "./dist/cjs/index.cjs",
|
|
39
|
+
"import": "./dist/esm/index.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./core": {
|
|
42
|
+
"types": "./dist/types/core/index.d.ts",
|
|
43
|
+
"require": "./dist/cjs/core/index.cjs",
|
|
44
|
+
"import": "./dist/esm/core/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./react": {
|
|
47
|
+
"types": "./dist/types/react/index.d.ts",
|
|
48
|
+
"require": "./dist/cjs/react/index.cjs",
|
|
49
|
+
"import": "./dist/esm/react/index.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./plugin": {
|
|
52
|
+
"types": "./dist/types/plugin/index.d.ts",
|
|
53
|
+
"require": "./dist/cjs/plugin/index.cjs",
|
|
54
|
+
"import": "./dist/esm/plugin/index.mjs"
|
|
55
|
+
},
|
|
56
|
+
"./package.json": "./package.json"
|
|
57
|
+
},
|
|
58
|
+
"main": "dist/cjs/index.cjs",
|
|
59
|
+
"module": "dist/esm/index.mjs",
|
|
60
|
+
"types": "dist/types/index.d.ts",
|
|
61
|
+
"typesVersions": {
|
|
62
|
+
"*": {
|
|
63
|
+
"core": [
|
|
64
|
+
"./dist/types/core/index.d.ts"
|
|
65
|
+
],
|
|
66
|
+
"react": [
|
|
67
|
+
"./dist/types/react/index.d.ts"
|
|
68
|
+
],
|
|
69
|
+
"plugin": [
|
|
70
|
+
"./dist/types/plugin/index.d.ts"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
"./dist",
|
|
76
|
+
"./package.json"
|
|
77
|
+
],
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "bun --bun tsdown --config tsdown.config.ts",
|
|
80
|
+
"build:ci": "bun --bun tsdown --config tsdown.config.ts",
|
|
81
|
+
"clean": "bun --bun rimraf ./dist .turbo",
|
|
82
|
+
"dev": "bun --bun tsdown --config tsdown.config.ts --watch",
|
|
83
|
+
"format": "bun --bun biome format . --check",
|
|
84
|
+
"format:fix": "bun --bun biome format --write .",
|
|
85
|
+
"lint": "bun --bun biome lint .",
|
|
86
|
+
"lint:fix": "bun --bun biome lint --write .",
|
|
87
|
+
"prepublish": "cp -f ../../README.md ./README.md",
|
|
88
|
+
"publish": "bun publish || true",
|
|
89
|
+
"publish:canary": "bun publish --access public --tag canary || true",
|
|
90
|
+
"publish:latest": "bun publish --access public --tag latest || true",
|
|
91
|
+
"test": "bun --bun vitest run",
|
|
92
|
+
"test:watch": "bun --bun vitest",
|
|
93
|
+
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
94
|
+
},
|
|
95
|
+
"dependencies": {
|
|
96
|
+
"@intlayer/chokidar": "9.0.0-canary.2",
|
|
97
|
+
"@intlayer/config": "9.0.0-canary.2",
|
|
98
|
+
"@intlayer/core": "9.0.0-canary.2",
|
|
99
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.2",
|
|
100
|
+
"@intlayer/types": "9.0.0-canary.2",
|
|
101
|
+
"react-intlayer": "9.0.0-canary.2",
|
|
102
|
+
"vite-intlayer": "9.0.0-canary.2"
|
|
103
|
+
},
|
|
104
|
+
"devDependencies": {
|
|
105
|
+
"@types/node": "25.9.3",
|
|
106
|
+
"@types/react": "19.2.17",
|
|
107
|
+
"@utils/ts-config": "1.0.4",
|
|
108
|
+
"@utils/ts-config-types": "1.0.4",
|
|
109
|
+
"@utils/tsdown-config": "1.0.4",
|
|
110
|
+
"use-intl": "4.13.0",
|
|
111
|
+
"rimraf": "6.1.3",
|
|
112
|
+
"tsdown": "0.21.10",
|
|
113
|
+
"typescript": "6.0.3",
|
|
114
|
+
"vite": "7.1.12",
|
|
115
|
+
"vitest": "4.1.9"
|
|
116
|
+
},
|
|
117
|
+
"peerDependencies": {
|
|
118
|
+
"react": ">=16.0.0",
|
|
119
|
+
"react-dom": ">=16.0.0",
|
|
120
|
+
"use-intl": ">=3.0.0",
|
|
121
|
+
"vite": ">=4.0.0"
|
|
122
|
+
},
|
|
123
|
+
"peerDependenciesMeta": {
|
|
124
|
+
"vite": {
|
|
125
|
+
"optional": true
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"engines": {
|
|
129
|
+
"node": ">=14.18"
|
|
130
|
+
}
|
|
131
|
+
}
|