tailwindcss-patch 8.0.0 → 8.2.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/dist/cli.js CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkFSTUQMKTjs = require('./chunk-FSTUQMKT.js');
6
+
7
+ var _chunk5KFYHNFJjs = require('./chunk-5KFYHNFJ.js');
7
8
 
8
9
  // src/cli.ts
9
10
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
@@ -101,19 +102,21 @@ var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
101
102
 
102
103
  // src/cli.ts
103
104
  var _cac = require('cac'); var _cac2 = _interopRequireDefault(_cac);
105
+ var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
106
+ var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
104
107
  var cli = _cac2.default.call(void 0, "tw-patch");
105
108
  async function loadPatchOptions(cwd, overrides) {
106
109
  const { config } = await _config.getConfig.call(void 0, cwd);
107
110
  const legacyConfig = config;
108
- const base = _optionalChain([config, 'optionalAccess', _ => _.registry]) ? _chunkFSTUQMKTjs.fromUnifiedConfig.call(void 0, config.registry) : _optionalChain([legacyConfig, 'optionalAccess', _2 => _2.patch]) ? _chunkFSTUQMKTjs.fromLegacyOptions.call(void 0, { patch: legacyConfig.patch }) : {};
111
+ const base = _optionalChain([config, 'optionalAccess', _ => _.registry]) ? _chunk5KFYHNFJjs.fromUnifiedConfig.call(void 0, config.registry) : _optionalChain([legacyConfig, 'optionalAccess', _2 => _2.patch]) ? _chunk5KFYHNFJjs.fromLegacyOptions.call(void 0, { patch: legacyConfig.patch }) : {};
109
112
  const merged = defu(_nullishCoalesce(overrides, () => ( {})), base);
110
113
  return merged;
111
114
  }
112
115
  cli.command("install", "Apply Tailwind CSS runtime patches").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
113
116
  const options = await loadPatchOptions(args.cwd);
114
- const patcher = new (0, _chunkFSTUQMKTjs.TailwindcssPatcher)(options);
117
+ const patcher = new (0, _chunk5KFYHNFJjs.TailwindcssPatcher)(options);
115
118
  await patcher.patch();
116
- _chunkFSTUQMKTjs.logger_default.success("Tailwind CSS runtime patched successfully.");
119
+ _chunk5KFYHNFJjs.logger_default.success("Tailwind CSS runtime patched successfully.");
117
120
  });
118
121
  cli.command("extract", "Collect generated class names into a cache file").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).option("--output <file>", "Override output file path").option("--format <format>", "Output format (json|lines)").option("--css <file>", "Tailwind CSS entry CSS when using v4").option("--no-write", "Skip writing to disk").action(async (args) => {
119
122
  const overrides = {};
@@ -131,17 +134,105 @@ cli.command("extract", "Collect generated class names into a cache file").option
131
134
  };
132
135
  }
133
136
  const options = await loadPatchOptions(args.cwd, overrides);
134
- const patcher = new (0, _chunkFSTUQMKTjs.TailwindcssPatcher)(options);
137
+ const patcher = new (0, _chunk5KFYHNFJjs.TailwindcssPatcher)(options);
135
138
  const result = await patcher.extract({ write: args.write });
