@intlify/unplugin-vue-i18n 3.0.1 → 4.0.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
@@ -539,53 +539,6 @@ If do you will use this option, you need to enable `jitCompilation` option.
539
539
  </i18n>
540
540
  ```
541
541
 
542
- ### `bridge`
543
-
544
- - **Type:** `boolean`
545
- - **Default:** `false`
546
-
547
- > [!WARNING]
548
- 'bridge' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
549
-
550
- The mode to birdge the i18n custom block to work in both vue-i18n@v8.x and vue-i18n@v9.x environments.
551
-
552
- To support in a smooth transition from vue-i18n@v8.x to vue-i18n@v9.x, we provide a mode that bundles the i18n custom block to be available in either version.
553
-
554
- > [!WARNING]
555
- 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.
556
-
557
- ### `legacy`
558
-
559
- - **Type:** `boolean`
560
- - **Default:** `false`
561
-
562
- > [!WARNING]
563
- 'legacy' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
564
-
565
- This option supports Vue I18n v8.x compatibility for resources in i18n custom blocks.
566
-
567
- > [!NOTE]
568
- To work for Vue 2.7, the value of `vueVersion` must be set to `'v2.7'`.
569
-
570
- ### `vueVersion`
571
-
572
- - **Type:** `string`
573
- - **Default:** `undefined`
574
-
575
- > [!WARNING]
576
- 'vueVersion' option is deprecated, sinece Vue 2 was EOL on 2023. that option will be removed in 4.0.`
577
-
578
- The version of Vue that will be used by Vue I18n. This option is enabled when the `legacy` option is `true`.
579
-
580
- Available values are `'v2.6'` and `'v2.7'`.
581
-
582
- ### `esm`
583
-
584
- - **Type:** `boolean`
585
- - **Default:** `true`
586
-
587
- For `bridge` option is `true`, whether to bundle locale resources with ESM. By default ESM, if you need to bundl with commonjs for especialy webpack, you need to set `false`
588
-
589
542
  ### `useClassComponent`
590
543
 
591
544
  - **Type:** `boolean`
package/lib/index.cjs CHANGED
@@ -10,8 +10,6 @@ const shared = require('@intlify/shared');
10
10
  const pluginutils = require('@rollup/pluginutils');
11
11
  const bundleUtils = require('@intlify/bundle-utils');
12
12
  const compilerSfc = require('@vue/compiler-sfc');
13
- const JSON5 = require('json5');
14
- const yaml = require('js-yaml');
15
13
  const fs = require('fs');
16
14
  const pc = require('picocolors');
17
15
 
@@ -19,8 +17,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
19
17
 
20
18
  const createDebug__default = /*#__PURE__*/_interopDefaultCompat(createDebug);
21
19
  const fg__default = /*#__PURE__*/_interopDefaultCompat(fg);
22
- const JSON5__default = /*#__PURE__*/_interopDefaultCompat(JSON5);
23
- const yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
24
20
  const pc__default = /*#__PURE__*/_interopDefaultCompat(pc);
25
21
 
26
22
  function parseVueRequest(id) {
@@ -61,29 +57,6 @@ function parseVueRequest(id) {
61
57
  };
62
58
  }
63
59
 
64
- function createBridgeCodeGenerator(source, query) {
65
- return () => {
66
- const data = convert(source, query.lang);
67
- let value = JSON.parse(data);
68
- if (shared.isString(query.locale)) {
69
- value = Object.assign({}, { [query.locale]: value });
70
- }
71
- return JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\\/g, "\\\\").replace(/\u0027/g, "\\u0027");
72
- };
73
- }
74
- function convert(source, lang) {
75
- switch (lang) {
76
- case "yaml":
77
- case "yml":
78
- const data = yaml__default.load(source);
79
- return JSON.stringify(data, void 0, " ");
80
- case "json5":
81
- return JSON.stringify(JSON5__default.parse(source));
82
- default:
83
- return source;
84
- }
85
- }
86
-
87
60
  function warn(...args) {
88
61
  console.warn(pc__default.yellow(pc__default.bold(`[unplugin-vue-i18n] `)), ...args);
89
62
  }
