unplugin-vue-components 0.17.4 → 0.17.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.
@@ -9,7 +9,7 @@ import {
9
9
  resolveAlias,
10
10
  shouldTransform,
11
11
  stringifyComponentImport
12
- } from "./chunk-CX5JV2R3.mjs";
12
+ } from "./chunk-IDYWJDFZ.mjs";
13
13
  import {
14
14
  __require,
15
15
  __spreadProps,
@@ -53,6 +53,7 @@ function resolveOptions(options, root) {
53
53
  resolved.extensions = toArray(resolved.extensions);
54
54
  if (resolved.globs) {
55
55
  resolved.globs = toArray(resolved.globs).map((glob) => slash(resolve(root, glob)));
56
+ resolved.resolvedDirs = [];
56
57
  } else {
57
58
  const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
58
59
  resolved.dirs = toArray(resolved.dirs);
@@ -124,7 +125,7 @@ async function generateDeclaration(ctx, root, filepath) {
124
125
  return;
125
126
  const originalContent = existsSync(filepath) ? await fs.readFile(filepath, "utf-8") : "";
126
127
  const originalImports = parseDeclaration(originalContent);
127
- const lines = Object.entries(__spreadValues(__spreadValues({}, originalImports), imports)).sort((a, b) => a[0].localeCompare(b[0])).map(([name, v]) => {
128
+ const lines = Object.entries(__spreadValues(__spreadValues({}, originalImports), imports)).sort((a, b) => a[0].localeCompare(b[0])).filter(([name]) => ctx.componentCustomMap[name] || ctx.componentNameMap[name]).map(([name, v]) => {
128
129
  if (!/^\w+$/.test(name))
129
130
  name = `'${name}'`;
130
131
  return `${name}: ${v}`;
@@ -182,9 +183,9 @@ var resolveVue3 = (code, s) => {
182
183
  }
183
184
  return results;
184
185
  };
185
- async function transformComponent(code, transformer, s, ctx, sfcPath) {
186
+ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
186
187
  let no = 0;
187
- const results = transformer === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
188
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
188
189
  for (const { rawName, replace } of results) {
189
190
  debug2(`| ${rawName}`);
190
191
  const name = pascalCase(rawName);
@@ -277,9 +278,9 @@ function resolveVue32(code, s) {
277
278
 
278
279
  // src/core/transforms/directive/index.ts
279
280
  var debug3 = Debug3("unplugin-vue-components:transform:directive");
280
- async function transformDirective(code, transformer, s, ctx, sfcPath) {
281
+ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
281
282
  let no = 0;
282
- const results = await (transformer === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
283
+ const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
283
284
  for (const { rawName, replace } of results) {
284
285
  debug3(`| ${rawName}`);
285
286
  const name = pascalCase(rawName);
@@ -298,15 +299,15 @@ async function transformDirective(code, transformer, s, ctx, sfcPath) {
298
299
 
299
300
  // src/core/transformer.ts
300
301
  var debug4 = Debug4("unplugin-vue-components:transformer");
301
- function tranformer(ctx, transformer) {
302
+ function transformer(ctx, transformer2) {
302
303
  return async (code, id, path) => {
303
304
  ctx.searchGlob();
304
305
  const sfcPath = ctx.normalizePath(path);
305
306
  debug4(sfcPath);
306
307
  const s = new MagicString(code);
307
- await transformComponent(code, transformer, s, ctx, sfcPath);
308
+ await transformComponent(code, transformer2, s, ctx, sfcPath);
308
309
  if (ctx.options.directives)
309
- await transformDirective(code, transformer, s, ctx, sfcPath);
310
+ await transformDirective(code, transformer2, s, ctx, sfcPath);
310
311
  s.prepend(DISABLE_COMMENT);
311
312
  const result = { code: s.toString() };
312
313
  if (ctx.sourcemap)
@@ -348,7 +349,7 @@ var Context = class {
348
349
  }
349
350
  setTransformer(name) {
350
351
  debug5.env("transformer", name);
351
- this.transformer = tranformer(this, name || "vue3");
352
+ this.transformer = transformer(this, name || "vue3");
352
353
  }
353
354
  transform(code, id) {
354
355
  const { path, query } = parseId(id);
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkVBV6MMCWjs = require('./chunk-VBV6MMCW.js');
12
+ var _chunkVGL64D3Tjs = require('./chunk-VGL64D3T.js');
13
13
 
14
14
 
15
15
 
@@ -49,10 +49,11 @@ function resolveOptions(options, root) {
49
49
  const resolved = Object.assign({}, defaultOptions, options);
50
50
  resolved.libraries = _utils.toArray.call(void 0, resolved.libraries).map((i) => typeof i === "string" ? { name: i } : i);
51
51
  resolved.resolvers = normalizeResolvers(resolved.resolvers);
52
- resolved.resolvers.push(...resolved.libraries.map((lib) => _chunkVBV6MMCWjs.LibraryResolver.call(void 0, lib)));
52
+ resolved.resolvers.push(...resolved.libraries.map((lib) => _chunkVGL64D3Tjs.LibraryResolver.call(void 0, lib)));
53
53
  resolved.extensions = _utils.toArray.call(void 0, resolved.extensions);
54
54
  if (resolved.globs) {
55
55
  resolved.globs = _utils.toArray.call(void 0, resolved.globs).map((glob) => _utils.slash.call(void 0, _path.resolve.call(void 0, root, glob)));
56
+ resolved.resolvedDirs = [];
56
57
  } else {
57
58
  const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
58
59
  resolved.dirs = _utils.toArray.call(void 0, resolved.dirs);
@@ -111,7 +112,7 @@ async function generateDeclaration(ctx, root, filepath) {
111
112
  const imports = Object.fromEntries(Object.values(_chunkHIJQIC5Vjs.__spreadValues.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, ctx.componentNameMap), ctx.componentCustomMap)).map(({ path, name, importName }) => {
112
113
  if (!name)
113
114
  return void 0;
114
- path = _chunkVBV6MMCWjs.getTransformedPath.call(void 0, path, ctx);
115
+ path = _chunkVGL64D3Tjs.getTransformedPath.call(void 0, path, ctx);
115
116
  const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
116
117
  let entry = `typeof import('${_utils.slash.call(void 0, related)}')`;
117
118
  if (importName)
@@ -124,7 +125,7 @@ async function generateDeclaration(ctx, root, filepath) {
124
125
  return;
125
126
  const originalContent = _fs.existsSync.call(void 0, filepath) ? await _fs.promises.readFile(filepath, "utf-8") : "";
126
127
  const originalImports = parseDeclaration(originalContent);
127
- const lines = Object.entries(_chunkHIJQIC5Vjs.__spreadValues.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, originalImports), imports)).sort((a, b) => a[0].localeCompare(b[0])).map(([name, v]) => {
128
+ const lines = Object.entries(_chunkHIJQIC5Vjs.__spreadValues.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, originalImports), imports)).sort((a, b) => a[0].localeCompare(b[0])).filter(([name]) => ctx.componentCustomMap[name] || ctx.componentNameMap[name]).map(([name, v]) => {
128
129
  if (!/^\w+$/.test(name))
129
130
  name = `'${name}'`;
130
131
  return `${name}: ${v}`;
@@ -182,17 +183,17 @@ var resolveVue3 = (code, s) => {
182
183
  }
183
184
  return results;
184
185
  };
185
- async function transformComponent(code, transformer, s, ctx, sfcPath) {
186
+ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
186
187
  let no = 0;
187
- const results = transformer === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
188
+ const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
188
189
  for (const { rawName, replace } of results) {
189
190
  debug2(`| ${rawName}`);
190
- const name = _chunkVBV6MMCWjs.pascalCase.call(void 0, rawName);
191
+ const name = _chunkVGL64D3Tjs.pascalCase.call(void 0, rawName);
191
192
  ctx.updateUsageMap(sfcPath, [name]);
192
193
  const component = await ctx.findComponent(name, "component", [sfcPath]);
193
194
  if (component) {
194
195
  const varName = `__unplugin_components_${no}`;
195
- s.prepend(`${_chunkVBV6MMCWjs.stringifyComponentImport.call(void 0, _chunkHIJQIC5Vjs.__spreadProps.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, component), { name: varName }), ctx)};
196
+ s.prepend(`${_chunkVGL64D3Tjs.stringifyComponentImport.call(void 0, _chunkHIJQIC5Vjs.__spreadProps.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, component), { name: varName }), ctx)};
196
197
  `);
197
198
  no += 1;
198
199
  replace(varName);
@@ -277,18 +278,18 @@ function resolveVue32(code, s) {
277
278
 
278
279
  // src/core/transforms/directive/index.ts
279
280
  var debug3 = _debug2.default.call(void 0, "unplugin-vue-components:transform:directive");
280
- async function transformDirective(code, transformer, s, ctx, sfcPath) {
281
+ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
281
282
  let no = 0;
282
- const results = await (transformer === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
283
+ const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
283
284
  for (const { rawName, replace } of results) {
284
285
  debug3(`| ${rawName}`);
285
- const name = _chunkVBV6MMCWjs.pascalCase.call(void 0, rawName);
286
+ const name = _chunkVGL64D3Tjs.pascalCase.call(void 0, rawName);
286
287
  ctx.updateUsageMap(sfcPath, [name]);
287
288
  const directive = await ctx.findComponent(name, "directive", [sfcPath]);
288
289
  if (!directive)
289
290
  continue;
290
291
  const varName = `__unplugin_directives_${no}`;
291
- s.prepend(`${_chunkVBV6MMCWjs.stringifyComponentImport.call(void 0, _chunkHIJQIC5Vjs.__spreadProps.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, directive), { name: varName }), ctx)};
292
+ s.prepend(`${_chunkVGL64D3Tjs.stringifyComponentImport.call(void 0, _chunkHIJQIC5Vjs.__spreadProps.call(void 0, _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {}, directive), { name: varName }), ctx)};
292
293
  `);
293
294
  no += 1;
294
295
  replace(varName);
@@ -298,16 +299,16 @@ async function transformDirective(code, transformer, s, ctx, sfcPath) {
298
299
 
299
300
  // src/core/transformer.ts
300
301
  var debug4 = _debug2.default.call(void 0, "unplugin-vue-components:transformer");
301
- function tranformer(ctx, transformer) {
302
+ function transformer(ctx, transformer2) {
302
303
  return async (code, id, path) => {
303
304
  ctx.searchGlob();
304
305
  const sfcPath = ctx.normalizePath(path);
305
306
  debug4(sfcPath);
306
307
  const s = new (0, _magicstring2.default)(code);
307
- await transformComponent(code, transformer, s, ctx, sfcPath);
308
+ await transformComponent(code, transformer2, s, ctx, sfcPath);
308
309
  if (ctx.options.directives)
309
- await transformDirective(code, transformer, s, ctx, sfcPath);
310
- s.prepend(_chunkVBV6MMCWjs.DISABLE_COMMENT);
310
+ await transformDirective(code, transformer2, s, ctx, sfcPath);
311
+ s.prepend(_chunkVGL64D3Tjs.DISABLE_COMMENT);
311
312
  const result = { code: s.toString() };
312
313
  if (ctx.sourcemap)
313
314
  result.map = s.generateMap({ source: id, includeContent: true });
@@ -348,10 +349,10 @@ var Context = class {
348
349
  }
349
350
  setTransformer(name) {
350
351
  debug5.env("transformer", name);
351
- this.transformer = tranformer(this, name || "vue3");
352
+ this.transformer = transformer(this, name || "vue3");
352
353
  }
353
354
  transform(code, id) {
354
- const { path, query } = _chunkVBV6MMCWjs.parseId.call(void 0, id);
355
+ const { path, query } = _chunkVGL64D3Tjs.parseId.call(void 0, id);
355
356
  return this.transformer(code, id, path, query);
356
357
  }
357
358
  setupViteServer(server) {
@@ -363,13 +364,13 @@ var Context = class {
363
364
  setupWatcher(watcher) {
364
365
  const { globs } = this.options;
365
366
  watcher.on("unlink", (path) => {
366
- if (!_chunkVBV6MMCWjs.matchGlobs.call(void 0, path, globs))
367
+ if (!_chunkVGL64D3Tjs.matchGlobs.call(void 0, path, globs))
367
368
  return;
368
369
  this.removeComponents(path);
369
370
  this.onUpdate(path);
370
371
  });
371
372
  watcher.on("add", (path) => {
372
- if (!_chunkVBV6MMCWjs.matchGlobs.call(void 0, path, globs))
373
+ if (!_chunkVGL64D3Tjs.matchGlobs.call(void 0, path, globs))
373
374
  return;
374
375
  this.addComponents(path);
375
376
  this.onUpdate(path);
@@ -415,7 +416,7 @@ var Context = class {
415
416
  updates: []
416
417
  };
417
418
  const timestamp = +new Date();
418
- const name = _chunkVBV6MMCWjs.pascalCase.call(void 0, _chunkVBV6MMCWjs.getNameFromFilePath.call(void 0, path, this.options));
419
+ const name = _chunkVGL64D3Tjs.pascalCase.call(void 0, _chunkVGL64D3Tjs.getNameFromFilePath.call(void 0, path, this.options));
419
420
  Object.entries(this._componentUsageMap).forEach(([key, values]) => {
420
421
  if (values.has(name)) {
421
422
  const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
@@ -433,7 +434,7 @@ var Context = class {
433
434
  updateComponentNameMap() {
434
435
  this._componentNameMap = {};
435
436
  Array.from(this._componentPaths).forEach((path) => {
436
- const name = _chunkVBV6MMCWjs.pascalCase.call(void 0, _chunkVBV6MMCWjs.getNameFromFilePath.call(void 0, path, this.options));
437
+ const name = _chunkVGL64D3Tjs.pascalCase.call(void 0, _chunkVGL64D3Tjs.getNameFromFilePath.call(void 0, path, this.options));
437
438
  if (this._componentNameMap[name] && !this.options.allowOverrides) {
438
439
  console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
439
440
  return;
@@ -473,7 +474,7 @@ var Context = class {
473
474
  }
474
475
  normalizePath(path) {
475
476
  var _a, _b, _c;
476
- return _chunkVBV6MMCWjs.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) || []);
477
+ return _chunkVGL64D3Tjs.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) || []);
477
478
  }
478
479
  relative(path) {
479
480
  if (path.startsWith("/") && !path.startsWith(this.root))
@@ -512,7 +513,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
512
513
  return filter(id);
513
514
  },
514
515
  async transform(code, id) {
515
- if (!_chunkVBV6MMCWjs.shouldTransform.call(void 0, code))
516
+ if (!_chunkVGL64D3Tjs.shouldTransform.call(void 0, code))
516
517
  return null;
517
518
  try {
518
519
  const result = await ctx.transform(code, id);
@@ -1,12 +1,12 @@
1
- import {
2
- __require
3
- } from "./chunk-EKXJN6YJ.mjs";
4
-
5
1
  // src/core/utils.ts
6
2
  import { parse } from "path";
7
3
  import minimatch from "minimatch";
8
4
  import resolve from "resolve";
9
5
  import { slash, toArray } from "@antfu/utils";
6
+ import {
7
+ isPackageExists,
8
+ getPackageInfo
9
+ } from "local-pkg";
10
10
 
11
11
  // src/core/constants.ts
12
12
  var DISABLE_COMMENT = "/* unplugin-vue-components disabled */";
@@ -113,9 +113,16 @@ function resolveAlias(filepath, alias = []) {
113
113
  }
114
114
  return result;
115
115
  }
116
- function getPkgVersion(pkgName, defaultVersion) {
116
+ async function getPkgVersion(pkgName, defaultVersion) {
117
+ var _a;
117
118
  try {
118
- return __require(`${pkgName}/package.json`).version;
119
+ const isExist = isPackageExists(pkgName);
120
+ if (isExist) {
121
+ const pkg = await getPackageInfo(pkgName);
122
+ return (_a = pkg == null ? void 0 : pkg.version) != null ? _a : defaultVersion;
123
+ } else {
124
+ return defaultVersion;
125
+ }
119
126
  } catch (err) {
120
127
  console.error(err);
121
128
  return defaultVersion;
@@ -1,13 +1,13 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
-
3
- var _chunkHIJQIC5Vjs = require('./chunk-HIJQIC5V.js');
4
-
5
- // src/core/utils.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/core/utils.ts
6
2
  var _path = require('path');
7
3
  var _minimatch = require('minimatch'); var _minimatch2 = _interopRequireDefault(_minimatch);
8
4
  var _resolve = require('resolve'); var _resolve2 = _interopRequireDefault(_resolve);
9
5
  var _utils = require('@antfu/utils');
10
6
 
7
+
8
+
9
+ var _localpkg = require('local-pkg');
10
+
11
11
  // src/core/constants.ts
12
12
  var DISABLE_COMMENT = "/* unplugin-vue-components disabled */";
13
13
 
@@ -113,9 +113,16 @@ function resolveAlias(filepath, alias = []) {
113
113
  }
114
114
  return result;
115
115
  }
116
- function getPkgVersion(pkgName, defaultVersion) {
116
+ async function getPkgVersion(pkgName, defaultVersion) {
117
+ var _a;
117
118
  try {
118
- return _chunkHIJQIC5Vjs.__require.call(void 0, `${pkgName}/package.json`).version;
119
+ const isExist = _localpkg.isPackageExists.call(void 0, pkgName);
120
+ if (isExist) {
121
+ const pkg = await _localpkg.getPackageInfo.call(void 0, pkgName);
122
+ return (_a = pkg == null ? void 0 : pkg.version) != null ? _a : defaultVersion;
123
+ } else {
124
+ return defaultVersion;
125
+ }
119
126
  } catch (err) {
120
127
  console.error(err);
121
128
  return defaultVersion;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkRTE6NPCNjs = require('./chunk-RTE6NPCN.js');
3
+ var _chunkCB6M22NEjs = require('./chunk-CB6M22NE.js');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkVBV6MMCWjs = require('./chunk-VBV6MMCW.js');
8
+ var _chunkVGL64D3Tjs = require('./chunk-VGL64D3T.js');
9
9
  require('./chunk-GGNOJ77I.js');
10
10
  require('./chunk-HIJQIC5V.js');
11
11
 
@@ -13,4 +13,4 @@ require('./chunk-HIJQIC5V.js');
13
13
 
14
14
 
15
15
 
16
- exports.camelCase = _chunkVBV6MMCWjs.camelCase; exports.default = _chunkRTE6NPCNjs.unplugin_default; exports.kebabCase = _chunkVBV6MMCWjs.kebabCase; exports.pascalCase = _chunkVBV6MMCWjs.pascalCase;
16
+ exports.camelCase = _chunkVGL64D3Tjs.camelCase; exports.default = _chunkCB6M22NEjs.unplugin_default; exports.kebabCase = _chunkVGL64D3Tjs.kebabCase; exports.pascalCase = _chunkVGL64D3Tjs.pascalCase;
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  unplugin_default
3
- } from "./chunk-YFCNNJ2H.mjs";
3
+ } from "./chunk-BPS23YOY.mjs";
4
4
  import {
5
5
  camelCase,
6
6
  kebabCase,
7
7
  pascalCase
8
- } from "./chunk-CX5JV2R3.mjs";
8
+ } from "./chunk-IDYWJDFZ.mjs";
9
9
  import "./chunk-WBQAMGXK.mjs";
10
10
  import "./chunk-EKXJN6YJ.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 _chunkRTE6NPCNjs = require('./chunk-RTE6NPCN.js');
4
- require('./chunk-VBV6MMCW.js');
3
+ var _chunkCB6M22NEjs = require('./chunk-CB6M22NE.js');
4
+ require('./chunk-VGL64D3T.js');
5
5
  require('./chunk-GGNOJ77I.js');
6
6
  require('./chunk-HIJQIC5V.js');
7
7
 
@@ -9,11 +9,11 @@ require('./chunk-HIJQIC5V.js');
9
9
  function nuxt_default(options) {
10
10
  this.extendBuild((config) => {
11
11
  config.plugins = config.plugins || [];
12
- config.plugins.unshift(_chunkRTE6NPCNjs.unplugin_default.webpack(options));
12
+ config.plugins.unshift(_chunkCB6M22NEjs.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(_chunkRTE6NPCNjs.unplugin_default.vite(options));
16
+ vite.config.plugins.push(_chunkCB6M22NEjs.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-YFCNNJ2H.mjs";
4
- import "./chunk-CX5JV2R3.mjs";
3
+ } from "./chunk-BPS23YOY.mjs";
4
+ import "./chunk-IDYWJDFZ.mjs";
5
5
  import "./chunk-WBQAMGXK.mjs";
6
6
  import "./chunk-EKXJN6YJ.mjs";
7
7
 
@@ -32,6 +32,10 @@ interface AntDesignVueResolverOptions {
32
32
  * @deprecated use `importStyle: 'less'` instead
33
33
  */
34
34
  importLess?: boolean;
35
+ /**
36
+ * use commonjs build default false
37
+ */
38
+ cjs?: boolean;
35
39
  }
36
40
  /**
37
41
  * Resolver for Ant Design Vue
@@ -105,13 +109,19 @@ declare function ElementUiResolver(options?: ElementUiResolverOptions): Componen
105
109
  declare function HeadlessUiResolver(): ComponentResolver;
106
110
 
107
111
  interface IduxResolverOptions {
112
+ /**
113
+ * exclude components that do not require automatic import
114
+ *
115
+ * @default []
116
+ */
117
+ exclude?: string[];
108
118
  /**
109
119
  * import style along with components
110
120
  */
111
121
  importStyle?: 'css' | 'less';
112
122
  }
113
123
  /**
114
- * Resolver for `@idux/cdk` and `@idux/components`
124
+ * Resolver for `@idux/cdk`, `@idux/components` and ``@idux/pro``
115
125
  *
116
126
  * @link https://idux.site
117
127
  */
@@ -156,11 +166,11 @@ declare function PrimeVueResolver(options?: PrimeVueResolverOptions): ComponentR
156
166
 
157
167
  interface VantResolverOptions {
158
168
  /**
159
- * import style along with components
169
+ * import style css or less along with components
160
170
  *
161
171
  * @default true
162
172
  */
163
- importStyle?: boolean;
173
+ importStyle?: boolean | 'css' | 'less';
164
174
  }
165
175
  /**
166
176
  * Resolver for Vant
package/dist/resolvers.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkVBV6MMCWjs = require('./chunk-VBV6MMCW.js');
9
+ var _chunkVGL64D3Tjs = require('./chunk-VGL64D3T.js');
10
10
 
11
11
 
12
12
 
@@ -1304,7 +1304,7 @@ function getStyleDir(compName) {
1304
1304
  }
1305
1305
  }
1306
1306
  if (!styleDir)
1307
- styleDir = _chunkVBV6MMCWjs.kebabCase.call(void 0, compName);
1307
+ styleDir = _chunkVGL64D3Tjs.kebabCase.call(void 0, compName);
1308
1308
  return styleDir;
1309
1309
  }
1310
1310
  function getSideEffects(compName, options) {
@@ -1314,12 +1314,13 @@ function getSideEffects(compName, options) {
1314
1314
  } = options;
1315
1315
  if (!importStyle)
1316
1316
  return;
1317
+ const lib = options.cjs ? "lib" : "es";
1317
1318
  if (importStyle === "less" || importLess) {
1318
1319
  const styleDir = getStyleDir(compName);
1319
- return `ant-design-vue/es/${styleDir}/style`;
1320
+ return `ant-design-vue/${lib}/${styleDir}/style`;
1320
1321
  } else {
1321
1322
  const styleDir = getStyleDir(compName);
1322
- return `ant-design-vue/es/${styleDir}/style/css`;
1323
+ return `ant-design-vue/${lib}/${styleDir}/style/css`;
1323
1324
  }
1324
1325
  }
1325
1326
  var primitiveNames = ["Affix", "Anchor", "AnchorLink", "AutoComplete", "AutoCompleteOptGroup", "AutoCompleteOption", "Alert", "Avatar", "AvatarGroup", "BackTop", "Badge", "BadgeRibbon", "Breadcrumb", "BreadcrumbItem", "BreadcrumbSeparator", "Button", "ButtonGroup", "Calendar", "Card", "CardGrid", "CardMeta", "Collapse", "CollapsePanel", "Carousel", "Cascader", "Checkbox", "CheckboxGroup", "Col", "Comment", "ConfigProvider", "DatePicker", "MonthPicker", "WeekPicker", "RangePicker", "QuarterPicker", "Descriptions", "DescriptionsItem", "Divider", "Dropdown", "DropdownButton", "Drawer", "Empty", "Form", "FormItem", "FormItemRest", "Grid", "Input", "InputGroup", "InputPassword", "InputSearch", "Textarea", "Image", "ImagePreviewGroup", "InputNumber", "Layout", "LayoutHeader", "LayoutSider", "LayoutFooter", "LayoutContent", "List", "ListItem", "ListItemMeta", "Menu", "MenuDivider", "MenuItem", "MenuItemGroup", "SubMenu", "Mentions", "MentionsOption", "Modal", "Statistic", "StatisticCountdown", "PageHeader", "Pagination", "Popconfirm", "Popover", "Progress", "Radio", "RadioButton", "RadioGroup", "Rate", "Result", "Row", "Select", "SelectOptGroup", "SelectOption", "Skeleton", "SkeletonButton", "SkeletonAvatar", "SkeletonInput", "SkeletonImage", "Slider", "Space", "Spin", "Steps", "Step", "Switch", "Table", "TableColumn", "TableColumnGroup", "TableSummary", "TableSummaryRow", "TableSummaryCell", "Transfer", "Tree", "TreeNode", "DirectoryTree", "TreeSelect", "TreeSelectNode", "Tabs", "TabPane", "Tag", "CheckableTag", "TimePicker", "TimeRangePicker", "Timeline", "TimelineItem", "Tooltip", "Typography", "TypographyLink", "TypographyParagraph", "TypographyText", "TypographyTitle", "Upload", "UploadDragger", "LocaleProvider"];
@@ -1345,9 +1346,11 @@ function AntDesignVueResolver(options = {}) {
1345
1346
  }
1346
1347
  if (isAntdv(name) && !((_a = options == null ? void 0 : options.exclude) == null ? void 0 : _a.includes(name))) {
1347
1348
  const importName = name.slice(1);
1349
+ const { cjs = false } = options;
1350
+ const path = `ant-design-vue/${cjs ? "lib" : "es"}`;
1348
1351
  return {
1349
1352
  importName,
1350
- path: "ant-design-vue/es",
1353
+ path,
1351
1354
  sideEffects: getSideEffects(importName, options)
1352
1355
  };
1353
1356
  }
@@ -1458,7 +1461,7 @@ function getSideEffects2(dirName, options) {
1458
1461
  function resolveComponent(name, options) {
1459
1462
  if (!name.match(/^El[A-Z]/))
1460
1463
  return;
1461
- const partialName = _chunkVBV6MMCWjs.kebabCase.call(void 0, name.slice(2));
1464
+ const partialName = _chunkVGL64D3Tjs.kebabCase.call(void 0, name.slice(2));
1462
1465
  const { version, ssr } = options;
1463
1466
  if (compare(version, "1.1.0-beta.1", ">=")) {
1464
1467
  return {
@@ -1499,23 +1502,29 @@ function resolveDirective(name, options) {
1499
1502
  }
1500
1503
  }
1501
1504
  function ElementPlusResolver(options = {}) {
1502
- const optionsResolved = _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {
1503
- ssr: false,
1504
- version: _chunkVBV6MMCWjs.getPkgVersion.call(void 0, "element-plus", "1.1.0-beta.21"),
1505
- importStyle: "css",
1506
- directives: true
1507
- }, options);
1505
+ let optionsResolved;
1506
+ async function resolveOptions() {
1507
+ if (optionsResolved)
1508
+ return optionsResolved;
1509
+ optionsResolved = _chunkHIJQIC5Vjs.__spreadValues.call(void 0, {
1510
+ ssr: false,
1511
+ version: await _chunkVGL64D3Tjs.getPkgVersion.call(void 0, "element-plus", "1.1.0-beta.21"),
1512
+ importStyle: "css",
1513
+ directives: true
1514
+ }, options);
1515
+ return optionsResolved;
1516
+ }
1508
1517
  return [
1509
1518
  {
1510
1519
  type: "component",
1511
- resolve: (name) => {
1512
- return resolveComponent(name, optionsResolved);
1520
+ resolve: async (name) => {
1521
+ return resolveComponent(name, await resolveOptions());
1513
1522
  }
1514
1523
  },
1515
1524
  {
1516
1525
  type: "directive",
1517
- resolve: (name) => {
1518
- return resolveDirective(name, optionsResolved);
1526
+ resolve: async (name) => {
1527
+ return resolveDirective(name, await resolveOptions());
1519
1528
  }
1520
1529
  }
1521
1530
  ];
@@ -1544,7 +1553,7 @@ function ElementUiResolver(options = {}) {
1544
1553
  resolve: (name) => {
1545
1554
  if (name.startsWith("El")) {
1546
1555
  const compName = name.slice(2);
1547
- const partialName = _chunkVBV6MMCWjs.kebabCase.call(void 0, compName);
1556
+ const partialName = _chunkVGL64D3Tjs.kebabCase.call(void 0, compName);
1548
1557
  if (partialName === "collapse-transition") {
1549
1558
  return {
1550
1559
  path: `element-ui/lib/transitions/${partialName}`
@@ -1612,46 +1621,54 @@ function HeadlessUiResolver() {
1612
1621
  }
1613
1622
 
1614
1623
  // src/core/resolvers/idux.ts
1615
- var cdkNames = [
1616
- "portal",
1617
- "resizable",
1618
- "virtual-list"
1619
- ];
1620
- var kebabCaseDirnames = [
1621
- "virtual-list",
1622
- "auto-complete",
1623
- "back-top",
1624
- "date-picker",
1625
- "input-number",
1626
- "time-picker",
1627
- "tree-select"
1628
- ];
1624
+ var specialComponents = {
1625
+ CdkVirtualScroll: "scroll",
1626
+ IxAutoComplete: "auto-complete",
1627
+ IxBackTop: "back-top",
1628
+ IxDatePicker: "date-picker",
1629
+ IxCol: "grid",
1630
+ IxRow: "grid",
1631
+ IxInputNumber: "input-number",
1632
+ IxTab: "tabs",
1633
+ IxTreeSelect: "tree-select",
1634
+ IxTimePicker: "time-picker"
1635
+ };
1629
1636
  function IduxResolver(options = {}) {
1630
1637
  return {
1631
1638
  type: "component",
1632
1639
  resolve: (name) => {
1633
- if (name.match(/^Ix[A-Z]/)) {
1634
- const { importStyle } = options;
1635
- const compName = name.slice(2);
1636
- const kebabCaseName = _chunkVBV6MMCWjs.kebabCase.call(void 0, compName);
1637
- const isCdk = cdkNames.includes(kebabCaseName);
1638
- const packageName = isCdk ? "cdk" : "components";
1639
- const dirname = getDirname(kebabCaseName);
1640
- const path = `@idux/${packageName}/${dirname}`;
1641
- const sideEffects = isCdk || !importStyle ? void 0 : `${path}/style/${importStyle === "css" ? "css" : "index"}`;
1642
- return { importName: name, path, sideEffects };
1640
+ const { importStyle, exclude = [] } = options;
1641
+ if (exclude.includes(name)) {
1642
+ return;
1643
1643
  }
1644
+ const packageName = getPackageName(name);
1645
+ if (!packageName) {
1646
+ return;
1647
+ }
1648
+ let dirname = specialComponents[name];
1649
+ if (!dirname) {
1650
+ const nameIndex = packageName === "pro" ? 2 : 1;
1651
+ dirname = _chunkVGL64D3Tjs.kebabCase.call(void 0, name).split("-")[nameIndex];
1652
+ }
1653
+ const path = `@idux/${packageName}/${dirname}`;
1654
+ let sideEffects;
1655
+ if (packageName !== "cdk" && importStyle) {
1656
+ sideEffects = `${path}/style/themes/${importStyle === "css" ? "default_css" : "default"}`;
1657
+ }
1658
+ return { importName: name, path, sideEffects };
1644
1659
  }
1645
1660
  };
1646
1661
  }
1647
- function getDirname(compName) {
1648
- const dirname = kebabCaseDirnames.find((name) => compName.startsWith(name));
1649
- if (dirname)
1650
- return dirname;
1651
- const [first] = compName.split("-");
1652
- if (first === "row" || first === "col")
1653
- return "grid";
1654
- return first;
1662
+ function getPackageName(name) {
1663
+ let packageName;
1664
+ if (name.match(/^Cdk[A-Z]/)) {
1665
+ packageName = "cdk";
1666
+ } else if (name.match(/^IxPro[A-Z]/)) {
1667
+ packageName = "pro";
1668
+ } else if (name.match(/^Ix[A-Z]/)) {
1669
+ packageName = "components";
1670
+ }
1671
+ return packageName;
1655
1672
  }
1656
1673
 
1657
1674
  // src/core/resolvers/naive-ui.ts
@@ -1779,17 +1796,26 @@ function PrimeVueResolver(options = {}) {
1779
1796
  }
1780
1797
 
1781
1798
  // src/core/resolvers/vant.ts
1799
+ function getSideEffects4(dirName, options) {
1800
+ const { importStyle = true } = options;
1801
+ if (!importStyle)
1802
+ return;
1803
+ if (importStyle === "less")
1804
+ return `vant/es/${dirName}/style/less`;
1805
+ if (importStyle === "css")
1806
+ return `vant/es/${dirName}/style/index`;
1807
+ return `vant/es/${dirName}/style/index`;
1808
+ }
1782
1809
  function VantResolver(options = {}) {
1783
1810
  return {
1784
1811
  type: "component",
1785
1812
  resolve: (name) => {
1786
- const { importStyle = true } = options;
1787
1813
  if (name.startsWith("Van")) {
1788
1814
  const partialName = name.slice(3);
1789
1815
  return {
1790
1816
  importName: partialName,
1791
1817
  path: "vant/es",
1792
- sideEffects: importStyle ? `vant/es/${_chunkVBV6MMCWjs.kebabCase.call(void 0, partialName)}/style` : void 0
1818
+ sideEffects: getSideEffects4(_chunkVGL64D3Tjs.kebabCase.call(void 0, partialName), options)
1793
1819
  };
1794
1820
  }
1795
1821
  }
@@ -1806,9 +1832,9 @@ function getResolved(name, options) {
1806
1832
  const sideEffects = [];
1807
1833
  if (importStyle || importCss) {
1808
1834
  if (importStyle === "less" || importLess)
1809
- sideEffects.push(`@varlet/ui/es/${_chunkVBV6MMCWjs.kebabCase.call(void 0, name)}/style/less.js`);
1835
+ sideEffects.push(`@varlet/ui/es/${_chunkVGL64D3Tjs.kebabCase.call(void 0, name)}/style/less.js`);
1810
1836
  else
1811
- sideEffects.push(`@varlet/ui/es/${_chunkVBV6MMCWjs.kebabCase.call(void 0, name)}/style`);
1837
+ sideEffects.push(`@varlet/ui/es/${_chunkVGL64D3Tjs.kebabCase.call(void 0, name)}/style`);
1812
1838
  }
1813
1839
  return {
1814
1840
  path: "@varlet/ui",
@@ -1858,22 +1884,22 @@ function VeuiResolver(options) {
1858
1884
  const componentName = name.slice(4);
1859
1885
  if (!components3.has(componentName))
1860
1886
  return;
1861
- const sideEffects = getSideEffects4(componentName, options);
1887
+ const sideEffects = getSideEffects5(componentName, options);
1862
1888
  return { importName: componentName, path: alias, sideEffects };
1863
1889
  }
1864
1890
  }
1865
1891
  };
1866
1892
  }
1867
1893
  var formatters = {
1868
- "kebab-case": _chunkVBV6MMCWjs.kebabCase,
1869
- "camelCase": _chunkVBV6MMCWjs.camelCase,
1870
- "PascalCase": _chunkVBV6MMCWjs.pascalCase
1894
+ "kebab-case": _chunkVGL64D3Tjs.kebabCase,
1895
+ "camelCase": _chunkVGL64D3Tjs.camelCase,
1896
+ "PascalCase": _chunkVGL64D3Tjs.pascalCase
1871
1897
  };
1872
1898
  var peerPaths = new Map();
1873
1899
  function assertPeerPath(peerPath) {
1874
1900
  if (!peerPaths.has(peerPath)) {
1875
1901
  try {
1876
- _chunkVBV6MMCWjs.resolveImportPath.call(void 0, peerPath);
1902
+ _chunkVGL64D3Tjs.resolveImportPath.call(void 0, peerPath);
1877
1903
  peerPaths.set(peerPath, true);
1878
1904
  } catch (e) {
1879
1905
  peerPaths.set(peerPath, false);
@@ -1881,7 +1907,7 @@ function assertPeerPath(peerPath) {
1881
1907
  }
1882
1908
  return peerPaths.get(peerPath);
1883
1909
  }
1884
- function getSideEffects4(name, {
1910
+ function getSideEffects5(name, {
1885
1911
  alias = VEUI_PACKAGE_NAME,
1886
1912
  modules = [],
1887
1913
  locale = "zh-Hans",
@@ -1902,7 +1928,7 @@ function getSideEffects4(name, {
1902
1928
  }
1903
1929
 
1904
1930
  // src/core/resolvers/view-ui.ts
1905
- function getSideEffects5(componentName) {
1931
+ function getSideEffects6(componentName) {
1906
1932
  const sideEffects = [
1907
1933
  "view-design/dist/styles/iview.css",
1908
1934
  "popper.js/dist/umd/popper.js"
@@ -1925,12 +1951,12 @@ function getCompDir(compName) {
1925
1951
  for (let i = 0; i < total; i++) {
1926
1952
  const matcher = matchComponents2[i];
1927
1953
  if (compName.match(matcher.pattern)) {
1928
- compPath = `${matcher.compDir}/${_chunkVBV6MMCWjs.kebabCase.call(void 0, compName)}.vue`;
1954
+ compPath = `${matcher.compDir}/${_chunkVGL64D3Tjs.kebabCase.call(void 0, compName)}.vue`;
1929
1955
  break;
1930
1956
  }
1931
1957
  }
1932
1958
  if (!compPath)
1933
- compPath = _chunkVBV6MMCWjs.kebabCase.call(void 0, compName);
1959
+ compPath = _chunkVGL64D3Tjs.kebabCase.call(void 0, compName);
1934
1960
  return compPath;
1935
1961
  }
1936
1962
  function ViewUiResolver() {
@@ -1941,7 +1967,7 @@ function ViewUiResolver() {
1941
1967
  const compName = name.slice(1);
1942
1968
  return {
1943
1969
  path: `view-design/src/components/${getCompDir(compName)}`,
1944
- sideEffects: getSideEffects5(compName)
1970
+ sideEffects: getSideEffects6(compName)
1945
1971
  };
1946
1972
  }
1947
1973
  }
@@ -2014,18 +2040,18 @@ var effectDirectiveMaps = {
2014
2040
  ImagePreview: "image-preview"
2015
2041
  };
2016
2042
  var effectComponentKeys = Object.keys(effectComponentMaps);
2017
- function getSideEffects6(name) {
2043
+ function getSideEffects7(name) {
2018
2044
  const match = effectComponentKeys.find((key) => key.includes(name));
2019
2045
  return match && effectComponentMaps[match] && findStyle(match);
2020
2046
  }
2021
2047
  function componentsResolver(name) {
2022
2048
  if (!name.match(/^D[A-Z]/))
2023
2049
  return;
2024
- const resolveId = _chunkVBV6MMCWjs.kebabCase.call(void 0, name = name.slice(1));
2050
+ const resolveId = _chunkVGL64D3Tjs.kebabCase.call(void 0, name = name.slice(1));
2025
2051
  return {
2026
2052
  path: LIB_NAME,
2027
2053
  importName: name,
2028
- sideEffects: getSideEffects6(resolveId)
2054
+ sideEffects: getSideEffects7(resolveId)
2029
2055
  };
2030
2056
  }
2031
2057
  function directivesResolver(name) {
@@ -2065,5 +2091,5 @@ function DevUiResolver(options = {}) {
2065
2091
 
2066
2092
 
2067
2093
 
2068
- exports.AntDesignVueResolver = AntDesignVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.LibraryResolver = _chunkVBV6MMCWjs.LibraryResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved; exports.tryLoadVeturTags = _chunkVBV6MMCWjs.tryLoadVeturTags;
2094
+ exports.AntDesignVueResolver = AntDesignVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.LibraryResolver = _chunkVGL64D3Tjs.LibraryResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved; exports.tryLoadVeturTags = _chunkVGL64D3Tjs.tryLoadVeturTags;
2069
2095
  exports.default = module.exports;
@@ -6,7 +6,7 @@ import {
6
6
  pascalCase,
7
7
  resolveImportPath,
8
8
  tryLoadVeturTags
9
- } from "./chunk-CX5JV2R3.mjs";
9
+ } from "./chunk-IDYWJDFZ.mjs";
10
10
  import {
11
11
  __commonJS,
12
12
  __require,
@@ -1314,12 +1314,13 @@ function getSideEffects(compName, options) {
1314
1314
  } = options;
1315
1315
  if (!importStyle)
1316
1316
  return;
1317
+ const lib = options.cjs ? "lib" : "es";
1317
1318
  if (importStyle === "less" || importLess) {
1318
1319
  const styleDir = getStyleDir(compName);
1319
- return `ant-design-vue/es/${styleDir}/style`;
1320
+ return `ant-design-vue/${lib}/${styleDir}/style`;
1320
1321
  } else {
1321
1322
  const styleDir = getStyleDir(compName);
1322
- return `ant-design-vue/es/${styleDir}/style/css`;
1323
+ return `ant-design-vue/${lib}/${styleDir}/style/css`;
1323
1324
  }
1324
1325
  }
1325
1326
  var primitiveNames = ["Affix", "Anchor", "AnchorLink", "AutoComplete", "AutoCompleteOptGroup", "AutoCompleteOption", "Alert", "Avatar", "AvatarGroup", "BackTop", "Badge", "BadgeRibbon", "Breadcrumb", "BreadcrumbItem", "BreadcrumbSeparator", "Button", "ButtonGroup", "Calendar", "Card", "CardGrid", "CardMeta", "Collapse", "CollapsePanel", "Carousel", "Cascader", "Checkbox", "CheckboxGroup", "Col", "Comment", "ConfigProvider", "DatePicker", "MonthPicker", "WeekPicker", "RangePicker", "QuarterPicker", "Descriptions", "DescriptionsItem", "Divider", "Dropdown", "DropdownButton", "Drawer", "Empty", "Form", "FormItem", "FormItemRest", "Grid", "Input", "InputGroup", "InputPassword", "InputSearch", "Textarea", "Image", "ImagePreviewGroup", "InputNumber", "Layout", "LayoutHeader", "LayoutSider", "LayoutFooter", "LayoutContent", "List", "ListItem", "ListItemMeta", "Menu", "MenuDivider", "MenuItem", "MenuItemGroup", "SubMenu", "Mentions", "MentionsOption", "Modal", "Statistic", "StatisticCountdown", "PageHeader", "Pagination", "Popconfirm", "Popover", "Progress", "Radio", "RadioButton", "RadioGroup", "Rate", "Result", "Row", "Select", "SelectOptGroup", "SelectOption", "Skeleton", "SkeletonButton", "SkeletonAvatar", "SkeletonInput", "SkeletonImage", "Slider", "Space", "Spin", "Steps", "Step", "Switch", "Table", "TableColumn", "TableColumnGroup", "TableSummary", "TableSummaryRow", "TableSummaryCell", "Transfer", "Tree", "TreeNode", "DirectoryTree", "TreeSelect", "TreeSelectNode", "Tabs", "TabPane", "Tag", "CheckableTag", "TimePicker", "TimeRangePicker", "Timeline", "TimelineItem", "Tooltip", "Typography", "TypographyLink", "TypographyParagraph", "TypographyText", "TypographyTitle", "Upload", "UploadDragger", "LocaleProvider"];
@@ -1345,9 +1346,11 @@ function AntDesignVueResolver(options = {}) {
1345
1346
  }
1346
1347
  if (isAntdv(name) && !((_a = options == null ? void 0 : options.exclude) == null ? void 0 : _a.includes(name))) {
1347
1348
  const importName = name.slice(1);
1349
+ const { cjs = false } = options;
1350
+ const path = `ant-design-vue/${cjs ? "lib" : "es"}`;
1348
1351
  return {
1349
1352
  importName,
1350
- path: "ant-design-vue/es",
1353
+ path,
1351
1354
  sideEffects: getSideEffects(importName, options)
1352
1355
  };
1353
1356
  }
@@ -1499,23 +1502,29 @@ function resolveDirective(name, options) {
1499
1502
  }
1500
1503
  }
1501
1504
  function ElementPlusResolver(options = {}) {
1502
- const optionsResolved = __spreadValues({
1503
- ssr: false,
1504
- version: getPkgVersion("element-plus", "1.1.0-beta.21"),
1505
- importStyle: "css",
1506
- directives: true
1507
- }, options);
1505
+ let optionsResolved;
1506
+ async function resolveOptions() {
1507
+ if (optionsResolved)
1508
+ return optionsResolved;
1509
+ optionsResolved = __spreadValues({
1510
+ ssr: false,
1511
+ version: await getPkgVersion("element-plus", "1.1.0-beta.21"),
1512
+ importStyle: "css",
1513
+ directives: true
1514
+ }, options);
1515
+ return optionsResolved;
1516
+ }
1508
1517
  return [
1509
1518
  {
1510
1519
  type: "component",
1511
- resolve: (name) => {
1512
- return resolveComponent(name, optionsResolved);
1520
+ resolve: async (name) => {
1521
+ return resolveComponent(name, await resolveOptions());
1513
1522
  }
1514
1523
  },
1515
1524
  {
1516
1525
  type: "directive",
1517
- resolve: (name) => {
1518
- return resolveDirective(name, optionsResolved);
1526
+ resolve: async (name) => {
1527
+ return resolveDirective(name, await resolveOptions());
1519
1528
  }
1520
1529
  }
1521
1530
  ];
@@ -1612,46 +1621,54 @@ function HeadlessUiResolver() {
1612
1621
  }
1613
1622
 
1614
1623
  // src/core/resolvers/idux.ts
1615
- var cdkNames = [
1616
- "portal",
1617
- "resizable",
1618
- "virtual-list"
1619
- ];
1620
- var kebabCaseDirnames = [
1621
- "virtual-list",
1622
- "auto-complete",
1623
- "back-top",
1624
- "date-picker",
1625
- "input-number",
1626
- "time-picker",
1627
- "tree-select"
1628
- ];
1624
+ var specialComponents = {
1625
+ CdkVirtualScroll: "scroll",
1626
+ IxAutoComplete: "auto-complete",
1627
+ IxBackTop: "back-top",
1628
+ IxDatePicker: "date-picker",
1629
+ IxCol: "grid",
1630
+ IxRow: "grid",
1631
+ IxInputNumber: "input-number",
1632
+ IxTab: "tabs",
1633
+ IxTreeSelect: "tree-select",
1634
+ IxTimePicker: "time-picker"
1635
+ };
1629
1636
  function IduxResolver(options = {}) {
1630
1637
  return {
1631
1638
  type: "component",
1632
1639
  resolve: (name) => {
1633
- if (name.match(/^Ix[A-Z]/)) {
1634
- const { importStyle } = options;
1635
- const compName = name.slice(2);
1636
- const kebabCaseName = kebabCase(compName);
1637
- const isCdk = cdkNames.includes(kebabCaseName);
1638
- const packageName = isCdk ? "cdk" : "components";
1639
- const dirname = getDirname(kebabCaseName);
1640
- const path = `@idux/${packageName}/${dirname}`;
1641
- const sideEffects = isCdk || !importStyle ? void 0 : `${path}/style/${importStyle === "css" ? "css" : "index"}`;
1642
- return { importName: name, path, sideEffects };
1640
+ const { importStyle, exclude = [] } = options;
1641
+ if (exclude.includes(name)) {
1642
+ return;
1643
1643
  }
1644
+ const packageName = getPackageName(name);
1645
+ if (!packageName) {
1646
+ return;
1647
+ }
1648
+ let dirname = specialComponents[name];
1649
+ if (!dirname) {
1650
+ const nameIndex = packageName === "pro" ? 2 : 1;
1651
+ dirname = kebabCase(name).split("-")[nameIndex];
1652
+ }
1653
+ const path = `@idux/${packageName}/${dirname}`;
1654
+ let sideEffects;
1655
+ if (packageName !== "cdk" && importStyle) {
1656
+ sideEffects = `${path}/style/themes/${importStyle === "css" ? "default_css" : "default"}`;
1657
+ }
1658
+ return { importName: name, path, sideEffects };
1644
1659
  }
1645
1660
  };
1646
1661
  }
1647
- function getDirname(compName) {
1648
- const dirname = kebabCaseDirnames.find((name) => compName.startsWith(name));
1649
- if (dirname)
1650
- return dirname;
1651
- const [first] = compName.split("-");
1652
- if (first === "row" || first === "col")
1653
- return "grid";
1654
- return first;
1662
+ function getPackageName(name) {
1663
+ let packageName;
1664
+ if (name.match(/^Cdk[A-Z]/)) {
1665
+ packageName = "cdk";
1666
+ } else if (name.match(/^IxPro[A-Z]/)) {
1667
+ packageName = "pro";
1668
+ } else if (name.match(/^Ix[A-Z]/)) {
1669
+ packageName = "components";
1670
+ }
1671
+ return packageName;
1655
1672
  }
1656
1673
 
1657
1674
  // src/core/resolvers/naive-ui.ts
@@ -1779,17 +1796,26 @@ function PrimeVueResolver(options = {}) {
1779
1796
  }
1780
1797
 
1781
1798
  // src/core/resolvers/vant.ts
1799
+ function getSideEffects4(dirName, options) {
1800
+ const { importStyle = true } = options;
1801
+ if (!importStyle)
1802
+ return;
1803
+ if (importStyle === "less")
1804
+ return `vant/es/${dirName}/style/less`;
1805
+ if (importStyle === "css")
1806
+ return `vant/es/${dirName}/style/index`;
1807
+ return `vant/es/${dirName}/style/index`;
1808
+ }
1782
1809
  function VantResolver(options = {}) {
1783
1810
  return {
1784
1811
  type: "component",
1785
1812
  resolve: (name) => {
1786
- const { importStyle = true } = options;
1787
1813
  if (name.startsWith("Van")) {
1788
1814
  const partialName = name.slice(3);
1789
1815
  return {
1790
1816
  importName: partialName,
1791
1817
  path: "vant/es",
1792
- sideEffects: importStyle ? `vant/es/${kebabCase(partialName)}/style` : void 0
1818
+ sideEffects: getSideEffects4(kebabCase(partialName), options)
1793
1819
  };
1794
1820
  }
1795
1821
  }
@@ -1858,7 +1884,7 @@ function VeuiResolver(options) {
1858
1884
  const componentName = name.slice(4);
1859
1885
  if (!components3.has(componentName))
1860
1886
  return;
1861
- const sideEffects = getSideEffects4(componentName, options);
1887
+ const sideEffects = getSideEffects5(componentName, options);
1862
1888
  return { importName: componentName, path: alias, sideEffects };
1863
1889
  }
1864
1890
  }
@@ -1881,7 +1907,7 @@ function assertPeerPath(peerPath) {
1881
1907
  }
1882
1908
  return peerPaths.get(peerPath);
1883
1909
  }
1884
- function getSideEffects4(name, {
1910
+ function getSideEffects5(name, {
1885
1911
  alias = VEUI_PACKAGE_NAME,
1886
1912
  modules = [],
1887
1913
  locale = "zh-Hans",
@@ -1902,7 +1928,7 @@ function getSideEffects4(name, {
1902
1928
  }
1903
1929
 
1904
1930
  // src/core/resolvers/view-ui.ts
1905
- function getSideEffects5(componentName) {
1931
+ function getSideEffects6(componentName) {
1906
1932
  const sideEffects = [
1907
1933
  "view-design/dist/styles/iview.css",
1908
1934
  "popper.js/dist/umd/popper.js"
@@ -1941,7 +1967,7 @@ function ViewUiResolver() {
1941
1967
  const compName = name.slice(1);
1942
1968
  return {
1943
1969
  path: `view-design/src/components/${getCompDir(compName)}`,
1944
- sideEffects: getSideEffects5(compName)
1970
+ sideEffects: getSideEffects6(compName)
1945
1971
  };
1946
1972
  }
1947
1973
  }
@@ -2014,7 +2040,7 @@ var effectDirectiveMaps = {
2014
2040
  ImagePreview: "image-preview"
2015
2041
  };
2016
2042
  var effectComponentKeys = Object.keys(effectComponentMaps);
2017
- function getSideEffects6(name) {
2043
+ function getSideEffects7(name) {
2018
2044
  const match = effectComponentKeys.find((key) => key.includes(name));
2019
2045
  return match && effectComponentMaps[match] && findStyle(match);
2020
2046
  }
@@ -2025,7 +2051,7 @@ function componentsResolver(name) {
2025
2051
  return {
2026
2052
  path: LIB_NAME,
2027
2053
  importName: name,
2028
- sideEffects: getSideEffects6(resolveId)
2054
+ sideEffects: getSideEffects7(resolveId)
2029
2055
  };
2030
2056
  }
2031
2057
  function directivesResolver(name) {
package/dist/rollup.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkRTE6NPCNjs = require('./chunk-RTE6NPCN.js');
4
- require('./chunk-VBV6MMCW.js');
3
+ var _chunkCB6M22NEjs = require('./chunk-CB6M22NE.js');
4
+ require('./chunk-VGL64D3T.js');
5
5
  require('./chunk-GGNOJ77I.js');
6
6
  require('./chunk-HIJQIC5V.js');
7
7
 
8
8
  // src/rollup.ts
9
- var rollup_default = _chunkRTE6NPCNjs.unplugin_default.rollup;
9
+ var rollup_default = _chunkCB6M22NEjs.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-YFCNNJ2H.mjs";
4
- import "./chunk-CX5JV2R3.mjs";
3
+ } from "./chunk-BPS23YOY.mjs";
4
+ import "./chunk-IDYWJDFZ.mjs";
5
5
  import "./chunk-WBQAMGXK.mjs";
6
6
  import "./chunk-EKXJN6YJ.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 _chunkRTE6NPCNjs = require('./chunk-RTE6NPCN.js');
4
- require('./chunk-VBV6MMCW.js');
3
+ var _chunkCB6M22NEjs = require('./chunk-CB6M22NE.js');
4
+ require('./chunk-VGL64D3T.js');
5
5
  require('./chunk-GGNOJ77I.js');
6
6
  require('./chunk-HIJQIC5V.js');
7
7
 
8
8
  // src/vite.ts
9
- var vite_default = _chunkRTE6NPCNjs.unplugin_default.vite;
9
+ var vite_default = _chunkCB6M22NEjs.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-YFCNNJ2H.mjs";
4
- import "./chunk-CX5JV2R3.mjs";
3
+ } from "./chunk-BPS23YOY.mjs";
4
+ import "./chunk-IDYWJDFZ.mjs";
5
5
  import "./chunk-WBQAMGXK.mjs";
6
6
  import "./chunk-EKXJN6YJ.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 _chunkRTE6NPCNjs = require('./chunk-RTE6NPCN.js');
4
- require('./chunk-VBV6MMCW.js');
3
+ var _chunkCB6M22NEjs = require('./chunk-CB6M22NE.js');
4
+ require('./chunk-VGL64D3T.js');
5
5
  require('./chunk-GGNOJ77I.js');
6
6
  require('./chunk-HIJQIC5V.js');
7
7
 
8
8
  // src/webpack.ts
9
- var webpack_default = _chunkRTE6NPCNjs.unplugin_default.webpack;
9
+ var webpack_default = _chunkCB6M22NEjs.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-YFCNNJ2H.mjs";
4
- import "./chunk-CX5JV2R3.mjs";
3
+ } from "./chunk-BPS23YOY.mjs";
4
+ import "./chunk-IDYWJDFZ.mjs";
5
5
  import "./chunk-WBQAMGXK.mjs";
6
6
  import "./chunk-EKXJN6YJ.mjs";
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-vue-components",
3
- "version": "0.17.4",
3
+ "version": "0.17.9",
4
4
  "description": "Components auto importing for Vue",
5
5
  "homepage": "https://github.com/antfu/unplugin-vue-components",
6
6
  "bugs": "https://github.com/antfu/unplugin-vue-components/issues",
@@ -56,8 +56,8 @@
56
56
  "example:dev": "npm -C examples/vite-vue3 run dev",
57
57
  "prepublishOnly": "npm run build",
58
58
  "release": "npx bumpp --commit --tag --push",
59
- "test": "jest",
60
- "test:update": "jest --u"
59
+ "test": "vitest",
60
+ "test:update": "vitest --u"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@babel/parser": "^7.15.8",
@@ -90,7 +90,6 @@
90
90
  "@babel/traverse": "^7.16.3",
91
91
  "@babel/types": "^7.16.0",
92
92
  "@types/debug": "^4.1.7",
93
- "@types/jest": "^27.0.3",
94
93
  "@types/minimatch": "^3.0.5",
95
94
  "@types/node": "^16.11.9",
96
95
  "@types/resolve": "^1.20.1",
@@ -100,12 +99,11 @@
100
99
  "element-plus": "^1.1.0-beta.24",
101
100
  "eslint": "^8.3.0",
102
101
  "esno": "^0.12.1",
103
- "jest": "^27.3.1",
104
102
  "rollup": "^2.60.0",
105
- "ts-jest": "^27.0.7",
106
103
  "tsup": "^5.7.4",
107
104
  "typescript": "^4.5.2",
108
105
  "vite": "^2.6.14",
106
+ "vitest": "^0.0.50",
109
107
  "vue": "3"
110
108
  },
111
109
  "engines": {