vite-plugin-components
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -73,2 +73,3 @@ import { Plugin } from 'vite'; | ||
dirs: string[]; | ||
resolvedDirs: string[]; | ||
globs: string[]; | ||
@@ -75,0 +76,0 @@ }; |
@@ -128,3 +128,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __assign = Object.assign; | ||
} | ||
function resolveOptions(options) { | ||
function resolveOptions(options, viteConfig) { | ||
const resolved = Object.assign({}, defaultOptions, options); | ||
@@ -137,2 +137,3 @@ resolved.libraries = toArray(resolved.libraries).map((i) => typeof i === "string" ? {name: i} : i); | ||
resolved.dirs = toArray(resolved.dirs); | ||
resolved.resolvedDirs = resolved.dirs.map((i) => _path.resolve.call(void 0, viteConfig.root, i)); | ||
resolved.globs = resolved.dirs.map((i) => resolved.deep ? slash(_path.join.call(void 0, i, `**/*.${extsGlob}`)) : slash(_path.join.call(void 0, i, `*.${extsGlob}`))); | ||
@@ -144,6 +145,6 @@ if (!resolved.extensions.length) | ||
function getNameFromFilePath(filePath, options) { | ||
const {dirs, directoryAsNamespace, globalNamespaces} = options; | ||
const {resolvedDirs, directoryAsNamespace, globalNamespaces} = options; | ||
const parsedFilePath = _path.parse.call(void 0, filePath); | ||
let strippedPath = ""; | ||
for (const dir of dirs) { | ||
for (const dir of resolvedDirs) { | ||
if (parsedFilePath.dir.startsWith(dir)) { | ||
@@ -214,3 +215,3 @@ strippedPath = parsedFilePath.dir.slice(dir.length); | ||
this._searched = false; | ||
this.options = resolveOptions(options); | ||
this.options = resolveOptions(options, viteConfig); | ||
const {globs, dirs} = this.options; | ||
@@ -217,0 +218,0 @@ if (viteConfig.command === "serve") { |
{ | ||
"name": "vite-plugin-components", | ||
"description": "Components auto importing for Vite", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"main": "dist/index.js", | ||
@@ -22,4 +22,4 @@ "module": "dist/index.mjs", | ||
"dev": "npm run build -- --watch", | ||
"example:dev": "npm -C example run dev", | ||
"example:build": "npm -C example run build", | ||
"example:dev": "npm -C example/basic run dev", | ||
"example:build": "npm -C example/basic run build", | ||
"build": "tsup src/index.ts --dts --format cjs,esm", | ||
@@ -26,0 +26,0 @@ "prepublishOnly": "npm run build", |
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
36344
952