136
139
  if (result.filename) {
137
- _chunkFSTUQMKTjs.logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
140
+ _chunk5KFYHNFJjs.logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
138
141
  } else {
139
- _chunkFSTUQMKTjs.logger_default.success(`Collected ${result.classList.length} classes.`);
142
+ _chunk5KFYHNFJjs.logger_default.success(`Collected ${result.classList.length} classes.`);
143
+ }
144
+ });
145
+ var TOKEN_FORMATS = ["json", "lines", "grouped-json"];
146
+ cli.command("tokens", "Extract Tailwind tokens with file/position metadata").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).option("--output <file>", "Override output file path", { default: ".tw-patch/tw-token-report.json" }).option("--format <format>", "Output format (json|lines|grouped-json)", { default: "json" }).option("--group-key <key>", "Grouping key for grouped-json output (relative|absolute)", { default: "relative" }).option("--no-write", "Skip writing to disk").action(async (args) => {
147
+ const options = await loadPatchOptions(args.cwd);
148
+ const patcher = new (0, _chunk5KFYHNFJjs.TailwindcssPatcher)(options);
149
+ const report = await patcher.collectContentTokens();
150
+ const shouldWrite = _nullishCoalesce(args.write, () => ( true));
151
+ let format = _nullishCoalesce(args.format, () => ( "json"));
152
+ if (!TOKEN_FORMATS.includes(format)) {
153
+ format = "json";
154
+ }
155
+ const targetFile = _nullishCoalesce(args.output, () => ( ".tw-patch/tw-token-report.json"));
156
+ const groupKey = args.groupKey === "absolute" ? "absolute" : "relative";
157
+ const buildGrouped = () => _chunk5KFYHNFJjs.groupTokensByFile.call(void 0, report, {
158
+ key: groupKey,
159
+ stripAbsolutePaths: groupKey !== "absolute"
160
+ });
161
+ const grouped = format === "grouped-json" ? buildGrouped() : null;
162
+ const resolveGrouped = () => _nullishCoalesce(grouped, () => ( buildGrouped()));
163
+ if (shouldWrite) {
164
+ const target = _pathe2.default.resolve(targetFile);
165
+ await _fsextra2.default.ensureDir(_pathe2.default.dirname(target));
166
+ if (format === "json") {
167
+ await _fsextra2.default.writeJSON(target, report, { spaces: 2 });
168
+ } else if (format === "grouped-json") {
169
+ await _fsextra2.default.writeJSON(target, resolveGrouped(), { spaces: 2 });
170
+ } else {
171
+ const lines = report.entries.map(formatTokenLine);
172
+ await _fsextra2.default.writeFile(target, `${lines.join("\n")}
173
+ `, "utf8");
174
+ }
175
+ _chunk5KFYHNFJjs.logger_default.success(
176
+ `Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(_process2.default.cwd(), ".")}`
177
+ );
178
+ } else {
179
+ _chunk5KFYHNFJjs.logger_default.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
180
+ if (format === "lines") {
181
+ const preview = report.entries.slice(0, 5).map(formatTokenLine).join("\n");
182
+ if (preview) {
183
+ _chunk5KFYHNFJjs.logger_default.log("");
184
+ _chunk5KFYHNFJjs.logger_default.info(preview);
185
+ if (report.entries.length > 5) {
186
+ _chunk5KFYHNFJjs.logger_default.info(`\u2026and ${report.entries.length - 5} more.`);
187
+ }
188
+ }
189
+ } else if (format === "grouped-json") {
190
+ const map = resolveGrouped();
191
+ const { preview, moreFiles } = formatGroupedPreview(map);
192
+ if (preview) {
193
+ _chunk5KFYHNFJjs.logger_default.log("");
194
+ _chunk5KFYHNFJjs.logger_default.info(preview);
195
+ if (moreFiles > 0) {
196
+ _chunk5KFYHNFJjs.logger_default.info(`\u2026and ${moreFiles} more files.`);
197
+ }
198
+ }
199
+ } else {
200
+ const previewEntries = report.entries.slice(0, 3);
201
+ if (previewEntries.length) {
202
+ _chunk5KFYHNFJjs.logger_default.log("");
203
+ _chunk5KFYHNFJjs.logger_default.info(JSON.stringify(previewEntries, null, 2));
204
+ }
205
+ }
206
+ }
207
+ if (report.skippedFiles.length) {
208
+ _chunk5KFYHNFJjs.logger_default.warn("Skipped files:");
209
+ for (const skipped of report.skippedFiles) {
210
+ _chunk5KFYHNFJjs.logger_default.warn(` \u2022 ${skipped.file} (${skipped.reason})`);
211
+ }
140
212
  }
141
213
  });
142
214
  cli.command("init", "Generate a tailwindcss-patch config file").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
143
215
  await _config.initConfig.call(void 0, args.cwd);
