unplugin-vue-components
Advanced tools
Comparing version 0.22.4 to 0.22.6
@@ -7,4 +7,4 @@ import * as esbuild from 'esbuild'; | ||
declare const _default: (options?: Options | undefined) => esbuild.Plugin; | ||
declare const _default: (options: Options) => esbuild.Plugin; | ||
export { _default as default }; |
@@ -39,2 +39,8 @@ import { ComponentResolver, ComponentResolveResult } from './types.js'; | ||
cjs?: boolean; | ||
/** | ||
* rename package | ||
* | ||
* @default 'ant-design-vue' | ||
*/ | ||
packageName?: string; | ||
} | ||
@@ -104,2 +110,6 @@ /** | ||
importStyle?: boolean | 'css' | 'sass'; | ||
/** | ||
* exclude component name, if match do not resolve the name | ||
*/ | ||
exclude?: RegExp; | ||
} | ||
@@ -146,2 +156,8 @@ /** | ||
importStyleTheme?: string; | ||
/** | ||
* The scope of the packages. | ||
* | ||
* @default '@idux' | ||
*/ | ||
scope?: string; | ||
} | ||
@@ -341,2 +357,9 @@ /** | ||
/** | ||
* Resolver for VueUse | ||
* | ||
* @link https://github.com/vueuse/vueuse | ||
*/ | ||
declare function VueUseDirectiveResolver(): ComponentResolver; | ||
/** | ||
* Resolver for Quasar | ||
@@ -466,2 +489,2 @@ * | ||
export { AntDesignVueResolver, AntDesignVueResolverOptions, ArcoResolver, ArcoResolverOptions, BootstrapVueResolver, BootstrapVueResolverOptions, DevResolverOptions, DevUiResolver, ElementPlusResolver, ElementPlusResolverOptions, ElementUiResolver, ElementUiResolverOptions, HeadlessUiResolver, HeadlessUiResolverOptions, IduxResolver, IduxResolverOptions, InklineResolver, LayuiVueResolver, LayuiVueResolverOptions, NaiveUiResolver, PrimeVueResolver, PrimeVueResolverOptions, QuasarResolver, TDesignResolver, TDesignResolverOptions, VantResolver, VantResolverOptions, VarletUIResolver, VarletUIResolverOptions, VeuiResolver, VeuiResolverOptions, ViewUiResolver, VueUseComponentsResolver, Vuetify3Resolver, VuetifyResolver, getResolved }; | ||
export { AntDesignVueResolver, AntDesignVueResolverOptions, ArcoResolver, ArcoResolverOptions, BootstrapVueResolver, BootstrapVueResolverOptions, DevResolverOptions, DevUiResolver, ElementPlusResolver, ElementPlusResolverOptions, ElementUiResolver, ElementUiResolverOptions, HeadlessUiResolver, HeadlessUiResolverOptions, IduxResolver, IduxResolverOptions, InklineResolver, LayuiVueResolver, LayuiVueResolverOptions, NaiveUiResolver, PrimeVueResolver, PrimeVueResolverOptions, QuasarResolver, TDesignResolver, TDesignResolverOptions, VantResolver, VantResolverOptions, VarletUIResolver, VarletUIResolverOptions, VeuiResolver, VeuiResolverOptions, ViewUiResolver, VueUseComponentsResolver, VueUseDirectiveResolver, Vuetify3Resolver, VuetifyResolver, getResolved }; |
@@ -178,8 +178,9 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } | ||
const lib = options.cjs ? "lib" : "es"; | ||
const packageName = (options == null ? void 0 : options.packageName) || "ant-design-vue"; | ||
if (importStyle === "less" || importLess) { | ||
const styleDir = getStyleDir(compName); | ||
return `ant-design-vue/${lib}/${styleDir}/style`; | ||
return `${packageName}/${lib}/${styleDir}/style`; | ||
} else { | ||
const styleDir = getStyleDir(compName); | ||
return `ant-design-vue/${lib}/${styleDir}/style/css`; | ||
return `${packageName}/${lib}/${styleDir}/style/css`; | ||
} | ||
@@ -210,4 +211,4 @@ } | ||
const importName = name.slice(1); | ||
const { cjs = false } = options; | ||
const path = `ant-design-vue/${cjs ? "lib" : "es"}`; | ||
const { cjs = false, packageName = "ant-design-vue" } = options; | ||
const path = `${packageName}/${cjs ? "lib" : "es"}`; | ||
return { | ||
@@ -223,4 +224,4 @@ name: importName, | ||
// node_modules/.pnpm/compare-versions@4.1.3/node_modules/compare-versions/index.mjs | ||
function compareVersions(v1, v2) { | ||
// node_modules/.pnpm/compare-versions@5.0.1/node_modules/compare-versions/lib/esm/index.js | ||
var compareVersions = (v1, v2) => { | ||
const n1 = validateAndParse(v1); | ||
@@ -239,4 +240,3 @@ const n2 = validateAndParse(v2); | ||
return 0; | ||
} | ||
var validate = (v) => typeof v === "string" && /^[v\d]/.test(v) && semver.test(v); | ||
}; | ||
var compare = (v1, v2, operator) => { | ||
@@ -247,29 +247,10 @@ assertValidOperator(operator); | ||
}; | ||
var satisfies = (v, r) => { | ||
const m = r.match(/^([<>=~^]+)/); | ||
const op = m ? m[1] : "="; | ||
if (op !== "^" && op !== "~") | ||
return compare(v, r, op); | ||
const [v1, v2, v3] = validateAndParse(v); | ||
const [r1, r2, r3] = validateAndParse(r); | ||
if (compareStrings(v1, r1) !== 0) | ||
return false; | ||
if (op === "^") { | ||
return compareSegments([v2, v3], [r2, r3]) >= 0; | ||
} | ||
if (compareStrings(v2, r2) !== 0) | ||
return false; | ||
return compareStrings(v3, r3) >= 0; | ||
}; | ||
compareVersions.validate = validate; | ||
compareVersions.compare = compare; | ||
compareVersions.sastisfies = satisfies; | ||
var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i; | ||
var validateAndParse = (v) => { | ||
if (typeof v !== "string") { | ||
var validateAndParse = (version) => { | ||
if (typeof version !== "string") { | ||
throw new TypeError("Invalid argument expected string"); | ||
} | ||
const match = v.match(semver); | ||
const match = version.match(semver); | ||
if (!match) { | ||
throw new Error(`Invalid argument not valid semver ('${v}' received)`); | ||
throw new Error(`Invalid argument not valid semver ('${version}' received)`); | ||
} | ||
@@ -297,3 +278,3 @@ match.shift(); | ||
for (let i = 0; i < Math.max(a.length, b.length); i++) { | ||
const r = compareStrings(a[i] || 0, b[i] || 0); | ||
const r = compareStrings(a[i] || "0", b[i] || "0"); | ||
if (r !== 0) | ||
@@ -314,10 +295,6 @@ return r; | ||
if (typeof op !== "string") { | ||
throw new TypeError( | ||
`Invalid operator type, expected string but got ${typeof op}` | ||
); | ||
throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`); | ||
} | ||
if (allowedOperators.indexOf(op) === -1) { | ||
throw new Error( | ||
`Invalid operator, expected one of ${allowedOperators.join("|")}` | ||
); | ||
throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`); | ||
} | ||
@@ -365,3 +342,3 @@ }; | ||
const { version, ssr } = options; | ||
if (compareVersions.compare(version, "1.1.0-beta.1", ">=")) { | ||
if (compare(version, "1.1.0-beta.1", ">=")) { | ||
return { | ||
@@ -372,3 +349,3 @@ name, | ||
}; | ||
} else if (compareVersions.compare(version, "1.0.2-beta.28", ">=")) { | ||
} else if (compare(version, "1.0.2-beta.28", ">=")) { | ||
return { | ||
@@ -388,3 +365,3 @@ from: `element-plus/es/el-${partialName}`, | ||
return; | ||
const directives = { | ||
const directives2 = { | ||
Loading: { importName: "ElLoadingDirective", styleName: "loading" }, | ||
@@ -394,7 +371,7 @@ Popover: { importName: "ElPopoverDirective", styleName: "popover" }, | ||
}; | ||
const directive = directives[name]; | ||
const directive = directives2[name]; | ||
if (!directive) | ||
return; | ||
const { version, ssr } = options; | ||
if (compareVersions.compare(version, "1.1.0-beta.1", ">=")) { | ||
if (compare(version, "1.1.0-beta.1", ">=")) { | ||
return { | ||
@@ -465,2 +442,4 @@ name: directive.importName, | ||
resolve: (name) => { | ||
if (options.exclude && name.match(options.exclude)) | ||
return; | ||
if (/^El[A-Z]/.test(name)) { | ||
@@ -569,3 +548,3 @@ const compName = name.slice(2); | ||
resolve: (name) => { | ||
const { importStyle, importStyleTheme = "default", exclude = [] } = options; | ||
const { importStyle, importStyleTheme = "default", exclude = [], scope = "@idux" } = options; | ||
if (exclude.includes(name)) | ||
@@ -581,3 +560,3 @@ return; | ||
} | ||
const path = `@idux/${packageName}/${dirname}`; | ||
const path = `${scope}/${packageName}/${dirname}`; | ||
let sideEffects; | ||
@@ -810,4 +789,4 @@ if (packageName !== "cdk" && importStyle) | ||
resolve: (name) => { | ||
const { directives = true } = options; | ||
if (!directives) | ||
const { directives: directives2 = true } = options; | ||
if (!directives2) | ||
return; | ||
@@ -896,3 +875,3 @@ if (!varDirectives.includes(name)) | ||
sideEffects.push("element-resize-detector"); | ||
if (/^Date/.test(componentName)) | ||
if (componentName.startsWith("Date")) | ||
sideEffects.push("js-calendar"); | ||
@@ -982,2 +961,28 @@ return sideEffects; | ||
// src/core/resolvers/vueuse-directive.ts | ||
var directives; | ||
function VueUseDirectiveResolver() { | ||
return { | ||
type: "directive", | ||
resolve: (name) => { | ||
if (!directives) { | ||
let indexesJson; | ||
try { | ||
const corePath = _localpkg.resolveModule.call(void 0, "@vueuse/core") || process.cwd(); | ||
const path = _localpkg.resolveModule.call(void 0, "@vueuse/core/indexes.json") || _localpkg.resolveModule.call(void 0, "@vueuse/metadata/index.json") || _localpkg.resolveModule.call(void 0, "@vueuse/metadata/index.json", { paths: [corePath] }); | ||
indexesJson = JSON.parse(_fs.readFileSync.call(void 0, path, "utf-8")); | ||
directives = indexesJson.functions.filter((i) => i.directive && i.name).map(({ name: name2 }) => name2[0].toUpperCase() + name2.slice(1)); | ||
} catch (error) { | ||
console.error(error); | ||
throw new Error("[vue-components] failed to load @vueuse/core, have you installed it?"); | ||
} | ||
} | ||
if (directives && directives.includes(name)) | ||
return { name: `v${name}`, as: name, from: "@vueuse/components" }; | ||
} | ||
}; | ||
} | ||
// src/core/resolvers/quasar.ts | ||
@@ -1223,3 +1228,3 @@ | ||
const prefix2 = fileName.slice(0, fileName.indexOf("-")); | ||
const container = ["anchor", "avatar", "breadcrumb", "checkbox", "dropdown", "form", "input", "list", "menu", "radio", "slider", "swiper", "color-picker", "text", "collapse"]; | ||
const container = ["anchor", "avatar", "breadcrumb", "checkbox", "dropdown", "form", "input", "list", "menu", "radio", "slider", "swiper", "color-picker", "text", "collapse", "timeline"]; | ||
if (container.includes(prefix2)) | ||
@@ -1244,6 +1249,10 @@ fileName = prefix2; | ||
fileName = "tag"; | ||
if (["time-range-picker", "time-range-picker-panel"].includes(fileName)) | ||
if (["time-range-picker", "time-range-picker-panel", "time-picker-panel"].includes(fileName)) | ||
fileName = "time-picker"; | ||
if (["date-range-picker", "date-range-picker-panel"].includes(fileName)) | ||
if (["date-range-picker", "date-range-picker-panel", "date-picker-panel"].includes(fileName)) | ||
fileName = "date-picker"; | ||
if (["color-picker", "color-picker-panel"].includes(fileName)) | ||
fileName = "color-picker"; | ||
if (["enhanced-table", "base-table"].includes(fileName)) | ||
fileName = "table"; | ||
if (importStyle === "less") | ||
@@ -1430,3 +1439,3 @@ return `tdesign-${library}/esm/${fileName}/style`; | ||
BFile: "BFormFile", | ||
BFormDatepicker: "BDatepicker", | ||
BDatepicker: "BFormDatepicker", | ||
BInput: "BFormInput", | ||
@@ -1500,3 +1509,4 @@ BNavDd: "BNavItemDropdown", | ||
exports.AntDesignVueResolver = AntDesignVueResolver; exports.ArcoResolver = ArcoResolver; exports.BootstrapVueResolver = BootstrapVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.InklineResolver = InklineResolver; exports.LayuiVueResolver = LayuiVueResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.TDesignResolver = TDesignResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.Vuetify3Resolver = Vuetify3Resolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved; | ||
exports.AntDesignVueResolver = AntDesignVueResolver; exports.ArcoResolver = ArcoResolver; exports.BootstrapVueResolver = BootstrapVueResolver; exports.DevUiResolver = DevUiResolver; exports.ElementPlusResolver = ElementPlusResolver; exports.ElementUiResolver = ElementUiResolver; exports.HeadlessUiResolver = HeadlessUiResolver; exports.IduxResolver = IduxResolver; exports.InklineResolver = InklineResolver; exports.LayuiVueResolver = LayuiVueResolver; exports.NaiveUiResolver = NaiveUiResolver; exports.PrimeVueResolver = PrimeVueResolver; exports.QuasarResolver = QuasarResolver; exports.TDesignResolver = TDesignResolver; exports.VantResolver = VantResolver; exports.VarletUIResolver = VarletUIResolver; exports.VeuiResolver = VeuiResolver; exports.ViewUiResolver = ViewUiResolver; exports.VueUseComponentsResolver = VueUseComponentsResolver; exports.VueUseDirectiveResolver = VueUseDirectiveResolver; exports.Vuetify3Resolver = Vuetify3Resolver; exports.VuetifyResolver = VuetifyResolver; exports.getResolved = getResolved; | ||
exports.default = module.exports; |
@@ -6,4 +6,4 @@ import * as unplugin from 'unplugin'; | ||
declare const _default: (options?: Options | undefined) => unplugin.RollupPlugin; | ||
declare const _default: (options: Options) => unplugin.RollupPlugin; | ||
export { _default as default }; |
@@ -7,4 +7,4 @@ import * as webpack from 'webpack'; | ||
declare const _default: (options?: Options | undefined) => webpack.WebpackPluginInstance; | ||
declare const _default: (options: Options) => webpack.WebpackPluginInstance; | ||
export { _default as default }; |
{ | ||
"name": "unplugin-vue-components", | ||
"version": "0.22.4", | ||
"version": "0.22.6", | ||
"packageManager": "pnpm@7.1.5", | ||
@@ -91,32 +91,32 @@ "description": "Components auto importing for Vue", | ||
"debug": "^4.3.4", | ||
"fast-glob": "^3.2.11", | ||
"fast-glob": "^3.2.12", | ||
"local-pkg": "^0.4.2", | ||
"magic-string": "^0.26.2", | ||
"magic-string": "^0.26.3", | ||
"minimatch": "^5.1.0", | ||
"resolve": "^1.22.1", | ||
"unplugin": "^0.9.0" | ||
"unplugin": "^0.9.5" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "^0.25.2", | ||
"@babel/parser": "^7.18.11", | ||
"@babel/types": "^7.18.10", | ||
"@antfu/eslint-config": "^0.26.3", | ||
"@babel/parser": "^7.19.0", | ||
"@babel/types": "^7.19.0", | ||
"@types/debug": "^4.1.7", | ||
"@types/minimatch": "^3.0.5", | ||
"@types/node": "^18.6.4", | ||
"@types/minimatch": "^5.1.2", | ||
"@types/node": "^18.7.16", | ||
"@types/resolve": "^1.20.2", | ||
"@typescript-eslint/eslint-plugin": "^5.32.0", | ||
"@typescript-eslint/eslint-plugin": "^5.36.2", | ||
"bumpp": "^8.2.1", | ||
"compare-versions": "^4.1.3", | ||
"element-plus": "^2.2.12", | ||
"eslint": "^8.21.0", | ||
"compare-versions": "^5.0.1", | ||
"element-plus": "^2.2.16", | ||
"eslint": "^8.23.0", | ||
"esno": "^0.16.3", | ||
"estree-walker": "^3.0.1", | ||
"pathe": "^0.3.3", | ||
"rollup": "^2.77.2", | ||
"tsup": "^6.2.1", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.4", | ||
"vitest": "^0.21.0", | ||
"pathe": "^0.3.7", | ||
"rollup": "^2.79.0", | ||
"tsup": "^6.2.3", | ||
"typescript": "^4.8.3", | ||
"vite": "^3.1.0", | ||
"vitest": "^0.23.2", | ||
"vue": "3.2.37" | ||
} | ||
} |
@@ -205,2 +205,3 @@ # unplugin-vue-components | ||
- [VueUse Components](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/vueuse.ts) | ||
- [VueUse Directives](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/vueuse-directive.ts) | ||
- [Dev UI](https://github.com/antfu/unplugin-vue-components/blob/main/src/core/resolvers/devui.ts) | ||
@@ -207,0 +208,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191554
5832
371
23
Updatedfast-glob@^3.2.12
Updatedmagic-string@^0.26.3
Updatedunplugin@^0.9.5