unplugin-vue-components 0.22.6 → 0.22.8

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
@@ -163,6 +163,8 @@ export default {
163
163
  }
164
164
  </script>
165
165
  ```
166
+ > **Note**
167
+ > By default this plugin will import components in the `src/components` path. You can customize it using the `dirs` option.
166
168
 
167
169
  ## TypeScript
168
170
 
@@ -192,6 +194,7 @@ Supported Resolvers:
192
194
  - [Headless UI](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/headless-ui.ts)
193
195
  - [IDux](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/idux.ts)
194
196
  - [Inkline](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/inkline.ts)
197
+ - [Ionic](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/ionic.ts)
195
198
  - [Naive UI](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/naive-ui.ts)
196
199
  - [Prime Vue](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/prime-vue.ts)
197
200
  - [Quasar](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/quasar.ts)
@@ -109,6 +109,7 @@ function getNameFromFilePath(filePath, options) {
109
109
  if (directoryAsNamespace) {
110
110
  if (globalNamespaces.some((name) => folders.includes(name)))
111
111
  folders = folders.filter((f) => !globalNamespaces.includes(f));
112
+ folders = folders.map((f) => f.replace(/[^a-zA-Z0-9]/g, ""));
112
113
  if (filename.toLowerCase() === "index")
113
114
  filename = "";
114
115
  if (!isEmpty(folders)) {
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunk2GXY7E6Xjs = require('./chunk-2GXY7E6X.js');
13
+ var _chunk5HMJAJIKjs = require('./chunk-5HMJAJIK.js');
14
14
 
15
15
  // src/core/unplugin.ts
16
16
  var _fs = require('fs');
@@ -159,7 +159,7 @@ function parseDeclaration(code) {
159
159
  function stringifyComponentInfo(filepath, { from: path, as: name, name: importName }, importPathTransform) {
160
160
  if (!name)
161
161
  return void 0;
162
- path = _chunk2GXY7E6Xjs.getTransformedPath.call(void 0, path, importPathTransform);
162
+ path = _chunk5HMJAJIKjs.getTransformedPath.call(void 0, path, importPathTransform);
163
163
  const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
164
164
  const entry = `typeof import('${_utils.slash.call(void 0, related)}')['${importName || "default"}']`;
165
165
  return [name, entry];
@@ -276,12 +276,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
276
276
  const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
277
277
  for (const { rawName, replace } of results) {
278
278
  debug2(`| ${rawName}`);
279
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, rawName);
279
+ const name = _chunk5HMJAJIKjs.pascalCase.call(void 0, rawName);
280
280
  ctx.updateUsageMap(sfcPath, [name]);
281
281
  const component = await ctx.findComponent(name, "component", [sfcPath]);
282
282
  if (component) {
283
283
  const varName = `__unplugin_components_${no}`;
284
- s.prepend(`${_chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
284
+ s.prepend(`${_chunk5HMJAJIKjs.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
285
285
  `);
286
286
  no += 1;
287
287
  replace(varName);
@@ -295,9 +295,9 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
295
295
 
296
296
  // src/core/transforms/directive/vue2.ts
297
297
 
298
- var getRenderFnStart = (ast) => {
298
+ var getRenderFnStart = (program) => {
299
299
  var _a, _b;
300
- const renderFn = ast.program.body.find(
300
+ const renderFn = program.body.find(
301
301
  (node) => node.type === "VariableDeclaration" && node.declarations[0].id.type === "Identifier" && ["render", "_sfc_render"].includes(node.declarations[0].id.name)
302
302
  );
303
303
  const start = (_b = (_a = renderFn == null ? void 0 : renderFn.declarations[0].init) == null ? void 0 : _a.body) == null ? void 0 : _b.start;
@@ -310,12 +310,12 @@ async function resolveVue22(code, s) {
310
310
  if (!_localpkg.isPackageExists.call(void 0, "@babel/parser"))
311
311
  throw new Error('[unplugin-vue-components:directive] To use Vue 2 directive you will need to install Babel first: "npm install -D @babel/parser"');
312
312
  const { parse } = await _localpkg.importModule.call(void 0, "@babel/parser");
313
- const ast = parse(code, {
313
+ const { program } = parse(code, {
314
314
  sourceType: "module"
315
315
  });
316
316
  const nodes = [];
317
317
  const { walk } = await Promise.resolve().then(() => require("./src-KKLCUN63.js"));
318
- walk(ast.program, {
318
+ walk(program, {
319
319
  enter(node) {
320
320
  if (node.type === "CallExpression")
321
321
  nodes.push(node);
@@ -323,8 +323,13 @@ async function resolveVue22(code, s) {
323
323
  });
324
324
  if (nodes.length === 0)
325
325
  return [];
326
+ let _renderStart;
327
+ const getRenderStart = () => {
328
+ if (_renderStart !== void 0)
329
+ return _renderStart;
330
+ return _renderStart = getRenderFnStart(program);
331
+ };
326
332
  const results = [];
327
- const renderStart = getRenderFnStart(ast);
328
333
  for (const node of nodes) {
329
334
  const { callee, arguments: args } = node;
330
335
  if (callee.type !== "Identifier" || callee.name !== "_c" || ((_a = args[1]) == null ? void 0 : _a.type) !== "ObjectExpression")
@@ -348,7 +353,7 @@ async function resolveVue22(code, s) {
348
353
  results.push({
349
354
  rawName: name,
350
355
  replace: (resolved) => {
351
- s.prependLeft(renderStart, `
356
+ s.prependLeft(getRenderStart(), `
352
357
  this.$options.directives["${name}"] = ${resolved};`);
353
358
  }
354
359
  });
@@ -381,13 +386,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
381
386
  const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
382
387
  for (const { rawName, replace } of results) {
383
388
  debug3(`| ${rawName}`);
384
- const name = `${_chunk2GXY7E6Xjs.DIRECTIVE_IMPORT_PREFIX}${_chunk2GXY7E6Xjs.pascalCase.call(void 0, rawName)}`;
389
+ const name = `${_chunk5HMJAJIKjs.DIRECTIVE_IMPORT_PREFIX}${_chunk5HMJAJIKjs.pascalCase.call(void 0, rawName)}`;
385
390
  ctx.updateUsageMap(sfcPath, [name]);
386
391
  const directive = await ctx.findComponent(name, "directive", [sfcPath]);
387
392
  if (!directive)
388
393
  continue;
389
394
  const varName = `__unplugin_directives_${no}`;
390
- s.prepend(`${_chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
395
+ s.prepend(`${_chunk5HMJAJIKjs.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
391
396
  `);
392
397
  no += 1;
393
398
  replace(varName);
@@ -406,7 +411,7 @@ function transformer(ctx, transformer2) {
406
411
  await transformComponent(code, transformer2, s, ctx, sfcPath);
407
412
  if (ctx.options.directives)
408
413
  await transformDirective(code, transformer2, s, ctx, sfcPath);
409
- s.prepend(_chunk2GXY7E6Xjs.DISABLE_COMMENT);
414
+ s.prepend(_chunk5HMJAJIKjs.DISABLE_COMMENT);
410
415
  const result = { code: s.toString() };
411
416
  if (ctx.sourcemap)
412
417
  result.map = s.generateMap({ source: id, includeContent: true });
@@ -451,7 +456,7 @@ var Context = class {
451
456
  this.transformer = transformer(this, name || "vue3");
452
457
  }
453
458
  transform(code, id) {
454
- const { path, query } = _chunk2GXY7E6Xjs.parseId.call(void 0, id);
459
+ const { path, query } = _chunk5HMJAJIKjs.parseId.call(void 0, id);
455
460
  return this.transformer(code, id, path, query);
456
461
  }
457
462
  setupViteServer(server) {
@@ -463,14 +468,14 @@ var Context = class {
463
468
  setupWatcher(watcher) {
464
469
  const { globs } = this.options;
465
470
  watcher.on("unlink", (path) => {
466
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
471
+ if (!_chunk5HMJAJIKjs.matchGlobs.call(void 0, path, globs))
467
472
  return;
468
473
  path = _utils.slash.call(void 0, path);
469
474
  this.removeComponents(path);
470
475
  this.onUpdate(path);
471
476
  });
472
477
  watcher.on("add", (path) => {
473
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
478
+ if (!_chunk5HMJAJIKjs.matchGlobs.call(void 0, path, globs))
474
479
  return;
475
480
  path = _utils.slash.call(void 0, path);
476
481
  this.addComponents(path);
@@ -480,14 +485,14 @@ var Context = class {
480
485
  setupWatcherWebpack(watcher, emitUpdate) {
481
486
  const { globs } = this.options;
482
487
  watcher.on("unlink", (path) => {
483
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
488
+ if (!_chunk5HMJAJIKjs.matchGlobs.call(void 0, path, globs))
484
489
  return;
485
490
  path = _utils.slash.call(void 0, path);
486
491
  this.removeComponents(path);
487
492
  emitUpdate(path, "unlink");
488
493
  });
489
494
  watcher.on("add", (path) => {
490
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
495
+ if (!_chunk5HMJAJIKjs.matchGlobs.call(void 0, path, globs))
491
496
  return;
492
497
  path = _utils.slash.call(void 0, path);
493
498
  this.addComponents(path);
@@ -538,7 +543,7 @@ var Context = class {
538
543
  updates: []
539
544
  };
540
545
  const timestamp = +new Date();
541
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, _chunk2GXY7E6Xjs.getNameFromFilePath.call(void 0, path, this.options));
546
+ const name = _chunk5HMJAJIKjs.pascalCase.call(void 0, _chunk5HMJAJIKjs.getNameFromFilePath.call(void 0, path, this.options));
542
547
  Object.entries(this._componentUsageMap).forEach(([key, values]) => {
543
548
  if (values.has(name)) {
544
549
  const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
@@ -556,7 +561,7 @@ var Context = class {
556
561
  updateComponentNameMap() {
557
562
  this._componentNameMap = {};
558
563
  Array.from(this._componentPaths).forEach((path) => {
559
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, _chunk2GXY7E6Xjs.getNameFromFilePath.call(void 0, path, this.options));
564
+ const name = _chunk5HMJAJIKjs.pascalCase.call(void 0, _chunk5HMJAJIKjs.getNameFromFilePath.call(void 0, path, this.options));
560
565
  if (this._componentNameMap[name] && !this.options.allowOverrides) {
561
566
  console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
562
567
  return;
@@ -574,7 +579,7 @@ var Context = class {
574
579
  for (const resolver of this.options.resolvers) {
575
580
  if (resolver.type !== type)
576
581
  continue;
577
- const result = await resolver.resolve(type === "directive" ? name.slice(_chunk2GXY7E6Xjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
582
+ const result = await resolver.resolve(type === "directive" ? name.slice(_chunk5HMJAJIKjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
578
583
  if (!result)
579
584
  continue;
580
585
  if (typeof result === "string") {
@@ -585,7 +590,7 @@ var Context = class {
585
590
  } else {
586
591
  info = {
587
592
  as: name,
588
- ..._chunk2GXY7E6Xjs.normalizeComponetInfo.call(void 0, result)
593
+ ..._chunk5HMJAJIKjs.normalizeComponetInfo.call(void 0, result)
589
594
  };
590
595
  }
591
596
  if (type === "component")
@@ -598,7 +603,7 @@ var Context = class {
598
603
  }
599
604
  normalizePath(path) {
600
605
  var _a, _b, _c;
601
- return _chunk2GXY7E6Xjs.resolveAlias.call(void 0, path, ((_b = (_a = this.viteConfig) == null ? void 0 : _a.resolve) == null ? void 0 : _b.alias) || ((_c = this.viteConfig) == null ? void 0 : _c.alias) || []);
606
+ return _chunk5HMJAJIKjs.resolveAlias.call(void 0, path, ((_b = (_a = this.viteConfig) == null ? void 0 : _a.resolve) == null ? void 0 : _b.alias) || ((_c = this.viteConfig) == null ? void 0 : _c.alias) || []);
602
607
  }
603
608
  relative(path) {
604
609
  if (path.startsWith("/") && !path.startsWith(this.root))
@@ -633,7 +638,7 @@ var Context = class {
633
638
  var PLUGIN_NAME = "unplugin:webpack";
634
639
  var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
635
640
  const filter = _pluginutils.createFilter.call(void 0,
636
- options.include || [/\.vue$/, /\.vue\?vue/],
641
+ options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
637
642
  options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]
638
643
  );
639
644
  const ctx = new Context(options);
@@ -642,7 +647,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
642
647
  return await ctx.findComponent(name, "component", filename ? [filename] : []);
643
648
  },
644
649
  stringifyImport(info) {
645
- return _chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, info, ctx);
650
+ return _chunk5HMJAJIKjs.stringifyComponentImport.call(void 0, info, ctx);
646
651
  }
647
652
  };
648
653
  return {
@@ -653,7 +658,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
653
658
  return filter(id);
654
659
  },
655
660
  async transform(code, id) {
656
- if (!_chunk2GXY7E6Xjs.shouldTransform.call(void 0, code))
661
+ if (!_chunk5HMJAJIKjs.shouldTransform.call(void 0, code))
657
662
  return null;
658
663
  try {
659
664
  const result = await ctx.transform(code, id);
@@ -109,6 +109,7 @@ function getNameFromFilePath(filePath, options) {
109
109
  if (directoryAsNamespace) {
110
110
  if (globalNamespaces.some((name) => folders.includes(name)))
111
111
  folders = folders.filter((f) => !globalNamespaces.includes(f));
112
+ folders = folders.map((f) => f.replace(/[^a-zA-Z0-9]/g, ""));
112
113
  if (filename.toLowerCase() === "index")
113
114
  filename = "";
114
115
  if (!isEmpty(folders)) {
@@ -10,7 +10,7 @@ import {
10
10
  resolveAlias,
11
11
  shouldTransform,
12
12
  stringifyComponentImport
13
- } from "./chunk-667B3WUW.mjs";
13
+ } from "./chunk-T47CWWYC.mjs";
14
14
 
15
15
  // src/core/unplugin.ts
16
16
  import { existsSync as existsSync2 } from "fs";
@@ -295,9 +295,9 @@ import Debug3 from "debug";
295
295
 
296
296
  // src/core/transforms/directive/vue2.ts
297
297
  import { importModule, isPackageExists as isPackageExists3 } from "local-pkg";
298
- var getRenderFnStart = (ast) => {
298
+ var getRenderFnStart = (program) => {
299
299
  var _a, _b;
300
- const renderFn = ast.program.body.find(
300
+ const renderFn = program.body.find(
301
301
  (node) => node.type === "VariableDeclaration" && node.declarations[0].id.type === "Identifier" && ["render", "_sfc_render"].includes(node.declarations[0].id.name)
302
302
  );
303
303
  const start = (_b = (_a = renderFn == null ? void 0 : renderFn.declarations[0].init) == null ? void 0 : _a.body) == null ? void 0 : _b.start;
@@ -310,12 +310,12 @@ async function resolveVue22(code, s) {
310
310
  if (!isPackageExists3("@babel/parser"))
311
311
  throw new Error('[unplugin-vue-components:directive] To use Vue 2 directive you will need to install Babel first: "npm install -D @babel/parser"');
312
312
  const { parse } = await importModule("@babel/parser");
313
- const ast = parse(code, {
313
+ const { program } = parse(code, {
314
314
  sourceType: "module"
315
315
  });
316
316
  const nodes = [];
317
317
  const { walk } = await import("./src-Z5BCFXFD.mjs");
318
- walk(ast.program, {
318
+ walk(program, {
319
319
  enter(node) {
320
320
  if (node.type === "CallExpression")
321
321
  nodes.push(node);
@@ -323,8 +323,13 @@ async function resolveVue22(code, s) {
323
323
  });
324
324
  if (nodes.length === 0)
325
325
  return [];
326
+ let _renderStart;
327
+ const getRenderStart = () => {
328
+ if (_renderStart !== void 0)
329
+ return _renderStart;
330
+ return _renderStart = getRenderFnStart(program);
331
+ };
326
332
  const results = [];
327
- const renderStart = getRenderFnStart(ast);
328
333
  for (const node of nodes) {
329
334
  const { callee, arguments: args } = node;
330
335
  if (callee.type !== "Identifier" || callee.name !== "_c" || ((_a = args[1]) == null ? void 0 : _a.type) !== "ObjectExpression")
@@ -348,7 +353,7 @@ async function resolveVue22(code, s) {
348
353
  results.push({
349
354
  rawName: name,
350
355
  replace: (resolved) => {
351
- s.prependLeft(renderStart, `
356
+ s.prependLeft(getRenderStart(), `
352
357
  this.$options.directives["${name}"] = ${resolved};`);
353
358
  }
354
359
  });
@@ -633,7 +638,7 @@ var Context = class {
633
638
  var PLUGIN_NAME = "unplugin:webpack";
634
639
  var unplugin_default = createUnplugin((options = {}) => {
635
640
  const filter = createFilter(
636
- options.include || [/\.vue$/, /\.vue\?vue/],
641
+ options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
637
642
  options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]
638
643
  );
639
644
  const ctx = new Context(options);
package/dist/esbuild.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
+ require('./chunk-5HMJAJIK.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunkSMCETF6Mjs.unplugin_default.esbuild;
9
+ var esbuild_default = _chunkALMYXVCOjs.unplugin_default.esbuild;
10
10
 
11
11
 
12
12
  module.exports = esbuild_default;
package/dist/esbuild.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
+ import "./chunk-T47CWWYC.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk2GXY7E6Xjs = require('./chunk-2GXY7E6X.js');
8
+ var _chunk5HMJAJIKjs = require('./chunk-5HMJAJIK.js');
9
9
  require('./chunk-EZUCZHGV.js');
10
10
  require('./chunk-6F4PWJZI.js');
11
11
 
@@ -13,4 +13,4 @@ require('./chunk-6F4PWJZI.js');
13
13
 
14
14
 
15
15
 
16
- exports.camelCase = _chunk2GXY7E6Xjs.camelCase; exports.default = _chunkSMCETF6Mjs.unplugin_default; exports.kebabCase = _chunk2GXY7E6Xjs.kebabCase; exports.pascalCase = _chunk2GXY7E6Xjs.pascalCase;
16
+ exports.camelCase = _chunk5HMJAJIKjs.camelCase; exports.default = _chunkALMYXVCOjs.unplugin_default; exports.kebabCase = _chunk5HMJAJIKjs.kebabCase; exports.pascalCase = _chunk5HMJAJIKjs.pascalCase;
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
4
  import {
5
5
  camelCase,
6
6
  kebabCase,
7
7
  pascalCase
8
- } from "./chunk-667B3WUW.mjs";
8
+ } from "./chunk-T47CWWYC.mjs";
9
9
  import "./chunk-AKU6F3WT.mjs";
10
10
  import "./chunk-WBQAMGXK.mjs";
11
11
  export {
package/dist/nuxt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
+ require('./chunk-5HMJAJIK.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
@@ -9,11 +9,11 @@ require('./chunk-6F4PWJZI.js');
9
9
  function nuxt_default(options) {
10
10
  this.extendBuild((config) => {
11
11
  config.plugins = config.plugins || [];
12
- config.plugins.unshift(_chunkSMCETF6Mjs.unplugin_default.webpack(options));
12
+ config.plugins.unshift(_chunkALMYXVCOjs.unplugin_default.webpack(options));
13
13
  });
14
14
  this.nuxt.hook("vite:extend", async (vite) => {
15
15
  vite.config.plugins = vite.config.plugins || [];
16
- vite.config.plugins.push(_chunkSMCETF6Mjs.unplugin_default.vite(options));
16
+ vite.config.plugins.push(_chunkALMYXVCOjs.unplugin_default.vite(options));
17
17
  });
18
18
  }
19
19
 
package/dist/nuxt.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
+ import "./chunk-T47CWWYC.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
@@ -251,6 +251,12 @@ interface VarletUIResolverOptions {
251
251
  * @default true
252
252
  */
253
253
  directives?: boolean;
254
+ /**
255
+ * compatible with unplugin-auto-import
256
+ *
257
+ * @default false
258
+ */
259
+ autoImport?: boolean;
254
260
  /**
255
261
  * @deprecated use `importStyle: 'css'` instead
256
262
  */
@@ -384,6 +390,14 @@ interface DevResolverOptions {
384
390
  }
385
391
  declare function DevUiResolver(options?: DevResolverOptions): ComponentResolver[];
386
392
 
393
+ declare type DisallowResolveIconOption = undefined | false | {
394
+ enable: false;
395
+ };
396
+ declare type AllowResolveIconOption = true | {
397
+ enable: true;
398
+ iconPrefix?: string;
399
+ };
400
+ declare type ResolveIconsOption = DisallowResolveIconOption | AllowResolveIconOption;
387
401
  interface ArcoResolverOptions {
388
402
  /**
389
403
  * import style css or less with components
@@ -396,7 +410,7 @@ interface ArcoResolverOptions {
396
410
  *
397
411
  * @default false
398
412
  */
399
- resolveIcons?: boolean;
413
+ resolveIcons?: ResolveIconsOption;
400
414
  /**
401
415
  * Control style automatic import
402
416
  *
@@ -482,4 +496,12 @@ interface BootstrapVueResolverOptions {
482
496
  */
483
497
  declare function BootstrapVueResolver(_options?: BootstrapVueResolverOptions): ComponentResolver[];
484
498
 
485
- export { AntDesignVueResolver, AntDesignVueResolverOptions, ArcoResolver, ArcoResolverOptions, BootstrapVueResolver, BootstrapVueResolverOptions, DevResolverOptions, DevUiResolver, ElementPlusResolver, ElementPlusResolverOptions, ElementUiResolver, ElementUiResolverOptions, HeadlessUiResolver, HeadlessUiResolverOptions, IduxResolver, IduxResolverOptions, InklineResolver, LayuiVueResolver, LayuiVueResolverOptions, NaiveUiResolver, PrimeVueResolver, PrimeVueResolverOptions, QuasarResolver, TDesignResolver, TDesignResolverOptions, VantResolver, VantResolverOptions, VarletUIResolver, VarletUIResolverOptions, VeuiResolver, VeuiResolverOptions, ViewUiResolver, VueUseComponentsResolver, VueUseDirectiveResolver, Vuetify3Resolver, VuetifyResolver, getResolved };
499
+ /**
500
+ * Resolver for ionic framework
501
+ *
502
+ * @author @mathsgod
503
+ * @link https://github.com/mathsgod
504
+ */
505
+ declare function IonicResolver(): ComponentResolver;
506
+
507
+ export { AllowResolveIconOption, AntDesignVueResolver, AntDesignVueResolverOptions, ArcoResolver, ArcoResolverOptions, BootstrapVueResolver, BootstrapVueResolverOptions, DevResolverOptions, DevUiResolver, DisallowResolveIconOption, ElementPlusResolver, ElementPlusResolverOptions, ElementUiResolver, ElementUiResolverOptions, HeadlessUiResolver, HeadlessUiResolverOptions, IduxResolver, IduxResolverOptions, InklineResolver, IonicResolver, LayuiVueResolver, LayuiVueResolverOptions, NaiveUiResolver, PrimeVueResolver, PrimeVueResolverOptions, QuasarResolver, ResolveIconsOption, TDesignResolver, TDesignResolverOptions, VantResolver, VantResolverOptions, VarletUIResolver, VarletUIResolverOptions, VeuiResolver, VeuiResolverOptions, ViewUiResolver, VueUseComponentsResolver, VueUseDirectiveResolver, Vuetify3Resolver, VuetifyResolver, getResolved };
package/dist/resolvers.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk2GXY7E6Xjs = require('./chunk-2GXY7E6X.js');
8
+ var _chunk5HMJAJIKjs = require('./chunk-5HMJAJIK.js');
9
9
 
10
10
 
11
11
  var _chunkEZUCZHGVjs = require('./chunk-EZUCZHGV.js');
@@ -164,7 +164,7 @@ function getStyleDir(compName) {
164
164
  }
165
165
  }
166
166
  if (!styleDir)
167
- styleDir = _chunk2GXY7E6Xjs.kebabCase.call(void 0, compName);
167
+ styleDir = _chunk5HMJAJIKjs.kebabCase.call(void 0, compName);
168
168
  return styleDir;
169
169
  }
170
170
  function getSideEffects(compName, options) {
@@ -330,7 +330,7 @@ function resolveComponent(name, options) {
330
330
  from: "@element-plus/icons-vue"
331
331
  };
332
332
  }
333
- const partialName = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name.slice(2));
333
+ const partialName = _chunk5HMJAJIKjs.kebabCase.call(void 0, name.slice(2));
334
334
  const { version, ssr } = options;
335
335
  if (compare(version, "1.1.0-beta.1", ">=")) {
336
336
  return {
@@ -378,7 +378,7 @@ function ElementPlusResolver(options = {}) {
378
378
  return optionsResolved;
379
379
  optionsResolved = {
380
380
  ssr: false,
381
- version: await _chunk2GXY7E6Xjs.getPkgVersion.call(void 0, "element-plus", "2.2.2"),
381
+ version: await _chunk5HMJAJIKjs.getPkgVersion.call(void 0, "element-plus", "2.2.2"),
382
382
  importStyle: "css",
383
383
  directives: true,
384
384
  exclude: void 0,
@@ -432,7 +432,7 @@ function ElementUiResolver(options = {}) {
432
432
  return;
433
433
  if (/^El[A-Z]/.test(name)) {
434
434
  const compName = name.slice(2);
435
- const partialName = _chunk2GXY7E6Xjs.kebabCase.call(void 0, compName);
435
+ const partialName = _chunk5HMJAJIKjs.kebabCase.call(void 0, compName);
436
436
  if (partialName === "collapse-transition") {
437
437
  return {
438
438
  from: `element-ui/lib/transitions/${partialName}`
@@ -542,7 +542,7 @@ function IduxResolver(options = {}) {
542
542
  let dirname = specialComponents[name];
543
543
  if (!dirname) {
544
544
  const nameIndex = packageName === "pro" ? 2 : 1;
545
- dirname = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name).split("-")[nameIndex];
545
+ dirname = _chunk5HMJAJIKjs.kebabCase.call(void 0, name).split("-")[nameIndex];
546
546
  }
547
547
  const path = `${scope}/${packageName}/${dirname}`;
548
548
  let sideEffects;
@@ -710,10 +710,10 @@ function PrimeVueResolver(options = {}) {
710
710
  }
711
711
 
712
712
  // src/core/resolvers/vant.ts
713
- var moduleType = _chunk2GXY7E6Xjs.isSSR ? "lib" : "es";
713
+ var moduleType = _chunk5HMJAJIKjs.isSSR ? "lib" : "es";
714
714
  function getSideEffects4(dirName, options) {
715
715
  const { importStyle = true } = options;
716
- if (!importStyle || _chunk2GXY7E6Xjs.isSSR)
716
+ if (!importStyle || _chunk5HMJAJIKjs.isSSR)
717
717
  return;
718
718
  if (importStyle === "less")
719
719
  return `vant/${moduleType}/${dirName}/style/less`;
@@ -730,7 +730,7 @@ function VantResolver(options = {}) {
730
730
  return {
731
731
  name: partialName,
732
732
  from: `vant/${moduleType}`,
733
- sideEffects: getSideEffects4(_chunk2GXY7E6Xjs.kebabCase.call(void 0, partialName), options)
733
+ sideEffects: getSideEffects4(_chunk5HMJAJIKjs.kebabCase.call(void 0, partialName), options)
734
734
  };
735
735
  }
736
736
  }
@@ -738,33 +738,38 @@ function VantResolver(options = {}) {
738
738
  }
739
739
 
740
740
  // src/core/resolvers/varlet-ui.ts
741
+ var varFunctions = ["Snackbar", "Picker", "ActionSheet", "Dialog", "Locale", "StyleProvider"];
742
+ var varDirectives = ["Ripple", "Lazy"];
741
743
  function getResolved(name, options) {
742
744
  const {
743
745
  importStyle = "css",
744
746
  importCss = true,
745
747
  importLess,
748
+ autoImport = false,
746
749
  version = "vue3"
747
750
  } = options;
748
751
  const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
749
752
  const sideEffects = [];
750
753
  if (importStyle || importCss) {
751
754
  if (importStyle === "less" || importLess)
752
- sideEffects.push(`${path}/es/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, name)}/style/less.js`);
755
+ sideEffects.push(`${path}/es/${_chunk5HMJAJIKjs.kebabCase.call(void 0, name)}/style/less.js`);
753
756
  else
754
- sideEffects.push(`${path}/es/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, name)}/style`);
757
+ sideEffects.push(`${path}/es/${_chunk5HMJAJIKjs.kebabCase.call(void 0, name)}/style`);
755
758
  }
756
759
  return {
757
760
  from: path,
758
- name: `_${name}Component`,
761
+ name: autoImport ? name : `_${name}Component`,
759
762
  sideEffects
760
763
  };
761
764
  }
762
- var varDirectives = ["Ripple", "Lazy"];
763
765
  function VarletUIResolver(options = {}) {
764
766
  return [
765
767
  {
766
768
  type: "component",
767
769
  resolve: (name) => {
770
+ const { autoImport = false } = options;
771
+ if (autoImport && varFunctions.includes(name))
772
+ return getResolved(name, options);
768
773
  if (name.startsWith("Var"))
769
774
  return getResolved(name.slice(3), options);
770
775
  }
@@ -811,15 +816,15 @@ function VeuiResolver(options = {}) {
811
816
  };
812
817
  }
813
818
  var formatters = {
814
- "kebab-case": _chunk2GXY7E6Xjs.kebabCase,
815
- "camelCase": _chunk2GXY7E6Xjs.camelCase,
816
- "PascalCase": _chunk2GXY7E6Xjs.pascalCase
819
+ "kebab-case": _chunk5HMJAJIKjs.kebabCase,
820
+ "camelCase": _chunk5HMJAJIKjs.camelCase,
821
+ "PascalCase": _chunk5HMJAJIKjs.pascalCase
817
822
  };
818
823
  var peerPaths = /* @__PURE__ */ new Map();
819
824
  function assertPeerPath(peerPath) {
820
825
  if (!peerPaths.has(peerPath)) {
821
826
  try {
822
- _chunk2GXY7E6Xjs.resolveImportPath.call(void 0, peerPath);
827
+ _chunk5HMJAJIKjs.resolveImportPath.call(void 0, peerPath);
823
828
  peerPaths.set(peerPath, true);
824
829
  } catch (e) {
825
830
  peerPaths.set(peerPath, false);
@@ -873,12 +878,12 @@ function getCompDir(compName) {
873
878
  for (let i = 0; i < total; i++) {
874
879
  const matcher = matchComponents2[i];
875
880
  if (compName.match(matcher.pattern)) {
876
- compPath = `${matcher.compDir}/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, compName)}.vue`;
881
+ compPath = `${matcher.compDir}/${_chunk5HMJAJIKjs.kebabCase.call(void 0, compName)}.vue`;
877
882
  break;
878
883
  }
879
884
  }
880
885
  if (!compPath)
881
- compPath = _chunk2GXY7E6Xjs.kebabCase.call(void 0, compName);
886
+ compPath = _chunk5HMJAJIKjs.kebabCase.call(void 0, compName);
882
887
  return compPath;
883
888
  }
884
889
  function ViewUiResolver() {
@@ -1007,7 +1012,7 @@ function getSideEffects7(name) {
1007
1012
  function componentsResolver(name, { ssr }) {
1008
1013
  if (!name.match(/^D[A-Z]/))
1009
1014
  return;
1010
- const resolveId = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name = name.slice(1));
1015
+ const resolveId = _chunk5HMJAJIKjs.kebabCase.call(void 0, name = name.slice(1));
1011
1016
  return {
1012
1017
  name,
1013
1018
  sideEffects: getSideEffects7(resolveId),
@@ -1015,7 +1020,7 @@ function componentsResolver(name, { ssr }) {
1015
1020
  };
1016
1021
  }
1017
1022
  function directivesResolver(name, { ssr }) {
1018
- const resolveId = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name);
1023
+ const resolveId = _chunk5HMJAJIKjs.kebabCase.call(void 0, name);
1019
1024
  return {
1020
1025
  name: `${name}Directive`,
1021
1026
  sideEffects: getSideEffects7(resolveId),
@@ -1040,6 +1045,8 @@ function DevUiResolver(options = {}) {
1040
1045
  }
1041
1046
 
1042
1047
  // src/core/resolvers/arco.ts
1048
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
1049
+ var debug = _debug2.default.call(void 0, "unplugin-vue-components:resolvers:arco");
1043
1050
  var matchComponents3 = [
1044
1051
  {
1045
1052
  pattern: /^AnchorLink$/,
@@ -1161,7 +1168,7 @@ var matchComponents3 = [
1161
1168
  function getComponentStyleDir(importName, importStyle) {
1162
1169
  if (["ConfigProvider", "Icon"].includes(importName))
1163
1170
  return void 0;
1164
- let componentDir = _chunk2GXY7E6Xjs.kebabCase.call(void 0, importName);
1171
+ let componentDir = _chunk5HMJAJIKjs.kebabCase.call(void 0, importName);
1165
1172
  for (const item of matchComponents3) {
1166
1173
  if (item.pattern.test(importName)) {
1167
1174
  componentDir = item.componentDir;
@@ -1173,15 +1180,42 @@ function getComponentStyleDir(importName, importStyle) {
1173
1180
  if (importStyle === "css" || importStyle)
1174
1181
  return `@arco-design/web-vue/es/${componentDir}/style/css.js`;
1175
1182
  }
1183
+ function canResolveIcons(options) {
1184
+ if (options === void 0)
1185
+ return false;
1186
+ if (typeof options === "boolean")
1187
+ return options;
1188
+ else
1189
+ return options.enable;
1190
+ }
1191
+ function getResolveIconPrefix(options) {
1192
+ if (canResolveIcons(options)) {
1193
+ if (typeof options === "boolean" && options)
1194
+ return "";
1195
+ else if (options.enable)
1196
+ return _nullishCoalesce(options.iconPrefix, () => ( ""));
1197
+ else
1198
+ return "";
1199
+ }
1200
+ return "";
1201
+ }
1176
1202
  function ArcoResolver(options = {}) {
1177
1203
  return {
1178
1204
  type: "component",
1179
1205
  resolve: (name) => {
1180
- if (options.resolveIcons && name.match(/^Icon/)) {
1181
- return {
1182
- name,
1183
- from: "@arco-design/web-vue/es/icon"
1184
- };
1206
+ if (canResolveIcons(options.resolveIcons)) {
1207
+ const iconPrefix = _chunk5HMJAJIKjs.pascalCase.call(void 0, getResolveIconPrefix(options.resolveIcons));
1208
+ const newNameRegexp = new RegExp(`^${iconPrefix}Icon`);
1209
+ if (newNameRegexp.test(name)) {
1210
+ debug("found icon component name %s", name);
1211
+ const rawComponentName = name.slice(iconPrefix.length);
1212
+ debug("found icon component raw name %s", rawComponentName);
1213
+ return {
1214
+ name: rawComponentName,
1215
+ as: name,
1216
+ from: "@arco-design/web-vue/es/icon"
1217
+ };
1218
+ }
1185
1219
  }
1186
1220
  if (name.match(/^A[A-Z]/)) {
1187
1221
  const importStyle = _nullishCoalesce(options.importStyle, () => ( "css"));
@@ -1201,7 +1235,7 @@ function ArcoResolver(options = {}) {
1201
1235
  // src/core/resolvers/tdesign.ts
1202
1236
  function getSideEffects8(importName, options) {
1203
1237
  const { library = "vue", importStyle = "css" } = options;
1204
- let fileName = _chunk2GXY7E6Xjs.kebabCase.call(void 0, importName);
1238
+ let fileName = _chunk5HMJAJIKjs.kebabCase.call(void 0, importName);
1205
1239
  if (!importStyle)
1206
1240
  return;
1207
1241
  if (["config-provider", "icon"].includes(fileName))
@@ -1464,6 +1498,22 @@ function BootstrapVueResolver(_options = {}) {
1464
1498
  return resolvers;
1465
1499
  }
1466
1500
 
1501
+ // src/core/resolvers/ionic.ts
1502
+ function IonicResolver() {
1503
+ return {
1504
+ type: "component",
1505
+ resolve: (name) => {
1506
+ if (name.startsWith("Ion")) {
1507
+ return {
1508
+ name,
1509
+ from: "@ionic/vue"
1510
+ };
1511
+ }
1512
+ }
1513
+ };
1514
+ }
1515
+
1516
+
1467
1517
 
1468
1518
 
1469
1519
 
@@ -1487,5 +1537,5 @@ function BootstrapVueResolver(_options = {}) {
1487
1537
 
1488
1538
 
1489
1539
 
1490
- exports.AntDesignVueResolver = AntDesignVueResolver; exports.ArcoResolver = ArcoResolver; exports.BootstrapVueResolver = BootstrapVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.InklineResolver = InklineResolver; exports.LayuiVueResolver = LayuiVueResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.TDesignResolver = TDesignResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.VueUseDirectiveResolver = VueUseDirectiveResolver; exports.Vuetify3Resolver = Vuetify3Resolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved;
1540
+ exports.AntDesignVueResolver = AntDesignVueResolver; exports.ArcoResolver = ArcoResolver; exports.BootstrapVueResolver = BootstrapVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.InklineResolver = InklineResolver; exports.IonicResolver = IonicResolver; exports.LayuiVueResolver = LayuiVueResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.TDesignResolver = TDesignResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.VueUseDirectiveResolver = VueUseDirectiveResolver; exports.Vuetify3Resolver = Vuetify3Resolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved;
1491
1541
  exports.default = module.exports;
@@ -5,7 +5,7 @@ import {
5
5
  kebabCase,
6
6
  pascalCase,
7
7
  resolveImportPath
8
- } from "./chunk-667B3WUW.mjs";
8
+ } from "./chunk-T47CWWYC.mjs";
9
9
  import {
10
10
  __require
11
11
  } from "./chunk-AKU6F3WT.mjs";
@@ -738,11 +738,14 @@ function VantResolver(options = {}) {
738
738
  }
739
739
 
740
740
  // src/core/resolvers/varlet-ui.ts
741
+ var varFunctions = ["Snackbar", "Picker", "ActionSheet", "Dialog", "Locale", "StyleProvider"];
742
+ var varDirectives = ["Ripple", "Lazy"];
741
743
  function getResolved(name, options) {
742
744
  const {
743
745
  importStyle = "css",
744
746
  importCss = true,
745
747
  importLess,
748
+ autoImport = false,
746
749
  version = "vue3"
747
750
  } = options;
748
751
  const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
@@ -755,16 +758,18 @@ function getResolved(name, options) {
755
758
  }
756
759
  return {
757
760
  from: path,
758
- name: `_${name}Component`,
761
+ name: autoImport ? name : `_${name}Component`,
759
762
  sideEffects
760
763
  };
761
764
  }
762
- var varDirectives = ["Ripple", "Lazy"];
763
765
  function VarletUIResolver(options = {}) {
764
766
  return [
765
767
  {
766
768
  type: "component",
767
769
  resolve: (name) => {
770
+ const { autoImport = false } = options;
771
+ if (autoImport && varFunctions.includes(name))
772
+ return getResolved(name, options);
768
773
  if (name.startsWith("Var"))
769
774
  return getResolved(name.slice(3), options);
770
775
  }
@@ -1040,6 +1045,8 @@ function DevUiResolver(options = {}) {
1040
1045
  }
1041
1046
 
1042
1047
  // src/core/resolvers/arco.ts
1048
+ import Debug from "debug";
1049
+ var debug = Debug("unplugin-vue-components:resolvers:arco");
1043
1050
  var matchComponents3 = [
1044
1051
  {
1045
1052
  pattern: /^AnchorLink$/,
@@ -1173,15 +1180,42 @@ function getComponentStyleDir(importName, importStyle) {
1173
1180
  if (importStyle === "css" || importStyle)
1174
1181
  return `@arco-design/web-vue/es/${componentDir}/style/css.js`;
1175
1182
  }
1183
+ function canResolveIcons(options) {
1184
+ if (options === void 0)
1185
+ return false;
1186
+ if (typeof options === "boolean")
1187
+ return options;
1188
+ else
1189
+ return options.enable;
1190
+ }
1191
+ function getResolveIconPrefix(options) {
1192
+ if (canResolveIcons(options)) {
1193
+ if (typeof options === "boolean" && options)
1194
+ return "";
1195
+ else if (options.enable)
1196
+ return options.iconPrefix ?? "";
1197
+ else
1198
+ return "";
1199
+ }
1200
+ return "";
1201
+ }
1176
1202
  function ArcoResolver(options = {}) {
1177
1203
  return {
1178
1204
  type: "component",
1179
1205
  resolve: (name) => {
1180
- if (options.resolveIcons && name.match(/^Icon/)) {
1181
- return {
1182
- name,
1183
- from: "@arco-design/web-vue/es/icon"
1184
- };
1206
+ if (canResolveIcons(options.resolveIcons)) {
1207
+ const iconPrefix = pascalCase(getResolveIconPrefix(options.resolveIcons));
1208
+ const newNameRegexp = new RegExp(`^${iconPrefix}Icon`);
1209
+ if (newNameRegexp.test(name)) {
1210
+ debug("found icon component name %s", name);
1211
+ const rawComponentName = name.slice(iconPrefix.length);
1212
+ debug("found icon component raw name %s", rawComponentName);
1213
+ return {
1214
+ name: rawComponentName,
1215
+ as: name,
1216
+ from: "@arco-design/web-vue/es/icon"
1217
+ };
1218
+ }
1185
1219
  }
1186
1220
  if (name.match(/^A[A-Z]/)) {
1187
1221
  const importStyle = options.importStyle ?? "css";
@@ -1463,6 +1497,21 @@ function BootstrapVueResolver(_options = {}) {
1463
1497
  }
1464
1498
  return resolvers;
1465
1499
  }
1500
+
1501
+ // src/core/resolvers/ionic.ts
1502
+ function IonicResolver() {
1503
+ return {
1504
+ type: "component",
1505
+ resolve: (name) => {
1506
+ if (name.startsWith("Ion")) {
1507
+ return {
1508
+ name,
1509
+ from: "@ionic/vue"
1510
+ };
1511
+ }
1512
+ }
1513
+ };
1514
+ }
1466
1515
  export {
1467
1516
  AntDesignVueResolver,
1468
1517
  ArcoResolver,
@@ -1473,6 +1522,7 @@ export {
1473
1522
  HeadlessUiResolver,
1474
1523
  IduxResolver,
1475
1524
  InklineResolver,
1525
+ IonicResolver,
1476
1526
  LayuiVueResolver,
1477
1527
  NaiveUiResolver,
1478
1528
  PrimeVueResolver,
package/dist/rollup.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import * as unplugin from 'unplugin';
1
+ import * as rollup from 'rollup';
2
2
  import { Options } from './types.js';
3
3
  import '@rollup/pluginutils';
4
+ import 'unplugin';
4
5
  import '@antfu/utils';
5
6
 
6
- declare const _default: (options: Options) => unplugin.RollupPlugin;
7
+ declare const _default: (options: Options) => rollup.Plugin;
7
8
 
8
9
  export { _default as default };
package/dist/rollup.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
+ require('./chunk-5HMJAJIK.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunkSMCETF6Mjs.unplugin_default.rollup;
9
+ var rollup_default = _chunkALMYXVCOjs.unplugin_default.rollup;
10
10
 
11
11
 
12
12
  module.exports = rollup_default;
package/dist/rollup.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
+ import "./chunk-T47CWWYC.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
package/dist/vite.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
+ require('./chunk-5HMJAJIK.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/vite.ts
9
- var vite_default = _chunkSMCETF6Mjs.unplugin_default.vite;
9
+ var vite_default = _chunkALMYXVCOjs.unplugin_default.vite;
10
10
 
11
11
 
12
12
  module.exports = vite_default;
package/dist/vite.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
+ import "./chunk-T47CWWYC.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
package/dist/webpack.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSMCETF6Mjs = require('./chunk-SMCETF6M.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkALMYXVCOjs = require('./chunk-ALMYXVCO.js');
4
+ require('./chunk-5HMJAJIK.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/webpack.ts
9
- var webpack_default = _chunkSMCETF6Mjs.unplugin_default.webpack;
9
+ var webpack_default = _chunkALMYXVCOjs.unplugin_default.webpack;
10
10
 
11
11
 
12
12
  module.exports = webpack_default;
package/dist/webpack.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-II7G4AEZ.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-VNVY5OWA.mjs";
4
+ import "./chunk-T47CWWYC.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-vue-components",
3
- "version": "0.22.6",
3
+ "version": "0.22.8",
4
4
  "packageManager": "pnpm@7.1.5",
5
5
  "description": "Components auto importing for Vue",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
@@ -90,32 +90,32 @@
90
90
  "debug": "^4.3.4",
91
91
  "fast-glob": "^3.2.12",
92
92
  "local-pkg": "^0.4.2",
93
- "magic-string": "^0.26.3",
93
+ "magic-string": "^0.26.5",
94
94
  "minimatch": "^5.1.0",
95
95
  "resolve": "^1.22.1",
96
- "unplugin": "^0.9.5"
96
+ "unplugin": "^0.9.6"
97
97
  },
98
98
  "devDependencies": {
99
- "@antfu/eslint-config": "^0.26.3",
100
- "@babel/parser": "^7.19.0",
101
- "@babel/types": "^7.19.0",
99
+ "@antfu/eslint-config": "^0.27.0",
100
+ "@babel/parser": "^7.19.3",
101
+ "@babel/types": "^7.19.3",
102
102
  "@types/debug": "^4.1.7",
103
103
  "@types/minimatch": "^5.1.2",
104
- "@types/node": "^18.7.16",
104
+ "@types/node": "^18.8.2",
105
105
  "@types/resolve": "^1.20.2",
106
- "@typescript-eslint/eslint-plugin": "^5.36.2",
106
+ "@typescript-eslint/eslint-plugin": "^5.39.0",
107
107
  "bumpp": "^8.2.1",
108
108
  "compare-versions": "^5.0.1",
109
- "element-plus": "^2.2.16",
110
- "eslint": "^8.23.0",
109
+ "element-plus": "^2.2.17",
110
+ "eslint": "^8.24.0",
111
111
  "esno": "^0.16.3",
112
112
  "estree-walker": "^3.0.1",
113
- "pathe": "^0.3.7",
114
- "rollup": "^2.79.0",
113
+ "pathe": "^0.3.8",
114
+ "rollup": "^2.79.1",
115
115
  "tsup": "^6.2.3",
116
- "typescript": "^4.8.3",
117
- "vite": "^3.1.0",
118
- "vitest": "^0.23.2",
116
+ "typescript": "^4.8.4",
117
+ "vite": "^3.1.4",
118
+ "vitest": "^0.23.4",
119
119
  "vue": "3.2.37"
120
120
  }
121
121
  }