@intlify/unplugin-vue-i18n 11.0.0 → 11.0.3

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
@@ -311,12 +311,10 @@ If you need to use programmatically dynamic resource construction, you would be
311
311
  Bundle target vue-i18n module. You can specify either `‘vue-i18n’` or `‘petite-vue-i18n’`.
312
312
 
313
313
  The default is `'vue-i18n'`, and the following installed in node_modules will be bundled.
314
-
315
314
  - development: `vue-i18n.esm-bundler.js`
316
315
  - production: `vue-i18n.runtime.esm-bundler.js`
317
316
 
318
317
  In the case of `‘petite-vue-i18n’`, the following installed in node_modules will be bundled.
319
-
320
318
  - development: `petite-vue-i18n.esm-bundler.js`
321
319
  - production: `petite-vue-i18n.runtime.esm-bundler.js`
322
320
 
package/lib/index.cjs CHANGED
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const createDebug = require('debug');
6
6
  const unplugin$1 = require('unplugin');
7
7
  const shared = require('@intlify/shared');
8
+ const pathe = require('pathe');
8
9
  const bundleUtils = require('@intlify/bundle-utils');
9
10
  const pluginutils = require('@rollup/pluginutils');
10
11
  const fg = require('fast-glob');
11
12
  const node_fs = require('node:fs');
12
13
  const path = require('node:path');
13
- const pathe = require('pathe');
14
14
  const compilerSfc = require('vue/compiler-sfc');
15
15
  const pc = require('picocolors');
16
16
  const eslintUitls = require('@eslint-community/eslint-utils');
@@ -26,6 +26,10 @@ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
26
26
  const pc__default = /*#__PURE__*/_interopDefaultCompat(pc);
27
27
  const eslintUitls__default = /*#__PURE__*/_interopDefaultCompat(eslintUitls);
28
28
 
