UNPKG

yuang-framework-ui-pc

Version:

yuang-framework-ui-pc Library

51 lines (50 loc) 1.65 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); function getSideEffects(path, options) { const importStyle = options == null ? void 0 : options.importStyle; if (!importStyle) { return; } if (importStyle === "css") { return `${path}/style/css`; } return `${path}/style/index`; } function getStylePath(namePath, packageName, path) { if (!path) { return `${packageName}/es/${namePath}`; } if (path === "/es/core") { return `${packageName}/es/${namePath}`; } if (path === "/lib/core") { return `${packageName}/lib/${namePath}`; } return `${packageName}${path}/${namePath}`; } function EleAdminResolver(options) { return { type: "component", resolve: (name) => { var _a; const { path, exclude } = options || {}; if ((name.match(/^Ele[A-Z]/) || name.match(/^Yu[A-Z]/)) && !((_a = exclude == null ? void 0 : exclude.includes) == null ? void 0 : _a.call(exclude, name))) { const packageName = "yuang-framework-ui-pc"; const namePath = name.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase(); const stylePath = getStylePath(namePath, packageName, path); if (!path || path === "/es/core" || path === "/lib/core") { return { name, from: `${packageName}${path ?? "/es"}`, sideEffects: getSideEffects(stylePath, options) }; } return { from: `${packageName}${path}/${namePath}/index`, sideEffects: getSideEffects(stylePath, options) }; } } }; } exports.EleAdminResolver = EleAdminResolver;