tailwindcss-patch 6.0.1 → 6.0.2

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.
@@ -782,6 +782,9 @@ var TailwindcssPatcher = class {
782
782
  if (packageInfo.version) {
783
783
  this.majorVersion = Number.parseInt(packageInfo.version[0]);
784
784
  }
785
+ if (this.patchOptions.tailwindcss?.version) {
786
+ this.majorVersion = this.patchOptions.tailwindcss.version;
787
+ }
785
788
  this.packageInfo = packageInfo;
786
789
  this.patch = () => {
787
790
  try {
@@ -786,10 +786,13 @@ var TailwindcssPatcher = (_class = class {
786
786
  if (packageInfo.version) {
787
787
  this.majorVersion = Number.parseInt(packageInfo.version[0]);
788
788
  }
789
+ if (_optionalChain([this, 'access', _23 => _23.patchOptions, 'access', _24 => _24.tailwindcss, 'optionalAccess', _25 => _25.version])) {
790
+ this.majorVersion = this.patchOptions.tailwindcss.version;
791
+ }
789
792
  this.packageInfo = packageInfo;
790
793
  this.patch = () => {
791
794
  try {
792
- return internalPatch(_optionalChain([this, 'access', _23 => _23.packageInfo, 'optionalAccess', _24 => _24.packageJsonPath]), this.patchOptions);
795
+ return internalPatch(_optionalChain([this, 'access', _26 => _26.packageInfo, 'optionalAccess', _27 => _27.packageJsonPath]), this.patchOptions);
793
796
  } catch (error) {
794
797
  logger_default.error(`patch tailwindcss failed: ${error.message}`);
795
798
  }
@@ -833,7 +836,7 @@ var TailwindcssPatcher = (_class = class {
833
836
  const { output, tailwindcss } = this.patchOptions;
834
837
  if (this.majorVersion === 4) {
835
838
  const { v4 } = _nullishCoalesce(tailwindcss, () => ( {}));
836
- if (Array.isArray(_optionalChain([v4, 'optionalAccess', _25 => _25.cssEntries]))) {
839
+ if (Array.isArray(_optionalChain([v4, 'optionalAccess', _28 => _28.cssEntries]))) {
837
840
  const results = (await Promise.all(
838
841
  v4.cssEntries.map(async (x) => {
839
842
  if (await _fsextra2.default.exists(x)) {
@@ -845,11 +848,11 @@ var TailwindcssPatcher = (_class = class {
845
848
  )).filter((x) => x);
846
849
  for (const css of results) {
847
850
  const candidates = await extractValidCandidates({
848
- base: _optionalChain([v4, 'optionalAccess', _26 => _26.base]),
851
+ base: _optionalChain([v4, 'optionalAccess', _29 => _29.base]),
849
852
  css,
850
- sources: _optionalChain([v4, 'optionalAccess', _27 => _27.sources, 'optionalAccess', _28 => _28.map, 'call', _29 => _29((x) => {
853
+ sources: _optionalChain([v4, 'optionalAccess', _30 => _30.sources, 'optionalAccess', _31 => _31.map, 'call', _32 => _32((x) => {
851
854
  return {
852
- base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _30 => _30.base]))), () => ( _process2.default.cwd())),
855
+ base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _33 => _33.base]))), () => ( _process2.default.cwd())),
853
856
  pattern: x.pattern
854
857
  };
855
858
  })])
@@ -860,11 +863,11 @@ var TailwindcssPatcher = (_class = class {
860
863
  }
861
864
  } else {
862
865
  const candidates = await extractValidCandidates({
863
- base: _optionalChain([v4, 'optionalAccess', _31 => _31.base]),
864
- css: _optionalChain([v4, 'optionalAccess', _32 => _32.css]),
865
- sources: _optionalChain([v4, 'optionalAccess', _33 => _33.sources, 'optionalAccess', _34 => _34.map, 'call', _35 => _35((x) => {
866
+ base: _optionalChain([v4, 'optionalAccess', _34 => _34.base]),
867
+ css: _optionalChain([v4, 'optionalAccess', _35 => _35.css]),
868
+ sources: _optionalChain([v4, 'optionalAccess', _36 => _36.sources, 'optionalAccess', _37 => _37.map, 'call', _38 => _38((x) => {
866
869
  return {
867
- base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _36 => _36.base]))), () => ( _process2.default.cwd())),
870
+ base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _39 => _39.base]))), () => ( _process2.default.cwd())),
868
871
  pattern: x.pattern
869
872
  };
870
873
  })])
@@ -879,7 +882,7 @@ var TailwindcssPatcher = (_class = class {
879
882
  const keys = classCacheMap.keys();
880
883
  for (const key of keys) {
881
884
  const v = key.toString();
882
- if (_optionalChain([output, 'optionalAccess', _37 => _37.removeUniversalSelector]) && v === "*") {
885
+ if (_optionalChain([output, 'optionalAccess', _40 => _40.removeUniversalSelector]) && v === "*") {
883
886
  continue;
884
887
  }
885
888
  classSet.add(v);
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkU3S6WRCPjs = require('./chunk-U3S6WRCP.js');
5
+ var _chunkS6WAH32Wjs = require('./chunk-S6WAH32W.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, _chunkU3S6WRCPjs.TailwindcssPatcher)({
18
- patch: _chunkU3S6WRCPjs.getPatchOptions.call(void 0, )
17
+ const twPatcher = new (0, _chunkS6WAH32Wjs.TailwindcssPatcher)({
18
+ patch: _chunkS6WAH32Wjs.getPatchOptions.call(void 0, )
19
19
  });
20
20
  twPatcher.patch();
21
21
  });
22
22
  cli.command("init").action(async () => {
23
23
  await init();
24
- _chunkU3S6WRCPjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
24
+ _chunkS6WAH32Wjs.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, _chunkU3S6WRCPjs.TailwindcssPatcher)();
29
+ const twPatcher = new (0, _chunkS6WAH32Wjs.TailwindcssPatcher)();
30
30
  const p = await twPatcher.extract(config.patch);
31
- _chunkU3S6WRCPjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
31
+ _chunkS6WAH32Wjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
32
32
  }
33
33
  });
34
34
  cli.help();
package/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  TailwindcssPatcher,
3
3
  getPatchOptions,
4
4
  logger_default
5
- } from "./chunk-U2NQZPXE.mjs";
5
+ } from "./chunk-NHBD2ICP.mjs";
6
6
 
7
7
  // src/cli.ts
8
8
  import process from "node:process";
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 _chunkU3S6WRCPjs = require('./chunk-U3S6WRCP.js');
10
+ var _chunkS6WAH32Wjs = require('./chunk-S6WAH32W.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 = _chunkU3S6WRCPjs.CacheManager; exports.TailwindcssPatcher = _chunkU3S6WRCPjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkU3S6WRCPjs.getCacheOptions; exports.internalPatch = _chunkU3S6WRCPjs.internalPatch; exports.logger = _chunkU3S6WRCPjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkU3S6WRCPjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkU3S6WRCPjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkU3S6WRCPjs.monkeyPatchForSupportingCustomUnit;
24
+ exports.CacheManager = _chunkS6WAH32Wjs.CacheManager; exports.TailwindcssPatcher = _chunkS6WAH32Wjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkS6WAH32Wjs.getCacheOptions; exports.internalPatch = _chunkS6WAH32Wjs.internalPatch; exports.logger = _chunkS6WAH32Wjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkS6WAH32Wjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkS6WAH32Wjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkS6WAH32Wjs.monkeyPatchForSupportingCustomUnit;
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  monkeyPatchForExposingContextV2,
8
8
  monkeyPatchForExposingContextV3,
9
9
  monkeyPatchForSupportingCustomUnit
10
- } from "./chunk-U2NQZPXE.mjs";
10
+ } from "./chunk-NHBD2ICP.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.1",
3
+ "version": "6.0.2",
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.0"
65
+ "@tailwindcss-mangle/config": "^5.0.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@tailwindcss/node": "^4.0.6",