@intlify/unplugin-vue-i18n 6.0.4 → 6.0.5

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