tailwindcss-patch 8.5.0 → 8.6.0

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.
package/README.md CHANGED
@@ -129,6 +129,7 @@ const patcher = new TailwindcssPatcher({
129
129
  enabled: true,
130
130
  dir: '.tw-patch/cache',
131
131
  strategy: 'merge',
132
+ driver: 'file',
132
133
  },
133
134
  output: {
134
135
  file: '.tw-patch/tw-class-list.json',
@@ -163,10 +164,12 @@ console.log(patchStatus.entries)
163
164
 
164
165
  The constructor accepts either the new object shown above or the historical `patch`/`cache` shape. Conversions happen internally so existing configs remain backwards compatible.
165
166
 
167
+ Use cache.driver to switch between the default file-backed cache, an in-memory cache (memory), or a no-op cache (noop) when filesystem permissions are restricted.
168
+
166
169
  ### Helper utilities
167
170
 
168
171
  - `normalizeOptions` – normalise raw user input to the runtime shape.
169
- - `CacheStore` – read/write class caches respecting merge or overwrite semantics.
172
+ - `CacheStore` – read/write class caches (file, memory, or noop drivers) respecting merge or overwrite semantics.
170
173
  - `extractProjectCandidatesWithPositions` – gather Tailwind tokens for every configured source file with location metadata.
171
174
  - `groupTokensByFile` – convert a token report into a `{ [filePath]: TailwindTokenLocation[] }` map.
172
175
  - `extractValidCandidates` – scan Tailwind v4 CSS/content sources with the Tailwind Oxide scanner.
@@ -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; var _class2;// ../../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,10 +13,16 @@ 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
- var CacheStore = class {
17
- constructor(options) {
16
+ function isAccessDenied(error) {
17
+ return isErrnoException(error) && Boolean(error.code && ["EPERM", "EBUSY", "EACCES"].includes(error.code));
18
+ }
19
+ var CacheStore = (_class = class {
20
+ constructor(options) {;_class.prototype.__init.call(this);
18
21
  this.options = options;
22
+ this.driver = _nullishCoalesce(options.driver, () => ( "file"));
19
23
  }
24
+
25
+ __init() {this.memoryCache = null}
20
26
  async ensureDir() {
21
27
  await _fsextra2.default.ensureDir(this.options.dir);
22
28
  }
@@ -30,17 +36,22 @@ var CacheStore = class {
30
36
  async replaceCacheFile(tempPath) {
31
37
  try {
32
38
  await _fsextra2.default.rename(tempPath, this.options.path);
39
+ return true;
33
40
  } catch (error) {
34
41
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
35
42
  try {
36
43
  await _fsextra2.default.remove(this.options.path);
37
44
  } catch (removeError) {
45
+ if (isAccessDenied(removeError)) {
46
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
47
+ return false;
48
+ }
38
49
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
39
50
  throw removeError;
40
51
  }
41
52
  }
42
53
  await _fsextra2.default.rename(tempPath, this.options.path);
43
- return;
54
+ return true;
44
55
  }
45
56
  throw error;
46
57
  }
@@ -48,17 +59,22 @@ var CacheStore = class {
48
59
  replaceCacheFileSync(tempPath) {
49
60
  try {
50
61
  _fsextra2.default.renameSync(tempPath, this.options.path);
62
+ return true;
51
63
  } catch (error) {
52
64
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
53
65
  try {
54
66
  _fsextra2.default.removeSync(this.options.path);
55
67
  } catch (removeError) {
68
+ if (isAccessDenied(removeError)) {
69
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
70
+ return false;
71
+ }
56
72
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
57
73
  throw removeError;
58
74
  }
59
75
  }
60
76
  _fsextra2.default.renameSync(tempPath, this.options.path);
61
- return;
77
+ return true;
62
78
  }
63
79
  throw error;
64
80
  }
@@ -79,12 +95,23 @@ var CacheStore = class {
79
95
  if (!this.options.enabled) {
80
96
  return void 0;
81
97
  }
98
+ if (this.driver === "noop") {
99
+ return void 0;
100
+ }
101
+ if (this.driver === "memory") {
102
+ this.memoryCache = new Set(data);
103
+ return "memory";
104
+ }
82
105
  const tempPath = this.createTempPath();
83
106
  try {
84
107
  await this.ensureDir();
85
108
  await _fsextra2.default.writeJSON(tempPath, Array.from(data));
86
- await this.replaceCacheFile(tempPath);
87
- return this.options.path;
109
+ const replaced = await this.replaceCacheFile(tempPath);
110
+ if (replaced) {
111
+ return this.options.path;
112
+ }
113
+ await this.cleanupTempFile(tempPath);
114
+ return void 0;
88
115
  } catch (error) {
89
116
  await this.cleanupTempFile(tempPath);
90
117
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -95,12 +122,23 @@ var CacheStore = class {
95
122
  if (!this.options.enabled) {
96
123
  return void 0;
97
124
  }
125
+ if (this.driver === "noop") {
126
+ return void 0;
127
+ }
128
+ if (this.driver === "memory") {
129
+ this.memoryCache = new Set(data);
130
+ return "memory";
131
+ }
98
132
  const tempPath = this.createTempPath();
99
133
  try {
100
134
  this.ensureDirSync();
101
135
  _fsextra2.default.writeJSONSync(tempPath, Array.from(data));
102
- this.replaceCacheFileSync(tempPath);
103
- return this.options.path;
136
+ const replaced = this.replaceCacheFileSync(tempPath);
137
+ if (replaced) {
138
+ return this.options.path;
139
+ }
140
+ this.cleanupTempFileSync(tempPath);
141
+ return void 0;
104
142
  } catch (error) {
105
143
  this.cleanupTempFileSync(tempPath);
106
144
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -111,6 +149,12 @@ var CacheStore = class {
111
149
  if (!this.options.enabled) {
112
150
  return /* @__PURE__ */ new Set();
113
151
  }
152
+ if (this.driver === "noop") {
153
+ return /* @__PURE__ */ new Set();
154
+ }
155
+ if (this.driver === "memory") {
156
+ return new Set(_nullishCoalesce(this.memoryCache, () => ( [])));
157
+ }
114
158
  try {
115
159
  const exists = await _fsextra2.default.pathExists(this.options.path);
116
160
  if (!exists) {
@@ -137,6 +181,12 @@ var CacheStore = class {
137
181
  if (!this.options.enabled) {
138
182
  return /* @__PURE__ */ new Set();
139
183
  }
184
+ if (this.driver === "noop") {
185
+ return /* @__PURE__ */ new Set();
186
+ }
187
+ if (this.driver === "memory") {
188
+ return new Set(_nullishCoalesce(this.memoryCache, () => ( [])));
189
+ }
140
190
  try {
141
191
  const exists = _fsextra2.default.pathExistsSync(this.options.path);
142
192
  if (!exists) {
@@ -159,7 +209,7 @@ var CacheStore = class {
159
209
  }
160
210
  return /* @__PURE__ */ new Set();
161
211
  }
162
- };
212
+ }, _class);
163
213
 
164
214
  // src/extraction/candidate-extractor.ts
165
215
  var _fs = require('fs');
@@ -374,12 +424,19 @@ function toPrettyValue(value) {
374
424
  }
375
425
  return false;
376
426
  }
427
+ function normalizeCacheDriver(driver) {
428
+ if (driver === "memory" || driver === "noop") {
429
+ return driver;
430
+ }
431
+ return "file";
432
+ }
377
433
  function normalizeCacheOptions(cache, projectRoot) {
378
434
  let enabled = false;
379
435
  let cwd = projectRoot;
380
436
  let dir = _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName);
381
437
  let file = "class-cache.json";
382
438
  let strategy = "merge";
439
+ let driver = "file";
383
440
  if (typeof cache === "boolean") {
384
441
  enabled = cache;
385
442
  } else if (typeof cache === "object" && cache) {
@@ -388,6 +445,7 @@ function normalizeCacheOptions(cache, projectRoot) {
388
445
  dir = cache.dir ? _pathe2.default.resolve(cache.dir) : _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName);
389
446
  file = _nullishCoalesce(cache.file, () => ( file));
390
447
  strategy = _nullishCoalesce(cache.strategy, () => ( strategy));
448
+ driver = normalizeCacheDriver(cache.driver);
391
449
  }
392
450
  const filename = _pathe2.default.resolve(dir, file);
393
451
  return {
@@ -396,7 +454,8 @@ function normalizeCacheOptions(cache, projectRoot) {
396
454
  dir,
397
455
  file,
398
456
  path: filename,
399
- strategy
457
+ strategy,
458
+ driver
400
459
  };
401
460
  }
402
461
  function normalizeOutputOptions(output) {
@@ -1670,12 +1729,12 @@ function resolveTailwindExecutionOptions(normalized, majorVersion) {
1670
1729
  postcssPlugin: base.postcssPlugin
1671
1730
  };
1672
1731
  }
1673
- var TailwindcssPatcher = (_class = class {
1732
+ var TailwindcssPatcher = (_class2 = class {
1674
1733
 
1675
1734
 
1676
1735
 
1677
1736
 
1678
- constructor(options = {}) {;_class.prototype.__init.call(this);
1737
+ constructor(options = {}) {;_class2.prototype.__init2.call(this);
1679
1738
  const resolvedOptions = options && typeof options === "object" && "patch" in options ? fromLegacyOptions(options) : options;
1680
1739
  this.options = normalizeOptions(resolvedOptions);
1681
1740
  const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
@@ -1813,7 +1872,7 @@ var TailwindcssPatcher = (_class = class {
1813
1872
  };
1814
1873
  }
1815
1874
  // Backwards compatibility helper used by tests and API consumers.
1816
- __init() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
1875
+ __init2() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
1817
1876
  async collectContentTokens(options) {
1818
1877
  return extractProjectCandidatesWithPositions({
1819
1878
  cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _72 => _72.cwd]), () => ( this.options.projectRoot)),
@@ -1830,7 +1889,7 @@ var TailwindcssPatcher = (_class = class {
1830
1889
  stripAbsolutePaths: _optionalChain([options, 'optionalAccess', _81 => _81.stripAbsolutePaths])
1831
1890
  });
1832
1891
  }
1833
- }, _class);
1892
+ }, _class2);
1834
1893
 
1835
1894
  // src/cli/commands.ts
1836
1895
 
@@ -9,10 +9,16 @@ 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;
18
+ this.driver = options.driver ?? "file";
15
19
  }
20
+ driver;
21
+ memoryCache = null;
16
22
  async ensureDir() {
17
23
  await fs.ensureDir(this.options.dir);
18
24
  }
@@ -26,17 +32,22 @@ var CacheStore = class {
26
32
  async replaceCacheFile(tempPath) {
27
33
  try {
28
34
  await fs.rename(tempPath, this.options.path);
35
+ return true;
29
36
  } catch (error) {
30
37
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
31
38
  try {
32
39
  await fs.remove(this.options.path);
33
40
  } catch (removeError) {
41
+ if (isAccessDenied(removeError)) {
42
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
43
+ return false;
44
+ }
34
45
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
35
46
  throw removeError;
36
47
  }
37
48
  }
38
49
  await fs.rename(tempPath, this.options.path);
39
- return;
50
+ return true;
40
51
  }
41
52
  throw error;
42
53
  }
@@ -44,17 +55,22 @@ var CacheStore = class {
44
55
  replaceCacheFileSync(tempPath) {
45
56
  try {
46
57
  fs.renameSync(tempPath, this.options.path);
58
+ return true;
47
59
  } catch (error) {
48
60
  if (isErrnoException(error) && (error.code === "EEXIST" || error.code === "EPERM")) {
49
61
  try {
50
62
  fs.removeSync(this.options.path);
51
63
  } catch (removeError) {
64
+ if (isAccessDenied(removeError)) {
65
+ logger_default.debug("Tailwind class cache locked or read-only, skipping update.", removeError);
66
+ return false;
67
+ }
52
68
  if (!isErrnoException(removeError) || removeError.code !== "ENOENT") {
53
69
  throw removeError;
54
70
  }
55
71
  }
56
72
  fs.renameSync(tempPath, this.options.path);
57
- return;
73
+ return true;
58
74
  }
59
75
  throw error;
60
76
  }
@@ -75,12 +91,23 @@ var CacheStore = class {
75
91
  if (!this.options.enabled) {
76
92
  return void 0;
77
93
  }
94
+ if (this.driver === "noop") {
95
+ return void 0;
96
+ }
97
+ if (this.driver === "memory") {
98
+ this.memoryCache = new Set(data);
99
+ return "memory";
100
+ }
78
101
  const tempPath = this.createTempPath();
79
102
  try {
80
103
  await this.ensureDir();
81
104
  await fs.writeJSON(tempPath, Array.from(data));
82
- await this.replaceCacheFile(tempPath);
83
- return this.options.path;
105
+ const replaced = await this.replaceCacheFile(tempPath);
106
+ if (replaced) {
107
+ return this.options.path;
108
+ }
109
+ await this.cleanupTempFile(tempPath);
110
+ return void 0;
84
111
  } catch (error) {
85
112
  await this.cleanupTempFile(tempPath);
86
113
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -91,12 +118,23 @@ var CacheStore = class {
91
118
  if (!this.options.enabled) {
92
119
  return void 0;
93
120
  }
121
+ if (this.driver === "noop") {
122
+ return void 0;
123
+ }
124
+ if (this.driver === "memory") {
125
+ this.memoryCache = new Set(data);
126
+ return "memory";
127
+ }
94
128
  const tempPath = this.createTempPath();
95
129
  try {
96
130
  this.ensureDirSync();
97
131
  fs.writeJSONSync(tempPath, Array.from(data));
98
- this.replaceCacheFileSync(tempPath);
99
- return this.options.path;
132
+ const replaced = this.replaceCacheFileSync(tempPath);
133
+ if (replaced) {
134
+ return this.options.path;
135
+ }
136
+ this.cleanupTempFileSync(tempPath);
137
+ return void 0;
100
138
  } catch (error) {
101
139
  this.cleanupTempFileSync(tempPath);
102
140
  logger_default.error("Unable to persist Tailwind class cache", error);
@@ -107,6 +145,12 @@ var CacheStore = class {
107
145
  if (!this.options.enabled) {
108
146
  return /* @__PURE__ */ new Set();
109
147
  }
148
+ if (this.driver === "noop") {
149
+ return /* @__PURE__ */ new Set();
150
+ }
151
+ if (this.driver === "memory") {
152
+ return new Set(this.memoryCache ?? []);
153
+ }
110
154
  try {
111
155
  const exists = await fs.pathExists(this.options.path);
112
156
  if (!exists) {
@@ -133,6 +177,12 @@ var CacheStore = class {
133
177
  if (!this.options.enabled) {
134
178
  return /* @__PURE__ */ new Set();
135
179
  }
180
+ if (this.driver === "noop") {
181
+ return /* @__PURE__ */ new Set();
182
+ }
183
+ if (this.driver === "memory") {
184
+ return new Set(this.memoryCache ?? []);
185
+ }
136
186
  try {
137
187
  const exists = fs.pathExistsSync(this.options.path);
138
188
  if (!exists) {
@@ -370,12 +420,19 @@ function toPrettyValue(value) {
370
420
  }
371
421
  return false;
372
422
  }
423
+ function normalizeCacheDriver(driver) {
424
+ if (driver === "memory" || driver === "noop") {
425
+ return driver;
426
+ }
427
+ return "file";
428
+ }
373
429
  function normalizeCacheOptions(cache, projectRoot) {
374
430
  let enabled = false;
375
431
  let cwd = projectRoot;
376
432
  let dir = path2.resolve(cwd, "node_modules/.cache", pkgName);
377
433
  let file = "class-cache.json";
378
434
  let strategy = "merge";
435
+ let driver = "file";
379
436
  if (typeof cache === "boolean") {
380
437
  enabled = cache;
381
438
  } else if (typeof cache === "object" && cache) {
@@ -384,6 +441,7 @@ function normalizeCacheOptions(cache, projectRoot) {
384
441
  dir = cache.dir ? path2.resolve(cache.dir) : path2.resolve(cwd, "node_modules/.cache", pkgName);
385
442
  file = cache.file ?? file;
386
443
  strategy = cache.strategy ?? strategy;
444
+ driver = normalizeCacheDriver(cache.driver);
387
445
  }
388
446
  const filename = path2.resolve(dir, file);
389
447
  return {
@@ -392,7 +450,8 @@ function normalizeCacheOptions(cache, projectRoot) {
392
450
  dir,
393
451
  file,
394
452
  path: filename,
395
- strategy
453
+ strategy,
454
+ driver
396
455
  };
397
456
  }
398
457
  function normalizeOutputOptions(output) {
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _chunkCGQTZTVOjs = require('./chunk-CGQTZTVO.js');
3
+ var _chunkJ27TPXH5js = require('./chunk-J27TPXH5.js');
4
4
 
5
5
  // src/cli.ts
6
- var cli = _chunkCGQTZTVOjs.createTailwindcssPatchCli.call(void 0, );
6
+ var cli = _chunkJ27TPXH5js.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-RVSD53YX.mjs";
4
4
 
5
5
  // src/cli.ts
6
6
  var cli = createTailwindcssPatchCli();
package/dist/index.d.mts CHANGED
@@ -8,6 +8,7 @@ import { Command, CAC } from 'cac';
8
8
  import * as consola from 'consola';
9
9
 
10
10
  type CacheStrategy = 'merge' | 'overwrite';
11
+ type CacheDriver = 'file' | 'memory' | 'noop';
11
12
  /**
12
13
  * Configures how the Tailwind class cache is stored and where it lives on disk.
13
14
  */
@@ -25,6 +26,8 @@ interface CacheUserOptions {
25
26
  file?: string;
26
27
  /** Strategy used when merging new class lists with an existing cache. */
27
28
  strategy?: CacheStrategy;
29
+ /** Backend used to persist the cache (`file`, `memory`, or `noop`). Defaults to `file`. */
30
+ driver?: CacheDriver;
28
31
  }
29
32
  /**
30
33
  * Controls how extracted class lists are written to disk.
@@ -150,6 +153,7 @@ interface NormalizedCacheOptions {
150
153
  file: string;
151
154
  path: string;
152
155
  strategy: CacheStrategy;
156
+ driver: CacheDriver;
153
157
  }
154
158
  /** Tracks whether runtime contexts should be exposed and via which property. */
155
159
  interface NormalizedExposeContextOptions {
@@ -431,6 +435,8 @@ declare class TailwindcssPatcher {
431
435
 
432
436
  declare class CacheStore {
433
437
  private readonly options;
438
+ private readonly driver;
439
+ private memoryCache;
434
440
  constructor(options: NormalizedCacheOptions);
435
441
  private ensureDir;
436
442
  private ensureDirSync;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { Command, CAC } from 'cac';
8
8
  import * as consola from 'consola';
9
9
 
10
10
  type CacheStrategy = 'merge' | 'overwrite';
11
+ type CacheDriver = 'file' | 'memory' | 'noop';
11
12
  /**
12
13
  * Configures how the Tailwind class cache is stored and where it lives on disk.
13
14
  */
@@ -25,6 +26,8 @@ interface CacheUserOptions {
25
26
  file?: string;
26
27
  /** Strategy used when merging new class lists with an existing cache. */
27
28
  strategy?: CacheStrategy;
29
+ /** Backend used to persist the cache (`file`, `memory`, or `noop`). Defaults to `file`. */
30
+ driver?: CacheDriver;
28
31
  }
29
32
  /**
30
33
  * Controls how extracted class lists are written to disk.
@@ -150,6 +153,7 @@ interface NormalizedCacheOptions {
150
153
  file: string;
151
154
  path: string;
152
155
  strategy: CacheStrategy;
156
+ driver: CacheDriver;
153
157
  }
154
158
  /** Tracks whether runtime contexts should be exposed and via which property. */
155
159
  interface NormalizedExposeContextOptions {
@@ -431,6 +435,8 @@ declare class TailwindcssPatcher {
431
435
 
432
436
  declare class CacheStore {
433
437
  private readonly options;
438
+ private readonly driver;
439
+ private memoryCache;
434
440
  constructor(options: NormalizedCacheOptions);
435
441
  private ensureDir;
436
442
  private ensureDirSync;
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkCGQTZTVOjs = require('./chunk-CGQTZTVO.js');
19
+ var _chunkJ27TPXH5js = require('./chunk-J27TPXH5.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 = _chunkJ27TPXH5js.CacheStore; exports.TailwindcssPatcher = _chunkJ27TPXH5js.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkJ27TPXH5js.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkJ27TPXH5js.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkJ27TPXH5js.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkJ27TPXH5js.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkJ27TPXH5js.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkJ27TPXH5js.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkJ27TPXH5js.extractValidCandidates; exports.getPatchStatusReport = _chunkJ27TPXH5js.getPatchStatusReport; exports.groupTokensByFile = _chunkJ27TPXH5js.groupTokensByFile; exports.loadRuntimeContexts = _chunkJ27TPXH5js.loadRuntimeContexts; exports.logger = _chunkJ27TPXH5js.logger_default; exports.mountTailwindcssPatchCommands = _chunkJ27TPXH5js.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkJ27TPXH5js.normalizeOptions; exports.runTailwindBuild = _chunkJ27TPXH5js.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkJ27TPXH5js.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-RVSD53YX.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.6.0",
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",