144
- _chunkFSTUQMKTjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
216
+ _chunk5KFYHNFJjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
145
217
  });
146
218
  cli.help();
147
219
  cli.parse();
220
+ function formatTokenLine(entry) {
221
+ return `${entry.relativeFile}:${entry.line}:${entry.column} ${entry.rawCandidate} (${entry.start}-${entry.end})`;
222
+ }
223
+ function formatGroupedPreview(map, limit = 3) {
224
+ const files = Object.keys(map);
225
+ if (!files.length) {
226
+ return { preview: "", moreFiles: 0 };
227
+ }
228
+ const lines = files.slice(0, limit).map((file) => {
229
+ const tokens = map[file];
230
+ const sample = tokens.slice(0, 3).map((token) => token.rawCandidate).join(", ");
231
+ const suffix = tokens.length > 3 ? ", \u2026" : "";
232
+ return `${file}: ${tokens.length} tokens (${sample}${suffix})`;
233
+ });
234
+ return {
235
+ preview: lines.join("\n"),
236
+ moreFiles: Math.max(0, files.length - limit)
237
+ };
238
+ }
package/dist/cli.mjs CHANGED
@@ -2,8 +2,9 @@ import {
2
2
  TailwindcssPatcher,
3
3
  fromLegacyOptions,
4
4
  fromUnifiedConfig,
5
+ groupTokensByFile,
5
6
  logger_default
6
- } from "./chunk-Y45IACSP.mjs";
7
+ } from "./chunk-SB2W2SQP.mjs";
7
8
 
8
9
  // src/cli.ts
9
10
  import process from "process";
@@ -101,6 +102,8 @@ var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
101
102
 
102
103
  // src/cli.ts
103
104
  import cac from "cac";
105
+ import fs from "fs-extra";
106
+ import path from "pathe";
104
107
  var cli = cac("tw-patch");
105
108
  async function loadPatchOptions(cwd, overrides) {
106
109
  const { config } = await getConfig(cwd);
@@ -139,9 +142,97 @@ cli.command("extract", "Collect generated class names into a cache file").option
139
142
  logger_default.success(`Collected ${result.classList.length} classes.`);
140
143
  }
141
144
  });
