@windicss/plugin-utils
Advanced tools
Comparing version 0.11.8 to 0.12.1
@@ -278,6 +278,6 @@ import * as windicss_types_interfaces from 'windicss/types/interfaces'; | ||
transformGroupsWithSourcemap: typeof transformGroupsWithSourcemap; | ||
isDetectTarget: (id: string) => boolean | null; | ||
isScanTarget: (id: string) => boolean | null; | ||
isDetectTarget: (id: string) => boolean; | ||
isScanTarget: (id: string) => boolean; | ||
isCssTransformTarget: (id: string) => boolean; | ||
isExcluded: (id: string) => boolean | RegExpMatchArray; | ||
isExcluded: (id: string) => boolean; | ||
scan: () => Promise<void>; | ||
@@ -284,0 +284,0 @@ classesGenerated: Set<string>; |
@@ -361,2 +361,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty; | ||
const globs = exts.length ? dirs.map((i) => _path.posix.join(i, exts.length > 1 ? `**/*.{${exts.join(",")}}` : `**/*.${exts[0]}`)) : []; | ||
globs.push("index.html"); | ||
return globs; | ||
@@ -396,3 +397,3 @@ } | ||
exclude: ["node_modules", ".git"], | ||
include: ["index.html"], | ||
include: [], | ||
runOnStartup: true, | ||
@@ -402,4 +403,4 @@ transformers: [], | ||
}, typeof scan === "boolean" ? {} : scan); | ||
scanOptions.exclude = mergeArrays((_a = config.extract) == null ? void 0 : _a.exclude, scanOptions.exclude); | ||
scanOptions.include = mergeArrays((_b = config.extract) == null ? void 0 : _b.include, scanOptions.include, ((_c = config.extract) == null ? void 0 : _c.include) ? [] : buildGlobs(scanOptions.dirs, scanOptions.fileExtensions)); | ||
scanOptions.exclude = mergeArrays((_a = config.extract) == null ? void 0 : _a.exclude, scanOptions.exclude).map((i) => _path.resolve.call(void 0, root, i)); | ||
scanOptions.include = mergeArrays((_b = config.extract) == null ? void 0 : _b.include, scanOptions.include, ((_c = config.extract) == null ? void 0 : _c.include) ? [] : buildGlobs(scanOptions.dirs, scanOptions.fileExtensions)).map((i) => _path.resolve.call(void 0, root, i)); | ||
scanOptions.extractors = mergeArrays(getDefaultExtractors(), (_d = config.extract) == null ? void 0 : _d.extractors); | ||
@@ -522,3 +523,2 @@ const safelist = new Set(mergeArrays(config.safelist, options.safelist).flatMap((i) => i.split(" "))); | ||
let files = []; | ||
let regexId; | ||
const classesGenerated = new Set(); | ||
@@ -540,2 +540,4 @@ const classesPending = new Set(); | ||
async function getFiles() { | ||
debug.glob("include", options.scanOptions.include); | ||
debug.glob("exclude", options.scanOptions.exclude); | ||
const files2 = await _fastglob2.default.call(void 0, options.scanOptions.include, { | ||
@@ -566,8 +568,11 @@ cwd: options.root, | ||
function isExcluded(id) { | ||
return id.match(/\b(?:node_modules|.git)\b/) || _micromatch2.default.isMatch(slash(id), options.scanOptions.exclude); | ||
return _micromatch2.default.isMatch(slash(id), options.scanOptions.exclude); | ||
} | ||
function isIncluded(id) { | ||
return _micromatch2.default.isMatch(slash(id), options.scanOptions.include); | ||
} | ||
function isDetectTarget(id) { | ||
if (files.some((file) => id.startsWith(file))) | ||
if (files.includes(id)) | ||
return true; | ||
return id.match(regexId) && !isExcluded(id); | ||
return isIncluded(id) && !isExcluded(id); | ||
} | ||
@@ -758,3 +763,2 @@ function isScanTarget(id) { | ||
options = await resolveOptions(userOptions, utilsOptions, true); | ||
regexId = new RegExp(`\\.(?:${options.scanOptions.fileExtensions.join("|")})$`, "i"); | ||
files = []; | ||
@@ -761,0 +765,0 @@ processor = new (0, _windicss2.default)(options.config); |
{ | ||
"name": "@windicss/plugin-utils", | ||
"description": "Common utils for building integrations of Windi CSS", | ||
"version": "0.11.8", | ||
"version": "0.12.1", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "module": "dist/index.mjs", |
Sorry, the diff of this file is not supported yet
59592
1833