@intlify/unplugin-vue-i18n 6.0.3 → 6.0.4
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 +41 -28
- package/lib/index.cjs +1 -7
- package/lib/index.mjs +1 -7
- package/lib/types.d.cts +0 -1
- package/lib/types.d.mts +0 -1
- package/lib/types.d.ts +0 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -280,11 +280,17 @@ About details, See the [here](https://vue-i18n.intlify.dev/guide/advanced/optimi
|
|
|
280
280
|
|
|
281
281
|
If nothing is specified for this option, i.e. `undefined`, nothing is done to the resource in the above format.
|
|
282
282
|
|
|
283
|
-
> [!WARNING]
|
|
283
|
+
> [!WARNING]
|
|
284
|
+
>
|
|
285
|
+
> `json` resources matches this option, it will be handled **before the internal json plugin of bundler, and will not be processed afterwards**, else the option doesn't match, the bundler side will handle.
|
|
284
286
|
|
|
285
|
-
> [!WARNING]
|
|
287
|
+
> [!WARNING]
|
|
288
|
+
>
|
|
289
|
+
> `yaml` resources don't support multi documentation with `|`, alias with `&` and `*`, tags with `! `, `@`, etc. Only simple data structures.
|
|
286
290
|
|
|
287
|
-
> [!WARNING]
|
|
291
|
+
> [!WARNING]
|
|
292
|
+
>
|
|
293
|
+
> `js` and `ts` resources are set **simple export (`export default`) as locale messages object, as default**.
|
|
288
294
|
|
|
289
295
|
```js
|
|
290
296
|
export default {
|
|
@@ -303,22 +309,22 @@ If you need to use programmatically dynamic resource construction, you would be
|
|
|
303
309
|
- **Type:** `string`
|
|
304
310
|
- **Default:** `'vue-i18n'`
|
|
305
311
|
|
|
306
|
-
|
|
307
|
-
|
|
312
|
+
> [!NOTE]
|
|
313
|
+
> This options is supported from v5.1.0, and works with vue-i18n v10 and later.
|
|
308
314
|
|
|
309
|
-
|
|
315
|
+
Bundle target vue-i18n module. You can specify either `‘vue-i18n’` or `‘petite-vue-i18n’`.
|
|
310
316
|
|
|
311
|
-
|
|
317
|
+
The default is `'vue-i18n'`, and the following installed in node_modules will be bundled.
|
|
312
318
|
|
|
313
|
-
|
|
314
|
-
|
|
319
|
+
- development: `vue-i18n.esm-bundler.js`
|
|
320
|
+
- production: `vue-i18n.runtime.esm-bundler.js`
|
|
315
321
|
|
|
316
|
-
|
|
322
|
+
In the case of `‘petite-vue-i18n’`, the following installed in node_modules will be bundled.
|
|
317
323
|
|
|
318
|
-
|
|
319
|
-
|
|
324
|
+
- development: `petite-vue-i18n.esm-bundler.js`
|
|
325
|
+
- production: `petite-vue-i18n.runtime.esm-bundler.js`
|
|
320
326
|
|
|
321
|
-
|
|
327
|
+
If you are using petite-vue-i18n, you will need to set this value.
|
|
322
328
|
|
|
323
329
|
### `strictMessage`
|
|
324
330
|
|
|
@@ -360,7 +366,7 @@ If you need to use programmatically dynamic resource construction, you would be
|
|
|
360
366
|
}
|
|
361
367
|
```
|
|
362
368
|
|
|
363
|
-
If you fetch some resources from the backend, the data **must be pre-compiled** for production.
|
|
369
|
+
If you fetch some resources from the backend, the data **must be pre-compiled** for production. example is [here](https://github.com/intlify/vue-i18n-next/tree/master/examples/backend).
|
|
364
370
|
|
|
365
371
|
### `jitCompilation`
|
|
366
372
|
|
|
@@ -368,15 +374,15 @@ If you need to use programmatically dynamic resource construction, you would be
|
|
|
368
374
|
- **Default:** `true`
|
|
369
375
|
|
|
370
376
|
> [!IMPORTANT]
|
|
371
|
-
> 'jitCompilation' option is
|
|
377
|
+
> 'jitCompilation' option is deprecated in v5.
|
|
372
378
|
> This option will be supported with vue-i18n until v9 latest version.
|
|
373
379
|
|
|
374
|
-
Whether locale
|
|
380
|
+
Whether locale messages should be compiled by JIT (Just in Time) compilation with vue-i18n's message compiler.
|
|
375
381
|
|
|
376
|
-
JIT compilation has been supported since vue-i18n v9.3. This means that since v9 was released until now, the message compiler compiles to executable JavaScript code, however it did not work in the CSP environment. Also, since this was an AOT (Ahead of Time) compilation, it was not possible to dynamically retrieve locale messages from the back-end Database and compose locale
|
|
382
|
+
JIT compilation has been supported since vue-i18n v9.3. This means that since v9 was released until now, the message compiler compiles to executable JavaScript code, however it did not work in the CSP environment. Also, since this was an AOT (Ahead of Time) compilation, it was not possible to dynamically retrieve locale messages from the back-end Database and compose locale messages with programatic.
|
|
377
383
|
|
|
378
384
|
> [!WARNING]
|
|
379
|
-
> Enabling JIT compilation causes the message compiler to generate AST objects for locale
|
|
385
|
+
> Enabling JIT compilation causes the message compiler to generate AST objects for locale messages instead of JavaScript code. If you pre-compile locale messages with a tool such as the [Intlify CLI](https://github.com/intlify/cli) and import them dynamically, you need to rebuild that resource.
|
|
380
386
|
|
|
381
387
|
About JIT compilation, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation)
|
|
382
388
|
|
|
@@ -433,6 +439,9 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
433
439
|
|
|
434
440
|
For more details, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
|
|
435
441
|
|
|
442
|
+
> [!CAUTION]
|
|
443
|
+
> This option will be removed in v7
|
|
444
|
+
|
|
436
445
|
### `fullInstall`
|
|
437
446
|
|
|
438
447
|
- **Type:** `boolean`
|
|
@@ -440,7 +449,7 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
440
449
|
|
|
441
450
|
Whether to install the full set of APIs, components, etc. provided by Vue I18n. By default, all of them will be installed.
|
|
442
451
|
|
|
443
|
-
If `false` is specified, **
|
|
452
|
+
If `false` is specified, **build-in components and directive will not be installed in vue and will be tree-shaken.**
|
|
444
453
|
|
|
445
454
|
For more details, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#reduce-bundle-size-with-feature-build-flags)
|
|
446
455
|
|
|
@@ -597,8 +606,10 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
597
606
|
|
|
598
607
|
This option that to use i18n custom blocks in `vue-class-component`.
|
|
599
608
|
|
|
600
|
-
|
|
601
|
-
|
|
609
|
+
> [!IMPORTANT]
|
|
610
|
+
>
|
|
611
|
+
> `useClassComponent` option is deprecated in v5.
|
|
612
|
+
> This option will be supported with vue-i18n until v9 latest version.
|
|
602
613
|
|
|
603
614
|
### `onlyLocales`
|
|
604
615
|
|
|
@@ -614,10 +625,12 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
614
625
|
|
|
615
626
|
Whether to use the import name of `petite-vue-i18n` with the same import name as vue-i18n (`import { xxx } from 'vue-i18n'`).
|
|
616
627
|
|
|
617
|
-
This option allows a smooth migration from `petite-vue-i18n` to `vue-i18n` and allows progressive
|
|
628
|
+
This option allows a smooth migration from `petite-vue-i18n` to `vue-i18n` and allows progressive enhancement.
|
|
618
629
|
|
|
619
|
-
|
|
620
|
-
|
|
630
|
+
> [!IMPORTANT]
|
|
631
|
+
>
|
|
632
|
+
> `useVueI18nImportName` option is deprecated in v5.
|
|
633
|
+
> This option will be supported with vue-i18n until v9 latest version.
|
|
621
634
|
|
|
622
635
|
### `optimizeTranslationDirective`
|
|
623
636
|
|
|
@@ -628,8 +641,8 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
628
641
|
|
|
629
642
|
If you want to put it manually, you can specify the signature of the translation function as a string or a string array.
|
|
630
643
|
|
|
631
|
-
|
|
632
|
-
|
|
644
|
+
> [!WARNING]
|
|
645
|
+
> About for manually signature, see the details [vue-i18n-extensions API docs](https://github.com/intlify/vue-i18n-extensions/blob/next/docs/%40intlify/vue-i18n-extensions-api.md#translationsignatures) and [usecase from vue-i18n-extensions PR](https://github.com/intlify/vue-i18n-extensions/pull/217/files#diff-3fb9543f91e011d4b0dc9beff44082fe1a99c9eab70c1afab23c3c34352b7c38R121-R200)
|
|
633
646
|
|
|
634
647
|
### `transformI18nBlock`
|
|
635
648
|
|
|
@@ -681,8 +694,8 @@ If do you will use this option, you need to enable `jitCompilation` option.
|
|
|
681
694
|
</i18n>
|
|
682
695
|
```
|
|
683
696
|
|
|
684
|
-
|
|
685
|
-
|
|
697
|
+
> [!IMPORTANT]
|
|
698
|
+
> The function **must** return a string or the build will fail.
|
|
686
699
|
|
|
687
700
|
## 📜 Changelog
|
|
688
701
|
|
package/lib/index.cjs
CHANGED
|
@@ -84,7 +84,6 @@ function resolveOptions(options) {
|
|
|
84
84
|
const globalSFCScope = !!options.globalSFCScope;
|
|
85
85
|
const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
86
86
|
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
87
|
-
const compositionOnly = moduleType === "vue-i18n" ? shared.isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
88
87
|
const fullInstall = moduleType === "vue-i18n" ? shared.isBoolean(options.fullInstall) ? options.fullInstall : true : false;
|
|
89
88
|
const ssrBuild = !!options.ssr;
|
|
90
89
|
const allowDynamic = !!options.allowDynamic;
|
|
@@ -103,7 +102,6 @@ function resolveOptions(options) {
|
|
|
103
102
|
globalSFCScope,
|
|
104
103
|
runtimeOnly,
|
|
105
104
|
dropMessageCompiler,
|
|
106
|
-
compositionOnly,
|
|
107
105
|
fullInstall,
|
|
108
106
|
ssrBuild,
|
|
109
107
|
allowDynamic,
|
|
@@ -193,7 +191,6 @@ function resourcePlugin({
|
|
|
193
191
|
globalSFCScope,
|
|
194
192
|
runtimeOnly,
|
|
195
193
|
dropMessageCompiler,
|
|
196
|
-
compositionOnly,
|
|
197
194
|
fullInstall,
|
|
198
195
|
ssrBuild,
|
|
199
196
|
strictMessage,
|
|
@@ -203,7 +200,7 @@ function resourcePlugin({
|
|
|
203
200
|
}, meta) {
|
|
204
201
|
const filter = pluginutils.createFilter(include, exclude);
|
|
205
202
|
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
206
|
-
return `${module}/dist/${module}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.
|
|
203
|
+
return `${module}/dist/${module}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.js"}`;
|
|
207
204
|
};
|
|
208
205
|
let isProduction = false;
|
|
209
206
|
let sourceMap = false;
|
|
@@ -228,7 +225,6 @@ function resourcePlugin({
|
|
|
228
225
|
config() {
|
|
229
226
|
const defineConfig = {
|
|
230
227
|
define: {
|
|
231
|
-
__VUE_I18N_LEGACY_API__: !compositionOnly,
|
|
232
228
|
__VUE_I18N_FULL_INSTALL__: fullInstall,
|
|
233
229
|
__INTLIFY_DROP_MESSAGE_COMPILER__: dropMessageCompiler,
|
|
234
230
|
__VUE_I18N_PROD_DEVTOOLS__: false
|
|
@@ -356,12 +352,10 @@ function resourcePlugin({
|
|
|
356
352
|
if (webpack) {
|
|
357
353
|
compiler.options.plugins.push(
|
|
358
354
|
new webpack.DefinePlugin({
|
|
359
|
-
__VUE_I18N_LEGACY_API__: JSON.stringify(compositionOnly),
|
|
360
355
|
__VUE_I18N_FULL_INSTALL__: JSON.stringify(fullInstall),
|
|
361
356
|
__INTLIFY_PROD_DEVTOOLS__: "false"
|
|
362
357
|
})
|
|
363
358
|
);
|
|
364
|
-
debug$2(`set __VUE_I18N_LEGACY_API__ is '${compositionOnly}'`);
|
|
365
359
|
debug$2(`set __VUE_I18N_FULL_INSTALL__ is '${fullInstall}'`);
|
|
366
360
|
} else {
|
|
367
361
|
debug$2("ignore vue-i18n feature flags with webpack.DefinePlugin");
|
package/lib/index.mjs
CHANGED
|
@@ -72,7 +72,6 @@ function resolveOptions(options) {
|
|
|
72
72
|
const globalSFCScope = !!options.globalSFCScope;
|
|
73
73
|
const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
|
|
74
74
|
const dropMessageCompiler = !!options.dropMessageCompiler;
|
|
75
|
-
const compositionOnly = moduleType === "vue-i18n" ? isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
|
|
76
75
|
const fullInstall = moduleType === "vue-i18n" ? isBoolean(options.fullInstall) ? options.fullInstall : true : false;
|
|
77
76
|
const ssrBuild = !!options.ssr;
|
|
78
77
|
const allowDynamic = !!options.allowDynamic;
|
|
@@ -91,7 +90,6 @@ function resolveOptions(options) {
|
|
|
91
90
|
globalSFCScope,
|
|
92
91
|
runtimeOnly,
|
|
93
92
|
dropMessageCompiler,
|
|
94
|
-
compositionOnly,
|
|
95
93
|
fullInstall,
|
|
96
94
|
ssrBuild,
|
|
97
95
|
allowDynamic,
|
|
@@ -181,7 +179,6 @@ function resourcePlugin({
|
|
|
181
179
|
globalSFCScope,
|
|
182
180
|
runtimeOnly,
|
|
183
181
|
dropMessageCompiler,
|
|
184
|
-
compositionOnly,
|
|
185
182
|
fullInstall,
|
|
186
183
|
ssrBuild,
|
|
187
184
|
strictMessage,
|
|
@@ -191,7 +188,7 @@ function resourcePlugin({
|
|
|
191
188
|
}, meta) {
|
|
192
189
|
const filter = createFilter(include, exclude);
|
|
193
190
|
const getVueI18nAliasPath = ({ ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
|
|
194
|
-
return `${module}/dist/${module}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.
|
|
191
|
+
return `${module}/dist/${module}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.js"}`;
|
|
195
192
|
};
|
|
196
193
|
let isProduction = false;
|
|
197
194
|
let sourceMap = false;
|
|
@@ -216,7 +213,6 @@ function resourcePlugin({
|
|
|
216
213
|
config() {
|
|
217
214
|
const defineConfig = {
|
|
218
215
|
define: {
|
|
219
|
-
__VUE_I18N_LEGACY_API__: !compositionOnly,
|
|
220
216
|
__VUE_I18N_FULL_INSTALL__: fullInstall,
|
|
221
217
|
__INTLIFY_DROP_MESSAGE_COMPILER__: dropMessageCompiler,
|
|
222
218
|
__VUE_I18N_PROD_DEVTOOLS__: false
|
|
@@ -344,12 +340,10 @@ function resourcePlugin({
|
|
|
344
340
|
if (webpack) {
|
|
345
341
|
compiler.options.plugins.push(
|
|
346
342
|
new webpack.DefinePlugin({
|
|
347
|
-
__VUE_I18N_LEGACY_API__: JSON.stringify(compositionOnly),
|
|
348
343
|
__VUE_I18N_FULL_INSTALL__: JSON.stringify(fullInstall),
|
|
349
344
|
__INTLIFY_PROD_DEVTOOLS__: "false"
|
|
350
345
|
})
|
|
351
346
|
);
|
|
352
|
-
debug$2(`set __VUE_I18N_LEGACY_API__ is '${compositionOnly}'`);
|
|
353
347
|
debug$2(`set __VUE_I18N_FULL_INSTALL__ is '${fullInstall}'`);
|
|
354
348
|
} else {
|
|
355
349
|
debug$2("ignore vue-i18n feature flags with webpack.DefinePlugin");
|
package/lib/types.d.cts
CHANGED
package/lib/types.d.mts
CHANGED
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlify/unplugin-vue-i18n",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.0.
|
|
4
|
+
"version": "6.0.4",
|
|
5
5
|
"description": "unplugin for Vue I18n",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "kazuya kawaguchi",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@eslint-community/eslint-utils": "^4.4.0",
|
|
28
|
-
"@intlify/bundle-utils": "^10.0.
|
|
29
|
-
"@intlify/shared": "
|
|
28
|
+
"@intlify/bundle-utils": "^10.0.1",
|
|
29
|
+
"@intlify/shared": "^11.1.2",
|
|
30
30
|
"@intlify/vue-i18n-extensions": "^8.0.0",
|
|
31
31
|
"@rollup/pluginutils": "^5.1.0",
|
|
32
32
|
"@typescript-eslint/scope-manager": "^8.13.0",
|