145
+ var TOKEN_FORMATS = ["json", "lines", "grouped-json"];
146
+ cli.command("tokens", "Extract Tailwind tokens with file/position metadata").option("--cwd <dir>", "Working directory", { default: process.cwd() }).option("--output <file>", "Override output file path", { default: ".tw-patch/tw-token-report.json" }).option("--format <format>", "Output format (json|lines|grouped-json)", { default: "json" }).option("--group-key <key>", "Grouping key for grouped-json output (relative|absolute)", { default: "relative" }).option("--no-write", "Skip writing to disk").action(async (args) => {
147
+ const options = await loadPatchOptions(args.cwd);
148
+ const patcher = new TailwindcssPatcher(options);
149
+ const report = await patcher.collectContentTokens();
150
+ const shouldWrite = args.write ?? true;
151
+ let format = args.format ?? "json";
152
+ if (!TOKEN_FORMATS.includes(format)) {
153
+ format = "json";
154
+ }
155
+ const targetFile = args.output ?? ".tw-patch/tw-token-report.json";
156
+ const groupKey = args.groupKey === "absolute" ? "absolute" : "relative";
157
+ const buildGrouped = () => groupTokensByFile(report, {
158
+ key: groupKey,
159
+ stripAbsolutePaths: groupKey !== "absolute"
160
+ });
161
+ const grouped = format === "grouped-json" ? buildGrouped() : null;
162
+ const resolveGrouped = () => grouped ?? buildGrouped();
163
+ if (shouldWrite) {
164
+ const target = path.resolve(targetFile);
165
+ await fs.ensureDir(path.dirname(target));
166
+ if (format === "json") {
167
+ await fs.writeJSON(target, report, { spaces: 2 });
168
+ } else if (format === "grouped-json") {
169
+ await fs.writeJSON(target, resolveGrouped(), { spaces: 2 });
170
+ } else {
171
+ const lines = report.entries.map(formatTokenLine);
172
+ await fs.writeFile(target, `${lines.join("\n")}
173
+ `, "utf8");
174
+ }
175
+ logger_default.success(
176
+ `Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(process.cwd(), ".")}`
177
+ );
178
+ } else {
179
+ logger_default.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
180
+ if (format === "lines") {
181
+ const preview = report.entries.slice(0, 5).map(formatTokenLine).join("\n");
182
+ if (preview) {
183
+ logger_default.log("");
184
+ logger_default.info(preview);
185
+ if (report.entries.length > 5) {
186
+ logger_default.info(`\u2026and ${report.entries.length - 5} more.`);
187
+ }
188
+ }
189
+ } else if (format === "grouped-json") {
190
+ const map = resolveGrouped();
191
+ const { preview, moreFiles } = formatGroupedPreview(map);
192
+ if (preview) {
193
+ logger_default.log("");
194
+ logger_default.info(preview);
195
+ if (moreFiles > 0) {
196
+ logger_default.info(`\u2026and ${moreFiles} more files.`);
197
+ }
198
+ }
199
+ } else {
200
+ const previewEntries = report.entries.slice(0, 3);
201
+ if (previewEntries.length) {
202
+ logger_default.log("");
203
+ logger_default.info(JSON.stringify(previewEntries, null, 2));
204
+ }
205
+ }
206
+ }
207
+ if (report.skippedFiles.length) {
208
+ logger_default.warn("Skipped files:");
209
+ for (const skipped of report.skippedFiles) {
210
+ logger_default.warn(` \u2022 ${skipped.file} (${skipped.reason})`);
211
+ }
212
+ }
213
+ });
142
214
  cli.command("init", "Generate a tailwindcss-patch config file").option("--cwd <dir>", "Working directory", { default: process.cwd() }).action(async (args) => {
143
215
  await initConfig(args.cwd);
144
216
  logger_default.success(`\u2728 ${CONFIG_NAME}.config.ts initialized!`);
145
217
  });
146
218
  cli.help();
147
219
  cli.parse();
220
+ function formatTokenLine(entry) {
221
+ return `${entry.relativeFile}:${entry.line}:${entry.column} ${entry.rawCandidate} (${entry.start}-${entry.end})`;
222
+ }
223
+ function formatGroupedPreview(map, limit = 3) {
224
+ const files = Object.keys(map);
225
+ if (!files.length) {
226
+ return { preview: "", moreFiles: 0 };
227
+ }
228
+ const lines = files.slice(0, limit).map((file) => {
229
+ const tokens = map[file];
230
+ const sample = tokens.slice(0, 3).map((token) => token.rawCandidate).join(", ");
231
+ const suffix = tokens.length > 3 ? ", \u2026" : "";
232
+ return `${file}: ${tokens.length} tokens (${sample}${suffix})`;
233
+ });
234
+ return {
235
+ preview: lines.join("\n"),
236
+ moreFiles: Math.max(0, files.length - limit)
237
+ };
238
+ }
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
+ import { SourceEntry } from '@tailwindcss/oxide';
1
2
  import postcss, { Node, Rule } from 'postcss';
2
3
  import { Config } from 'tailwindcss';
3
- import { SourceEntry } from '@tailwindcss/oxide';
4
4
  import { PackageResolvingOptions, PackageInfo } from 'local-pkg';
5
5
  import { TailwindLocatorOptions, TailwindNextOptions } from '@tailwindcss-mangle/config';
6
6
  export { defineConfig } from '@tailwindcss-mangle/config';
@@ -166,6 +166,29 @@ interface ExtractResult {
166
166
  classSet: Set<string>;
167
167
  filename?: string;
168
168
  }
