unplugin-vue-components 0.22.7 → 0.22.9

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)
@@ -354,6 +357,10 @@ Components({
354
357
  // filters for transforming targets
355
358
  include: [/\.vue$/, /\.vue\?vue/],
356
359
  exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
360
+
361
+ // Vue version of project. It will detect automatically if not specified.
362
+ // Acceptable value: 2 | 2.7 | 3
363
+ version: 2.7
357
364
  })
358
365
  ```
359
366
 
@@ -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-LTPEKZZE.mjs";
14
14
 
15
15
  // src/core/unplugin.ts
16
16
  import { existsSync as existsSync2 } from "fs";
@@ -99,14 +99,22 @@ function resolveOptions(options, root) {
99
99
  resolved.types = detectTypeImports();
100
100
  resolved.types = resolved.types || [];
101
101
  resolved.root = root;
102
- resolved.transformer = options.transformer || getVueVersion(root) || "vue3";
103
- resolved.directives = typeof options.directives === "boolean" ? options.directives : !resolved.resolvers.some((i) => i.type === "directive") ? false : getVueVersion(root) === "vue3";
102
+ resolved.version = resolved.version ?? getVueVersion(root);
103
+ if (resolved.version < 2 || resolved.version >= 4)
104
+ throw new Error(`[unplugin-vue-components] unsupported version: ${resolved.version}`);
105
+ resolved.transformer = options.transformer || `vue${Math.trunc(resolved.version)}`;
106
+ resolved.directives = typeof options.directives === "boolean" ? options.directives : !resolved.resolvers.some((i) => i.type === "directive") ? false : resolved.version >= 3;
104
107
  return resolved;
105
108
  }
106
109
  function getVueVersion(root) {
107
110
  var _a;
108
- const version = ((_a = getPackageInfoSync("vue", { paths: [root] })) == null ? void 0 : _a.version) || "3";
109
- return version.startsWith("2.") ? "vue2" : "vue3";
111
+ const raw = ((_a = getPackageInfoSync("vue", { paths: [root] })) == null ? void 0 : _a.version) || "3";
112
+ const version = +raw.split(".").slice(0, 2).join(".");
113
+ if (version === 2.7)
114
+ return 2.7;
115
+ else if (version < 2.7)
116
+ return 2;
117
+ return 3;
110
118
  }
111
119
 
112
120
  // src/core/fs/glob.ts
@@ -201,14 +209,17 @@ function getDeclaration(ctx, filepath, originalImports) {
201
209
  component: stringifyDeclarationImports({ ...originalImports == null ? void 0 : originalImports.component, ...imports.component }),
202
210
  directive: stringifyDeclarationImports({ ...originalImports == null ? void 0 : originalImports.directive, ...imports.directive })
203
211
  };
204
- let code = `// generated by unplugin-vue-components
205
- // We suggest you to commit this file into source control
206
- // Read more: https://github.com/vuejs/core/pull/3399
207
- import '@vue/runtime-core'
212
+ const head = ctx.options.version === 2.7 ? `export {}
213
+
214
+ declare module 'vue' {` : `import '@vue/runtime-core'
208
215
 
209
216
  export {}
210
217
 
211
218
  declare module '@vue/runtime-core' {`;
219
+ let code = `// generated by unplugin-vue-components
220
+ // We suggest you to commit this file into source control
221
+ // Read more: https://github.com/vuejs/core/pull/3399
222
+ ${head}`;
212
223
  if (Object.keys(declarations.component).length > 0) {
213
224
  code += `
214
225
  export interface GlobalComponents {
@@ -295,9 +306,9 @@ import Debug3 from "debug";
295
306
 
296
307
  // src/core/transforms/directive/vue2.ts
297
308
  import { importModule, isPackageExists as isPackageExists3 } from "local-pkg";
298
- var getRenderFnStart = (ast) => {
309
+ var getRenderFnStart = (program) => {
299
310
  var _a, _b;
300
- const renderFn = ast.program.body.find(
311
+ const renderFn = program.body.find(
301
312
  (node) => node.type === "VariableDeclaration" && node.declarations[0].id.type === "Identifier" && ["render", "_sfc_render"].includes(node.declarations[0].id.name)
302
313
  );
303
314
  const start = (_b = (_a = renderFn == null ? void 0 : renderFn.declarations[0].init) == null ? void 0 : _a.body) == null ? void 0 : _b.start;
@@ -310,12 +321,12 @@ async function resolveVue22(code, s) {
310
321
  if (!isPackageExists3("@babel/parser"))
311
322
  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
323
  const { parse } = await importModule("@babel/parser");
313
- const ast = parse(code, {
324
+ const { program } = parse(code, {
314
325
  sourceType: "module"
315
326
  });
316
327
  const nodes = [];
317
328
  const { walk } = await import("./src-Z5BCFXFD.mjs");
318
- walk(ast.program, {
329
+ walk(program, {
319
330
  enter(node) {
320
331
  if (node.type === "CallExpression")
321
332
  nodes.push(node);
@@ -323,8 +334,13 @@ async function resolveVue22(code, s) {
323
334
  });
324
335
  if (nodes.length === 0)
325
336
  return [];
337
+ let _renderStart;
338
+ const getRenderStart = () => {
339
+ if (_renderStart !== void 0)
340
+ return _renderStart;
341
+ return _renderStart = getRenderFnStart(program);
342
+ };
326
343
  const results = [];
327
- const renderStart = getRenderFnStart(ast);
328
344
  for (const node of nodes) {
329
345
  const { callee, arguments: args } = node;
330
346
  if (callee.type !== "Identifier" || callee.name !== "_c" || ((_a = args[1]) == null ? void 0 : _a.type) !== "ObjectExpression")
@@ -348,7 +364,7 @@ async function resolveVue22(code, s) {
348
364
  results.push({
349
365
  rawName: name,
350
366
  replace: (resolved) => {
351
- s.prependLeft(renderStart, `
367
+ s.prependLeft(getRenderStart(), `
352
368
  this.$options.directives["${name}"] = ${resolved};`);
353
369
  }
