@pit-frontend-framework/unplugin-vue-components 1.0.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/LICENSE +21 -0
- package/README.md +464 -0
- package/dist/esbuild.d.mts +6 -0
- package/dist/esbuild.mjs +5 -0
- package/dist/index.d.mts +11 -0
- package/dist/index.mjs +3 -0
- package/dist/nuxt.d.mts +7 -0
- package/dist/nuxt.mjs +9 -0
- package/dist/resolvers.d.mts +552 -0
- package/dist/resolvers.mjs +2007 -0
- package/dist/rolldown.d.mts +6 -0
- package/dist/rolldown.mjs +5 -0
- package/dist/rollup.d.mts +6 -0
- package/dist/rollup.mjs +5 -0
- package/dist/rspack.d.mts +6 -0
- package/dist/rspack.mjs +5 -0
- package/dist/src-S1kwY0Q8.mjs +656 -0
- package/dist/types-BbnOeCab.d.mts +217 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils-BfjsfvcK.mjs +229 -0
- package/dist/vite.d.mts +9 -0
- package/dist/vite.mjs +5 -0
- package/dist/webpack.d.mts +6 -0
- package/dist/webpack.mjs +5 -0
- package/package.json +95 -0
|
@@ -0,0 +1,2007 @@
|
|
|
1
|
+
import { c as kebabCase, f as pascalCase, i as getPkgVersion, o as isExclude, s as isSSR, t as camelCase } from "./utils-BfjsfvcK.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { promises, readFileSync } from "node:fs";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { join, normalize } from "node:path";
|
|
6
|
+
import { createDebug } from "obug";
|
|
7
|
+
import { resolveModule } from "local-pkg";
|
|
8
|
+
import { resolvePathSync } from "mlly";
|
|
9
|
+
//#region \0rolldown/runtime.js
|
|
10
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/core/resolvers/antdv.ts
|
|
14
|
+
const matchComponents$3 = [
|
|
15
|
+
{
|
|
16
|
+
pattern: /^Affix/,
|
|
17
|
+
styleDir: "affix"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
pattern: /^Avatar/,
|
|
21
|
+
styleDir: "avatar"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
pattern: /^AutoComplete/,
|
|
25
|
+
styleDir: "auto-complete"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
pattern: /^Alert/,
|
|
29
|
+
styleDir: "alert"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pattern: /^Anchor/,
|
|
33
|
+
styleDir: "anchor"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
pattern: /^App/,
|
|
37
|
+
styleDir: "app"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
pattern: /^Badge/,
|
|
41
|
+
styleDir: "badge"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
pattern: /^Breadcrumb/,
|
|
45
|
+
styleDir: "breadcrumb"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
pattern: /^Button/,
|
|
49
|
+
styleDir: "button"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
pattern: /^Checkbox/,
|
|
53
|
+
styleDir: "checkbox"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
pattern: /^Calendar/,
|
|
57
|
+
styleDir: "calendar"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pattern: /^Card/,
|
|
61
|
+
styleDir: "card"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pattern: /^Carousel/,
|
|
65
|
+
styleDir: "carousel"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
pattern: /^Collapse/,
|
|
69
|
+
styleDir: "collapse"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
pattern: /^Comment/,
|
|
73
|
+
styleDir: "comment"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
pattern: /^Descriptions/,
|
|
77
|
+
styleDir: "descriptions"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
pattern: /^RangePicker|^WeekPicker|^MonthPicker/,
|
|
81
|
+
styleDir: "date-picker"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
pattern: /^Divider/,
|
|
85
|
+
styleDir: "divider"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
pattern: /^Drawer/,
|
|
89
|
+
styleDir: "drawer"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pattern: /^Dropdown/,
|
|
93
|
+
styleDir: "dropdown"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
pattern: /^Empty/,
|
|
97
|
+
styleDir: "empty"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pattern: /^Flex/,
|
|
101
|
+
styleDir: "flex"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
pattern: /^FloatButton/,
|
|
105
|
+
styleDir: "float-button"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
pattern: /^Form/,
|
|
109
|
+
styleDir: "form"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
pattern: /^Grid/,
|
|
113
|
+
styleDir: "grid"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
pattern: /^InputNumber/,
|
|
117
|
+
styleDir: "input-number"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
pattern: /^Input|^Textarea/,
|
|
121
|
+
styleDir: "input"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
pattern: /^Statistic/,
|
|
125
|
+
styleDir: "statistic"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
pattern: /^CheckableTag/,
|
|
129
|
+
styleDir: "tag"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
pattern: /^TimeRangePicker/,
|
|
133
|
+
styleDir: "time-picker"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
pattern: /^Layout/,
|
|
137
|
+
styleDir: "layout"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
pattern: /^Menu|^SubMenu/,
|
|
141
|
+
styleDir: "menu"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
pattern: /^Table/,
|
|
145
|
+
styleDir: "table"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
pattern: /^TimePicker|^TimeRangePicker/,
|
|
149
|
+
styleDir: "time-picker"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
pattern: /^Radio/,
|
|
153
|
+
styleDir: "radio"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
pattern: /^Image/,
|
|
157
|
+
styleDir: "image"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
pattern: /^List/,
|
|
161
|
+
styleDir: "list"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
pattern: /^Tab/,
|
|
165
|
+
styleDir: "tabs"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
pattern: /^Mentions/,
|
|
169
|
+
styleDir: "mentions"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
pattern: /^Step/,
|
|
173
|
+
styleDir: "steps"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
pattern: /^Skeleton/,
|
|
177
|
+
styleDir: "skeleton"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
pattern: /^Select/,
|
|
181
|
+
styleDir: "select"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
pattern: /^TreeSelect/,
|
|
185
|
+
styleDir: "tree-select"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
pattern: /^Tree|^DirectoryTree/,
|
|
189
|
+
styleDir: "tree"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
pattern: /^Typography/,
|
|
193
|
+
styleDir: "typography"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
pattern: /^Timeline/,
|
|
197
|
+
styleDir: "timeline"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
pattern: /^Upload/,
|
|
201
|
+
styleDir: "upload"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
pattern: /^Qrcode/,
|
|
205
|
+
styleDir: "qrcode"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
pattern: /^Space/,
|
|
209
|
+
styleDir: "space"
|
|
210
|
+
}
|
|
211
|
+
];
|
|
212
|
+
function getStyleDir(compName) {
|
|
213
|
+
let styleDir;
|
|
214
|
+
const total = matchComponents$3.length;
|
|
215
|
+
for (let i = 0; i < total; i++) {
|
|
216
|
+
const matcher = matchComponents$3[i];
|
|
217
|
+
if (compName.match(matcher.pattern)) {
|
|
218
|
+
styleDir = matcher.styleDir;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (!styleDir) styleDir = kebabCase(compName);
|
|
223
|
+
return styleDir;
|
|
224
|
+
}
|
|
225
|
+
function getSideEffects$7(compName, options) {
|
|
226
|
+
const { importStyle = true, importLess = false } = options;
|
|
227
|
+
if (!importStyle) return;
|
|
228
|
+
const lib = options.cjs ? "lib" : "es";
|
|
229
|
+
const packageName = options?.packageName || "ant-design-vue";
|
|
230
|
+
if (importStyle === "less" || importStyle === "css-in-js" || importLess) return `${packageName}/${lib}/${getStyleDir(compName)}/style`;
|
|
231
|
+
else return `${packageName}/${lib}/${getStyleDir(compName)}/style/css`;
|
|
232
|
+
}
|
|
233
|
+
const primitiveNames = [
|
|
234
|
+
"Affix",
|
|
235
|
+
"Anchor",
|
|
236
|
+
"AnchorLink",
|
|
237
|
+
"AutoComplete",
|
|
238
|
+
"AutoCompleteOptGroup",
|
|
239
|
+
"AutoCompleteOption",
|
|
240
|
+
"Alert",
|
|
241
|
+
"Avatar",
|
|
242
|
+
"AvatarGroup",
|
|
243
|
+
"BackTop",
|
|
244
|
+
"Badge",
|
|
245
|
+
"BadgeRibbon",
|
|
246
|
+
"Breadcrumb",
|
|
247
|
+
"BreadcrumbItem",
|
|
248
|
+
"BreadcrumbSeparator",
|
|
249
|
+
"Button",
|
|
250
|
+
"ButtonGroup",
|
|
251
|
+
"Calendar",
|
|
252
|
+
"Card",
|
|
253
|
+
"CardGrid",
|
|
254
|
+
"CardMeta",
|
|
255
|
+
"Collapse",
|
|
256
|
+
"CollapsePanel",
|
|
257
|
+
"Carousel",
|
|
258
|
+
"Cascader",
|
|
259
|
+
"Checkbox",
|
|
260
|
+
"CheckboxGroup",
|
|
261
|
+
"Col",
|
|
262
|
+
"Comment",
|
|
263
|
+
"ConfigProvider",
|
|
264
|
+
"DatePicker",
|
|
265
|
+
"MonthPicker",
|
|
266
|
+
"WeekPicker",
|
|
267
|
+
"RangePicker",
|
|
268
|
+
"QuarterPicker",
|
|
269
|
+
"Descriptions",
|
|
270
|
+
"DescriptionsItem",
|
|
271
|
+
"Divider",
|
|
272
|
+
"Dropdown",
|
|
273
|
+
"DropdownButton",
|
|
274
|
+
"Drawer",
|
|
275
|
+
"Empty",
|
|
276
|
+
"Form",
|
|
277
|
+
"FormItem",
|
|
278
|
+
"FormItemRest",
|
|
279
|
+
"Grid",
|
|
280
|
+
"Input",
|
|
281
|
+
"InputGroup",
|
|
282
|
+
"InputPassword",
|
|
283
|
+
"InputSearch",
|
|
284
|
+
"Textarea",
|
|
285
|
+
"Image",
|
|
286
|
+
"ImagePreviewGroup",
|
|
287
|
+
"InputNumber",
|
|
288
|
+
"Layout",
|
|
289
|
+
"LayoutHeader",
|
|
290
|
+
"LayoutSider",
|
|
291
|
+
"LayoutFooter",
|
|
292
|
+
"LayoutContent",
|
|
293
|
+
"List",
|
|
294
|
+
"ListItem",
|
|
295
|
+
"ListItemMeta",
|
|
296
|
+
"Menu",
|
|
297
|
+
"MenuDivider",
|
|
298
|
+
"MenuItem",
|
|
299
|
+
"MenuItemGroup",
|
|
300
|
+
"SubMenu",
|
|
301
|
+
"Mentions",
|
|
302
|
+
"MentionsOption",
|
|
303
|
+
"Modal",
|
|
304
|
+
"Statistic",
|
|
305
|
+
"StatisticCountdown",
|
|
306
|
+
"PageHeader",
|
|
307
|
+
"Pagination",
|
|
308
|
+
"Popconfirm",
|
|
309
|
+
"Popover",
|
|
310
|
+
"Progress",
|
|
311
|
+
"Radio",
|
|
312
|
+
"RadioButton",
|
|
313
|
+
"RadioGroup",
|
|
314
|
+
"Rate",
|
|
315
|
+
"Result",
|
|
316
|
+
"Row",
|
|
317
|
+
"Select",
|
|
318
|
+
"SelectOptGroup",
|
|
319
|
+
"SelectOption",
|
|
320
|
+
"Skeleton",
|
|
321
|
+
"SkeletonButton",
|
|
322
|
+
"SkeletonAvatar",
|
|
323
|
+
"SkeletonInput",
|
|
324
|
+
"SkeletonImage",
|
|
325
|
+
"Slider",
|
|
326
|
+
"Space",
|
|
327
|
+
"Spin",
|
|
328
|
+
"Steps",
|
|
329
|
+
"Step",
|
|
330
|
+
"Switch",
|
|
331
|
+
"Table",
|
|
332
|
+
"TableColumn",
|
|
333
|
+
"TableColumnGroup",
|
|
334
|
+
"TableSummary",
|
|
335
|
+
"TableSummaryRow",
|
|
336
|
+
"TableSummaryCell",
|
|
337
|
+
"Transfer",
|
|
338
|
+
"Tree",
|
|
339
|
+
"TreeNode",
|
|
340
|
+
"DirectoryTree",
|
|
341
|
+
"TreeSelect",
|
|
342
|
+
"TreeSelectNode",
|
|
343
|
+
"Tabs",
|
|
344
|
+
"TabPane",
|
|
345
|
+
"Tag",
|
|
346
|
+
"CheckableTag",
|
|
347
|
+
"TimePicker",
|
|
348
|
+
"TimeRangePicker",
|
|
349
|
+
"Timeline",
|
|
350
|
+
"TimelineItem",
|
|
351
|
+
"Tooltip",
|
|
352
|
+
"Typography",
|
|
353
|
+
"TypographyLink",
|
|
354
|
+
"TypographyParagraph",
|
|
355
|
+
"TypographyText",
|
|
356
|
+
"TypographyTitle",
|
|
357
|
+
"Upload",
|
|
358
|
+
"UploadDragger",
|
|
359
|
+
"LocaleProvider",
|
|
360
|
+
"FloatButton",
|
|
361
|
+
"FloatButtonGroup",
|
|
362
|
+
"Qrcode",
|
|
363
|
+
"Watermark",
|
|
364
|
+
"Segmented",
|
|
365
|
+
"Tour",
|
|
366
|
+
"SpaceCompact",
|
|
367
|
+
"StyleProvider",
|
|
368
|
+
"Flex",
|
|
369
|
+
"App"
|
|
370
|
+
];
|
|
371
|
+
let antdvNames;
|
|
372
|
+
function genAntdNames(primitiveNames) {
|
|
373
|
+
antdvNames = new Set(primitiveNames);
|
|
374
|
+
}
|
|
375
|
+
genAntdNames(primitiveNames);
|
|
376
|
+
function isAntdv(compName) {
|
|
377
|
+
return antdvNames.has(compName);
|
|
378
|
+
}
|
|
379
|
+
function getImportName(compName) {
|
|
380
|
+
if (compName === "Qrcode") return "QRCode";
|
|
381
|
+
else if (compName === "SpaceCompact") return "Compact";
|
|
382
|
+
return compName;
|
|
383
|
+
}
|
|
384
|
+
function getDateLibraryComponent(compName) {
|
|
385
|
+
if (/^Calendar$/.test(compName)) return "calendar";
|
|
386
|
+
if (/^DatePicker$/.test(compName) || /^(?:Month|Week|Range|Quarter)Picker$/.test(compName)) return "date-picker";
|
|
387
|
+
if (/^Time(?:Range)?Picker$/.test(compName)) return "time-picker";
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Resolver for Ant Design Vue
|
|
391
|
+
*
|
|
392
|
+
* Requires ant-design-vue@v2.2.0-beta.6 or later
|
|
393
|
+
*
|
|
394
|
+
* See https://github.com/antfu/unplugin-vue-components/issues/26#issuecomment-789767941 for more details
|
|
395
|
+
*
|
|
396
|
+
* @author @yangss3
|
|
397
|
+
* @link https://antdv.com/
|
|
398
|
+
*/
|
|
399
|
+
function AntDesignVueResolver(options = {}) {
|
|
400
|
+
const originPrefix = options.prefix ?? "A";
|
|
401
|
+
return {
|
|
402
|
+
type: "component",
|
|
403
|
+
resolve: (name) => {
|
|
404
|
+
if (options.resolveIcons && /(?:Outlined|Filled|TwoTone)$/.test(name)) return {
|
|
405
|
+
name,
|
|
406
|
+
from: "@ant-design/icons-vue"
|
|
407
|
+
};
|
|
408
|
+
const [compName, prefix] = [name.slice(originPrefix.length), name.slice(0, originPrefix.length)];
|
|
409
|
+
if (prefix === originPrefix && isAntdv(compName) && !options?.exclude?.includes(compName)) {
|
|
410
|
+
const { cjs = false, packageName = "ant-design-vue" } = options;
|
|
411
|
+
const path = `${packageName}/${cjs ? "lib" : "es"}`;
|
|
412
|
+
const dateComponent = getDateLibraryComponent(compName);
|
|
413
|
+
if (dateComponent) {
|
|
414
|
+
const dateLibPath = `${path}/${dateComponent}/${options.resolveDateLibrary ?? "dayjs"}`;
|
|
415
|
+
const sideEffects = getSideEffects$7(compName, options);
|
|
416
|
+
if (compName === "Calendar" || compName === "DatePicker") return {
|
|
417
|
+
from: dateLibPath,
|
|
418
|
+
sideEffects
|
|
419
|
+
};
|
|
420
|
+
return {
|
|
421
|
+
name: getImportName(compName),
|
|
422
|
+
from: dateLibPath,
|
|
423
|
+
sideEffects
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
return {
|
|
427
|
+
name: getImportName(compName),
|
|
428
|
+
from: path,
|
|
429
|
+
sideEffects: getSideEffects$7(compName, options)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/core/resolvers/arco.ts
|
|
437
|
+
const debug = createDebug("unplugin-vue-components:resolvers:arco");
|
|
438
|
+
const matchComponents$2 = [
|
|
439
|
+
{
|
|
440
|
+
pattern: /^AnchorLink$/,
|
|
441
|
+
componentDir: "anchor"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
pattern: /^AvatarGroup$/,
|
|
445
|
+
componentDir: "avatar"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
pattern: /^BreadcrumbItem$/,
|
|
449
|
+
componentDir: "breadcrumb"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
pattern: /^ButtonGroup$/,
|
|
453
|
+
componentDir: "button"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
pattern: /^(CardMeta|CardGrid)$/,
|
|
457
|
+
componentDir: "card"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
pattern: /^CarouselItem$/,
|
|
461
|
+
componentDir: "carousel"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
pattern: /^CascaderPanel$/,
|
|
465
|
+
componentDir: "cascader"
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
pattern: /^CheckboxGroup$/,
|
|
469
|
+
componentDir: "checkbox"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
pattern: /^CollapseItem$/,
|
|
473
|
+
componentDir: "collapse"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
pattern: /^(WeekPicker|MonthPicker|YearPicker|QuarterPicker|RangePicker)$/,
|
|
477
|
+
componentDir: "date-picker"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
pattern: /^DescriptionsItem$/,
|
|
481
|
+
componentDir: "descriptions"
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
pattern: /^(Doption|Dgroup|Dsubmenu|DropdownButton)$/,
|
|
485
|
+
componentDir: "dropdown"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
pattern: /^FormItem$/,
|
|
489
|
+
componentDir: "form"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
pattern: /^(Col|Row|GridItem)$/,
|
|
493
|
+
componentDir: "grid"
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
pattern: /^(ImagePreview|ImagePreviewGroup)$/,
|
|
497
|
+
componentDir: "image"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
pattern: /^(InputGroup|InputSearch|InputPassword)$/,
|
|
501
|
+
componentDir: "input"
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
pattern: /^(LayoutHeader|LayoutContent|LayoutFooter|LayoutSider)$/,
|
|
505
|
+
componentDir: "layout"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
pattern: /^(ListItem|ListItemMeta)$/,
|
|
509
|
+
componentDir: "list"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
pattern: /^(MenuItem|MenuItemGroup|SubMenu)$/,
|
|
513
|
+
componentDir: "menu"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
pattern: /^RadioGroup$/,
|
|
517
|
+
componentDir: "radio"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
pattern: /^(Option|Optgroup)$/,
|
|
521
|
+
componentDir: "select"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
pattern: /^(SkeletonLine|SkeletonShape)$/,
|
|
525
|
+
componentDir: "skeleton"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
pattern: /^Countdown$/,
|
|
529
|
+
componentDir: "statistic"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
pattern: /^Step$/,
|
|
533
|
+
componentDir: "steps"
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
pattern: /^(Thead|Td|Th|Tr|Tbody|TableColumn)$/,
|
|
537
|
+
componentDir: "table"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
pattern: /^TagGroup$/,
|
|
541
|
+
componentDir: "tag"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
pattern: /^TabPane$/,
|
|
545
|
+
componentDir: "tabs"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
pattern: /^TimelineItem$/,
|
|
549
|
+
componentDir: "timeline"
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
pattern: /^(TypographyParagraph|TypographyTitle|TypographyText)$/,
|
|
553
|
+
componentDir: "typography"
|
|
554
|
+
}
|
|
555
|
+
];
|
|
556
|
+
function getComponentStyleDir(importName, importStyle) {
|
|
557
|
+
if (["ConfigProvider", "Icon"].includes(importName)) return void 0;
|
|
558
|
+
let componentDir = kebabCase(importName);
|
|
559
|
+
for (const item of matchComponents$2) if (item.pattern.test(importName)) {
|
|
560
|
+
componentDir = item.componentDir;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
if (importStyle === "less") return `@arco-design/web-vue/es/${componentDir}/style/index.js`;
|
|
564
|
+
if (importStyle === "css" || importStyle) return `@arco-design/web-vue/es/${componentDir}/style/css.js`;
|
|
565
|
+
}
|
|
566
|
+
function canResolveIcons(options) {
|
|
567
|
+
if (options === void 0) return false;
|
|
568
|
+
if (typeof options === "boolean") return options;
|
|
569
|
+
else return options.enable;
|
|
570
|
+
}
|
|
571
|
+
function getResolveIconPrefix(options) {
|
|
572
|
+
if (canResolveIcons(options)) if (typeof options === "boolean" && options) return "";
|
|
573
|
+
else if (options.enable) return options.iconPrefix ?? "";
|
|
574
|
+
else return "";
|
|
575
|
+
return "";
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Resolver for Arco Design Vue
|
|
579
|
+
*
|
|
580
|
+
* Requires arco-design/web-vue@2.11.0 or later
|
|
581
|
+
*
|
|
582
|
+
* @author @flsion
|
|
583
|
+
* @link https://arco.design/ for arco-design
|
|
584
|
+
*
|
|
585
|
+
*/
|
|
586
|
+
function ArcoResolver(options = {}) {
|
|
587
|
+
return {
|
|
588
|
+
type: "component",
|
|
589
|
+
resolve: (name) => {
|
|
590
|
+
if (canResolveIcons(options.resolveIcons)) {
|
|
591
|
+
const iconPrefix = pascalCase(getResolveIconPrefix(options.resolveIcons));
|
|
592
|
+
if (new RegExp(`^${iconPrefix}Icon`).test(name)) {
|
|
593
|
+
debug("found icon component name %s", name);
|
|
594
|
+
const rawComponentName = name.slice(iconPrefix.length);
|
|
595
|
+
debug("found icon component raw name %s", rawComponentName);
|
|
596
|
+
return {
|
|
597
|
+
name: rawComponentName,
|
|
598
|
+
as: name,
|
|
599
|
+
from: "@arco-design/web-vue/es/icon"
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (/^A[A-Z]/.test(name) && !isExclude(name, options.exclude)) {
|
|
604
|
+
const importStyle = options.importStyle ?? "css";
|
|
605
|
+
const importName = name.slice(1);
|
|
606
|
+
const config = {
|
|
607
|
+
name: importName,
|
|
608
|
+
from: "@arco-design/web-vue"
|
|
609
|
+
};
|
|
610
|
+
if (options.sideEffect !== false) config.sideEffects = getComponentStyleDir(importName, importStyle);
|
|
611
|
+
return config;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/core/resolvers/bootstrap-vue.ts
|
|
618
|
+
const COMPONENT_ALIASES = {
|
|
619
|
+
BBtn: "BButton",
|
|
620
|
+
BBtnClose: "BButtonClose",
|
|
621
|
+
BBtnGroup: "BButtonGroup",
|
|
622
|
+
BBtnToolbar: "BButtonToolbar",
|
|
623
|
+
BCheck: "BFormCheckbox",
|
|
624
|
+
BCheckbox: "BFormCheckbox",
|
|
625
|
+
BCheckboxGroup: "BFormCheckboxGroup",
|
|
626
|
+
BCheckGroup: "BFormCheckboxGroup",
|
|
627
|
+
BDatalist: "BFormDatalist",
|
|
628
|
+
BDatepicker: "BFormDatepicker",
|
|
629
|
+
BDd: "BDropdown",
|
|
630
|
+
BDdDivider: "BDropdownDivider",
|
|
631
|
+
BDdForm: "BDropdownForm",
|
|
632
|
+
BDdGroup: "BDropdownGroup",
|
|
633
|
+
BDdHeader: "BDropdownHeader",
|
|
634
|
+
BDdItem: "BDropdownItem",
|
|
635
|
+
BDdItemBtn: "BDropdownItemButton",
|
|
636
|
+
BDdItemButton: "BDropdownItemButton",
|
|
637
|
+
BDdText: "BDropdownText",
|
|
638
|
+
BDropdownItemBtn: "BDropdownItemButton",
|
|
639
|
+
BFile: "BFormFile",
|
|
640
|
+
BInput: "BFormInput",
|
|
641
|
+
BNavDd: "BNavItemDropdown",
|
|
642
|
+
BNavDropdown: "BNavItemDropdown",
|
|
643
|
+
BNavItemDd: "BNavItemDropdown",
|
|
644
|
+
BNavToggle: "BNavbarToggle",
|
|
645
|
+
BRadio: "BFormRadio",
|
|
646
|
+
BRadioGroup: "BFormRadioGroup",
|
|
647
|
+
BRating: "BFormRating",
|
|
648
|
+
BSelect: "BFormSelect",
|
|
649
|
+
BSelectOption: "BFormSelectOption",
|
|
650
|
+
BSelectOptionGroup: "BFormSelectOptionGroup",
|
|
651
|
+
BSpinbutton: "BFormSpinbutton",
|
|
652
|
+
BTag: "BFormTag",
|
|
653
|
+
BTags: "BFormTags",
|
|
654
|
+
BTextarea: "BFormTextarea",
|
|
655
|
+
BTimepicker: "BFormTimepicker"
|
|
656
|
+
};
|
|
657
|
+
/**
|
|
658
|
+
* Resolver for BootstrapVue
|
|
659
|
+
*
|
|
660
|
+
* @link https://github.com/bootstrap-vue/bootstrap-vue
|
|
661
|
+
*/
|
|
662
|
+
function BootstrapVueResolver(_options = {}) {
|
|
663
|
+
const options = {
|
|
664
|
+
directives: true,
|
|
665
|
+
..._options
|
|
666
|
+
};
|
|
667
|
+
const resolvers = [{
|
|
668
|
+
type: "component",
|
|
669
|
+
resolve: (name) => {
|
|
670
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
671
|
+
name: COMPONENT_ALIASES[name] || name,
|
|
672
|
+
from: "bootstrap-vue"
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}];
|
|
676
|
+
if (options.directives) resolvers.push({
|
|
677
|
+
type: "directive",
|
|
678
|
+
resolve: (name) => {
|
|
679
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
680
|
+
name: `V${name}`,
|
|
681
|
+
from: "bootstrap-vue"
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
return resolvers;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Resolver for BootstrapVueNext
|
|
689
|
+
*
|
|
690
|
+
* @link https://github.com/bootstrap-vue/bootstrap-vue-next
|
|
691
|
+
*
|
|
692
|
+
* @deprecated use `import { BootstrapVueNextResolver } from 'bootstrap-vue-next'` instead
|
|
693
|
+
*/
|
|
694
|
+
function BootstrapVueNextResolver(_options = {}) {
|
|
695
|
+
const options = {
|
|
696
|
+
directives: true,
|
|
697
|
+
..._options
|
|
698
|
+
};
|
|
699
|
+
const resolvers = [{
|
|
700
|
+
type: "component",
|
|
701
|
+
resolve: (name) => {
|
|
702
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
703
|
+
name,
|
|
704
|
+
from: "bootstrap-vue-next"
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
}];
|
|
708
|
+
if (options.directives) resolvers.push({
|
|
709
|
+
type: "directive",
|
|
710
|
+
resolve: (name) => {
|
|
711
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
712
|
+
name: `v${name}`,
|
|
713
|
+
from: "bootstrap-vue-next"
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
return resolvers;
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Resolver for legacy BootstrapVue3 apps
|
|
721
|
+
*
|
|
722
|
+
* @deprecated use BootstrapVueNextResolver with https://github.com/bootstrap-vue/bootstrap-vue-next
|
|
723
|
+
* @link https://www.npmjs.com/package/bootstrap-vue-3
|
|
724
|
+
*/
|
|
725
|
+
function BootstrapVue3Resolver(_options = {}) {
|
|
726
|
+
const options = {
|
|
727
|
+
directives: true,
|
|
728
|
+
..._options
|
|
729
|
+
};
|
|
730
|
+
const resolvers = [{
|
|
731
|
+
type: "component",
|
|
732
|
+
resolve: (name) => {
|
|
733
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
734
|
+
name,
|
|
735
|
+
from: "bootstrap-vue-3"
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
}];
|
|
739
|
+
if (options.directives) resolvers.push({
|
|
740
|
+
type: "directive",
|
|
741
|
+
resolve: (name) => {
|
|
742
|
+
if (/^B[A-Z]/.test(name)) return {
|
|
743
|
+
name: `V${name}`,
|
|
744
|
+
from: "bootstrap-vue-3"
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
return resolvers;
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/core/resolvers/devui.ts
|
|
752
|
+
const LIB_NAME = "vue-devui";
|
|
753
|
+
const HARMLESS = ["ripple"];
|
|
754
|
+
function resolveDirectory(name, filename) {
|
|
755
|
+
return `${LIB_NAME}/${name}/${filename}`;
|
|
756
|
+
}
|
|
757
|
+
function getSideEffects$6(name, filename) {
|
|
758
|
+
if (HARMLESS.includes(name)) return;
|
|
759
|
+
if (["row", "col"].includes(name)) return resolveDirectory("grid", filename);
|
|
760
|
+
if ([
|
|
761
|
+
"aside",
|
|
762
|
+
"content",
|
|
763
|
+
"footer",
|
|
764
|
+
"header",
|
|
765
|
+
"layout"
|
|
766
|
+
].includes(name)) return resolveDirectory("layout", filename);
|
|
767
|
+
if ([
|
|
768
|
+
"overlay",
|
|
769
|
+
"fixed-overlay",
|
|
770
|
+
"flexible-overlay"
|
|
771
|
+
].includes(name)) return resolveDirectory("overlay", filename);
|
|
772
|
+
if ([
|
|
773
|
+
"panel",
|
|
774
|
+
"panel-header",
|
|
775
|
+
"panel-body"
|
|
776
|
+
].includes(name)) return resolveDirectory("panel", filename);
|
|
777
|
+
if ([
|
|
778
|
+
"menu",
|
|
779
|
+
"menu-item",
|
|
780
|
+
"sub-menu"
|
|
781
|
+
].includes(name)) return resolveDirectory("menu", filename);
|
|
782
|
+
if (["tabs", "tab"].includes(name)) return resolveDirectory("tabs", filename);
|
|
783
|
+
if (["form", "form-item"].includes(name)) return resolveDirectory("form", filename);
|
|
784
|
+
if (["collapse", "collapse-item"].includes(name)) return resolveDirectory("collapse", filename);
|
|
785
|
+
if (["steps", "step"].includes(name)) return resolveDirectory("steps", filename);
|
|
786
|
+
if ([
|
|
787
|
+
"radio",
|
|
788
|
+
"radio-group",
|
|
789
|
+
"radio-button"
|
|
790
|
+
].includes(name)) return resolveDirectory("radio", filename);
|
|
791
|
+
if (["column"].includes(name)) return resolveDirectory("table", filename);
|
|
792
|
+
if (["timeline-item"].includes(name)) return resolveDirectory("timeline", filename);
|
|
793
|
+
if (["splitter-pane"].includes(name)) return resolveDirectory("splitter", filename);
|
|
794
|
+
return resolveDirectory(name, filename);
|
|
795
|
+
}
|
|
796
|
+
function componentsResolver(name, { ssr }) {
|
|
797
|
+
if (!/^D[A-Z]/.test(name)) return;
|
|
798
|
+
const resolveId = kebabCase(name = name.slice(1));
|
|
799
|
+
return {
|
|
800
|
+
name,
|
|
801
|
+
sideEffects: getSideEffects$6(resolveId, "style.css"),
|
|
802
|
+
from: getSideEffects$6(resolveId, `index.${ssr ? "umd" : "es"}.js`)
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
function directivesResolver(name, { ssr }) {
|
|
806
|
+
const resolveId = kebabCase(name);
|
|
807
|
+
return {
|
|
808
|
+
name: `${name}Directive`,
|
|
809
|
+
sideEffects: getSideEffects$6(resolveId, "style.css"),
|
|
810
|
+
from: resolveDirectory(resolveId, `index.${ssr ? "umd" : "es"}.js`)
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function DevUiResolver(options = {}) {
|
|
814
|
+
const config = {
|
|
815
|
+
directives: true,
|
|
816
|
+
importStyle: true,
|
|
817
|
+
ssr: false,
|
|
818
|
+
...options
|
|
819
|
+
};
|
|
820
|
+
const resolvers = [{
|
|
821
|
+
type: "component",
|
|
822
|
+
resolve: (name) => componentsResolver(name, config)
|
|
823
|
+
}];
|
|
824
|
+
if (config.directives) resolvers.push({
|
|
825
|
+
type: "directive",
|
|
826
|
+
resolve: (name) => directivesResolver(name, config)
|
|
827
|
+
});
|
|
828
|
+
return resolvers;
|
|
829
|
+
}
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/core/resolvers/element-plus.ts
|
|
832
|
+
var import_umd = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
833
|
+
(function(global, factory) {
|
|
834
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.compareVersions = {}));
|
|
835
|
+
})(exports, (function(exports$1) {
|
|
836
|
+
"use strict";
|
|
837
|
+
const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
838
|
+
const validateAndParse = (version) => {
|
|
839
|
+
if (typeof version !== "string") throw new TypeError("Invalid argument expected string");
|
|
840
|
+
const match = version.match(semver);
|
|
841
|
+
if (!match) throw new Error(`Invalid argument not valid semver ('${version}' received)`);
|
|
842
|
+
match.shift();
|
|
843
|
+
return match;
|
|
844
|
+
};
|
|
845
|
+
const isWildcard = (s) => s === "*" || s === "x" || s === "X";
|
|
846
|
+
const tryParse = (v) => {
|
|
847
|
+
const n = parseInt(v, 10);
|
|
848
|
+
return isNaN(n) ? v : n;
|
|
849
|
+
};
|
|
850
|
+
const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b];
|
|
851
|
+
const compareStrings = (a, b) => {
|
|
852
|
+
if (isWildcard(a) || isWildcard(b)) return 0;
|
|
853
|
+
const [ap, bp] = forceType(tryParse(a), tryParse(b));
|
|
854
|
+
if (ap > bp) return 1;
|
|
855
|
+
if (ap < bp) return -1;
|
|
856
|
+
return 0;
|
|
857
|
+
};
|
|
858
|
+
const compareSegments = (a, b) => {
|
|
859
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
860
|
+
const r = compareStrings(a[i] || "0", b[i] || "0");
|
|
861
|
+
if (r !== 0) return r;
|
|
862
|
+
}
|
|
863
|
+
return 0;
|
|
864
|
+
};
|
|
865
|
+
/**
|
|
866
|
+
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
867
|
+
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
|
868
|
+
* @param v1 - First version to compare
|
|
869
|
+
* @param v2 - Second version to compare
|
|
870
|
+
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
|
|
871
|
+
*/
|
|
872
|
+
const compareVersions = (v1, v2) => {
|
|
873
|
+
const n1 = validateAndParse(v1);
|
|
874
|
+
const n2 = validateAndParse(v2);
|
|
875
|
+
const p1 = n1.pop();
|
|
876
|
+
const p2 = n2.pop();
|
|
877
|
+
const r = compareSegments(n1, n2);
|
|
878
|
+
if (r !== 0) return r;
|
|
879
|
+
if (p1 && p2) return compareSegments(p1.split("."), p2.split("."));
|
|
880
|
+
else if (p1 || p2) return p1 ? -1 : 1;
|
|
881
|
+
return 0;
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Compare [semver](https://semver.org/) version strings using the specified operator.
|
|
885
|
+
*
|
|
886
|
+
* @param v1 First version to compare
|
|
887
|
+
* @param v2 Second version to compare
|
|
888
|
+
* @param operator Allowed arithmetic operator to use
|
|
889
|
+
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```
|
|
893
|
+
* compare('10.1.8', '10.0.4', '>'); // return true
|
|
894
|
+
* compare('10.0.1', '10.0.1', '='); // return true
|
|
895
|
+
* compare('10.1.1', '10.2.2', '<'); // return true
|
|
896
|
+
* compare('10.1.1', '10.2.2', '<='); // return true
|
|
897
|
+
* compare('10.1.1', '10.2.2', '>='); // return false
|
|
898
|
+
* ```
|
|
899
|
+
*/
|
|
900
|
+
const compare = (v1, v2, operator) => {
|
|
901
|
+
assertValidOperator(operator);
|
|
902
|
+
const res = compareVersions(v1, v2);
|
|
903
|
+
return operatorResMap[operator].includes(res);
|
|
904
|
+
};
|
|
905
|
+
const operatorResMap = {
|
|
906
|
+
">": [1],
|
|
907
|
+
">=": [0, 1],
|
|
908
|
+
"=": [0],
|
|
909
|
+
"<=": [-1, 0],
|
|
910
|
+
"<": [-1],
|
|
911
|
+
"!=": [-1, 1]
|
|
912
|
+
};
|
|
913
|
+
const allowedOperators = Object.keys(operatorResMap);
|
|
914
|
+
const assertValidOperator = (op) => {
|
|
915
|
+
if (typeof op !== "string") throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`);
|
|
916
|
+
if (allowedOperators.indexOf(op) === -1) throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`);
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
|
|
920
|
+
*
|
|
921
|
+
* @param version Version number to match
|
|
922
|
+
* @param range Range pattern for version
|
|
923
|
+
* @returns `true` if the version number is within the range, `false` otherwise.
|
|
924
|
+
*
|
|
925
|
+
* @example
|
|
926
|
+
* ```
|
|
927
|
+
* satisfies('1.1.0', '^1.0.0'); // return true
|
|
928
|
+
* satisfies('1.1.0', '~1.0.0'); // return false
|
|
929
|
+
* ```
|
|
930
|
+
*/
|
|
931
|
+
const satisfies = (version, range) => {
|
|
932
|
+
range = range.replace(/([><=]+)\s+/g, "$1");
|
|
933
|
+
if (range.includes("||")) return range.split("||").some((r) => satisfies(version, r));
|
|
934
|
+
else if (range.includes(" - ")) {
|
|
935
|
+
const [a, b] = range.split(" - ", 2);
|
|
936
|
+
return satisfies(version, `>=${a} <=${b}`);
|
|
937
|
+
} else if (range.includes(" ")) return range.trim().replace(/\s{2,}/g, " ").split(" ").every((r) => satisfies(version, r));
|
|
938
|
+
const m = range.match(/^([<>=~^]+)/);
|
|
939
|
+
const op = m ? m[1] : "=";
|
|
940
|
+
if (op !== "^" && op !== "~") return compare(version, range, op);
|
|
941
|
+
const [v1, v2, v3, , vp] = validateAndParse(version);
|
|
942
|
+
const [r1, r2, r3, , rp] = validateAndParse(range);
|
|
943
|
+
const v = [
|
|
944
|
+
v1,
|
|
945
|
+
v2,
|
|
946
|
+
v3
|
|
947
|
+
];
|
|
948
|
+
const r = [
|
|
949
|
+
r1,
|
|
950
|
+
r2 !== null && r2 !== void 0 ? r2 : "x",
|
|
951
|
+
r3 !== null && r3 !== void 0 ? r3 : "x"
|
|
952
|
+
];
|
|
953
|
+
if (rp) {
|
|
954
|
+
if (!vp) return false;
|
|
955
|
+
if (compareSegments(v, r) !== 0) return false;
|
|
956
|
+
if (compareSegments(vp.split("."), rp.split(".")) === -1) return false;
|
|
957
|
+
}
|
|
958
|
+
const nonZero = r.findIndex((v) => v !== "0") + 1;
|
|
959
|
+
const i = op === "~" ? 2 : nonZero > 1 ? nonZero : 1;
|
|
960
|
+
if (compareSegments(v.slice(0, i), r.slice(0, i)) !== 0) return false;
|
|
961
|
+
if (compareSegments(v.slice(i), r.slice(i)) === -1) return false;
|
|
962
|
+
return true;
|
|
963
|
+
};
|
|
964
|
+
/**
|
|
965
|
+
* Validate [semver](https://semver.org/) version strings.
|
|
966
|
+
*
|
|
967
|
+
* @param version Version number to validate
|
|
968
|
+
* @returns `true` if the version number is a valid semver version number, `false` otherwise.
|
|
969
|
+
*
|
|
970
|
+
* @example
|
|
971
|
+
* ```
|
|
972
|
+
* validate('1.0.0-rc.1'); // return true
|
|
973
|
+
* validate('1.0-rc.1'); // return false
|
|
974
|
+
* validate('foo'); // return false
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
const validate = (version) => typeof version === "string" && /^[v\d]/.test(version) && semver.test(version);
|
|
978
|
+
/**
|
|
979
|
+
* Validate [semver](https://semver.org/) version strings strictly. Will not accept wildcards and version ranges.
|
|
980
|
+
*
|
|
981
|
+
* @param version Version number to validate
|
|
982
|
+
* @returns `true` if the version number is a valid semver version number `false` otherwise
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* ```
|
|
986
|
+
* validate('1.0.0-rc.1'); // return true
|
|
987
|
+
* validate('1.0-rc.1'); // return false
|
|
988
|
+
* validate('foo'); // return false
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
const validateStrict = (version) => typeof version === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(version);
|
|
992
|
+
exports$1.compare = compare;
|
|
993
|
+
exports$1.compareVersions = compareVersions;
|
|
994
|
+
exports$1.satisfies = satisfies;
|
|
995
|
+
exports$1.validate = validate;
|
|
996
|
+
exports$1.validateStrict = validateStrict;
|
|
997
|
+
}));
|
|
998
|
+
})))();
|
|
999
|
+
/**
|
|
1000
|
+
* @deprecated
|
|
1001
|
+
* @param partialName
|
|
1002
|
+
* @param options
|
|
1003
|
+
*/
|
|
1004
|
+
function getSideEffectsLegacy(partialName, options) {
|
|
1005
|
+
const { importStyle } = options;
|
|
1006
|
+
if (!importStyle) return;
|
|
1007
|
+
if (importStyle === "sass") return ["pit-element-plus/packages/theme-chalk/src/base.scss", `pit-element-plus/packages/theme-chalk/src/${partialName}.scss`];
|
|
1008
|
+
else if (importStyle === true || importStyle === "css") return ["pit-element-plus/lib/theme-chalk/base.css", `pit-element-plus/lib/theme-chalk/el-${partialName}.css`];
|
|
1009
|
+
}
|
|
1010
|
+
function getSideEffects$5(dirName, options) {
|
|
1011
|
+
const { importStyle, ssr, nightly } = options;
|
|
1012
|
+
const themeFolder = nightly ? "@element-plus/nightly/theme-chalk" : "pit-element-plus/theme-chalk";
|
|
1013
|
+
const esComponentsFolder = nightly ? "@element-plus/nightly/es/components" : "pit-element-plus/es/components";
|
|
1014
|
+
if (importStyle === "sass") return ssr ? [`${themeFolder}/src/base.scss`, `${themeFolder}/src/${dirName}.scss`] : [`${esComponentsFolder}/base/style/index`, `${esComponentsFolder}/${dirName}/style/index`];
|
|
1015
|
+
else if (importStyle === true || importStyle === "css") return ssr ? [`${themeFolder}/base.css`, `${themeFolder}/el-${dirName}.css`] : [`${esComponentsFolder}/base/style/css`, `${esComponentsFolder}/${dirName}/style/css`];
|
|
1016
|
+
}
|
|
1017
|
+
function resolveComponent$1(name, options) {
|
|
1018
|
+
if (options.exclude && name.match(options.exclude)) return;
|
|
1019
|
+
if (!/^El[A-Z]/.test(name)) return;
|
|
1020
|
+
if (/^ElIcon.+/.test(name)) return {
|
|
1021
|
+
name: name.replace(/^ElIcon/, ""),
|
|
1022
|
+
from: "pit-element-icons"
|
|
1023
|
+
};
|
|
1024
|
+
const partialName = kebabCase(name.slice(2));
|
|
1025
|
+
const { version, ssr, nightly } = options;
|
|
1026
|
+
if ((0, import_umd.compare)(version, "1.1.0-beta.1", ">=") || nightly) return {
|
|
1027
|
+
name,
|
|
1028
|
+
from: `${nightly ? "@element-plus/nightly" : "pit-element-plus"}/${ssr ? "lib" : "es"}`,
|
|
1029
|
+
sideEffects: getSideEffects$5(partialName, options)
|
|
1030
|
+
};
|
|
1031
|
+
else if ((0, import_umd.compare)(version, "1.0.2-beta.28", ">=")) return {
|
|
1032
|
+
from: `pit-element-plus/es/el-${partialName}`,
|
|
1033
|
+
sideEffects: getSideEffectsLegacy(partialName, options)
|
|
1034
|
+
};
|
|
1035
|
+
else return {
|
|
1036
|
+
from: `pit-element-plus/lib/el-${partialName}`,
|
|
1037
|
+
sideEffects: getSideEffectsLegacy(partialName, options)
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
function resolveDirective(name, options) {
|
|
1041
|
+
if (!options.directives) return;
|
|
1042
|
+
const directive = {
|
|
1043
|
+
Loading: {
|
|
1044
|
+
importName: "ElLoadingDirective",
|
|
1045
|
+
styleName: "loading"
|
|
1046
|
+
},
|
|
1047
|
+
Popover: {
|
|
1048
|
+
importName: "ElPopoverDirective",
|
|
1049
|
+
styleName: "popover"
|
|
1050
|
+
},
|
|
1051
|
+
InfiniteScroll: {
|
|
1052
|
+
importName: "ElInfiniteScroll",
|
|
1053
|
+
styleName: "infinite-scroll"
|
|
1054
|
+
}
|
|
1055
|
+
}[name];
|
|
1056
|
+
if (!directive) return;
|
|
1057
|
+
const { version, ssr, nightly } = options;
|
|
1058
|
+
if ((0, import_umd.compare)(version, "1.1.0-beta.1", ">=") || nightly) return {
|
|
1059
|
+
name: directive.importName,
|
|
1060
|
+
from: `${nightly ? "@element-plus/nightly" : "pit-element-plus"}/${ssr ? "lib" : "es"}`,
|
|
1061
|
+
sideEffects: getSideEffects$5(directive.styleName, options)
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
const noStylesComponents = ["ElAutoResizer"];
|
|
1065
|
+
/**
|
|
1066
|
+
* Resolver for Element Plus
|
|
1067
|
+
*
|
|
1068
|
+
* See https://github.com/antfu/vite-plugin-components/pull/28 for more details
|
|
1069
|
+
* See https://github.com/antfu/vite-plugin-components/issues/117 for more details
|
|
1070
|
+
*
|
|
1071
|
+
* @author @develar @nabaonan @sxzz
|
|
1072
|
+
* @link https://element-plus.org/ for element-plus
|
|
1073
|
+
*
|
|
1074
|
+
*/
|
|
1075
|
+
function ElementPlusResolver(options = {}) {
|
|
1076
|
+
let optionsResolved;
|
|
1077
|
+
async function resolveOptions() {
|
|
1078
|
+
if (optionsResolved) return optionsResolved;
|
|
1079
|
+
optionsResolved = {
|
|
1080
|
+
ssr: false,
|
|
1081
|
+
version: await getPkgVersion("pit-element-plus", "2.2.2"),
|
|
1082
|
+
importStyle: "css",
|
|
1083
|
+
directives: true,
|
|
1084
|
+
exclude: void 0,
|
|
1085
|
+
noStylesComponents: options.noStylesComponents || [],
|
|
1086
|
+
nightly: false,
|
|
1087
|
+
...options
|
|
1088
|
+
};
|
|
1089
|
+
return optionsResolved;
|
|
1090
|
+
}
|
|
1091
|
+
return [{
|
|
1092
|
+
type: "component",
|
|
1093
|
+
resolve: async (name) => {
|
|
1094
|
+
const options = await resolveOptions();
|
|
1095
|
+
if ([...options.noStylesComponents, ...noStylesComponents].includes(name)) return resolveComponent$1(name, {
|
|
1096
|
+
...options,
|
|
1097
|
+
importStyle: false
|
|
1098
|
+
});
|
|
1099
|
+
else return resolveComponent$1(name, options);
|
|
1100
|
+
}
|
|
1101
|
+
}, {
|
|
1102
|
+
type: "directive",
|
|
1103
|
+
resolve: async (name) => {
|
|
1104
|
+
return resolveDirective(name, await resolveOptions());
|
|
1105
|
+
}
|
|
1106
|
+
}];
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/core/resolvers/headless-ui.ts
|
|
1110
|
+
const components$3 = [
|
|
1111
|
+
"Combobox",
|
|
1112
|
+
"ComboboxButton",
|
|
1113
|
+
"ComboboxInput",
|
|
1114
|
+
"ComboboxLabel",
|
|
1115
|
+
"ComboboxOption",
|
|
1116
|
+
"ComboboxOptions",
|
|
1117
|
+
"Dialog",
|
|
1118
|
+
"DialogDescription",
|
|
1119
|
+
"DialogOverlay",
|
|
1120
|
+
"DialogPanel",
|
|
1121
|
+
"DialogTitle",
|
|
1122
|
+
"Disclosure",
|
|
1123
|
+
"DisclosureButton",
|
|
1124
|
+
"DisclosurePanel",
|
|
1125
|
+
"FocusTrap",
|
|
1126
|
+
"Listbox",
|
|
1127
|
+
"ListboxButton",
|
|
1128
|
+
"ListboxLabel",
|
|
1129
|
+
"ListboxOption",
|
|
1130
|
+
"ListboxOptions",
|
|
1131
|
+
"Menu",
|
|
1132
|
+
"MenuButton",
|
|
1133
|
+
"MenuItem",
|
|
1134
|
+
"MenuItems",
|
|
1135
|
+
"Popover",
|
|
1136
|
+
"PopoverButton",
|
|
1137
|
+
"PopoverGroup",
|
|
1138
|
+
"PopoverOverlay",
|
|
1139
|
+
"PopoverPanel",
|
|
1140
|
+
"Portal",
|
|
1141
|
+
"PortalGroup",
|
|
1142
|
+
"RadioGroup",
|
|
1143
|
+
"RadioGroupDescription",
|
|
1144
|
+
"RadioGroupLabel",
|
|
1145
|
+
"RadioGroupOption",
|
|
1146
|
+
"Switch",
|
|
1147
|
+
"SwitchDescription",
|
|
1148
|
+
"SwitchGroup",
|
|
1149
|
+
"SwitchLabel",
|
|
1150
|
+
"Tab",
|
|
1151
|
+
"TabGroup",
|
|
1152
|
+
"TabList",
|
|
1153
|
+
"TabPanel",
|
|
1154
|
+
"TabPanels",
|
|
1155
|
+
"TransitionChild",
|
|
1156
|
+
"TransitionRoot"
|
|
1157
|
+
];
|
|
1158
|
+
/**
|
|
1159
|
+
* Resolver for headlessui
|
|
1160
|
+
*
|
|
1161
|
+
* @link https://github.com/tailwindlabs/headlessui
|
|
1162
|
+
*/
|
|
1163
|
+
function HeadlessUiResolver(options = {}) {
|
|
1164
|
+
const { prefix = "" } = options;
|
|
1165
|
+
return {
|
|
1166
|
+
type: "component",
|
|
1167
|
+
resolve: (name) => {
|
|
1168
|
+
if (name.startsWith(prefix)) {
|
|
1169
|
+
const componentName = name.substring(prefix.length);
|
|
1170
|
+
if (components$3.includes(componentName)) return {
|
|
1171
|
+
name: componentName,
|
|
1172
|
+
from: "@headlessui/vue"
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region src/core/resolvers/idux.ts
|
|
1180
|
+
const specialComponents = {
|
|
1181
|
+
CdkClickOutside: "click-outside",
|
|
1182
|
+
CdkDraggable: "drag-drop",
|
|
1183
|
+
CdkResizable: "resize",
|
|
1184
|
+
CdkResizableHandle: "resize",
|
|
1185
|
+
CdkResizeObserver: "resize",
|
|
1186
|
+
CdkVirtualScroll: "scroll",
|
|
1187
|
+
IxAutoComplete: "auto-complete",
|
|
1188
|
+
IxBackTop: "back-top",
|
|
1189
|
+
IxCol: "grid",
|
|
1190
|
+
IxDatePicker: "date-picker",
|
|
1191
|
+
IxDateRangePicker: "date-picker",
|
|
1192
|
+
IxInputNumber: "input-number",
|
|
1193
|
+
IxLoadingBar: "loading-bar",
|
|
1194
|
+
IxLoadingBarProvider: "loading-bar",
|
|
1195
|
+
IxRow: "grid",
|
|
1196
|
+
IxTab: "tabs",
|
|
1197
|
+
IxTimePicker: "time-picker",
|
|
1198
|
+
IxTimeRangePicker: "time-picker",
|
|
1199
|
+
IxTreeSelect: "tree-select"
|
|
1200
|
+
};
|
|
1201
|
+
/**
|
|
1202
|
+
* Resolver for `@idux/cdk`, `@idux/components` and ``@idux/pro``
|
|
1203
|
+
*
|
|
1204
|
+
* @link https://idux.site
|
|
1205
|
+
*/
|
|
1206
|
+
function IduxResolver(options = {}) {
|
|
1207
|
+
return {
|
|
1208
|
+
type: "component",
|
|
1209
|
+
resolve: async (name) => {
|
|
1210
|
+
const { importStyle, importStyleTheme, exclude = [], scope = "@idux" } = options;
|
|
1211
|
+
if (exclude.includes(name)) return;
|
|
1212
|
+
const packageName = getPackageName(name);
|
|
1213
|
+
if (!packageName) return;
|
|
1214
|
+
const resolvedVersion = await getPkgVersion(`${scope}/${packageName}`, "2.0.0");
|
|
1215
|
+
let dirname = specialComponents[name];
|
|
1216
|
+
if (!dirname) {
|
|
1217
|
+
const nameIndex = packageName === "pro" ? 2 : 1;
|
|
1218
|
+
dirname = kebabCase(name).split("-")[nameIndex];
|
|
1219
|
+
}
|
|
1220
|
+
const path = `${scope}/${packageName}/${dirname}`;
|
|
1221
|
+
return {
|
|
1222
|
+
name,
|
|
1223
|
+
from: path,
|
|
1224
|
+
sideEffects: packageName === "cdk" ? void 0 : getSideEffects$4(resolvedVersion, path, importStyle, importStyleTheme)
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
function getPackageName(name) {
|
|
1230
|
+
let packageName;
|
|
1231
|
+
if (/^Cdk[A-Z]/.test(name)) packageName = "cdk";
|
|
1232
|
+
else if (/^IxPro[A-Z]/.test(name)) packageName = "pro";
|
|
1233
|
+
else if (/^Ix[A-Z]/.test(name)) packageName = "components";
|
|
1234
|
+
return packageName;
|
|
1235
|
+
}
|
|
1236
|
+
function getSideEffects$4(version, path, importStyle, importStyleTheme) {
|
|
1237
|
+
if (!importStyle) return;
|
|
1238
|
+
if ((0, import_umd.compare)(version, "2.0.0-beta.0", "<")) return getLegacySideEffects(path, importStyle, importStyleTheme);
|
|
1239
|
+
const styleRoot = `${path}/style`;
|
|
1240
|
+
const themeRoot = `${path}/theme`;
|
|
1241
|
+
const styleImport = `${styleRoot}/${importStyle === "css" ? "index.css" : "index"}`;
|
|
1242
|
+
if (!resolveModule(styleImport)) return;
|
|
1243
|
+
const themeImport = `${themeRoot}/${importStyleTheme}.css`;
|
|
1244
|
+
if (!importStyleTheme || !resolveModule(themeImport)) return styleImport;
|
|
1245
|
+
return [styleImport, `${themeRoot}/${importStyleTheme}`];
|
|
1246
|
+
}
|
|
1247
|
+
function getLegacySideEffects(path, importStyle, importStyleTheme = "default") {
|
|
1248
|
+
const styleImport = `${path}/style/themes/${importStyle === "css" ? `${importStyleTheme}_css` : importStyleTheme}`;
|
|
1249
|
+
if (!resolveModule(styleImport)) return;
|
|
1250
|
+
return styleImport;
|
|
1251
|
+
}
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/core/resolvers/inkline.ts
|
|
1254
|
+
/**
|
|
1255
|
+
* Resolver for Inkline
|
|
1256
|
+
*
|
|
1257
|
+
* @author @alexgrozav
|
|
1258
|
+
* @link https://github.com/inkline/inkline
|
|
1259
|
+
*/
|
|
1260
|
+
function InklineResolver() {
|
|
1261
|
+
return {
|
|
1262
|
+
type: "component",
|
|
1263
|
+
resolve: (name) => {
|
|
1264
|
+
if (/^I[A-Z]/.test(name)) return {
|
|
1265
|
+
name,
|
|
1266
|
+
from: "@inkline/inkline"
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
//#endregion
|
|
1272
|
+
//#region src/core/resolvers/ionic.ts
|
|
1273
|
+
/**
|
|
1274
|
+
* source: https://github.com/nuxt-modules/ionic/blob/main/src/imports.ts
|
|
1275
|
+
* @author @danielroe
|
|
1276
|
+
*/
|
|
1277
|
+
const IonicBuiltInComponents = [
|
|
1278
|
+
"IonAccordion",
|
|
1279
|
+
"IonAccordionGroup",
|
|
1280
|
+
"IonActionSheet",
|
|
1281
|
+
"IonAlert",
|
|
1282
|
+
"IonApp",
|
|
1283
|
+
"IonAvatar",
|
|
1284
|
+
"IonBackButton",
|
|
1285
|
+
"IonBackdrop",
|
|
1286
|
+
"IonBadge",
|
|
1287
|
+
"IonBreadcrumb",
|
|
1288
|
+
"IonBreadcrumbs",
|
|
1289
|
+
"IonButton",
|
|
1290
|
+
"IonButtons",
|
|
1291
|
+
"IonCard",
|
|
1292
|
+
"IonCardContent",
|
|
1293
|
+
"IonCardHeader",
|
|
1294
|
+
"IonCardSubtitle",
|
|
1295
|
+
"IonCardTitle",
|
|
1296
|
+
"IonCheckbox",
|
|
1297
|
+
"IonChip",
|
|
1298
|
+
"IonCol",
|
|
1299
|
+
"IonContent",
|
|
1300
|
+
"IonDatetime",
|
|
1301
|
+
"IonDatetimeButton",
|
|
1302
|
+
"IonFab",
|
|
1303
|
+
"IonFabButton",
|
|
1304
|
+
"IonFabList",
|
|
1305
|
+
"IonFooter",
|
|
1306
|
+
"IonGrid",
|
|
1307
|
+
"IonHeader",
|
|
1308
|
+
"IonIcon",
|
|
1309
|
+
"IonImg",
|
|
1310
|
+
"IonInfiniteScroll",
|
|
1311
|
+
"IonInfiniteScrollContent",
|
|
1312
|
+
"IonInput",
|
|
1313
|
+
"IonInputOtp",
|
|
1314
|
+
"IonInputPasswordToggle",
|
|
1315
|
+
"IonItem",
|
|
1316
|
+
"IonItemDivider",
|
|
1317
|
+
"IonItemGroup",
|
|
1318
|
+
"IonItemOption",
|
|
1319
|
+
"IonItemOptions",
|
|
1320
|
+
"IonItemSliding",
|
|
1321
|
+
"IonLabel",
|
|
1322
|
+
"IonList",
|
|
1323
|
+
"IonListHeader",
|
|
1324
|
+
"IonLoading",
|
|
1325
|
+
"IonMenu",
|
|
1326
|
+
"IonMenuButton",
|
|
1327
|
+
"IonMenuToggle",
|
|
1328
|
+
"IonModal",
|
|
1329
|
+
"IonNav",
|
|
1330
|
+
"IonNavLink",
|
|
1331
|
+
"IonNote",
|
|
1332
|
+
"IonPage",
|
|
1333
|
+
"IonPicker",
|
|
1334
|
+
"IonPickerColumn",
|
|
1335
|
+
"IonPickerColumnOption",
|
|
1336
|
+
"IonPickerLegacy",
|
|
1337
|
+
"IonPopover",
|
|
1338
|
+
"IonProgressBar",
|
|
1339
|
+
"IonRadio",
|
|
1340
|
+
"IonRadioGroup",
|
|
1341
|
+
"IonRange",
|
|
1342
|
+
"IonRefresher",
|
|
1343
|
+
"IonRefresherContent",
|
|
1344
|
+
"IonReorder",
|
|
1345
|
+
"IonReorderGroup",
|
|
1346
|
+
"IonRippleEffect",
|
|
1347
|
+
"IonRouterOutlet",
|
|
1348
|
+
"IonRow",
|
|
1349
|
+
"IonSearchbar",
|
|
1350
|
+
"IonSegment",
|
|
1351
|
+
"IonSegmentButton",
|
|
1352
|
+
"IonSegmentContent",
|
|
1353
|
+
"IonSegmentView",
|
|
1354
|
+
"IonSelect",
|
|
1355
|
+
"IonSelectModal",
|
|
1356
|
+
"IonSelectOption",
|
|
1357
|
+
"IonSkeletonText",
|
|
1358
|
+
"IonSpinner",
|
|
1359
|
+
"IonSplitPane",
|
|
1360
|
+
"IonTab",
|
|
1361
|
+
"IonTabBar",
|
|
1362
|
+
"IonTabButton",
|
|
1363
|
+
"IonTabs",
|
|
1364
|
+
"IonText",
|
|
1365
|
+
"IonTextarea",
|
|
1366
|
+
"IonThumbnail",
|
|
1367
|
+
"IonTitle",
|
|
1368
|
+
"IonToast",
|
|
1369
|
+
"IonToggle",
|
|
1370
|
+
"IonToolbar"
|
|
1371
|
+
];
|
|
1372
|
+
/**
|
|
1373
|
+
* Resolver for ionic framework
|
|
1374
|
+
*
|
|
1375
|
+
* @author @mathsgod @reslear
|
|
1376
|
+
* @link https://ionicframework.com/
|
|
1377
|
+
*/
|
|
1378
|
+
function IonicResolver() {
|
|
1379
|
+
return {
|
|
1380
|
+
type: "component",
|
|
1381
|
+
resolve: (name) => {
|
|
1382
|
+
if (IonicBuiltInComponents.includes(name)) return {
|
|
1383
|
+
name,
|
|
1384
|
+
from: "@ionic/vue"
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region src/core/resolvers/layui-vue.ts
|
|
1391
|
+
const matchComponents$1 = [
|
|
1392
|
+
{
|
|
1393
|
+
pattern: /^LayAvatarList$/,
|
|
1394
|
+
styleDir: "avatar"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
pattern: /^LayBreadcrumbItem$/,
|
|
1398
|
+
styleDir: "breadcrumb"
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
pattern: /^(LayCarouselItem)$/,
|
|
1402
|
+
styleDir: "carousel"
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
pattern: /^(LayCheckboxGroup)$/,
|
|
1406
|
+
styleDir: "checkbox"
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
pattern: /^LayCol$/,
|
|
1410
|
+
styleDir: "row"
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
pattern: /^(LayCollapseItem)$/,
|
|
1414
|
+
styleDir: "collapse"
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
pattern: /^LayConfigProvider$/,
|
|
1418
|
+
styleDir: void 0
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
pattern: /^LayCountUp$/,
|
|
1422
|
+
styleDir: void 0
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
pattern: /^(LayDropdownMenu|LayDropdownMenuItem|LayDropdownSubMenu)$/,
|
|
1426
|
+
styleDir: "dropdown"
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
pattern: /^(LayFormItem)$/,
|
|
1430
|
+
styleDir: "form"
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
pattern: /^(LayMenuItem|LaySubMenu)$/,
|
|
1434
|
+
styleDir: "menu"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
pattern: /^(LayRadioGroup)$/,
|
|
1438
|
+
styleDir: "radio"
|
|
1439
|
+
},
|
|
1440
|
+
{
|
|
1441
|
+
pattern: /^LaySelectOption$/,
|
|
1442
|
+
styleDir: "select"
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
pattern: /^LaySkeletonItem$/,
|
|
1446
|
+
styleDir: "skeleton"
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
pattern: /^LaySplitPanelItem$/,
|
|
1450
|
+
styleDir: "splitPanel"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
pattern: /^LayStepItem$/,
|
|
1454
|
+
styleDir: "step"
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
pattern: /^(LayTabItem)$/,
|
|
1458
|
+
styleDir: "tab"
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
pattern: /^LayTimelineItem$/,
|
|
1462
|
+
styleDir: "timeline"
|
|
1463
|
+
}
|
|
1464
|
+
];
|
|
1465
|
+
const layuiRE = /^Lay[A-Z]/;
|
|
1466
|
+
const layerRE = /^(?:layer|LayLayer)$/;
|
|
1467
|
+
const iconsRE = /^[A-Z]\w+Icon$/;
|
|
1468
|
+
let libName = "@layui/layui-vue";
|
|
1469
|
+
function lowerCamelCase(str) {
|
|
1470
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
1471
|
+
}
|
|
1472
|
+
function getSideEffects$3(importName, options) {
|
|
1473
|
+
const { importStyle = "css" } = options;
|
|
1474
|
+
if (!importStyle) return void 0;
|
|
1475
|
+
if (libName !== "@layui/layui-vue") return `${libName}/lib/index.css`;
|
|
1476
|
+
let styleDir = lowerCamelCase(importName.slice(3));
|
|
1477
|
+
for (const item of matchComponents$1) if (item.pattern.test(importName)) {
|
|
1478
|
+
styleDir = item.styleDir;
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
if (importStyle === "css" || importStyle) return styleDir ? [`@layui/layui-vue/es/${styleDir}/index.css`, "@layui/layui-vue/es/index/index.css"] : void 0;
|
|
1482
|
+
}
|
|
1483
|
+
function resolveComponent(importName, options) {
|
|
1484
|
+
let name;
|
|
1485
|
+
if (isExclude(importName, options.exclude)) return void 0;
|
|
1486
|
+
if (options.resolveIcons && iconsRE.test(importName)) {
|
|
1487
|
+
name = importName;
|
|
1488
|
+
libName = "@layui/icons-vue";
|
|
1489
|
+
} else if (layerRE.test(importName)) {
|
|
1490
|
+
name = importName;
|
|
1491
|
+
libName = "@layui/layer-vue";
|
|
1492
|
+
} else if (layuiRE.test(importName) && !iconsRE.test(importName)) {
|
|
1493
|
+
name = importName;
|
|
1494
|
+
libName = "@layui/layui-vue";
|
|
1495
|
+
}
|
|
1496
|
+
return name ? {
|
|
1497
|
+
name,
|
|
1498
|
+
from: libName,
|
|
1499
|
+
sideEffects: getSideEffects$3(name, options)
|
|
1500
|
+
} : void 0;
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Resolver for layui-vue
|
|
1504
|
+
*
|
|
1505
|
+
* @link http://www.layui-vue.com/ for layui-vue
|
|
1506
|
+
*
|
|
1507
|
+
*/
|
|
1508
|
+
function LayuiVueResolver(options = {}) {
|
|
1509
|
+
return {
|
|
1510
|
+
type: "component",
|
|
1511
|
+
resolve: (name) => {
|
|
1512
|
+
return resolveComponent(name, options);
|
|
1513
|
+
}
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region src/core/resolvers/naive-ui.ts
|
|
1518
|
+
/**
|
|
1519
|
+
* Resolver for Naive UI
|
|
1520
|
+
*
|
|
1521
|
+
* @author @antfu
|
|
1522
|
+
* @link https://www.naiveui.com/
|
|
1523
|
+
*/
|
|
1524
|
+
function NaiveUiResolver() {
|
|
1525
|
+
return {
|
|
1526
|
+
type: "component",
|
|
1527
|
+
resolve: (name) => {
|
|
1528
|
+
if (/^(?:N[A-Z]|n-[a-z])/.test(name)) return {
|
|
1529
|
+
name,
|
|
1530
|
+
from: "naive-ui"
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
//#endregion
|
|
1536
|
+
//#region src/core/resolvers/prime-vue.ts
|
|
1537
|
+
const components$2 = [
|
|
1538
|
+
"Accordion",
|
|
1539
|
+
"AccordionTab",
|
|
1540
|
+
"AutoComplete",
|
|
1541
|
+
"Avatar",
|
|
1542
|
+
"AvatarGroup",
|
|
1543
|
+
"Badge",
|
|
1544
|
+
"BlockUI",
|
|
1545
|
+
"Breadcrumb",
|
|
1546
|
+
"Button",
|
|
1547
|
+
"Calendar",
|
|
1548
|
+
"Card",
|
|
1549
|
+
"Carousel",
|
|
1550
|
+
"CascadeSelect",
|
|
1551
|
+
"Chart",
|
|
1552
|
+
"Checkbox",
|
|
1553
|
+
"Chip",
|
|
1554
|
+
"Chips",
|
|
1555
|
+
"ColorPicker",
|
|
1556
|
+
"Column",
|
|
1557
|
+
"ColumnGroup",
|
|
1558
|
+
"ContextMenu",
|
|
1559
|
+
"DataTable",
|
|
1560
|
+
"DataView",
|
|
1561
|
+
"DataViewLayoutOptions",
|
|
1562
|
+
"DeferredContent",
|
|
1563
|
+
"Dialog",
|
|
1564
|
+
"Divider",
|
|
1565
|
+
"Dock",
|
|
1566
|
+
"Dropdown",
|
|
1567
|
+
"Editor",
|
|
1568
|
+
"Fieldset",
|
|
1569
|
+
"FileUpload",
|
|
1570
|
+
"FloatLabel",
|
|
1571
|
+
"FullCalendar",
|
|
1572
|
+
"Galleria",
|
|
1573
|
+
"IconField",
|
|
1574
|
+
"IconField",
|
|
1575
|
+
"Image",
|
|
1576
|
+
"InlineMessage",
|
|
1577
|
+
"Inplace",
|
|
1578
|
+
"InputGroup",
|
|
1579
|
+
"InputGroupAddon",
|
|
1580
|
+
"InputIcon",
|
|
1581
|
+
"InputMask",
|
|
1582
|
+
"InputNumber",
|
|
1583
|
+
"InputOtp",
|
|
1584
|
+
"InputSwitch",
|
|
1585
|
+
"InputText",
|
|
1586
|
+
"Knob",
|
|
1587
|
+
"Listbox",
|
|
1588
|
+
"MegaMenu",
|
|
1589
|
+
"Menu",
|
|
1590
|
+
"Menubar",
|
|
1591
|
+
"Message",
|
|
1592
|
+
"MeterGroup",
|
|
1593
|
+
"MultiSelect",
|
|
1594
|
+
"OrderList",
|
|
1595
|
+
"OrganizationChart",
|
|
1596
|
+
"OverlayPanel",
|
|
1597
|
+
"Paginator",
|
|
1598
|
+
"Panel",
|
|
1599
|
+
"PanelMenu",
|
|
1600
|
+
"Password",
|
|
1601
|
+
"PickList",
|
|
1602
|
+
"ProgressBar",
|
|
1603
|
+
"ProgressSpinner",
|
|
1604
|
+
"RadioButton",
|
|
1605
|
+
"Rating",
|
|
1606
|
+
"Row",
|
|
1607
|
+
"ScrollPanel",
|
|
1608
|
+
"ScrollTop",
|
|
1609
|
+
"SelectButton",
|
|
1610
|
+
"Sidebar",
|
|
1611
|
+
"Skeleton",
|
|
1612
|
+
"Slider",
|
|
1613
|
+
"SpeedDial",
|
|
1614
|
+
"SplitButton",
|
|
1615
|
+
"Splitter",
|
|
1616
|
+
"SplitterPanel",
|
|
1617
|
+
"Stepper",
|
|
1618
|
+
"StepperPanel",
|
|
1619
|
+
"Steps",
|
|
1620
|
+
"TabMenu",
|
|
1621
|
+
"TabPanel",
|
|
1622
|
+
"TabView",
|
|
1623
|
+
"Tag",
|
|
1624
|
+
"Terminal",
|
|
1625
|
+
"TerminalService",
|
|
1626
|
+
"Textarea",
|
|
1627
|
+
"TieredMenu",
|
|
1628
|
+
"Timeline",
|
|
1629
|
+
"Timelist",
|
|
1630
|
+
"ToggleButton",
|
|
1631
|
+
"Toolbar",
|
|
1632
|
+
"Tree",
|
|
1633
|
+
"TreeSelect",
|
|
1634
|
+
"TreeTable",
|
|
1635
|
+
"TriStateCheckbox",
|
|
1636
|
+
"VirtualScroller"
|
|
1637
|
+
];
|
|
1638
|
+
/**
|
|
1639
|
+
* Resolver for PrimeVue - If you're using a component with the same tag as an native HTML element (e.g. button) the component must be in uppercase
|
|
1640
|
+
*
|
|
1641
|
+
* @link https://github.com/primefaces/primevue
|
|
1642
|
+
*/
|
|
1643
|
+
function PrimeVueResolver(options = {}) {
|
|
1644
|
+
return {
|
|
1645
|
+
type: "component",
|
|
1646
|
+
resolve: (name) => {
|
|
1647
|
+
const sideEffects = [];
|
|
1648
|
+
if (options.importStyle) sideEffects.push("primevue/resources/primevue.min.css");
|
|
1649
|
+
if (options.importIcons) sideEffects.push("primeicons/primeicons.css");
|
|
1650
|
+
if (options.importTheme) sideEffects.push(`primevue/resources/themes/${options.importTheme}/theme.css`);
|
|
1651
|
+
if (options.prefix) {
|
|
1652
|
+
if (!name.startsWith(options.prefix)) return;
|
|
1653
|
+
name = name.substring(options.prefix.length);
|
|
1654
|
+
}
|
|
1655
|
+
if (components$2.includes(name)) return {
|
|
1656
|
+
from: `primevue/${name.toLowerCase()}`,
|
|
1657
|
+
sideEffects
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
//#endregion
|
|
1663
|
+
//#region src/core/resolvers/quasar.ts
|
|
1664
|
+
/**
|
|
1665
|
+
* Resolver for Quasar
|
|
1666
|
+
*
|
|
1667
|
+
* @link https://github.com/quasarframework/quasar
|
|
1668
|
+
*/
|
|
1669
|
+
function QuasarResolver() {
|
|
1670
|
+
let components = [];
|
|
1671
|
+
return {
|
|
1672
|
+
type: "component",
|
|
1673
|
+
resolve: async (name) => {
|
|
1674
|
+
if (!components.length) {
|
|
1675
|
+
const quasarApiListPath = resolveModule("quasar/dist/transforms/api-list.json");
|
|
1676
|
+
if (quasarApiListPath) components = JSON.parse(await promises.readFile(quasarApiListPath, "utf-8"));
|
|
1677
|
+
}
|
|
1678
|
+
if (components.includes(name)) return {
|
|
1679
|
+
name,
|
|
1680
|
+
from: "quasar"
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
//#endregion
|
|
1686
|
+
//#region src/core/resolvers/tdesign.ts
|
|
1687
|
+
function TDesignResolver(options = {}) {
|
|
1688
|
+
const pluginList = [
|
|
1689
|
+
"DialogPlugin",
|
|
1690
|
+
"LoadingPlugin",
|
|
1691
|
+
"MessagePlugin",
|
|
1692
|
+
"NotifyPlugin"
|
|
1693
|
+
];
|
|
1694
|
+
return {
|
|
1695
|
+
type: "component",
|
|
1696
|
+
resolve: (name) => {
|
|
1697
|
+
const { library = "vue", exclude } = options;
|
|
1698
|
+
const importFrom = options.esm ? "/esm" : "";
|
|
1699
|
+
if (isExclude(name, exclude)) return;
|
|
1700
|
+
if (options.resolveIcons && /[a-z]Icon$/.test(name)) return {
|
|
1701
|
+
name,
|
|
1702
|
+
from: `tdesign-icons-${library}${importFrom}`
|
|
1703
|
+
};
|
|
1704
|
+
if (name.startsWith("TTypography") || name.startsWith("Typography")) return {
|
|
1705
|
+
name: name.slice(name.startsWith("TTypography") ? 11 : 10),
|
|
1706
|
+
from: `tdesign-${library}${importFrom}`
|
|
1707
|
+
};
|
|
1708
|
+
if (name.startsWith("TQrcode")) return {
|
|
1709
|
+
name: "QRCode",
|
|
1710
|
+
from: `tdesign-${library}${importFrom}`
|
|
1711
|
+
};
|
|
1712
|
+
if (/^T[A-Z]/.test(name) || pluginList.includes(name)) return {
|
|
1713
|
+
name: /^T[A-Z]/.test(name) ? name.slice(1) : name,
|
|
1714
|
+
from: `tdesign-${library}${importFrom}`
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
}
|
|
1719
|
+
//#endregion
|
|
1720
|
+
//#region src/core/resolvers/vant.ts
|
|
1721
|
+
const moduleType = isSSR ? "lib" : "es";
|
|
1722
|
+
function getSideEffects$2(dirName, options) {
|
|
1723
|
+
const { importStyle = true } = options;
|
|
1724
|
+
if (!importStyle || isSSR) return;
|
|
1725
|
+
if (importStyle === "less") return `vant/${moduleType}/${dirName}/style/less`;
|
|
1726
|
+
if (importStyle === "css") return `vant/${moduleType}/${dirName}/style/index`;
|
|
1727
|
+
return `vant/${moduleType}/${dirName}/style/index`;
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Resolver for Vant
|
|
1731
|
+
*
|
|
1732
|
+
* @link https://github.com/youzan/vant
|
|
1733
|
+
*/
|
|
1734
|
+
function VantResolver(options = {}) {
|
|
1735
|
+
return {
|
|
1736
|
+
type: "component",
|
|
1737
|
+
resolve: (name) => {
|
|
1738
|
+
if (name.startsWith("Van")) {
|
|
1739
|
+
const partialName = name.slice(3);
|
|
1740
|
+
return {
|
|
1741
|
+
name: partialName,
|
|
1742
|
+
from: `vant/${moduleType}`,
|
|
1743
|
+
sideEffects: getSideEffects$2(kebabCase(partialName), options)
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
//#endregion
|
|
1750
|
+
//#region src/core/resolvers/varlet-ui.ts
|
|
1751
|
+
const varFunctions = [
|
|
1752
|
+
"ImagePreview",
|
|
1753
|
+
"Snackbar",
|
|
1754
|
+
"Picker",
|
|
1755
|
+
"ActionSheet",
|
|
1756
|
+
"Dialog",
|
|
1757
|
+
"Locale",
|
|
1758
|
+
"StyleProvider",
|
|
1759
|
+
"LoadingBar"
|
|
1760
|
+
];
|
|
1761
|
+
const varDirectives = [
|
|
1762
|
+
"Ripple",
|
|
1763
|
+
"Lazy",
|
|
1764
|
+
"Hover"
|
|
1765
|
+
];
|
|
1766
|
+
function getResolved(name, options) {
|
|
1767
|
+
const { importStyle = "css", importCss = true, importLess, styleExtname = ".mjs", autoImport = false } = options;
|
|
1768
|
+
const path = "@varlet/ui";
|
|
1769
|
+
const sideEffects = [];
|
|
1770
|
+
if (importStyle || importCss) if (importStyle === "less" || importLess) sideEffects.push(`${path}/es/${kebabCase(name)}/style/less`);
|
|
1771
|
+
else sideEffects.push(`${path}/es/${kebabCase(name)}/style/index${styleExtname}`);
|
|
1772
|
+
return {
|
|
1773
|
+
from: path,
|
|
1774
|
+
name: autoImport ? name : `_${name}Component`,
|
|
1775
|
+
sideEffects
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Resolver for VarletUI
|
|
1780
|
+
*
|
|
1781
|
+
* @link https://github.com/varletjs/varlet
|
|
1782
|
+
*/
|
|
1783
|
+
function VarletUIResolver(options = {}) {
|
|
1784
|
+
return [{
|
|
1785
|
+
type: "component",
|
|
1786
|
+
resolve: (name) => {
|
|
1787
|
+
const { autoImport = false } = options;
|
|
1788
|
+
if (autoImport && varFunctions.includes(name)) return getResolved(name, options);
|
|
1789
|
+
if (name.startsWith("Var")) return getResolved(name.slice(3), options);
|
|
1790
|
+
}
|
|
1791
|
+
}, {
|
|
1792
|
+
type: "directive",
|
|
1793
|
+
resolve: (name) => {
|
|
1794
|
+
const { directives = true } = options;
|
|
1795
|
+
if (!directives) return;
|
|
1796
|
+
if (!varDirectives.includes(name)) return;
|
|
1797
|
+
return getResolved(name, options);
|
|
1798
|
+
}
|
|
1799
|
+
}];
|
|
1800
|
+
}
|
|
1801
|
+
//#endregion
|
|
1802
|
+
//#region src/core/resolvers/veui.ts
|
|
1803
|
+
const VEUI_PACKAGE_NAME = "veui";
|
|
1804
|
+
let components$1;
|
|
1805
|
+
/**
|
|
1806
|
+
* Resolver for VEUI
|
|
1807
|
+
*
|
|
1808
|
+
* @link https://github.com/ecomfe/veui
|
|
1809
|
+
*/
|
|
1810
|
+
function VeuiResolver(options = {}) {
|
|
1811
|
+
const { alias = VEUI_PACKAGE_NAME } = options;
|
|
1812
|
+
if (!components$1) try {
|
|
1813
|
+
const componentsData = __require(`${alias}/components.json`);
|
|
1814
|
+
components$1 = new Set(componentsData.map(({ name }) => name));
|
|
1815
|
+
} catch {
|
|
1816
|
+
throw new Error("[unplugin-vue-components:veui] VEUI is not installed");
|
|
1817
|
+
}
|
|
1818
|
+
return {
|
|
1819
|
+
type: "component",
|
|
1820
|
+
resolve: (name) => {
|
|
1821
|
+
if (/^Veui[A-Z]/.test(name)) {
|
|
1822
|
+
const componentName = name.slice(4);
|
|
1823
|
+
if (!components$1.has(componentName)) return;
|
|
1824
|
+
return {
|
|
1825
|
+
name: componentName,
|
|
1826
|
+
from: alias,
|
|
1827
|
+
sideEffects: getSideEffects$1(componentName, options)
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
const formatters = {
|
|
1834
|
+
"kebab-case": kebabCase,
|
|
1835
|
+
"camelCase": camelCase,
|
|
1836
|
+
"PascalCase": pascalCase
|
|
1837
|
+
};
|
|
1838
|
+
const peerPaths = /* @__PURE__ */ new Map();
|
|
1839
|
+
function assertPeerPath(peerPath) {
|
|
1840
|
+
if (!peerPaths.has(peerPath)) try {
|
|
1841
|
+
resolvePathSync(peerPath);
|
|
1842
|
+
peerPaths.set(peerPath, true);
|
|
1843
|
+
} catch {
|
|
1844
|
+
peerPaths.set(peerPath, false);
|
|
1845
|
+
}
|
|
1846
|
+
return peerPaths.get(peerPath);
|
|
1847
|
+
}
|
|
1848
|
+
function getSideEffects$1(name, { alias = VEUI_PACKAGE_NAME, modules = [], locale = "zh-Hans", global = [] }) {
|
|
1849
|
+
const localeModules = (locale ? Array.isArray(locale) ? locale : [locale] : []).map((locale) => `${alias}/locale/${locale}/${name}.js`);
|
|
1850
|
+
const peerModules = modules.map(({ package: pack, path = "components", fileName = "{module}.css", transform = "kebab-case" }) => {
|
|
1851
|
+
const peer = transform ? formatters[transform](name) : name;
|
|
1852
|
+
return normalize(join(pack, path, fileName.replace(/\$?\{module\}/g, peer)));
|
|
1853
|
+
});
|
|
1854
|
+
return [
|
|
1855
|
+
...localeModules,
|
|
1856
|
+
...global,
|
|
1857
|
+
...peerModules
|
|
1858
|
+
].filter(assertPeerPath);
|
|
1859
|
+
}
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region src/core/resolvers/view-ui.ts
|
|
1862
|
+
function getSideEffects(componentName) {
|
|
1863
|
+
const sideEffects = ["view-design/dist/styles/iview.css", "popper.js/dist/umd/popper.js"];
|
|
1864
|
+
if (/^Table|^Slider|^Tab/.test(componentName)) sideEffects.push("element-resize-detector");
|
|
1865
|
+
if (componentName.startsWith("Date")) sideEffects.push("js-calendar");
|
|
1866
|
+
return sideEffects;
|
|
1867
|
+
}
|
|
1868
|
+
const matchComponents = [{
|
|
1869
|
+
pattern: /^List/,
|
|
1870
|
+
compDir: "list"
|
|
1871
|
+
}];
|
|
1872
|
+
function getCompDir(compName) {
|
|
1873
|
+
let compPath;
|
|
1874
|
+
const total = matchComponents.length;
|
|
1875
|
+
for (let i = 0; i < total; i++) {
|
|
1876
|
+
const matcher = matchComponents[i];
|
|
1877
|
+
if (compName.match(matcher.pattern)) {
|
|
1878
|
+
compPath = `${matcher.compDir}/${kebabCase(compName)}.vue`;
|
|
1879
|
+
break;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
if (!compPath) compPath = kebabCase(compName);
|
|
1883
|
+
return compPath;
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Resolver for View UI
|
|
1887
|
+
* @requires @originjs/vite-plugin-commonjs
|
|
1888
|
+
* @author @nabaonan
|
|
1889
|
+
* @link https://www.iviewui.com/
|
|
1890
|
+
* @description has known problems list below
|
|
1891
|
+
* - select component render error PR: https://github.com/view-design/ViewUI/pull/944, choose can't display value,because click option trigger twice,at second time,select value turn into undefined.
|
|
1892
|
+
* - scroll component has a template syntax called lang='html',it is require html-loader,but vite plugin not support yet,remove it can run. relate pr: https://github.com/view-design/ViewUI/pull/985
|
|
1893
|
+
*/
|
|
1894
|
+
function ViewUiResolver() {
|
|
1895
|
+
return {
|
|
1896
|
+
type: "component",
|
|
1897
|
+
resolve: (name) => {
|
|
1898
|
+
if (/^I[A-Z]/.test(name)) {
|
|
1899
|
+
const compName = name.slice(1);
|
|
1900
|
+
return {
|
|
1901
|
+
from: `view-design/src/components/${getCompDir(compName)}`,
|
|
1902
|
+
sideEffects: getSideEffects(compName)
|
|
1903
|
+
};
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
//#endregion
|
|
1909
|
+
//#region src/core/resolvers/vuetify.ts
|
|
1910
|
+
/**
|
|
1911
|
+
* Resolver for Vuetify
|
|
1912
|
+
*
|
|
1913
|
+
* @link https://github.com/vuetifyjs/vuetify
|
|
1914
|
+
*/
|
|
1915
|
+
function VuetifyResolver() {
|
|
1916
|
+
return {
|
|
1917
|
+
type: "component",
|
|
1918
|
+
resolve: (name) => {
|
|
1919
|
+
if (/^V[A-Z]/.test(name)) return {
|
|
1920
|
+
name,
|
|
1921
|
+
from: "vuetify/lib"
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
/**
|
|
1927
|
+
* Resolver for Vuetify 3 Beta
|
|
1928
|
+
*
|
|
1929
|
+
* @link https://github.com/vuetifyjs/vuetify
|
|
1930
|
+
*/
|
|
1931
|
+
function Vuetify3Resolver() {
|
|
1932
|
+
return {
|
|
1933
|
+
type: "component",
|
|
1934
|
+
resolve: (name) => {
|
|
1935
|
+
if (/^V[A-Z]/.test(name)) return {
|
|
1936
|
+
name,
|
|
1937
|
+
from: "vuetify/components"
|
|
1938
|
+
};
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
}
|
|
1942
|
+
//#endregion
|
|
1943
|
+
//#region src/core/resolvers/vueuse.ts
|
|
1944
|
+
let components;
|
|
1945
|
+
/**
|
|
1946
|
+
* Resolver for VueUse
|
|
1947
|
+
*
|
|
1948
|
+
* @link https://github.com/vueuse/vueuse
|
|
1949
|
+
*/
|
|
1950
|
+
function VueUseComponentsResolver() {
|
|
1951
|
+
return {
|
|
1952
|
+
type: "component",
|
|
1953
|
+
resolve: (name) => {
|
|
1954
|
+
if (!components) {
|
|
1955
|
+
let indexesJson;
|
|
1956
|
+
try {
|
|
1957
|
+
const corePath = resolveModule("@vueuse/core") || process.cwd();
|
|
1958
|
+
const path = resolveModule("@vueuse/core/indexes.json") || resolveModule("@vueuse/metadata/index.json") || resolveModule("@vueuse/metadata/index.json", { paths: [corePath] });
|
|
1959
|
+
indexesJson = JSON.parse(readFileSync(path, "utf-8"));
|
|
1960
|
+
components = indexesJson.functions.filter((i) => i.component && i.name).map(({ name }) => name[0].toUpperCase() + name.slice(1));
|
|
1961
|
+
} catch (error) {
|
|
1962
|
+
console.error(error);
|
|
1963
|
+
throw new Error("[vue-components] failed to load @vueuse/core, have you installed it?");
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
if (components && components.includes(name)) return {
|
|
1967
|
+
name,
|
|
1968
|
+
as: name,
|
|
1969
|
+
from: "@vueuse/components"
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
//#endregion
|
|
1975
|
+
//#region src/core/resolvers/vueuse-directive.ts
|
|
1976
|
+
let directives;
|
|
1977
|
+
/**
|
|
1978
|
+
* Resolver for VueUse
|
|
1979
|
+
*
|
|
1980
|
+
* @link https://github.com/vueuse/vueuse
|
|
1981
|
+
*/
|
|
1982
|
+
function VueUseDirectiveResolver() {
|
|
1983
|
+
return {
|
|
1984
|
+
type: "directive",
|
|
1985
|
+
resolve: (name) => {
|
|
1986
|
+
if (!directives) {
|
|
1987
|
+
let indexesJson;
|
|
1988
|
+
try {
|
|
1989
|
+
const corePath = resolveModule("@vueuse/core") || process.cwd();
|
|
1990
|
+
const path = resolveModule("@vueuse/core/indexes.json") || resolveModule("@vueuse/metadata/index.json") || resolveModule("@vueuse/metadata/index.json", { paths: [corePath] });
|
|
1991
|
+
indexesJson = JSON.parse(readFileSync(path, "utf-8"));
|
|
1992
|
+
directives = indexesJson.functions.filter((i) => i.directive && i.name).map(({ name }) => name[0].toUpperCase() + name.slice(1)).map((name) => name.startsWith("Use") ? name.slice(3) : name);
|
|
1993
|
+
} catch (error) {
|
|
1994
|
+
console.error(error);
|
|
1995
|
+
throw new Error("[vue-components] failed to load @vueuse/core, have you installed it?");
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
if (directives && directives.includes(name)) return {
|
|
1999
|
+
name: `v${name}`,
|
|
2000
|
+
as: `v${name}`,
|
|
2001
|
+
from: "@vueuse/components"
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
//#endregion
|
|
2007
|
+
export { AntDesignVueResolver, ArcoResolver, BootstrapVue3Resolver, BootstrapVueNextResolver, BootstrapVueResolver, DevUiResolver, ElementPlusResolver, HeadlessUiResolver, IduxResolver, InklineResolver, IonicBuiltInComponents, IonicResolver, LayuiVueResolver, NaiveUiResolver, PrimeVueResolver, QuasarResolver, TDesignResolver, VantResolver, VarletUIResolver, VeuiResolver, ViewUiResolver, VueUseComponentsResolver, VueUseDirectiveResolver, Vuetify3Resolver, VuetifyResolver, getResolved };
|