unplugin-vue-components 0.17.21 → 0.18.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/README.md +6 -6
- package/dist/{chunk-GGNOJ77I.js → chunk-6F4PWJZI.js} +0 -0
- package/dist/{chunk-ERB4VV6K.js → chunk-I3PYM4HQ.js} +37 -2
- package/dist/{chunk-ZHBFA55Z.mjs → chunk-KA5FQ6XN.mjs} +15 -8
- package/dist/{chunk-M3Z4TUEC.mjs → chunk-PQNKN3AH.mjs} +35 -0
- package/dist/{chunk-4OXKGUF4.js → chunk-X46PG6OB.js} +30 -23
- package/dist/esbuild.js +4 -5
- package/dist/esbuild.mjs +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -5
- package/dist/index.mjs +2 -3
- package/dist/nuxt.js +5 -6
- package/dist/nuxt.mjs +2 -3
- package/dist/resolvers.js +990 -342
- package/dist/resolvers.mjs +980 -332
- package/dist/rollup.js +4 -5
- package/dist/rollup.mjs +2 -3
- package/dist/types.d.ts +11 -1
- package/dist/types.js +1 -2
- package/dist/types.mjs +0 -1
- package/dist/vite.d.ts +5 -3
- package/dist/vite.js +4 -5
- package/dist/vite.mjs +2 -3
- package/dist/webpack.js +4 -5
- package/dist/webpack.mjs +2 -3
- package/package.json +43 -35
- package/dist/chunk-EKXJN6YJ.mjs +0 -36
- package/dist/chunk-HIJQIC5V.js +0 -36
- package/esbuild.d.ts +0 -2
- package/index.d.ts +0 -2
- package/nuxt.d.ts +0 -2
- package/resolvers.d.ts +0 -2
- package/rollup.d.ts +0 -2
- package/types.d.ts +0 -2
- package/vite.d.ts +0 -2
- package/webpack.d.ts +0 -2
package/README.md
CHANGED
|
@@ -74,8 +74,8 @@ export default {
|
|
|
74
74
|
module.exports = {
|
|
75
75
|
/* ... */
|
|
76
76
|
plugins: [
|
|
77
|
-
require('unplugin-vue-components/webpack')({ /* options */ })
|
|
78
|
-
]
|
|
77
|
+
require('unplugin-vue-components/webpack')({ /* options */ }),
|
|
78
|
+
],
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -217,7 +217,7 @@ Components({
|
|
|
217
217
|
AntDesignVueResolver(),
|
|
218
218
|
ElementPlusResolver(),
|
|
219
219
|
VantResolver(),
|
|
220
|
-
]
|
|
220
|
+
],
|
|
221
221
|
})
|
|
222
222
|
```
|
|
223
223
|
|
|
@@ -231,8 +231,8 @@ Components({
|
|
|
231
231
|
// where `name` is always CapitalCase
|
|
232
232
|
if (name.startsWith('Van'))
|
|
233
233
|
return { importName: name.slice(3), path: 'vant' }
|
|
234
|
-
}
|
|
235
|
-
]
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
236
|
})
|
|
237
237
|
```
|
|
238
238
|
|
|
@@ -298,7 +298,7 @@ Components({
|
|
|
298
298
|
// resolvers for custom components
|
|
299
299
|
resolvers: [],
|
|
300
300
|
|
|
301
|
-
// generate `components.d.ts` global declarations,
|
|
301
|
+
// generate `components.d.ts` global declarations,
|
|
302
302
|
// also accepts a path for custom filename
|
|
303
303
|
dts: false,
|
|
304
304
|
|
|
File without changes
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
22
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
23
|
+
}) : x)(function(x) {
|
|
24
|
+
if (typeof require !== "undefined")
|
|
25
|
+
return require.apply(this, arguments);
|
|
26
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
27
|
+
});
|
|
28
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
29
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/core/utils.ts
|
|
2
33
|
var _path = require('path');
|
|
3
34
|
var _minimatch = require('minimatch'); var _minimatch2 = _interopRequireDefault(_minimatch);
|
|
4
35
|
var _resolve = require('resolve'); var _resolve2 = _interopRequireDefault(_resolve);
|
|
@@ -213,4 +244,8 @@ function LibraryResolver(options) {
|
|
|
213
244
|
|
|
214
245
|
|
|
215
246
|
|
|
216
|
-
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__require = __require; exports.__commonJS = __commonJS; exports.DISABLE_COMMENT = DISABLE_COMMENT; exports.isSSR = isSSR; exports.pascalCase = pascalCase; exports.camelCase = camelCase; exports.kebabCase = kebabCase; exports.parseId = parseId; exports.matchGlobs = matchGlobs; exports.getTransformedPath = getTransformedPath; exports.stringifyComponentImport = stringifyComponentImport; exports.getNameFromFilePath = getNameFromFilePath; exports.resolveAlias = resolveAlias; exports.getPkgVersion = getPkgVersion; exports.shouldTransform = shouldTransform; exports.resolveImportPath = resolveImportPath; exports.tryLoadVeturTags = tryLoadVeturTags; exports.LibraryResolver = LibraryResolver;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DISABLE_COMMENT,
|
|
3
3
|
LibraryResolver,
|
|
4
|
+
__require,
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues,
|
|
4
7
|
getNameFromFilePath,
|
|
5
8
|
getTransformedPath,
|
|
6
9
|
matchGlobs,
|
|
@@ -9,12 +12,7 @@ import {
|
|
|
9
12
|
resolveAlias,
|
|
10
13
|
shouldTransform,
|
|
11
14
|
stringifyComponentImport
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
__require,
|
|
15
|
-
__spreadProps,
|
|
16
|
-
__spreadValues
|
|
17
|
-
} from "./chunk-EKXJN6YJ.mjs";
|
|
15
|
+
} from "./chunk-PQNKN3AH.mjs";
|
|
18
16
|
|
|
19
17
|
// src/core/unplugin.ts
|
|
20
18
|
import { createUnplugin } from "unplugin";
|
|
@@ -328,7 +326,7 @@ var Context = class {
|
|
|
328
326
|
constructor(rawOptions) {
|
|
329
327
|
this.rawOptions = rawOptions;
|
|
330
328
|
this.transformer = void 0;
|
|
331
|
-
this._componentPaths = new Set();
|
|
329
|
+
this._componentPaths = /* @__PURE__ */ new Set();
|
|
332
330
|
this._componentNameMap = {};
|
|
333
331
|
this._componentUsageMap = {};
|
|
334
332
|
this._componentCustomMap = {};
|
|
@@ -380,7 +378,7 @@ var Context = class {
|
|
|
380
378
|
}
|
|
381
379
|
updateUsageMap(path, paths) {
|
|
382
380
|
if (!this._componentUsageMap[path])
|
|
383
|
-
this._componentUsageMap[path] = new Set();
|
|
381
|
+
this._componentUsageMap[path] = /* @__PURE__ */ new Set();
|
|
384
382
|
paths.forEach((p) => {
|
|
385
383
|
this._componentUsageMap[path].add(p);
|
|
386
384
|
});
|
|
@@ -508,9 +506,18 @@ var Context = class {
|
|
|
508
506
|
var unplugin_default = createUnplugin((options = {}) => {
|
|
509
507
|
const filter = createFilter(options.include || [/\.vue$/, /\.vue\?vue/], options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]);
|
|
510
508
|
const ctx = new Context(options);
|
|
509
|
+
const api = {
|
|
510
|
+
async findComponent(name, filename) {
|
|
511
|
+
return await ctx.findComponent(name, "component", filename ? [filename] : []);
|
|
512
|
+
},
|
|
513
|
+
stringifyImport(info) {
|
|
514
|
+
return stringifyComponentImport(info, ctx);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
511
517
|
return {
|
|
512
518
|
name: "unplugin-vue-components",
|
|
513
519
|
enforce: "post",
|
|
520
|
+
api,
|
|
514
521
|
transformInclude(id) {
|
|
515
522
|
return filter(id);
|
|
516
523
|
},
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
22
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
23
|
+
}) : x)(function(x) {
|
|
24
|
+
if (typeof require !== "undefined")
|
|
25
|
+
return require.apply(this, arguments);
|
|
26
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
27
|
+
});
|
|
28
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
29
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30
|
+
};
|
|
31
|
+
|
|
1
32
|
// src/core/utils.ts
|
|
2
33
|
import { parse } from "path";
|
|
3
34
|
import minimatch from "minimatch";
|
|
@@ -197,6 +228,10 @@ function LibraryResolver(options) {
|
|
|
197
228
|
}
|
|
198
229
|
|
|
199
230
|
export {
|
|
231
|
+
__spreadValues,
|
|
232
|
+
__spreadProps,
|
|
233
|
+
__require,
|
|
234
|
+
__commonJS,
|
|
200
235
|
DISABLE_COMMENT,
|
|
201
236
|
isSSR,
|
|
202
237
|
pascalCase,
|
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunkERB4VV6Kjs = require('./chunk-ERB4VV6K.js');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
var _chunkHIJQIC5Vjs = require('./chunk-HIJQIC5V.js');
|
|
15
|
+
var _chunkI3PYM4HQjs = require('./chunk-I3PYM4HQ.js');
|
|
18
16
|
|
|
19
17
|
// src/core/unplugin.ts
|
|
20
18
|
var _unplugin = require('unplugin');
|
|
@@ -49,7 +47,7 @@ function resolveOptions(options, root) {
|
|
|
49
47
|
const resolved = Object.assign({}, defaultOptions, options);
|
|
50
48
|
resolved.libraries = _utils.toArray.call(void 0, resolved.libraries).map((i) => typeof i === "string" ? { name: i } : i);
|
|
51
49
|
resolved.resolvers = normalizeResolvers(resolved.resolvers);
|
|
52
|
-
resolved.resolvers.push(...resolved.libraries.map((lib) =>
|
|
50
|
+
resolved.resolvers.push(...resolved.libraries.map((lib) => _chunkI3PYM4HQjs.LibraryResolver.call(void 0, lib)));
|
|
53
51
|
resolved.extensions = _utils.toArray.call(void 0, resolved.extensions);
|
|
54
52
|
if (resolved.globs) {
|
|
55
53
|
resolved.globs = _utils.toArray.call(void 0, resolved.globs).map((glob) => _utils.slash.call(void 0, _path.resolve.call(void 0, root, glob)));
|
|
@@ -71,7 +69,7 @@ function resolveOptions(options, root) {
|
|
|
71
69
|
function getVueVersion() {
|
|
72
70
|
var _a;
|
|
73
71
|
try {
|
|
74
|
-
const vue =
|
|
72
|
+
const vue = _chunkI3PYM4HQjs.__require.call(void 0, "vue");
|
|
75
73
|
const version = ((_a = vue == null ? void 0 : vue.default) == null ? void 0 : _a.version) || (vue == null ? void 0 : vue.version) || "3";
|
|
76
74
|
return version.startsWith("2.") ? "vue2" : "vue3";
|
|
77
75
|
} catch (e2) {
|
|
@@ -109,10 +107,10 @@ function parseDeclaration(code) {
|
|
|
109
107
|
return Object.fromEntries(Array.from(code.matchAll(/(?<!\/\/)\s+\s+['"]?(.+?)['"]?:\s(.+?)\n/g)).map((i) => [i[1], i[2]]));
|
|
110
108
|
}
|
|
111
109
|
async function generateDeclaration(ctx, root, filepath, removeUnused = false) {
|
|
112
|
-
const imports = Object.fromEntries(Object.values(
|
|
110
|
+
const imports = Object.fromEntries(Object.values(_chunkI3PYM4HQjs.__spreadValues.call(void 0, _chunkI3PYM4HQjs.__spreadValues.call(void 0, {}, ctx.componentNameMap), ctx.componentCustomMap)).map(({ path, name, importName }) => {
|
|
113
111
|
if (!name)
|
|
114
112
|
return void 0;
|
|
115
|
-
path =
|
|
113
|
+
path = _chunkI3PYM4HQjs.getTransformedPath.call(void 0, path, ctx);
|
|
116
114
|
const related = _path.isAbsolute.call(void 0, path) ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), path)}` : path;
|
|
117
115
|
let entry = `typeof import('${_utils.slash.call(void 0, related)}')`;
|
|
118
116
|
if (importName)
|
|
@@ -125,7 +123,7 @@ async function generateDeclaration(ctx, root, filepath, removeUnused = false) {
|
|
|
125
123
|
return;
|
|
126
124
|
const originalContent = _fs.existsSync.call(void 0, filepath) ? await _fs.promises.readFile(filepath, "utf-8") : "";
|
|
127
125
|
const originalImports = parseDeclaration(originalContent);
|
|
128
|
-
const lines = Object.entries(
|
|
126
|
+
const lines = Object.entries(_chunkI3PYM4HQjs.__spreadValues.call(void 0, _chunkI3PYM4HQjs.__spreadValues.call(void 0, {}, originalImports), imports)).sort((a, b) => a[0].localeCompare(b[0])).filter(([name]) => removeUnused ? ctx.componentCustomMap[name] || ctx.componentNameMap[name] : true).map(([name, v]) => {
|
|
129
127
|
if (!/^\w+$/.test(name))
|
|
130
128
|
name = `'${name}'`;
|
|
131
129
|
return `${name}: ${v}`;
|
|
@@ -188,12 +186,12 @@ async function transformComponent(code, transformer2, s, ctx, sfcPath) {
|
|
|
188
186
|
const results = transformer2 === "vue2" ? resolveVue2(code, s) : resolveVue3(code, s);
|
|
189
187
|
for (const { rawName, replace } of results) {
|
|
190
188
|
debug2(`| ${rawName}`);
|
|
191
|
-
const name =
|
|
189
|
+
const name = _chunkI3PYM4HQjs.pascalCase.call(void 0, rawName);
|
|
192
190
|
ctx.updateUsageMap(sfcPath, [name]);
|
|
193
191
|
const component = await ctx.findComponent(name, "component", [sfcPath]);
|
|
194
192
|
if (component) {
|
|
195
193
|
const varName = `__unplugin_components_${no}`;
|
|
196
|
-
s.prepend(`${
|
|
194
|
+
s.prepend(`${_chunkI3PYM4HQjs.stringifyComponentImport.call(void 0, _chunkI3PYM4HQjs.__spreadProps.call(void 0, _chunkI3PYM4HQjs.__spreadValues.call(void 0, {}, component), { name: varName }), ctx)};
|
|
197
195
|
`);
|
|
198
196
|
no += 1;
|
|
199
197
|
replace(varName);
|
|
@@ -283,13 +281,13 @@ async function transformDirective(code, transformer2, s, ctx, sfcPath) {
|
|
|
283
281
|
const results = await (transformer2 === "vue2" ? resolveVue22(code, s) : resolveVue32(code, s));
|
|
284
282
|
for (const { rawName, replace } of results) {
|
|
285
283
|
debug3(`| ${rawName}`);
|
|
286
|
-
const name =
|
|
284
|
+
const name = _chunkI3PYM4HQjs.pascalCase.call(void 0, rawName);
|
|
287
285
|
ctx.updateUsageMap(sfcPath, [name]);
|
|
288
286
|
const directive = await ctx.findComponent(name, "directive", [sfcPath]);
|
|
289
287
|
if (!directive)
|
|
290
288
|
continue;
|
|
291
289
|
const varName = `__unplugin_directives_${no}`;
|
|
292
|
-
s.prepend(`${
|
|
290
|
+
s.prepend(`${_chunkI3PYM4HQjs.stringifyComponentImport.call(void 0, _chunkI3PYM4HQjs.__spreadProps.call(void 0, _chunkI3PYM4HQjs.__spreadValues.call(void 0, {}, directive), { name: varName }), ctx)};
|
|
293
291
|
`);
|
|
294
292
|
no += 1;
|
|
295
293
|
replace(varName);
|
|
@@ -308,7 +306,7 @@ function transformer(ctx, transformer2) {
|
|
|
308
306
|
await transformComponent(code, transformer2, s, ctx, sfcPath);
|
|
309
307
|
if (ctx.options.directives)
|
|
310
308
|
await transformDirective(code, transformer2, s, ctx, sfcPath);
|
|
311
|
-
s.prepend(
|
|
309
|
+
s.prepend(_chunkI3PYM4HQjs.DISABLE_COMMENT);
|
|
312
310
|
const result = { code: s.toString() };
|
|
313
311
|
if (ctx.sourcemap)
|
|
314
312
|
result.map = s.generateMap({ source: id, includeContent: true });
|
|
@@ -328,7 +326,7 @@ var Context = class {
|
|
|
328
326
|
constructor(rawOptions) {
|
|
329
327
|
this.rawOptions = rawOptions;
|
|
330
328
|
this.transformer = void 0;
|
|
331
|
-
this._componentPaths = new Set();
|
|
329
|
+
this._componentPaths = /* @__PURE__ */ new Set();
|
|
332
330
|
this._componentNameMap = {};
|
|
333
331
|
this._componentUsageMap = {};
|
|
334
332
|
this._componentCustomMap = {};
|
|
@@ -352,7 +350,7 @@ var Context = class {
|
|
|
352
350
|
this.transformer = transformer(this, name || "vue3");
|
|
353
351
|
}
|
|
354
352
|
transform(code, id) {
|
|
355
|
-
const { path, query } =
|
|
353
|
+
const { path, query } = _chunkI3PYM4HQjs.parseId.call(void 0, id);
|
|
356
354
|
return this.transformer(code, id, path, query);
|
|
357
355
|
}
|
|
358
356
|
setupViteServer(server) {
|
|
@@ -364,14 +362,14 @@ var Context = class {
|
|
|
364
362
|
setupWatcher(watcher) {
|
|
365
363
|
const { globs } = this.options;
|
|
366
364
|
watcher.on("unlink", (path) => {
|
|
367
|
-
if (!
|
|
365
|
+
if (!_chunkI3PYM4HQjs.matchGlobs.call(void 0, path, globs))
|
|
368
366
|
return;
|
|
369
367
|
path = _utils.slash.call(void 0, path);
|
|
370
368
|
this.removeComponents(path);
|
|
371
369
|
this.onUpdate(path);
|
|
372
370
|
});
|
|
373
371
|
watcher.on("add", (path) => {
|
|
374
|
-
if (!
|
|
372
|
+
if (!_chunkI3PYM4HQjs.matchGlobs.call(void 0, path, globs))
|
|
375
373
|
return;
|
|
376
374
|
path = _utils.slash.call(void 0, path);
|
|
377
375
|
this.addComponents(path);
|
|
@@ -380,7 +378,7 @@ var Context = class {
|
|
|
380
378
|
}
|
|
381
379
|
updateUsageMap(path, paths) {
|
|
382
380
|
if (!this._componentUsageMap[path])
|
|
383
|
-
this._componentUsageMap[path] = new Set();
|
|
381
|
+
this._componentUsageMap[path] = /* @__PURE__ */ new Set();
|
|
384
382
|
paths.forEach((p) => {
|
|
385
383
|
this._componentUsageMap[path].add(p);
|
|
386
384
|
});
|
|
@@ -418,7 +416,7 @@ var Context = class {
|
|
|
418
416
|
updates: []
|
|
419
417
|
};
|
|
420
418
|
const timestamp = +new Date();
|
|
421
|
-
const name =
|
|
419
|
+
const name = _chunkI3PYM4HQjs.pascalCase.call(void 0, _chunkI3PYM4HQjs.getNameFromFilePath.call(void 0, path, this.options));
|
|
422
420
|
Object.entries(this._componentUsageMap).forEach(([key, values]) => {
|
|
423
421
|
if (values.has(name)) {
|
|
424
422
|
const r = `/${_utils.slash.call(void 0, _path.relative.call(void 0, this.root, key))}`;
|
|
@@ -436,7 +434,7 @@ var Context = class {
|
|
|
436
434
|
updateComponentNameMap() {
|
|
437
435
|
this._componentNameMap = {};
|
|
438
436
|
Array.from(this._componentPaths).forEach((path) => {
|
|
439
|
-
const name =
|
|
437
|
+
const name = _chunkI3PYM4HQjs.pascalCase.call(void 0, _chunkI3PYM4HQjs.getNameFromFilePath.call(void 0, path, this.options));
|
|
440
438
|
if (this._componentNameMap[name] && !this.options.allowOverrides) {
|
|
441
439
|
console.warn(`[unplugin-vue-components] component "${name}"(${path}) has naming conflicts with other components, ignored.`);
|
|
442
440
|
return;
|
|
@@ -464,7 +462,7 @@ var Context = class {
|
|
|
464
462
|
this.addCustomComponents(info);
|
|
465
463
|
return info;
|
|
466
464
|
} else {
|
|
467
|
-
info =
|
|
465
|
+
info = _chunkI3PYM4HQjs.__spreadValues.call(void 0, {
|
|
468
466
|
name
|
|
469
467
|
}, result);
|
|
470
468
|
this.addCustomComponents(info);
|
|
@@ -476,7 +474,7 @@ var Context = class {
|
|
|
476
474
|
}
|
|
477
475
|
normalizePath(path) {
|
|
478
476
|
var _a, _b, _c;
|
|
479
|
-
return
|
|
477
|
+
return _chunkI3PYM4HQjs.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) || []);
|
|
480
478
|
}
|
|
481
479
|
relative(path) {
|
|
482
480
|
if (path.startsWith("/") && !path.startsWith(this.root))
|
|
@@ -508,14 +506,23 @@ var Context = class {
|
|
|
508
506
|
var unplugin_default = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
509
507
|
const filter = _pluginutils.createFilter.call(void 0, options.include || [/\.vue$/, /\.vue\?vue/], options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/]);
|
|
510
508
|
const ctx = new Context(options);
|
|
509
|
+
const api = {
|
|
510
|
+
async findComponent(name, filename) {
|
|
511
|
+
return await ctx.findComponent(name, "component", filename ? [filename] : []);
|
|
512
|
+
},
|
|
513
|
+
stringifyImport(info) {
|
|
514
|
+
return _chunkI3PYM4HQjs.stringifyComponentImport.call(void 0, info, ctx);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
511
517
|
return {
|
|
512
518
|
name: "unplugin-vue-components",
|
|
513
519
|
enforce: "post",
|
|
520
|
+
api,
|
|
514
521
|
transformInclude(id) {
|
|
515
522
|
return filter(id);
|
|
516
523
|
},
|
|
517
524
|
async transform(code, id) {
|
|
518
|
-
if (!
|
|
525
|
+
if (!_chunkI3PYM4HQjs.shouldTransform.call(void 0, code))
|
|
519
526
|
return null;
|
|
520
527
|
try {
|
|
521
528
|
const result = await ctx.transform(code, id);
|
package/dist/esbuild.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-HIJQIC5V.js');
|
|
3
|
+
var _chunkX46PG6OBjs = require('./chunk-X46PG6OB.js');
|
|
4
|
+
require('./chunk-I3PYM4HQ.js');
|
|
5
|
+
require('./chunk-6F4PWJZI.js');
|
|
7
6
|
|
|
8
7
|
// src/esbuild.ts
|
|
9
|
-
var esbuild_default =
|
|
8
|
+
var esbuild_default = _chunkX46PG6OBjs.unplugin_default.esbuild;
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
module.exports = esbuild_default;
|
package/dist/esbuild.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KA5FQ6XN.mjs";
|
|
4
|
+
import "./chunk-PQNKN3AH.mjs";
|
|
5
5
|
import "./chunk-WBQAMGXK.mjs";
|
|
6
|
-
import "./chunk-EKXJN6YJ.mjs";
|
|
7
6
|
|
|
8
7
|
// src/esbuild.ts
|
|
9
8
|
var esbuild_default = unplugin_default.esbuild;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Options } from './types';
|
|
2
|
-
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, Matcher, Options, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, UILibraryOptions } from './types';
|
|
2
|
+
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentResolverFunction, ComponentResolverObject, ComponentsImportMap, ImportInfo, Matcher, Options, PublicPluginAPI, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, UILibraryOptions } from './types';
|
|
3
3
|
import * as unplugin from 'unplugin';
|
|
4
4
|
import '@rollup/pluginutils';
|
|
5
5
|
import '@antfu/utils';
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkX46PG6OBjs = require('./chunk-X46PG6OB.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-HIJQIC5V.js');
|
|
8
|
+
var _chunkI3PYM4HQjs = require('./chunk-I3PYM4HQ.js');
|
|
9
|
+
require('./chunk-6F4PWJZI.js');
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
exports.camelCase =
|
|
15
|
+
exports.camelCase = _chunkI3PYM4HQjs.camelCase; exports.default = _chunkX46PG6OBjs.unplugin_default; exports.kebabCase = _chunkI3PYM4HQjs.kebabCase; exports.pascalCase = _chunkI3PYM4HQjs.pascalCase;
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KA5FQ6XN.mjs";
|
|
4
4
|
import {
|
|
5
5
|
camelCase,
|
|
6
6
|
kebabCase,
|
|
7
7
|
pascalCase
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PQNKN3AH.mjs";
|
|
9
9
|
import "./chunk-WBQAMGXK.mjs";
|
|
10
|
-
import "./chunk-EKXJN6YJ.mjs";
|
|
11
10
|
export {
|
|
12
11
|
camelCase,
|
|
13
12
|
unplugin_default as default,
|
package/dist/nuxt.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-HIJQIC5V.js');
|
|
3
|
+
var _chunkX46PG6OBjs = require('./chunk-X46PG6OB.js');
|
|
4
|
+
require('./chunk-I3PYM4HQ.js');
|
|
5
|
+
require('./chunk-6F4PWJZI.js');
|
|
7
6
|
|
|
8
7
|
// src/nuxt.ts
|
|
9
8
|
function nuxt_default(options) {
|
|
10
9
|
this.extendBuild((config) => {
|
|
11
10
|
config.plugins = config.plugins || [];
|
|
12
|
-
config.plugins.unshift(
|
|
11
|
+
config.plugins.unshift(_chunkX46PG6OBjs.unplugin_default.webpack(options));
|
|
13
12
|
});
|
|
14
13
|
this.nuxt.hook("vite:extend", async (vite) => {
|
|
15
14
|
vite.config.plugins = vite.config.plugins || [];
|
|
16
|
-
vite.config.plugins.push(
|
|
15
|
+
vite.config.plugins.push(_chunkX46PG6OBjs.unplugin_default.vite(options));
|
|
17
16
|
});
|
|
18
17
|
}
|
|
19
18
|
|
package/dist/nuxt.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unplugin_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KA5FQ6XN.mjs";
|
|
4
|
+
import "./chunk-PQNKN3AH.mjs";
|
|
5
5
|
import "./chunk-WBQAMGXK.mjs";
|
|
6
|
-
import "./chunk-EKXJN6YJ.mjs";
|
|
7
6
|
|
|
8
7
|
// src/nuxt.ts
|
|
9
8
|
function nuxt_default(options) {
|