@@ -101,7 +74,6 @@ const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
101
74
  const VIRTUAL_PREFIX = "\0";
102
75
  const debug = createDebug__default("unplugin-vue-i18n");
103
76
  const installedPkg = bundleUtils.checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
104
- const installedVueI18nBridge = bundleUtils.checkVueI18nBridgeInstallPackage(debug);
105
77
  const vueI18nVersion = bundleUtils.getVueI18nVersion(debug);
106
78
  if (vueI18nVersion === "8") {
107
79
  warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
@@ -131,26 +103,6 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
131
103
  const defaultSFCLang = shared.isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
132
104
  const globalSFCScope = !!options.globalSFCScope;
133
105
  const useClassComponent = !!options.useClassComponent;
134
- const bridge = !!options.bridge;
135
- debug("bridge", bridge);
136
- if (bridge) {
137
- warn(
138
- `'bridge' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
139
- );
140
- }
141
- const legacy = !!options.legacy;
142
- debug("legacy", legacy);
143
- if (legacy) {
144
- warn(
145
- `'legacy' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
146
- );
147
- }
148
- const vueVersion = shared.isString(options.vueVersion) ? options.vueVersion : void 0;
149
- if (vueVersion) {
150
- warn(
151
- `'vueVersion' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
152
- );
153
- }
154
106
  const runtimeOnly = shared.isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
155
107
  debug("runtimeOnly", runtimeOnly);
156
108
  const jitCompilation = shared.isBoolean(options.jitCompilation) ? options.jitCompilation : true;
@@ -168,13 +120,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
168
120
  warn(`'useVueI18nImportName' option is experimental`);
169
121
  }
170
122
  debug("useVueI18nImportName", useVueI18nImportName);
171
- const getVueI18nAliasName = () => vueI18nVersion === "9" || vueI18nVersion === "8" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
172
- const getVueI18nBridgeAliasPath = () => `vue-i18n-bridge/dist/vue-i18n-bridge.runtime.esm-bundler.js`;
123
+ const getVueI18nAliasName = () => vueI18nVersion === "9" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && shared.isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
173
124
  const getVueI18nAliasPath = (aliasName, { ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
174
- return vueI18nVersion === "8" ? `${aliasName}/dist/${aliasName}.esm.js` : `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
125
+ return `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
175
126
  };
176
- const esm = shared.isBoolean(options.esm) ? options.esm : true;
177
- debug("esm", esm);
178
127
  const allowDynamic = !!options.allowDynamic;
179
128
  debug("allowDynamic", allowDynamic);
180
129
  const strictMessage = shared.isBoolean(options.strictMessage) ? options.strictMessage : true;
@@ -211,20 +160,11 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
211
160
  runtimeOnly
212
161
  })
213
162
  });
214
- if (installedVueI18nBridge) {
215
- config.resolve.alias.push({
216
- find: "vue-i18n-bridge",
217
- replacement: getVueI18nBridgeAliasPath()
218
- });
219
- }
220
163
  } else if (shared.isObject(config.resolve.alias)) {
221
164
  config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(vueI18nAliasName, {
222
165
  ssr: ssrBuild,
223
166
  runtimeOnly
224
167
  });
225
- if (installedVueI18nBridge) {
226
- config.resolve.alias["vue-i18n-bridge"] = getVueI18nBridgeAliasPath();
227
- }
228
168
  }
229
169
  debug(
230
170
  `set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath(
@@ -235,11 +175,6 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
235
175
  }
236
176
  )}`
237
177
  );
238
- if (installedVueI18nBridge) {
239
- debug(
240
- `set vue-i18n-bridge runtime only: ${getVueI18nBridgeAliasPath()}`
241
- );
242
- }
243
178
  } else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
244
179
  config.resolve = normalizeConfigResolveAlias(
245
180
  config.resolve,
@@ -326,21 +261,13 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
326
261
  allowDynamic,
327
262
  strictMessage,
328
263
  escapeHtml,
329
- bridge,
330
- legacy,
331
- vueVersion,
332
264
  jit: jitCompilation,
333
265
  onlyLocales,
334
- exportESM: esm,
335
266
  forceStringify
336
267
  }
337
268
  );
338
269
  debug("parseOptions", parseOptions);
339
- const { code: generatedCode, map } = generate(
340
- _code,
341
- parseOptions,
342
- bridge ? createBridgeCodeGenerator(_code, query) : void 0
343
- );
270
+ const { code: generatedCode, map } = generate(_code, parseOptions);
344
271
  debug("generated code", generatedCode);
345
272
  debug("sourcemap", map, sourceMap);
346
273
  if (_code === generatedCode)
@@ -382,20 +309,12 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
382
309
  ssr: ssrBuild,
383
310
  runtimeOnly
384
311
  });
385
- if (installedVueI18nBridge) {
386
- compiler.options.resolve.alias["vue-i18n-bridge"] = getVueI18nBridgeAliasPath();
387
- }
388
312
  debug(
389
313
  `set ${vueI18nAliasName}: ${getVueI18nAliasPath(vueI18nAliasName, {
390
314
  ssr: ssrBuild,
391
315
  runtimeOnly
392
316
  })}`
393
317
  );
394
- if (installedVueI18nBridge) {
395
- debug(
396
- `set vue-i18n-bridge runtime only: ${getVueI18nBridgeAliasPath()}`
397
- );
398
- }
399
318
  } else if (!isProduction && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
400
319
  compiler.options.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
401
320
  debug(`petite-vue-i18n alias name: ${vueI18nAliasName}`);
@@ -450,10 +369,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
450
369
  isProduction,
451
370
  {
452
371
  forceStringify,
453
- bridge,
454
372
  strictMessage,
455
373
  escapeHtml,
456
- exportESM: esm,
457
374
  useClassComponent
458
375
  }
459
376
  );
@@ -493,19 +410,13 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
493
410
  allowDynamic,
494
411
  strictMessage,
495
412
  escapeHtml,
496
- bridge,
497
413
  jit: jitCompilation,
498
414
  onlyLocales,
499
- exportESM: esm,
500
415
  forceStringify
501
416
  }
502
417
  );
503
418
  debug("parseOptions", parseOptions);
504
- const { code: generatedCode, map } = generate(
505
- code,
506
- parseOptions,
507
- bridge ? createBridgeCodeGenerator(code, query) : void 0
508
- );
419
+ const { code: generatedCode, map } = generate(code, parseOptions);
509
420
  debug("generated code", generatedCode);
510
421
  debug("sourcemap", map, sourceMap);
511
422
  if (code === generatedCode)
@@ -535,14 +446,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
535
446
  inSourceMap,
536
447
  isGlobal: globalSFCScope,
537
448
  useClassComponent,
538
- bridge,
539
- legacy,
540
- vueVersion,
541
449
  jit: jitCompilation,
542
450
  strictMessage,
543
451
  escapeHtml,
544
452
  onlyLocales,
545
- exportESM: esm,
546
453
  forceStringify
547
454
  }
548
455
  );
@@ -554,11 +461,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
554
461
  query,
555
462
  meta.framework
556
463
  );
557
- const { code: generatedCode, map } = generate(
558
- source,
559
- parseOptions,
560
- bridge ? createBridgeCodeGenerator(source, query) : void 0
561
- );
464
+ const { code: generatedCode, map } = generate(source, parseOptions);
562
465
  debug("generated code", generatedCode);
563
466
  debug("sourcemap", map, sourceMap);
564
467
  if (code === generatedCode)
@@ -609,9 +512,7 @@ async function loadWebpack() {
609
512
  async function generateBundleResources(resources, query, isProduction, {
610
513
  forceStringify = false,
611
514
  isGlobal = false,
612
- bridge = false,
613
515
  onlyLocales = [],
614
- exportESM = true,
615
516
  strictMessage = true,
616
517
  escapeHtml = false,
617
518
  useClassComponent = false,
@@ -627,20 +528,14 @@ async function generateBundleResources(resources, query, isProduction, {
627
528
  const parseOptions = getOptions(res, isProduction, {}, false, {
628
529
  isGlobal,
629
530
  useClassComponent,
630
- bridge,
631
531
  jit,
632
532
  onlyLocales,
633
- exportESM,
634
533
  strictMessage,
635
534
  escapeHtml,
636
535
  forceStringify
637
536
  });
638
537
  parseOptions.type = "bare";
639
- const { code } = generate(
640
- source,
641
- parseOptions,
642
- bridge ? createBridgeCodeGenerator(source, query) : void 0
643
- );
538
+ const { code } = generate(source, parseOptions);
644
539
  debug("generated code", code);
645
540
  codes.push(`${JSON.stringify(name)}: ${code}`);
646
541
  }
@@ -705,11 +600,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
705
600
  inSourceMap = void 0,
706
601
  forceStringify = false,
707
602
  isGlobal = false,
708
- bridge = false,
709
- legacy = false,
710
- vueVersion = "v2.6",
711
603
  onlyLocales = [],
712
- exportESM = true,
713
604
  useClassComponent = false,
714
605
  allowDynamic = false,
715
606
  strictMessage = true,
@@ -726,12 +617,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
726
617
  allowDynamic,
727
618
  strictMessage,
728
619
  escapeHtml,
729
- bridge,
730
- legacy,
731
- vueVersion,
732
620
  jit,
733
621
  onlyLocales,
734
- exportESM,
735
622
  env: mode,
736
623
  onWarn: (msg) => {
737
624
  warn(`${filename} ${msg}`);
package/lib/index.d.cts CHANGED
@@ -1,7 +1,6 @@
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';
5
4
 
6
5
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
7
6
 
package/lib/index.d.mts CHANGED
@@ -1,7 +1,6 @@
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';
5
4
 
6
5
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
7
6
 
package/lib/index.d.ts CHANGED
@@ -1,7 +1,6 @@
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';
5
4
 
6
5
  declare const unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
7
6
 
package/lib/index.mjs CHANGED
@@ -2,12 +2,10 @@ import { createUnplugin } from 'unplugin';
2
2
  import { normalize, parse } from 'pathe';
3
3
  import createDebug from 'debug';
4
4
  import fg from 'fast-glob';
5
- import { isString, isArray, isBoolean, isObject, isNumber, isEmptyObject, assign, generateCodeFrame } from '@intlify/shared';
5
+ import { isArray, isString, isBoolean, isObject, isNumber, isEmptyObject, assign, generateCodeFrame } from '@intlify/shared';
6
6
  import { createFilter } from '@rollup/pluginutils';
7
- import { checkInstallPackage, checkVueI18nBridgeInstallPackage, getVueI18nVersion, generateJSON, generateYAML, generateJavaScript } from '@intlify/bundle-utils';
7
+ import { checkInstallPackage, getVueI18nVersion, generateJSON, generateYAML, generateJavaScript } from '@intlify/bundle-utils';
8
8
  import { parse as parse$1 } from '@vue/compiler-sfc';
9
- import JSON5 from 'json5';
10
- import yaml from 'js-yaml';
11
9
  import { promises } from 'fs';
12
10
  import pc from 'picocolors';
13
11
 
@@ -49,29 +47,6 @@ function parseVueRequest(id) {
49
47
  };
50
48
  }
51
49
 
52
- function createBridgeCodeGenerator(source, query) {
53
- return () => {
54
- const data = convert(source, query.lang);
55
- let value = JSON.parse(data);
56
- if (isString(query.locale)) {
57
- value = Object.assign({}, { [query.locale]: value });
58
- }
59
- return JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029").replace(/\\/g, "\\\\").replace(/\u0027/g, "\\u0027");
60
- };
61
- }
62
- function convert(source, lang) {
63
- switch (lang) {
64
- case "yaml":
65
- case "yml":
66
- const data = yaml.load(source);
67
- return JSON.stringify(data, void 0, " ");
68
- case "json5":
69
- return JSON.stringify(JSON5.parse(source));
70
- default:
71
- return source;
72
- }
73
- }
74
-
75
50
  function warn(...args) {
76
51
  console.warn(pc.yellow(pc.bold(`[unplugin-vue-i18n] `)), ...args);
77
52
  }
@@ -89,7 +64,6 @@ const INTLIFY_BUNDLE_IMPORT_ID = "@intlify/unplugin-vue-i18n/messages";
89
64
  const VIRTUAL_PREFIX = "\0";
90
65
  const debug = createDebug("unplugin-vue-i18n");
91
66
  const installedPkg = checkInstallPackage("@intlify/unplugin-vue-i18n", debug);
92
- const installedVueI18nBridge = checkVueI18nBridgeInstallPackage(debug);
93
67
  const vueI18nVersion = getVueI18nVersion(debug);
94
68
  if (vueI18nVersion === "8") {
95
69
  warn(`vue-i18n@8 is not supported, since sinece Vue 2 was EOL on 2023.`);
@@ -119,26 +93,6 @@ const unplugin = createUnplugin((options = {}, meta) => {
119
93
  const defaultSFCLang = isString(options.defaultSFCLang) ? options.defaultSFCLang : "json";
120
94
  const globalSFCScope = !!options.globalSFCScope;
121
95
  const useClassComponent = !!options.useClassComponent;
122
- const bridge = !!options.bridge;
123
- debug("bridge", bridge);
124
- if (bridge) {
125
- warn(
126
- `'bridge' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
127
- );
128
- }
129
- const legacy = !!options.legacy;
130
- debug("legacy", legacy);
131
- if (legacy) {
132
- warn(
133
- `'legacy' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
134
- );
135
- }
136
- const vueVersion = isString(options.vueVersion) ? options.vueVersion : void 0;
137
- if (vueVersion) {
138
- warn(
139
- `'vueVersion' option is deprecated, since Vue 2 was EOL on 2023. that option will be removed in 4.0.`
140
- );
141
- }
142
96
  const runtimeOnly = isBoolean(options.runtimeOnly) ? options.runtimeOnly : true;
143
97
  debug("runtimeOnly", runtimeOnly);
144
98
  const jitCompilation = isBoolean(options.jitCompilation) ? options.jitCompilation : true;
@@ -156,13 +110,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
156
110
  warn(`'useVueI18nImportName' option is experimental`);
157
111
  }
158
112
  debug("useVueI18nImportName", useVueI18nImportName);
159
- const getVueI18nAliasName = () => vueI18nVersion === "9" || vueI18nVersion === "8" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
160
- const getVueI18nBridgeAliasPath = () => `vue-i18n-bridge/dist/vue-i18n-bridge.runtime.esm-bundler.js`;
113
+ const getVueI18nAliasName = () => vueI18nVersion === "9" ? "vue-i18n" : vueI18nVersion === "unknown" && installedPkg === "petite-vue-i18n" && isBoolean(useVueI18nImportName) && useVueI18nImportName ? "vue-i18n" : installedPkg;
161
114
  const getVueI18nAliasPath = (aliasName, { ssr = false, runtimeOnly: runtimeOnly2 = false }) => {
162
- return vueI18nVersion === "8" ? `${aliasName}/dist/${aliasName}.esm.js` : `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
115
+ return `${aliasName}/dist/${installedPkg}${runtimeOnly2 ? ".runtime" : ""}.${!ssr ? "esm-bundler.js" : "node.mjs"}`;
163
116
  };
164
- const esm = isBoolean(options.esm) ? options.esm : true;
165
- debug("esm", esm);
166
117
  const allowDynamic = !!options.allowDynamic;
167
118
  debug("allowDynamic", allowDynamic);
168
119
  const strictMessage = isBoolean(options.strictMessage) ? options.strictMessage : true;
@@ -199,20 +150,11 @@ const unplugin = createUnplugin((options = {}, meta) => {
199
150
  runtimeOnly
200
151
  })
201
152
  });
