Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-components

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-components - npm Package Compare versions

Comparing version 0.11.5 to 0.12.0

70

dist/index.js

@@ -56,3 +56,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __create = Object.create;

}
function toArray2(array) {
function toArray3(array) {
array = array || [];

@@ -64,6 +64,6 @@ if (Array.isArray(array))

function flattenArrayable(array) {
return toArray2(array).flat(1);
return toArray3(array).flat(1);
}
function mergeArrayable(...args) {
return args.flatMap((i) => toArray2(i));
return args.flatMap((i) => toArray3(i));
}

@@ -151,3 +151,3 @@ function partition(array, filter) {

var isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
function slash2(str) {
function slash4(str) {
return str.replace(/\\/g, "/");

@@ -331,3 +331,3 @@ }

exports.remove = remove;
exports.slash = slash2;
exports.slash = slash4;
exports.sleep = sleep;

@@ -338,3 +338,3 @@ exports.sum = sum;

exports.timestamp = timestamp;
exports.toArray = toArray2;
exports.toArray = toArray3;
exports.toString = toString2;

@@ -346,6 +346,5 @@ exports.uniq = uniq;

// src/context.ts
var import_utils5 = __toModule(require_dist());
var import_utils4 = __toModule(require_dist());
var _path = require('path');
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
var _chokidar = require('chokidar'); var _chokidar2 = _interopRequireDefault(_chokidar);

@@ -494,3 +493,3 @@ // src/utils.ts

resolved.resolvedDirs = resolved.dirs.map((i) => (0, import_utils2.slash)(_path.resolve.call(void 0, viteConfig.root, i)));
resolved.globs = resolved.dirs.map((i) => resolved.deep ? (0, import_utils2.slash)(_path.join.call(void 0, i, `**/*.${extsGlob}`)) : (0, import_utils2.slash)(_path.join.call(void 0, i, `*.${extsGlob}`)));
resolved.globs = resolved.resolvedDirs.map((i) => resolved.deep ? (0, import_utils2.slash)(_path.join.call(void 0, i, `**/*.${extsGlob}`)) : (0, import_utils2.slash)(_path.join.call(void 0, i, `*.${extsGlob}`)));
if (!resolved.extensions.length)

@@ -570,4 +569,4 @@ throw new Error("[vite-plugin-components] extensions are required to search for components");

return void 0;
const related = (0, import_utils2.slash)(path).startsWith("/") ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), _path.resolve.call(void 0, root, path.slice(1)))}` : path;
let entry = `typeof import('${(0, import_utils2.slash)(related)}')`;
const related = (0, import_utils3.slash)(path).startsWith("/") ? `./${_path.relative.call(void 0, _path.dirname.call(void 0, filepath), _path.resolve.call(void 0, root, path.slice(1)))}` : path;
let entry = `typeof import('${(0, import_utils3.slash)(related)}')`;
if (importName)

@@ -617,17 +616,3 @@ entry += `['${importName}']`;

this.options = resolveOptions(options, viteConfig);
const { globs, dirs } = this.options;
if (viteConfig.command === "serve") {
_chokidar2.default.watch(dirs, { ignoreInitial: true, cwd: this.root }).on("unlink", (path) => {
if (matchGlobs(path, globs)) {
this.removeComponents(path);
this.onUpdate(path);
}
}).on("add", (path) => {
if (matchGlobs(path, globs)) {
this.addComponents(path);
this.onUpdate(path);
}
});
}
this.generateDeclaration = (0, import_utils5.throttle)(500, false, this.generateDeclaration.bind(this));
this.generateDeclaration = (0, import_utils4.throttle)(500, false, this.generateDeclaration.bind(this));
}

@@ -639,2 +624,16 @@ get root() {

this._server = server;
const { globs, dirs } = this.options;
server.watcher.add(dirs);
server.watcher.on("unlink", (path) => {
if (!matchGlobs(path, globs))
return;
this.removeComponents(path);
this.onUpdate(path);
});
server.watcher.on("add", (path) => {
if (!matchGlobs(path, globs))
return;
this.addComponents(path);
this.onUpdate(path);
});
}

@@ -651,3 +650,3 @@ updateUsageMap(path, paths) {

const size = this._componentPaths.size;
(0, import_utils2.toArray)(paths).forEach((p) => this._componentPaths.add(p));
(0, import_utils4.toArray)(paths).forEach((p) => this._componentPaths.add(p));
if (this._componentPaths.size !== size) {

@@ -666,3 +665,3 @@ this.updateComponentNameMap();

const size = this._componentPaths.size;
(0, import_utils2.toArray)(paths).forEach((p) => this._componentPaths.delete(p));
(0, import_utils4.toArray)(paths).forEach((p) => this._componentPaths.delete(p));
if (this._componentPaths.size !== size) {

@@ -685,3 +684,3 @@ this.updateComponentNameMap();

if (values.has(name)) {
const r = `/${(0, import_utils2.slash)(_path.relative.call(void 0, this.viteConfig.root, key))}`;
const r = `/${(0, import_utils4.slash)(_path.relative.call(void 0, this.viteConfig.root, key))}`;
payload.updates.push({

@@ -747,4 +746,4 @@ acceptedPath: r,

if (path.startsWith("/") && !path.startsWith(this.root))
return (0, import_utils2.slash)(path.slice(1));
return (0, import_utils2.slash)(_path.relative.call(void 0, this.root, path));
return (0, import_utils4.slash)(path.slice(1));
return (0, import_utils4.slash)(_path.relative.call(void 0, this.root, path));
}

@@ -1146,2 +1145,11 @@ searchGlob() {

enforce: "post",
config() {
return {
server: {
watch: {
disableGlobbing: false
}
}
};
},
configResolved(config) {

@@ -1148,0 +1156,0 @@ if (config.plugins.find((i) => i.name === "vite-plugin-vue2"))

{
"name": "vite-plugin-components",
"version": "0.11.5",
"version": "0.12.0",
"description": "Components auto importing for Vite",

@@ -34,3 +34,2 @@ "homepage": "https://github.com/antfu/vite-plugin-components",

"dependencies": {
"chokidar": "^3.5.2",
"debug": "^4.3.2",

@@ -44,16 +43,16 @@ "fast-glob": "^3.2.6",

"@antfu/utils": "^0.2.4",
"@types/debug": "^4.1.5",
"@types/debug": "^4.1.6",
"@types/jest": "^26.0.23",
"@types/minimatch": "^3.0.4",
"@types/node": "^15.12.5",
"@types/node": "^15.14.0",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"eslint": "^7.29.0",
"jest": "^27.0.6",
"rollup": "^2.52.3",
"rollup": "^2.52.6",
"standard-version": "^9.3.0",
"ts-jest": "^27.0.3",
"tsup": "^4.12.0",
"typescript": "^4.3.4",
"typescript": "^4.3.5",
"vite": "^2.3.8"
}
}

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