@intlify/unplugin-vue-i18n 11.0.3 → 11.1.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/lib/types.d.cts CHANGED
@@ -1,5 +1,24 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  type VueI18nModule = 'vue-i18n' | 'petite-vue-i18n';
3
+ interface TreeShakingOptions {
4
+ /**
5
+ * Message key patterns to always keep (never tree-shake).
6
+ * Supports glob-like patterns (e.g., `'errors.*'`, `'validation.**'`).
7
+ */
8
+ safelist?: string[];
9
+ /**
10
+ * Strategy when dynamic key usage (e.g., `t(variable)`) is detected.
11
+ * - `'keep-all'`: Disable tree-shaking and keep all keys (safe default).
12
+ * - `'ignore'`: Continue tree-shaking despite dynamic keys (risky, use with `safelist`).
13
+ * @default 'keep-all'
14
+ */
15
+ dynamicKeyStrategy?: 'keep-all' | 'ignore';
16
+ /**
17
+ * Glob patterns for source files to scan for used message keys.
18
+ * Defaults to `${projectRoot}/src/**\/*.{vue,ts,js,tsx,jsx}` when not specified.
19
+ */
20
+ scanPatterns?: string[];
21
+ }
3
22
  interface PluginOptions {
4
23
  include?: string | string[];
5
24
  exclude?: string | string[];
@@ -18,6 +37,12 @@ interface PluginOptions {
18
37
  escapeHtml?: boolean;
19
38
  optimizeTranslationDirective?: boolean | string | string[];
20
39
  transformI18nBlock?: (src: string | Buffer) => string;
40
+ /**
41
+ * Enable message key tree-shaking to remove unused locale message keys.
42
+ * Only effective in production builds.
43
+ * @default false
44
+ */
45
+ treeShaking?: boolean | TreeShakingOptions;
21
46
  }
22
47
 
23
- export type { PluginOptions, SFCLangFormat, VueI18nModule };
48
+ export type { PluginOptions, SFCLangFormat, TreeShakingOptions, VueI18nModule };
package/lib/types.d.mts CHANGED
@@ -1,5 +1,24 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  type VueI18nModule = 'vue-i18n' | 'petite-vue-i18n';
3
+ interface TreeShakingOptions {
4
+ /**
5
+ * Message key patterns to always keep (never tree-shake).
6
+ * Supports glob-like patterns (e.g., `'errors.*'`, `'validation.**'`).
7
+ */
8
+ safelist?: string[];
9
+ /**
10
+ * Strategy when dynamic key usage (e.g., `t(variable)`) is detected.
11
+ * - `'keep-all'`: Disable tree-shaking and keep all keys (safe default).
12
+ * - `'ignore'`: Continue tree-shaking despite dynamic keys (risky, use with `safelist`).
13
+ * @default 'keep-all'
14
+ */
15
+ dynamicKeyStrategy?: 'keep-all' | 'ignore';
16
+ /**
17
+ * Glob patterns for source files to scan for used message keys.
18
+ * Defaults to `${projectRoot}/src/**\/*.{vue,ts,js,tsx,jsx}` when not specified.
19
+ */
20
+ scanPatterns?: string[];
21
+ }
3
22
  interface PluginOptions {
4
23
  include?: string | string[];
5
24
  exclude?: string | string[];
@@ -18,6 +37,12 @@ interface PluginOptions {
18
37
  escapeHtml?: boolean;
19
38
  optimizeTranslationDirective?: boolean | string | string[];
20
39
  transformI18nBlock?: (src: string | Buffer) => string;
40
+ /**
41
+ * Enable message key tree-shaking to remove unused locale message keys.
42
+ * Only effective in production builds.
43
+ * @default false
44
+ */
45
+ treeShaking?: boolean | TreeShakingOptions;
21
46
  }
22
47
 
23
- export type { PluginOptions, SFCLangFormat, VueI18nModule };
48
+ export type { PluginOptions, SFCLangFormat, TreeShakingOptions, VueI18nModule };
package/lib/types.d.ts CHANGED
@@ -1,5 +1,24 @@
1
1
  type SFCLangFormat = 'json' | 'json5' | 'yml' | 'yaml';
2
2
  type VueI18nModule = 'vue-i18n' | 'petite-vue-i18n';
3
+ interface TreeShakingOptions {
4
+ /**
5
+ * Message key patterns to always keep (never tree-shake).
6
+ * Supports glob-like patterns (e.g., `'errors.*'`, `'validation.**'`).
7
+ */
8
+ safelist?: string[];
9
+ /**
10
+ * Strategy when dynamic key usage (e.g., `t(variable)`) is detected.
11
+ * - `'keep-all'`: Disable tree-shaking and keep all keys (safe default).
12
+ * - `'ignore'`: Continue tree-shaking despite dynamic keys (risky, use with `safelist`).
13
+ * @default 'keep-all'
14
+ */
15
+ dynamicKeyStrategy?: 'keep-all' | 'ignore';
16
+ /**
17
+ * Glob patterns for source files to scan for used message keys.
18
+ * Defaults to `${projectRoot}/src/**\/*.{vue,ts,js,tsx,jsx}` when not specified.
19
+ */
20
+ scanPatterns?: string[];
21
+ }
3
22
  interface PluginOptions {
4
23
  include?: string | string[];
5
24
  exclude?: string | string[];
@@ -18,6 +37,12 @@ interface PluginOptions {
18
37
  escapeHtml?: boolean;
19
38
  optimizeTranslationDirective?: boolean | string | string[];
20
39
  transformI18nBlock?: (src: string | Buffer) => string;
40
+ /**
41
+ * Enable message key tree-shaking to remove unused locale message keys.
42
+ * Only effective in production builds.
43
+ * @default false
44
+ */
45
+ treeShaking?: boolean | TreeShakingOptions;
21
46
  }
22
47
 
23
- export type { PluginOptions, SFCLangFormat, VueI18nModule };
48
+ export type { PluginOptions, SFCLangFormat, TreeShakingOptions, VueI18nModule };
package/lib/vite.cjs CHANGED
@@ -15,7 +15,6 @@ require('picocolors');
15
15
  require('@eslint-community/eslint-utils');
16
16
  require('@intlify/vue-i18n-extensions');
17
17
  require('@typescript-eslint/scope-manager');
18
- require('@typescript-eslint/typescript-estree');
19
18
 
20
19
  const vite = unplugin.createVitePlugin(index.unpluginFactory);
21
20
 
package/lib/vite.mjs CHANGED
@@ -13,7 +13,6 @@ import 'picocolors';
13
13
  import '@eslint-community/eslint-utils';
14
14
  import '@intlify/vue-i18n-extensions';
15
15
  import '@typescript-eslint/scope-manager';
16
- import '@typescript-eslint/typescript-estree';
17
16
 
18
17
  const vite = createVitePlugin(unpluginFactory);
19
18
 
package/lib/webpack.cjs CHANGED
@@ -15,7 +15,6 @@ require('picocolors');
15
15
  require('@eslint-community/eslint-utils');
16
16
  require('@intlify/vue-i18n-extensions');
17
17
  require('@typescript-eslint/scope-manager');
18
- require('@typescript-eslint/typescript-estree');
19
18
 
20
19
  const webpack = unplugin.createWebpackPlugin(index.unpluginFactory);
21
20
 
package/lib/webpack.mjs CHANGED
@@ -13,7 +13,6 @@ import 'picocolors';
13
13
  import '@eslint-community/eslint-utils';
14
14
  import '@intlify/vue-i18n-extensions';
15
15
  import '@typescript-eslint/scope-manager';
16
- import '@typescript-eslint/typescript-estree';
17
16
 
18
17
  const webpack = createWebpackPlugin(unpluginFactory);
19
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "11.0.3",
3
+ "version": "11.1.0",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
@@ -35,7 +35,7 @@
35
35
  "picocolors": "^1.0.0",
36
36
  "unplugin": "^2.3.4",
37
37
  "vue": "^3.5.21",
38
- "@intlify/bundle-utils": "11.0.3"
38
+ "@intlify/bundle-utils": "11.1.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@intlify/core-base": "next",