tailwindcss-patch 6.0.6 → 6.0.7

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.
@@ -157,13 +157,17 @@ var CacheManager = class {
157
157
  try {
158
158
  if (isExisted) {
159
159
  const data = await fs.readJSON(filename);
160
- return new Set(data);
160
+ return new Set(data ?? []);
161
161
  }
162
162
  } catch (error) {
163
- logger_default.error(`path:${filename}`);
164
163
  logger_default.error(error);
165
- isExisted && await fs.remove(filename);
164
+ try {
165
+ isExisted && await fs.remove(filename);
166
+ } catch (error2) {
167
+ logger_default.error(error2);
168
+ }
166
169
  }
170
+ return /* @__PURE__ */ new Set();
167
171
  }
168
172
  };
169
173
 
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.2_tsx@4.19.2_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;// ../../node_modules/.pnpm/tsup@8.3.6_jiti@2.4.2_postcss@8.5.2_tsx@4.19.3_typescript@5.7.3_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
2
2
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
3
3
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
4
 
@@ -161,13 +161,17 @@ var CacheManager = class {
161
161
  try {
162
162
  if (isExisted) {
163
163
  const data = await _fsextra2.default.readJSON(filename);
164
- return new Set(data);
164
+ return new Set(_nullishCoalesce(data, () => ( [])));
165
165
  }
166
166
  } catch (error) {
167
- logger_default.error(`path:${filename}`);
168
167
  logger_default.error(error);
169
- isExisted && await _fsextra2.default.remove(filename);
168
+ try {
169
+ isExisted && await _fsextra2.default.remove(filename);
170
+ } catch (error2) {
171
+ logger_default.error(error2);
172
+ }
170
173
  }
174
+ return /* @__PURE__ */ new Set();
171
175
  }
172
176
  };
173
177
 
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkL7IXX3YUjs = require('./chunk-L7IXX3YU.js');
7
+ var _chunk7LD7UWYLjs = require('./chunk-7LD7UWYL.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, _chunkL7IXX3YUjs.TailwindcssPatcher)({
20
- patch: _chunkL7IXX3YUjs.getPatchOptions.call(void 0, )
19
+ const twPatcher = new (0, _chunk7LD7UWYLjs.TailwindcssPatcher)({
20
+ patch: _chunk7LD7UWYLjs.getPatchOptions.call(void 0, )
21
21
  });
22
22
  twPatcher.patch();
23
23
  });
