tailwindcss-patch 6.0.2 → 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.
@@ -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("write cache file fail!");
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 (await fs.exists(filename)) {
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(`parse cache content fail! path:${filename}`);
73
- try {
74
- fs.unlinkSync(filename);
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
  };
@@ -910,7 +908,7 @@ var TailwindcssPatcher = class {
910
908
  const { output, tailwindcss } = options ?? {};
911
909
  if (output && tailwindcss) {
912
910
  const { filename, loose } = output;
913
- if (this.majorVersion === 3) {
911
+ if (this.majorVersion === 3 || this.majorVersion === 2) {
914
912
  await processTailwindcss({
915
913
  ...tailwindcss,
916
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 (e2) {
65
- logger_default.error("write cache file fail!");
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 (await _fsextra2.default.exists(filename)) {
72
+ if (isExisted) {
72
73
  const data = await _fsextra2.default.readJSON(filename);
73
74
  return new Set(data);
74
75
  }
75
- } catch (e3) {
76
- logger_default.error(`parse cache content fail! path:${filename}`);
77
- try {
78
- _fsextra2.default.unlinkSync(filename);
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 (e5) {
659
+ } catch (e2) {
662
660
  }
663
661
  }
664
662
  return result;
@@ -914,7 +912,7 @@ var TailwindcssPatcher = (_class = class {
914
912
  const { output, tailwindcss } = _nullishCoalesce(options, () => ( {}));
915
913
  if (output && tailwindcss) {
916
914
  const { filename, loose } = output;
917
- if (this.majorVersion === 3) {
915
+ if (this.majorVersion === 3 || this.majorVersion === 2) {
918
916
  await processTailwindcss({
919
917
  ...tailwindcss,
920
918
  majorVersion: this.majorVersion
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkS6WAH32Wjs = require('./chunk-S6WAH32W.js');
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, _chunkS6WAH32Wjs.TailwindcssPatcher)({
18
- patch: _chunkS6WAH32Wjs.getPatchOptions.call(void 0, )
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
- _chunkS6WAH32Wjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
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, _chunkS6WAH32Wjs.TailwindcssPatcher)();
29
+ const twPatcher = new (0, _chunkAT6RYKKSjs.TailwindcssPatcher)();
30
30
  const p = await twPatcher.extract(config.patch);
31
- _chunkS6WAH32Wjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p}`);
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
@@ -2,7 +2,7 @@ import {
2
2
  TailwindcssPatcher,
3
3
  getPatchOptions,
4
4
  logger_default
5
- } from "./chunk-NHBD2ICP.mjs";
5
+ } from "./chunk-5K6TRQY5.mjs";
6
6
 
7
7
  // src/cli.ts
8
8
  import process from "node:process";
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkS6WAH32Wjs = require('./chunk-S6WAH32W.js');
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 = _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;
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-NHBD2ICP.mjs";
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.2",
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",