tailwindcss-patch 6.0.4 → 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.
@@ -178,7 +178,8 @@ function getDefaultPatchOptions() {
178
178
  exportContext: true,
179
179
  extendLengthUnits: false
180
180
  },
181
- overwrite: true
181
+ overwrite: true,
182
+ filter: () => true
182
183
  };
183
184
  }
184
185
  function getPatchOptions(options) {
@@ -769,11 +770,13 @@ var TailwindcssPatcher = class {
769
770
  cacheManager;
770
771
  packageInfo;
771
772
  majorVersion;
773
+ filter;
772
774
  constructor(options = {}) {
773
775
  this.rawOptions = options;
774
776
  this.cacheOptions = getCacheOptions(options.cache);
775
777
  this.patchOptions = getPatchOptions(options.patch);
776
778
  this.cacheManager = new CacheManager(this.cacheOptions);
779
+ this.filter = this.patchOptions.filter;
777
780
  const packageInfo = getPackageInfoSync(
778
781
  this.patchOptions.packageName ?? "tailwindcss",
779
782
  this.patchOptions.resolve
@@ -862,7 +865,7 @@ var TailwindcssPatcher = class {
862
865
  })
863
866
  });
864
867
  for (const candidate of candidates) {
865
- classSet.add(candidate);
868
+ this.filter?.(candidate) && classSet.add(candidate);
866
869
  }
867
870
  }
868
871
  } else {
@@ -877,7 +880,7 @@ var TailwindcssPatcher = class {
877
880
  })
878
881
  });
879
882
  for (const candidate of candidates) {
880
- classSet.add(candidate);
883
+ this.filter?.(candidate) && classSet.add(candidate);
881
884
  }
882
885
  }
883
886
  } else {
@@ -889,7 +892,7 @@ var TailwindcssPatcher = class {
889
892
  if (output?.removeUniversalSelector && v === "*") {
890
893
  continue;
891
894
  }
892
- classSet.add(v);
895
+ this.filter?.(v) && classSet.add(v);
893
896
  }
894
897
  }
895
898
  }
@@ -182,7 +182,8 @@ function getDefaultPatchOptions() {
182
182
  exportContext: true,
183
183
  extendLengthUnits: false
184
184
  },
185
- overwrite: true
185
+ overwrite: true,
186
+ filter: () => true
186
187
  };
187
188
  }
188
189
  function getPatchOptions(options) {
@@ -773,11 +774,13 @@ var TailwindcssPatcher = (_class = class {
773
774
 
774
775
 
775
776
 
777
+
776
778
  constructor(options = {}) {;_class.prototype.__init.call(this);
777
779
  this.rawOptions = options;
778
780
  this.cacheOptions = getCacheOptions(options.cache);
779
781
  this.patchOptions = getPatchOptions(options.patch);
780
782
  this.cacheManager = new CacheManager(this.cacheOptions);
783
+ this.filter = this.patchOptions.filter;
781
784
  const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
782
785
  _nullishCoalesce(this.patchOptions.packageName, () => ( "tailwindcss")),
783
786
  this.patchOptions.resolve
@@ -866,22 +869,22 @@ var TailwindcssPatcher = (_class = class {
866
869
  })])
867
870
  });
868
871
  for (const candidate of candidates) {
869
- classSet.add(candidate);
872
+ _optionalChain([this, 'access', _34 => _34.filter, 'optionalCall', _35 => _35(candidate)]) && classSet.add(candidate);
870
873
  }
871
874
  }
872
875
  } else {
873
876
  const candidates = await extractValidCandidates({
874
- base: _optionalChain([v4, 'optionalAccess', _34 => _34.base]),
875
- css: _optionalChain([v4, 'optionalAccess', _35 => _35.css]),
876
- sources: _optionalChain([v4, 'optionalAccess', _36 => _36.sources, 'optionalAccess', _37 => _37.map, 'call', _38 => _38((x) => {
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) => {
877
880
  return {
878
- base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _39 => _39.base]))), () => ( _process2.default.cwd())),
881
+ base: _nullishCoalesce(_nullishCoalesce(x.base, () => ( _optionalChain([v4, 'optionalAccess', _41 => _41.base]))), () => ( _process2.default.cwd())),
879
882
  pattern: x.pattern
880
883
  };
881
884
  })])
882
885
  });
883
886
  for (const candidate of candidates) {
884
- classSet.add(candidate);
887
+ _optionalChain([this, 'access', _42 => _42.filter, 'optionalCall', _43 => _43(candidate)]) && classSet.add(candidate);
885
888
  }
886
889
  }
887
890
  } else {
@@ -890,10 +893,10 @@ var TailwindcssPatcher = (_class = class {
890
893
  const keys = classCacheMap.keys();
891
894
  for (const key of keys) {
892
895
  const v = key.toString();
893
- if (_optionalChain([output, 'optionalAccess', _40 => _40.removeUniversalSelector]) && v === "*") {
896
+ if (_optionalChain([output, 'optionalAccess', _44 => _44.removeUniversalSelector]) && v === "*") {
894
897
  continue;
895
898
  }
896
- classSet.add(v);
899
+ _optionalChain([this, 'access', _45 => _45.filter, 'optionalCall', _46 => _46(v)]) && classSet.add(v);
897
900
  }
898
901
  }
899
902
  }
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkR73U6A56js = require('./chunk-R73U6A56.js');
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, _chunkR73U6A56js.TailwindcssPatcher)({
18
- patch: _chunkR73U6A56js.getPatchOptions.call(void 0, )
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
- _chunkR73U6A56js.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
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, _chunkR73U6A56js.TailwindcssPatcher)();
29
+ const twPatcher = new (0, _chunkPWCT7HFHjs.TailwindcssPatcher)();
30
30
  const p = await twPatcher.extract(config.patch);
31
- _chunkR73U6A56js.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
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
@@ -2,7 +2,7 @@ import {
2
2
  TailwindcssPatcher,
3
3
  getPatchOptions,
4
4
  logger_default
5
- } from "./chunk-X2JGSXYF.mjs";
5
+ } from "./chunk-OTEJWDA3.mjs";
6
6
 
7
7
  // src/cli.ts
8
8
  import process from "node:process";
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 _chunkR73U6A56js = require('./chunk-R73U6A56.js');
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 = _chunkR73U6A56js.CacheManager; exports.TailwindcssPatcher = _chunkR73U6A56js.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkR73U6A56js.getCacheOptions; exports.internalPatch = _chunkR73U6A56js.internalPatch; exports.logger = _chunkR73U6A56js.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkR73U6A56js.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkR73U6A56js.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkR73U6A56js.monkeyPatchForSupportingCustomUnit;
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-X2JGSXYF.mjs";
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.4",
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",