astro-intlayer 9.7.1 → 9.7.3
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/cjs/useDictionary.cjs.map +1 -1
- package/dist/esm/useDictionary.mjs.map +1 -1
- package/dist/types/client/index.d.ts +11 -0
- package/dist/types/format/useIntl.d.ts +1 -1
- package/dist/types/middleware.d.ts +1 -1
- package/dist/types/useDictionary.d.ts +1 -1
- package/dist/types/useDictionary.d.ts.map +1 -1
- package/dist/types/useIntlayer.d.ts +1 -1
- package/package.json +61 -61
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.cjs","names":["withInertOnChange","getDictionary","resolveDictionaryArgument","getRequestLocale"],"sources":["../../src/useDictionary.ts"],"sourcesContent":["import { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n type DeepTransformContent,\n getDictionary,\n type WithOnChange,\n} from 'vanilla-intlayer';\nimport { getRequestLocale } from './requestStorage';\nimport { withInertOnChange } from './withInertOnChange';\n\n/**\n * Transforms an imported dictionary (or qualified dictionary group) and returns\n * its content for the locale of the request being rendered, read from\n * `Astro.locals.intlayer`.\n *\n * The second argument is either a locale or a selector object\n * (`{ item }`, `{ variant }`, optionally with `locale`); it takes precedence\n * over the request locale.\n *\n * Same signature and content shape as the client-side hook this entry resolves\n * to in the browser (`vanilla-intlayer`).\n *\n * @example\n * ```astro\n * ---\n * import { useDictionary } from 'astro-intlayer';\n * import homeContent from '../content/home.content';\n *\n * const { title } = useDictionary(homeContent);\n * ---\n * ```\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends
|
|
1
|
+
{"version":3,"file":"useDictionary.cjs","names":["withInertOnChange","getDictionary","resolveDictionaryArgument","getRequestLocale"],"sources":["../../src/useDictionary.ts"],"sourcesContent":["import { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n type DeepTransformContent,\n getDictionary,\n type WithOnChange,\n} from 'vanilla-intlayer';\nimport { getRequestLocale } from './requestStorage';\nimport { withInertOnChange } from './withInertOnChange';\n\n/**\n * Transforms an imported dictionary (or qualified dictionary group) and returns\n * its content for the locale of the request being rendered, read from\n * `Astro.locals.intlayer`.\n *\n * The second argument is either a locale or a selector object\n * (`{ item }`, `{ variant }`, optionally with `locale`); it takes precedence\n * over the request locale.\n *\n * Same signature and content shape as the client-side hook this entry resolves\n * to in the browser (`vanilla-intlayer`).\n *\n * @example\n * ```astro\n * ---\n * import { useDictionary } from 'astro-intlayer';\n * import homeContent from '../content/home.content';\n *\n * const { title } = useDictionary(homeContent);\n * ---\n * ```\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends LocalesValues | DictionarySelectorForGroup<T> =\n DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): WithOnChange<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> =>\n withInertOnChange(\n getDictionary<T, A>(\n dictionary,\n // Selectors disabled project-wide (build-time flag) ⇒ the argument can\n // only be a locale, so the merge is dropped by the bundler.\n (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: getRequestLocale(),\n dictionaryKey: dictionary.key,\n })\n : (localeOrSelector ?? getRequestLocale())) as A\n )\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBAKX,YACA,qBAOAA,gDACEC,gCACE,YAGC,QAAQ,IAAI,iCAAiC,cAC1CC,gEAA0B;CACxB;CACA,eAAeC,wCAAiB;CAChC,eAAe,WAAW;AAC5B,CAAC,IACA,oBAAoBA,wCAAiB,CAC5C,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../src/useDictionary.ts"],"sourcesContent":["import { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n type DeepTransformContent,\n getDictionary,\n type WithOnChange,\n} from 'vanilla-intlayer';\nimport { getRequestLocale } from './requestStorage';\nimport { withInertOnChange } from './withInertOnChange';\n\n/**\n * Transforms an imported dictionary (or qualified dictionary group) and returns\n * its content for the locale of the request being rendered, read from\n * `Astro.locals.intlayer`.\n *\n * The second argument is either a locale or a selector object\n * (`{ item }`, `{ variant }`, optionally with `locale`); it takes precedence\n * over the request locale.\n *\n * Same signature and content shape as the client-side hook this entry resolves\n * to in the browser (`vanilla-intlayer`).\n *\n * @example\n * ```astro\n * ---\n * import { useDictionary } from 'astro-intlayer';\n * import homeContent from '../content/home.content';\n *\n * const { title } = useDictionary(homeContent);\n * ---\n * ```\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends
|
|
1
|
+
{"version":3,"file":"useDictionary.mjs","names":[],"sources":["../../src/useDictionary.ts"],"sourcesContent":["import { resolveDictionaryArgument } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n ResolveQualifiedDictionaryContent,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n ExtractSelectorLocale,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport {\n type DeepTransformContent,\n getDictionary,\n type WithOnChange,\n} from 'vanilla-intlayer';\nimport { getRequestLocale } from './requestStorage';\nimport { withInertOnChange } from './withInertOnChange';\n\n/**\n * Transforms an imported dictionary (or qualified dictionary group) and returns\n * its content for the locale of the request being rendered, read from\n * `Astro.locals.intlayer`.\n *\n * The second argument is either a locale or a selector object\n * (`{ item }`, `{ variant }`, optionally with `locale`); it takes precedence\n * over the request locale.\n *\n * Same signature and content shape as the client-side hook this entry resolves\n * to in the browser (`vanilla-intlayer`).\n *\n * @example\n * ```astro\n * ---\n * import { useDictionary } from 'astro-intlayer';\n * import homeContent from '../content/home.content';\n *\n * const { title } = useDictionary(homeContent);\n * ---\n * ```\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends LocalesValues | DictionarySelectorForGroup<T> =\n DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): WithOnChange<\n DeepTransformContent<\n ResolveQualifiedDictionaryContent<T, A>,\n ExtractSelectorLocale<A>\n >\n> =>\n withInertOnChange(\n getDictionary<T, A>(\n dictionary,\n // Selectors disabled project-wide (build-time flag) ⇒ the argument can\n // only be a locale, so the merge is dropped by the bundler.\n (process.env.INTLAYER_DICTIONARY_SELECTOR !== 'false'\n ? resolveDictionaryArgument({\n localeOrSelector,\n contextLocale: getRequestLocale(),\n dictionaryKey: dictionary.key,\n })\n : (localeOrSelector ?? getRequestLocale())) as A\n )\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBAKX,YACA,qBAOA,kBACE,cACE,YAGC,QAAQ,IAAI,iCAAiC,UAC1C,0BAA0B;CACxB;CACA,eAAe,iBAAiB;CAChC,eAAe,WAAW;AAC5B,CAAC,IACA,oBAAoB,iBAAiB,CAC5C,CACF"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `astro-intlayer` as loaded in the browser — client `<script>` blocks and
|
|
3
|
+
* framework islands.
|
|
4
|
+
*
|
|
5
|
+
* Selected by the `browser` export condition. It mirrors the server entry name
|
|
6
|
+
* for name, resolved to the client implementations of `vanilla-intlayer`, so
|
|
7
|
+
* `useIntlayer('key')` reads the request locale in the frontmatter and the
|
|
8
|
+
* client store in a `<script>` through one import path.
|
|
9
|
+
*
|
|
10
|
+
* The integration and the middleware are server-only and deliberately absent.
|
|
11
|
+
*/
|
|
1
12
|
import { DeepTransformContent, IntlayerNode, UseLocaleProps, UseLocaleResult, WithOnChange, getDictionary, getIntlayer, installIntlayer, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useDictionary, useDictionaryDynamic, useIntlayer, useLocale, useLocaleCookie, useLocaleStorage } from "vanilla-intlayer";
|
|
2
13
|
export { type DeepTransformContent, type IntlayerNode, type UseLocaleProps, type UseLocaleResult, type WithOnChange, getDictionary, getIntlayer, installIntlayer, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, useDictionary, useDictionaryDynamic, useIntlayer, useLocale, useLocaleCookie, useLocaleStorage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeclaredLocales } from "@intlayer/types/module_augmentation";
|
|
2
1
|
import { MiddlewareHandler } from "astro";
|
|
2
|
+
import { DeclaredLocales } from "@intlayer/types/module_augmentation";
|
|
3
3
|
/**
|
|
4
4
|
* Intlayer state stored in `Astro.locals.intlayer` by the {@link onRequest} middleware.
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeepTransformContent, WithOnChange } from "vanilla-intlayer";
|
|
2
1
|
import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
3
2
|
import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from "@intlayer/types/dictionary";
|
|
3
|
+
import { DeepTransformContent, WithOnChange } from "vanilla-intlayer";
|
|
4
4
|
/**
|
|
5
5
|
* Transforms an imported dictionary (or qualified dictionary group) and returns
|
|
6
6
|
* its content for the locale of the request being rendered, read from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;qBA0Ca,sBACL,UAAU,aAAa,gCACvB,
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":[],"sources":["../../src/useDictionary.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;qBA0Ca,sBACL,UAAU,aAAa,gCACvB,UAAU,gBAAgB,2BAA2B,KACzD,iBAAe,YAEL,GAAC,mBACM,MAClB,aACD,qBACE,kCAAkC,GAAG,IACrC,sBAAsB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeepTransformContent, WithOnChange } from "vanilla-intlayer";
|
|
2
1
|
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from "@intlayer/types/module_augmentation";
|
|
2
|
+
import { DeepTransformContent, WithOnChange } from "vanilla-intlayer";
|
|
3
3
|
/**
|
|
4
4
|
* Picks one dictionary by its key and returns its content for the locale of
|
|
5
5
|
* the request being rendered, read from `Astro.locals.intlayer`.
|
package/package.json
CHANGED
|
@@ -1,30 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-intlayer",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Astro applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"
|
|
8
|
-
"internationalization",
|
|
9
|
-
"i18n",
|
|
10
|
-
"typescript",
|
|
7
|
+
"a11y",
|
|
11
8
|
"astro",
|
|
12
|
-
"astro-integration",
|
|
13
9
|
"astro-component",
|
|
14
|
-
"
|
|
15
|
-
"devtools",
|
|
10
|
+
"astro-integration",
|
|
16
11
|
"astro-loader",
|
|
12
|
+
"devtools",
|
|
13
|
+
"i18n",
|
|
14
|
+
"internationalization",
|
|
15
|
+
"intlayer",
|
|
17
16
|
"tooling",
|
|
18
|
-
"
|
|
17
|
+
"typescript",
|
|
18
|
+
"withastro"
|
|
19
19
|
],
|
|
20
20
|
"homepage": "https://intlayer.org",
|
|
21
21
|
"bugs": {
|
|
22
22
|
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
23
23
|
},
|
|
24
|
-
"repository": {
|
|
25
|
-
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
27
|
-
},
|
|
28
24
|
"license": "Apache-2.0",
|
|
29
25
|
"author": {
|
|
30
26
|
"name": "Aymeric PINEAU",
|
|
@@ -37,7 +33,46 @@
|
|
|
37
33
|
"url": "https://github.com/aymericzip"
|
|
38
34
|
}
|
|
39
35
|
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"./dist",
|
|
42
|
+
"./package.json"
|
|
43
|
+
],
|
|
40
44
|
"sideEffects": false,
|
|
45
|
+
"main": "dist/cjs/index.cjs",
|
|
46
|
+
"module": "dist/esm/index.mjs",
|
|
47
|
+
"types": "dist/types/index.d.ts",
|
|
48
|
+
"typesVersions": {
|
|
49
|
+
"*": {
|
|
50
|
+
"client": [
|
|
51
|
+
"./dist/types/client/index.d.ts"
|
|
52
|
+
],
|
|
53
|
+
"client/locale-redirect": [
|
|
54
|
+
"./dist/types/client/localeRedirect.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"format": [
|
|
57
|
+
"./dist/types/format/index.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"html": [
|
|
60
|
+
"./dist/types/html/index.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"markdown": [
|
|
63
|
+
"./dist/types/markdown/index.d.ts"
|
|
64
|
+
],
|
|
65
|
+
"middleware": [
|
|
66
|
+
"./dist/types/middleware.d.ts"
|
|
67
|
+
],
|
|
68
|
+
"package.json": [
|
|
69
|
+
"./package.json"
|
|
70
|
+
],
|
|
71
|
+
"integration": [
|
|
72
|
+
"./dist/types/integration.d.ts"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
41
76
|
"exports": {
|
|
42
77
|
".": {
|
|
43
78
|
"types": "./dist/types/index.d.ts",
|
|
@@ -113,50 +148,15 @@
|
|
|
113
148
|
},
|
|
114
149
|
"./package.json": "./package.json"
|
|
115
150
|
},
|
|
116
|
-
"main": "dist/cjs/index.cjs",
|
|
117
|
-
"module": "dist/esm/index.mjs",
|
|
118
|
-
"types": "dist/types/index.d.ts",
|
|
119
|
-
"typesVersions": {
|
|
120
|
-
"*": {
|
|
121
|
-
"client": [
|
|
122
|
-
"./dist/types/client/index.d.ts"
|
|
123
|
-
],
|
|
124
|
-
"client/locale-redirect": [
|
|
125
|
-
"./dist/types/client/localeRedirect.d.ts"
|
|
126
|
-
],
|
|
127
|
-
"format": [
|
|
128
|
-
"./dist/types/format/index.d.ts"
|
|
129
|
-
],
|
|
130
|
-
"html": [
|
|
131
|
-
"./dist/types/html/index.d.ts"
|
|
132
|
-
],
|
|
133
|
-
"markdown": [
|
|
134
|
-
"./dist/types/markdown/index.d.ts"
|
|
135
|
-
],
|
|
136
|
-
"middleware": [
|
|
137
|
-
"./dist/types/middleware.d.ts"
|
|
138
|
-
],
|
|
139
|
-
"package.json": [
|
|
140
|
-
"./package.json"
|
|
141
|
-
],
|
|
142
|
-
"integration": [
|
|
143
|
-
"./dist/types/integration.d.ts"
|
|
144
|
-
]
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
"files": [
|
|
148
|
-
"./dist",
|
|
149
|
-
"./package.json"
|
|
150
|
-
],
|
|
151
151
|
"scripts": {
|
|
152
152
|
"build": "tsdown --config tsdown.config.ts",
|
|
153
153
|
"build:ci": "tsdown --config tsdown.config.ts",
|
|
154
154
|
"clean": "bun --bun rimraf ./dist .turbo",
|
|
155
155
|
"dev": "tsdown --config tsdown.config.ts --watch",
|
|
156
|
-
"format": "
|
|
157
|
-
"format:fix": "
|
|
158
|
-
"lint": "
|
|
159
|
-
"lint:fix": "
|
|
156
|
+
"format": "oxfmt --check .",
|
|
157
|
+
"format:fix": "oxfmt .",
|
|
158
|
+
"lint": "oxlint .",
|
|
159
|
+
"lint:fix": "oxlint --fix .",
|
|
160
160
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
161
161
|
"publish": "bun publish || true",
|
|
162
162
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
@@ -167,22 +167,22 @@
|
|
|
167
167
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
168
168
|
},
|
|
169
169
|
"dependencies": {
|
|
170
|
-
"@intlayer/config": "9.7.
|
|
171
|
-
"@intlayer/core": "9.7.
|
|
172
|
-
"@intlayer/engine": "9.7.
|
|
173
|
-
"@intlayer/types": "9.7.
|
|
174
|
-
"vanilla-intlayer": "9.7.
|
|
175
|
-
"vite-intlayer": "9.7.
|
|
170
|
+
"@intlayer/config": "9.7.3",
|
|
171
|
+
"@intlayer/core": "9.7.3",
|
|
172
|
+
"@intlayer/engine": "9.7.3",
|
|
173
|
+
"@intlayer/types": "9.7.3",
|
|
174
|
+
"vanilla-intlayer": "9.7.3",
|
|
175
|
+
"vite-intlayer": "9.7.3"
|
|
176
176
|
},
|
|
177
177
|
"devDependencies": {
|
|
178
|
-
"@intlayer/dictionaries-entry": "9.7.
|
|
178
|
+
"@intlayer/dictionaries-entry": "9.7.3",
|
|
179
179
|
"@types/node": "^26",
|
|
180
180
|
"@utils/ts-config": "1.0.4",
|
|
181
181
|
"@utils/ts-config-types": "1.0.4",
|
|
182
182
|
"@utils/tsdown-config": "1.0.4",
|
|
183
183
|
"fast-glob": "3.3.3",
|
|
184
|
-
"rimraf": "6.1.
|
|
185
|
-
"tsdown": "0.23.
|
|
184
|
+
"rimraf": "6.1.4",
|
|
185
|
+
"tsdown": "0.23.7",
|
|
186
186
|
"typescript": "7.0.2",
|
|
187
187
|
"vitest": "5.1.0"
|
|
188
188
|
},
|