tailwindcss-patch 8.5.0 → 8.5.1

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.
@@ -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.5.1_jiti@1.21.7_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/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.5.1_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
2
2
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
3
3
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
4
4
 
@@ -13,6 +13,9 @@ var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsex
13
13
  function isErrnoException(error) {
14
14
  return error instanceof Error && typeof error.code === "string";
15
15
  }
16
+ function isAccessDenied(error) {
17
+ return isErrnoException(error) && Boolean(error.code && ["EPERM", "EBUSY", "EACCES"].includes(error.code));
18
+ }
16
19
  var CacheStore = class {
17
20
  constructor(options) {
18
21
  this.options = options;
@@ -30,17 +33,22 @@ var CacheStore = class {
30
33
  async replaceCacheFile(tempPath) {
31
34
  try {
32
35
  await _fsextra2.default.rename(tempPath, this.options.path);
36
+ return true;
33
37
  } catch (error) {
34
38
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
35
39
  try {
36
40
  await _fsextra2.default.remove(this.options.path);
37
41
  } catch (removeError) {
42
+ if (isAccessDenied(removeError)) {
43
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
44
+ return false;
45
+ }
38
46
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
39
47
  throw removeError;
40
48
  }
41
49
  }
42
50
  await _fsextra2.default.rename(tempPath, this.options.path);
43
- return;
51
+ return true;
44
52
  }
45
53
  throw error;
46
54
  }
@@ -48,17 +56,22 @@ var CacheStore = class {
48
56
  replaceCacheFileSync(tempPath) {
49
57
  try {
50
58
  _fsextra2.default.renameSync(tempPath, this.options.path);
59
+ return true;
51
60
  } catch (error) {
52
61
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
53
62
  try {
54
63
  _fsextra2.default.removeSync(this.options.path);
55
64
  } catch (removeError) {
65
+ if (isAccessDenied(removeError)) {
66
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
67
+ return false;
68
+ }
56
69
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
57
70
  throw removeError;
58
71
  }
59
72
  }
60
73
  _fsextra2.default.renameSync(tempPath, this.options.path);
61
- return;
74
+ return true;
62
75
  }
63
76
  throw error;
64
77
  }
@@ -83,8 +96,12 @@ var CacheStore = class {
83
96
  try {
84
97
  await this.ensureDir();
85
98
  await _fsextra2.default.writeJSON(tempPath, Array.from(data));
86
- await this.replaceCacheFile(tempPath);
87
- return this.options.path;
99
+ const replaced = await this.replaceCacheFile(tempPath);
100
+ if (replaced) {
101
+ return this.options.path;
102
+ }
103
+ await this.cleanupTempFile(tempPath);
104
+ return void 0;
88
105
  } catch (error) {
89
106
  await this.cleanupTempFile(tempPath);
90
107
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -99,8 +116,12 @@ var CacheStore = class {
99
116
  try {
100
117
  this.ensureDirSync();
101
118
  _fsextra2.default.writeJSONSync(tempPath, Array.from(data));
102
- this.replaceCacheFileSync(tempPath);
103
- return this.options.path;
119
+ const replaced = this.replaceCacheFileSync(tempPath);
120
+ if (replaced) {
121
+ return this.options.path;
122
+ }
123
+ this.cleanupTempFileSync(tempPath);
124
+ return void 0;
104
125
  } catch (error) {
105
126
  this.cleanupTempFileSync(tempPath);
106
127
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -9,6 +9,9 @@ import fs from "fs-extra";
9
9
  function isErrnoException(error) {
10
10
  return error instanceof Error && typeof error.code === "string";
11
11
  }
12
+ function isAccessDenied(error) {
13
+ return isErrnoException(error) && Boolean(error.code && ["EPERM", "EBUSY", "EACCES"].includes(error.code));
14
+ }
12
15
  var CacheStore = class {
13
16
  constructor(options) {
14
17
  this.options = options;
@@ -26,17 +29,22 @@ var CacheStore = class {
26
29
  async replaceCacheFile(tempPath) {
27
30
  try {
28
31
  await fs.rename(tempPath, this.options.path);
32
+ return true;
29
33
  } catch (error) {
30
34
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
31
35
  try {
32
36
  await fs.remove(this.options.path);
33
37
  } catch (removeError) {
38
+ if (isAccessDenied(removeError)) {
39
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
40
+ return false;
41
+ }
34
42
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
35
43
  throw removeError;
36
44
  }
37
45
  }
38
46
  await fs.rename(tempPath, this.options.path);
39
- return;
47
+ return true;
40
48
  }
41
49
  throw error;
42
50
  }
@@ -44,17 +52,22 @@ var CacheStore = class {
44
52
  replaceCacheFileSync(tempPath) {
45
53
  try {
46
54
  fs.renameSync(tempPath, this.options.path);
55
+ return true;
47
56
  } catch (error) {
48
57
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
49
58
  try {
50
59
  fs.removeSync(this.options.path);
51
60
  } catch (removeError) {
61
+ if (isAccessDenied(removeError)) {
62
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
63
+ return false;
64
+ }
52
65
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
53
66
  throw removeError;
54
67
  }
55
68
  }
56
69
  fs.renameSync(tempPath, this.options.path);
57
- return;
70
+ return true;
58
71
  }
59
72
  throw error;
60
73
  }
@@ -79,8 +92,12 @@ var CacheStore = class {
79
92
  try {
80
93
  await this.ensureDir();
81
94
  await fs.writeJSON(tempPath, Array.from(data));
82
- await this.replaceCacheFile(tempPath);
83
- return this.options.path;
95
+ const replaced = await this.replaceCacheFile(tempPath);
96
+ if (replaced) {
97
+ return this.options.path;
98
+ }
99
+ await this.cleanupTempFile(tempPath);
100
+ return void 0;
84
101
  } catch (error) {
85
102
  await this.cleanupTempFile(tempPath);
86
103
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -95,8 +112,12 @@ var CacheStore = class {
95
112
  try {
96
113
  this.ensureDirSync();
97
114
  fs.writeJSONSync(tempPath, Array.from(data));
98
- this.replaceCacheFileSync(tempPath);
99
- return this.options.path;
115
+ const replaced = this.replaceCacheFileSync(tempPath);
116
+ if (replaced) {
117
+ return this.options.path;
118
+ }
119
+ this.cleanupTempFileSync(tempPath);
120
+ return void 0;
100
121
  } catch (error) {
101
122
  this.cleanupTempFileSync(tempPath);
102
123
  logger_default.error("Unable to persist Tailwind class cache", error);
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _chunkCGQTZTVOjs = require('./chunk-CGQTZTVO.js');
3
+ var _chunkBSUCDWMJjs = require('./chunk-BSUCDWMJ.js');
4
4
 
5
5
  // src/cli.ts
6
- var cli = _chunkCGQTZTVOjs.createTailwindcssPatchCli.call(void 0, );
6
+ var cli = _chunkBSUCDWMJjs.createTailwindcssPatchCli.call(void 0, );
7
7
  cli.help();
8
8
  cli.parse();
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTailwindcssPatchCli
3
- } from "./chunk-V4NW4IGL.mjs";
3
+ } from "./chunk-KGBUT44N.mjs";
4
4
 
5
5
  // src/cli.ts
6
6
  var cli = createTailwindcssPatchCli();
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkCGQTZTVOjs = require('./chunk-CGQTZTVO.js');
19
+ var _chunkBSUCDWMJjs = require('./chunk-BSUCDWMJ.js');
20
20
 
21
21
  // src/index.ts
22
22
  var _config = require('@tailwindcss-mangle/config');
@@ -39,4 +39,4 @@ var _config = require('@tailwindcss-mangle/config');
39
39
 
40
40
 
41
41
 
42
- exports.CacheStore = _chunkCGQTZTVOjs.CacheStore; exports.TailwindcssPatcher = _chunkCGQTZTVOjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkCGQTZTVOjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkCGQTZTVOjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkCGQTZTVOjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkCGQTZTVOjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkCGQTZTVOjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkCGQTZTVOjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkCGQTZTVOjs.extractValidCandidates; exports.getPatchStatusReport = _chunkCGQTZTVOjs.getPatchStatusReport; exports.groupTokensByFile = _chunkCGQTZTVOjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkCGQTZTVOjs.loadRuntimeContexts; exports.logger = _chunkCGQTZTVOjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkCGQTZTVOjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkCGQTZTVOjs.normalizeOptions; exports.runTailwindBuild = _chunkCGQTZTVOjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkCGQTZTVOjs.tailwindcssPatchCommands;
42
+ exports.CacheStore = _chunkBSUCDWMJjs.CacheStore; exports.TailwindcssPatcher = _chunkBSUCDWMJjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkBSUCDWMJjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkBSUCDWMJjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkBSUCDWMJjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkBSUCDWMJjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkBSUCDWMJjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkBSUCDWMJjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkBSUCDWMJjs.extractValidCandidates; exports.getPatchStatusReport = _chunkBSUCDWMJjs.getPatchStatusReport; exports.groupTokensByFile = _chunkBSUCDWMJjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkBSUCDWMJjs.loadRuntimeContexts; exports.logger = _chunkBSUCDWMJjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkBSUCDWMJjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkBSUCDWMJjs.normalizeOptions; exports.runTailwindBuild = _chunkBSUCDWMJjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkBSUCDWMJjs.tailwindcssPatchCommands;
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  normalizeOptions,
17
17
  runTailwindBuild,
18
18
  tailwindcssPatchCommands
19
- } from "./chunk-V4NW4IGL.mjs";
19
+ } from "./chunk-KGBUT44N.mjs";
20
20
 
21
21
  // src/index.ts
22
22
  import { defineConfig } from "@tailwindcss-mangle/config";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "@tailwindcss/node": "^4.1.18",
58
58
  "cac": "^6.7.14",
59
59
  "consola": "^3.4.2",
60
- "fs-extra": "^11.3.2",
60
+ "fs-extra": "^11.3.3",
61
61
  "local-pkg": "^1.1.2",
62
62
  "pathe": "^2.0.3",
63
63
  "postcss": "^8.5.6",