@intlify/unplugin-vue-i18n 1.1.0 → 1.3.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
@@ -549,6 +549,13 @@ If you enable this option, **you should check resources in your application are
549
549
 
550
550
  This option that to use i18n custom blocks in `vue-class-component`.
551
551
 
552
+ ### `onlyLocales`
553
+
554
+ - **Type:** `string | string[]`
555
+ - **Default:** `[]`
556
+
557
+ By using it you can exclude from the bundle those localizations that are not specified in this option.
558
+
552
559
  ### `useVueI18nImportName` (Experimental)
553
560
 
554
561
  - **Type:** `boolean`
package/lib/index.cjs CHANGED
@@ -109,6 +109,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
109
109
  if (!["vite", "webpack"].includes(meta.framework)) {
110
110
  raiseError(`This plugin is supported 'vite' and 'webpack' only`);
111
111
  }
112
+ let onlyLocales = [];
113
+ if (options.onlyLocales) {
114
+ onlyLocales = Array.isArray(options.onlyLocales) ? options.onlyLocales : [options.onlyLocales];
115
+ }
112
116
  let include = options.include;
113
117
  let exclude = null;
114
118
  if (include) {
@@ -290,6 +294,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
290
294
  escapeHtml,
291
295
  bridge,
292
296
  jit: jitCompilation,
297
+ onlyLocales,
293
298
  exportESM: esm,
294
299
  forceStringify
295
300
  }
@@ -458,6 +463,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
458
463
  escapeHtml,
459
464
  bridge,
460
465
  jit: jitCompilation,
466
+ onlyLocales,
461
467
  exportESM: esm,
462
468
  forceStringify
463
469
  }
@@ -501,6 +507,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
501
507
  jit: jitCompilation,
502
508
  strictMessage,
503
509
  escapeHtml,
510
+ onlyLocales,
504
511
  exportESM: esm,
505
512
  forceStringify
506
513
  }
@@ -569,6 +576,7 @@ async function generateBundleResources(resources, query, isProduction, {
569
576
  forceStringify = false,
570
577
  isGlobal = false,
571
578
  bridge = false,
579
+ onlyLocales = [],
572
580
  exportESM = true,
573
581
  strictMessage = true,
574
582
  escapeHtml = false,
@@ -587,6 +595,7 @@ async function generateBundleResources(resources, query, isProduction, {
587
595
  useClassComponent,
588
596
  bridge,
589
597
  jit,
598
+ onlyLocales,
590
599
  exportESM,
591
600
  strictMessage,
592
601
  escapeHtml,
@@ -644,6 +653,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
644
653
  forceStringify = false,
645
654
  isGlobal = false,
646
655
  bridge = false,
656
+ onlyLocales = [],
647
657
  exportESM = true,
648
658
  useClassComponent = false,
649
659
  allowDynamic = false,
@@ -663,6 +673,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
663
673
  escapeHtml,
664
674
  bridge,
665
675
  jit,
676
+ onlyLocales,
666
677
  exportESM,
667
678
  env: mode,
668
679
  onWarn: (msg) => {
package/lib/index.mjs CHANGED
@@ -97,6 +97,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
97
97
  if (!["vite", "webpack"].includes(meta.framework)) {
98
98
  raiseError(`This plugin is supported 'vite' and 'webpack' only`);
99
99
  }
100
+ let onlyLocales = [];
101
+ if (options.onlyLocales) {
102
+ onlyLocales = Array.isArray(options.onlyLocales) ? options.onlyLocales : [options.onlyLocales];
103
+ }
100
104
  let include = options.include;
101
105
  let exclude = null;
102
106
  if (include) {
@@ -278,6 +282,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
278
282
  escapeHtml,
279
283
  bridge,
280
284
  jit: jitCompilation,
285
+ onlyLocales,
281
286
  exportESM: esm,
282
287
  forceStringify
283
288
  }
@@ -446,6 +451,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
446
451
  escapeHtml,
447
452
  bridge,
448
453
  jit: jitCompilation,
454
+ onlyLocales,
449
455
  exportESM: esm,
450
456
  forceStringify
451
457
  }
@@ -489,6 +495,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
489
495
  jit: jitCompilation,
490
496
  strictMessage,
491
497
  escapeHtml,
498
+ onlyLocales,
492
499
  exportESM: esm,
493
500
  forceStringify
494
501
  }
@@ -557,6 +564,7 @@ async function generateBundleResources(resources, query, isProduction, {
557
564
  forceStringify = false,
558
565
  isGlobal = false,
559
566
  bridge = false,
567
+ onlyLocales = [],
560
568
  exportESM = true,
561
569
  strictMessage = true,
562
570
  escapeHtml = false,
@@ -575,6 +583,7 @@ async function generateBundleResources(resources, query, isProduction, {
575
583
  useClassComponent,
576
584
  bridge,
577
585
  jit,
586
+ onlyLocales,
578
587
  exportESM,
579
588
  strictMessage,
580
589
  escapeHtml,
@@ -632,6 +641,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
632
641
  forceStringify = false,
633
642
  isGlobal = false,
634
643
  bridge = false,
644
+ onlyLocales = [],
635
645
  exportESM = true,
636
646
  useClassComponent = false,
637
647
  allowDynamic = false,
@@ -651,6 +661,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
651
661
  escapeHtml,
652
662
  bridge,
653
663
  jit,
664
+ onlyLocales,
654
665
  exportESM,
655
666
  env: mode,
656
667
  onWarn: (msg) => {
package/lib/types.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  interface PluginOptions {
3
3
  include?: string | string[];
4
+ onlyLocales?: string | string[];
4
5
  allowDynamic?: boolean;
5
6
  jitCompilation?: boolean;
6
7
  dropMessageCompiler?: boolean;
package/lib/types.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  interface PluginOptions {
3
3
  include?: string | string[];
4
+ onlyLocales?: string | string[];
4
5
  allowDynamic?: boolean;
5
6
  jitCompilation?: boolean;
6
7
  dropMessageCompiler?: boolean;
package/lib/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  interface PluginOptions {
3
3
  include?: string | string[];
4
+ onlyLocales?: string | string[];
4
5
  allowDynamic?: boolean;
5
6
  jitCompilation?: boolean;
6
7
  dropMessageCompiler?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@intlify/bundle-utils": "^7.3.0",
29
+ "@intlify/bundle-utils": "^7.4.0",
30
30
  "@intlify/shared": "^9.4.0",
31
31
  "@rollup/pluginutils": "^5.0.2",
32
32
  "@vue/compiler-sfc": "^3.2.47",