vite-plugin-components
Advanced tools
Comparing version 0.6.9 to 0.6.10
@@ -68,2 +68,3 @@ import { Plugin } from 'vite'; | ||
globs: string[]; | ||
watchGlobs: string[]; | ||
}; | ||
@@ -70,0 +71,0 @@ interface ComponentInfo { |
@@ -131,4 +131,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __assign = Object.assign; | ||
const extsGlob = resolved.extensions.length === 1 ? resolved.extensions : `{${resolved.extensions.join(",")}}`; | ||
resolved.globs = toArray(resolved.dirs).map((i) => resolved.deep ? _path.join.call(void 0, i, `/**/*.${extsGlob}`) : _path.join.call(void 0, i, `/*.${extsGlob}`)); | ||
resolved.globs = toArray(resolved.dirs).map((i) => resolved.deep ? `${i}/**/*.${extsGlob}` : `${i}/*.${extsGlob}`); | ||
resolved.dirs = toArray(resolved.dirs).map((i) => _path.resolve.call(void 0, viteConfig.root, i)); | ||
resolved.watchGlobs = toArray(resolved.dirs).map((i) => resolved.deep ? _path.join.call(void 0, i, `/**/*.${extsGlob}`) : _path.join.call(void 0, i, `/*.${extsGlob}`)); | ||
if (!resolved.extensions.length) | ||
@@ -208,6 +209,6 @@ throw new Error("[vite-plugin-components] extensions are required to search for components"); | ||
this.options = resolveOptions(options, viteConfig); | ||
const {globs, dirs} = this.options; | ||
const {watchGlobs, dirs} = this.options; | ||
if (viteConfig.command === "serve") { | ||
_chokidar2.default.watch(dirs, {ignoreInitial: true}).on("unlink", (path) => { | ||
if (matchGlobs(path, globs)) { | ||
if (matchGlobs(path, watchGlobs)) { | ||
this.removeComponents(path); | ||
@@ -217,3 +218,3 @@ this.onUpdate(path); | ||
}).on("add", (path) => { | ||
if (matchGlobs(path, globs)) { | ||
if (matchGlobs(path, watchGlobs)) { | ||
this.addComponents(path); | ||
@@ -220,0 +221,0 @@ this.onUpdate(path); |
{ | ||
"name": "vite-plugin-components", | ||
"description": "Components auto importing for Vite", | ||
"version": "0.6.9", | ||
"version": "0.6.10", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.mjs", |
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
33231
865