29
+ function normalizeGlobOption(val) {
30
+ if (!val) return void 0;
31
+ return shared.isString(val) ? [pathe.normalize(val)] : val.map(pathe.normalize);
32
+ }
29
33
  function resolveOptions(options) {
30
34
  const moduleType = options.module || "vue-i18n";
31
35
  let onlyLocales = [];
@@ -47,8 +51,8 @@ function resolveOptions(options) {
47
51
  const translationIdentifiers = /* @__PURE__ */ new Map();
48
52
  const transformI18nBlock = typeof options.transformI18nBlock === "function" ? options.transformI18nBlock : null;
49
53
  return {
50
- include: options.include,
51
- exclude: options.exclude,
54
+ include: normalizeGlobOption(options.include || []),
55
+ exclude: normalizeGlobOption(options.exclude),
52
56
  module: moduleType,
53
57
  onlyLocales,
54
58
  forceStringify,
@@ -210,28 +214,11 @@ function resourcePlugin({
210
214
  }
211
215
  function resolveIncludeExclude() {
212
216
  const customBlockInclude = meta.framework === "vite" ? RE_SFC_I18N_CUSTOM_BLOCK : RE_SFC_I18N_WEBPACK_CUSTOM_BLOCK;
213
- if (shared.isArray(include)) {
214
- return [[...include, customBlockInclude], exclude];
215
- } else if (shared.isString(include)) {
216
- return [[include, customBlockInclude], exclude];
217
- } else {
218
- return [[RE_RESOURCE_FORMAT, customBlockInclude], exclude];
219
- }
217
+ return include ? [[...include, customBlockInclude], exclude] : [[RE_RESOURCE_FORMAT, customBlockInclude], exclude];
220
218
  }
221
219
  function resolveIncludeExcludeForLegacy() {
222
220
  const customBlockInclude = meta.framework === "vite" ? RE_SFC_I18N_CUSTOM_BLOCK : RE_SFC_I18N_WEBPACK_CUSTOM_BLOCK;
223
- let _include = void 0;
224
- let _exclude = void 0;
225
- if (include) {
226
- if (shared.isArray(include)) {
227
- _include = [...include.map((item) => pathe.normalize(item)), customBlockInclude];
228
- } else if (shared.isString(include)) {
229
- _include = [pathe.normalize(include), customBlockInclude];
230
- }
231
- } else {
232
- _exclude = "**/**";
233
- }
234
- return [_include, _exclude];
221
+ return include ? [[...include, customBlockInclude], void 0] : [void 0, ["**/**"]];
235
222
  }
236
223
  let _filter = null;
237
224
  async function getFilter() {
@@ -399,8 +386,7 @@ function resourcePlugin({
399
386
  debug$2("load", id);
400
387
  if (INTLIFY_BUNDLE_IMPORT_ID === getVirtualId(id, meta.framework) && include) {
401
388
  let resourcePaths = [];
402
- const includePaths = shared.isArray(include) ? include : [include];
403
- for (const inc of includePaths) {
389
+ for (const inc of include) {
404
390
  resourcePaths = [...resourcePaths, ...await fg__default(inc)];
405
391
  }
406
392
  resourcePaths = resourcePaths.filter((el, pos) => resourcePaths.indexOf(el) === pos);
package/lib/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import createDebug from 'debug';
2
2
  import { createUnplugin } from 'unplugin';
3
3
  import { isArray, isString, isBoolean, assign, isEmptyObject, isNumber, generateCodeFrame } from '@intlify/shared';
4
+ import { normalize } from 'pathe';
4
5
  import { generateJSON, generateYAML, generateJavaScript, generateTypescript } from '@intlify/bundle-utils';
5
6
  import { createFilter } from '@rollup/pluginutils';
6
7
  import fg from 'fast-glob';
7
8
  import { promises } from 'node:fs';
8
9
  import path, { parse } from 'node:path';
9
- import { normalize } from 'pathe';
10
10
  import { parse as parse$1 } from 'vue/compiler-sfc';
11
11
  import pc from 'picocolors';
12
12
  import eslintUitls from '@eslint-community/eslint-utils';
@@ -14,6 +14,10 @@ import { transformVTDirective } from '@intlify/vue-i18n-extensions';
14
14
  import { analyze } from '@typescript-eslint/scope-manager';
15
15
  import { parse as parse$2, simpleTraverse, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree';
16
16
 
17
+ function normalizeGlobOption(val) {
18
+ if (!val) return void 0;
19
+ return isString(val) ? [normalize(val)] : val.map(normalize);
20
+ }
17
21
  function resolveOptions(options) {
18
22
  const moduleType = options.module || "vue-i18n";
19
23
  let onlyLocales = [];
@@ -35,8 +39,8 @@ function resolveOptions(options) {
35
39
  const translationIdentifiers = /* @__PURE__ */ new Map();
36
40
  const transformI18nBlock = typeof options.transformI18nBlock === "function" ? options.transformI18nBlock : null;
37
41
  return {
38
- include: options.include,
39
- exclude: options.exclude,
42
+ include: normalizeGlobOption(options.include || []),
43
+ exclude: normalizeGlobOption(options.exclude),
40
44
  module: moduleType,
41
45
  onlyLocales,
42
46
  forceStringify,
@@ -198,28 +202,11 @@ function resourcePlugin({
198
202
  }
199
203
  function resolveIncludeExclude() {
200
204
  const customBlockInclude = meta.framework === "vite" ? RE_SFC_I18N_CUSTOM_BLOCK : RE_SFC_I18N_WEBPACK_CUSTOM_BLOCK;
201
- if (isArray(include)) {
202
- return [[...include, customBlockInclude], exclude];
203
- } else if (isString(include)) {
204
- return [[include, customBlockInclude], exclude];
205
- } else {
206
- return [[RE_RESOURCE_FORMAT, customBlockInclude], exclude];
207
- }
205
+ return include ? [[...include, customBlockInclude], exclude] : [[RE_RESOURCE_FORMAT, customBlockInclude], exclude];
208
206
  }
209
207
  function resolveIncludeExcludeForLegacy() {
210
208
  const customBlockInclude = meta.framework === "vite" ? RE_SFC_I18N_CUSTOM_BLOCK : RE_SFC_I18N_WEBPACK_CUSTOM_BLOCK;
211
- let _include = void 0;
212
- let _exclude = void 0;
213
- if (include) {
214
- if (isArray(include)) {
215
- _include = [...include.map((item) => normalize(item)), customBlockInclude];
216
- } else if (isString(include)) {
217
- _include = [normalize(include), customBlockInclude];
218
- }
219
- } else {
220
- _exclude = "**/**";
221
- }
222
- return [_include, _exclude];
209
+ return include ? [[...include, customBlockInclude], void 0] : [void 0, ["**/**"]];
223
210
  }
224
211
  let _filter = null;
225
212
  async function getFilter() {
@@ -387,8 +374,7 @@ function resourcePlugin({
387
374
  debug$2("load", id);
388
375
  if (INTLIFY_BUNDLE_IMPORT_ID === getVirtualId(id, meta.framework) && include) {
389
376
  let resourcePaths = [];
390
- const includePaths = isArray(include) ? include : [include];
391
- for (const inc of includePaths) {
377
+ for (const inc of include) {
392
378
  resourcePaths = [...resourcePaths, ...await fg(inc)];
393
379
  }
394
380
  resourcePaths = resourcePaths.filter((el, pos) => resourcePaths.indexOf(el) === pos);
package/lib/vite.cjs CHANGED
@@ -4,12 +4,12 @@ const unplugin = require('unplugin');
4
4
  const index = require('./index.cjs');
5
5
  require('debug');
6
6
  require('@intlify/shared');
7
+ require('pathe');
7
8
  require('@intlify/bundle-utils');
8
9
  require('@rollup/pluginutils');
9
10
  require('fast-glob');
10
11
  require('node:fs');
11
12
  require('node:path');
12
- require('pathe');
13
13
  require('vue/compiler-sfc');
14
14
  require('picocolors');
15
15
  require('@eslint-community/eslint-utils');
package/lib/vite.mjs CHANGED
@@ -2,12 +2,12 @@ import { createVitePlugin } from 'unplugin';
2
2
  import { unpluginFactory } from './index.mjs';
3
3
  import 'debug';
4
4
  import '@intlify/shared';
5
+ import 'pathe';
5
6
  import '@intlify/bundle-utils';
6
7
  import '@rollup/pluginutils';
7
8
  import 'fast-glob';
8
9
  import 'node:fs';
9
10
  import 'node:path';
10
- import 'pathe';
11
11
  import 'vue/compiler-sfc';
12
12
  import 'picocolors';
13
13
  import '@eslint-community/eslint-utils';
package/lib/webpack.cjs CHANGED
@@ -4,12 +4,12 @@ const unplugin = require('unplugin');
4
4
  const index = require('./index.cjs');
5
5
  require('debug');
6
6
  require('@intlify/shared');
7
+ require('pathe');
7
8
  require('@intlify/bundle-utils');
8
9
  require('@rollup/pluginutils');
9
10
  require('fast-glob');
10
11
  require('node:fs');
11
12
  require('node:path');
12
- require('pathe');
13
13
  require('vue/compiler-sfc');
14
14
  require('picocolors');
15
15
  require('@eslint-community/eslint-utils');
package/lib/webpack.mjs CHANGED
@@ -2,12 +2,12 @@ import { createWebpackPlugin } from 'unplugin';
2
2
  import { unpluginFactory } from './index.mjs';
3
3
  import 'debug';
4
4
  import '@intlify/shared';
5
+ import 'pathe';
5
6
  import '@intlify/bundle-utils';
6
7
  import '@rollup/pluginutils';
7
8
  import 'fast-glob';
8
9
  import 'node:fs';
9
10
  import 'node:path';
10
- import 'pathe';
11
11
  import 'vue/compiler-sfc';
12
12
  import 'picocolors';
13
13
  import '@eslint-community/eslint-utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlify/unplugin-vue-i18n",
3
- "version": "11.0.0",
3
+ "version": "11.0.3",
4
4
  "description": "unplugin for Vue I18n",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@eslint-community/eslint-utils": "^4.4.0",
27
- "@intlify/shared": "^11.1.10",
27
+ "@intlify/shared": "^11.1.12",
28
28
  "@intlify/vue-i18n-extensions": "^8.0.0",
29
29
  "@rollup/pluginutils": "^5.1.0",
30
30
  "@typescript-eslint/scope-manager": "^8.13.0",
@@ -34,25 +34,25 @@
34
34
  "fast-glob": "^3.2.12",
35
35
  "picocolors": "^1.0.0",
36
36
  "unplugin": "^2.3.4",
37
- "vue": "^3.5.14",
38
- "@intlify/bundle-utils": "11.0.0"
37
+ "vue": "^3.5.21",
38
+ "@intlify/bundle-utils": "11.0.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@intlify/core-base": "next",
42
42
  "@types/debug": "^4.1.5",
43
43
  "@types/jsdom": "^16.2.5",
44
44
  "@types/memory-fs": "^0.3.2",
45
- "@types/node": "^22.15.19",
45
+ "@types/node": "^22.18.4",
46
46
  "@vitejs/plugin-vue": "^5.2.4",
47
47
  "jsdom": "^25.0.1",
48
48
  "memory-fs": "^0.5.0",
49
- "source-map-js": "^1.0.2",
50
- "ts-loader": "^9.5.2",
51
- "unbuild": "^3.5.0",
52
- "vite": "^6.3.5",
49
+ "source-map-js": "^1.2.1",
50
+ "ts-loader": "^9.5.4",
51
+ "unbuild": "^3.6.1",
52
+ "vite": "^6.3.6",
53
53
  "rollup-vite": "npm:vite@^6.3.5",
54
54
  "vue-loader": "^17.4.2",
55
- "webpack": "^5.99.8",
55
+ "webpack": "^5.101.3",
56
56
  "webpack-merge": "^5.9.0"
57
57
  },
58
58
  "engines": {