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