tailwindcss-patch 8.5.1 → 8.6.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.
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@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
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
 
@@ -16,10 +16,13 @@ function isErrnoException(error) {
16
16
  function isAccessDenied(error) {
17
17
  return isErrnoException(error) && Boolean(error.code && ["EPERM", "EBUSY", "EACCES"].includes(error.code));
18
18
  }
19
- var CacheStore = class {
20
- constructor(options) {
19
+ var CacheStore = (_class = class {
20
+ constructor(options) {;_class.prototype.__init.call(this);
21
21
  this.options = options;
22
+ this.driver = _nullishCoalesce(options.driver, () => ( "file"));
22
23
  }
24
+
25
+ __init() {this.memoryCache = null}
23
26
  async ensureDir() {
24
27
  await _fsextra2.default.ensureDir(this.options.dir);
25
28
  }
@@ -92,6 +95,13 @@ var CacheStore = class {
92
95
  if (!this.options.enabled) {
93
96
  return void 0;
94
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
+ }
95
105
  const tempPath = this.createTempPath();
96
106
  try {
97
107
  await this.ensureDir();
@@ -112,6 +122,13 @@ var CacheStore = class {
112
122
  if (!this.options.enabled) {
113
123
  return void 0;
114
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
+ }
115
132
  const tempPath = this.createTempPath();
116
133
  try {
117
134
  this.ensureDirSync();
@@ -132,6 +149,12 @@ var CacheStore = class {
132
149
  if (!this.options.enabled) {
133
150
  return /* @__PURE__ */ new Set();
134
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
+ }
135
158
  try {
136
159
  const exists = await _fsextra2.default.pathExists(this.options.path);
137
160
  if (!exists) {
@@ -158,6 +181,12 @@ var CacheStore = class {
158
181
  if (!this.options.enabled) {
159
182
  return /* @__PURE__ */ new Set();
160
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
+ }
161
190
  try {
162
191
  const exists = _fsextra2.default.pathExistsSync(this.options.path);
163
192
  if (!exists) {
@@ -180,7 +209,7 @@ var CacheStore = class {
180
209
  }
181
210
  return /* @__PURE__ */ new Set();
182
211
  }
183
- };
212
+ }, _class);
184
213
 
185
214
  // src/extraction/candidate-extractor.ts
186
215
  var _fs = require('fs');
@@ -192,6 +221,25 @@ async function importNode() {
192
221
  async function importOxide() {
193
222
  return Promise.resolve().then(() => _interopRequireWildcard(require("@tailwindcss/oxide")));
194
223
  }
224
+ async function loadDesignSystem(css, bases) {
225
+ const uniqueBases = Array.from(new Set(bases.filter(Boolean)));
226
+ if (uniqueBases.length === 0) {
227
+ throw new Error("No base directories provided for Tailwind CSS design system.");
228
+ }
229
+ const { __unstable__loadDesignSystem } = await importNode();
230
+ let lastError;
231
+ for (const base of uniqueBases) {
232
+ try {
233
+ return await __unstable__loadDesignSystem(css, { base });
234
+ } catch (error) {
235
+ lastError = error;
236
+ }
237
+ }
238
+ if (lastError instanceof Error) {
239
+ throw lastError;
240
+ }
241
+ throw new Error("Failed to load Tailwind CSS design system.");
242
+ }
195
243
  async function extractRawCandidatesWithPositions(content, extension = "html") {
196
244
  const { Scanner } = await importOxide();
197
245
  const scanner = new Scanner({});
@@ -213,6 +261,7 @@ async function extractValidCandidates(options) {
213
261
  const providedOptions = _nullishCoalesce(options, () => ( {}));
214
262
  const defaultCwd = _nullishCoalesce(providedOptions.cwd, () => ( _process2.default.cwd()));
215
263
  const base = _nullishCoalesce(providedOptions.base, () => ( defaultCwd));
264
+ const baseFallbacks = _nullishCoalesce(providedOptions.baseFallbacks, () => ( []));
216
265
  const css = _nullishCoalesce(providedOptions.css, () => ( '@import "tailwindcss";'));
217
266
  const sources = (_nullishCoalesce(providedOptions.sources, () => ( [
218
267
  {
@@ -225,8 +274,7 @@ async function extractValidCandidates(options) {
225
274
  pattern: source.pattern,
226
275
  negated: source.negated
227
276
  }));
228
- const { __unstable__loadDesignSystem } = await importNode();
229
- const designSystem = await __unstable__loadDesignSystem(css, { base });
277
+ const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks]);
230
278
  const candidates = await extractRawCandidates(sources);
231
279
  const parsedCandidates = candidates.filter(
232
280
  (rawCandidate) => designSystem.parseCandidate(rawCandidate).length > 0
@@ -395,12 +443,19 @@ function toPrettyValue(value) {
395
443
  }
396
444
  return false;
397
445
  }
446
+ function normalizeCacheDriver(driver) {
447
+ if (driver === "memory" || driver === "noop") {
448
+ return driver;
449
+ }
450
+ return "file";
451
+ }
398
452
  function normalizeCacheOptions(cache, projectRoot) {
399
453
  let enabled = false;
400
454
  let cwd = projectRoot;
401
455
  let dir = _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName);
402
456
  let file = "class-cache.json";
403
457
  let strategy = "merge";
458
+ let driver = "file";
404
459
  if (typeof cache === "boolean") {
405
460
  enabled = cache;
406
461
  } else if (typeof cache === "object" && cache) {
@@ -409,6 +464,7 @@ function normalizeCacheOptions(cache, projectRoot) {
409
464
  dir = cache.dir ? _pathe2.default.resolve(cache.dir) : _pathe2.default.resolve(cwd, "node_modules/.cache", pkgName);
410
465
  file = _nullishCoalesce(cache.file, () => ( file));
411
466
  strategy = _nullishCoalesce(cache.strategy, () => ( strategy));
467
+ driver = normalizeCacheDriver(cache.driver);
412
468
  }
413
469
  const filename = _pathe2.default.resolve(dir, file);
414
470
  return {
@@ -417,7 +473,8 @@ function normalizeCacheOptions(cache, projectRoot) {
417
473
  dir,
418
474
  file,
419
475
  path: filename,
420
- strategy
476
+ strategy,
477
+ driver
421
478
  };
422
479
  }
423
480
  function normalizeOutputOptions(output) {
@@ -1309,11 +1366,13 @@ async function collectClassesFromTailwindV4(options) {
1309
1366
  }
1310
1367
  const css = await _fsextra2.default.readFile(filePath, "utf8");
1311
1368
  const entryDir = _pathe2.default.dirname(filePath);
1312
- const baseForEntry = _nullishCoalesce(resolvedConfiguredBase, () => ( entryDir));
1313
- const sources = resolveSources(baseForEntry);
1369
+ const designSystemBases = resolvedConfiguredBase && resolvedConfiguredBase !== entryDir ? [entryDir, resolvedConfiguredBase] : [entryDir];
1370
+ const sourcesBase = _nullishCoalesce(resolvedConfiguredBase, () => ( entryDir));
1371
+ const sources = resolveSources(sourcesBase);
1314
1372
  const candidates = await extractValidCandidates({
1315
1373
  cwd: options.projectRoot,
1316
- base: baseForEntry,
1374
+ base: designSystemBases[0],
1375
+ baseFallbacks: designSystemBases.slice(1),
1317
1376
  css,
1318
1377
  sources
1319
1378
  });
@@ -1691,12 +1750,12 @@ function resolveTailwindExecutionOptions(normalized, majorVersion) {
1691
1750
  postcssPlugin: base.postcssPlugin
1692
1751
  };
1693
1752
  }
1694
- var TailwindcssPatcher = (_class = class {
1753
+ var TailwindcssPatcher = (_class2 = class {
1695
1754
 
1696
1755
 
1697
1756
 
1698
1757
 
1699
- constructor(options = {}) {;_class.prototype.__init.call(this);
1758
+ constructor(options = {}) {;_class2.prototype.__init2.call(this);
1700
1759
  const resolvedOptions = options && typeof options === "object" && "patch" in options ? fromLegacyOptions(options) : options;
1701
1760
  this.options = normalizeOptions(resolvedOptions);
1702
1761
  const packageInfo = _localpkg.getPackageInfoSync.call(void 0,
@@ -1834,7 +1893,7 @@ var TailwindcssPatcher = (_class = class {
1834
1893
  };
1835
1894
  }
1836
1895
  // Backwards compatibility helper used by tests and API consumers.
1837
- __init() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
1896
+ __init2() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
1838
1897
  async collectContentTokens(options) {
1839
1898
  return extractProjectCandidatesWithPositions({
1840
1899
  cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _72 => _72.cwd]), () => ( this.options.projectRoot)),
@@ -1851,7 +1910,7 @@ var TailwindcssPatcher = (_class = class {
1851
1910
  stripAbsolutePaths: _optionalChain([options, 'optionalAccess', _81 => _81.stripAbsolutePaths])
1852
1911
  });
1853
1912
  }
1854
- }, _class);
1913
+ }, _class2);
1855
1914
 
1856
1915
  // src/cli/commands.ts
1857
1916
 
@@ -15,7 +15,10 @@ function isAccessDenied(error) {
15
15
  var CacheStore = class {
16
16
  constructor(options) {
17
17
  this.options = options;
18
+ this.driver = options.driver ?? "file";
18
19
  }
20
+ driver;
21
+ memoryCache = null;
19
22
  async ensureDir() {
20
23
  await fs.ensureDir(this.options.dir);
21
24
  }
@@ -88,6 +91,13 @@ var CacheStore = class {
88
91
  if (!this.options.enabled) {
89
92
  return void 0;
90
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
+ }
91
101
  const tempPath = this.createTempPath();
92
102
  try {
93
103
  await this.ensureDir();
@@ -108,6 +118,13 @@ var CacheStore = class {
108
118
  if (!this.options.enabled) {
109
119
  return void 0;
110
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
+ }
111
128
  const tempPath = this.createTempPath();
112
129
  try {
113
130
  this.ensureDirSync();
@@ -128,6 +145,12 @@ var CacheStore = class {
128
145
  if (!this.options.enabled) {
129
146
  return /* @__PURE__ */ new Set();
130
147
  }
148
+ if (this.driver === "noop") {
149
+ return /* @__PURE__ */ new Set();
150
+ }
151
+ if (this.driver === "memory") {
152
+ return new Set(this.memoryCache ?? []);
153
+ }
131
154
  try {
132
155
  const exists = await fs.pathExists(this.options.path);
133
156
  if (!exists) {
@@ -154,6 +177,12 @@ var CacheStore = class {
154
177
  if (!this.options.enabled) {
155
178
  return /* @__PURE__ */ new Set();
156
179
  }
180
+ if (this.driver === "noop") {
181
+ return /* @__PURE__ */ new Set();
182
+ }
183
+ if (this.driver === "memory") {
184
+ return new Set(this.memoryCache ?? []);
185
+ }
157
186
  try {
158
187
  const exists = fs.pathExistsSync(this.options.path);
159
188
  if (!exists) {
@@ -188,6 +217,25 @@ async function importNode() {
188
217
  async function importOxide() {
189
218
  return import("@tailwindcss/oxide");
190
219
  }
220
+ async function loadDesignSystem(css, bases) {
221
+ const uniqueBases = Array.from(new Set(bases.filter(Boolean)));
222
+ if (uniqueBases.length === 0) {
223
+ throw new Error("No base directories provided for Tailwind CSS design system.");
224
+ }
225
+ const { __unstable__loadDesignSystem } = await importNode();
226
+ let lastError;
227
+ for (const base of uniqueBases) {
228
+ try {
229
+ return await __unstable__loadDesignSystem(css, { base });
230
+ } catch (error) {
231
+ lastError = error;
232
+ }
233
+ }
234
+ if (lastError instanceof Error) {
235
+ throw lastError;
236
+ }
237
+ throw new Error("Failed to load Tailwind CSS design system.");
238
+ }
191
239
  async function extractRawCandidatesWithPositions(content, extension = "html") {
192
240
  const { Scanner } = await importOxide();
193
241
  const scanner = new Scanner({});
@@ -209,6 +257,7 @@ async function extractValidCandidates(options) {
209
257
  const providedOptions = options ?? {};
210
258
  const defaultCwd = providedOptions.cwd ?? process2.cwd();
211
259
  const base = providedOptions.base ?? defaultCwd;
260
+ const baseFallbacks = providedOptions.baseFallbacks ?? [];
212
261
  const css = providedOptions.css ?? '@import "tailwindcss";';
213
262
  const sources = (providedOptions.sources ?? [
214
263
  {
@@ -221,8 +270,7 @@ async function extractValidCandidates(options) {
221
270
  pattern: source.pattern,
222
271
  negated: source.negated
223
272
  }));
224
- const { __unstable__loadDesignSystem } = await importNode();
225
- const designSystem = await __unstable__loadDesignSystem(css, { base });
273
+ const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks]);
226
274
  const candidates = await extractRawCandidates(sources);
227
275
  const parsedCandidates = candidates.filter(
228
276
  (rawCandidate) => designSystem.parseCandidate(rawCandidate).length > 0
@@ -391,12 +439,19 @@ function toPrettyValue(value) {
391
439
  }
392
440
  return false;
393
441
  }
442
+ function normalizeCacheDriver(driver) {
443
+ if (driver === "memory" || driver === "noop") {
444
+ return driver;
445
+ }
446
+ return "file";
447
+ }
394
448
  function normalizeCacheOptions(cache, projectRoot) {
395
449
  let enabled = false;
396
450
  let cwd = projectRoot;
397
451
  let dir = path2.resolve(cwd, "node_modules/.cache", pkgName);
398
452
  let file = "class-cache.json";
399
453
  let strategy = "merge";
454
+ let driver = "file";
400
455
  if (typeof cache === "boolean") {
401
456
  enabled = cache;
402
457
  } else if (typeof cache === "object" && cache) {
@@ -405,6 +460,7 @@ function normalizeCacheOptions(cache, projectRoot) {
405
460
  dir = cache.dir ? path2.resolve(cache.dir) : path2.resolve(cwd, "node_modules/.cache", pkgName);
406
461
  file = cache.file ?? file;
407
462
  strategy = cache.strategy ?? strategy;
463
+ driver = normalizeCacheDriver(cache.driver);
408
464
  }
409
465
  const filename = path2.resolve(dir, file);
410
466
  return {
@@ -413,7 +469,8 @@ function normalizeCacheOptions(cache, projectRoot) {
413
469
  dir,
414
470
  file,
415
471
  path: filename,
416
- strategy
472
+ strategy,
473
+ driver
417
474
  };
418
475
  }
419
476
  function normalizeOutputOptions(output) {
@@ -1305,11 +1362,13 @@ async function collectClassesFromTailwindV4(options) {
1305
1362
  }
1306
1363
  const css = await fs5.readFile(filePath, "utf8");
1307
1364
  const entryDir = path5.dirname(filePath);
1308
- const baseForEntry = resolvedConfiguredBase ?? entryDir;
1309
- const sources = resolveSources(baseForEntry);
1365
+ const designSystemBases = resolvedConfiguredBase && resolvedConfiguredBase !== entryDir ? [entryDir, resolvedConfiguredBase] : [entryDir];
1366
+ const sourcesBase = resolvedConfiguredBase ?? entryDir;
1367
+ const sources = resolveSources(sourcesBase);
1310
1368
  const candidates = await extractValidCandidates({
1311
1369
  cwd: options.projectRoot,
1312
- base: baseForEntry,
1370
+ base: designSystemBases[0],
1371
+ baseFallbacks: designSystemBases.slice(1),
1313
1372
  css,
1314
1373
  sources
1315
1374
  });
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _chunkBSUCDWMJjs = require('./chunk-BSUCDWMJ.js');
3
+ var _chunkDRPYVUDAjs = require('./chunk-DRPYVUDA.js');
4
4
 
5
5
  // src/cli.ts
6
- var cli = _chunkBSUCDWMJjs.createTailwindcssPatchCli.call(void 0, );
6
+ var cli = _chunkDRPYVUDAjs.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-KGBUT44N.mjs";
3
+ } from "./chunk-LOJHMBK5.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 {
@@ -376,6 +380,7 @@ interface LegacyTailwindcssPatcherOptions {
376
380
  interface ExtractValidCandidatesOption {
377
381
  sources?: SourceEntry[];
378
382
  base?: string;
383
+ baseFallbacks?: string[];
379
384
  css?: string;
380
385
  cwd?: string;
381
386
  }
@@ -431,6 +436,8 @@ declare class TailwindcssPatcher {
431
436
 
432
437
  declare class CacheStore {
433
438
  private readonly options;
439
+ private readonly driver;
440
+ private memoryCache;
434
441
  constructor(options: NormalizedCacheOptions);
435
442
  private ensureDir;
436
443
  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 {
@@ -376,6 +380,7 @@ interface LegacyTailwindcssPatcherOptions {
376
380
  interface ExtractValidCandidatesOption {
377
381
  sources?: SourceEntry[];
378
382
  base?: string;
383
+ baseFallbacks?: string[];
379
384
  css?: string;
380
385
  cwd?: string;
381
386
  }
@@ -431,6 +436,8 @@ declare class TailwindcssPatcher {
431
436
 
432
437
  declare class CacheStore {
433
438
  private readonly options;
439
+ private readonly driver;
440
+ private memoryCache;
434
441
  constructor(options: NormalizedCacheOptions);
435
442
  private ensureDir;
436
443
  private ensureDirSync;
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkBSUCDWMJjs = require('./chunk-BSUCDWMJ.js');
19
+ var _chunkDRPYVUDAjs = require('./chunk-DRPYVUDA.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 = _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;
42
+ exports.CacheStore = _chunkDRPYVUDAjs.CacheStore; exports.TailwindcssPatcher = _chunkDRPYVUDAjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkDRPYVUDAjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkDRPYVUDAjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkDRPYVUDAjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkDRPYVUDAjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkDRPYVUDAjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkDRPYVUDAjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkDRPYVUDAjs.extractValidCandidates; exports.getPatchStatusReport = _chunkDRPYVUDAjs.getPatchStatusReport; exports.groupTokensByFile = _chunkDRPYVUDAjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkDRPYVUDAjs.loadRuntimeContexts; exports.logger = _chunkDRPYVUDAjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkDRPYVUDAjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkDRPYVUDAjs.normalizeOptions; exports.runTailwindBuild = _chunkDRPYVUDAjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkDRPYVUDAjs.tailwindcssPatchCommands;
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  normalizeOptions,
17
17
  runTailwindBuild,
18
18
  tailwindcssPatchCommands
19
- } from "./chunk-KGBUT44N.mjs";
19
+ } from "./chunk-LOJHMBK5.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.1",
3
+ "version": "8.6.1",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",