169
+ interface TailwindTokenLocation {
170
+ rawCandidate: string;
171
+ file: string;
172
+ relativeFile: string;
173
+ extension: string;
174
+ start: number;
175
+ end: number;
176
+ length: number;
177
+ line: number;
178
+ column: number;
179
+ lineText: string;
180
+ }
181
+ type TailwindTokenFileKey = 'relative' | 'absolute';
182
+ interface TailwindTokenReport {
183
+ entries: TailwindTokenLocation[];
184
+ filesScanned: number;
185
+ sources: SourceEntry[];
186
+ skippedFiles: {
187
+ file: string;
188
+ reason: string;
189
+ }[];
190
+ }
191
+ type TailwindTokenByFileMap = Record<string, TailwindTokenLocation[]>;
169
192
  interface TailwindPatchRuntime {
170
193
  options: NormalizedTailwindcssPatchOptions;
171
194
  majorVersion: 2 | 3 | 4;
@@ -267,6 +290,15 @@ declare function extractRawCandidatesWithPositions(content: string, extension?:
267
290
  }[]>;
268
291
  declare function extractRawCandidates(sources?: SourceEntry[]): Promise<string[]>;
269
292
  declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
293
+ interface ExtractProjectCandidatesOptions {
294
+ cwd?: string;
295
+ sources?: SourceEntry[];
296
+ }
297
+ declare function extractProjectCandidatesWithPositions(options?: ExtractProjectCandidatesOptions): Promise<TailwindTokenReport>;
298
+ declare function groupTokensByFile(report: TailwindTokenReport, options?: {
299
+ key?: TailwindTokenFileKey;
300
+ stripAbsolutePaths?: boolean;
301
+ }): TailwindTokenByFileMap;
270
302
 
271
303
  type TailwindMajorVersion = 2 | 3 | 4;
272
304
  type TailwindcssPatcherInitOptions = TailwindcssPatchOptions | LegacyTailwindcssPatcherOptions;
@@ -280,20 +312,36 @@ declare class TailwindcssPatcher {
280
312
  getContexts(): TailwindcssRuntimeContext[];
281
313
  private runTailwindBuildIfNeeded;
282
314
  private collectClassSet;
315
+ private collectClassSetSync;
283
316
  private mergeWithCache;
317
+ private mergeWithCacheSync;
284
318
  getClassSet(): Promise<Set<string>>;
319
+ getClassSetSync(): Set<string>;
285
320
  extract(options?: {
286
321
  write?: boolean;
287
322
  }): Promise<ExtractResult>;
288
323
  extractValidCandidates: typeof extractValidCandidates;
324
+ collectContentTokens(options?: {
325
+ cwd?: string;
326
+ sources?: SourceEntry[];
327
+ }): Promise<TailwindTokenReport>;
328
+ collectContentTokensByFile(options?: {
329
+ cwd?: string;
330
+ sources?: SourceEntry[];
331
+ key?: TailwindTokenFileKey;
332
+ stripAbsolutePaths?: boolean;
333
+ }): Promise<TailwindTokenByFileMap>;
289
334
  }
290
335
 
291
336
  declare class CacheStore {
292
337
  private readonly options;
293
338
  constructor(options: NormalizedCacheOptions);
294
339
  private ensureDir;
340
+ private ensureDirSync;
295
341
  write(data: Set<string>): Promise<string | undefined>;
342
+ writeSync(data: Set<string>): string | undefined;
296
343
  read(): Promise<Set<string>>;
344
+ readSync(): Set<string>;
297
345
  }
298
346
 
299
347
  declare const logger: consola.ConsolaInstance;
@@ -313,4 +361,4 @@ interface TailwindBuildOptions {
313
361
  }
314
362
  declare function runTailwindBuild(options: TailwindBuildOptions): Promise<postcss.Result<postcss.Root>>;
315
363
 
316
- export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindcssClassCache, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, loadRuntimeContexts, logger, normalizeOptions, runTailwindBuild };
364
+ export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, groupTokensByFile, loadRuntimeContexts, logger, normalizeOptions, runTailwindBuild };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { SourceEntry } from '@tailwindcss/oxide';
1
2
  import postcss, { Node, Rule } from 'postcss';
2
3
  import { Config } from 'tailwindcss';
3
- import { SourceEntry } from '@tailwindcss/oxide';
4
4
  import { PackageResolvingOptions, PackageInfo } from 'local-pkg';