202
- if (installedVueI18nBridge) {
203
- config.resolve.alias.push({
204
- find: "vue-i18n-bridge",
205
- replacement: getVueI18nBridgeAliasPath()
206
- });
207
- }
208
153
  } else if (isObject(config.resolve.alias)) {
209
154
  config.resolve.alias[vueI18nAliasName] = getVueI18nAliasPath(vueI18nAliasName, {
210
155
  ssr: ssrBuild,
211
156
  runtimeOnly
212
157
  });
213
- if (installedVueI18nBridge) {
214
- config.resolve.alias["vue-i18n-bridge"] = getVueI18nBridgeAliasPath();
215
- }
216
158
  }
217
159
  debug(
218
160
  `set ${vueI18nAliasName} runtime only: ${getVueI18nAliasPath(
@@ -223,11 +165,6 @@ const unplugin = createUnplugin((options = {}, meta) => {
223
165
  }
224
166
  )}`
225
167
  );
226
- if (installedVueI18nBridge) {
227
- debug(
228
- `set vue-i18n-bridge runtime only: ${getVueI18nBridgeAliasPath()}`
229
- );
230
- }
231
168
  } else if (command === "serve" && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
232
169
  config.resolve = normalizeConfigResolveAlias(
233
170
  config.resolve,
@@ -314,21 +251,13 @@ const unplugin = createUnplugin((options = {}, meta) => {
314
251
  allowDynamic,
315
252
  strictMessage,
316
253
  escapeHtml,
317
- bridge,
318
- legacy,
319
- vueVersion,
320
254
  jit: jitCompilation,
321
255
  onlyLocales,
322
- exportESM: esm,
323
256
  forceStringify
324
257
  }
325
258
  );
326
259
  debug("parseOptions", parseOptions);
327
- const { code: generatedCode, map } = generate(
328
- _code,
329
- parseOptions,
330
- bridge ? createBridgeCodeGenerator(_code, query) : void 0
331
- );
260
+ const { code: generatedCode, map } = generate(_code, parseOptions);
332
261
  debug("generated code", generatedCode);
333
262
  debug("sourcemap", map, sourceMap);
334
263
  if (_code === generatedCode)
@@ -370,20 +299,12 @@ const unplugin = createUnplugin((options = {}, meta) => {
370
299
  ssr: ssrBuild,
371
300
  runtimeOnly
372
301
  });
373
- if (installedVueI18nBridge) {
374
- compiler.options.resolve.alias["vue-i18n-bridge"] = getVueI18nBridgeAliasPath();
375
- }
376
302
  debug(
377
303
  `set ${vueI18nAliasName}: ${getVueI18nAliasPath(vueI18nAliasName, {
378
304
  ssr: ssrBuild,
379
305
  runtimeOnly
380
306
  })}`
381
307
  );
382
- if (installedVueI18nBridge) {
383
- debug(
384
- `set vue-i18n-bridge runtime only: ${getVueI18nBridgeAliasPath()}`
385
- );
386
- }
387
308
  } else if (!isProduction && installedPkg === "petite-vue-i18n" && useVueI18nImportName) {
388
309
  compiler.options.resolve.alias[vueI18nAliasName] = `petite-vue-i18n/dist/petite-vue-i18n.esm-bundler.js`;
389
310
  debug(`petite-vue-i18n alias name: ${vueI18nAliasName}`);
@@ -438,10 +359,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
438
359
  isProduction,
439
360
  {
440
361
  forceStringify,
441
- bridge,
442
362
  strictMessage,
443
363
  escapeHtml,
444
- exportESM: esm,
445
364
  useClassComponent
446
365
  }
447
366
  );
@@ -481,19 +400,13 @@ const unplugin = createUnplugin((options = {}, meta) => {
481
400
  allowDynamic,
482
401
  strictMessage,
483
402
  escapeHtml,
484
- bridge,
485
403
  jit: jitCompilation,
486
404
  onlyLocales,
487
- exportESM: esm,
488
405
  forceStringify
489
406
  }
490
407
  );
491
408
  debug("parseOptions", parseOptions);
492
- const { code: generatedCode, map } = generate(
493
- code,
494
- parseOptions,
495
- bridge ? createBridgeCodeGenerator(code, query) : void 0
496
- );
409
+ const { code: generatedCode, map } = generate(code, parseOptions);
497
410
  debug("generated code", generatedCode);
498
411
  debug("sourcemap", map, sourceMap);
499
412
  if (code === generatedCode)
@@ -523,14 +436,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
523
436
  inSourceMap,
524
437
  isGlobal: globalSFCScope,
525
438
  useClassComponent,
526
- bridge,
527
- legacy,
528
- vueVersion,
529
439
  jit: jitCompilation,
530
440
  strictMessage,
531
441
  escapeHtml,
532
442
  onlyLocales,
533
- exportESM: esm,
534
443
  forceStringify
535
444
  }
