resolvers.js 45 KB

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