5
5
  import { TailwindLocatorOptions, TailwindNextOptions } from '@tailwindcss-mangle/config';
6
6
  export { defineConfig } from '@tailwindcss-mangle/config';
@@ -166,6 +166,29 @@ interface ExtractResult {
166
166
  classSet: Set<string>;
167
167
  filename?: string;
168
168
  }
169
+ interface TailwindTokenLocation {
170
+ rawCandidate: string;
171
+ file: string;
172
+ relativeFile: string;
173
+ extension: string;
174
+ start: number;
175
+ end: number;
176
+ length: number;
177
+ line: number;
178
+ column: number;
179
+ lineText: string;
180
+ }
181
+ type TailwindTokenFileKey = 'relative' | 'absolute';
182
+ interface TailwindTokenReport {
183
+ entries: TailwindTokenLocation[];
184
+ filesScanned: number;
185
+ sources: SourceEntry[];
186
+ skippedFiles: {
187
+ file: string;
188
+ reason: string;
189
+ }[];
190
+ }
191
+ type TailwindTokenByFileMap = Record<string, TailwindTokenLocation[]>;
169
192
  interface TailwindPatchRuntime {
170
193
  options: NormalizedTailwindcssPatchOptions;
171
194
  majorVersion: 2 | 3 | 4;
@@ -267,6 +290,15 @@ declare function extractRawCandidatesWithPositions(content: string, extension?:
267
290
  }[]>;
268
291
  declare function extractRawCandidates(sources?: SourceEntry[]): Promise<string[]>;
269
292
  declare function extractValidCandidates(options?: ExtractValidCandidatesOption): Promise<string[]>;
293
+ interface ExtractProjectCandidatesOptions {
294
+ cwd?: string;
295
+ sources?: SourceEntry[];
296
+ }
297
+ declare function extractProjectCandidatesWithPositions(options?: ExtractProjectCandidatesOptions): Promise<TailwindTokenReport>;
298
+ declare function groupTokensByFile(report: TailwindTokenReport, options?: {
299
+ key?: TailwindTokenFileKey;
300
+ stripAbsolutePaths?: boolean;
301
+ }): TailwindTokenByFileMap;
270
302
 
271
303
  type TailwindMajorVersion = 2 | 3 | 4;
272
304
  type TailwindcssPatcherInitOptions = TailwindcssPatchOptions | LegacyTailwindcssPatcherOptions;
@@ -280,20 +312,36 @@ declare class TailwindcssPatcher {
280
312
  getContexts(): TailwindcssRuntimeContext[];
281
313
  private runTailwindBuildIfNeeded;
282
314
  private collectClassSet;
315
+ private collectClassSetSync;
283
316
  private mergeWithCache;
317
+ private mergeWithCacheSync;
284
318
  getClassSet(): Promise<Set<string>>;
319
+ getClassSetSync(): Set<string>;
285
320
  extract(options?: {
286
321
  write?: boolean;
287
322
  }): Promise<ExtractResult>;
288
323
  extractValidCandidates: typeof extractValidCandidates;
324
+ collectContentTokens(options?: {
325
+ cwd?: string;
326
+ sources?: SourceEntry[];
327
+ }): Promise<TailwindTokenReport>;
328
+ collectContentTokensByFile(options?: {
329
+ cwd?: string;
330
+ sources?: SourceEntry[];
331
+ key?: TailwindTokenFileKey;
332
+ stripAbsolutePaths?: boolean;
333
+ }): Promise<TailwindTokenByFileMap>;
289
334
  }
290
335
 
291
336
  declare class CacheStore {
292
337
  private readonly options;
293
338
  constructor(options: NormalizedCacheOptions);
294
339
  private ensureDir;
340
+ private ensureDirSync;
295
341
  write(data: Set<string>): Promise<string | undefined>;
342
+ writeSync(data: Set<string>): string | undefined;
296
343
  read(): Promise<Set<string>>;
344
+ readSync(): Set<string>;
297
345
  }
298
346
 
299
347
  declare const logger: consola.ConsolaInstance;
@@ -313,4 +361,4 @@ interface TailwindBuildOptions {
313
361
  }
314
362
  declare function runTailwindBuild(options: TailwindBuildOptions): Promise<postcss.Result<postcss.Root>>;
315
363
 
316
- export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindcssClassCache, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, loadRuntimeContexts, logger, normalizeOptions, runTailwindBuild };
364
+ export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, groupTokensByFile, loadRuntimeContexts, logger, normalizeOptions, runTailwindBuild };
package/dist/index.js CHANGED
@@ -10,7 +10,9 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkFSTUQMKTjs = require('./chunk-FSTUQMKT.js');
13
+
14
+
15
+ var _chunk5KFYHNFJjs = require('./chunk-5KFYHNFJ.js');
14
16
 