536
445
  );
@@ -542,11 +451,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
542
451
  query,
543
452
  meta.framework
544
453
  );
545
- const { code: generatedCode, map } = generate(
546
- source,
547
- parseOptions,
548
- bridge ? createBridgeCodeGenerator(source, query) : void 0
549
- );
454
+ const { code: generatedCode, map } = generate(source, parseOptions);
550
455
  debug("generated code", generatedCode);
551
456
  debug("sourcemap", map, sourceMap);
552
457
  if (code === generatedCode)
@@ -597,9 +502,7 @@ async function loadWebpack() {
597
502
  async function generateBundleResources(resources, query, isProduction, {
598
503
  forceStringify = false,
599
504
  isGlobal = false,
600
- bridge = false,
601
505
  onlyLocales = [],
602
- exportESM = true,
603
506
  strictMessage = true,
604
507
  escapeHtml = false,
605
508
  useClassComponent = false,
@@ -615,20 +518,14 @@ async function generateBundleResources(resources, query, isProduction, {
615
518
  const parseOptions = getOptions(res, isProduction, {}, false, {
616
519
  isGlobal,
617
520
  useClassComponent,
618
- bridge,
619
521
  jit,
620
522
  onlyLocales,
621
- exportESM,
622
523
  strictMessage,
623
524
  escapeHtml,
624
525
  forceStringify
625
526
  });
626
527
  parseOptions.type = "bare";
627
- const { code } = generate(
628
- source,
629
- parseOptions,
630
- bridge ? createBridgeCodeGenerator(source, query) : void 0
631
- );
528
+ const { code } = generate(source, parseOptions);
632
529
  debug("generated code", code);
633
530
  codes.push(`${JSON.stringify(name)}: ${code}`);
634
531
  }
@@ -693,11 +590,7 @@ function getOptions(filename, isProduction, query, sourceMap, {
693
590
  inSourceMap = void 0,
694
591
  forceStringify = false,
695
592
  isGlobal = false,
696
- bridge = false,
697
- legacy = false,
698
- vueVersion = "v2.6",
699
593
  onlyLocales = [],
700
- exportESM = true,
701
594
  useClassComponent = false,
702
595
  allowDynamic = false,
703
596
  strictMessage = true,
@@ -714,12 +607,8 @@ function getOptions(filename, isProduction, query, sourceMap, {
714
607
  allowDynamic,
715
608
  strictMessage,
716
609
  escapeHtml,
717
- bridge,
718
- legacy,
719
- vueVersion,
720
610
  jit,
721
611
  onlyLocales,
722
- exportESM,
723
612
  env: mode,
724
613
  onWarn: (msg) => {
725
614
  warn(`${filename} ${msg}`);
package/lib/types.d.cts CHANGED
@@ -1,5 +1,3 @@
1
- import { CodeGenOptions } from '@intlify/bundle-utils';
2
-
3
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
4
2
  interface PluginOptions {
5
3
  include?: string | string[];
@@ -11,13 +9,9 @@ interface PluginOptions {
11
9
  compositionOnly?: boolean;
12
10
  ssr?: boolean;
13
11
  fullInstall?: boolean;
14
- esm?: boolean;
15
12
  forceStringify?: boolean;
16
13
  defaultSFCLang?: SFCLangFormat;
17
14
  globalSFCScope?: boolean;
18
- bridge?: boolean;
19
- legacy?: boolean;
20
- vueVersion?: CodeGenOptions['vueVersion'];
21
15
  useClassComponent?: boolean;
22
16
  useVueI18nImportName?: boolean;
23
17
  strictMessage?: boolean;
package/lib/types.d.mts CHANGED
@@ -1,5 +1,3 @@
1
- import { CodeGenOptions } from '@intlify/bundle-utils';
2
-
3
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
4
2
  interface PluginOptions {
5
3
  include?: string | string[];
@@ -11,13 +9,9 @@ interface PluginOptions {
11
9
  compositionOnly?: boolean;
12
10
  ssr?: boolean;
13
11
  fullInstall?: boolean;
14
- esm?: boolean;
15
12
  forceStringify?: boolean;
16
13
  defaultSFCLang?: SFCLangFormat;
17
14
  globalSFCScope?: boolean;
18
- bridge?: boolean;
19
- legacy?: boolean;
20
- vueVersion?: CodeGenOptions['vueVersion'];
21
15
  useClassComponent?: boolean;
22
16
  useVueI18nImportName?: boolean;
23
17
  strictMessage?: boolean;
package/lib/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { CodeGenOptions } from '@intlify/bundle-utils';
2
-
3
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
4
2
  interface PluginOptions {
5
3
  include?: string | string[];
@@ -11,13 +9,9 @@ interface PluginOptions {
11
9
  compositionOnly?: boolean;
12
10
  ssr?: boolean;
13
11
  fullInstall?: boolean;
14
- esm?: boolean;
15
12
  forceStringify?: boolean;
16
13
  defaultSFCLang?: SFCLangFormat;
17
14
  globalSFCScope?: boolean;
18
- bridge?: boolean;
19
- legacy?: boolean;
20
- vueVersion?: CodeGenOptions['vueVersion'];
21
15
  useClassComponent?: boolean;
22
16
  useVueI18nImportName?: boolean;
23
17
  strictMessage?: boolean;
package/lib/vite.cjs CHANGED
@@ -9,8 +9,6 @@ require('@intlify/shared');
9
9
  require('@rollup/pluginutils');
10
10
  require('@intlify/bundle-utils');
11
11
  require('@vue/compiler-sfc');
12
- require('json5');
13
- require('js-yaml');
14
12
  require('fs');
15
13
  require('picocolors');
16
14
 
package/lib/vite.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.cjs';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
6
5
 
package/lib/vite.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.mjs';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
6
5
 
package/lib/vite.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as vite from 'vite';
2
2
  import { PluginOptions } from './types.js';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => vite.Plugin | vite.Plugin[];
6
5
 
package/lib/vite.mjs CHANGED
@@ -7,8 +7,6 @@ import '@intlify/shared';
7
7
  import '@rollup/pluginutils';
8
8
  import '@intlify/bundle-utils';
9
9
  import '@vue/compiler-sfc';
10
- import 'json5';
11
- import 'js-yaml';
12
10
  import 'fs';
13
11
  import 'picocolors';
14
12
 
package/lib/webpack.cjs CHANGED
@@ -9,8 +9,6 @@ require('@intlify/shared');
9
9
  require('@rollup/pluginutils');
10
10
  require('@intlify/bundle-utils');
11
11
  require('@vue/compiler-sfc');
12
- require('json5');
13
- require('js-yaml');
14
12
  require('fs');
15
13
  require('picocolors');
16
14
 
package/lib/webpack.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.cjs';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
6
5
 
package/lib/webpack.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.mjs';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
6
5
 
package/lib/webpack.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as webpack from 'webpack';
2
2
  import { PluginOptions } from './types.js';
3
- import '@intlify/bundle-utils';
4
3
 
5
4
  declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
6
5
 
package/lib/webpack.mjs CHANGED
@@ -7,8 +7,6 @@ import '@intlify/shared';
7
7
  import '@rollup/pluginutils';
8
8
  import '@intlify/bundle-utils';
9
9
  import '@vue/compiler-sfc';
10
- import 'json5';
11
- import 'js-yaml';
12
10
  import 'fs';
13
11
  import 'picocolors';
14
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "3.0.1",
3
+ "version": "4.0.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.4.0",
29
+ "@intlify/bundle-utils": "^8.0.0",
30
30
  "@intlify/shared": "^9.4.0",
31
31
  "@rollup/pluginutils": "^5.1.0",
32
32
  "@vue/compiler-sfc": "^3.2.47",