tailwindcss-patch 6.0.7 → 6.0.8
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-7LD7UWYL.js → chunk-436LRPDX.js} +26 -28
- package/dist/{chunk-4NIV24YC.mjs → chunk-I3NEK7LN.mjs} +12 -14
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -163,12 +163,11 @@ var CacheManager = class {
|
|
|
163
163
|
const data = await _fsextra2.default.readJSON(filename);
|
|
164
164
|
return new Set(_nullishCoalesce(data, () => ( [])));
|
|
165
165
|
}
|
|
166
|
-
} catch (
|
|
167
|
-
logger_default.error(error);
|
|
166
|
+
} catch (e2) {
|
|
168
167
|
try {
|
|
169
168
|
isExisted && await _fsextra2.default.remove(filename);
|
|
170
|
-
} catch (
|
|
171
|
-
logger_default.error(
|
|
169
|
+
} catch (error) {
|
|
170
|
+
logger_default.error(error);
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
return /* @__PURE__ */ new Set();
|
|
@@ -192,6 +191,9 @@ function getPatchOptions(options) {
|
|
|
192
191
|
return defu(
|
|
193
192
|
options,
|
|
194
193
|
{
|
|
194
|
+
output: {
|
|
195
|
+
removeUniversalSelector: true
|
|
196
|
+
},
|
|
195
197
|
basedir: _process2.default.cwd()
|
|
196
198
|
},
|
|
197
199
|
getDefaultPatchOptions()
|
|
@@ -660,7 +662,7 @@ function internalPatch(pkgJsonPath, options) {
|
|
|
660
662
|
Object.assign(_nullishCoalesce(result, () => ( {})), monkeyPatchForSupportingCustomUnit(twDir, defu(options.applyPatches.extendLengthUnits === true ? void 0 : options.applyPatches.extendLengthUnits, {
|
|
661
663
|
overwrite: options.overwrite
|
|
662
664
|
})));
|
|
663
|
-
} catch (
|
|
665
|
+
} catch (e3) {
|
|
664
666
|
}
|
|
665
667
|
}
|
|
666
668
|
return result;
|
|
@@ -782,16 +784,15 @@ var TailwindcssPatcher = (_class = class {
|
|
|
782
784
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
783
785
|
this.patchOptions = getPatchOptions(options.patch);
|
|
784
786
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
785
|
-
this.filter =
|
|
787
|
+
this.filter = function filter(className) {
|
|
788
|
+
if (_optionalChain([this, 'access', _23 => _23.patchOptions, 'access', _24 => _24.output, 'optionalAccess', _25 => _25.removeUniversalSelector]) && className === "*") {
|
|
789
|
+
return false;
|
|
790
|
+
}
|
|
791
|
+
return Boolean(_optionalChain([this, 'access', _26 => _26.patchOptions, 'access', _27 => _27.filter, 'optionalCall', _28 => _28(className)]));
|
|
792
|
+
};
|
|
786
793
|
const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
|
|
787
794
|
_nullishCoalesce(this.patchOptions.packageName, () => ( "tailwindcss")),
|
|
788
795
|
this.patchOptions.resolve
|
|
789
|
-
// defuOverrideArray<PackageResolvingOptions, Partial<PackageResolvingOptions>[]>(
|
|
790
|
-
// this.patchOptions.resolve!,
|
|
791
|
-
// {
|
|
792
|
-
// paths: [import.meta.dirname],
|
|
793
|
-
// },
|
|
794
|
-
// ),
|
|
795
796
|
);
|
|
796
797
|
if (!packageInfo) {
|
|
797
798
|
throw new Error("tailwindcss not found");
|
|
@@ -799,13 +800,13 @@ var TailwindcssPatcher = (_class = class {
|
|
|
799
800
|
if (packageInfo.version) {
|
|
800
801
|
this.majorVersion = Number.parseInt(packageInfo.version[0]);
|
|
801
802
|
}
|
|
802
|
-
if (_optionalChain([this, 'access',
|
|
803
|
+
if (_optionalChain([this, 'access', _29 => _29.patchOptions, 'access', _30 => _30.tailwindcss, 'optionalAccess', _31 => _31.version])) {
|
|
803
804
|
this.majorVersion = this.patchOptions.tailwindcss.version;
|
|
804
805
|
}
|
|
805
806
|
this.packageInfo = packageInfo;
|
|
806
807
|
this.patch = () => {
|
|
807
808
|
try {
|
|
808
|
-
return internalPatch(_optionalChain([this, 'access',
|
|
809
|
+
return internalPatch(_optionalChain([this, 'access', _32 => _32.packageInfo, 'optionalAccess', _33 => _33.packageJsonPath]), this.patchOptions);
|
|
809
810
|
} catch (error) {
|
|
810
811
|
logger_default.error(`patch tailwindcss failed: ${error.message}`);
|
|
811
812
|
}
|
|
@@ -849,7 +850,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
849
850
|
const { output, tailwindcss } = this.patchOptions;
|
|
850
851
|
if (this.majorVersion === 4) {
|
|
851
852
|
const { v4 } = _nullishCoalesce(tailwindcss, () => ( {}));
|
|
852
|
-
if (Array.isArray(_optionalChain([v4, 'optionalAccess',
|
|
853
|
+
if (Array.isArray(_optionalChain([v4, 'optionalAccess', _34 => _34.cssEntries]))) {
|
|
853
854
|
const results = (await Promise.all(
|
|
854
855
|
v4.cssEntries.map(async (x) => {
|
|
855
856
|
if (await _fsextra2.default.exists(x)) {
|
|
@@ -861,32 +862,32 @@ var TailwindcssPatcher = (_class = class {
|
|
|
861
862
|
)).filter((x) => x);
|
|
862
863
|
for (const css of results) {
|
|
863
864
|
const candidates = await extractValidCandidates({
|
|
864
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
865
|
+
base: _optionalChain([v4, 'optionalAccess', _35 => _35.base]),
|
|
865
866
|
css,
|
|
866
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
867
|
+
sources: _optionalChain([v4, 'optionalAccess', _36 => _36.sources, 'optionalAccess', _37 => _37.map, 'call', _38 => _38((x) => {
|
|
867
868
|
return {
|
|
868
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
869
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _39 => _39.base]))), () => ( _process2.default.cwd())),
|
|
869
870
|
pattern: x.pattern
|
|
870
871
|
};
|
|
871
872
|
})])
|
|
872
873
|
});
|
|
873
874
|
for (const candidate of candidates) {
|
|
874
|
-
_optionalChain([this, 'access',
|
|
875
|
+
_optionalChain([this, 'access', _40 => _40.filter, 'optionalCall', _41 => _41(candidate)]) && classSet.add(candidate);
|
|
875
876
|
}
|
|
876
877
|
}
|
|
877
878
|
} else {
|
|
878
879
|
const candidates = await extractValidCandidates({
|
|
879
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
880
|
-
css: _optionalChain([v4, 'optionalAccess',
|
|
881
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
880
|
+
base: _optionalChain([v4, 'optionalAccess', _42 => _42.base]),
|
|
881
|
+
css: _optionalChain([v4, 'optionalAccess', _43 => _43.css]),
|
|
882
|
+
sources: _optionalChain([v4, 'optionalAccess', _44 => _44.sources, 'optionalAccess', _45 => _45.map, 'call', _46 => _46((x) => {
|
|
882
883
|
return {
|
|
883
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
884
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _47 => _47.base]))), () => ( _process2.default.cwd())),
|
|
884
885
|
pattern: x.pattern
|
|
885
886
|
};
|
|
886
887
|
})])
|
|
887
888
|
});
|
|
888
889
|
for (const candidate of candidates) {
|
|
889
|
-
_optionalChain([this, 'access',
|
|
890
|
+
_optionalChain([this, 'access', _48 => _48.filter, 'optionalCall', _49 => _49(candidate)]) && classSet.add(candidate);
|
|
890
891
|
}
|
|
891
892
|
}
|
|
892
893
|
} else {
|
|
@@ -895,10 +896,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
895
896
|
const keys = classCacheMap.keys();
|
|
896
897
|
for (const key of keys) {
|
|
897
898
|
const v = key.toString();
|
|
898
|
-
|
|
899
|
-
continue;
|
|
900
|
-
}
|
|
901
|
-
_optionalChain([this, 'access', _45 => _45.filter, 'optionalCall', _46 => _46(v)]) && classSet.add(v);
|
|
899
|
+
_optionalChain([this, 'access', _50 => _50.filter, 'optionalCall', _51 => _51(v)]) && classSet.add(v);
|
|
902
900
|
}
|
|
903
901
|
}
|
|
904
902
|
}
|
|
@@ -159,12 +159,11 @@ var CacheManager = class {
|
|
|
159
159
|
const data = await fs.readJSON(filename);
|
|
160
160
|
return new Set(data ?? []);
|
|
161
161
|
}
|
|
162
|
-
} catch
|
|
163
|
-
logger_default.error(error);
|
|
162
|
+
} catch {
|
|
164
163
|
try {
|
|
165
164
|
isExisted && await fs.remove(filename);
|
|
166
|
-
} catch (
|
|
167
|
-
logger_default.error(
|
|
165
|
+
} catch (error) {
|
|
166
|
+
logger_default.error(error);
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
return /* @__PURE__ */ new Set();
|
|
@@ -188,6 +187,9 @@ function getPatchOptions(options) {
|
|
|
188
187
|
return defu(
|
|
189
188
|
options,
|
|
190
189
|
{
|
|
190
|
+
output: {
|
|
191
|
+
removeUniversalSelector: true
|
|
192
|
+
},
|
|
191
193
|
basedir: process2.cwd()
|
|
192
194
|
},
|
|
193
195
|
getDefaultPatchOptions()
|
|
@@ -778,16 +780,15 @@ var TailwindcssPatcher = class {
|
|
|
778
780
|
this.cacheOptions = getCacheOptions(options.cache);
|
|
779
781
|
this.patchOptions = getPatchOptions(options.patch);
|
|
780
782
|
this.cacheManager = new CacheManager(this.cacheOptions);
|
|
781
|
-
this.filter =
|
|
783
|
+
this.filter = function filter(className) {
|
|
784
|
+
if (this.patchOptions.output?.removeUniversalSelector && className === "*") {
|
|
785
|
+
return false;
|
|
786
|
+
}
|
|
787
|
+
return Boolean(this.patchOptions.filter?.(className));
|
|
788
|
+
};
|
|
782
789
|
const packageInfo = getPackageInfoSync(
|
|
783
790
|
this.patchOptions.packageName ?? "tailwindcss",
|
|
784
791
|
this.patchOptions.resolve
|
|
785
|
-
// defuOverrideArray<PackageResolvingOptions, Partial<PackageResolvingOptions>[]>(
|
|
786
|
-
// this.patchOptions.resolve!,
|
|
787
|
-
// {
|
|
788
|
-
// paths: [import.meta.dirname],
|
|
789
|
-
// },
|
|
790
|
-
// ),
|
|
791
792
|
);
|
|
792
793
|
if (!packageInfo) {
|
|
793
794
|
throw new Error("tailwindcss not found");
|
|
@@ -891,9 +892,6 @@ var TailwindcssPatcher = class {
|
|
|
891
892
|
const keys = classCacheMap.keys();
|
|
892
893
|
for (const key of keys) {
|
|
893
894
|
const v = key.toString();
|
|
894
|
-
if (output?.removeUniversalSelector && v === "*") {
|
|
895
|
-
continue;
|
|
896
|
-
}
|
|
897
895
|
this.filter?.(v) && classSet.add(v);
|
|
898
896
|
}
|
|
899
897
|
}
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunk436LRPDXjs = require('./chunk-436LRPDX.js');
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -16,29 +16,29 @@ 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, _chunk436LRPDXjs.TailwindcssPatcher)({
|
|
20
|
+
patch: _chunk436LRPDXjs.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
|
+
_chunk436LRPDXjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
|
|
27
27
|
});
|
|
28
28
|
cli.command("extract").action(async () => {
|
|
29
29
|
const { config } = await _config.getConfig.call(void 0, );
|
|
30
30
|
if (config) {
|
|
31
|
-
const twPatcher = new (0,
|
|
31
|
+
const twPatcher = new (0, _chunk436LRPDXjs.TailwindcssPatcher)(
|
|
32
32
|
{
|
|
33
|
-
patch:
|
|
33
|
+
patch: _chunk436LRPDXjs.defuOverrideArray.call(void 0, config.patch, {
|
|
34
34
|
resolve: {
|
|
35
|
-
paths: [
|
|
35
|
+
paths: [_chunk436LRPDXjs.importMetaUrl]
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
);
|
|
40
40
|
const p = await twPatcher.extract();
|
|
41
|
-
p &&
|
|
41
|
+
p && _chunk436LRPDXjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
cli.help();
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk436LRPDXjs = require('./chunk-436LRPDX.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 = _chunk436LRPDXjs.CacheManager; exports.TailwindcssPatcher = _chunk436LRPDXjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunk436LRPDXjs.getCacheOptions; exports.internalPatch = _chunk436LRPDXjs.internalPatch; exports.logger = _chunk436LRPDXjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunk436LRPDXjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunk436LRPDXjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunk436LRPDXjs.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-I3NEK7LN.mjs";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { defineConfig } from "@tailwindcss-mangle/config";
|