tailwindcss-patch 6.0.1 → 6.0.3
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-U2NQZPXE.mjs → chunk-5K6TRQY5.mjs} +12 -11
- package/dist/{chunk-U3S6WRCP.js → chunk-AT6RYKKS.js} +23 -22
- package/dist/cli.js +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -57,24 +57,22 @@ var CacheManager = class {
|
|
|
57
57
|
const { filename } = this.options;
|
|
58
58
|
await fs.outputJSON(filename, [...data]);
|
|
59
59
|
return filename;
|
|
60
|
-
} catch {
|
|
61
|
-
logger_default.error(
|
|
60
|
+
} catch (error) {
|
|
61
|
+
logger_default.error(error);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
async read() {
|
|
65
65
|
const { filename } = this.options;
|
|
66
|
+
const isExisted = await fs.exists(filename);
|
|
66
67
|
try {
|
|
67
|
-
if (
|
|
68
|
+
if (isExisted) {
|
|
68
69
|
const data = await fs.readJSON(filename);
|
|
69
70
|
return new Set(data);
|
|
70
71
|
}
|
|
71
|
-
} catch {
|
|
72
|
-
logger_default.error(`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} catch {
|
|
76
|
-
logger_default.error(`delete cache file fail! path:${filename}`);
|
|
77
|
-
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
logger_default.error(`path:${filename}`);
|
|
74
|
+
logger_default.error(error);
|
|
75
|
+
isExisted && await fs.remove(filename);
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
};
|
|
@@ -782,6 +780,9 @@ var TailwindcssPatcher = class {
|
|
|
782
780
|
if (packageInfo.version) {
|
|
783
781
|
this.majorVersion = Number.parseInt(packageInfo.version[0]);
|
|
784
782
|
}
|
|
783
|
+
if (this.patchOptions.tailwindcss?.version) {
|
|
784
|
+
this.majorVersion = this.patchOptions.tailwindcss.version;
|
|
785
|
+
}
|
|
785
786
|
this.packageInfo = packageInfo;
|
|
786
787
|
this.patch = () => {
|
|
787
788
|
try {
|
|
@@ -907,7 +908,7 @@ var TailwindcssPatcher = class {
|
|
|
907
908
|
const { output, tailwindcss } = options ?? {};
|
|
908
909
|
if (output && tailwindcss) {
|
|
909
910
|
const { filename, loose } = output;
|
|
910
|
-
if (this.majorVersion === 3) {
|
|
911
|
+
if (this.majorVersion === 3 || this.majorVersion === 2) {
|
|
911
912
|
await processTailwindcss({
|
|
912
913
|
...tailwindcss,
|
|
913
914
|
majorVersion: this.majorVersion
|
|
@@ -61,24 +61,22 @@ var CacheManager = class {
|
|
|
61
61
|
const { filename } = this.options;
|
|
62
62
|
await _fsextra2.default.outputJSON(filename, [...data]);
|
|
63
63
|
return filename;
|
|
64
|
-
} catch (
|
|
65
|
-
logger_default.error(
|
|
64
|
+
} catch (error) {
|
|
65
|
+
logger_default.error(error);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
async read() {
|
|
69
69
|
const { filename } = this.options;
|
|
70
|
+
const isExisted = await _fsextra2.default.exists(filename);
|
|
70
71
|
try {
|
|
71
|
-
if (
|
|
72
|
+
if (isExisted) {
|
|
72
73
|
const data = await _fsextra2.default.readJSON(filename);
|
|
73
74
|
return new Set(data);
|
|
74
75
|
}
|
|
75
|
-
} catch (
|
|
76
|
-
logger_default.error(`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} catch (e4) {
|
|
80
|
-
logger_default.error(`delete cache file fail! path:${filename}`);
|
|
81
|
-
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
logger_default.error(`path:${filename}`);
|
|
78
|
+
logger_default.error(error);
|
|
79
|
+
isExisted && await _fsextra2.default.remove(filename);
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
};
|
|
@@ -658,7 +656,7 @@ function internalPatch(pkgJsonPath, options) {
|
|
|
658
656
|
Object.assign(_nullishCoalesce(result, () => ( {})), monkeyPatchForSupportingCustomUnit(twDir, defu(options.applyPatches.extendLengthUnits === true ? void 0 : options.applyPatches.extendLengthUnits, {
|
|
659
657
|
overwrite: options.overwrite
|
|
660
658
|
})));
|
|
661
|
-
} catch (
|
|
659
|
+
} catch (e2) {
|
|
662
660
|
}
|
|
663
661
|
}
|
|
664
662
|
return result;
|
|
@@ -786,10 +784,13 @@ var TailwindcssPatcher = (_class = class {
|
|
|
786
784
|
if (packageInfo.version) {
|
|
787
785
|
this.majorVersion = Number.parseInt(packageInfo.version[0]);
|
|
788
786
|
}
|
|
787
|
+
if (_optionalChain([this, 'access', _23 => _23.patchOptions, 'access', _24 => _24.tailwindcss, 'optionalAccess', _25 => _25.version])) {
|
|
788
|
+
this.majorVersion = this.patchOptions.tailwindcss.version;
|
|
789
|
+
}
|
|
789
790
|
this.packageInfo = packageInfo;
|
|
790
791
|
this.patch = () => {
|
|
791
792
|
try {
|
|
792
|
-
return internalPatch(_optionalChain([this, 'access',
|
|
793
|
+
return internalPatch(_optionalChain([this, 'access', _26 => _26.packageInfo, 'optionalAccess', _27 => _27.packageJsonPath]), this.patchOptions);
|
|
793
794
|
} catch (error) {
|
|
794
795
|
logger_default.error(`patch tailwindcss failed: ${error.message}`);
|
|
795
796
|
}
|
|
@@ -833,7 +834,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
833
834
|
const { output, tailwindcss } = this.patchOptions;
|
|
834
835
|
if (this.majorVersion === 4) {
|
|
835
836
|
const { v4 } = _nullishCoalesce(tailwindcss, () => ( {}));
|
|
836
|
-
if (Array.isArray(_optionalChain([v4, 'optionalAccess',
|
|
837
|
+
if (Array.isArray(_optionalChain([v4, 'optionalAccess', _28 => _28.cssEntries]))) {
|
|
837
838
|
const results = (await Promise.all(
|
|
838
839
|
v4.cssEntries.map(async (x) => {
|
|
839
840
|
if (await _fsextra2.default.exists(x)) {
|
|
@@ -845,11 +846,11 @@ var TailwindcssPatcher = (_class = class {
|
|
|
845
846
|
)).filter((x) => x);
|
|
846
847
|
for (const css of results) {
|
|
847
848
|
const candidates = await extractValidCandidates({
|
|
848
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
849
|
+
base: _optionalChain([v4, 'optionalAccess', _29 => _29.base]),
|
|
849
850
|
css,
|
|
850
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
851
|
+
sources: _optionalChain([v4, 'optionalAccess', _30 => _30.sources, 'optionalAccess', _31 => _31.map, 'call', _32 => _32((x) => {
|
|
851
852
|
return {
|
|
852
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
853
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _33 => _33.base]))), () => ( _process2.default.cwd())),
|
|
853
854
|
pattern: x.pattern
|
|
854
855
|
};
|
|
855
856
|
})])
|
|
@@ -860,11 +861,11 @@ var TailwindcssPatcher = (_class = class {
|
|
|
860
861
|
}
|
|
861
862
|
} else {
|
|
862
863
|
const candidates = await extractValidCandidates({
|
|
863
|
-
base: _optionalChain([v4, 'optionalAccess',
|
|
864
|
-
css: _optionalChain([v4, 'optionalAccess',
|
|
865
|
-
sources: _optionalChain([v4, 'optionalAccess',
|
|
864
|
+
base: _optionalChain([v4, 'optionalAccess', _34 => _34.base]),
|
|
865
|
+
css: _optionalChain([v4, 'optionalAccess', _35 => _35.css]),
|
|
866
|
+
sources: _optionalChain([v4, 'optionalAccess', _36 => _36.sources, 'optionalAccess', _37 => _37.map, 'call', _38 => _38((x) => {
|
|
866
867
|
return {
|
|
867
|
-
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess',
|
|
868
|
+
base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _39 => _39.base]))), () => ( _process2.default.cwd())),
|
|
868
869
|
pattern: x.pattern
|
|
869
870
|
};
|
|
870
871
|
})])
|
|
@@ -879,7 +880,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
879
880
|
const keys = classCacheMap.keys();
|
|
880
881
|
for (const key of keys) {
|
|
881
882
|
const v = key.toString();
|
|
882
|
-
if (_optionalChain([output, 'optionalAccess',
|
|
883
|
+
if (_optionalChain([output, 'optionalAccess', _40 => _40.removeUniversalSelector]) && v === "*") {
|
|
883
884
|
continue;
|
|
884
885
|
}
|
|
885
886
|
classSet.add(v);
|
|
@@ -911,7 +912,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
911
912
|
const { output, tailwindcss } = _nullishCoalesce(options, () => ( {}));
|
|
912
913
|
if (output && tailwindcss) {
|
|
913
914
|
const { filename, loose } = output;
|
|
914
|
-
if (this.majorVersion === 3) {
|
|
915
|
+
if (this.majorVersion === 3 || this.majorVersion === 2) {
|
|
915
916
|
await processTailwindcss({
|
|
916
917
|
...tailwindcss,
|
|
917
918
|
majorVersion: this.majorVersion
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkAT6RYKKSjs = require('./chunk-AT6RYKKS.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, _chunkAT6RYKKSjs.TailwindcssPatcher)({
|
|
18
|
+
patch: _chunkAT6RYKKSjs.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
|
+
_chunkAT6RYKKSjs.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, _chunkAT6RYKKSjs.TailwindcssPatcher)();
|
|
30
30
|
const p = await twPatcher.extract(config.patch);
|
|
31
|
-
|
|
31
|
+
_chunkAT6RYKKSjs.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PatchUserConfig } from '@tailwindcss-mangle/config';
|
|
2
|
-
export { defineConfig } from '@tailwindcss-mangle/config';
|
|
2
|
+
export { TailwindcssUserConfig, defineConfig } from '@tailwindcss-mangle/config';
|
|
3
3
|
import { PackageJson } from 'pkg-types';
|
|
4
4
|
import { Node, Rule } from 'postcss';
|
|
5
5
|
import { Config } from 'tailwindcss';
|
|
@@ -7,6 +7,7 @@ import { GlobEntry } from '@tailwindcss/oxide';
|
|
|
7
7
|
import * as consola from 'consola';
|
|
8
8
|
|
|
9
9
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
10
|
+
|
|
10
11
|
interface PackageInfo {
|
|
11
12
|
name: string;
|
|
12
13
|
version: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PatchUserConfig } from '@tailwindcss-mangle/config';
|
|
2
|
-
export { defineConfig } from '@tailwindcss-mangle/config';
|
|
2
|
+
export { TailwindcssUserConfig, defineConfig } from '@tailwindcss-mangle/config';
|
|
3
3
|
import { PackageJson } from 'pkg-types';
|
|
4
4
|
import { Node, Rule } from 'postcss';
|
|
5
5
|
import { Config } from 'tailwindcss';
|
|
@@ -7,6 +7,7 @@ import { GlobEntry } from '@tailwindcss/oxide';
|
|
|
7
7
|
import * as consola from 'consola';
|
|
8
8
|
|
|
9
9
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
10
|
+
|
|
10
11
|
interface PackageInfo {
|
|
11
12
|
name: string;
|
|
12
13
|
version: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkAT6RYKKSjs = require('./chunk-AT6RYKKS.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 = _chunkAT6RYKKSjs.CacheManager; exports.TailwindcssPatcher = _chunkAT6RYKKSjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkAT6RYKKSjs.getCacheOptions; exports.internalPatch = _chunkAT6RYKKSjs.internalPatch; exports.logger = _chunkAT6RYKKSjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkAT6RYKKSjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkAT6RYKKSjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkAT6RYKKSjs.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-5K6TRQY5.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.3",
|
|
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.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@tailwindcss/node": "^4.0.6",
|