tailwindcss-patch 7.1.0 → 7.1.1
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-MRFFSSEO.mjs → chunk-36H7NLND.mjs} +35 -7
- package/dist/{chunk-T7FU63AY.js → chunk-DULFDOL2.js} +36 -8
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
|
@@ -142,26 +142,26 @@ var CacheManager = class {
|
|
|
142
142
|
strategy: "merge"
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
write(data) {
|
|
146
146
|
try {
|
|
147
147
|
const { filename } = this.options;
|
|
148
|
-
|
|
148
|
+
fs.outputJSONSync(filename, [...data]);
|
|
149
149
|
return filename;
|
|
150
150
|
} catch (error) {
|
|
151
151
|
logger_default.error(error);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
read() {
|
|
155
155
|
const { filename } = this.options;
|
|
156
|
-
const isExisted =
|
|
156
|
+
const isExisted = fs.existsSync(filename);
|
|
157
157
|
try {
|
|
158
158
|
if (isExisted) {
|
|
159
|
-
const data =
|
|
159
|
+
const data = fs.readJSONSync(filename);
|
|
160
160
|
return new Set(data ?? []);
|
|
161
161
|
}
|
|
162
162
|
} catch {
|
|
163
163
|
try {
|
|
164
|
-
isExisted &&
|
|
164
|
+
isExisted && fs.removeSync(filename);
|
|
165
165
|
} catch (error) {
|
|
166
166
|
logger_default.error(error);
|
|
167
167
|
}
|
|
@@ -1005,6 +1005,18 @@ var TailwindcssPatcher = class {
|
|
|
1005
1005
|
}
|
|
1006
1006
|
return classSet;
|
|
1007
1007
|
}
|
|
1008
|
+
getClassCacheSetV3() {
|
|
1009
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
1010
|
+
const classCaches = this.getClassCaches();
|
|
1011
|
+
for (const classCacheMap of classCaches) {
|
|
1012
|
+
const keys = classCacheMap.keys();
|
|
1013
|
+
for (const key of keys) {
|
|
1014
|
+
const v = key.toString();
|
|
1015
|
+
this.filter?.(v) && classSet.add(v);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return classSet;
|
|
1019
|
+
}
|
|
1008
1020
|
/**
|
|
1009
1021
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
1010
1022
|
*/
|
|
@@ -1014,7 +1026,23 @@ var TailwindcssPatcher = class {
|
|
|
1014
1026
|
if (cacheStrategy === "overwrite") {
|
|
1015
1027
|
set.size > 0 && this.setCache(set);
|
|
1016
1028
|
} else if (cacheStrategy === "merge") {
|
|
1017
|
-
const cacheSet =
|
|
1029
|
+
const cacheSet = this.getCache();
|
|
1030
|
+
if (cacheSet) {
|
|
1031
|
+
for (const x of cacheSet) {
|
|
1032
|
+
set.add(x);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
this.setCache(set);
|
|
1036
|
+
}
|
|
1037
|
+
return set;
|
|
1038
|
+
}
|
|
1039
|
+
getClassSetV3() {
|
|
1040
|
+
const cacheStrategy = this.cacheOptions.strategy ?? "merge";
|
|
1041
|
+
const set = this.getClassCacheSetV3();
|
|
1042
|
+
if (cacheStrategy === "overwrite") {
|
|
1043
|
+
set.size > 0 && this.setCache(set);
|
|
1044
|
+
} else if (cacheStrategy === "merge") {
|
|
1045
|
+
const cacheSet = this.getCache();
|
|
1018
1046
|
if (cacheSet) {
|
|
1019
1047
|
for (const x of cacheSet) {
|
|
1020
1048
|
set.add(x);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.4.0_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.4.0_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/cjs_shims.js
|
|
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
|
|
|
@@ -146,26 +146,26 @@ var CacheManager = class {
|
|
|
146
146
|
strategy: "merge"
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
write(data) {
|
|
150
150
|
try {
|
|
151
151
|
const { filename } = this.options;
|
|
152
|
-
|
|
152
|
+
_fsextra2.default.outputJSONSync(filename, [...data]);
|
|
153
153
|
return filename;
|
|
154
154
|
} catch (error) {
|
|
155
155
|
logger_default.error(error);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
read() {
|
|
159
159
|
const { filename } = this.options;
|
|
160
|
-
const isExisted =
|
|
160
|
+
const isExisted = _fsextra2.default.existsSync(filename);
|
|
161
161
|
try {
|
|
162
162
|
if (isExisted) {
|
|
163
|
-
const data =
|
|
163
|
+
const data = _fsextra2.default.readJSONSync(filename);
|
|
164
164
|
return new Set(_nullishCoalesce(data, () => ( [])));
|
|
165
165
|
}
|
|
166
166
|
} catch (e2) {
|
|
167
167
|
try {
|
|
168
|
-
isExisted &&
|
|
168
|
+
isExisted && _fsextra2.default.removeSync(filename);
|
|
169
169
|
} catch (error) {
|
|
170
170
|
logger_default.error(error);
|
|
171
171
|
}
|
|
@@ -1009,6 +1009,18 @@ var TailwindcssPatcher = (_class = class {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
return classSet;
|
|
1011
1011
|
}
|
|
1012
|
+
getClassCacheSetV3() {
|
|
1013
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
1014
|
+
const classCaches = this.getClassCaches();
|
|
1015
|
+
for (const classCacheMap of classCaches) {
|
|
1016
|
+
const keys = classCacheMap.keys();
|
|
1017
|
+
for (const key of keys) {
|
|
1018
|
+
const v = key.toString();
|
|
1019
|
+
_optionalChain([this, 'access', _50 => _50.filter, 'optionalCall', _51 => _51(v)]) && classSet.add(v);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return classSet;
|
|
1023
|
+
}
|
|
1012
1024
|
/**
|
|
1013
1025
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
1014
1026
|
*/
|
|
@@ -1018,7 +1030,23 @@ var TailwindcssPatcher = (_class = class {
|
|
|
1018
1030
|
if (cacheStrategy === "overwrite") {
|
|
1019
1031
|
set.size > 0 && this.setCache(set);
|
|
1020
1032
|
} else if (cacheStrategy === "merge") {
|
|
1021
|
-
const cacheSet =
|
|
1033
|
+
const cacheSet = this.getCache();
|
|
1034
|
+
if (cacheSet) {
|
|
1035
|
+
for (const x of cacheSet) {
|
|
1036
|
+
set.add(x);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
this.setCache(set);
|
|
1040
|
+
}
|
|
1041
|
+
return set;
|
|
1042
|
+
}
|
|
1043
|
+
getClassSetV3() {
|
|
1044
|
+
const cacheStrategy = _nullishCoalesce(this.cacheOptions.strategy, () => ( "merge"));
|
|
1045
|
+
const set = this.getClassCacheSetV3();
|
|
1046
|
+
if (cacheStrategy === "overwrite") {
|
|
1047
|
+
set.size > 0 && this.setCache(set);
|
|
1048
|
+
} else if (cacheStrategy === "merge") {
|
|
1049
|
+
const cacheSet = this.getCache();
|
|
1022
1050
|
if (cacheSet) {
|
|
1023
1051
|
for (const x of cacheSet) {
|
|
1024
1052
|
set.add(x);
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkDULFDOL2js = require('./chunk-DULFDOL2.js');
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -16,26 +16,26 @@ function init() {
|
|
|
16
16
|
}
|
|
17
17
|
var cli = _cac2.default.call(void 0, );
|
|
18
18
|
cli.command("install", "patch install").action(() => {
|
|
19
|
-
const twPatcher = new (0,
|
|
20
|
-
patch:
|
|
19
|
+
const twPatcher = new (0, _chunkDULFDOL2js.TailwindcssPatcher)({
|
|
20
|
+
patch: _chunkDULFDOL2js.getPatchOptions.call(void 0, )
|
|
21
21
|
});
|
|
22
22
|
twPatcher.patch();
|
|
23
23
|
});
|
|
24
24
|
cli.command("init").action(async () => {
|
|
25
25
|
await init();
|
|
26
|
-
|
|
26
|
+
_chunkDULFDOL2js.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
|
|
27
27
|
});
|
|
28
28
|
cli.command("extract").option("--css [file]", "css file entries").action(async (options) => {
|
|
29
29
|
const { config } = await _config.getConfig.call(void 0, );
|
|
30
30
|
const file = options.css;
|
|
31
31
|
if (config) {
|
|
32
|
-
const twPatcher = new (0,
|
|
32
|
+
const twPatcher = new (0, _chunkDULFDOL2js.TailwindcssPatcher)(
|
|
33
33
|
{
|
|
34
|
-
patch:
|
|
34
|
+
patch: _chunkDULFDOL2js.defuOverrideArray.call(void 0,
|
|
35
35
|
config.patch,
|
|
36
36
|
{
|
|
37
37
|
resolve: {
|
|
38
|
-
paths: [
|
|
38
|
+
paths: [_chunkDULFDOL2js.importMetaUrl]
|
|
39
39
|
},
|
|
40
40
|
tailwindcss: {
|
|
41
41
|
v4: {
|
|
@@ -47,7 +47,7 @@ cli.command("extract").option("--css [file]", "css file entries").action(async (
|
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
const p = await twPatcher.extract();
|
|
50
|
-
p &&
|
|
50
|
+
p && _chunkDULFDOL2js.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
cli.help();
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -97,8 +97,8 @@ declare class CacheManager {
|
|
|
97
97
|
getOptions(options?: CacheOptions): Required<CacheOptions> & {
|
|
98
98
|
filename: string;
|
|
99
99
|
};
|
|
100
|
-
write(data: Set<string>):
|
|
101
|
-
read():
|
|
100
|
+
write(data: Set<string>): string | undefined;
|
|
101
|
+
read(): Set<string>;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
interface ExtractValidCandidatesOption {
|
|
@@ -118,15 +118,17 @@ declare class TailwindcssPatcher {
|
|
|
118
118
|
majorVersion?: number;
|
|
119
119
|
filter?: (className: string) => boolean;
|
|
120
120
|
constructor(options?: TailwindcssPatcherOptions);
|
|
121
|
-
setCache(set: Set<string>):
|
|
122
|
-
getCache():
|
|
121
|
+
setCache(set: Set<string>): string | undefined;
|
|
122
|
+
getCache(): Set<string>;
|
|
123
123
|
getContexts(): TailwindcssRuntimeContext[];
|
|
124
124
|
getClassCaches(): TailwindcssClassCache[];
|
|
125
125
|
getClassCacheSet(): Promise<Set<string>>;
|
|
126
|
+
getClassCacheSetV3(): Set<string>;
|
|
126
127
|
/**
|
|
127
128
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
128
129
|
*/
|
|
129
130
|
getClassSet(): Promise<Set<string>>;
|
|
131
|
+
getClassSetV3(): Set<string>;
|
|
130
132
|
extract(): Promise<{
|
|
131
133
|
filename: string;
|
|
132
134
|
classList: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -97,8 +97,8 @@ declare class CacheManager {
|
|
|
97
97
|
getOptions(options?: CacheOptions): Required<CacheOptions> & {
|
|
98
98
|
filename: string;
|
|
99
99
|
};
|
|
100
|
-
write(data: Set<string>):
|
|
101
|
-
read():
|
|
100
|
+
write(data: Set<string>): string | undefined;
|
|
101
|
+
read(): Set<string>;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
interface ExtractValidCandidatesOption {
|
|
@@ -118,15 +118,17 @@ declare class TailwindcssPatcher {
|
|
|
118
118
|
majorVersion?: number;
|
|
119
119
|
filter?: (className: string) => boolean;
|
|
120
120
|
constructor(options?: TailwindcssPatcherOptions);
|
|
121
|
-
setCache(set: Set<string>):
|
|
122
|
-
getCache():
|
|
121
|
+
setCache(set: Set<string>): string | undefined;
|
|
122
|
+
getCache(): Set<string>;
|
|
123
123
|
getContexts(): TailwindcssRuntimeContext[];
|
|
124
124
|
getClassCaches(): TailwindcssClassCache[];
|
|
125
125
|
getClassCacheSet(): Promise<Set<string>>;
|
|
126
|
+
getClassCacheSetV3(): Set<string>;
|
|
126
127
|
/**
|
|
127
128
|
* @description 在多个 tailwindcss 上下文时,这个方法将被执行多次,所以策略上应该使用 append
|
|
128
129
|
*/
|
|
129
130
|
getClassSet(): Promise<Set<string>>;
|
|
131
|
+
getClassSetV3(): Set<string>;
|
|
130
132
|
extract(): Promise<{
|
|
131
133
|
filename: string;
|
|
132
134
|
classList: string[];
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkDULFDOL2js = require('./chunk-DULFDOL2.js');
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
var _config = require('@tailwindcss-mangle/config');
|
|
@@ -23,4 +23,4 @@ var _config = require('@tailwindcss-mangle/config');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.CacheManager =
|
|
26
|
+
exports.CacheManager = _chunkDULFDOL2js.CacheManager; exports.TailwindcssPatcher = _chunkDULFDOL2js.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkDULFDOL2js.getCacheOptions; exports.internalPatch = _chunkDULFDOL2js.internalPatch; exports.logger = _chunkDULFDOL2js.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkDULFDOL2js.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkDULFDOL2js.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnitV3 = _chunkDULFDOL2js.monkeyPatchForSupportingCustomUnitV3; exports.monkeyPatchForSupportingCustomUnitV4 = _chunkDULFDOL2js.monkeyPatchForSupportingCustomUnitV4;
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
monkeyPatchForExposingContextV3,
|
|
9
9
|
monkeyPatchForSupportingCustomUnitV3,
|
|
10
10
|
monkeyPatchForSupportingCustomUnitV4
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-36H7NLND.mjs";
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
import { defineConfig } from "@tailwindcss-mangle/config";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-patch",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "patch tailwindcss for exposing context and extract classes",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"@tailwindcss-mangle/config": "^5.1.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@tailwindcss/node": "^4.1.
|
|
69
|
-
"@tailwindcss/oxide": "^4.1.
|
|
70
|
-
"@tailwindcss/postcss": "^4.1.
|
|
71
|
-
"@tailwindcss/vite": "^4.1.
|
|
68
|
+
"@tailwindcss/node": "^4.1.4",
|
|
69
|
+
"@tailwindcss/oxide": "^4.1.4",
|
|
70
|
+
"@tailwindcss/postcss": "^4.1.4",
|
|
71
|
+
"@tailwindcss/vite": "^4.1.4",
|
|
72
72
|
"tailwindcss": "^4.1.1",
|
|
73
73
|
"tailwindcss-3": "npm:tailwindcss@^3",
|
|
74
74
|
"tailwindcss-4": "npm:tailwindcss@^4.1.1"
|