vite-plugin-components
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -5,2 +5,4 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/constants.ts | ||
// src/generator/resolver.ts | ||
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug); | ||
const debug2 = _debug2.default.call(void 0, "vite-plugin-components:resolver"); | ||
function isResolverPath(reqPath) { | ||
@@ -13,2 +15,4 @@ return reqPath.endsWith(RESOLVER_EXT); | ||
const components = ctx.components.filter((i) => names.includes(i[0]) && i[1] !== sfcPath); | ||
debug2(`resolving ${sfcPath}`); | ||
debug2(`components [${names.join(", ")}]`); | ||
return ` | ||
@@ -26,2 +30,4 @@ ${components.map(([name, path3]) => `import ${name} from "${path3}"`).join("\n")} | ||
var _fastglob = require('fast-glob'); var _fastglob2 = _interopRequireDefault(_fastglob); | ||
const debug4 = _debug2.default.call(void 0, "vite-plugin-components:glob"); | ||
function toArray(arr) { | ||
@@ -41,2 +47,3 @@ if (Array.isArray(arr)) | ||
const globs = toArray(dirs).map((i) => deep ? `${i}/**/*.${extsGlob}` : `${i}/*.${extsGlob}`); | ||
debug4(`searching start with: [${globs.join(", ")}]`); | ||
const files = await _fastglob2.default.call(void 0, globs, { | ||
@@ -51,2 +58,4 @@ ignore: [ | ||
const components = files.map((f) => [_path2.default.parse(f).name, `/${f}`]); | ||
debug4(`${components.length} components found.`); | ||
debug4(`[${components.map((i) => i).join(", ")}]`); | ||
ctx.components = components; | ||
@@ -85,3 +94,3 @@ ctx._searchingPromise = void 0; | ||
try { | ||
await searchComponents(context, true); | ||
await searchComponents(context); | ||
ctx.body = await generateResolver(context, ctx.path); | ||
@@ -88,0 +97,0 @@ ctx.type = "js"; |
{ | ||
"name": "vite-plugin-components", | ||
"description": "Components auto importing for Vite", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "dist/index.js", | ||
@@ -26,2 +26,3 @@ "module": "dist/index.mjs", | ||
"@antfu/eslint-config-ts": "^0.3.2", | ||
"@types/debug": "^4.1.5", | ||
"@typescript-eslint/eslint-plugin": "^3.9.1", | ||
@@ -35,4 +36,5 @@ "eslint": "^7.7.0", | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"fast-glob": "^3.2.4" | ||
} | ||
} |
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
14196
331
2
8
+ Addeddebug@^4.1.1
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)