tailwindcss-patch 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +21 -4
- package/dist/types/class.d.ts +5 -2
- package/dist/types/type.d.ts +2 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ function getClassCacheSet(basedir) {
|
|
|
43
43
|
for (const classCacheMap of classCaches) {
|
|
44
44
|
const keys = classCacheMap.keys();
|
|
45
45
|
for (const key of keys) {
|
|
46
|
-
classSet.add(key);
|
|
46
|
+
classSet.add(key.toString());
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return classSet;
|
|
@@ -74,7 +74,8 @@ function getCacheOptions$1(options = {}) {
|
|
|
74
74
|
cwd,
|
|
75
75
|
dir,
|
|
76
76
|
file,
|
|
77
|
-
filename
|
|
77
|
+
filename,
|
|
78
|
+
strategy: 'merge'
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
81
|
function writeCache(data, options = {}) {
|
|
@@ -147,9 +148,25 @@ class TailwindcssPatcher {
|
|
|
147
148
|
getCache() {
|
|
148
149
|
return readCache(this.cacheOptions);
|
|
149
150
|
}
|
|
150
|
-
getClassSet(
|
|
151
|
+
getClassSet(options) {
|
|
152
|
+
var _a;
|
|
153
|
+
if (options === void 0) { options = {
|
|
154
|
+
cacheStrategy: (_a = this.cacheOptions.strategy) !== null && _a !== void 0 ? _a : 'merge'
|
|
155
|
+
}; }
|
|
156
|
+
const { basedir, cacheStrategy } = options;
|
|
151
157
|
const set = getClassCacheSet(basedir);
|
|
152
|
-
|
|
158
|
+
if (cacheStrategy === 'overwrite') {
|
|
159
|
+
set.size > 0 && this.setCache(set);
|
|
160
|
+
}
|
|
161
|
+
else if (cacheStrategy === 'merge') {
|
|
162
|
+
const cacheSet = this.getCache();
|
|
163
|
+
if (cacheSet) {
|
|
164
|
+
for (const x of cacheSet) {
|
|
165
|
+
set.add(x);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
this.setCache(set);
|
|
169
|
+
}
|
|
153
170
|
return set;
|
|
154
171
|
}
|
|
155
172
|
getContexts(basedir) {
|
package/dist/types/class.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CacheOptions, InternalCacheOptions, InternalPatchOptions, TailwindcssPatcherOptions } from './type';
|
|
1
|
+
import type { CacheOptions, InternalCacheOptions, InternalPatchOptions, TailwindcssPatcherOptions, CacheStrategy } from './type';
|
|
2
2
|
export declare function getCacheOptions(options?: CacheOptions | boolean): InternalCacheOptions;
|
|
3
3
|
export declare class TailwindcssPatcher {
|
|
4
4
|
rawOptions: TailwindcssPatcherOptions;
|
|
@@ -9,6 +9,9 @@ export declare class TailwindcssPatcher {
|
|
|
9
9
|
getPkgEntry(basedir?: string): string;
|
|
10
10
|
setCache(set: Set<string>): string | undefined;
|
|
11
11
|
getCache(): Set<string> | undefined;
|
|
12
|
-
getClassSet(
|
|
12
|
+
getClassSet(options?: {
|
|
13
|
+
basedir?: string;
|
|
14
|
+
cacheStrategy?: CacheStrategy;
|
|
15
|
+
}): Set<string>;
|
|
13
16
|
getContexts(basedir?: string): any[];
|
|
14
17
|
}
|
package/dist/types/type.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-patch",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "patch tailwindcss for exposing context",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"tailwindcss": "^3.3.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/generator": "^7.22.
|
|
38
|
-
"@babel/parser": "^7.22.
|
|
39
|
-
"@babel/traverse": "^7.22.
|
|
40
|
-
"@babel/types": "^7.22.
|
|
37
|
+
"@babel/generator": "^7.22.5",
|
|
38
|
+
"@babel/parser": "^7.22.5",
|
|
39
|
+
"@babel/traverse": "^7.22.5",
|
|
40
|
+
"@babel/types": "^7.22.5",
|
|
41
41
|
"resolve": "^1.22.2",
|
|
42
|
-
"semver": "^7.5.
|
|
42
|
+
"semver": "^7.5.2"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
|
|
45
45
|
"repository": {
|