@windicss/plugin-utils
Advanced tools
Comparing version 0.11.3 to 0.11.4
@@ -264,2 +264,3 @@ import * as windicss_types_interfaces from 'windicss/types/interfaces'; | ||
init: () => Promise<WindiCssProcessor>; | ||
ensureInit: () => Promise<WindiCssProcessor | undefined>; | ||
extractFile: (code: string, id?: string | undefined, applyGroupTransform?: boolean) => Promise<boolean>; | ||
@@ -269,3 +270,3 @@ applyExtractors: (code: string, id?: string | undefined) => Promise<windicss_types_interfaces.ExtractorResultDetailed>; | ||
getFiles: () => Promise<string[]>; | ||
clearCache: () => void; | ||
clearCache: (clearAll?: boolean) => void; | ||
transformCSS: (css: string) => string; | ||
@@ -291,2 +292,3 @@ transformGroups: typeof transformGroups; | ||
}; | ||
readonly initialized: boolean; | ||
readonly options: ResolvedOptions; | ||
@@ -293,0 +295,0 @@ readonly files: string[]; |
@@ -514,3 +514,2 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var __defProp = Object.defineProperty; | ||
async function init() { | ||
completions = void 0; | ||
options = await resolveOptions(userOptions, utilsOptions, true); | ||
@@ -523,2 +522,6 @@ regexId = new RegExp(`\\.(?:${options.scanOptions.fileExtensions.join("|")})$`, "i"); | ||
} | ||
async function ensureInit() { | ||
if (!processor) | ||
return await init(); | ||
} | ||
function getCompletions() { | ||
@@ -543,4 +546,3 @@ if (!completions) | ||
async function scan() { | ||
if (!processor) | ||
await init(); | ||
await ensureInit(); | ||
if (!_searching) { | ||
@@ -635,4 +637,3 @@ _searching = (async () => { | ||
var _a, _b; | ||
if (!processor) | ||
await init(); | ||
await ensureInit(); | ||
if (options.enableScan && options.scanOptions.runOnStartup) | ||
@@ -676,11 +677,18 @@ await scan(); | ||
} | ||
function clearCache() { | ||
function clearCache(clearAll = false) { | ||
style = new (0, _style.StyleSheet)(); | ||
_cssCache = void 0; | ||
include(classesPending, options.safelist); | ||
include(classesPending, classesGenerated); | ||
include(tagsPending, tagsGenerated); | ||
include(tagsPending, preflightTags); | ||
include(tagsPending, options.preflightOptions.safelist); | ||
include(tagsAvailable, htmlTags); | ||
completions = void 0; | ||
if (clearAll) { | ||
classesPending.clear(); | ||
tagsPending.clear(); | ||
tagsAvailable.clear(); | ||
} else { | ||
include(classesPending, options.safelist); | ||
include(classesPending, classesGenerated); | ||
include(tagsPending, tagsGenerated); | ||
include(tagsPending, preflightTags); | ||
include(tagsPending, options.preflightOptions.safelist); | ||
include(tagsAvailable, htmlTags); | ||
} | ||
exclude(tagsAvailable, preflightTags); | ||
@@ -694,2 +702,3 @@ exclude(tagsAvailable, options.preflightOptions.safelist); | ||
init, | ||
ensureInit, | ||
extractFile, | ||
@@ -716,2 +725,5 @@ applyExtractors: applyExtractors2, | ||
getCompletions, | ||
get initialized() { | ||
return !!processor; | ||
}, | ||
get options() { | ||
@@ -718,0 +730,0 @@ return options; |
{ | ||
"name": "@windicss/plugin-utils", | ||
"description": "Common utils for building integrations of Windi CSS", | ||
"version": "0.11.3", | ||
"version": "0.11.4", | ||
"main": "dist/index.js", | ||
@@ -36,3 +36,3 @@ "module": "dist/index.mjs", | ||
"sucrase": "^3.17.1", | ||
"windicss": "^2.5.8" | ||
"windicss": "^2.5.9" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
58157
1788
Updatedwindicss@^2.5.9