24
24
  cli.command("init").action(async () => {
25
25
  await init();
26
- _chunkL7IXX3YUjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
26
+ _chunk7LD7UWYLjs.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, _chunkL7IXX3YUjs.TailwindcssPatcher)(
31
+ const twPatcher = new (0, _chunk7LD7UWYLjs.TailwindcssPatcher)(
32
32
  {
33
- patch: _chunkL7IXX3YUjs.defuOverrideArray.call(void 0, config.patch, {
33
+ patch: _chunk7LD7UWYLjs.defuOverrideArray.call(void 0, config.patch, {
34
34
  resolve: {
35
- paths: [_chunkL7IXX3YUjs.importMetaUrl]
35
+ paths: [_chunk7LD7UWYLjs.importMetaUrl]
36
36
  }
37
37
  })
38
38
  }
39
39
  );
40
40
  const p = await twPatcher.extract();
41
- p && _chunkL7IXX3YUjs.logger_default.success(`\u2728 tailwindcss-patch extract success! file path: ${p.filename}, classList length: ${p.classList.length}`);
41
+ p && _chunk7LD7UWYLjs.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
@@ -3,7 +3,7 @@ import {
3
3
  defuOverrideArray,
4
4
  getPatchOptions,
5
5
  logger_default
6
- } from "./chunk-JNFI3RBM.mjs";
6
+ } from "./chunk-4NIV24YC.mjs";
7
7
 
8
8
  // src/cli.ts
9
9
  import process from "node:process";
package/dist/index.d.mts CHANGED
@@ -105,7 +105,7 @@ declare class CacheManager {
105
105
  filename: string;
106
106
  };
107
107
  write(data: Set<string>): Promise<string | undefined>;
108
- read(): Promise<Set<string> | undefined>;
108
+ read(): Promise<Set<string>>;
109
109
  }
110
110
 
111
111
  interface ExtractValidCandidatesOption {
@@ -126,7 +126,7 @@ declare class TailwindcssPatcher {
126
126
  filter?: (className: string) => boolean;
127
127
  constructor(options?: TailwindcssPatcherOptions);
128
128
  setCache(set: Set<string>): Promise<string | undefined> | undefined;
129
- getCache(): Promise<Set<string> | undefined>;
129
+ getCache(): Promise<Set<string>>;
130
130
  getContexts(): TailwindcssRuntimeContext[];
131
131
  getClassCaches(): TailwindcssClassCache[];
132
132
  getClassCacheSet(): Promise<Set<string>>;
package/dist/index.d.ts CHANGED
@@ -105,7 +105,7 @@ declare class CacheManager {
105
105
  filename: string;
106
106
  };
107
107
  write(data: Set<string>): Promise<string | undefined>;
108
- read(): Promise<Set<string> | undefined>;
108
+ read(): Promise<Set<string>>;
109
109
  }
110
110
 
111
111
  interface ExtractValidCandidatesOption {
@@ -126,7 +126,7 @@ declare class TailwindcssPatcher {
126
126
  filter?: (className: string) => boolean;
127
127
  constructor(options?: TailwindcssPatcherOptions);
128
128
  setCache(set: Set<string>): Promise<string | undefined> | undefined;
129
- getCache(): Promise<Set<string> | undefined>;
129
+ getCache(): Promise<Set<string>>;
130
130
  getContexts(): TailwindcssRuntimeContext[];
131
131
  getClassCaches(): TailwindcssClassCache[];
132
132
  getClassCacheSet(): Promise<Set<string>>;
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkL7IXX3YUjs = require('./chunk-L7IXX3YU.js');
10
+ var _chunk7LD7UWYLjs = require('./chunk-7LD7UWYL.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 = _chunkL7IXX3YUjs.CacheManager; exports.TailwindcssPatcher = _chunkL7IXX3YUjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunkL7IXX3YUjs.getCacheOptions; exports.internalPatch = _chunkL7IXX3YUjs.internalPatch; exports.logger = _chunkL7IXX3YUjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunkL7IXX3YUjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunkL7IXX3YUjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunkL7IXX3YUjs.monkeyPatchForSupportingCustomUnit;
24
+ exports.CacheManager = _chunk7LD7UWYLjs.CacheManager; exports.TailwindcssPatcher = _chunk7LD7UWYLjs.TailwindcssPatcher; exports.defineConfig = _config.defineConfig; exports.getCacheOptions = _chunk7LD7UWYLjs.getCacheOptions; exports.internalPatch = _chunk7LD7UWYLjs.internalPatch; exports.logger = _chunk7LD7UWYLjs.logger_default; exports.monkeyPatchForExposingContextV2 = _chunk7LD7UWYLjs.monkeyPatchForExposingContextV2; exports.monkeyPatchForExposingContextV3 = _chunk7LD7UWYLjs.monkeyPatchForExposingContextV3; exports.monkeyPatchForSupportingCustomUnit = _chunk7LD7UWYLjs.monkeyPatchForSupportingCustomUnit;
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  monkeyPatchForExposingContextV2,
8
8
  monkeyPatchForExposingContextV3,
9
9
  monkeyPatchForSupportingCustomUnit
10
- } from "./chunk-JNFI3RBM.mjs";
10
+ } from "./chunk-4NIV24YC.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.6",
3
+ "version": "6.0.7",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -65,10 +65,10 @@
65
65
  "@tailwindcss-mangle/config": "^5.0.3"
66
66
  },
67
67
  "devDependencies": {
68
- "@tailwindcss/node": "^4.0.6",
69
- "@tailwindcss/oxide": "^4.0.6",
70
- "@tailwindcss/postcss": "^4.0.6",
71
- "@tailwindcss/vite": "^4.0.6",
68
+ "@tailwindcss/node": "^4.0.7",
69
+ "@tailwindcss/oxide": "^4.0.7",
70
+ "@tailwindcss/postcss": "^4.0.7",
71
+ "@tailwindcss/vite": "^4.0.7",
72
72
  "tailwindcss": "^4.0.6",
73
73
  "tailwindcss-3": "npm:tailwindcss@^3",
74
74
  "tailwindcss-4": "npm:tailwindcss@^4.0.6"