Socket
Socket
Sign inDemoInstall

unplugin-vue-components

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-vue-components - npm Package Compare versions

Comparing version 0.15.6 to 0.16.0

dist/chunk-6FGVCWLF.js

2

dist/index.d.ts
import { Options } from './types';
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentsImportMap, ImportInfo, Matcher, Options, ResolvedOptions, SideEffectsInfo, Transformer, UILibraryOptions } from './types';
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentsImportMap, ImportInfo, Matcher, Options, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, UILibraryOptions } from './types';
import * as unplugin from 'unplugin';

@@ -4,0 +4,0 @@ import '@rollup/pluginutils';

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkAS4ILSIYjs = require('./chunk-AS4ILSIY.js');
var _chunk6FGVCWLFjs = require('./chunk-6FGVCWLF.js');

@@ -16,2 +16,2 @@

exports.camelCase = _chunkYBT6MD7Sjs.camelCase; exports.default = _chunkAS4ILSIYjs.unplugin_default; exports.kebabCase = _chunkYBT6MD7Sjs.kebabCase; exports.pascalCase = _chunkYBT6MD7Sjs.pascalCase;
exports.camelCase = _chunkYBT6MD7Sjs.camelCase; exports.default = _chunk6FGVCWLFjs.unplugin_default; exports.kebabCase = _chunkYBT6MD7Sjs.kebabCase; exports.pascalCase = _chunkYBT6MD7Sjs.pascalCase;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkAS4ILSIYjs = require('./chunk-AS4ILSIY.js');
var _chunk6FGVCWLFjs = require('./chunk-6FGVCWLF.js');
require('./chunk-YBT6MD7S.js');

@@ -15,7 +15,7 @@ require('./chunk-LKFHSEPW.js');

config.plugins = config.plugins || [];
config.plugins.unshift(_chunkAS4ILSIYjs.unplugin_default.webpack(options));
config.plugins.unshift(_chunk6FGVCWLFjs.unplugin_default.webpack(options));
});
this.nuxt.hook("vite:extend", async (vite) => {
vite.config.plugins = vite.config.plugins || [];
vite.config.plugins.push(_chunkAS4ILSIYjs.unplugin_default.vite(options));
vite.config.plugins.push(_chunk6FGVCWLFjs.unplugin_default.vite(options));
});

@@ -22,0 +22,0 @@ }

@@ -56,2 +56,6 @@ import { ComponentResolver, UILibraryOptions } from './types';

/**
* use commonjs lib & source css or scss for ssr
*/
ssr?: boolean;
/**
* specify element-plus version to load style

@@ -62,2 +66,8 @@ *

version?: string;
/**
* auto import for directives
*
* @default true
*/
directives?: boolean;
}

@@ -70,4 +80,4 @@ /**

*
* @author @develar @nabaonan
* @link https://element-plus.org/#/en-US for element-plus
* @author @develar @nabaonan @sxzz
* @link https://element-plus.org/ for element-plus
*

@@ -74,0 +84,0 @@ */

@@ -15,2 +15,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunk7T67WII5js = require('./chunk-7T67WII5.js');

@@ -316,3 +317,3 @@

