@intlify/unplugin-vue-i18n 1.5.0 → 1.6.0

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
@@ -281,13 +281,13 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
281
281
 
282
282
  If nothing is specified for this option, i.e. `undefined`, nothing is done to the resource in the above format.
283
283
 
284
- > ⚠️ NOTE:
284
+ > ⚠️ NOTE:
285
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.
286
286
 
287
- > ⚠️ NOTE:
287
+ > ⚠️ NOTE:
288
288
  `yaml` resources don't support multi documentation with `|`, alias with `&` and `*`, tags with `! `, `@`, etc. Only simple data structures.
289
289
 
290
- > ⚠️ NOTE:
290
+ > ⚠️ NOTE:
291
291
  `js` and `ts` resources are set **simple export (`export default`) as locale messages object, as default**.
292
292
 
293
293
  ```js
@@ -299,7 +299,7 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
299
299
 
300
300
  If you need to use programmatically dynamic resource construction, you would be enable `allowDynamic` option. about details, see the section.
301
301
 
302
- > ⚠️ NOTE:
302
+ > ⚠️ NOTE:
303
303
  If you use the `js` and `ts` resources formats, set the paths, so your application code is not targeted. We recommend that resources be isolated from the application code.
304
304
 
305
305
 
@@ -354,12 +354,12 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
354
354
 
355
355
  Whether locale mesages should be compiled by JIT (Just in Time) compilation with vue-i18n's message compiler.
356
356
 
357
- > ⚠️ NOTE:
357
+ > ⚠️ NOTE:
358
358
  This option works with vue-i18n v9.3 and later.
359
359
 
360
360
  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.
361
361
 
362
- > ⚠️ NOTE:
362
+ > ⚠️ NOTE:
363
363
  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.
364
364
 
365
365
  About JIT compilation, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation)
@@ -373,10 +373,10 @@ Whether to tree-shake message compiler when we will be bundling.
373
373
 
374
374
  If do you will use this option, you need to enable `jitCompilation` option.
375
375
 
376
- > ⚠️ NOTE:
376
+ > ⚠️ NOTE:
377
377
  This option works with vue-i18n v9.3 and later.
378
378
 
379
- > ⚠️ NOTE:
379
+ > ⚠️ NOTE:
380
380
  If you enable this option, **you should check resources in your application are pre-compiled with this plugin.** If you will be loading resources dynamically from the back-end via the API, enabling this option do not work because there is not message compiler.
381
381
 
382
382
  ### `ssr`
@@ -386,7 +386,7 @@ If you enable this option, **you should check resources in your application are
386
386
 
387
387
  Whether to bundle vue-i18n module for SSR at build time
388
388
 
389
- > ⚠️ NOTE:
389
+ > ⚠️ NOTE:
390
390
  This option works with vue-i18n v9.4 and later.
391
391
 
392
392
  ### `runtimeOnly`
@@ -395,7 +395,7 @@ If you enable this option, **you should check resources in your application are
395
395
  - **Default:** `true`
396
396
 
397
397
  Whether or not to automatically use Vue I18n **runtime-only** in production build, set `vue-i18n.runtime.esm-bundler.js` in the `vue-i18n` field of bundler config, the below:
398
-
398
+
399
399
  ```
400
400
  - vite config: `resolve.alias`
401
401
  - webpack config: `resolve.alias`
@@ -547,6 +547,24 @@ If you enable this option, **you should check resources in your application are
547
547
 
548
548
  > ⚠️ Note that if you set `bridge: true`, the bundle size will increase. It is recommended to disable this mode after the migration from vue-i18n@v8.26 to vue-i18n@v9.x is completed.
549
549
 
550
+ ### `legacy`
551
+
552
+ - **Type:** `boolean`
553
+ - **Default:** `false`
554
+
555
+ This option supports Vue I18n v8.x compatibility for resources in i18n custom blocks.
556
+
557
+ > ⚠️ To work for Vue 2.7, the value of `vueVersion` must be set to `'v2.7'`.
558
+
559
+ ### `vueVersion`
560
+
561
+ - **Type:** `string`
562
+ - **Default:** `undefined`
563
+
564
+ The version of Vue that will be used by Vue I18n. This option is enabled when the `legacy` option is `true`.
565
+
566
+ Available values are `'v2.6'` and `'v2.7'`.
567
+
550
568
  ### `esm`
551
569
 
552
570
  - **Type:** `boolean`
package/lib/index.cjs CHANGED
@@ -131,6 +131,9 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
131
131
  const useClassComponent = !!options.useClassComponent;
132
132
  const bridge = !!options.bridge;
133
133
  debug("bridge", bridge);
134
+ const legacy = !!options.legacy;
135
+ debug("legacy", legacy);
136
+ const vueVersion = shared.isString(options.vueVersion) ? options.vueVersion : void 0;
134
137
  const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
135
138
  debug("runtimeOnly", runtimeOnly);
136
139
  const jitCompilation = !!options.jitCompilation;
@@ -307,6 +310,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
307
310
  strictMessage,
308
311
  escapeHtml,
309
312
  bridge,
313
+ legacy,
314
+ vueVersion,
310
315
  jit: jitCompilation,
311
316
  onlyLocales,
312
317
  exportESM: esm,
@@ -522,6 +527,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
522
527
  isGlobal: globalSFCScope,
523
528
  useClassComponent,
524
529
  bridge,
530
+ legacy,
531
+ vueVersion,
525
532
  jit: jitCompilation,
526
533
  strictMessage,
527
534
  escapeHtml,
@@ -690,6 +697,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
690
697
  forceStringify = false,
691
698
  isGlobal = false,
692
699
  bridge = false,
700
+ legacy = false,
701
+ vueVersion = "v2.6",
693
702
  onlyLocales = [],
694
703
  exportESM = true,
695
704
  useClassComponent = false,
@@ -709,6 +718,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
709
718
  strictMessage,
710
719
  escapeHtml,
711
720
  bridge,
721
+ legacy,
722
+ vueVersion,
712
723
  jit,
713
724
  onlyLocales,
714
725
  exportESM,
package/lib/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { PluginOptions } from './types.cjs';
3
3
  export { SFCLangFormat } from './types.cjs';
4
+ import '@intlify/bundle-utils';
4
5
 
5
6
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
6
7
 
package/lib/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { PluginOptions } from './types.mjs';
3
3
  export { SFCLangFormat } from './types.mjs';
4
+ import '@intlify/bundle-utils';
4
5
 
5
6
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
6
7
 
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as _unplugin from 'unplugin';
2
2
  import { PluginOptions } from './types.js';
3
3
  export { SFCLangFormat } from './types.js';
4
+ import '@intlify/bundle-utils';
4
5
 
5
6
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
6
7
 
package/lib/index.mjs CHANGED
@@ -119,6 +119,9 @@ const unplugin = createUnplugin((options = {}, meta) => {
119
119
  const useClassComponent = !!options.useClassComponent;
120
120
  const bridge = !!options.bridge;
121
121
  debug("bridge", bridge);
122
+ const legacy = !!options.legacy;
123
+ debug("legacy", legacy);
124
+ const vueVersion = isString(options.vueVersion) ? options.vueVersion : void 0;
122
125
  const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
123
126
  debug("runtimeOnly", runtimeOnly);
124
127
  const jitCompilation = !!options.jitCompilation;
@@ -295,6 +298,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
295
298
  strictMessage,
296
299
  escapeHtml,
297
300
  bridge,
301
+ legacy,
302
+ vueVersion,
298
303
  jit: jitCompilation,
299
304
  onlyLocales,
300
305
  exportESM: esm,
@@ -510,6 +515,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
510
515
  isGlobal: globalSFCScope,
511
516
  useClassComponent,
512
517
  bridge,
518
+ legacy,
519
+ vueVersion,
513
520
  jit: jitCompilation,
514
521
  strictMessage,
515
522
  escapeHtml,
@@ -678,6 +685,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
678
685
  forceStringify = false,
679
686
  isGlobal = false,
680
687
  bridge = false,
688
+ legacy = false,
689
+ vueVersion = "v2.6",
681
690
  onlyLocales = [],
682
691
  exportESM = true,
683
692
  useClassComponent = false,
@@ -697,6 +706,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
697
706
  strictMessage,
698
707
  escapeHtml,
699
708
  bridge,
709
+ legacy,
710
+ vueVersion,
700
711
  jit,
701
712
  onlyLocales,
702
713
  exportESM,
package/lib/types.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import { CodeGenOptions } from '@intlify/bundle-utils';
2
+
1
3
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
4
  interface PluginOptions {
3
5
  include?: string | string[];
@@ -14,6 +16,8 @@ interface PluginOptions {
14
16
  defaultSFCLang?: SFCLangFormat;
15
17
  globalSFCScope?: boolean;
16
18
  bridge?: boolean;
19
+ legacy?: boolean;
20
+ vueVersion?: CodeGenOptions['vueVersion'];
17
21
  useClassComponent?: boolean;
18
22
  useVueI18nImportName?: boolean;
19
23
  strictMessage?: boolean;
package/lib/types.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import { CodeGenOptions } from '@intlify/bundle-utils';
2
+
1
3
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
4
  interface PluginOptions {
3
5
  include?: string | string[];
@@ -14,6 +16,8 @@ interface PluginOptions {
14
16
  defaultSFCLang?: SFCLangFormat;
15
17
  globalSFCScope?: boolean;
16
18
  bridge?: boolean;
19
+ legacy?: boolean;
20
+ vueVersion?: CodeGenOptions['vueVersion'];
17
21
  useClassComponent?: boolean;
18
22
  useVueI18nImportName?: boolean;
19
23
  strictMessage?: boolean;
package/lib/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { CodeGenOptions } from '@intlify/bundle-utils';
2
+
1
3
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
4
  interface PluginOptions {
3
5
  include?: string | string[];
@@ -14,6 +16,8 @@ interface PluginOptions {
14
16
  defaultSFCLang?: SFCLangFormat;
15
17
  globalSFCScope?: boolean;
16
18
  bridge?: boolean;
19
+ legacy?: boolean;
20
+ vueVersion?: CodeGenOptions['vueVersion'];
17
21
  useClassComponent?: boolean;
18
22
  useVueI18nImportName?: boolean;
19
23
  strictMessage?: boolean;
package/lib/vite.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.cjs';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
5
6
 
package/lib/vite.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.mjs';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
5
6
 
package/lib/vite.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.js';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
5
6
 
package/lib/webpack.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.cjs';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
5
6
 
package/lib/webpack.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.mjs';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
5
6
 
package/lib/webpack.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.js';
3
+ import '@intlify/bundle-utils';
3
4
 
4
5
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
5
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",