tailwindcss-patch 6.0.3 → 6.0.5
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-5K6TRQY5.mjs → chunk-OTEJWDA3.mjs} +18 -5
- package/dist/{chunk-AT6RYKKS.js → chunk-PWCT7HFH.js} +23 -10
- package/dist/cli.js +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -173,11 +173,13 @@ var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
|
173
173
|
// src/defaults.ts
|
|
174
174
|
function getDefaultPatchOptions() {
|
|
175
175
|
return {
|
|
176
|
+
packageName: "tailwindcss",
|
|
176
177
|
applyPatches: {
|
|
177
178
|
exportContext: true,
|
|
178
179
|
extendLengthUnits: false
|
|
179
180
|
},
|
|
180
|
-
overwrite: true
|
|
181
|
+
overwrite: true,
|
|
182
|
+
filter: () => true
|
|
181
183
|
};
|
|
182
184
|
}
|
|
183
185
|
function getPatchOptions(options) {
|
|
@@ -768,12 +770,23 @@ var TailwindcssPatcher = class {
|
|
|
768
770
|
cacheManager;
|
|
769
771
|
packageInfo;
|
|
770
772
|
majorVersion;
|
|
773
|
+
filter;
|
|
771
774
|
constructor(options = {}) {
|
|
772
775
|
this.rawOptions = options;
|
|
773
776
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
774
777
|
this.patchOptions = getPatchOptions(options.patch);
|
|
775
778
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
776
|
-
|
|
779
|
+
this.filter = this.patchOptions.filter;
|
|
780
|
+
const packageInfo = getPackageInfoSync(
|
|
781
|
+
this.patchOptions.packageName ?? "tailwindcss",
|
|
782
|
+
this.patchOptions.resolve
|
|
783
|
+
// defuOverrideArray<PackageResolvingOptions, Partial<PackageResolvingOptions>[]>(
|
|
784
|
+
// this.patchOptions.resolve!,
|
|
785
|
+
// {
|
|
786
|
+
// paths: [import.meta.dirname],
|
|
787
|
+
// },
|
|
788
|
+
// ),
|
|
789
|
+
);
|
|
777
790
|
if (!packageInfo) {
|
|
778
791
|
throw new Error("tailwindcss not found");
|
|
779
792
|
}
|
|
@@ -852,7 +865,7 @@ var TailwindcssPatcher = class {
|
|
|
852
865
|
})
|
|
853
866
|
});
|
|
854
867
|
for (const candidate of candidates) {
|
|
855
|
-
classSet.add(candidate);
|
|
868
|
+
this.filter?.(candidate) && classSet.add(candidate);
|
|
856
869
|
}
|
|
857
870
|
}
|
|
858
871
|
} else {
|
|
@@ -867,7 +880,7 @@ var TailwindcssPatcher = class {
|
|
|
867
880
|
})
|
|
868
881
|
});
|
|
869
882
|
for (const candidate of candidates) {
|
|
870
|
-
classSet.add(candidate);
|
|
883
|
+
this.filter?.(candidate) && classSet.add(candidate);
|
|
871
884
|
}
|
|
872
885
|
}
|
|
873
886
|
} else {
|
|
@@ -879,7 +892,7 @@ var TailwindcssPatcher = class {
|
|
|
879
892
|
if (output?.removeUniversalSelector && v === "*") {
|
|
880
893
|
continue;
|
|
881
894
|
}
|
|
882
|
-
classSet.add(v);
|
|
895
|
+
this.filter?.(v) && classSet.add(v);
|
|
883
896
|
}
|
|
884
897
|
}
|
|
885
898
|
}
|
|
@@ -177,11 +177,13 @@ var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
|
|
|
177
177
|
// src/defaults.ts
|
|
178
178
|
function getDefaultPatchOptions() {
|
|
179
179
|
return {
|
|
180
|
+
packageName: "tailwindcss",
|
|
180
181
|
applyPatches: {
|
|
181
182
|
exportContext: true,
|
|
182
183
|
extendLengthUnits: false
|
|
183
184
|
},
|
|
184
|
-
overwrite: true
|
|
185
|
+
overwrite: true,
|
|
186
|
+
filter: () => true
|
|
185
187
|
};
|
|
186
188
|
}
|
|
187
189
|
function getPatchOptions(options) {
|
|
@@ -772,12 +774,23 @@ var TailwindcssPatcher = (_class = class {
|
|
|
772
774
|
|
|
773
775
|
|
|
774
776
|
|
|
777
|
+
|
|
775
778
|
constructor(options = {}) {;_class.prototype.__init.call(this);
|
|
776
779
|
this.rawOptions = options;
|
|
777
780
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
778
781
|
this.patchOptions = getPatchOptions(options.patch);
|
|
779
782
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
780
|
-
|
|
783
|
+
this.filter = this.patchOptions.filter;
|
|
784
|
+
const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
|
|
785
|
+
_nullishCoalesce(this.patchOptions.packageName, () => ( "tailwindcss")),
|
|
786
|
+
this.patchOptions.resolve
|
|
787
|
+
// defuOverrideArray<PackageResolvingOptions, Partial<PackageResolvingOptions>[]>(
|
|
788
|
+
// this.patchOptions.resolve!,
|
|
789
|
+
// {
|
|
790
|
+
// paths: [import.meta.dirname],
|
|
791
|
+
// },
|
|
792
|
+
// ),
|
|
793
|
+
);
|
|
781
794
|
if (!packageInfo) {
|
|
782
795
|
throw new Error("tailwindcss not found");
|
|
783
796
|
}
|
|
@@ -856,22 +869,22 @@ var TailwindcssPatcher = (_class = class {
|
|
|
856
869
|
})])
|
|
857
870
|
});
|
|
858
871
|
for (const candidate of candidates) {
|
|
859
|
-
classSet.add(candidate);
|
|
872
|
+
_optionalChain([this, 'access', _34 => _34.filter, 'optionalCall', _35 => _35(candidate)]) && classSet.add(candidate);
|
|
860
873
|
}
|
|
861
874
|
}
|
|
862
875
|
} else {
|
|
863
876
|
const candidates = await extractValidCandidates({
|
|
864
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
865
|
-
css: _optionalChain([v4, 'optionalAccess',
|
|
866
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
877
|
+
base: _optionalChain([v4, 'optionalAccess', _36 => _36.base]),
|
|
878
|
+
css: _optionalChain([v4, 'optionalAccess', _37 => _37.css]),
|
|
879
|
+
sources: _optionalChain([v4, 'optionalAccess', _38 => _38.sources, 'optionalAccess', _39 => _39.map, 'call', _40 => _40((x) => {
|
|
867
880
|
return {
|
|
868
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
881
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _41 => _41.base]))), () => ( _process2.default.cwd())),
|
|
869
882
|
pattern: x.pattern
|
|
870
883
|
};
|
|
871
884
|
})])
|
|
872
885
|
});
|
|
873
886
|
for (const candidate of candidates) {
|
|
874
|
-
classSet.add(candidate);
|
|
887
|
+
_optionalChain([this, 'access', _42 => _42.filter, 'optionalCall', _43 => _43(candidate)]) && classSet.add(candidate);
|
|
875
888
|
}
|
|
876
889
|
}
|
|
877
890
|
} else {
|
|
@@ -880,10 +893,10 @@ var TailwindcssPatcher = (_class = class {
|
|
|
880
893
|
const keys = classCacheMap.keys();
|
|
881
894
|
for (const key of keys) {
|
|
882
895
|
const v = key.toString();
|
|
883
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
896
|
+
if (_optionalChain([output, 'optionalAccess', _44 => _44.removeUniversalSelector]) && v === "*") {
|
|
884
897
|
continue;
|
|
885
898
|
}
|
|
886
|
-
classSet.add(v);
|
|
899
|
+
_optionalChain([this, 'access', _45 => _45.filter, 'optionalCall', _46 => _46(v)]) && classSet.add(v);
|
|
887
900
|
}
|
|
888
901
|
}
|
|
889
902
|
}
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkPWCT7HFHjs = require('./chunk-PWCT7HFH.js');
|
|
6
6
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -14,21 +14,21 @@ function init() {
|
|
|
14
14
|
}
|
|
15
15
|
var cli = _cac2.default.call(void 0, );
|
|
16
16
|
cli.command("install", "patch install").action(() => {
|
|
17
|
-
const twPatcher = new (0,
|
|
18
|
-
patch:
|
|
17
|
+
const twPatcher = new (0, _chunkPWCT7HFHjs.TailwindcssPatcher)({
|
|
18
|
+
patch: _chunkPWCT7HFHjs.getPatchOptions.call(void 0, )
|
|
19
19
|
});
|
|
20
20
|
twPatcher.patch();
|
|
21
21
|
});
|
|
22
22
|
cli.command("init").action(async () => {
|
|
23
23
|
await init();
|
|
24
|
-
|
|
24
|
+
_chunkPWCT7HFHjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
|
|
25
25
|
});
|
|
26
26
|
cli.command("extract").action(async () => {
|
|
27
27
|
const { config } = await _config.getConfig.call(void 0, );
|
|
28
28
|
if (config) {
|
|
29
|
-
const twPatcher = new (0,
|
|
29
|
+
const twPatcher = new (0, _chunkPWCT7HFHjs.TailwindcssPatcher)();
|
|
30
30
|
const p = await twPatcher.extract(config.patch);
|
|
31
|
-
|
|
31
|
+
_chunkPWCT7HFHjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
cli.help();
|
package/dist/cli.mjs
CHANGED
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>;
|
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>;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkPWCT7HFHjs = require('./chunk-PWCT7HFH.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 = _chunkPWCT7HFHjs.CacheManager; exports.TailwindcssPatcher = _chunkPWCT7HFHjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkPWCT7HFHjs.getCacheOptions; exports.internalPatch = _chunkPWCT7HFHjs.internalPatch; exports.logger = _chunkPWCT7HFHjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkPWCT7HFHjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkPWCT7HFHjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkPWCT7HFHjs.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-OTEJWDA3.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.5",
|
|
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.2"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@tailwindcss/node": "^4.0.6",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@tailwindcss/vite": "^4.0.6",
|
|
72
72
|
"tailwindcss": "^4.0.6",
|
|
73
73
|
"tailwindcss-3": "npm:tailwindcss@^3",
|
|
74
|
-
"tailwindcss-4": "npm:tailwindcss@^4"
|
|
74
|
+
"tailwindcss-4": "npm:tailwindcss@^4.0.6"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"dev": "tsup --watch --sourcemap",
|