tailwindcss-patch 6.0.4 → 6.0.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/{chunk-X2JGSXYF.mjs → chunk-JNFI3RBM.mjs} +94 -89
- package/dist/{chunk-R73U6A56.js → chunk-L7IXX3YU.js} +101 -95
- package/dist/cli.js +17 -7
- package/dist/cli.mjs +13 -4
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -1,85 +1,3 @@
|
|
|
1
|
-
// src/logger.ts
|
|
2
|
-
import { createConsola } from "consola";
|
|
3
|
-
var logger = createConsola();
|
|
4
|
-
var logger_default = logger;
|
|
5
|
-
|
|
6
|
-
// src/core/cache.ts
|
|
7
|
-
import process from "node:process";
|
|
8
|
-
import fs from "fs-extra";
|
|
9
|
-
import path from "pathe";
|
|
10
|
-
|
|
11
|
-
// src/constants.ts
|
|
12
|
-
var pkgName = "tailwindcss-patch";
|
|
13
|
-
|
|
14
|
-
// src/core/cache.ts
|
|
15
|
-
function getCacheOptions(options) {
|
|
16
|
-
let cache;
|
|
17
|
-
switch (typeof options) {
|
|
18
|
-
case "undefined": {
|
|
19
|
-
cache = {
|
|
20
|
-
enable: false
|
|
21
|
-
};
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
case "boolean": {
|
|
25
|
-
cache = {
|
|
26
|
-
enable: options
|
|
27
|
-
};
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
case "object": {
|
|
31
|
-
cache = { ...options, enable: true };
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return cache;
|
|
36
|
-
}
|
|
37
|
-
var CacheManager = class {
|
|
38
|
-
options;
|
|
39
|
-
constructor(options = {}) {
|
|
40
|
-
this.options = this.getOptions(options);
|
|
41
|
-
}
|
|
42
|
-
getOptions(options = {}) {
|
|
43
|
-
const cwd = options.cwd ?? process.cwd();
|
|
44
|
-
const dir = options.dir ?? path.resolve(cwd, "node_modules/.cache", pkgName);
|
|
45
|
-
const file = options.file ?? "index.json";
|
|
46
|
-
const filename = path.resolve(dir, file);
|
|
47
|
-
return {
|
|
48
|
-
cwd,
|
|
49
|
-
dir,
|
|
50
|
-
file,
|
|
51
|
-
filename,
|
|
52
|
-
strategy: "merge"
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
async write(data) {
|
|
56
|
-
try {
|
|
57
|
-
const { filename } = this.options;
|
|
58
|
-
await fs.outputJSON(filename, [...data]);
|
|
59
|
-
return filename;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
logger_default.error(error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async read() {
|
|
65
|
-
const { filename } = this.options;
|
|
66
|
-
const isExisted = await fs.exists(filename);
|
|
67
|
-
try {
|
|
68
|
-
if (isExisted) {
|
|
69
|
-
const data = await fs.readJSON(filename);
|
|
70
|
-
return new Set(data);
|
|
71
|
-
}
|
|
72
|
-
} catch (error) {
|
|
73
|
-
logger_default.error(`path:${filename}`);
|
|
74
|
-
logger_default.error(error);
|
|
75
|
-
isExisted && await fs.remove(filename);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// src/defaults.ts
|
|
81
|
-
import process2 from "node:process";
|
|
82
|
-
|
|
83
1
|
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
84
2
|
function isPlainObject(value) {
|
|
85
3
|
if (value === null || typeof value !== "object") {
|
|
@@ -170,7 +88,87 @@ var preserveClassNamesMap = preserveClassNames.reduce((acc, cur) => {
|
|
|
170
88
|
}, {});
|
|
171
89
|
var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
172
90
|
|
|
91
|
+
// src/logger.ts
|
|
92
|
+
import { createConsola } from "consola";
|
|
93
|
+
var logger = createConsola();
|
|
94
|
+
var logger_default = logger;
|
|
95
|
+
|
|
96
|
+
// src/core/cache.ts
|
|
97
|
+
import process from "node:process";
|
|
98
|
+
import fs from "fs-extra";
|
|
99
|
+
import path from "pathe";
|
|
100
|
+
|
|
101
|
+
// src/constants.ts
|
|
102
|
+
var pkgName = "tailwindcss-patch";
|
|
103
|
+
|
|
104
|
+
// src/core/cache.ts
|
|
105
|
+
function getCacheOptions(options) {
|
|
106
|
+
let cache;
|
|
107
|
+
switch (typeof options) {
|
|
108
|
+
case "undefined": {
|
|
109
|
+
cache = {
|
|
110
|
+
enable: false
|
|
111
|
+
};
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case "boolean": {
|
|
115
|
+
cache = {
|
|
116
|
+
enable: options
|
|
117
|
+
};
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case "object": {
|
|
121
|
+
cache = { ...options, enable: true };
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return cache;
|
|
126
|
+
}
|
|
127
|
+
var CacheManager = class {
|
|
128
|
+
options;
|
|
129
|
+
constructor(options = {}) {
|
|
130
|
+
this.options = this.getOptions(options);
|
|
131
|
+
}
|
|
132
|
+
getOptions(options = {}) {
|
|
133
|
+
const cwd = options.cwd ?? process.cwd();
|
|
134
|
+
const dir = options.dir ?? path.resolve(cwd, "node_modules/.cache", pkgName);
|
|
135
|
+
const file = options.file ?? "index.json";
|
|
136
|
+
const filename = path.resolve(dir, file);
|
|
137
|
+
return {
|
|
138
|
+
cwd,
|
|
139
|
+
dir,
|
|
140
|
+
file,
|
|
141
|
+
filename,
|
|
142
|
+
strategy: "merge"
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async write(data) {
|
|
146
|
+
try {
|
|
147
|
+
const { filename } = this.options;
|
|
148
|
+
await fs.outputJSON(filename, [...data]);
|
|
149
|
+
return filename;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
logger_default.error(error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async read() {
|
|
155
|
+
const { filename } = this.options;
|
|
156
|
+
const isExisted = await fs.exists(filename);
|
|
157
|
+
try {
|
|
158
|
+
if (isExisted) {
|
|
159
|
+
const data = await fs.readJSON(filename);
|
|
160
|
+
return new Set(data);
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
logger_default.error(`path:${filename}`);
|
|
164
|
+
logger_default.error(error);
|
|
165
|
+
isExisted && await fs.remove(filename);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
173
170
|
// src/defaults.ts
|
|
171
|
+
import process2 from "node:process";
|
|
174
172
|
function getDefaultPatchOptions() {
|
|
175
173
|
return {
|
|
176
174
|
packageName: "tailwindcss",
|
|
@@ -178,7 +176,8 @@ function getDefaultPatchOptions() {
|
|
|
178
176
|
exportContext: true,
|
|
179
177
|
extendLengthUnits: false
|
|
180
178
|
},
|
|
181
|
-
overwrite: true
|
|
179
|
+
overwrite: true,
|
|
180
|
+
filter: () => true
|
|
182
181
|
};
|
|
183
182
|
}
|
|
184
183
|
function getPatchOptions(options) {
|
|
@@ -769,11 +768,13 @@ var TailwindcssPatcher = class {
|
|
|
769
768
|
cacheManager;
|
|
770
769
|
packageInfo;
|
|
771
770
|
majorVersion;
|
|
771
|
+
filter;
|
|
772
772
|
constructor(options = {}) {
|
|
773
773
|
this.rawOptions = options;
|
|
774
774
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
775
775
|
this.patchOptions = getPatchOptions(options.patch);
|
|
776
776
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
777
|
+
this.filter = this.patchOptions.filter;
|
|
777
778
|
const packageInfo = getPackageInfoSync(
|
|
778
779
|
this.patchOptions.packageName ?? "tailwindcss",
|
|
779
780
|
this.patchOptions.resolve
|
|
@@ -862,7 +863,7 @@ var TailwindcssPatcher = class {
|
|
|
862
863
|
})
|
|
863
864
|
});
|
|
864
865
|
for (const candidate of candidates) {
|
|
865
|
-
classSet.add(candidate);
|
|
866
|
+
this.filter?.(candidate) && classSet.add(candidate);
|
|
866
867
|
}
|
|
867
868
|
}
|
|
868
869
|
} else {
|
|
@@ -877,7 +878,7 @@ var TailwindcssPatcher = class {
|
|
|
877
878
|
})
|
|
878
879
|
});
|
|
879
880
|
for (const candidate of candidates) {
|
|
880
|
-
classSet.add(candidate);
|
|
881
|
+
this.filter?.(candidate) && classSet.add(candidate);
|
|
881
882
|
}
|
|
882
883
|
}
|
|
883
884
|
} else {
|
|
@@ -889,7 +890,7 @@ var TailwindcssPatcher = class {
|
|
|
889
890
|
if (output?.removeUniversalSelector && v === "*") {
|
|
890
891
|
continue;
|
|
891
892
|
}
|
|
892
|
-
classSet.add(v);
|
|
893
|
+
this.filter?.(v) && classSet.add(v);
|
|
893
894
|
}
|
|
894
895
|
}
|
|
895
896
|
}
|
|
@@ -914,8 +915,8 @@ var TailwindcssPatcher = class {
|
|
|
914
915
|
}
|
|
915
916
|
return set;
|
|
916
917
|
}
|
|
917
|
-
async extract(
|
|
918
|
-
const { output, tailwindcss } =
|
|
918
|
+
async extract() {
|
|
919
|
+
const { output, tailwindcss } = this.patchOptions;
|
|
919
920
|
if (output && tailwindcss) {
|
|
920
921
|
const { filename, loose } = output;
|
|
921
922
|
if (this.majorVersion === 3 || this.majorVersion === 2) {
|
|
@@ -930,7 +931,10 @@ var TailwindcssPatcher = class {
|
|
|
930
931
|
await fs4.outputJSON(filename, classList, {
|
|
931
932
|
spaces: loose ? 2 : void 0
|
|
932
933
|
});
|
|
933
|
-
return
|
|
934
|
+
return {
|
|
935
|
+
filename,
|
|
936
|
+
classList
|
|
937
|
+
};
|
|
934
938
|
}
|
|
935
939
|
}
|
|
936
940
|
}
|
|
@@ -938,6 +942,7 @@ var TailwindcssPatcher = class {
|
|
|
938
942
|
};
|
|
939
943
|
|
|
940
944
|
export {
|
|
945
|
+
defuOverrideArray,
|
|
941
946
|
logger_default,
|
|
942
947
|
getCacheOptions,
|
|
943
948
|
CacheManager,
|
|
@@ -2,88 +2,6 @@
|
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|
|
5
|
-
// src/logger.ts
|
|
6
|
-
var _consola = require('consola');
|
|
7
|
-
var logger = _consola.createConsola.call(void 0, );
|
|
8
|
-
var logger_default = logger;
|
|
9
|
-
|
|
10
|
-
// src/core/cache.ts
|
|
11
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
12
|
-
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
13
|
-
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
14
|
-
|
|
15
|
-
// src/constants.ts
|
|
16
|
-
var pkgName = "tailwindcss-patch";
|
|
17
|
-
|
|
18
|
-
// src/core/cache.ts
|
|
19
|
-
function getCacheOptions(options) {
|
|
20
|
-
let cache;
|
|
21
|
-
switch (typeof options) {
|
|
22
|
-
case "undefined": {
|
|
23
|
-
cache = {
|
|
24
|
-
enable: false
|
|
25
|
-
};
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case "boolean": {
|
|
29
|
-
cache = {
|
|
30
|
-
enable: options
|
|
31
|
-
};
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
case "object": {
|
|
35
|
-
cache = { ...options, enable: true };
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return cache;
|
|
40
|
-
}
|
|
41
|
-
var CacheManager = class {
|
|
42
|
-
|
|
43
|
-
constructor(options = {}) {
|
|
44
|
-
this.options = this.getOptions(options);
|
|
45
|
-
}
|
|
46
|
-
getOptions(options = {}) {
|
|
47
|
-
const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
|
|
48
|
-
const dir = _nullishCoalesce(options.dir, () => ( _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName)));
|
|
49
|
-
const file = _nullishCoalesce(options.file, () => ( "index.json"));
|
|
50
|
-
const filename = _pathe2.default.resolve(dir, file);
|
|
51
|
-
return {
|
|
52
|
-
cwd,
|
|
53
|
-
dir,
|
|
54
|
-
file,
|
|
55
|
-
filename,
|
|
56
|
-
strategy: "merge"
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
async write(data) {
|
|
60
|
-
try {
|
|
61
|
-
const { filename } = this.options;
|
|
62
|
-
await _fsextra2.default.outputJSON(filename, [...data]);
|
|
63
|
-
return filename;
|
|
64
|
-
} catch (error) {
|
|
65
|
-
logger_default.error(error);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async read() {
|
|
69
|
-
const { filename } = this.options;
|
|
70
|
-
const isExisted = await _fsextra2.default.exists(filename);
|
|
71
|
-
try {
|
|
72
|
-
if (isExisted) {
|
|
73
|
-
const data = await _fsextra2.default.readJSON(filename);
|
|
74
|
-
return new Set(data);
|
|
75
|
-
}
|
|
76
|
-
} catch (error) {
|
|
77
|
-
logger_default.error(`path:${filename}`);
|
|
78
|
-
logger_default.error(error);
|
|
79
|
-
isExisted && await _fsextra2.default.remove(filename);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// src/defaults.ts
|
|
85
|
-
|
|
86
|
-
|
|
87
5
|
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
88
6
|
function isPlainObject(value) {
|
|
89
7
|
if (value === null || typeof value !== "object") {
|
|
@@ -174,7 +92,87 @@ var preserveClassNamesMap = preserveClassNames.reduce((acc, cur) => {
|
|
|
174
92
|
}, {});
|
|
175
93
|
var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
176
94
|
|
|
95
|
+
// src/logger.ts
|
|
96
|
+
var _consola = require('consola');
|
|
97
|
+
var logger = _consola.createConsola.call(void 0, );
|
|
98
|
+
var logger_default = logger;
|
|
99
|
+
|
|
100
|
+
// src/core/cache.ts
|
|
101
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
102
|
+
var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
|
|
103
|
+
var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
104
|
+
|
|
105
|
+
// src/constants.ts
|
|
106
|
+
var pkgName = "tailwindcss-patch";
|
|
107
|
+
|
|
108
|
+
// src/core/cache.ts
|
|
109
|
+
function getCacheOptions(options) {
|
|
110
|
+
let cache;
|
|
111
|
+
switch (typeof options) {
|
|
112
|
+
case "undefined": {
|
|
113
|
+
cache = {
|
|
114
|
+
enable: false
|
|
115
|
+
};
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "boolean": {
|
|
119
|
+
cache = {
|
|
120
|
+
enable: options
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "object": {
|
|
125
|
+
cache = { ...options, enable: true };
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return cache;
|
|
130
|
+
}
|
|
131
|
+
var CacheManager = class {
|
|
132
|
+
|
|
133
|
+
constructor(options = {}) {
|
|
134
|
+
this.options = this.getOptions(options);
|
|
135
|
+
}
|
|
136
|
+
getOptions(options = {}) {
|
|
137
|
+
const cwd = _nullishCoalesce(options.cwd, () => ( _process2.default.cwd()));
|
|
138
|
+
const dir = _nullishCoalesce(options.dir, () => ( _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName)));
|
|
139
|
+
const file = _nullishCoalesce(options.file, () => ( "index.json"));
|
|
140
|
+
const filename = _pathe2.default.resolve(dir, file);
|
|
141
|
+
return {
|
|
142
|
+
cwd,
|
|
143
|
+
dir,
|
|
144
|
+
file,
|
|
145
|
+
filename,
|
|
146
|
+
strategy: "merge"
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async write(data) {
|
|
150
|
+
try {
|
|
151
|
+
const { filename } = this.options;
|
|
152
|
+
await _fsextra2.default.outputJSON(filename, [...data]);
|
|
153
|
+
return filename;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
logger_default.error(error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async read() {
|
|
159
|
+
const { filename } = this.options;
|
|
160
|
+
const isExisted = await _fsextra2.default.exists(filename);
|
|
161
|
+
try {
|
|
162
|
+
if (isExisted) {
|
|
163
|
+
const data = await _fsextra2.default.readJSON(filename);
|
|
164
|
+
return new Set(data);
|
|
165
|
+
}
|
|
166
|
+
} catch (error) {
|
|
167
|
+
logger_default.error(`path:${filename}`);
|
|
168
|
+
logger_default.error(error);
|
|
169
|
+
isExisted && await _fsextra2.default.remove(filename);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
177
174
|
// src/defaults.ts
|
|
175
|
+
|
|
178
176
|
function getDefaultPatchOptions() {
|
|
179
177
|
return {
|
|
180
178
|
packageName: "tailwindcss",
|
|
@@ -182,7 +180,8 @@ function getDefaultPatchOptions() {
|
|
|
182
180
|
exportContext: true,
|
|
183
181
|
extendLengthUnits: false
|
|
184
182
|
},
|
|
185
|
-
overwrite: true
|
|
183
|
+
overwrite: true,
|
|
184
|
+
filter: () => true
|
|
186
185
|
};
|
|
187
186
|
}
|
|
188
187
|
function getPatchOptions(options) {
|
|
@@ -773,11 +772,13 @@ var TailwindcssPatcher = (_class = class {
|
|
|
773
772
|
|
|
774
773
|
|
|
775
774
|
|
|
775
|
+
|
|
776
776
|
constructor(options = {}) {;_class.prototype.__init.call(this);
|
|
777
777
|
this.rawOptions = options;
|
|
778
778
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
779
779
|
this.patchOptions = getPatchOptions(options.patch);
|
|
780
780
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
781
|
+
this.filter = this.patchOptions.filter;
|
|
781
782
|
const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
|
|
782
783
|
_nullishCoalesce(this.patchOptions.packageName, () => ( "tailwindcss")),
|
|
783
784
|
this.patchOptions.resolve
|
|
@@ -866,22 +867,22 @@ var TailwindcssPatcher = (_class = class {
|
|
|
866
867
|
})])
|
|
867
868
|
});
|
|
868
869
|
for (const candidate of candidates) {
|
|
869
|
-
classSet.add(candidate);
|
|
870
|
+
_optionalChain([this, 'access', _34 => _34.filter, 'optionalCall', _35 => _35(candidate)]) && classSet.add(candidate);
|
|
870
871
|
}
|
|
871
872
|
}
|
|
872
873
|
} else {
|
|
873
874
|
const candidates = await extractValidCandidates({
|
|
874
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
875
|
-
css: _optionalChain([v4, 'optionalAccess',
|
|
876
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
875
|
+
base: _optionalChain([v4, 'optionalAccess', _36 => _36.base]),
|
|
876
|
+
css: _optionalChain([v4, 'optionalAccess', _37 => _37.css]),
|
|
877
|
+
sources: _optionalChain([v4, 'optionalAccess', _38 => _38.sources, 'optionalAccess', _39 => _39.map, 'call', _40 => _40((x) => {
|
|
877
878
|
return {
|
|
878
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
879
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _41 => _41.base]))), () => ( _process2.default.cwd())),
|
|
879
880
|
pattern: x.pattern
|
|
880
881
|
};
|
|
881
882
|
})])
|
|
882
883
|
});
|
|
883
884
|
for (const candidate of candidates) {
|
|
884
|
-
classSet.add(candidate);
|
|
885
|
+
_optionalChain([this, 'access', _42 => _42.filter, 'optionalCall', _43 => _43(candidate)]) && classSet.add(candidate);
|
|
885
886
|
}
|
|
886
887
|
}
|
|
887
888
|
} else {
|
|
@@ -890,10 +891,10 @@ var TailwindcssPatcher = (_class = class {
|
|
|
890
891
|
const keys = classCacheMap.keys();
|
|
891
892
|
for (const key of keys) {
|
|
892
893
|
const v = key.toString();
|
|
893
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
894
|
+
if (_optionalChain([output, 'optionalAccess', _44 => _44.removeUniversalSelector]) && v === "*") {
|
|
894
895
|
continue;
|
|
895
896
|
}
|
|
896
|
-
classSet.add(v);
|
|
897
|
+
_optionalChain([this, 'access', _45 => _45.filter, 'optionalCall', _46 => _46(v)]) && classSet.add(v);
|
|
897
898
|
}
|
|
898
899
|
}
|
|
899
900
|
}
|
|
@@ -918,8 +919,8 @@ var TailwindcssPatcher = (_class = class {
|
|
|
918
919
|
}
|
|
919
920
|
return set;
|
|
920
921
|
}
|
|
921
|
-
async extract(
|
|
922
|
-
const { output, tailwindcss } =
|
|
922
|
+
async extract() {
|
|
923
|
+
const { output, tailwindcss } = this.patchOptions;
|
|
923
924
|
if (output && tailwindcss) {
|
|
924
925
|
const { filename, loose } = output;
|
|
925
926
|
if (this.majorVersion === 3 || this.majorVersion === 2) {
|
|
@@ -934,7 +935,10 @@ var TailwindcssPatcher = (_class = class {
|
|
|
934
935
|
await _fsextra2.default.outputJSON(filename, classList, {
|
|
935
936
|
spaces: loose ? 2 : void 0
|
|
936
937
|
});
|
|
937
|
-
return
|
|
938
|
+
return {
|
|
939
|
+
filename,
|
|
940
|
+
classList
|
|
941
|
+
};
|
|
938
942
|
}
|
|
939
943
|
}
|
|
940
944
|
}
|
|
@@ -951,4 +955,6 @@ var TailwindcssPatcher = (_class = class {
|
|
|
951
955
|
|
|
952
956
|
|
|
953
957
|
|
|
954
|
-
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
exports.importMetaUrl = importMetaUrl; exports.defuOverrideArray = defuOverrideArray; exports.logger_default = logger_default; exports.getCacheOptions = getCacheOptions; exports.CacheManager = CacheManager; exports.getPatchOptions = getPatchOptions; exports.monkeyPatchForExposingContextV3 = monkeyPatchForExposingContextV3; exports.monkeyPatchForExposingContextV2 = monkeyPatchForExposingContextV2; exports.monkeyPatchForSupportingCustomUnit = monkeyPatchForSupportingCustomUnit; exports.internalPatch = internalPatch; exports.TailwindcssPatcher = TailwindcssPatcher;
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkL7IXX3YUjs = require('./chunk-L7IXX3YU.js');
|
|
6
8
|
|
|
7
9
|
// src/cli.ts
|
|
8
10
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -14,21 +16,29 @@ function init() {
|
|
|
14
16
|
}
|
|
15
17
|
var cli = _cac2.default.call(void 0, );
|
|
16
18
|
cli.command("install", "patch install").action(() => {
|
|
17
|
-
const twPatcher = new (0,
|
|
18
|
-
patch:
|
|
19
|
+
const twPatcher = new (0, _chunkL7IXX3YUjs.TailwindcssPatcher)({
|
|
20
|
+
patch: _chunkL7IXX3YUjs.getPatchOptions.call(void 0, )
|
|
19
21
|
});
|
|
20
22
|
twPatcher.patch();
|
|
21
23
|
});
|
|
22
24
|
cli.command("init").action(async () => {
|
|
23
25
|
await init();
|
|
24
|
-
|
|
26
|
+
_chunkL7IXX3YUjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
|
|
25
27
|
});
|
|
26
28
|
cli.command("extract").action(async () => {
|
|
27
29
|
const { config } = await _config.getConfig.call(void 0, );
|
|
28
30
|
if (config) {
|
|
29
|
-
const twPatcher = new (0,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const twPatcher = new (0, _chunkL7IXX3YUjs.TailwindcssPatcher)(
|
|
32
|
+
{
|
|
33
|
+
patch: _chunkL7IXX3YUjs.defuOverrideArray.call(void 0, config.patch, {
|
|
34
|
+
resolve: {
|
|
35
|
+
paths: [_chunkL7IXX3YUjs.importMetaUrl]
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
const p = await twPatcher.extract();
|
|
41
|
+
p && _chunkL7IXX3YUjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
|
|
32
42
|
}
|
|
33
43
|
});
|
|
34
44
|
cli.help();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TailwindcssPatcher,
|
|
3
|
+
defuOverrideArray,
|
|
3
4
|
getPatchOptions,
|
|
4
5
|
logger_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JNFI3RBM.mjs";
|
|
6
7
|
|
|
7
8
|
// src/cli.ts
|
|
8
9
|
import process from "node:process";
|
|
@@ -26,9 +27,17 @@ cli.command("init").action(async () => {
|
|
|
26
27
|
cli.command("extract").action(async () => {
|
|
27
28
|
const { config } = await getConfig();
|
|
28
29
|
if (config) {
|
|
29
|
-
const twPatcher = new TailwindcssPatcher(
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const twPatcher = new TailwindcssPatcher(
|
|
31
|
+
{
|
|
32
|
+
patch: defuOverrideArray(config.patch, {
|
|
33
|
+
resolve: {
|
|
34
|
+
paths: [import.meta.url]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const p = await twPatcher.extract();
|
|
40
|
+
p && logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
|
|
32
41
|
}
|
|
33
42
|
});
|
|
34
43
|
cli.help();
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface PatchOptions extends PatchUserConfig {
|
|
|
32
32
|
exportContext?: boolean;
|
|
33
33
|
extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
|
|
34
34
|
};
|
|
35
|
+
filter?: (className: string) => boolean;
|
|
35
36
|
}
|
|
36
37
|
interface InternalPatchOptions extends PatchOptions {
|
|
37
38
|
version?: string;
|
|
@@ -122,6 +123,7 @@ declare class TailwindcssPatcher {
|
|
|
122
123
|
cacheManager: CacheManager;
|
|
123
124
|
packageInfo: PackageInfo;
|
|
124
125
|
majorVersion?: number;
|
|
126
|
+
filter?: (className: string) => boolean;
|
|
125
127
|
constructor(options?: TailwindcssPatcherOptions);
|
|
126
128
|
setCache(set: Set<string>): Promise<string | undefined> | undefined;
|
|
127
129
|
getCache(): Promise<Set<string> | undefined>;
|
|
@@ -132,7 +134,10 @@ declare class TailwindcssPatcher {
|
|
|
132
134
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
133
135
|
*/
|
|
134
136
|
getClassSet(): Promise<Set<string>>;
|
|
135
|
-
extract(
|
|
137
|
+
extract(): Promise<{
|
|
138
|
+
filename: string;
|
|
139
|
+
classList: string[];
|
|
140
|
+
} | undefined>;
|
|
136
141
|
extractValidCandidates: typeof extractValidCandidates;
|
|
137
142
|
}
|
|
138
143
|
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface PatchOptions extends PatchUserConfig {
|
|
|
32
32
|
exportContext?: boolean;
|
|
33
33
|
extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
|
|
34
34
|
};
|
|
35
|
+
filter?: (className: string) => boolean;
|
|
35
36
|
}
|
|
36
37
|
interface InternalPatchOptions extends PatchOptions {
|
|
37
38
|
version?: string;
|
|
@@ -122,6 +123,7 @@ declare class TailwindcssPatcher {
|
|
|
122
123
|
cacheManager: CacheManager;
|
|
123
124
|
packageInfo: PackageInfo;
|
|
124
125
|
majorVersion?: number;
|
|
126
|
+
filter?: (className: string) => boolean;
|
|
125
127
|
constructor(options?: TailwindcssPatcherOptions);
|
|
126
128
|
setCache(set: Set<string>): Promise<string | undefined> | undefined;
|
|
127
129
|
getCache(): Promise<Set<string> | undefined>;
|
|
@@ -132,7 +134,10 @@ declare class TailwindcssPatcher {
|
|
|
132
134
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
133
135
|
*/
|
|
134
136
|
getClassSet(): Promise<Set<string>>;
|
|
135
|
-
extract(
|
|
137
|
+
extract(): Promise<{
|
|
138
|
+
filename: string;
|
|
139
|
+
classList: string[];
|
|
140
|
+
} | undefined>;
|
|
136
141
|
extractValidCandidates: typeof extractValidCandidates;
|
|
137
142
|
}
|
|
138
143
|
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkL7IXX3YUjs = require('./chunk-L7IXX3YU.js');
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
var _config = require('@tailwindcss-mangle/config');
|
|
@@ -21,4 +21,4 @@ var _config = require('@tailwindcss-mangle/config');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.CacheManager =
|
|
24
|
+
exports.CacheManager = _chunkL7IXX3YUjs.CacheManager; exports.TailwindcssPatcher = _chunkL7IXX3YUjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkL7IXX3YUjs.getCacheOptions; exports.internalPatch = _chunkL7IXX3YUjs.internalPatch; exports.logger = _chunkL7IXX3YUjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkL7IXX3YUjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkL7IXX3YUjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkL7IXX3YUjs.monkeyPatchForSupportingCustomUnit;
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
monkeyPatchForExposingContextV2,
|
|
8
8
|
monkeyPatchForExposingContextV3,
|
|
9
9
|
monkeyPatchForSupportingCustomUnit
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JNFI3RBM.mjs";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { defineConfig } from "@tailwindcss-mangle/config";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-patch",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "patch tailwindcss for exposing context and extract classes",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"postcss": "^8.5.2",
|
|
63
63
|
"semver": "^7.7.1",
|
|
64
64
|
"tailwindcss-config": "^1.0.0",
|
|
65
|
-
"@tailwindcss-mangle/config": "^5.0.
|
|
65
|
+
"@tailwindcss-mangle/config": "^5.0.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@tailwindcss/node": "^4.0.6",
|