resolvers.mjs 40 KB

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