354
370
  });
@@ -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)) {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
 
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunk2GXY7E6Xjs = require('./chunk-2GXY7E6X.js');
13
+ var _chunk2VBGH4A4js = require('./chunk-2VBGH4A4.js');
14
14
 
15
15
  // src/core/unplugin.ts
16
16
  var _fs = require('fs');
@@ -99,14 +99,22 @@ function resolveOptions(options, root) {
99
99
  resolved.types = detectTypeImports();
100
100
  resolved.types = resolved.types || [];
101
101
  resolved.root = root;
102
- resolved.transformer = options.transformer || getVueVersion(root) || "vue3";
103
- resolved.directives = typeof options.directives === "boolean" ? options.directives : !resolved.resolvers.some((i) => i.type === "directive") ? false : getVueVersion(root) === "vue3";
102
+ resolved.version = _nullishCoalesce(resolved.version, () => ( getVueVersion(root)));
103
+ if (resolved.version < 2 || resolved.version >= 4)
104
+ throw new Error(`[unplugin-vue-components] unsupported version: ${resolved.version}`);
105
+ resolved.transformer = options.transformer || `vue${Math.trunc(resolved.version)}`;
106
+ resolved.directives = typeof options.directives === "boolean" ? options.directives : !resolved.resolvers.some((i) => i.type === "directive") ? false : resolved.version >= 3;
104
107
  return resolved;
105
108
  }
106
109
  function getVueVersion(root) {
107
110
  var _a;
108
- const version = ((_a = _localpkg.getPackageInfoSync.call(void 0, "vue", { paths: [root] })) == null ? void 0 : _a.version) || "3";
109
- return version.startsWith("2.") ? "vue2" : "vue3";
111
+ const raw = ((_a = _localpkg.getPackageInfoSync.call(void 0, "vue", { paths: [root] })) == null ? void 0 : _a.version) || "3";
112
+ const version = +raw.split(".").slice(0, 2).join(".");
113
+ if (version === 2.7)
114
+ return 2.7;
115
+ else if (version < 2.7)
116
+ return 2;
117
+ return 3;
110
118
  }
111
119
 
112
120
  // src/core/fs/glob.ts
@@ -159,7 +167,7 @@ function parseDeclaration(code) {
159
167
  function stringifyComponentInfo(filepath, { from: path, as: name, name: importName }, importPathTransform) {
160
168
  if (!name)
161
169
  return void 0;
162
- path = _chunk2GXY7E6Xjs.getTransformedPath.call(void 0, path, importPathTransform);
170
+ path = _chunk2VBGH4A4js.getTransformedPath.call(void 0, path, importPathTransform);
163
171
  const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
164
172
  const entry = `typeof import('${_utils.slash.call(void 0, related)}')['${importName || "default"}']`;
165
173
  return [name, entry];
@@ -201,14 +209,17 @@ function getDeclaration(ctx, filepath, originalImports) {
201
209
  component: stringifyDeclarationImports({ ...originalImports == null ? void 0 : originalImports.component, ...imports.component }),
202
210
  directive: stringifyDeclarationImports({ ...originalImports == null ? void 0 : originalImports.directive, ...imports.directive })
203
211
  };
204
- let code = `// generated by unplugin-vue-components
205
- // We suggest you to commit this file into source control
206
- // Read more: https://github.com/vuejs/core/pull/3399
207
- import '@vue/runtime-core'
212
+ const head = ctx.options.version === 2.7 ? `export {}
213
+
214
+ declare module 'vue' {` : `import '@vue/runtime-core'
208
215
 
209
216
  export {}
210
217
 
211
218
  declare module '@vue/runtime-core' {`;
219
+ let code = `// generated by unplugin-vue-components
220
+ // We suggest you to commit this file into source control
221
+ // Read more: https://github.com/vuejs/core/pull/3399
222
+ ${head}`;
212
223
  if (Object.keys(declarations.component).length > 0) {
213
224
  code += `
214
225
  export interface GlobalComponents {
@@ -276,12 +287,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
276
287
  const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
277
288
  for (const { rawName, replace } of results) {
278
289
  debug2(`| ${rawName}`);
279
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, rawName);
290
+ const name = _chunk2VBGH4A4js.pascalCase.call(void 0, rawName);
280
291
  ctx.updateUsageMap(sfcPath, [name]);
281
292
  const component = await ctx.findComponent(name, "component", [sfcPath]);
282
293
  if (component) {
283
294
  const varName = `__unplugin_components_${no}`;
284
- s.prepend(`${_chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
295
+ s.prepend(`${_chunk2VBGH4A4js.stringifyComponentImport.call(void 0, { ...component, as: varName }, ctx)};
285
296
  `);
286
297
  no += 1;
287
298
  replace(varName);
@@ -295,9 +306,9 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
295
306
 
296
307
  // src/core/transforms/directive/vue2.ts
297
308
 
298
- var getRenderFnStart = (ast) => {
309
+ var getRenderFnStart = (program) => {
299
310
  var _a, _b;
300
- const renderFn = ast.program.body.find(
311
+ const renderFn = program.body.find(
301
312
  (node) => node.type === "VariableDeclaration" && node.declarations[0].id.type === "Identifier" && ["render", "_sfc_render"].includes(node.declarations[0].id.name)
302
313
  );
303
314
  const start = (_b = (_a = renderFn == null ? void 0 : renderFn.declarations[0].init) == null ? void 0 : _a.body) == null ? void 0 : _b.start;
@@ -310,12 +321,12 @@ async function resolveVue22(code, s) {
310
321
  if (!_localpkg.isPackageExists.call(void 0, "@babel/parser"))
311
322
  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
323
  const { parse } = await _localpkg.importModule.call(void 0, "@babel/parser");
313
- const ast = parse(code, {
324
+ const { program } = parse(code, {
314
325
  sourceType: "module"
315
326
  });
316
327
  const nodes = [];
317
328
  const { walk } = await Promise.resolve().then(() => require("./src-KKLCUN63.js"));
318
- walk(ast.program, {
329
+ walk(program, {
319
330
  enter(node) {
320
331
  if (node.type === "CallExpression")
321
332
  nodes.push(node);
@@ -323,8 +334,13 @@ async function resolveVue22(code, s) {
323
334
  });
324
335
  if (nodes.length === 0)
325
336
  return [];
337
+ let _renderStart;
338
+ const getRenderStart = () => {
339
+ if (_renderStart !== void 0)
340
+ return _renderStart;
341
+ return _renderStart = getRenderFnStart(program);
342
+ };
326
343
  const results = [];
327
- const renderStart = getRenderFnStart(ast);
328
344
  for (const node of nodes) {
329
345
  const { callee, arguments: args } = node;
330
346
  if (callee.type !== "Identifier" || callee.name !== "_c" || ((_a = args[1]) == null ? void 0 : _a.type) !== "ObjectExpression")
@@ -348,7 +364,7 @@ async function resolveVue22(code, s) {
348
364
  results.push({
349
365
  rawName: name,
350
366
  replace: (resolved) => {
351
- s.prependLeft(renderStart, `
367
+ s.prependLeft(getRenderStart(), `
352
368
  this.$options.directives["${name}"] = ${resolved};`);
353
369
  }
354
370
  });
@@ -381,13 +397,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
381
397
  const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
382
398
  for (const { rawName, replace } of results) {
383
399
  debug3(`| ${rawName}`);
384
- const name = `${_chunk2GXY7E6Xjs.DIRECTIVE_IMPORT_PREFIX}${_chunk2GXY7E6Xjs.pascalCase.call(void 0, rawName)}`;
400
+ const name = `${_chunk2VBGH4A4js.DIRECTIVE_IMPORT_PREFIX}${_chunk2VBGH4A4js.pascalCase.call(void 0, rawName)}`;
385
401
  ctx.updateUsageMap(sfcPath, [name]);
386
402
  const directive = await ctx.findComponent(name, "directive", [sfcPath]);
387
403
  if (!directive)
388
404
  continue;
389
405
  const varName = `__unplugin_directives_${no}`;
390
- s.prepend(`${_chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
406
+ s.prepend(`${_chunk2VBGH4A4js.stringifyComponentImport.call(void 0, { ...directive, as: varName }, ctx)};
391
407
  `);
392
408
  no += 1;
393
409
  replace(varName);
@@ -406,7 +422,7 @@ function transformer(ctx, transformer2) {
406
422
  await transformComponent(code, transformer2, s, ctx, sfcPath);
407
423
  if (ctx.options.directives)
408
424
  await transformDirective(code, transformer2, s, ctx, sfcPath);
409
- s.prepend(_chunk2GXY7E6Xjs.DISABLE_COMMENT);
425
+ s.prepend(_chunk2VBGH4A4js.DISABLE_COMMENT);
410
426
  const result = { code: s.toString() };
411
427
  if (ctx.sourcemap)
412
428
  result.map = s.generateMap({ source: id, includeContent: true });
@@ -451,7 +467,7 @@ var Context = class {
451
467
  this.transformer = transformer(this, name || "vue3");
452
468
  }
453
469
  transform(code, id) {
454
- const { path, query } = _chunk2GXY7E6Xjs.parseId.call(void 0, id);
470
+ const { path, query } = _chunk2VBGH4A4js.parseId.call(void 0, id);
455
471
  return this.transformer(code, id, path, query);
456
472
  }
457
473
  setupViteServer(server) {
@@ -463,14 +479,14 @@ var Context = class {
463
479
  setupWatcher(watcher) {
464
480
  const { globs } = this.options;
465
481
  watcher.on("unlink", (path) => {
466
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
482
+ if (!_chunk2VBGH4A4js.matchGlobs.call(void 0, path, globs))
467
483
  return;
468
484
  path = _utils.slash.call(void 0, path);
469
485
  this.removeComponents(path);
470
486
  this.onUpdate(path);
471
487
  });
472
488
  watcher.on("add", (path) => {
473
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
489
+ if (!_chunk2VBGH4A4js.matchGlobs.call(void 0, path, globs))
474
490
  return;
475
491
  path = _utils.slash.call(void 0, path);
476
492
  this.addComponents(path);
@@ -480,14 +496,14 @@ var Context = class {
480
496
  setupWatcherWebpack(watcher, emitUpdate) {
481
497
  const { globs } = this.options;
482
498
  watcher.on("unlink", (path) => {
483
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
499
+ if (!_chunk2VBGH4A4js.matchGlobs.call(void 0, path, globs))
484
500
  return;
485
501
  path = _utils.slash.call(void 0, path);
486
502
  this.removeComponents(path);
487
503
  emitUpdate(path, "unlink");
488
504
  });
489
505
  watcher.on("add", (path) => {
490
- if (!_chunk2GXY7E6Xjs.matchGlobs.call(void 0, path, globs))
506
+ if (!_chunk2VBGH4A4js.matchGlobs.call(void 0, path, globs))
491
507
  return;
492
508
  path = _utils.slash.call(void 0, path);
493
509
  this.addComponents(path);
@@ -538,7 +554,7 @@ var Context = class {
538
554
  updates: []
539
555
  };
540
556
  const timestamp = +new Date();
541
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, _chunk2GXY7E6Xjs.getNameFromFilePath.call(void 0, path, this.options));
557
+ const name = _chunk2VBGH4A4js.pascalCase.call(void 0, _chunk2VBGH4A4js.getNameFromFilePath.call(void 0, path, this.options));
542
558
  Object.entries(this._componentUsageMap).forEach(([key, values]) => {
543
559
  if (values.has(name)) {
544
560
  const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
@@ -556,7 +572,7 @@ var Context = class {
556
572
  updateComponentNameMap() {
557
573
  this._componentNameMap = {};
558
574
  Array.from(this._componentPaths).forEach((path) => {
559
- const name = _chunk2GXY7E6Xjs.pascalCase.call(void 0, _chunk2GXY7E6Xjs.getNameFromFilePath.call(void 0, path, this.options));
575
+ const name = _chunk2VBGH4A4js.pascalCase.call(void 0, _chunk2VBGH4A4js.getNameFromFilePath.call(void 0, path, this.options));
560
576
  if (this._componentNameMap[name] && !this.options.allowOverrides) {
561
577
  console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
562
578
  return;
@@ -574,7 +590,7 @@ var Context = class {
574
590
  for (const resolver of this.options.resolvers) {
575
591
  if (resolver.type !== type)
576
592
  continue;
577
- const result = await resolver.resolve(type === "directive" ? name.slice(_chunk2GXY7E6Xjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
593
+ const result = await resolver.resolve(type === "directive" ? name.slice(_chunk2VBGH4A4js.DIRECTIVE_IMPORT_PREFIX.length) : name);
578
594
  if (!result)
579
595
  continue;
580
596
  if (typeof result === "string") {
@@ -585,7 +601,7 @@ var Context = class {
585
601
  } else {
586
602
  info = {
587
603
  as: name,
588
- ..._chunk2GXY7E6Xjs.normalizeComponetInfo.call(void 0, result)
604
+ ..._chunk2VBGH4A4js.normalizeComponetInfo.call(void 0, result)
589
605
  };
590
606
  }
591
607
  if (type === "component")
@@ -598,7 +614,7 @@ var Context = class {
598
614
  }
599
615
  normalizePath(path) {
600
616
  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) || []);
617
+ return _chunk2VBGH4A4js.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
618
  }
603
619
  relative(path) {
604
620
  if (path.startsWith("/") && !path.startsWith(this.root))
@@ -642,7 +658,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
642
658
  return await ctx.findComponent(name, "component", filename ? [filename] : []);
643
659
  },
644
660
  stringifyImport(info) {
645
- return _chunk2GXY7E6Xjs.stringifyComponentImport.call(void 0, info, ctx);
661
+ return _chunk2VBGH4A4js.stringifyComponentImport.call(void 0, info, ctx);
646
662
  }
647
663
  };
648
664
  return {
@@ -653,7 +669,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
653
669
  return filter(id);
654
670
  },
655
671
  async transform(code, id) {
656
- if (!_chunk2GXY7E6Xjs.shouldTransform.call(void 0, code))
672
+ if (!_chunk2VBGH4A4js.shouldTransform.call(void 0, code))
657
673
  return null;
658
674
  try {
659
675
  const result = await ctx.transform(code, id);
package/dist/esbuild.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
+ require('./chunk-2VBGH4A4.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/esbuild.ts
9
- var esbuild_default = _chunk22OCYU7Cjs.unplugin_default.esbuild;
9
+ var esbuild_default = _chunkZWAJ4GHEjs.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-5SDBTYO5.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
+ import "./chunk-LTPEKZZE.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 _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunk2GXY7E6Xjs = require('./chunk-2GXY7E6X.js');
8
+ var _chunk2VBGH4A4js = require('./chunk-2VBGH4A4.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 = _chunk22OCYU7Cjs.unplugin_default; exports.kebabCase = _chunk2GXY7E6Xjs.kebabCase; exports.pascalCase = _chunk2GXY7E6Xjs.pascalCase;
16
+ exports.camelCase = _chunk2VBGH4A4js.camelCase; exports.default = _chunkZWAJ4GHEjs.unplugin_default; exports.kebabCase = _chunk2VBGH4A4js.kebabCase; exports.pascalCase = _chunk2VBGH4A4js.pascalCase;
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-5SDBTYO5.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
4
  import {
5
5
  camelCase,
6
6
  kebabCase,
7
7
  pascalCase
8
- } from "./chunk-667B3WUW.mjs";
8
+ } from "./chunk-LTPEKZZE.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 _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
+ require('./chunk-2VBGH4A4.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(_chunk22OCYU7Cjs.unplugin_default.webpack(options));
12
+ config.plugins.unshift(_chunkZWAJ4GHEjs.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(_chunk22OCYU7Cjs.unplugin_default.vite(options));
16
+ vite.config.plugins.push(_chunkZWAJ4GHEjs.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-5SDBTYO5.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
+ import "./chunk-LTPEKZZE.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,27 @@ 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
+ interface BootstrapVue3ResolverOptions {
500
+ /**
501
+ * Auto import for directives.
502
+ *
503
+ * @default true
504
+ */
505
+ directives?: boolean;
506
+ }
507
+ /**
508
+ * Resolver for BootstrapVue
509
+ *
510
+ * @link https://github.com/cdmoro/bootstrap-vue-3
511
+ */
512
+ declare const BootstrapVue3Resolver: (_options?: BootstrapVue3ResolverOptions) => Array<ComponentResolver>;
513
+
514
+ /**
515
+ * Resolver for ionic framework
516
+ *
517
+ * @author @mathsgod
518
+ * @link https://github.com/mathsgod
519
+ */
520
+ declare function IonicResolver(): ComponentResolver;
521
+
522
+ export { AllowResolveIconOption, AntDesignVueResolver, AntDesignVueResolverOptions, ArcoResolver, ArcoResolverOptions, BootstrapVue3Resolver, BootstrapVue3ResolverOptions, 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 _chunk2VBGH4A4js = require('./chunk-2VBGH4A4.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 = _chunk2VBGH4A4js.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 = _chunk2VBGH4A4js.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 _chunk2VBGH4A4js.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 = _chunk2VBGH4A4js.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 = _chunk2VBGH4A4js.kebabCase.call(void 0, name).split("-")[nameIndex];
546
546
  }
547
547
  const path = `${scope}/${packageName}/${dirname}`;
548
548
  let sideEffects;
@@ -651,6 +651,7 @@ var components2 = [
651
651
  "ProgressSpinner",
652
652
  "RadioButton",
653
653
  "Rating",
654
+ "Row",
654
655
  "ScrollPanel",
655
656
  "ScrollTop",
656
657
  "SelectButton",
@@ -710,10 +711,10 @@ function PrimeVueResolver(options = {}) {
710
711
  }
711
712
 
712
713
  // src/core/resolvers/vant.ts
713
- var moduleType = _chunk2GXY7E6Xjs.isSSR ? "lib" : "es";
714
+ var moduleType = _chunk2VBGH4A4js.isSSR ? "lib" : "es";
714
715
  function getSideEffects4(dirName, options) {
715
716
  const { importStyle = true } = options;
716
- if (!importStyle || _chunk2GXY7E6Xjs.isSSR)
717
+ if (!importStyle || _chunk2VBGH4A4js.isSSR)
717
718
  return;
718
719
  if (importStyle === "less")
719
720
  return `vant/${moduleType}/${dirName}/style/less`;
@@ -730,7 +731,7 @@ function VantResolver(options = {}) {
730
731
  return {
731
732
  name: partialName,
732
733
  from: `vant/${moduleType}`,
733
- sideEffects: getSideEffects4(_chunk2GXY7E6Xjs.kebabCase.call(void 0, partialName), options)
734
+ sideEffects: getSideEffects4(_chunk2VBGH4A4js.kebabCase.call(void 0, partialName), options)
734
735
  };
735
736
  }
736
737
  }
@@ -738,33 +739,38 @@ function VantResolver(options = {}) {
738
739
  }
739
740
 
740
741
  // src/core/resolvers/varlet-ui.ts
742
+ var varFunctions = ["Snackbar", "Picker", "ActionSheet", "Dialog", "Locale", "StyleProvider"];
743
+ var varDirectives = ["Ripple", "Lazy"];
741
744
  function getResolved(name, options) {
742
745
  const {
743
746
  importStyle = "css",
744
747
  importCss = true,
745
748
  importLess,
749
+ autoImport = false,
746
750
  version = "vue3"
747
751
  } = options;
748
752
  const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
749
753
  const sideEffects = [];
750
754
  if (importStyle || importCss) {
751
755
  if (importStyle === "less" || importLess)
752
- sideEffects.push(`${path}/es/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, name)}/style/less.js`);
756
+ sideEffects.push(`${path}/es/${_chunk2VBGH4A4js.kebabCase.call(void 0, name)}/style/less.js`);
753
757
  else
754
- sideEffects.push(`${path}/es/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, name)}/style`);
758
+ sideEffects.push(`${path}/es/${_chunk2VBGH4A4js.kebabCase.call(void 0, name)}/style`);
755
759
  }
756
760
  return {
757
761
  from: path,
758
- name: `_${name}Component`,
762
+ name: autoImport ? name : `_${name}Component`,
759
763
  sideEffects
760
764
  };
761
765
  }
762
- var varDirectives = ["Ripple", "Lazy"];
763
766
  function VarletUIResolver(options = {}) {
764
767
  return [
765
768
  {
766
769
  type: "component",
767
770
  resolve: (name) => {
771
+ const { autoImport = false } = options;
772
+ if (autoImport && varFunctions.includes(name))
773
+ return getResolved(name, options);
768
774
  if (name.startsWith("Var"))
769
775
  return getResolved(name.slice(3), options);
770
776
  }
@@ -811,15 +817,15 @@ function VeuiResolver(options = {}) {
811
817
  };
812
818
  }
813
819
  var formatters = {
814
- "kebab-case": _chunk2GXY7E6Xjs.kebabCase,
815
- "camelCase": _chunk2GXY7E6Xjs.camelCase,
816
- "PascalCase": _chunk2GXY7E6Xjs.pascalCase
820
+ "kebab-case": _chunk2VBGH4A4js.kebabCase,
821
+ "camelCase": _chunk2VBGH4A4js.camelCase,
822
+ "PascalCase": _chunk2VBGH4A4js.pascalCase
817
823
  };
818
824
  var peerPaths = /* @__PURE__ */ new Map();
819
825
  function assertPeerPath(peerPath) {
820
826
  if (!peerPaths.has(peerPath)) {
821
827
  try {
822
- _chunk2GXY7E6Xjs.resolveImportPath.call(void 0, peerPath);
828
+ _chunk2VBGH4A4js.resolveImportPath.call(void 0, peerPath);
823
829
  peerPaths.set(peerPath, true);
824
830
  } catch (e) {
825
831
  peerPaths.set(peerPath, false);
@@ -873,12 +879,12 @@ function getCompDir(compName) {
873
879
  for (let i = 0; i < total; i++) {
874
880
  const matcher = matchComponents2[i];
875
881
  if (compName.match(matcher.pattern)) {
876
- compPath = `${matcher.compDir}/${_chunk2GXY7E6Xjs.kebabCase.call(void 0, compName)}.vue`;
882
+ compPath = `${matcher.compDir}/${_chunk2VBGH4A4js.kebabCase.call(void 0, compName)}.vue`;
877
883
  break;
878
884
  }
879
885
  }
880
886
  if (!compPath)
881
- compPath = _chunk2GXY7E6Xjs.kebabCase.call(void 0, compName);
887
+ compPath = _chunk2VBGH4A4js.kebabCase.call(void 0, compName);
882
888
  return compPath;
883
889
  }
884
890
  function ViewUiResolver() {
@@ -1007,7 +1013,7 @@ function getSideEffects7(name) {
1007
1013
  function componentsResolver(name, { ssr }) {
1008
1014
  if (!name.match(/^D[A-Z]/))
1009
1015
  return;
1010
- const resolveId = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name = name.slice(1));
1016
+ const resolveId = _chunk2VBGH4A4js.kebabCase.call(void 0, name = name.slice(1));
1011
1017
  return {
1012
1018
  name,
1013
1019
  sideEffects: getSideEffects7(resolveId),
@@ -1015,7 +1021,7 @@ function componentsResolver(name, { ssr }) {
1015
1021
  };
1016
1022
  }
1017
1023
  function directivesResolver(name, { ssr }) {
1018
- const resolveId = _chunk2GXY7E6Xjs.kebabCase.call(void 0, name);
1024
+ const resolveId = _chunk2VBGH4A4js.kebabCase.call(void 0, name);
1019
1025
  return {
1020
1026
  name: `${name}Directive`,
1021
1027
  sideEffects: getSideEffects7(resolveId),
@@ -1040,6 +1046,8 @@ function DevUiResolver(options = {}) {
1040
1046
  }
1041
1047
 
1042
1048
  // src/core/resolvers/arco.ts
1049
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
1050
+ var debug = _debug2.default.call(void 0, "unplugin-vue-components:resolvers:arco");
1043
1051
  var matchComponents3 = [
1044
1052
  {
1045
1053
  pattern: /^AnchorLink$/,
@@ -1161,7 +1169,7 @@ var matchComponents3 = [
1161
1169
  function getComponentStyleDir(importName, importStyle) {
1162
1170
  if (["ConfigProvider", "Icon"].includes(importName))
1163
1171
  return void 0;
1164
- let componentDir = _chunk2GXY7E6Xjs.kebabCase.call(void 0, importName);
1172
+ let componentDir = _chunk2VBGH4A4js.kebabCase.call(void 0, importName);
1165
1173
  for (const item of matchComponents3) {
1166
1174
  if (item.pattern.test(importName)) {
1167
1175
  componentDir = item.componentDir;
@@ -1173,15 +1181,42 @@ function getComponentStyleDir(importName, importStyle) {
1173
1181
  if (importStyle === "css" || importStyle)
1174
1182
  return `@arco-design/web-vue/es/${componentDir}/style/css.js`;
1175
1183
  }
1184
+ function canResolveIcons(options) {
1185
+ if (options === void 0)
1186
+ return false;
1187
+ if (typeof options === "boolean")
1188
+ return options;
1189
+ else
1190
+ return options.enable;
1191
+ }
1192
+ function getResolveIconPrefix(options) {
1193
+ if (canResolveIcons(options)) {
1194
+ if (typeof options === "boolean" && options)
1195
+ return "";
1196
+ else if (options.enable)
1197
+ return _nullishCoalesce(options.iconPrefix, () => ( ""));
1198
+ else
1199
+ return "";
1200
+ }
1201
+ return "";
1202
+ }
1176
1203
  function ArcoResolver(options = {}) {
1177
1204
  return {
1178
1205
  type: "component",
1179
1206
  resolve: (name) => {
1180
- if (options.resolveIcons && name.match(/^Icon/)) {
1181
- return {
1182
- name,
1183
- from: "@arco-design/web-vue/es/icon"
1184
- };
1207
+ if (canResolveIcons(options.resolveIcons)) {
1208
+ const iconPrefix = _chunk2VBGH4A4js.pascalCase.call(void 0, getResolveIconPrefix(options.resolveIcons));
1209
+ const newNameRegexp = new RegExp(`^${iconPrefix}Icon`);
1210
+ if (newNameRegexp.test(name)) {
1211
+ debug("found icon component name %s", name);
1212
+ const rawComponentName = name.slice(iconPrefix.length);
1213
+ debug("found icon component raw name %s", rawComponentName);
1214
+ return {
1215
+ name: rawComponentName,
1216
+ as: name,
1217
+ from: "@arco-design/web-vue/es/icon"
1218
+ };
1219
+ }
1185
1220
  }
1186
1221
  if (name.match(/^A[A-Z]/)) {
1187
1222
  const importStyle = _nullishCoalesce(options.importStyle, () => ( "css"));
@@ -1201,7 +1236,7 @@ function ArcoResolver(options = {}) {
1201
1236
  // src/core/resolvers/tdesign.ts
1202
1237
  function getSideEffects8(importName, options) {
1203
1238
  const { library = "vue", importStyle = "css" } = options;
1204
- let fileName = _chunk2GXY7E6Xjs.kebabCase.call(void 0, importName);
1239
+ let fileName = _chunk2VBGH4A4js.kebabCase.call(void 0, importName);
1205
1240
  if (!importStyle)
1206
1241
  return;
1207
1242
  if (["config-provider", "icon"].includes(fileName))
@@ -1464,6 +1499,45 @@ function BootstrapVueResolver(_options = {}) {
1464
1499
  return resolvers;
1465
1500
  }
1466
1501
 
1502
+ // src/core/resolvers/bootstrap-vue-3.ts
1503
+ var BootstrapVue3Resolver = (_options = {}) => {
1504
+ const options = { directives: true, ..._options };
1505
+ const resolvers = [{
1506
+ type: "component",
1507
+ resolve: (name) => {
1508
+ if (name.match(/^B[A-Z]/))
1509
+ return { name, from: "bootstrap-vue-3" };
1510
+ }
1511
+ }];
1512
+ if (options.directives) {
1513
+ resolvers.push({
1514
+ type: "directive",
1515
+ resolve: (name) => {
1516
+ if (name.match(/^B[A-Z]/))
1517
+ return { name: `V${name}`, from: "bootstrap-vue-3" };
1518
+ }
1519
+ });
1520
+ }
1521
+ return resolvers;
1522
+ };
1523
+
1524
+ // src/core/resolvers/ionic.ts
1525
+ function IonicResolver() {
1526
+ return {
1527
+ type: "component",
1528
+ resolve: (name) => {
1529
+ if (name.startsWith("Ion")) {
1530
+ return {
1531
+ name,
1532
+ from: "@ionic/vue"
1533
+ };
1534
+ }
1535
+ }
1536
+ };
1537
+ }
1538
+
1539
+
1540
+
1467
1541
 
1468
1542
 
1469
1543
 
@@ -1487,5 +1561,5 @@ function BootstrapVueResolver(_options = {}) {
1487
1561
 
1488
1562
 
1489
1563
 
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;
1564
+ exports.AntDesignVueResolver = AntDesignVueResolver; exports.ArcoResolver = ArcoResolver; exports.BootstrapVue3Resolver = BootstrapVue3Resolver; 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
1565
  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-LTPEKZZE.mjs";
9
9
  import {
10
10
  __require
11
11
  } from "./chunk-AKU6F3WT.mjs";
@@ -651,6 +651,7 @@ var components2 = [
651
651
  "ProgressSpinner",
652
652
  "RadioButton",
653
653
  "Rating",
654
+ "Row",
654
655
  "ScrollPanel",
655
656
  "ScrollTop",
656
657
  "SelectButton",
@@ -738,11 +739,14 @@ function VantResolver(options = {}) {
738
739
  }
739
740
 
740
741
  // src/core/resolvers/varlet-ui.ts
742
+ var varFunctions = ["Snackbar", "Picker", "ActionSheet", "Dialog", "Locale", "StyleProvider"];
743
+ var varDirectives = ["Ripple", "Lazy"];
741
744
  function getResolved(name, options) {
742
745
  const {
743
746
  importStyle = "css",
744
747
  importCss = true,
745
748
  importLess,
749
+ autoImport = false,
746
750
  version = "vue3"
747
751
  } = options;
748
752
  const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
@@ -755,16 +759,18 @@ function getResolved(name, options) {
755
759
  }
756
760
  return {
757
761
  from: path,
758
- name: `_${name}Component`,
762
+ name: autoImport ? name : `_${name}Component`,
759
763
  sideEffects
760
764
  };
761
765
  }
762
- var varDirectives = ["Ripple", "Lazy"];
763
766
  function VarletUIResolver(options = {}) {
764
767
  return [
765
768
  {
766
769
  type: "component",
767
770
  resolve: (name) => {
771
+ const { autoImport = false } = options;
772
+ if (autoImport && varFunctions.includes(name))
773
+ return getResolved(name, options);
768
774
  if (name.startsWith("Var"))
769
775
  return getResolved(name.slice(3), options);
770
776
  }
@@ -1040,6 +1046,8 @@ function DevUiResolver(options = {}) {
1040
1046
  }
1041
1047
 
1042
1048
  // src/core/resolvers/arco.ts
1049
+ import Debug from "debug";
1050
+ var debug = Debug("unplugin-vue-components:resolvers:arco");
1043
1051
  var matchComponents3 = [
1044
1052
  {
1045
1053
  pattern: /^AnchorLink$/,
@@ -1173,15 +1181,42 @@ function getComponentStyleDir(importName, importStyle) {
1173
1181
  if (importStyle === "css" || importStyle)
1174
1182
  return `@arco-design/web-vue/es/${componentDir}/style/css.js`;
1175
1183
  }
1184
+ function canResolveIcons(options) {
1185
+ if (options === void 0)
1186
+ return false;
1187
+ if (typeof options === "boolean")
1188
+ return options;
1189
+ else
1190
+ return options.enable;
1191
+ }
1192
+ function getResolveIconPrefix(options) {
1193
+ if (canResolveIcons(options)) {
1194
+ if (typeof options === "boolean" && options)
1195
+ return "";
1196
+ else if (options.enable)
1197
+ return options.iconPrefix ?? "";
1198
+ else
1199
+ return "";
1200
+ }
1201
+ return "";
1202
+ }
1176
1203
  function ArcoResolver(options = {}) {
1177
1204
  return {
1178
1205
  type: "component",
1179
1206
  resolve: (name) => {
1180
- if (options.resolveIcons && name.match(/^Icon/)) {
1181
- return {
1182
- name,
1183
- from: "@arco-design/web-vue/es/icon"
1184
- };
1207
+ if (canResolveIcons(options.resolveIcons)) {
1208
+ const iconPrefix = pascalCase(getResolveIconPrefix(options.resolveIcons));
1209
+ const newNameRegexp = new RegExp(`^${iconPrefix}Icon`);
1210
+ if (newNameRegexp.test(name)) {
1211
+ debug("found icon component name %s", name);
1212
+ const rawComponentName = name.slice(iconPrefix.length);
1213
+ debug("found icon component raw name %s", rawComponentName);
1214
+ return {
1215
+ name: rawComponentName,
1216
+ as: name,
1217
+ from: "@arco-design/web-vue/es/icon"
1218
+ };
1219
+ }
1185
1220
  }
1186
1221
  if (name.match(/^A[A-Z]/)) {
1187
1222
  const importStyle = options.importStyle ?? "css";
@@ -1463,9 +1498,47 @@ function BootstrapVueResolver(_options = {}) {
1463
1498
  }
1464
1499
  return resolvers;
1465
1500
  }
1501
+
1502
+ // src/core/resolvers/bootstrap-vue-3.ts
1503
+ var BootstrapVue3Resolver = (_options = {}) => {
1504
+ const options = { directives: true, ..._options };
1505
+ const resolvers = [{
1506
+ type: "component",
1507
+ resolve: (name) => {
1508
+ if (name.match(/^B[A-Z]/))
1509
+ return { name, from: "bootstrap-vue-3" };
1510
+ }
1511
+ }];
1512
+ if (options.directives) {
1513
+ resolvers.push({
1514
+ type: "directive",
1515
+ resolve: (name) => {
1516
+ if (name.match(/^B[A-Z]/))
1517
+ return { name: `V${name}`, from: "bootstrap-vue-3" };
1518
+ }
1519
+ });
1520
+ }
1521
+ return resolvers;
1522
+ };
1523
+
1524
+ // src/core/resolvers/ionic.ts
1525
+ function IonicResolver() {
1526
+ return {
1527
+ type: "component",
1528
+ resolve: (name) => {
1529
+ if (name.startsWith("Ion")) {
1530
+ return {
1531
+ name,
1532
+ from: "@ionic/vue"
1533
+ };
1534
+ }
1535
+ }
1536
+ };
1537
+ }
1466
1538
  export {
1467
1539
  AntDesignVueResolver,
1468
1540
  ArcoResolver,
1541
+ BootstrapVue3Resolver,
1469
1542
  BootstrapVueResolver,
1470
1543
  DevUiResolver,
1471
1544
  ElementPlusResolver,
@@ -1473,6 +1546,7 @@ export {
1473
1546
  HeadlessUiResolver,
1474
1547
  IduxResolver,
1475
1548
  InklineResolver,
1549
+ IonicResolver,
1476
1550
  LayuiVueResolver,
1477
1551
  NaiveUiResolver,
1478
1552
  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 | 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 _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
+ require('./chunk-2VBGH4A4.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunk22OCYU7Cjs.unplugin_default.rollup;
9
+ var rollup_default = _chunkZWAJ4GHEjs.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-5SDBTYO5.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
+ import "./chunk-LTPEKZZE.mjs";
5
5
  import "./chunk-AKU6F3WT.mjs";
6
6
  import "./chunk-WBQAMGXK.mjs";
7
7
 
package/dist/types.d.ts CHANGED
@@ -145,6 +145,10 @@ interface Options {
145
145
  * Only provide types of components in library (registered globally)
146
146
  **/
147
147
  types?: TypeImport[];
148
+ /**
149
+ * Vue version of project. It will detect automatically if not specified.
150
+ */
151
+ version?: 2 | 2.7 | 3;
148
152
  }
149
153
  declare type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {
150
154
  resolvers: ComponentResolverObject[];
package/dist/vite.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
+ require('./chunk-2VBGH4A4.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/vite.ts
9
- var vite_default = _chunk22OCYU7Cjs.unplugin_default.vite;
9
+ var vite_default = _chunkZWAJ4GHEjs.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-5SDBTYO5.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
+ import "./chunk-LTPEKZZE.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 _chunk22OCYU7Cjs = require('./chunk-22OCYU7C.js');
4
- require('./chunk-2GXY7E6X.js');
3
+ var _chunkZWAJ4GHEjs = require('./chunk-ZWAJ4GHE.js');
4
+ require('./chunk-2VBGH4A4.js');
5
5
  require('./chunk-EZUCZHGV.js');
6
6
  require('./chunk-6F4PWJZI.js');
7
7
 
8
8
  // src/webpack.ts
9
- var webpack_default = _chunk22OCYU7Cjs.unplugin_default.webpack;
9
+ var webpack_default = _chunkZWAJ4GHEjs.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-5SDBTYO5.mjs";
4
- import "./chunk-667B3WUW.mjs";
3
+ } from "./chunk-6MMPI2T6.mjs";
4
+ import "./chunk-LTPEKZZE.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.7",
3
+ "version": "0.22.9",
4
4
  "packageManager": "pnpm@7.1.5",
5
5
  "description": "Components auto importing for Vue",
6
6
  "author": "antfu <anthonyfu117@hotmail.com>",
@@ -84,38 +84,38 @@
84
84
  }
85
85
  },
86
86
  "dependencies": {
87
- "@antfu/utils": "^0.5.2",
88
- "@rollup/pluginutils": "^4.2.1",
87
+ "@antfu/utils": "^0.6.0",
88
+ "@rollup/pluginutils": "^5.0.2",
89
89
  "chokidar": "^3.5.3",
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.7",
94
94
  "minimatch": "^5.1.0",
95
95
  "resolve": "^1.22.1",
96
- "unplugin": "^0.9.5"
96
+ "unplugin": "^0.10.1"
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.6",
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.11.4",
105
105
  "@types/resolve": "^1.20.2",
106
- "@typescript-eslint/eslint-plugin": "^5.36.2",
106
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
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.19",
110
+ "eslint": "^8.26.0",
111
111
  "esno": "^0.16.3",
112
112
  "estree-walker": "^3.0.1",
113
- "pathe": "^0.3.7",
114
- "rollup": "^2.79.0",
115
- "tsup": "^6.2.3",
116
- "typescript": "^4.8.3",
117
- "vite": "^3.1.0",
118
- "vitest": "^0.23.2",
113
+ "pathe": "^0.3.9",
114
+ "rollup": "^3.2.3",
115
+ "tsup": "^6.3.0",
116
+ "typescript": "^4.8.4",
117
+ "vite": "^3.1.8",
118
+ "vitest": "^0.24.3",
119
119
  "vue": "3.2.37"
120
120
  }
121
121
  }