15
17
  // src/index.ts
16
18
  var _config = require('@tailwindcss-mangle/config');
@@ -27,4 +29,6 @@ var _config = require('@tailwindcss-mangle/config');
27
29
 
28
30
 
29
31
 
30
- exports.CacheStore = _chunkFSTUQMKTjs.CacheStore; exports.TailwindcssPatcher = _chunkFSTUQMKTjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkFSTUQMKTjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkFSTUQMKTjs.collectClassesFromTailwindV4; exports.defineConfig = _config.defineConfig; exports.extractRawCandidates = _chunkFSTUQMKTjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkFSTUQMKTjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkFSTUQMKTjs.extractValidCandidates; exports.loadRuntimeContexts = _chunkFSTUQMKTjs.loadRuntimeContexts; exports.logger = _chunkFSTUQMKTjs.logger_default; exports.normalizeOptions = _chunkFSTUQMKTjs.normalizeOptions; exports.runTailwindBuild = _chunkFSTUQMKTjs.runTailwindBuild;
32
+
33
+
34
+ exports.CacheStore = _chunk5KFYHNFJjs.CacheStore; exports.TailwindcssPatcher = _chunk5KFYHNFJjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunk5KFYHNFJjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunk5KFYHNFJjs.collectClassesFromTailwindV4; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunk5KFYHNFJjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunk5KFYHNFJjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunk5KFYHNFJjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunk5KFYHNFJjs.extractValidCandidates; exports.groupTokensByFile = _chunk5KFYHNFJjs.groupTokensByFile; exports.loadRuntimeContexts = _chunk5KFYHNFJjs.loadRuntimeContexts; exports.logger = _chunk5KFYHNFJjs.logger_default; exports.normalizeOptions = _chunk5KFYHNFJjs.normalizeOptions; exports.runTailwindBuild = _chunk5KFYHNFJjs.runTailwindBuild;
package/dist/index.mjs CHANGED
@@ -3,14 +3,16 @@ import {
3
3
  TailwindcssPatcher,
4
4
  collectClassesFromContexts,
5
5
  collectClassesFromTailwindV4,
6
+ extractProjectCandidatesWithPositions,
6
7
  extractRawCandidates,
7
8
  extractRawCandidatesWithPositions,
8
9
  extractValidCandidates,
10
+ groupTokensByFile,
9
11
  loadRuntimeContexts,
10
12
  logger_default,
11
13
  normalizeOptions,
12
14
  runTailwindBuild
13
- } from "./chunk-Y45IACSP.mjs";
15
+ } from "./chunk-SB2W2SQP.mjs";
14
16
 
15
17
  // src/index.ts
16
18
  import { defineConfig } from "@tailwindcss-mangle/config";
@@ -20,9 +22,11 @@ export {
20
22
  collectClassesFromContexts,
21
23
  collectClassesFromTailwindV4,
22
24
  defineConfig,
25
+ extractProjectCandidatesWithPositions,
23
26
  extractRawCandidates,
24
27
  extractRawCandidatesWithPositions,
25
28
  extractValidCandidates,
29
+ groupTokensByFile,
26
30
  loadRuntimeContexts,
27
31
  logger_default as logger,
28
32
  normalizeOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "8.0.0",
3
+ "version": "8.2.0",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",