@intlify/unplugin-vue-i18n 0.12.2 → 0.13.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
@@ -362,6 +362,21 @@ This plugin will automatically select and bundle `petite-vue-i18n` build accordi
362
362
 
363
363
  About JIT compilation, See [here](https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation)
364
364
 
365
+ ### `dropMessageCompiler`
366
+
367
+ - **Type:** `boolean`
368
+ - **Default:** `false`
369
+
370
+ Whether to tree-shake message compiler when we will be bundling.
371
+
372
+ If do you will use this option, you need to enable `jitCompilation` option.
373
+
374
+ > ⚠️ NOTE:
375
+ This option works with vue-i18n v9.3 and later.
376
+
377
+ > ⚠️ NOTE:
378
+ 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.
379
+
365
380
  ### `runtimeOnly`
366
381
 
367
382
  - **Type:** `boolean`
package/lib/index.cjs CHANGED
@@ -131,6 +131,8 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
131
131
  debug("runtimeOnly", runtimeOnly);
132
132
  const jitCompilation = !!options.jitCompilation;
133
133
  debug("jitCompilation", jitCompilation);
134
+ const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
135
+ debug("dropMessageCompiler", dropMessageCompiler);
134
136
  const compositionOnly = installedPkg === "vue-i18n" ? shared.isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
135
137
  debug("compositionOnly", compositionOnly);
136
138
  const fullInstall = installedPkg === "vue-i18n" ? shared.isBoolean(options.fullInstall) ? options.fullInstall : true : false;
@@ -228,6 +230,10 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
228
230
  debug(
229
231
  `set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
230
232
  );
233
+ config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
234
+ debug(
235
+ `set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
236
+ );
231
237
  config.define["__VUE_I18N_PROD_DEVTOOLS__"] = false;
232
238
  },
233
239
  configResolved(config) {
@@ -476,7 +482,7 @@ const unplugin = unplugin$1.createUnplugin((options = {}, meta) => {
476
482
  } else {
477
483
  if (isCustomBlock(query)) {
478
484
  if (shared.isString(query.lang)) {
479
- langInfo = query.src ? query.lang === "i18n" ? "json" : query.lang : query.lang;
485
+ langInfo = query.src ? query.lang === "i18n" ? defaultSFCLang : query.lang : query.lang;
480
486
  } else if (defaultSFCLang) {
481
487
  langInfo = defaultSFCLang;
482
488
  }
package/lib/index.mjs CHANGED
@@ -119,6 +119,8 @@ const unplugin = createUnplugin((options = {}, meta) => {
119
119
  debug("runtimeOnly", runtimeOnly);
120
120
  const jitCompilation = !!options.jitCompilation;
121
121
  debug("jitCompilation", jitCompilation);
122
+ const dropMessageCompiler = jitCompilation ? !!options.dropMessageCompiler : false;
123
+ debug("dropMessageCompiler", dropMessageCompiler);
122
124
  const compositionOnly = installedPkg === "vue-i18n" ? isBoolean(options.compositionOnly) ? options.compositionOnly : true : true;
123
125
  debug("compositionOnly", compositionOnly);
124
126
  const fullInstall = installedPkg === "vue-i18n" ? isBoolean(options.fullInstall) ? options.fullInstall : true : false;
@@ -216,6 +218,10 @@ const unplugin = createUnplugin((options = {}, meta) => {
216
218
  debug(
217
219
  `set __INTLIFY_JIT_COMPILATION__ is '${config.define["__INTLIFY_JIT_COMPILATION__"]}'`
218
220
  );
221
+ config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"] = dropMessageCompiler;
222
+ debug(
223
+ `set __INTLIFY_DROP_MESSAGE_COMPILER__ is '${config.define["__INTLIFY_DROP_MESSAGE_COMPILER__"]}'`
224
+ );
219
225
  config.define["__VUE_I18N_PROD_DEVTOOLS__"] = false;
220
226
  },
221
227
  configResolved(config) {
@@ -464,7 +470,7 @@ const unplugin = createUnplugin((options = {}, meta) => {
464
470
  } else {
465
471
  if (isCustomBlock(query)) {
466
472
  if (isString(query.lang)) {
467
- langInfo = query.src ? query.lang === "i18n" ? "json" : query.lang : query.lang;
473
+ langInfo = query.src ? query.lang === "i18n" ? defaultSFCLang : query.lang : query.lang;
468
474
  } else if (defaultSFCLang) {
469
475
  langInfo = defaultSFCLang;
470
476
  }
package/lib/types.d.ts CHANGED
@@ -3,6 +3,7 @@ interface PluginOptions {
3
3
  include?: string | string[];
4
4
  allowDynamic?: boolean;
5
5
  jitCompilation?: boolean;
6
+ dropMessageCompiler?: boolean;
6
7
  runtimeOnly?: boolean;
7
8
  compositionOnly?: boolean;
8
9
  fullInstall?: boolean;
package/messages.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  declare module '@intlify/unplugin-vue-i18n/messages' {
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
- const messages: any
2
+ import type { I18nOptions } from 'vue-i18n'
3
+
4
+ const messages: I18nOptions['messages']
4
5
  export default messages
5
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
@@ -26,8 +26,8 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "@intlify/bundle-utils": "^7.0.2",
30
- "@intlify/shared": "9.3.0-beta.24",
29
+ "@intlify/bundle-utils": "^7.1.0",
30
+ "@intlify/shared": "^9.3.0-beta.27",
31
31
  "@rollup/pluginutils": "^5.0.2",
32
32
  "@vue/compiler-sfc": "^3.2.47",
33
33
  "debug": "^4.3.3",