unplugin-vue-components 28.4.0 → 28.5.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
@@ -341,7 +341,7 @@ export default {
341
341
 
342
342
  // `customLoaderMatcher` is depreacted, use `include` instead
343
343
  - customLoaderMatcher: id => id.endsWith('.md'),
344
- + include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
344
+ + include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/, /\.md$/],
345
345
  }),
346
346
  ],
347
347
  }
@@ -401,7 +401,7 @@ Components({
401
401
 
402
402
  // Filters for transforming targets (components to insert the auto import)
403
403
  // Note these are NOT about including/excluding components registered - use `globs` or `excludeNames` for that
404
- include: [/\.vue$/, /\.vue\?vue/],
404
+ include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/],
405
405
  exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
406
406
 
407
407
  // Filters for component names that will not be imported
@@ -15,7 +15,7 @@
15
15
 
16
16
 
17
17
 
18
- var _chunkCYD4VYHZcjs = require('./chunk-CYD4VYHZ.cjs');
18
+ var _chunkDNROZFEWcjs = require('./chunk-DNROZFEW.cjs');
19
19
 
20
20
  // src/core/unplugin.ts
21
21
  var _fs = require('fs');
@@ -57,7 +57,7 @@ var TypeImportPresets = [
57
57
 
58
58
  // src/core/type-imports/detect.ts
59
59
  function detectTypeImports() {
60
- return TypeImportPresets.map((i) => _localpkg.isPackageExists.call(void 0, i.from) ? i : void 0).filter(_chunkCYD4VYHZcjs.notNullish);
60
+ return TypeImportPresets.map((i) => _localpkg.isPackageExists.call(void 0, i.from) ? i : void 0).filter(_chunkDNROZFEWcjs.notNullish);
61
61
  }
62
62
  function resolveTypeImports(imports) {
63
63
  return imports.flatMap((i) => i.names.map((n) => ({ from: i.from, name: n, as: n })));
@@ -77,10 +77,10 @@ function parseDeclaration(code) {
77
77
  component: {},
78
78
  directive: {}
79
79
  };
80
- const componentDeclaration = _optionalChain([/export\s+interface\s+GlobalComponents\s*\{.*?\}/s, 'access', _ => _.exec, 'call', _2 => _2(code), 'optionalAccess', _3 => _3[0]]);
80
+ const componentDeclaration = _optionalChain([/export\s+interface\s+GlobalComponents\s*\{.*?\}/s, 'access', _2 => _2.exec, 'call', _3 => _3(code), 'optionalAccess', _4 => _4[0]]);
81
81
  if (componentDeclaration)
82
82
  imports.component = extractImports(componentDeclaration);
83
- const directiveDeclaration = _optionalChain([/export\s+interface\s+ComponentCustomProperties\s*\{.*?\}/s, 'access', _4 => _4.exec, 'call', _5 => _5(code), 'optionalAccess', _6 => _6[0]]);
83
+ const directiveDeclaration = _optionalChain([/export\s+interface\s+ComponentCustomProperties\s*\{.*?\}/s, 'access', _5 => _5.exec, 'call', _6 => _6(code), 'optionalAccess', _7 => _7[0]]);
84
84
  if (directiveDeclaration)
85
85
  imports.directive = extractImports(directiveDeclaration);
86
86
  return imports;
@@ -88,14 +88,14 @@ function parseDeclaration(code) {
88
88
  function stringifyComponentInfo(filepath, { from: path, as: name, name: importName }, importPathTransform) {
89
89
  if (!name)
90
90
  return void 0;
91
- path = _chunkCYD4VYHZcjs.getTransformedPath.call(void 0, path, importPathTransform);
91
+ path = _chunkDNROZFEWcjs.getTransformedPath.call(void 0, path, importPathTransform);
92
92
  const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
93
- const entry = `typeof import('${_chunkCYD4VYHZcjs.slash.call(void 0, related)}')['${importName || "default"}']`;
93
+ const entry = `typeof import('${_chunkDNROZFEWcjs.slash.call(void 0, related)}')['${importName || "default"}']`;
94
94
  return [name, entry];
95
95
  }
96
96
  function stringifyComponentsInfo(filepath, components, importPathTransform) {
97
97
  return Object.fromEntries(
98
- components.map((info) => stringifyComponentInfo(filepath, info, importPathTransform)).filter(_chunkCYD4VYHZcjs.notNullish)
98
+ components.map((info) => stringifyComponentInfo(filepath, info, importPathTransform)).filter(_chunkDNROZFEWcjs.notNullish)
99
99
  );
100
100
  }
101
101
  function getDeclarationImports(ctx, filepath) {
@@ -127,8 +127,8 @@ function getDeclaration(ctx, filepath, originalImports) {
127
127
  if (!imports)
128
128
  return;
129
129
  const declarations = {
130
- component: stringifyDeclarationImports({ ..._optionalChain([originalImports, 'optionalAccess', _7 => _7.component]), ...imports.component }),
131
- directive: stringifyDeclarationImports({ ..._optionalChain([originalImports, 'optionalAccess', _8 => _8.directive]), ...imports.directive })
130
+ component: stringifyDeclarationImports({ ..._optionalChain([originalImports, 'optionalAccess', _8 => _8.component]), ...imports.component }),
131
+ directive: stringifyDeclarationImports({ ..._optionalChain([originalImports, 'optionalAccess', _9 => _9.directive]), ...imports.directive })
132
132
  };
133
133
  let code = `/* eslint-disable */
134
134
  // @ts-nocheck
@@ -167,6 +167,22 @@ async function writeDeclaration(ctx, filepath, removeUnused = false) {
167
167
  if (code !== originalContent)
168
168
  await writeFile(filepath, code);
169
169
  }
170
+ async function writeComponentsJson(ctx, _removeUnused = false) {
171
+ if (!ctx.dumpComponentsInfoPath)
172
+ return;
173
+ const components = [
174
+ ...Object.entries({
175
+ ...ctx.componentNameMap,
176
+ ...ctx.componentCustomMap
177
+ }).map(([_, { name, as, from }]) => ({
178
+ name: name || "default",
179
+ as,
180
+ from
181
+ })),
182
+ ...resolveTypeImports(ctx.options.types)
183
+ ];
184
+ await writeFile(ctx.dumpComponentsInfoPath, JSON.stringify(components, null, 2));
185
+ }
170
186
 
171
187
  // src/core/fs/glob.ts
172
188
 
@@ -182,7 +198,7 @@ function searchComponents(ctx) {
182
198
  absolute: true,
183
199
  expandDirectories: false
184
200
  });
185
- if (!files.length && !_optionalChain([ctx, 'access', _9 => _9.options, 'access', _10 => _10.resolvers, 'optionalAccess', _11 => _11.length]))
201
+ if (!files.length && !_optionalChain([ctx, 'access', _10 => _10.options, 'access', _11 => _11.resolvers, 'optionalAccess', _12 => _12.length]))
186
202
  console.warn("[unplugin-vue-components] no components found");
187
203
  debug(`${files.length} components found.`);
188
204
  ctx.addComponents(files);
@@ -205,22 +221,22 @@ var defaultOptions = {
205
221
  allowOverrides: false
206
222
  };
207
223
  function normalizeResolvers(resolvers) {
208
- return _chunkCYD4VYHZcjs.toArray.call(void 0, resolvers).flat().map((r) => typeof r === "function" ? { resolve: r, type: "component" } : r);
224
+ return _chunkDNROZFEWcjs.toArray.call(void 0, resolvers).flat().map((r) => typeof r === "function" ? { resolve: r, type: "component" } : r);
209
225
  }
210
226
  function resolveGlobsExclude(root, glob) {
211
227
  const excludeReg = /^!/;
212
- return _chunkCYD4VYHZcjs.slash.call(void 0, `${excludeReg.test(glob) ? "!" : ""}${_path.resolve.call(void 0, root, glob.replace(excludeReg, ""))}`);
228
+ return _chunkDNROZFEWcjs.slash.call(void 0, `${excludeReg.test(glob) ? "!" : ""}${_path.resolve.call(void 0, root, glob.replace(excludeReg, ""))}`);
213
229
  }
214
230
  function resolveOptions(options, root) {
215
231
  const resolved = Object.assign({}, defaultOptions, options);
216
232
  resolved.resolvers = normalizeResolvers(resolved.resolvers);
217
- resolved.extensions = _chunkCYD4VYHZcjs.toArray.call(void 0, resolved.extensions);
233
+ resolved.extensions = _chunkDNROZFEWcjs.toArray.call(void 0, resolved.extensions);
218
234
  if (resolved.globs) {
219
- resolved.globs = _chunkCYD4VYHZcjs.toArray.call(void 0, resolved.globs).map((glob) => resolveGlobsExclude(root, glob));
235
+ resolved.globs = _chunkDNROZFEWcjs.toArray.call(void 0, resolved.globs).map((glob) => resolveGlobsExclude(root, glob));
220
236
  resolved.resolvedDirs = [];
221
237
  } else {
222
238
  const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
223
- resolved.dirs = _chunkCYD4VYHZcjs.toArray.call(void 0, resolved.dirs);
239
+ resolved.dirs = _chunkDNROZFEWcjs.toArray.call(void 0, resolved.dirs);
224
240
  const globs = resolved.dirs.map((i) => resolveGlobsExclude(root, i));
225
241
  resolved.resolvedDirs = globs.filter((i) => !i.startsWith("!"));
226
242
  resolved.globs = globs.map((i) => {
@@ -229,14 +245,12 @@ function resolveOptions(options, root) {
229
245
  prefix = "!";
230
246
  i = i.slice(1);
231
247
  }
232
- return resolved.deep ? prefix + _chunkCYD4VYHZcjs.slash.call(void 0, _path.join.call(void 0, i, `**/*.${extsGlob}`)) : prefix + _chunkCYD4VYHZcjs.slash.call(void 0, _path.join.call(void 0, i, `*.${extsGlob}`));
248
+ return resolved.deep ? prefix + _chunkDNROZFEWcjs.slash.call(void 0, _path.join.call(void 0, i, `**/*.${extsGlob}`)) : prefix + _chunkDNROZFEWcjs.slash.call(void 0, _path.join.call(void 0, i, `*.${extsGlob}`));
233
249
  });
234
250
  if (!resolved.extensions.length)
235
251
  throw new Error("[unplugin-vue-components] `extensions` option is required to search for components");
236
252
  }
237
- if (!resolved.globsExclude)
238
- resolved.globsExclude = [`**/node_modules/**`];
239
- resolved.globsExclude = _chunkCYD4VYHZcjs.toArray.call(void 0, resolved.globsExclude || []).map((i) => resolveGlobsExclude(root, i));
253
+ resolved.globsExclude = _chunkDNROZFEWcjs.toArray.call(void 0, resolved.globsExclude || []).map((i) => resolveGlobsExclude(root, i));
240
254
  resolved.globs = resolved.globs.filter((i) => {
241
255
  if (!i.startsWith("!"))
242
256
  return true;
@@ -259,7 +273,7 @@ function resolveOptions(options, root) {
259
273
  return resolved;
260
274
  }
261
275
  function getVueVersion(root) {
262
- const raw = _optionalChain([_localpkg.getPackageInfoSync.call(void 0, "vue", { paths: [_path.join.call(void 0, root, "/")] }), 'optionalAccess', _12 => _12.version]) || "3";
276
+ const raw = _optionalChain([_localpkg.getPackageInfoSync.call(void 0, "vue", { paths: [_path.join.call(void 0, root, "/")] }), 'optionalAccess', _13 => _13.version]) || "3";
263
277
  const version = +raw.split(".").slice(0, 2).join(".");
264
278
  if (version === 2.7)
265
279
  return 2.7;
@@ -313,12 +327,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
313
327
  const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s, ctx.options.transformerUserResolveFunctions);
314
328
  for (const { rawName, replace } of results) {
315
329
  debug2(`| ${rawName}`);
316
- const name = _chunkCYD4VYHZcjs.pascalCase.call(void 0, rawName);
330
+ const name = _chunkDNROZFEWcjs.pascalCase.call(void 0, rawName);
317
331
  ctx.updateUsageMap(sfcPath, [name]);
318
332
  const component = await ctx.findComponent(name, "component", [sfcPath]);
319
333
  if (component) {
320
334
  const varName = `__unplugin_components_${no}`;
321
- s.prepend(`${_chunkCYD4VYHZcjs.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
335
+ s.prepend(`${_chunkDNROZFEWcjs.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
322
336
  `);
323
337
  no += 1;
324
338
  replace(varName);
@@ -336,7 +350,7 @@ function getRenderFnStart(program) {
336
350
  const renderFn = program.body.find(
337
351
  (node) => node.type === "VariableDeclaration" && node.declarations[0].id.type === "Identifier" && ["render", "_sfc_render"].includes(node.declarations[0].id.name)
338
352
  );
339
- const start = _optionalChain([renderFn, 'optionalAccess', _13 => _13.declarations, 'access', _14 => _14[0], 'access', _15 => _15.init, 'optionalAccess', _16 => _16.body, 'optionalAccess', _17 => _17.start]);
353
+ const start = _optionalChain([renderFn, 'optionalAccess', _14 => _14.declarations, 'access', _15 => _15[0], 'access', _16 => _16.init, 'optionalAccess', _17 => _17.body, 'optionalAccess', _18 => _18.start]);
340
354
  if (start === null || start === void 0)
341
355
  throw new Error("[unplugin-vue-components:directive] Cannot find render function position.");
342
356
  return start + 1;
@@ -367,20 +381,20 @@ async function resolveVue22(code, s) {
367
381
  const results = [];
368
382
  for (const node of nodes) {
369
383
  const { callee, arguments: args } = node;
370
- if (callee.type !== "Identifier" || callee.name !== "_c" || _optionalChain([args, 'access', _18 => _18[1], 'optionalAccess', _19 => _19.type]) !== "ObjectExpression")
384
+ if (callee.type !== "Identifier" || callee.name !== "_c" || _optionalChain([args, 'access', _19 => _19[1], 'optionalAccess', _20 => _20.type]) !== "ObjectExpression")
371
385
  continue;
372
- const directives = _optionalChain([args, 'access', _20 => _20[1], 'access', _21 => _21.properties, 'access', _22 => _22.find, 'call', _23 => _23(
386
+ const directives = _optionalChain([args, 'access', _21 => _21[1], 'access', _22 => _22.properties, 'access', _23 => _23.find, 'call', _24 => _24(
373
387
  (property) => property.type === "ObjectProperty" && property.key.type === "Identifier" && property.key.name === "directives"
374
- ), 'optionalAccess', _24 => _24.value]);
388
+ ), 'optionalAccess', _25 => _25.value]);
375
389
  if (!directives || directives.type !== "ArrayExpression")
376
390
  continue;
377
391
  for (const directive of directives.elements) {
378
- if (_optionalChain([directive, 'optionalAccess', _25 => _25.type]) !== "ObjectExpression")
392
+ if (_optionalChain([directive, 'optionalAccess', _26 => _26.type]) !== "ObjectExpression")
379
393
  continue;
380
- const nameNode = _optionalChain([directive, 'access', _26 => _26.properties, 'access', _27 => _27.find, 'call', _28 => _28(
394
+ const nameNode = _optionalChain([directive, 'access', _27 => _27.properties, 'access', _28 => _28.find, 'call', _29 => _29(
381
395
  (p) => p.type === "ObjectProperty" && p.key.type === "Identifier" && p.key.name === "name"
382
- ), 'optionalAccess', _29 => _29.value]);
383
- if (_optionalChain([nameNode, 'optionalAccess', _30 => _30.type]) !== "StringLiteral")
396
+ ), 'optionalAccess', _30 => _30.value]);
397
+ if (_optionalChain([nameNode, 'optionalAccess', _31 => _31.type]) !== "StringLiteral")
384
398
  continue;
385
399
  const name = nameNode.value;
386
400
  if (!name || name.startsWith("_"))
@@ -424,13 +438,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
424
438
  const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
425
439
  for (const { rawName, replace } of results) {
426
440
  debug3(`| ${rawName}`);
427
- const name = `${_chunkCYD4VYHZcjs.DIRECTIVE_IMPORT_PREFIX}${_chunkCYD4VYHZcjs.pascalCase.call(void 0, rawName)}`;
441
+ const name = `${_chunkDNROZFEWcjs.DIRECTIVE_IMPORT_PREFIX}${_chunkDNROZFEWcjs.pascalCase.call(void 0, rawName)}`;
428
442
  ctx.updateUsageMap(sfcPath, [name]);
429
443
  const directive = await ctx.findComponent(name, "directive", [sfcPath]);
430
444
  if (!directive)
431
445
  continue;
432
446
  const varName = `__unplugin_directives_${no}`;
433
- s.prepend(`${_chunkCYD4VYHZcjs.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
447
+ s.prepend(`${_chunkDNROZFEWcjs.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
434
448
  `);
435
449
  no += 1;
436
450
  replace(varName);
@@ -449,7 +463,7 @@ function transformer(ctx, transformer2) {
449
463
  await transformComponent(code, transformer2, s, ctx, sfcPath);
450
464
  if (ctx.options.directives)
451
465
  await transformDirective(code, transformer2, s, ctx, sfcPath);
452
- s.prepend(_chunkCYD4VYHZcjs.DISABLE_COMMENT);
466
+ s.prepend(_chunkDNROZFEWcjs.DISABLE_COMMENT);
453
467
  const result = { code: s.toString() };
454
468
  if (ctx.sourcemap)
455
469
  result.map = s.generateMap({ source: id, includeContent: true, hires: "boundary" });
@@ -469,7 +483,13 @@ var Context = (_class = class {
469
483
  constructor(rawOptions) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);
470
484
  this.rawOptions = rawOptions;
471
485
  this.options = resolveOptions(rawOptions, this.root);
472
- this.generateDeclaration = _chunkCYD4VYHZcjs.throttle.call(void 0, 500, this._generateDeclaration.bind(this), { noLeading: false });
486
+ this.sourcemap = _nullishCoalesce(rawOptions.sourcemap, () => ( true));
487
+ this.generateDeclaration = _chunkDNROZFEWcjs.throttle.call(void 0, 500, this._generateDeclaration.bind(this), { noLeading: false });
488
+ if (this.options.dumpComponentsInfo) {
489
+ const dumpComponentsInfo = this.options.dumpComponentsInfo === true ? "./.components-info.json" : _nullishCoalesce(this.options.dumpComponentsInfo, () => ( false));
490
+ this.dumpComponentsInfoPath = dumpComponentsInfo;
491
+ this.generateComponentsJson = _chunkDNROZFEWcjs.throttle.call(void 0, 500, this._generateComponentsJson.bind(this), { noLeading: false });
492
+ }
473
493
  this.setTransformer(this.options.transformer);
474
494
  }
475
495
 
@@ -483,6 +503,7 @@ var Context = (_class = class {
483
503
  __init7() {this.root = _process2.default.cwd()}
484
504
  __init8() {this.sourcemap = true}
485
505
  __init9() {this.alias = {}}
506
+
486
507
  setRoot(root) {
487
508
  if (this.root === root)
488
509
  return;
@@ -495,7 +516,7 @@ var Context = (_class = class {
495
516
  this.transformer = transformer(this, name || "vue3");
496
517
  }
497
518
  transform(code, id) {
498
- const { path, query } = _chunkCYD4VYHZcjs.parseId.call(void 0, id);
519
+ const { path, query } = _chunkDNROZFEWcjs.parseId.call(void 0, id);
499
520
  return this.transformer(code, id, path, query);
500
521
  }
501
522
  setupViteServer(server) {
@@ -507,16 +528,16 @@ var Context = (_class = class {
507
528
  setupWatcher(watcher) {
508
529
  const { globs } = this.options;
509
530
  watcher.on("unlink", (path) => {
510
- if (!_chunkCYD4VYHZcjs.matchGlobs.call(void 0, path, globs))
531
+ if (!_chunkDNROZFEWcjs.matchGlobs.call(void 0, path, globs))
511
532
  return;
512
- path = _chunkCYD4VYHZcjs.slash.call(void 0, path);
533
+ path = _chunkDNROZFEWcjs.slash.call(void 0, path);
513
534
  this.removeComponents(path);
514
535
  this.onUpdate(path);
515
536
  });
516
537
  watcher.on("add", (path) => {
517
- if (!_chunkCYD4VYHZcjs.matchGlobs.call(void 0, path, globs))
538
+ if (!_chunkDNROZFEWcjs.matchGlobs.call(void 0, path, globs))
518
539
  return;
519
- path = _chunkCYD4VYHZcjs.slash.call(void 0, path);
540
+ path = _chunkDNROZFEWcjs.slash.call(void 0, path);
520
541
  this.addComponents(path);
521
542
  this.onUpdate(path);
522
543
  });
@@ -527,16 +548,16 @@ var Context = (_class = class {
527
548
  setupWatcherWebpack(watcher, emitUpdate) {
528
549
  const { globs } = this.options;
529
550
  watcher.on("unlink", (path) => {
530
- if (!_chunkCYD4VYHZcjs.matchGlobs.call(void 0, path, globs))
551
+ if (!_chunkDNROZFEWcjs.matchGlobs.call(void 0, path, globs))
531
552
  return;
532
- path = _chunkCYD4VYHZcjs.slash.call(void 0, path);
553
+ path = _chunkDNROZFEWcjs.slash.call(void 0, path);
533
554
  this.removeComponents(path);
534
555
  emitUpdate(path, "unlink");
535
556
  });
536
557
  watcher.on("add", (path) => {
537
- if (!_chunkCYD4VYHZcjs.matchGlobs.call(void 0, path, globs))
558
+ if (!_chunkDNROZFEWcjs.matchGlobs.call(void 0, path, globs))
538
559
  return;
539
- path = _chunkCYD4VYHZcjs.slash.call(void 0, path);
560
+ path = _chunkDNROZFEWcjs.slash.call(void 0, path);
540
561
  this.addComponents(path);
541
562
  emitUpdate(path, "add");
542
563
  });
@@ -556,7 +577,7 @@ var Context = (_class = class {
556
577
  addComponents(paths) {
557
578
  debug5.components("add", paths);
558
579
  const size = this._componentPaths.size;
559
- _chunkCYD4VYHZcjs.toArray.call(void 0, paths).forEach((p) => this._componentPaths.add(p));
580
+ _chunkDNROZFEWcjs.toArray.call(void 0, paths).forEach((p) => this._componentPaths.add(p));
560
581
  if (this._componentPaths.size !== size) {
561
582
  this.updateComponentNameMap();
562
583
  return true;
@@ -574,7 +595,7 @@ var Context = (_class = class {
574
595
  removeComponents(paths) {
575
596
  debug5.components("remove", paths);
576
597
  const size = this._componentPaths.size;
577
- _chunkCYD4VYHZcjs.toArray.call(void 0, paths).forEach((p) => this._componentPaths.delete(p));
598
+ _chunkDNROZFEWcjs.toArray.call(void 0, paths).forEach((p) => this._componentPaths.delete(p));
578
599
  if (this._componentPaths.size !== size) {
579
600
  this.updateComponentNameMap();
580
601
  return true;
@@ -583,6 +604,7 @@ var Context = (_class = class {
583
604
  }
584
605
  onUpdate(path) {
585
606
  this.generateDeclaration();
607
+ this.generateComponentsJson();
586
608
  if (!this._server)
587
609
  return;
588
610
  const payload = {
@@ -590,10 +612,10 @@ var Context = (_class = class {
590
612
  updates: []
591
613
  };
592
614
  const timestamp = +/* @__PURE__ */ new Date();
593
- const name = _chunkCYD4VYHZcjs.pascalCase.call(void 0, _chunkCYD4VYHZcjs.getNameFromFilePath.call(void 0, path, this.options));
615
+ const name = _chunkDNROZFEWcjs.pascalCase.call(void 0, _chunkDNROZFEWcjs.getNameFromFilePath.call(void 0, path, this.options));
594
616
  Object.entries(this._componentUsageMap).forEach(([key, values]) => {
595
617
  if (values.has(name)) {
596
- const r = `/${_chunkCYD4VYHZcjs.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
618
+ const r = `/${_chunkDNROZFEWcjs.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
597
619
  payload.updates.push({
598
620
  acceptedPath: r,
599
621
  path: r,
@@ -608,8 +630,8 @@ var Context = (_class = class {
608
630
  updateComponentNameMap() {
609
631
  this._componentNameMap = {};
610
632
  Array.from(this._componentPaths).forEach((path) => {
611
- const name = _chunkCYD4VYHZcjs.pascalCase.call(void 0, _chunkCYD4VYHZcjs.getNameFromFilePath.call(void 0, path, this.options));
612
- if (_chunkCYD4VYHZcjs.isExclude.call(void 0, name, this.options.excludeNames)) {
633
+ const name = _chunkDNROZFEWcjs.pascalCase.call(void 0, _chunkDNROZFEWcjs.getNameFromFilePath.call(void 0, path, this.options));
634
+ if (_chunkDNROZFEWcjs.isExclude.call(void 0, name, this.options.excludeNames)) {
613
635
  debug5.components("exclude", name);
614
636
  return;
615
637
  }
@@ -630,7 +652,7 @@ var Context = (_class = class {
630
652
  for (const resolver of this.options.resolvers) {
631
653
  if (resolver.type !== type)
632
654
  continue;
633
- const result = await resolver.resolve(type === "directive" ? name.slice(_chunkCYD4VYHZcjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
655
+ const result = await resolver.resolve(type === "directive" ? name.slice(_chunkDNROZFEWcjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
634
656
  if (!result)
635
657
  continue;
636
658
  if (typeof result === "string") {
@@ -641,7 +663,7 @@ var Context = (_class = class {
641
663
  } else {
642
664
  info = {
643
665
  as: name,
644
- ..._chunkCYD4VYHZcjs.normalizeComponentInfo.call(void 0, result)
666
+ ..._chunkDNROZFEWcjs.normalizeComponentInfo.call(void 0, result)
645
667
  };
646
668
  }
647
669
  if (type === "component")
@@ -653,12 +675,12 @@ var Context = (_class = class {
653
675
  return void 0;
654
676
  }
655
677
  normalizePath(path) {
656
- return _chunkCYD4VYHZcjs.resolveAlias.call(void 0, path, _optionalChain([this, 'access', _31 => _31.viteConfig, 'optionalAccess', _32 => _32.resolve, 'optionalAccess', _33 => _33.alias]) || _optionalChain([this, 'access', _34 => _34.viteConfig, 'optionalAccess', _35 => _35.alias]) || []);
678
+ return _chunkDNROZFEWcjs.resolveAlias.call(void 0, path, _optionalChain([this, 'access', _32 => _32.viteConfig, 'optionalAccess', _33 => _33.resolve, 'optionalAccess', _34 => _34.alias]) || _optionalChain([this, 'access', _35 => _35.viteConfig, 'optionalAccess', _36 => _36.alias]) || []);
657
679
  }
658
680
  relative(path) {
659
681
  if (path.startsWith("/") && !path.startsWith(this.root))
660
- return _chunkCYD4VYHZcjs.slash.call(void 0, path.slice(1));
661
- return _chunkCYD4VYHZcjs.slash.call(void 0, _path.relative.call(void 0, this.root, path));
682
+ return _chunkDNROZFEWcjs.slash.call(void 0, path.slice(1));
683
+ return _chunkDNROZFEWcjs.slash.call(void 0, _path.relative.call(void 0, this.root, path));
662
684
  }
663
685
  __init10() {this._searched = false}
664
686
  /**
@@ -676,12 +698,21 @@ var Context = (_class = class {
676
698
  _generateDeclaration(removeUnused = !this._server) {
677
699
  if (!this.options.dts)
678
700
  return;
679
- debug5.declaration("generating");
701
+ debug5.declaration("generating dts");
680
702
  return writeDeclaration(this, this.options.dts, removeUnused);
681
703
  }
682
704
  generateDeclaration(removeUnused = !this._server) {
683
705
  this._generateDeclaration(removeUnused);
684
706
  }
707
+ _generateComponentsJson(removeUnused = !this._server) {
708
+ if (!Object.keys(this._componentNameMap).length)
709
+ return;
710
+ debug5.components("generating components-info");
711
+ return writeComponentsJson(this, removeUnused);
712
+ }
713
+ generateComponentsJson(removeUnused = !this._server) {
714
+ this._generateComponentsJson(removeUnused);
715
+ }
685
716
  get componentNameMap() {
686
717
  return this._componentNameMap;
687
718
  }
@@ -697,7 +728,13 @@ var Context = (_class = class {
697
728
  var PLUGIN_NAME = "unplugin:webpack";
698
729
  var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
699
730
  const filter = _unpluginutils.createFilter.call(void 0,
700
- options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
731
+ options.include || [
732
+ /\.vue$/,
733
+ /\.vue\?vue/,
734
+ /\.vue\.[tj]sx?\?vue/,
735
+ // for vue-loader with experimentalInlineMatchResource enabled
736
+ /\.vue\?v=/
737
+ ],
701
738
  options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]
702
739
  );
703
740
  const ctx = new Context(options);
@@ -706,7 +743,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
706
743
  return await ctx.findComponent(name, "component", filename ? [filename] : []);
707
744
  },
708
745
  stringifyImport(info) {
709
- return _chunkCYD4VYHZcjs.stringifyComponentImport.call(void 0, info, ctx);
746
+ return _chunkDNROZFEWcjs.stringifyComponentImport.call(void 0, info, ctx);
710
747
  }
711
748
  };
712
749
  return {
@@ -717,11 +754,12 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
717
754
  return filter(id);
718
755
  },
719
756
  async transform(code, id) {
720
- if (!_chunkCYD4VYHZcjs.shouldTransform.call(void 0, code))
757
+ if (!_chunkDNROZFEWcjs.shouldTransform.call(void 0, code))
721
758
  return null;
722
759
  try {
723
760
  const result = await ctx.transform(code, id);
724
761
  ctx.generateDeclaration();
762
+ ctx.generateComponentsJson();
725
763
  return result;
726
764
  } catch (e) {
727
765
  this.error(e);
@@ -738,6 +776,10 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
738
776
  if (!_fs.existsSync.call(void 0, ctx.options.dts))
739
777
  ctx.generateDeclaration();
740
778
  }
779
+ if (ctx.options.dumpComponentsInfo && ctx.dumpComponentsInfoPath) {
780
+ if (!_fs.existsSync.call(void 0, ctx.dumpComponentsInfoPath))
781
+ ctx.generateComponentsJson();
782
+ }
741
783
  if (config.build.watch && config.command === "build")
742
784
  ctx.setupWatcher(_chokidar2.default.watch(ctx.options.globs));
743
785
  },
@@ -216,7 +216,7 @@ var require_brace_expansion = __commonJS({
216
216
  import { parse } from "node:path";
217
217
  import process2 from "node:process";
218
218
 
219
- // node_modules/.pnpm/@antfu+utils@9.0.0/node_modules/@antfu/utils/dist/index.mjs
219
+ // node_modules/.pnpm/@antfu+utils@9.2.0/node_modules/@antfu/utils/dist/index.mjs
220
220
  function toArray(array) {
221
221
  array = array ?? [];
222
222
  return Array.isArray(array) ? array : [array];
@@ -224,10 +224,10 @@ function toArray(array) {
224
224
  function notNullish(v) {
225
225
  return v != null;
226
226
  }
227
- var VOID = Symbol("p-void");
228
227
  function slash(str) {
229
228
  return str.replace(/\\/g, "/");
230
229
  }
230
+ var VOID = Symbol("p-void");
231
231
  function throttle$1(delay, callback, options) {
232
232
  var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
233
233
  var timeoutID;
@@ -216,7 +216,7 @@ var require_brace_expansion = _chunk3HT76LNNcjs.__commonJS.call(void 0, {
216
216
  var _path = require('path');
217
217
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
218
218
 
219
- // node_modules/.pnpm/@antfu+utils@9.0.0/node_modules/@antfu/utils/dist/index.mjs
219
+ // node_modules/.pnpm/@antfu+utils@9.2.0/node_modules/@antfu/utils/dist/index.mjs
220
220
  function toArray(array) {
221
221
  array = _nullishCoalesce(array, () => ( []));
222
222
  return Array.isArray(array) ? array : [array];
@@ -224,10 +224,10 @@ function toArray(array) {
224
224
  function notNullish(v) {
225
225
  return v != null;
226
226
  }
227
- var VOID = Symbol("p-void");
228
227
  function slash(str) {
229
228
  return str.replace(/\\/g, "/");
230
229
  }
230
+ var VOID = Symbol("p-void");
231
231
  function throttle$1(delay, callback, options) {
232
232
  var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
233
233
  var timeoutID;
@@ -15,7 +15,7 @@ import {
15
15
  stringifyComponentImport,
16
16
  throttle,
17
17
  toArray
18
- } from "./chunk-UZ5LIG7M.js";
18
+ } from "./chunk-AXRVJ5GF.js";
19
19
 
20
20
  // src/core/unplugin.ts
21
21
  import { existsSync as existsSync2 } from "node:fs";
@@ -167,6 +167,22 @@ async function writeDeclaration(ctx, filepath, removeUnused = false) {
167
167
  if (code !== originalContent)
168
168
  await writeFile(filepath, code);
169
169
  }
170
+ async function writeComponentsJson(ctx, _removeUnused = false) {
171
+ if (!ctx.dumpComponentsInfoPath)
172
+ return;
173
+ const components = [
174
+ ...Object.entries({
175
+ ...ctx.componentNameMap,
176
+ ...ctx.componentCustomMap
177
+ }).map(([_, { name, as, from }]) => ({
178
+ name: name || "default",
179
+ as,
180
+ from
181
+ })),
182
+ ...resolveTypeImports(ctx.options.types)
183
+ ];
184
+ await writeFile(ctx.dumpComponentsInfoPath, JSON.stringify(components, null, 2));
185
+ }
170
186
 
171
187
  // src/core/fs/glob.ts
172
188
  import Debug from "debug";
@@ -234,8 +250,6 @@ function resolveOptions(options, root) {
234
250
  if (!resolved.extensions.length)
235
251
  throw new Error("[unplugin-vue-components] `extensions` option is required to search for components");
236
252
  }
237
- if (!resolved.globsExclude)
238
- resolved.globsExclude = [`**/node_modules/**`];
239
253
  resolved.globsExclude = toArray(resolved.globsExclude || []).map((i) => resolveGlobsExclude(root, i));
240
254
  resolved.globs = resolved.globs.filter((i) => {
241
255
  if (!i.startsWith("!"))
@@ -469,7 +483,13 @@ var Context = class {
469
483
  constructor(rawOptions) {
470
484
  this.rawOptions = rawOptions;
471
485
  this.options = resolveOptions(rawOptions, this.root);
486
+ this.sourcemap = rawOptions.sourcemap ?? true;
472
487
  this.generateDeclaration = throttle(500, this._generateDeclaration.bind(this), { noLeading: false });
488
+ if (this.options.dumpComponentsInfo) {
489
+ const dumpComponentsInfo = this.options.dumpComponentsInfo === true ? "./.components-info.json" : this.options.dumpComponentsInfo ?? false;
490
+ this.dumpComponentsInfoPath = dumpComponentsInfo;
491
+ this.generateComponentsJson = throttle(500, this._generateComponentsJson.bind(this), { noLeading: false });
492
+ }
473
493
  this.setTransformer(this.options.transformer);
474
494
  }
475
495
  options;
@@ -483,6 +503,7 @@ var Context = class {
483
503
  root = process.cwd();
484
504
  sourcemap = true;
485
505
  alias = {};
506
+ dumpComponentsInfoPath;
486
507
  setRoot(root) {
487
508
  if (this.root === root)
488
509
  return;
@@ -583,6 +604,7 @@ var Context = class {
583
604
  }
584
605
  onUpdate(path) {
585
606
  this.generateDeclaration();
607
+ this.generateComponentsJson();
586
608
  if (!this._server)
587
609
  return;
588
610
  const payload = {
@@ -676,12 +698,21 @@ var Context = class {
676
698
  _generateDeclaration(removeUnused = !this._server) {
677
699
  if (!this.options.dts)
678
700
  return;
679
- debug5.declaration("generating");
701
+ debug5.declaration("generating dts");
680
702
  return writeDeclaration(this, this.options.dts, removeUnused);
681
703
  }
682
704
  generateDeclaration(removeUnused = !this._server) {
683
705
  this._generateDeclaration(removeUnused);
684
706
  }
707
+ _generateComponentsJson(removeUnused = !this._server) {
708
+ if (!Object.keys(this._componentNameMap).length)
709
+ return;
710
+ debug5.components("generating components-info");
711
+ return writeComponentsJson(this, removeUnused);
712
+ }
713
+ generateComponentsJson(removeUnused = !this._server) {
714
+ this._generateComponentsJson(removeUnused);
715
+ }
685
716
  get componentNameMap() {
686
717
  return this._componentNameMap;
687
718
  }
@@ -697,7 +728,13 @@ var Context = class {
697
728
  var PLUGIN_NAME = "unplugin:webpack";
698
729
  var unplugin_default = createUnplugin((options = {}) => {
699
730
  const filter = createFilter(
700
- options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
731
+ options.include || [
732
+ /\.vue$/,
733
+ /\.vue\?vue/,
734
+ /\.vue\.[tj]sx?\?vue/,
735
+ // for vue-loader with experimentalInlineMatchResource enabled
736
+ /\.vue\?v=/
737
+ ],
701
738
  options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]
702
739
  );
703
740
  const ctx = new Context(options);
@@ -722,6 +759,7 @@ var unplugin_default = createUnplugin((options = {}) => {
722
759
  try {
723
760
  const result = await ctx.transform(code, id);
724
761
  ctx.generateDeclaration();
762
+ ctx.generateComponentsJson();
725
763
  return result;
726
764
  } catch (e) {
727
765
  this.error(e);
@@ -738,6 +776,10 @@ var unplugin_default = createUnplugin((options = {}) => {
738
776
  if (!existsSync2(ctx.options.dts))
739
777
  ctx.generateDeclaration();
740
778
  }
779
+ if (ctx.options.dumpComponentsInfo && ctx.dumpComponentsInfoPath) {
780
+ if (!existsSync2(ctx.dumpComponentsInfoPath))
781
+ ctx.generateComponentsJson();
782
+ }
741
783
  if (config.build.watch && config.command === "build")
742
784
  ctx.setupWatcher(chokidar.watch(ctx.options.globs));
743
785
  },
package/dist/esbuild.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunkZ44OFZ6Mcjs.unplugin_default.esbuild;
9
+ var esbuild_default = _chunk2L7VET54cjs.unplugin_default.esbuild;
10
10
 
11
11
 
12
12
  exports.default = esbuild_default;
package/dist/esbuild.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkCYD4VYHZcjs = require('./chunk-CYD4VYHZ.cjs');
8
+ var _chunkDNROZFEWcjs = require('./chunk-DNROZFEW.cjs');
9
9
  require('./chunk-3HT76LNN.cjs');
10
10
  require('./chunk-ZBPRDZS4.cjs');
11
11
 
@@ -13,4 +13,4 @@ require('./chunk-ZBPRDZS4.cjs');
13
13
 
14
14
 
15
15
 
16
- exports.camelCase = _chunkCYD4VYHZcjs.camelCase; exports.default = _chunkZ44OFZ6Mcjs.unplugin_default; exports.kebabCase = _chunkCYD4VYHZcjs.kebabCase; exports.pascalCase = _chunkCYD4VYHZcjs.pascalCase;
16
+ exports.camelCase = _chunkDNROZFEWcjs.camelCase; exports.default = _chunk2L7VET54cjs.unplugin_default; exports.kebabCase = _chunkDNROZFEWcjs.kebabCase; exports.pascalCase = _chunkDNROZFEWcjs.pascalCase;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
4
  import {
5
5
  camelCase,
6
6
  kebabCase,
7
7
  pascalCase
8
- } from "./chunk-UZ5LIG7M.js";
8
+ } from "./chunk-AXRVJ5GF.js";
9
9
  import "./chunk-QGM4M3NI.js";
10
10
  import "./chunk-6F4PWJZI.js";
11
11
  export {
package/dist/nuxt.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
@@ -9,8 +9,8 @@ require('./chunk-ZBPRDZS4.cjs');
9
9
  var _kit = require('@nuxt/kit');
10
10
  var nuxt_default = _kit.defineNuxtModule.call(void 0, {
11
11
  setup(options) {
12
- _kit.addWebpackPlugin.call(void 0, _chunkZ44OFZ6Mcjs.unplugin_default.webpack(options));
13
- _kit.addVitePlugin.call(void 0, _chunkZ44OFZ6Mcjs.unplugin_default.vite(options));
12
+ _kit.addWebpackPlugin.call(void 0, _chunk2L7VET54cjs.unplugin_default.webpack(options));
13
+ _kit.addVitePlugin.call(void 0, _chunk2L7VET54cjs.unplugin_default.vite(options));
14
14
  }
15
15
  });
16
16
 
package/dist/nuxt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkCYD4VYHZcjs = require('./chunk-CYD4VYHZ.cjs');
8
+ var _chunkDNROZFEWcjs = require('./chunk-DNROZFEW.cjs');
9
9
 
10
10
 
11
11
  var _chunk3HT76LNNcjs = require('./chunk-3HT76LNN.cjs');
@@ -220,7 +220,7 @@ function getStyleDir(compName) {
220
220
  }
221
221
  }
222
222
  if (!styleDir)
223
- styleDir = _chunkCYD4VYHZcjs.kebabCase.call(void 0, compName);
223
+ styleDir = _chunkDNROZFEWcjs.kebabCase.call(void 0, compName);
224
224
  return styleDir;
225
225
  }
226
226
  function getSideEffects(compName, options) {
@@ -405,7 +405,7 @@ var matchComponents2 = [
405
405
  function getComponentStyleDir(importName, importStyle) {
406
406
  if (["ConfigProvider", "Icon"].includes(importName))
407
407
  return void 0;
408
- let componentDir = _chunkCYD4VYHZcjs.kebabCase.call(void 0, importName);
408
+ let componentDir = _chunkDNROZFEWcjs.kebabCase.call(void 0, importName);
409
409
  for (const item of matchComponents2) {
410
410
  if (item.pattern.test(importName)) {
411
411
  componentDir = item.componentDir;
@@ -441,7 +441,7 @@ function ArcoResolver(options = {}) {
441
441
  type: "component",
442
442
  resolve: (name) => {
443
443
  if (canResolveIcons(options.resolveIcons)) {
444
- const iconPrefix = _chunkCYD4VYHZcjs.pascalCase.call(void 0, getResolveIconPrefix(options.resolveIcons));
444
+ const iconPrefix = _chunkDNROZFEWcjs.pascalCase.call(void 0, getResolveIconPrefix(options.resolveIcons));
445
445
  const newNameRegexp = new RegExp(`^${iconPrefix}Icon`);
446
446
  if (newNameRegexp.test(name)) {
447
447
  debug("found icon component name %s", name);
@@ -454,7 +454,7 @@ function ArcoResolver(options = {}) {
454
454
  };
455
455
  }
456
456
  }
457
- if (name.match(/^A[A-Z]/) && !_chunkCYD4VYHZcjs.isExclude.call(void 0, name, options.exclude)) {
457
+ if (name.match(/^A[A-Z]/) && !_chunkDNROZFEWcjs.isExclude.call(void 0, name, options.exclude)) {
458
458
  const importStyle = _nullishCoalesce(options.importStyle, () => ( "css"));
459
459
  const importName = name.slice(1);
460
460
  const config = {
@@ -618,7 +618,7 @@ function getSideEffects2(name, filename) {
618
618
  function componentsResolver(name, { ssr }) {
619
619
  if (!name.match(/^D[A-Z]/))
620
620
  return;
621
- const resolveId = _chunkCYD4VYHZcjs.kebabCase.call(void 0, name = name.slice(1));
621
+ const resolveId = _chunkDNROZFEWcjs.kebabCase.call(void 0, name = name.slice(1));
622
622
  return {
623
623
  name,
624
624
  sideEffects: getSideEffects2(resolveId, "style.css"),
@@ -626,7 +626,7 @@ function componentsResolver(name, { ssr }) {
626
626
  };
627
627
  }
628
628
  function directivesResolver(name, { ssr }) {
629
- const resolveId = _chunkCYD4VYHZcjs.kebabCase.call(void 0, name);
629
+ const resolveId = _chunkDNROZFEWcjs.kebabCase.call(void 0, name);
630
630
  return {
631
631
  name: `${name}Directive`,
632
632
  sideEffects: getSideEffects2(resolveId, "style.css"),
@@ -767,7 +767,7 @@ function resolveComponent(name, options) {
767
767
  from: "@element-plus/icons-vue"
768
768
  };
769
769
  }
770
- const partialName = _chunkCYD4VYHZcjs.kebabCase.call(void 0, name.slice(2));
770
+ const partialName = _chunkDNROZFEWcjs.kebabCase.call(void 0, name.slice(2));
771
771
  const { version, ssr, nightly } = options;
772
772
  if (compare(version, "1.1.0-beta.1", ">=") || nightly) {
773
773
  return {
@@ -815,7 +815,7 @@ function ElementPlusResolver(options = {}) {
815
815
  return optionsResolved;
816
816
  optionsResolved = {
817
817
  ssr: false,
818
- version: await _chunkCYD4VYHZcjs.getPkgVersion.call(void 0, "element-plus", "2.2.2"),
818
+ version: await _chunkDNROZFEWcjs.getPkgVersion.call(void 0, "element-plus", "2.2.2"),
819
819
  importStyle: "css",
820
820
  directives: true,
821
821
  exclude: void 0,
@@ -869,7 +869,7 @@ function ElementUiResolver(options = {}) {
869
869
  return;
870
870
  if (/^El[A-Z]/.test(name)) {
871
871
  const compName = name.slice(2);
872
- const partialName = _chunkCYD4VYHZcjs.kebabCase.call(void 0, compName);
872
+ const partialName = _chunkDNROZFEWcjs.kebabCase.call(void 0, compName);
873
873
  if (partialName === "collapse-transition") {
874
874
  return {
875
875
  from: `element-ui/lib/transitions/${partialName}`
@@ -984,11 +984,11 @@ function IduxResolver(options = {}) {
984
984
  const packageName = getPackageName(name);
985
985
  if (!packageName)
986
986
  return;
987
- const resolvedVersion = await _chunkCYD4VYHZcjs.getPkgVersion.call(void 0, `${scope}/${packageName}`, "2.0.0");
987
+ const resolvedVersion = await _chunkDNROZFEWcjs.getPkgVersion.call(void 0, `${scope}/${packageName}`, "2.0.0");
988
988
  let dirname = specialComponents[name];
989
989
  if (!dirname) {
990
990
  const nameIndex = packageName === "pro" ? 2 : 1;
991
- dirname = _chunkCYD4VYHZcjs.kebabCase.call(void 0, name).split("-")[nameIndex];
991
+ dirname = _chunkDNROZFEWcjs.kebabCase.call(void 0, name).split("-")[nameIndex];
992
992
  }
993
993
  const path = `${scope}/${packageName}/${dirname}`;
994
994
  const sideEffects = packageName === "cdk" ? void 0 : getSideEffects5(resolvedVersion, path, importStyle, importStyleTheme);
@@ -1251,7 +1251,7 @@ function getSideEffects6(importName, options) {
1251
1251
  }
1252
1252
  function resolveComponent2(importName, options) {
1253
1253
  let name;
1254
- if (_chunkCYD4VYHZcjs.isExclude.call(void 0, importName, options.exclude))
1254
+ if (_chunkDNROZFEWcjs.isExclude.call(void 0, importName, options.exclude))
1255
1255
  return void 0;
1256
1256
  if (options.resolveIcons && importName.match(iconsRE)) {
1257
1257
  name = importName;
@@ -1450,7 +1450,7 @@ function TDesignResolver(options = {}) {
1450
1450
  resolve: (name) => {
1451
1451
  const { library = "vue", exclude } = options;
1452
1452
  const importFrom = options.esm ? "/esm" : "";
1453
- if (_chunkCYD4VYHZcjs.isExclude.call(void 0, name, exclude))
1453
+ if (_chunkDNROZFEWcjs.isExclude.call(void 0, name, exclude))
1454
1454
  return;
1455
1455
  if (options.resolveIcons && name.match(/[a-z]Icon$/)) {
1456
1456
  return {
@@ -1476,10 +1476,10 @@ function TDesignResolver(options = {}) {
1476
1476
  }
1477
1477
 
1478
1478
  // src/core/resolvers/vant.ts
1479
- var moduleType = _chunkCYD4VYHZcjs.isSSR ? "lib" : "es";
1479
+ var moduleType = _chunkDNROZFEWcjs.isSSR ? "lib" : "es";
1480
1480
  function getSideEffects7(dirName, options) {
1481
1481
  const { importStyle = true } = options;
1482
- if (!importStyle || _chunkCYD4VYHZcjs.isSSR)
1482
+ if (!importStyle || _chunkDNROZFEWcjs.isSSR)
1483
1483
  return;
1484
1484
  if (importStyle === "less")
1485
1485
  return `vant/${moduleType}/${dirName}/style/less`;
@@ -1496,7 +1496,7 @@ function VantResolver(options = {}) {
1496
1496
  return {
1497
1497
  name: partialName,
1498
1498
  from: `vant/${moduleType}`,
1499
- sideEffects: getSideEffects7(_chunkCYD4VYHZcjs.kebabCase.call(void 0, partialName), options)
1499
+ sideEffects: getSideEffects7(_chunkDNROZFEWcjs.kebabCase.call(void 0, partialName), options)
1500
1500
  };
1501
1501
  }
1502
1502
  }
@@ -1519,9 +1519,9 @@ function getResolved(name, options) {
1519
1519
  const sideEffects = [];
1520
1520
  if (importStyle || importCss) {
1521
1521
  if (importStyle === "less" || importLess)
1522
- sideEffects.push(`${path}/es/${_chunkCYD4VYHZcjs.kebabCase.call(void 0, name)}/style/less`);
1522
+ sideEffects.push(`${path}/es/${_chunkDNROZFEWcjs.kebabCase.call(void 0, name)}/style/less`);
1523
1523
  else
1524
- sideEffects.push(`${path}/es/${_chunkCYD4VYHZcjs.kebabCase.call(void 0, name)}/style/index${styleExtname}`);
1524
+ sideEffects.push(`${path}/es/${_chunkDNROZFEWcjs.kebabCase.call(void 0, name)}/style/index${styleExtname}`);
1525
1525
  }
1526
1526
  return {
1527
1527
  from: path,
@@ -1584,9 +1584,9 @@ function VeuiResolver(options = {}) {
1584
1584
  };
1585
1585
  }
1586
1586
  var formatters = {
1587
- "kebab-case": _chunkCYD4VYHZcjs.kebabCase,
1588
- "camelCase": _chunkCYD4VYHZcjs.camelCase,
1589
- "PascalCase": _chunkCYD4VYHZcjs.pascalCase
1587
+ "kebab-case": _chunkDNROZFEWcjs.kebabCase,
1588
+ "camelCase": _chunkDNROZFEWcjs.camelCase,
1589
+ "PascalCase": _chunkDNROZFEWcjs.pascalCase
1590
1590
  };
1591
1591
  var peerPaths = /* @__PURE__ */ new Map();
1592
1592
  function assertPeerPath(peerPath) {
@@ -1646,12 +1646,12 @@ function getCompDir(compName) {
1646
1646
  for (let i = 0; i < total; i++) {
1647
1647
  const matcher = matchComponents4[i];
1648
1648
  if (compName.match(matcher.pattern)) {
1649
- compPath = `${matcher.compDir}/${_chunkCYD4VYHZcjs.kebabCase.call(void 0, compName)}.vue`;
1649
+ compPath = `${matcher.compDir}/${_chunkDNROZFEWcjs.kebabCase.call(void 0, compName)}.vue`;
1650
1650
  break;
1651
1651
  }
1652
1652
  }
1653
1653
  if (!compPath)
1654
- compPath = _chunkCYD4VYHZcjs.kebabCase.call(void 0, compName);
1654
+ compPath = _chunkDNROZFEWcjs.kebabCase.call(void 0, compName);
1655
1655
  return compPath;
1656
1656
  }
1657
1657
  function ViewUiResolver() {
package/dist/resolvers.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  isSSR,
6
6
  kebabCase,
7
7
  pascalCase
8
- } from "./chunk-UZ5LIG7M.js";
8
+ } from "./chunk-AXRVJ5GF.js";
9
9
  import {
10
10
  __require
11
11
  } from "./chunk-QGM4M3NI.js";
package/dist/rollup.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunkZ44OFZ6Mcjs.unplugin_default.rollup;
9
+ var rollup_default = _chunk2L7VET54cjs.unplugin_default.rollup;
10
10
 
11
11
 
12
12
  exports.default = rollup_default;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
package/dist/rspack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/rspack.ts
9
- var rspack_default = _chunkZ44OFZ6Mcjs.unplugin_default.rspack;
9
+ var rspack_default = _chunk2L7VET54cjs.unplugin_default.rspack;
10
10
 
11
11
 
12
12
  exports.default = rspack_default;
package/dist/rspack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
package/dist/types.d.cts CHANGED
@@ -81,7 +81,7 @@ interface Options {
81
81
  /**
82
82
  * Negated glob patterns to exclude files from being detected as components.
83
83
  *
84
- * @default ['<root>/**\/node_modules/**']
84
+ * @default []
85
85
  */
86
86
  globsExclude?: string | string[];
87
87
  /**
@@ -168,6 +168,21 @@ interface Options {
168
168
  * Vue version of project. It will detect automatically if not specified.
169
169
  */
170
170
  version?: 2 | 2.7 | 3;
171
+ /**
172
+ * Generate sourcemap for the transformed code.
173
+ *
174
+ * @default true
175
+ */
176
+ sourcemap?: boolean;
177
+ /**
178
+ * Save component information into a JSON file for other tools to consume.
179
+ * Provide a filepath to save the JSON file.
180
+ *
181
+ * When set to `true`, it will save to `./.components-info.json`
182
+ *
183
+ * @default false
184
+ */
185
+ dumpComponentsInfo?: boolean | string;
171
186
  }
172
187
  type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {
173
188
  resolvers: ComponentResolverObject[];
package/dist/types.d.ts CHANGED
@@ -81,7 +81,7 @@ interface Options {
81
81
  /**
82
82
  * Negated glob patterns to exclude files from being detected as components.
83
83
  *
84
- * @default ['<root>/**\/node_modules/**']
84
+ * @default []
85
85
  */
86
86
  globsExclude?: string | string[];
87
87
  /**
@@ -168,6 +168,21 @@ interface Options {
168
168
  * Vue version of project. It will detect automatically if not specified.
169
169
  */
170
170
  version?: 2 | 2.7 | 3;
171
+ /**
172
+ * Generate sourcemap for the transformed code.
173
+ *
174
+ * @default true
175
+ */
176
+ sourcemap?: boolean;
177
+ /**
178
+ * Save component information into a JSON file for other tools to consume.
179
+ * Provide a filepath to save the JSON file.
180
+ *
181
+ * When set to `true`, it will save to `./.components-info.json`
182
+ *
183
+ * @default false
184
+ */
185
+ dumpComponentsInfo?: boolean | string;
171
186
  }
172
187
  type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {
173
188
  resolvers: ComponentResolverObject[];
package/dist/vite.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/vite.ts
9
- var vite_default = _chunkZ44OFZ6Mcjs.unplugin_default.vite;
9
+ var vite_default = _chunk2L7VET54cjs.unplugin_default.vite;
10
10
 
11
11
 
12
12
  exports.default = vite_default;
package/dist/vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
package/dist/webpack.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZ44OFZ6Mcjs = require('./chunk-Z44OFZ6M.cjs');
4
- require('./chunk-CYD4VYHZ.cjs');
3
+ var _chunk2L7VET54cjs = require('./chunk-2L7VET54.cjs');
4
+ require('./chunk-DNROZFEW.cjs');
5
5
  require('./chunk-3HT76LNN.cjs');
6
6
  require('./chunk-ZBPRDZS4.cjs');
7
7
 
8
8
  // src/webpack.ts
9
- var webpack_default = _chunkZ44OFZ6Mcjs.unplugin_default.webpack;
9
+ var webpack_default = _chunk2L7VET54cjs.unplugin_default.webpack;
10
10
 
11
11
 
12
12
  exports.default = webpack_default;
package/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-GDXMSVFX.js";
4
- import "./chunk-UZ5LIG7M.js";
3
+ } from "./chunk-NY5XDZK3.js";
4
+ import "./chunk-AXRVJ5GF.js";
5
5
  import "./chunk-QGM4M3NI.js";
6
6
  import "./chunk-6F4PWJZI.js";
7
7
 
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "unplugin-vue-components",
3
3
  "type": "module",
4
- "version": "28.4.0",
4
+ "version": "28.5.0",
5
+ "packageManager": "pnpm@10.8.0",
5
6
  "description": "Components auto importing for Vue",
6
7
  "author": "antfu <anthonyfu117@hotmail.com>",
7
8
  "license": "MIT",
@@ -67,6 +68,17 @@
67
68
  "engines": {
68
69
  "node": ">=14"
69
70
  },
71
+ "scripts": {
72
+ "build": "tsup",
73
+ "dev": "tsup --watch src",
74
+ "example:build": "npm -C examples/vite-vue3 run build",
75
+ "example:dev": "npm -C examples/vite-vue3 run dev",
76
+ "prepublishOnly": "npm run build",
77
+ "lint": "eslint .",
78
+ "release": "bumpp && npm publish",
79
+ "test": "vitest",
80
+ "test:update": "vitest --u"
81
+ },
70
82
  "peerDependencies": {
71
83
  "@babel/parser": "^7.15.8",
72
84
  "@nuxt/kit": "^3.2.2",
@@ -83,48 +95,38 @@
83
95
  "dependencies": {
84
96
  "chokidar": "^3.6.0",
85
97
  "debug": "^4.4.0",
86
- "local-pkg": "^1.0.0",
98
+ "local-pkg": "^1.1.1",
87
99
  "magic-string": "^0.30.17",
88
100
  "mlly": "^1.7.4",
89
- "tinyglobby": "^0.2.10",
90
- "unplugin": "^2.2.0",
101
+ "tinyglobby": "^0.2.12",
102
+ "unplugin": "^2.3.2",
91
103
  "unplugin-utils": "^0.2.4"
92
104
  },
93
105
  "devDependencies": {
94
- "@antfu/eslint-config": "^4.2.0",
95
- "@antfu/utils": "^9.0.0",
96
- "@babel/parser": "^7.26.9",
97
- "@babel/types": "^7.26.9",
98
- "@nuxt/kit": "^3.15.4",
99
- "@nuxt/schema": "^3.15.4",
106
+ "@antfu/eslint-config": "^4.12.0",
107
+ "@antfu/utils": "^9.2.0",
108
+ "@babel/parser": "^7.27.0",
109
+ "@babel/types": "^7.27.0",
110
+ "@nuxt/kit": "^3.16.2",
111
+ "@nuxt/schema": "^3.16.2",
100
112
  "@types/debug": "^4.1.12",
101
113
  "@types/minimatch": "^5.1.2",
102
- "@types/node": "^22.13.4",
103
- "bumpp": "^10.0.3",
114
+ "@types/node": "^22.14.1",
115
+ "bumpp": "^10.1.0",
104
116
  "compare-versions": "^6.1.1",
105
- "element-plus": "^2.9.4",
106
- "eslint": "^9.20.1",
117
+ "element-plus": "^2.9.7",
118
+ "eslint": "^9.24.0",
107
119
  "eslint-plugin-format": "^1.0.1",
108
120
  "esno": "^4.8.0",
109
121
  "estree-walker": "^3.0.3",
110
122
  "minimatch": "^10.0.1",
111
123
  "pathe": "^2.0.3",
112
- "rollup": "^4.34.7",
113
- "tsup": "^8.3.6",
114
- "typescript": "^5.7.3",
115
- "vite": "^6.1.0",
116
- "vitest": "^3.0.5",
124
+ "rollup": "^4.40.0",
125
+ "tsup": "^8.4.0",
126
+ "typescript": "^5.8.3",
127
+ "vite": "^6.2.6",
128
+ "vitest": "^3.1.1",
117
129
  "vue": "3.2.45",
118
- "vue-tsc": "^2.2.0"
119
- },
120
- "scripts": {
121
- "build": "tsup",
122
- "dev": "tsup --watch src",
123
- "example:build": "npm -C examples/vite-vue3 run build",
124
- "example:dev": "npm -C examples/vite-vue3 run dev",
125
- "lint": "eslint .",
126
- "release": "bumpp && npm publish",
127
- "test": "vitest",
128
- "test:update": "vitest --u"
130
+ "vue-tsc": "^2.2.8"
129
131
  }
130
- }
132
+ }