@windicss/plugin-utils
Advanced tools
Comparing version 1.6.3 to 1.7.0
@@ -1,2 +0,1 @@ | ||
import * as windicss_types_interfaces from 'windicss/types/interfaces'; | ||
import { FullConfig, Extractor, ExtractorResultDetailed } from 'windicss/types/interfaces'; | ||
@@ -258,3 +257,3 @@ import { generateCompletions } from 'windicss/utils'; | ||
declare function getDefaultExtractors(): Extractor[]; | ||
declare function applyExtractors(code: string, id?: string, extractors?: Extractor[], defaultExtract?: typeof DefaultExtractor): Promise<windicss_types_interfaces.ExtractorResultDetailed>; | ||
declare function applyExtractors(code: string, id?: string, extractors?: Extractor[], defaultExtract?: typeof DefaultExtractor): Promise<ExtractorResultDetailed>; | ||
@@ -261,0 +260,0 @@ declare type CompletionsResult = ReturnType<typeof generateCompletions>; |
@@ -219,4 +219,4 @@ var __create = Object.create; | ||
var import_parser = require("windicss/utils/parser"); | ||
var import_utils5 = require("windicss/utils"); | ||
var import_utils6 = require("@antfu/utils"); | ||
var import_utils6 = require("windicss/utils"); | ||
var import_utils7 = require("@antfu/utils"); | ||
var import_fast_glob = __toESM(require("fast-glob")); | ||
@@ -263,2 +263,3 @@ var import_debug2 = __toESM(require("debug")); | ||
var import_path = require("path"); | ||
var import_utils3 = require("@antfu/utils"); | ||
@@ -391,7 +392,22 @@ // src/regexes.ts | ||
ext = ext.slice(1); | ||
for (const { extractor, extensions } of extractors) { | ||
if (extensions.includes(ext)) | ||
return extractor(code, id); | ||
} | ||
return defaultExtract(code, id); | ||
const matchingExtractors = extractors.filter((extractor) => extractor.extensions.includes(ext)).map((extractor) => extractor.extractor); | ||
return Promise.all((matchingExtractors.length ? matchingExtractors : [defaultExtract]).map((extractor) => extractor(code, id))).then((results) => { | ||
const attributesNames = results.flatMap((v) => { | ||
var _a; | ||
return (_a = v.attributes) == null ? void 0 : _a.names; | ||
}); | ||
const attributesValues = results.flatMap((v) => { | ||
var _a; | ||
return (_a = v.attributes) == null ? void 0 : _a.values; | ||
}); | ||
return { | ||
tags: (0, import_utils3.uniq)(results.flatMap((v) => v.tags)), | ||
ids: (0, import_utils3.uniq)(results.flatMap((v) => v.ids)), | ||
classes: (0, import_utils3.uniq)(results.flatMap((v) => v.classes)), | ||
attributes: attributesNames.length || attributesValues.length ? { | ||
names: attributesNames, | ||
values: attributesValues | ||
} : void 0 | ||
}; | ||
}); | ||
} | ||
@@ -592,3 +608,3 @@ | ||
if (!completions) | ||
completions = (0, import_utils5.generateCompletions)(processor); | ||
completions = (0, import_utils6.generateCompletions)(processor); | ||
return completions; | ||
@@ -611,3 +627,3 @@ } | ||
let scanned = false; | ||
const scan = (0, import_utils6.createSingletonPromise)(async () => { | ||
const scan = (0, import_utils7.createSingletonPromise)(async () => { | ||
await ensureInit(); | ||
@@ -614,0 +630,0 @@ debug.scan("started"); |
{ | ||
"name": "@windicss/plugin-utils", | ||
"version": "1.6.3", | ||
"version": "1.7.0", | ||
"description": "Common utils for building integrations of Windi CSS", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"@antfu/utils": "^0.4.0", | ||
"@windicss/config": "1.6.3", | ||
"@windicss/config": "1.7.0", | ||
"debug": "^4.3.3", | ||
@@ -36,0 +36,0 @@ "fast-glob": "^3.2.11", |
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
79328
2299
+ Added@windicss/config@1.7.0(transitive)
- Removed@windicss/config@1.6.3(transitive)
Updated@windicss/config@1.7.0