function getSideEffectsLegacy(partialName, options) {
const { importStyle = "css" } = options;
const { importStyle } = options;
if (!importStyle)

@@ -333,32 +334,66 @@ return;

function getSideEffects2(dirName, options) {
const { importStyle = "css" } = options;
const { importStyle, ssr } = options;
const themeFolder = "element-plus/theme-chalk";
const esComponentsFolder = "element-plus/es/components";
if (importStyle === "sass")
return `element-plus/es/components/${dirName}/style`;
return ssr ? `${themeFolder}/src/${dirName}.scss` : `${esComponentsFolder}/${dirName}/style/index`;
else if (importStyle === true || importStyle === "css")
return `element-plus/es/components/${dirName}/style/css`;
return ssr ? `${themeFolder}/el-${dirName}.css` : `${esComponentsFolder}/${dirName}/style/css`;
}
function resolveComponent(name, options) {
if (!name.match(/^El[A-Z]/))
return;
const partialName = _chunkYBT6MD7Sjs.kebabCase.call(void 0, name.slice(2));
const { version, ssr } = options;
if (import_compare_versions.default.compare(version, "1.1.0-beta.1", ">=")) {
return {
importName: name,
path: `element-plus/${ssr ? "lib" : "es"}`,
sideEffects: getSideEffects2(partialName, options)
};
} else if (import_compare_versions.default.compare(version, "1.0.2-beta.28", ">=")) {
return {
path: `element-plus/es/el-${partialName}`,
sideEffects: getSideEffectsLegacy(partialName, options)
};
} else {
return {
path: `element-plus/lib/el-${partialName}`,
sideEffects: getSideEffectsLegacy(partialName, options)
};
}
}
function resolveDirective(name, options) {
if (!options.directives)
return;
const directives = {
Loading: { importName: "ElLoadingDirective", styleName: "loading" },
Popover: { importName: "ElPopoverDirective", styleName: "popover" },
InfiniteScroll: { importName: "ElInfiniteScroll", styleName: "infinite-scroll" }
};
const directive = directives[name];
if (!directive)
return;
const { version, ssr } = options;
if (import_compare_versions.default.compare(version, "1.1.0-beta.1", ">=")) {
return {
importName: directive.importName,
path: `element-plus/${ssr ? "lib" : "es"}`,
sideEffects: getSideEffects2(directive.styleName, options)
};
}
}
function ElementPlusResolver(options = {}) {
return (name) => {
if (name.match(/^El[A-Z]/)) {
const {
version = _chunkYBT6MD7Sjs.getPkgVersion.call(void 0, "element-plus", "1.0.2")
} = options;
const partialName = _chunkYBT6MD7Sjs.kebabCase.call(void 0, name.slice(2));
if (import_compare_versions.default.compare(version, "1.1.0-beta.1", ">=")) {
return {
importName: name,
path: "element-plus/es",
sideEffects: getSideEffects2(partialName, options)
};
} else if (import_compare_versions.default.compare(version, "1.0.2-beta.28", ">=")) {
return {
path: `element-plus/es/el-${partialName}`,
sideEffects: getSideEffectsLegacy(partialName, options)
};
} else {
return {
path: `element-plus/lib/el-${partialName}`,
sideEffects: getSideEffectsLegacy(partialName, options)
};
}
const optionsResolved = _chunk7T67WII5js.__spreadValues.call(void 0, {
ssr: false,
version: _chunkYBT6MD7Sjs.getPkgVersion.call(void 0, "element-plus", "1.1.0-beta.21"),
importStyle: "css",
directives: true
}, options);
return (name, type) => {
switch (type) {
case "component":
return resolveComponent(name, optionsResolved);
case "directive":
return resolveDirective(name, optionsResolved);
}

@@ -391,2 +426,7 @@ };

const partialName = _chunkYBT6MD7Sjs.kebabCase.call(void 0, compName);
if (partialName === "collapse-transition") {
return {
path: `element-ui/lib/transitions/${partialName}`
};
}
return {

@@ -798,5 +838,4 @@ path: `element-ui/lib/${partialName}`,

}
if (components5.includes(name)) {
if (components5.includes(name))
return { importName: name, path: "quasar" };
}
};

@@ -803,0 +842,0 @@ }

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkAS4ILSIYjs = require('./chunk-AS4ILSIY.js');
var _chunk6FGVCWLFjs = require('./chunk-6FGVCWLF.js');
require('./chunk-YBT6MD7S.js');

@@ -12,3 +12,3 @@ require('./chunk-LKFHSEPW.js');

_chunk7T67WII5js.init_cjs_shims.call(void 0, );
var rollup_default = _chunkAS4ILSIYjs.unplugin_default.rollup;
var rollup_default = _chunk6FGVCWLFjs.unplugin_default.rollup;

@@ -15,0 +15,0 @@

@@ -15,3 +15,3 @@ import { FilterPattern } from '@rollup/pluginutils';

declare type ComponentResolveResult = Awaitable<string | ComponentInfo | null | undefined | void>;
declare type ComponentResolver = (name: string) => ComponentResolveResult;
declare type ComponentResolver = (name: string, type: 'component' | 'directive') => ComponentResolveResult;
interface UILibraryOptions {

@@ -24,2 +24,3 @@ name: string;

declare type Transformer = (code: string, id: string, path: string, query: Record<string, string>) => Awaitable<TransformResult | null>;
declare type SupportedTransformer = 'vue3' | 'vue2';
/**

@@ -88,3 +89,3 @@ * Plugin options.

*/
transformer?: 'vue3' | 'vue2';
transformer?: SupportedTransformer;
/**

@@ -106,2 +107,11 @@ * Generate TypeScript declaration for global components

allowOverrides?: boolean;
/**
* auto import for directives.
*
* default: `true` for Vue 3, `false` for Vue 2
*
* Babel is needed to do the transformation for Vue 2, it's disabled by default for performance concerns.
* @default undefined
*/
directives?: boolean;
}

@@ -120,2 +130,2 @@ declare type ResolvedOptions = Omit<Required<Options>, 'resolvers' | 'libraries' | 'extensions' | 'dirs' | 'globalComponentsDeclaration'> & {

export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentsImportMap, ImportInfo, Matcher, Options, ResolvedOptions, SideEffectsInfo, Transformer, UILibraryOptions };
export { ComponentInfo, ComponentResolveResult, ComponentResolver, ComponentsImportMap, ImportInfo, Matcher, Options, ResolvedOptions, SideEffectsInfo, SupportedTransformer, Transformer, UILibraryOptions };
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkAS4ILSIYjs = require('./chunk-AS4ILSIY.js');
var _chunk6FGVCWLFjs = require('./chunk-6FGVCWLF.js');
require('./chunk-YBT6MD7S.js');

@@ -12,3 +12,3 @@ require('./chunk-LKFHSEPW.js');

_chunk7T67WII5js.init_cjs_shims.call(void 0, );
var vite_default = _chunkAS4ILSIYjs.unplugin_default.vite;
var vite_default = _chunk6FGVCWLFjs.unplugin_default.vite;

@@ -15,0 +15,0 @@

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkAS4ILSIYjs = require('./chunk-AS4ILSIY.js');
var _chunk6FGVCWLFjs = require('./chunk-6FGVCWLF.js');
require('./chunk-YBT6MD7S.js');

@@ -12,3 +12,3 @@ require('./chunk-LKFHSEPW.js');

_chunk7T67WII5js.init_cjs_shims.call(void 0, );
var webpack_default = _chunkAS4ILSIYjs.unplugin_default.webpack;
var webpack_default = _chunk6FGVCWLFjs.unplugin_default.webpack;

@@ -15,0 +15,0 @@

{
"name": "unplugin-vue-components",
"version": "0.15.6",
"version": "0.16.0",
"description": "Components auto importing for Vue",
"homepage": "https://github.com/antfu/unplugin-vue-components",
"bugs": "https://github.com/antfu/unplugin-vue-components/issues",
"license": "MIT",
"repository": {

@@ -12,4 +13,7 @@ "type": "git",

"funding": "https://github.com/sponsors/antfu",
"license": "MIT",
"author": "antfu <anthonyfu117@hotmail.com>",
"files": [
"dist",
"*.d.ts"
],
"exports": {

@@ -49,11 +53,7 @@ ".": {

"types": "index.d.ts",
"files": [
"dist",
"*.d.ts"
],
"scripts": {
"build": "rimraf dist && tsup src/*.ts --format cjs,esm --dts --splitting && esno scripts/postbuild.ts",
"dev": "tsup src/*.ts --format cjs,esm --watch src",
"example:build": "npm -C examples/vue3 run build",
"example:dev": "npm -C examples/vue3 run dev",
"build": "tsup src/*.ts && esno scripts/postbuild.ts",
"dev": "tsup src/*.ts --watch src",
"example:build": "npm -C examples/vite-vue3 run build",
"example:dev": "npm -C examples/vite-vue3 run dev",
"prepublishOnly": "npm run build",

@@ -64,2 +64,5 @@ "release": "npx bumpp --commit --tag --push",

},
"peerDependencies": {
"vue": "2 || 3"
},
"dependencies": {

@@ -79,2 +82,5 @@ "@antfu/utils": "^0.3.0",

"@antfu/eslint-config": "^0.9.0",
"@babel/parser": "^7.15.8",
"@babel/traverse": "^7.15.4",
"@babel/types": "^7.15.6",
"@types/debug": "^4.1.7",

@@ -97,5 +103,2 @@ "@types/jest": "^27.0.2",

},
"peerDependencies": {
"vue": "2 || 3"
},
"engines": {

@@ -102,0 +105,0 @@ "node": ">=14"

@@ -10,2 +10,3 @@ # unplugin-vue-components

- 💚 Supports both Vue 2 and Vue 3 out-of-the-box.
- ✨ Supports both components and directives.
- ⚡️ Supports Vite, Webpack, Vue CLI, Rollup and more, powered by <a href="https://github.com/unjs/unplugin">unplugin</a>.

@@ -288,2 +289,7 @@ - 🏝 Tree-shakable, only registers the components you use.

// auto import for directives
// default: `true` for Vue 3, `false` for Vue 2
// Babel is needed to do the transformation for Vue 2, it's disabled by default for performance concerns.
directives: true,
// filters for transforming targets

@@ -290,0 +296,0 @@ include: [/\.vue$/, /\.vue\?vue/],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc