unplugin-vue-components 0.18.4 → 0.18.5
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/resolvers.d.ts +15 -1
- package/dist/resolvers.js +23 -12
- package/dist/resolvers.mjs +23 -12
- package/package.json +1 -1
package/dist/resolvers.d.ts
CHANGED
|
@@ -206,6 +206,13 @@ interface VantResolverOptions {
|
|
|
206
206
|
declare function VantResolver(options?: VantResolverOptions): ComponentResolver;
|
|
207
207
|
|
|
208
208
|
interface VarletUIResolverOptions {
|
|
209
|
+
/**
|
|
210
|
+
* support vue version
|
|
211
|
+
* vue3 use @varlet/ui, vue2 use @varlet-vue2/ui
|
|
212
|
+
*
|
|
213
|
+
* @default 'vue3'
|
|
214
|
+
*/
|
|
215
|
+
version?: 'vue3' | 'vue2';
|
|
209
216
|
/**
|
|
210
217
|
* import style along with components
|
|
211
218
|
*
|
|
@@ -231,7 +238,8 @@ declare function getResolved(name: string, options: VarletUIResolverOptions): Co
|
|
|
231
238
|
/**
|
|
232
239
|
* Resolver for VarletUI
|
|
233
240
|
*
|
|
234
|
-
* @link https://github.com/
|
|
241
|
+
* @link https://github.com/varletjs/varlet
|
|
242
|
+
* @link https://github.com/varletjs/varlet-vue2
|
|
235
243
|
*/
|
|
236
244
|
declare function VarletUIResolver(options?: VarletUIResolverOptions): ComponentResolver[];
|
|
237
245
|
|
|
@@ -352,6 +360,12 @@ interface ArcoResolverOptions {
|
|
|
352
360
|
* @default false
|
|
353
361
|
*/
|
|
354
362
|
resolveIcons?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Control style automatic import
|
|
365
|
+
*
|
|
366
|
+
* @default true
|
|
367
|
+
*/
|
|
368
|
+
sideEffect?: boolean;
|
|
355
369
|
}
|
|
356
370
|
/**
|
|
357
371
|
* Resolver for Arco Design Vue
|
package/dist/resolvers.js
CHANGED
|
@@ -2532,17 +2532,19 @@ function getResolved(name, options) {
|
|
|
2532
2532
|
const {
|
|
2533
2533
|
importStyle = "css",
|
|
2534
2534
|
importCss = true,
|
|
2535
|
-
importLess
|
|
2535
|
+
importLess,
|
|
2536
|
+
version = "vue3"
|
|
2536
2537
|
} = options;
|
|
2538
|
+
const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
|
|
2537
2539
|
const sideEffects = [];
|
|
2538
2540
|
if (importStyle || importCss) {
|
|
2539
2541
|
if (importStyle === "less" || importLess)
|
|
2540
|
-
sideEffects.push(
|
|
2542
|
+
sideEffects.push(`${path}/es/${_chunkI3PYM4HQjs.kebabCase.call(void 0, name)}/style/less.js`);
|
|
2541
2543
|
else
|
|
2542
|
-
sideEffects.push(
|
|
2544
|
+
sideEffects.push(`${path}/es/${_chunkI3PYM4HQjs.kebabCase.call(void 0, name)}/style`);
|
|
2543
2545
|
}
|
|
2544
2546
|
return {
|
|
2545
|
-
path
|
|
2547
|
+
path,
|
|
2546
2548
|
importName: `_${name}Component`,
|
|
2547
2549
|
sideEffects
|
|
2548
2550
|
};
|
|
@@ -2720,14 +2722,17 @@ function VueUseComponentsResolver() {
|
|
|
2720
2722
|
}
|
|
2721
2723
|
|
|
2722
2724
|
// src/core/resolvers/quasar.ts
|
|
2725
|
+
var _fs = require('fs');
|
|
2726
|
+
var _localpkg = require('local-pkg');
|
|
2723
2727
|
function QuasarResolver() {
|
|
2728
|
+
let components5 = [];
|
|
2724
2729
|
return {
|
|
2725
2730
|
type: "component",
|
|
2726
|
-
resolve: (name) => {
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
+
resolve: async (name) => {
|
|
2732
|
+
if (!components5.length) {
|
|
2733
|
+
const quasarApiListPath = _localpkg.resolveModule.call(void 0, "quasar/dist/transforms/api-list.json");
|
|
2734
|
+
if (quasarApiListPath)
|
|
2735
|
+
components5 = JSON.parse(await _fs.promises.readFile(quasarApiListPath, "utf-8"));
|
|
2731
2736
|
}
|
|
2732
2737
|
if (components5.includes(name))
|
|
2733
2738
|
return { importName: name, path: "quasar" };
|
|
@@ -2892,6 +2897,10 @@ var matchComponents3 = [
|
|
|
2892
2897
|
{
|
|
2893
2898
|
pattern: /^(TypographyParagraph|TypographyTitle|TypographyText)$/,
|
|
2894
2899
|
componentDir: "typography"
|
|
2900
|
+
},
|
|
2901
|
+
{
|
|
2902
|
+
pattern: /^DescriptionsItem$/,
|
|
2903
|
+
componentDir: "descriptions"
|
|
2895
2904
|
}
|
|
2896
2905
|
];
|
|
2897
2906
|
function getComponentStyleDir(importName, importStyle) {
|
|
@@ -2923,11 +2932,13 @@ function ArcoResolver(options = {}) {
|
|
|
2923
2932
|
if (name.match(/^A[A-Z]/)) {
|
|
2924
2933
|
const importStyle = (_a = options.importStyle) != null ? _a : "css";
|
|
2925
2934
|
const importName = name.slice(1);
|
|
2926
|
-
|
|
2935
|
+
const config = {
|
|
2927
2936
|
importName,
|
|
2928
|
-
path: "@arco-design/web-vue"
|
|
2929
|
-
sideEffects: getComponentStyleDir(importName, importStyle)
|
|
2937
|
+
path: "@arco-design/web-vue"
|
|
2930
2938
|
};
|
|
2939
|
+
if (options.sideEffect !== false)
|
|
2940
|
+
config.sideEffects = getComponentStyleDir(importName, importStyle);
|
|
2941
|
+
return config;
|
|
2931
2942
|
}
|
|
2932
2943
|
}
|
|
2933
2944
|
};
|
package/dist/resolvers.mjs
CHANGED
|
@@ -2532,17 +2532,19 @@ function getResolved(name, options) {
|
|
|
2532
2532
|
const {
|
|
2533
2533
|
importStyle = "css",
|
|
2534
2534
|
importCss = true,
|
|
2535
|
-
importLess
|
|
2535
|
+
importLess,
|
|
2536
|
+
version = "vue3"
|
|
2536
2537
|
} = options;
|
|
2538
|
+
const path = version === "vue2" ? "@varlet-vue2/ui" : "@varlet/ui";
|
|
2537
2539
|
const sideEffects = [];
|
|
2538
2540
|
if (importStyle || importCss) {
|
|
2539
2541
|
if (importStyle === "less" || importLess)
|
|
2540
|
-
sideEffects.push(
|
|
2542
|
+
sideEffects.push(`${path}/es/${kebabCase(name)}/style/less.js`);
|
|
2541
2543
|
else
|
|
2542
|
-
sideEffects.push(
|
|
2544
|
+
sideEffects.push(`${path}/es/${kebabCase(name)}/style`);
|
|
2543
2545
|
}
|
|
2544
2546
|
return {
|
|
2545
|
-
path
|
|
2547
|
+
path,
|
|
2546
2548
|
importName: `_${name}Component`,
|
|
2547
2549
|
sideEffects
|
|
2548
2550
|
};
|
|
@@ -2720,14 +2722,17 @@ function VueUseComponentsResolver() {
|
|
|
2720
2722
|
}
|
|
2721
2723
|
|
|
2722
2724
|
// src/core/resolvers/quasar.ts
|
|
2725
|
+
import { promises as fs } from "fs";
|
|
2726
|
+
import { resolveModule } from "local-pkg";
|
|
2723
2727
|
function QuasarResolver() {
|
|
2728
|
+
let components5 = [];
|
|
2724
2729
|
return {
|
|
2725
2730
|
type: "component",
|
|
2726
|
-
resolve: (name) => {
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
+
resolve: async (name) => {
|
|
2732
|
+
if (!components5.length) {
|
|
2733
|
+
const quasarApiListPath = resolveModule("quasar/dist/transforms/api-list.json");
|
|
2734
|
+
if (quasarApiListPath)
|
|
2735
|
+
components5 = JSON.parse(await fs.readFile(quasarApiListPath, "utf-8"));
|
|
2731
2736
|
}
|
|
2732
2737
|
if (components5.includes(name))
|
|
2733
2738
|
return { importName: name, path: "quasar" };
|
|
@@ -2892,6 +2897,10 @@ var matchComponents3 = [
|
|
|
2892
2897
|
{
|
|
2893
2898
|
pattern: /^(TypographyParagraph|TypographyTitle|TypographyText)$/,
|
|
2894
2899
|
componentDir: "typography"
|
|
2900
|
+
},
|
|
2901
|
+
{
|
|
2902
|
+
pattern: /^DescriptionsItem$/,
|
|
2903
|
+
componentDir: "descriptions"
|
|
2895
2904
|
}
|
|
2896
2905
|
];
|
|
2897
2906
|
function getComponentStyleDir(importName, importStyle) {
|
|
@@ -2923,11 +2932,13 @@ function ArcoResolver(options = {}) {
|
|
|
2923
2932
|
if (name.match(/^A[A-Z]/)) {
|
|
2924
2933
|
const importStyle = (_a = options.importStyle) != null ? _a : "css";
|
|
2925
2934
|
const importName = name.slice(1);
|
|
2926
|
-
|
|
2935
|
+
const config = {
|
|
2927
2936
|
importName,
|
|
2928
|
-
path: "@arco-design/web-vue"
|
|
2929
|
-
sideEffects: getComponentStyleDir(importName, importStyle)
|
|
2937
|
+
path: "@arco-design/web-vue"
|
|
2930
2938
|
};
|
|
2939
|
+
if (options.sideEffect !== false)
|
|
2940
|
+
config.sideEffects = getComponentStyleDir(importName, importStyle);
|
|
2941
|
+
return config;
|
|
2931
2942
|
}
|
|
2932
2943
|
}
|
|
2933
2944
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unplugin-vue-components",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.5",
|
|
4
4
|
"description": "Components auto importing for Vue",
|
|
5
5
|
"homepage": "https://github.com/antfu/unplugin-vue-components",
|
|
6
6
|
"bugs": "https://github.com/antfu/unplugin-vue-components/issues",
|