tailwindcss-patch
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -46,3 +46,3 @@ 'use strict'; | ||
for (const key of keys) { | ||
classSet.add(key); | ||
classSet.add(key.toString()); | ||
} | ||
@@ -78,3 +78,4 @@ } | ||
file, | ||
filename | ||
filename, | ||
strategy: 'merge' | ||
}; | ||
@@ -152,5 +153,21 @@ } | ||
} | ||
getClassSet(basedir) { | ||
getClassSet(options) { | ||
var _a; | ||
if (options === void 0) { options = { | ||
cacheStrategy: (_a = this.cacheOptions.strategy) !== null && _a !== void 0 ? _a : 'merge' | ||
}; } | ||
const { basedir, cacheStrategy } = options; | ||
const set = getClassCacheSet(basedir); | ||
set.size > 0 && this.setCache(set); | ||
if (cacheStrategy === 'overwrite') { | ||
set.size > 0 && this.setCache(set); | ||
} | ||
else if (cacheStrategy === 'merge') { | ||
const cacheSet = this.getCache(); | ||
if (cacheSet) { | ||
for (const x of cacheSet) { | ||
set.add(x); | ||
} | ||
} | ||
this.setCache(set); | ||
} | ||
return set; | ||
@@ -157,0 +174,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { CacheOptions, InternalCacheOptions, InternalPatchOptions, TailwindcssPatcherOptions } from './type'; | ||
import type { CacheOptions, InternalCacheOptions, InternalPatchOptions, TailwindcssPatcherOptions, CacheStrategy } from './type'; | ||
export declare function getCacheOptions(options?: CacheOptions | boolean): InternalCacheOptions; | ||
@@ -12,4 +12,7 @@ export declare class TailwindcssPatcher { | ||
getCache(): Set<string> | undefined; | ||
getClassSet(basedir?: string): Set<string>; | ||
getClassSet(options?: { | ||
basedir?: string; | ||
cacheStrategy?: CacheStrategy; | ||
}): Set<string>; | ||
getContexts(basedir?: string): any[]; | ||
} |
@@ -0,1 +1,2 @@ | ||
export type CacheStrategy = 'merge' | 'overwrite'; | ||
export interface CacheOptions { | ||
@@ -5,2 +6,3 @@ dir?: string; | ||
file?: string; | ||
strategy?: CacheStrategy; | ||
} | ||
@@ -7,0 +9,0 @@ export type InternalCacheOptions = CacheOptions & { |
{ | ||
"name": "tailwindcss-patch", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "patch tailwindcss for exposing context", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
"resolve": "^1.22.2", | ||
"semver": "^7.5.1" | ||
"semver": "^7.5.2" | ||
}, | ||
@@ -45,0 +45,0 @@ "homepage": "https://github.com/sonofmagic/tailwindcss-mangle", |
27315
589
Updatedsemver@^7.5.2