unplugin-vue-components 0.25.0 → 0.25.2
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-BTQOTIPQ.js → chunk-5JVO2UWC.js} +1 -1
- package/dist/{chunk-LZZY5DWQ.js → chunk-5MUHROAQ.js} +37 -33
- package/dist/{chunk-OZY6VR4H.mjs → chunk-L2JFDMEX.mjs} +3 -2
- package/dist/{chunk-ZKNUHGJ4.mjs → chunk-T2FESLJY.mjs} +1 -1
- package/dist/{chunk-44PFEKS6.js → chunk-WRE7G5OD.js} +4 -3
- package/dist/{chunk-7Y6EJQDX.mjs → chunk-XR5T4LZ3.mjs} +16 -12
- package/dist/esbuild.d.mts +9 -0
- package/dist/esbuild.js +4 -4
- package/dist/esbuild.mjs +3 -3
- package/dist/index.d.mts +13 -0
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/dist/nuxt.d.mts +9 -0
- package/dist/nuxt.js +5 -5
- package/dist/nuxt.mjs +3 -3
- package/dist/resolvers.d.mts +540 -0
- package/dist/resolvers.d.ts +17 -3
- package/dist/resolvers.js +202 -79
- package/dist/resolvers.mjs +173 -50
- package/dist/rollup.d.mts +9 -0
- package/dist/rollup.js +4 -4
- package/dist/rollup.mjs +3 -3
- package/dist/rspack.d.mts +8 -0
- package/dist/rspack.js +4 -4
- package/dist/rspack.mjs +3 -3
- package/dist/{src-EJAVKJEF.mjs → src-B32PW6M3.mjs} +1 -1
- package/dist/{src-FZTNZZMC.js → src-WIQNDB4Q.js} +1 -1
- package/dist/types.d.mts +168 -0
- package/dist/vite.d.mts +11 -0
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +9 -0
- package/dist/webpack.js +4 -4
- package/dist/webpack.mjs +3 -3
- package/package.json +24 -24
|
@@ -22,7 +22,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
22
22
|
}) : x)(function(x) {
|
|
23
23
|
if (typeof require !== "undefined")
|
|
24
24
|
return require.apply(this, arguments);
|
|
25
|
-
throw
|
|
25
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
|
|
@@ -10,20 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkWRE7G5ODjs = require('./chunk-WRE7G5OD.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunk5JVO2UWCjs = require('./chunk-5JVO2UWC.js');
|
|
18
18
|
|
|
19
19
|
// src/core/unplugin.ts
|
|
20
20
|
var _fs = require('fs');
|
|
21
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
21
22
|
var _unplugin = require('unplugin');
|
|
22
23
|
var _pluginutils = require('@rollup/pluginutils');
|
|
23
24
|
var _chokidar = require('chokidar'); var _chokidar2 = _interopRequireDefault(_chokidar);
|
|
24
25
|
|
|
25
26
|
// src/core/context.ts
|
|
26
27
|
var _path = require('path');
|
|
28
|
+
|
|
27
29
|
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
28
30
|
var _utils = require('@antfu/utils');
|
|
29
31
|
|
|
@@ -78,18 +80,22 @@ var defaultOptions = {
|
|
|
78
80
|
function normalizeResolvers(resolvers) {
|
|
79
81
|
return _utils.toArray.call(void 0, resolvers).flat().map((r) => typeof r === "function" ? { resolve: r, type: "component" } : r);
|
|
80
82
|
}
|
|
83
|
+
function resolveGlobsExclude(root, glob) {
|
|
84
|
+
const excludeReg = /^!/;
|
|
85
|
+
return `${excludeReg.test(glob) ? "!" : ""}${_path.resolve.call(void 0, root, glob.replace(excludeReg, ""))}`;
|
|
86
|
+
}
|
|
81
87
|
function resolveOptions(options, root) {
|
|
82
88
|
var _a;
|
|
83
89
|
const resolved = Object.assign({}, defaultOptions, options);
|
|
84
90
|
resolved.resolvers = normalizeResolvers(resolved.resolvers);
|
|
85
91
|
resolved.extensions = _utils.toArray.call(void 0, resolved.extensions);
|
|
86
92
|
if (resolved.globs) {
|
|
87
|
-
resolved.globs = _utils.toArray.call(void 0, resolved.globs).map((glob) => _utils.slash.call(void 0,
|
|
93
|
+
resolved.globs = _utils.toArray.call(void 0, resolved.globs).map((glob) => _utils.slash.call(void 0, resolveGlobsExclude(root, glob)));
|
|
88
94
|
resolved.resolvedDirs = [];
|
|
89
95
|
} else {
|
|
90
96
|
const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
|
|
91
97
|
resolved.dirs = _utils.toArray.call(void 0, resolved.dirs);
|
|
92
|
-
resolved.resolvedDirs = resolved.dirs.map((i) => _utils.slash.call(void 0,
|
|
98
|
+
resolved.resolvedDirs = resolved.dirs.map((i) => _utils.slash.call(void 0, resolveGlobsExclude(root, i)));
|
|
93
99
|
resolved.globs = resolved.resolvedDirs.map(
|
|
94
100
|
(i) => resolved.deep ? _utils.slash.call(void 0, _path.join.call(void 0, i, `**/*.${extsGlob}`)) : _utils.slash.call(void 0, _path.join.call(void 0, i, `*.${extsGlob}`))
|
|
95
101
|
);
|
|
@@ -172,7 +178,7 @@ function parseDeclaration(code) {
|
|
|
172
178
|
function stringifyComponentInfo(filepath, { from: path, as: name, name: importName }, importPathTransform) {
|
|
173
179
|
if (!name)
|
|
174
180
|
return void 0;
|
|
175
|
-
path =
|
|
181
|
+
path = _chunkWRE7G5ODjs.getTransformedPath.call(void 0, path, importPathTransform);
|
|
176
182
|
const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
|
|
177
183
|
const entry = `typeof import('${_utils.slash.call(void 0, related)}')['${importName || "default"}']`;
|
|
178
184
|
return [name, entry];
|
|
@@ -184,7 +190,7 @@ function stringifyComponentsInfo(filepath, components, importPathTransform) {
|
|
|
184
190
|
}
|
|
185
191
|
function getDeclarationImports(ctx, filepath) {
|
|
186
192
|
const component = stringifyComponentsInfo(filepath, [
|
|
187
|
-
...Object.values(
|
|
193
|
+
...Object.values(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, ctx.componentNameMap), ctx.componentCustomMap)),
|
|
188
194
|
...resolveTypeImports(ctx.options.types)
|
|
189
195
|
], ctx.options.importPathTransform);
|
|
190
196
|
const directive = stringifyComponentsInfo(
|
|
@@ -208,16 +214,14 @@ function getDeclaration(ctx, filepath, originalImports) {
|
|
|
208
214
|
if (!imports)
|
|
209
215
|
return;
|
|
210
216
|
const declarations = {
|
|
211
|
-
component: stringifyDeclarationImports(
|
|
212
|
-
directive: stringifyDeclarationImports(
|
|
217
|
+
component: stringifyDeclarationImports(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.component), imports.component)),
|
|
218
|
+
directive: stringifyDeclarationImports(_chunk5JVO2UWCjs.__spreadValues.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, originalImports == null ? void 0 : originalImports.directive), imports.directive))
|
|
213
219
|
};
|
|
214
220
|
const head = ctx.options.version === 2.7 ? `export {}
|
|
215
221
|
|
|
216
|
-
declare module 'vue' {` : `
|
|
217
|
-
|
|
218
|
-
export {}
|
|
222
|
+
declare module 'vue' {` : `export {}
|
|
219
223
|
|
|
220
|
-
declare module '
|
|
224
|
+
declare module 'vue' {`;
|
|
221
225
|
let code = `/* eslint-disable */
|
|
222
226
|
/* prettier-ignore */
|
|
223
227
|
// @ts-nocheck
|
|
@@ -295,12 +299,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
|
|
|
295
299
|
const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
|
|
296
300
|
for (const { rawName, replace } of results) {
|
|
297
301
|
debug2(`| ${rawName}`);
|
|
298
|
-
const name =
|
|
302
|
+
const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, rawName);
|
|
299
303
|
ctx.updateUsageMap(sfcPath, [name]);
|
|
300
304
|
const component = await ctx.findComponent(name, "component", [sfcPath]);
|
|
301
305
|
if (component) {
|
|
302
306
|
const varName = `__unplugin_components_${no}`;
|
|
303
|
-
s.prepend(`${
|
|
307
|
+
s.prepend(`${_chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, _chunk5JVO2UWCjs.__spreadProps.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, component), { as: varName }), ctx)};
|
|
304
308
|
`);
|
|
305
309
|
no += 1;
|
|
306
310
|
replace(varName);
|
|
@@ -333,7 +337,7 @@ async function resolveVue22(code, s) {
|
|
|
333
337
|
sourceType: "module"
|
|
334
338
|
});
|
|
335
339
|
const nodes = [];
|
|
336
|
-
const { walk } = await Promise.resolve().then(() => require("./src-
|
|
340
|
+
const { walk } = await Promise.resolve().then(() => require("./src-WIQNDB4Q.js"));
|
|
337
341
|
walk(program, {
|
|
338
342
|
enter(node) {
|
|
339
343
|
if (node.type === "CallExpression")
|
|
@@ -405,13 +409,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
|
|
|
405
409
|
const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
|
|
406
410
|
for (const { rawName, replace } of results) {
|
|
407
411
|
debug3(`| ${rawName}`);
|
|
408
|
-
const name = `${
|
|
412
|
+
const name = `${_chunkWRE7G5ODjs.DIRECTIVE_IMPORT_PREFIX}${_chunkWRE7G5ODjs.pascalCase.call(void 0, rawName)}`;
|
|
409
413
|
ctx.updateUsageMap(sfcPath, [name]);
|
|
410
414
|
const directive = await ctx.findComponent(name, "directive", [sfcPath]);
|
|
411
415
|
if (!directive)
|
|
412
416
|
continue;
|
|
413
417
|
const varName = `__unplugin_directives_${no}`;
|
|
414
|
-
s.prepend(`${
|
|
418
|
+
s.prepend(`${_chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, _chunk5JVO2UWCjs.__spreadProps.call(void 0, _chunk5JVO2UWCjs.__spreadValues.call(void 0, {}, directive), { as: varName }), ctx)};
|
|
415
419
|
`);
|
|
416
420
|
no += 1;
|
|
417
421
|
replace(varName);
|
|
@@ -430,7 +434,7 @@ function transformer(ctx, transformer2) {
|
|
|
430
434
|
await transformComponent(code, transformer2, s, ctx, sfcPath);
|
|
431
435
|
if (ctx.options.directives)
|
|
432
436
|
await transformDirective(code, transformer2, s, ctx, sfcPath);
|
|
433
|
-
s.prepend(
|
|
437
|
+
s.prepend(_chunkWRE7G5ODjs.DISABLE_COMMENT);
|
|
434
438
|
const result = { code: s.toString() };
|
|
435
439
|
if (ctx.sourcemap)
|
|
436
440
|
result.map = s.generateMap({ source: id, includeContent: true });
|
|
@@ -455,7 +459,7 @@ var Context = class {
|
|
|
455
459
|
this._componentUsageMap = {};
|
|
456
460
|
this._componentCustomMap = {};
|
|
457
461
|
this._directiveCustomMap = {};
|
|
458
|
-
this.root =
|
|
462
|
+
this.root = _process2.default.cwd();
|
|
459
463
|
this.sourcemap = true;
|
|
460
464
|
this.alias = {};
|
|
461
465
|
this._searched = false;
|
|
@@ -475,7 +479,7 @@ var Context = class {
|
|
|
475
479
|
this.transformer = transformer(this, name || "vue3");
|
|
476
480
|
}
|
|
477
481
|
transform(code, id) {
|
|
478
|
-
const { path, query } =
|
|
482
|
+
const { path, query } = _chunkWRE7G5ODjs.parseId.call(void 0, id);
|
|
479
483
|
return this.transformer(code, id, path, query);
|
|
480
484
|
}
|
|
481
485
|
setupViteServer(server) {
|
|
@@ -487,14 +491,14 @@ var Context = class {
|
|
|
487
491
|
setupWatcher(watcher) {
|
|
488
492
|
const { globs } = this.options;
|
|
489
493
|
watcher.on("unlink", (path) => {
|
|
490
|
-
if (!
|
|
494
|
+
if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
|
|
491
495
|
return;
|
|
492
496
|
path = _utils.slash.call(void 0, path);
|
|
493
497
|
this.removeComponents(path);
|
|
494
498
|
this.onUpdate(path);
|
|
495
499
|
});
|
|
496
500
|
watcher.on("add", (path) => {
|
|
497
|
-
if (!
|
|
501
|
+
if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
|
|
498
502
|
return;
|
|
499
503
|
path = _utils.slash.call(void 0, path);
|
|
500
504
|
this.addComponents(path);
|
|
@@ -507,14 +511,14 @@ var Context = class {
|
|
|
507
511
|
setupWatcherWebpack(watcher, emitUpdate) {
|
|
508
512
|
const { globs } = this.options;
|
|
509
513
|
watcher.on("unlink", (path) => {
|
|
510
|
-
if (!
|
|
514
|
+
if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
|
|
511
515
|
return;
|
|
512
516
|
path = _utils.slash.call(void 0, path);
|
|
513
517
|
this.removeComponents(path);
|
|
514
518
|
emitUpdate(path, "unlink");
|
|
515
519
|
});
|
|
516
520
|
watcher.on("add", (path) => {
|
|
517
|
-
if (!
|
|
521
|
+
if (!_chunkWRE7G5ODjs.matchGlobs.call(void 0, path, globs))
|
|
518
522
|
return;
|
|
519
523
|
path = _utils.slash.call(void 0, path);
|
|
520
524
|
this.addComponents(path);
|
|
@@ -570,7 +574,7 @@ var Context = class {
|
|
|
570
574
|
updates: []
|
|
571
575
|
};
|
|
572
576
|
const timestamp = +/* @__PURE__ */ new Date();
|
|
573
|
-
const name =
|
|
577
|
+
const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, _chunkWRE7G5ODjs.getNameFromFilePath.call(void 0, path, this.options));
|
|
574
578
|
Object.entries(this._componentUsageMap).forEach(([key, values]) => {
|
|
575
579
|
if (values.has(name)) {
|
|
576
580
|
const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
|
|
@@ -588,7 +592,7 @@ var Context = class {
|
|
|
588
592
|
updateComponentNameMap() {
|
|
589
593
|
this._componentNameMap = {};
|
|
590
594
|
Array.from(this._componentPaths).forEach((path) => {
|
|
591
|
-
const name =
|
|
595
|
+
const name = _chunkWRE7G5ODjs.pascalCase.call(void 0, _chunkWRE7G5ODjs.getNameFromFilePath.call(void 0, path, this.options));
|
|
592
596
|
if (this._componentNameMap[name] && !this.options.allowOverrides) {
|
|
593
597
|
console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
|
|
594
598
|
return;
|
|
@@ -606,7 +610,7 @@ var Context = class {
|
|
|
606
610
|
for (const resolver of this.options.resolvers) {
|
|
607
611
|
if (resolver.type !== type)
|
|
608
612
|
continue;
|
|
609
|
-
const result = await resolver.resolve(type === "directive" ? name.slice(
|
|
613
|
+
const result = await resolver.resolve(type === "directive" ? name.slice(_chunkWRE7G5ODjs.DIRECTIVE_IMPORT_PREFIX.length) : name);
|
|
610
614
|
if (!result)
|
|
611
615
|
continue;
|
|
612
616
|
if (typeof result === "string") {
|
|
@@ -615,9 +619,9 @@ var Context = class {
|
|
|
615
619
|
from: result
|
|
616
620
|
};
|
|
617
621
|
} else {
|
|
618
|
-
info =
|
|
622
|
+
info = _chunk5JVO2UWCjs.__spreadValues.call(void 0, {
|
|
619
623
|
as: name
|
|
620
|
-
},
|
|
624
|
+
}, _chunkWRE7G5ODjs.normalizeComponentInfo.call(void 0, result));
|
|
621
625
|
}
|
|
622
626
|
if (type === "component")
|
|
623
627
|
this.addCustomComponents(info);
|
|
@@ -629,7 +633,7 @@ var Context = class {
|
|
|
629
633
|
}
|
|
630
634
|
normalizePath(path) {
|
|
631
635
|
var _a, _b, _c;
|
|
632
|
-
return
|
|
636
|
+
return _chunkWRE7G5ODjs.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) || []);
|
|
633
637
|
}
|
|
634
638
|
relative(path) {
|
|
635
639
|
if (path.startsWith("/") && !path.startsWith(this.root))
|
|
@@ -678,7 +682,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
678
682
|
return await ctx.findComponent(name, "component", filename ? [filename] : []);
|
|
679
683
|
},
|
|
680
684
|
stringifyImport(info) {
|
|
681
|
-
return
|
|
685
|
+
return _chunkWRE7G5ODjs.stringifyComponentImport.call(void 0, info, ctx);
|
|
682
686
|
}
|
|
683
687
|
};
|
|
684
688
|
return {
|
|
@@ -689,7 +693,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
689
693
|
return filter(id);
|
|
690
694
|
},
|
|
691
695
|
async transform(code, id) {
|
|
692
|
-
if (!
|
|
696
|
+
if (!_chunkWRE7G5ODjs.shouldTransform.call(void 0, code))
|
|
693
697
|
return null;
|
|
694
698
|
try {
|
|
695
699
|
const result = await ctx.transform(code, id);
|
|
@@ -725,7 +729,7 @@ var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
725
729
|
watcher = compiler.watching;
|
|
726
730
|
ctx.setupWatcherWebpack(_chokidar2.default.watch(ctx.options.globs), (path, type) => {
|
|
727
731
|
fileDepQueue.push({ path, type });
|
|
728
|
-
|
|
732
|
+
_process2.default.nextTick(() => {
|
|
729
733
|
watcher.invalidate();
|
|
730
734
|
});
|
|
731
735
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/core/utils.ts
|
|
2
2
|
import { parse } from "path";
|
|
3
|
+
import process from "process";
|
|
3
4
|
import { minimatch } from "minimatch";
|
|
4
5
|
import resolve from "resolve";
|
|
5
6
|
import { slash, toArray } from "@antfu/utils";
|
|
@@ -70,7 +71,7 @@ function stringifyImport(info) {
|
|
|
70
71
|
else
|
|
71
72
|
return `import ${info.as} from '${info.from}'`;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function normalizeComponentInfo(info) {
|
|
74
75
|
if ("path" in info) {
|
|
75
76
|
return {
|
|
76
77
|
from: info.path,
|
|
@@ -185,7 +186,7 @@ export {
|
|
|
185
186
|
parseId,
|
|
186
187
|
matchGlobs,
|
|
187
188
|
getTransformedPath,
|
|
188
|
-
|
|
189
|
+
normalizeComponentInfo,
|
|
189
190
|
stringifyComponentImport,
|
|
190
191
|
getNameFromFilePath,
|
|
191
192
|
resolveAlias,
|
|
@@ -22,7 +22,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
22
22
|
}) : x)(function(x) {
|
|
23
23
|
if (typeof require !== "undefined")
|
|
24
24
|
return require.apply(this, arguments);
|
|
25
|
-
throw
|
|
25
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/core/utils.ts
|
|
2
2
|
var _path = require('path');
|
|
3
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
3
4
|
var _minimatch = require('minimatch');
|
|
4
5
|
var _resolve = require('resolve'); var _resolve2 = _interopRequireDefault(_resolve);
|
|
5
6
|
var _utils = require('@antfu/utils');
|
|
@@ -13,7 +14,7 @@ var DISABLE_COMMENT = "/* unplugin-vue-components disabled */";
|
|
|
13
14
|
var DIRECTIVE_IMPORT_PREFIX = "v";
|
|
14
15
|
|
|
15
16
|
// src/core/utils.ts
|
|
16
|
-
var isSSR = Boolean(
|
|
17
|
+
var isSSR = Boolean(_process2.default.env.SSR || _process2.default.env.SSG || _process2.default.env.VITE_SSR || _process2.default.env.VITE_SSG);
|
|
17
18
|
function pascalCase(str) {
|
|
18
19
|
return capitalize(camelCase(str));
|
|
19
20
|
}
|
|
@@ -70,7 +71,7 @@ function stringifyImport(info) {
|
|
|
70
71
|
else
|
|
71
72
|
return `import ${info.as} from '${info.from}'`;
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function normalizeComponentInfo(info) {
|
|
74
75
|
if ("path" in info) {
|
|
75
76
|
return {
|
|
76
77
|
from: info.path,
|
|
@@ -192,4 +193,4 @@ function resolveImportPath(importName) {
|
|
|
192
193
|
|
|
193
194
|
|
|
194
195
|
|
|
195
|
-
exports.DISABLE_COMMENT = DISABLE_COMMENT; exports.DIRECTIVE_IMPORT_PREFIX = DIRECTIVE_IMPORT_PREFIX; exports.isSSR = isSSR; exports.pascalCase = pascalCase; exports.camelCase = camelCase; exports.kebabCase = kebabCase; exports.parseId = parseId; exports.matchGlobs = matchGlobs; exports.getTransformedPath = getTransformedPath; exports.
|
|
196
|
+
exports.DISABLE_COMMENT = DISABLE_COMMENT; exports.DIRECTIVE_IMPORT_PREFIX = DIRECTIVE_IMPORT_PREFIX; exports.isSSR = isSSR; exports.pascalCase = pascalCase; exports.camelCase = camelCase; exports.kebabCase = kebabCase; exports.parseId = parseId; exports.matchGlobs = matchGlobs; exports.getTransformedPath = getTransformedPath; exports.normalizeComponentInfo = normalizeComponentInfo; exports.stringifyComponentImport = stringifyComponentImport; exports.getNameFromFilePath = getNameFromFilePath; exports.resolveAlias = resolveAlias; exports.getPkgVersion = getPkgVersion; exports.shouldTransform = shouldTransform; exports.resolveImportPath = resolveImportPath;
|
|
@@ -4,26 +4,28 @@ import {
|
|
|
4
4
|
getNameFromFilePath,
|
|
5
5
|
getTransformedPath,
|
|
6
6
|
matchGlobs,
|
|
7
|
-
|
|
7
|
+
normalizeComponentInfo,
|
|
8
8
|
parseId,
|
|
9
9
|
pascalCase,
|
|
10
10
|
resolveAlias,
|
|
11
11
|
shouldTransform,
|
|
12
12
|
stringifyComponentImport
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-L2JFDMEX.mjs";
|
|
14
14
|
import {
|
|
15
15
|
__spreadProps,
|
|
16
16
|
__spreadValues
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-T2FESLJY.mjs";
|
|
18
18
|
|
|
19
19
|
// src/core/unplugin.ts
|
|
20
20
|
import { existsSync as existsSync2 } from "fs";
|
|
21
|
+
import process2 from "process";
|
|
21
22
|
import { createUnplugin } from "unplugin";
|
|
22
23
|
import { createFilter } from "@rollup/pluginutils";
|
|
23
24
|
import chokidar from "chokidar";
|
|
24
25
|
|
|
25
26
|
// src/core/context.ts
|
|
26
27
|
import { relative as relative2 } from "path";
|
|
28
|
+
import process from "process";
|
|
27
29
|
import Debug5 from "debug";
|
|
28
30
|
import { slash as slash3, throttle, toArray as toArray2 } from "@antfu/utils";
|
|
29
31
|
|
|
@@ -78,18 +80,22 @@ var defaultOptions = {
|
|
|
78
80
|
function normalizeResolvers(resolvers) {
|
|
79
81
|
return toArray(resolvers).flat().map((r) => typeof r === "function" ? { resolve: r, type: "component" } : r);
|
|
80
82
|
}
|
|
83
|
+
function resolveGlobsExclude(root, glob) {
|
|
84
|
+
const excludeReg = /^!/;
|
|
85
|
+
return `${excludeReg.test(glob) ? "!" : ""}${resolve(root, glob.replace(excludeReg, ""))}`;
|
|
86
|
+
}
|
|
81
87
|
function resolveOptions(options, root) {
|
|
82
88
|
var _a;
|
|
83
89
|
const resolved = Object.assign({}, defaultOptions, options);
|
|
84
90
|
resolved.resolvers = normalizeResolvers(resolved.resolvers);
|
|
85
91
|
resolved.extensions = toArray(resolved.extensions);
|
|
86
92
|
if (resolved.globs) {
|
|
87
|
-
resolved.globs = toArray(resolved.globs).map((glob) => slash(
|
|
93
|
+
resolved.globs = toArray(resolved.globs).map((glob) => slash(resolveGlobsExclude(root, glob)));
|
|
88
94
|
resolved.resolvedDirs = [];
|
|
89
95
|
} else {
|
|
90
96
|
const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`;
|
|
91
97
|
resolved.dirs = toArray(resolved.dirs);
|
|
92
|
-
resolved.resolvedDirs = resolved.dirs.map((i) => slash(
|
|
98
|
+
resolved.resolvedDirs = resolved.dirs.map((i) => slash(resolveGlobsExclude(root, i)));
|
|
93
99
|
resolved.globs = resolved.resolvedDirs.map(
|
|
94
100
|
(i) => resolved.deep ? slash(join(i, `**/*.${extsGlob}`)) : slash(join(i, `*.${extsGlob}`))
|
|
95
101
|
);
|
|
@@ -213,11 +219,9 @@ function getDeclaration(ctx, filepath, originalImports) {
|
|
|
213
219
|
};
|
|
214
220
|
const head = ctx.options.version === 2.7 ? `export {}
|
|
215
221
|
|
|
216
|
-
declare module 'vue' {` : `
|
|
217
|
-
|
|
218
|
-
export {}
|
|
222
|
+
declare module 'vue' {` : `export {}
|
|
219
223
|
|
|
220
|
-
declare module '
|
|
224
|
+
declare module 'vue' {`;
|
|
221
225
|
let code = `/* eslint-disable */
|
|
222
226
|
/* prettier-ignore */
|
|
223
227
|
// @ts-nocheck
|
|
@@ -333,7 +337,7 @@ async function resolveVue22(code, s) {
|
|
|
333
337
|
sourceType: "module"
|
|
334
338
|
});
|
|
335
339
|
const nodes = [];
|
|
336
|
-
const { walk } = await import("./src-
|
|
340
|
+
const { walk } = await import("./src-B32PW6M3.mjs");
|
|
337
341
|
walk(program, {
|
|
338
342
|
enter(node) {
|
|
339
343
|
if (node.type === "CallExpression")
|
|
@@ -617,7 +621,7 @@ var Context = class {
|
|
|
617
621
|
} else {
|
|
618
622
|
info = __spreadValues({
|
|
619
623
|
as: name
|
|
620
|
-
},
|
|
624
|
+
}, normalizeComponentInfo(result));
|
|
621
625
|
}
|
|
622
626
|
if (type === "component")
|
|
623
627
|
this.addCustomComponents(info);
|
|
@@ -725,7 +729,7 @@ var unplugin_default = createUnplugin((options = {}) => {
|
|
|
725
729
|
watcher = compiler.watching;
|
|
726
730
|
ctx.setupWatcherWebpack(chokidar.watch(ctx.options.globs), (path, type) => {
|
|
727
731
|
fileDepQueue.push({ path, type });
|
|
728
|
-
|
|
732
|
+
process2.nextTick(() => {
|
|
729
733
|
watcher.invalidate();
|
|
730
734
|
});
|
|
731
735
|
});
|
package/dist/esbuild.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
|
|
4
|
+
require('./chunk-WRE7G5OD.js');
|
|
5
|
+
require('./chunk-5JVO2UWC.js');
|
|
6
6
|
require('./chunk-6F4PWJZI.js');
|
|
7
7
|
|
|
8
8
|
// src/esbuild.ts
|
|
9
|
-
var esbuild_default =
|
|
9
|
+
var esbuild_default = _chunk5MUHROAQjs.unplugin_default.esbuild;
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
module.exports = esbuild_default;
|
package/dist/esbuild.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-XR5T4LZ3.mjs";
|
|
4
|
+
import "./chunk-L2JFDMEX.mjs";
|
|
5
|
+
import "./chunk-T2FESLJY.mjs";
|
|
6
6
|
import "./chunk-WBQAMGXK.mjs";
|
|
7
7
|
|
|
8
8
|
// src/esbuild.ts
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Options } from './types.mjs';
|
|
2
|
+
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, ImportInfoLegacy, Matcher, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, TypeImport } from './types.mjs';
|
|
3
|
+
import * as unplugin from 'unplugin';
|
|
4
|
+
import '@rollup/pluginutils';
|
|
5
|
+
import '@antfu/utils';
|
|
6
|
+
|
|
7
|
+
declare const _default: unplugin.UnpluginInstance<Options, boolean>;
|
|
8
|
+
|
|
9
|
+
declare function pascalCase(str: string): string;
|
|
10
|
+
declare function camelCase(str: string): string;
|
|
11
|
+
declare function kebabCase(key: string): string;
|
|
12
|
+
|
|
13
|
+
export { Options, camelCase, _default as default, kebabCase, pascalCase };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
8
|
+
var _chunkWRE7G5ODjs = require('./chunk-WRE7G5OD.js');
|
|
9
|
+
require('./chunk-5JVO2UWC.js');
|
|
10
10
|
require('./chunk-6F4PWJZI.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.camelCase =
|
|
16
|
+
exports.camelCase = _chunkWRE7G5ODjs.camelCase; exports.default = _chunk5MUHROAQjs.unplugin_default; exports.kebabCase = _chunkWRE7G5ODjs.kebabCase; exports.pascalCase = _chunkWRE7G5ODjs.pascalCase;
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XR5T4LZ3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
camelCase,
|
|
6
6
|
kebabCase,
|
|
7
7
|
pascalCase
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-L2JFDMEX.mjs";
|
|
9
|
+
import "./chunk-T2FESLJY.mjs";
|
|
10
10
|
import "./chunk-WBQAMGXK.mjs";
|
|
11
11
|
export {
|
|
12
12
|
camelCase,
|
package/dist/nuxt.d.mts
ADDED
package/dist/nuxt.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunk5MUHROAQjs = require('./chunk-5MUHROAQ.js');
|
|
4
|
+
require('./chunk-WRE7G5OD.js');
|
|
5
|
+
require('./chunk-5JVO2UWC.js');
|
|
6
6
|
require('./chunk-6F4PWJZI.js');
|
|
7
7
|
|
|
8
8
|
// src/nuxt.ts
|
|
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, _chunk5MUHROAQjs.unplugin_default.webpack(options));
|
|
13
|
+
_kit.addVitePlugin.call(void 0, _chunk5MUHROAQjs.unplugin_default.vite(options));
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-XR5T4LZ3.mjs";
|
|
4
|
+
import "./chunk-L2JFDMEX.mjs";
|
|
5
|
+
import "./chunk-T2FESLJY.mjs";
|
|
6
6
|
import "./chunk-WBQAMGXK.mjs";
|
|
7
7
|
|
|
8
8
|
// src/nuxt.ts
|