tailwindcss-patch 8.2.4 → 8.3.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
@@ -1,238 +1,8 @@
1
- "use strict"; 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; }
1
+ "use strict";
2
2
 
3
-
4
-
5
-
6
-
7
- var _chunkOQKHXYAKjs = require('./chunk-OQKHXYAK.js');
8
-
9
- // src/cli.ts
10
- var _process = require('process'); var _process2 = _interopRequireDefault(_process);
11
- var _config = require('@tailwindcss-mangle/config');
12
-
13
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
14
- function isPlainObject(value) {
15
- if (value === null || typeof value !== "object") {
16
- return false;
17
- }
18
- const prototype = Object.getPrototypeOf(value);
19
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
20
- return false;
21
- }
22
- if (Symbol.iterator in value) {
23
- return false;
24
- }
25
- if (Symbol.toStringTag in value) {
26
- return Object.prototype.toString.call(value) === "[object Module]";
27
- }
28
- return true;
29
- }
30
- function _defu(baseObject, defaults, namespace = ".", merger) {
31
- if (!isPlainObject(defaults)) {
32
- return _defu(baseObject, {}, namespace, merger);
33
- }
34
- const object = Object.assign({}, defaults);
35
- for (const key in baseObject) {
36
- if (key === "__proto__" || key === "constructor") {
37
- continue;
38
- }
39
- const value = baseObject[key];
40
- if (value === null || value === void 0) {
41
- continue;
42
- }
43
- if (merger && merger(object, key, value, namespace)) {
44
- continue;
45
- }
46
- if (Array.isArray(value) && Array.isArray(object[key])) {
47
- object[key] = [...value, ...object[key]];
48
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
49
- object[key] = _defu(
50
- value,
51
- object[key],
52
- (namespace ? `${namespace}.` : "") + key.toString(),
53
- merger
54
- );
55
- } else {
56
- object[key] = value;
57
- }
58
- }
59
- return object;
60
- }
61
- function createDefu(merger) {
62
- return (...arguments_) => (
63
- // eslint-disable-next-line unicorn/no-array-reduce
64
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
65
- );
66
- }
67
- var defu = createDefu();
68
- var defuFn = createDefu((object, key, currentValue) => {
69
- if (object[key] !== void 0 && typeof currentValue === "function") {
70
- object[key] = currentValue(object[key]);
71
- return true;
72
- }
73
- });
74
- var defuArrayFn = createDefu((object, key, currentValue) => {
75
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
76
- object[key] = currentValue(object[key]);
77
- return true;
78
- }
79
- });
80
-
81
- // ../shared/src/utils.ts
82
- var defuOverrideArray = createDefu((obj, key, value) => {
83
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
84
- obj[key] = value;
85
- return true;
86
- }
87
- });
88
- var preserveClassNames = [
89
- // https://tailwindcss.com/docs/transition-timing-function start
90
- // https://github.com/sonofmagic/tailwindcss-mangle/issues/21
91
- "ease-out",
92
- "ease-linear",
93
- "ease-in",
94
- "ease-in-out"
95
- // https://tailwindcss.com/docs/transition-timing-function end
96
- ];
97
- var preserveClassNamesMap = preserveClassNames.reduce((acc, cur) => {
98
- acc[cur] = true;
99
- return acc;
100
- }, {});
101
- var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
3
+ var _chunk7ZWFVW77js = require('./chunk-7ZWFVW77.js');
102
4
 
103
5
  // src/cli.ts
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);
107
- var cli = _cac2.default.call(void 0, "tw-patch");
108
- async function loadPatchOptions(cwd, overrides) {
109
- const { config } = await _config.getConfig.call(void 0, cwd);
110
- const legacyConfig = config;
111
- const base = _optionalChain([config, 'optionalAccess', _ => _.registry]) ? _chunkOQKHXYAKjs.fromUnifiedConfig.call(void 0, config.registry) : _optionalChain([legacyConfig, 'optionalAccess', _2 => _2.patch]) ? _chunkOQKHXYAKjs.fromLegacyOptions.call(void 0, { patch: legacyConfig.patch }) : {};
112
- const merged = defu(_nullishCoalesce(overrides, () => ( {})), base);
113
- return merged;
114
- }
115
- cli.command("install", "Apply Tailwind CSS runtime patches").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
116
- const options = await loadPatchOptions(args.cwd);
117
- const patcher = new (0, _chunkOQKHXYAKjs.TailwindcssPatcher)(options);
118
- await patcher.patch();
119
- _chunkOQKHXYAKjs.logger_default.success("Tailwind CSS runtime patched successfully.");
120
- });
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) => {
122
- const overrides = {};
123
- if (args.output || args.format) {
124
- overrides.output = {
125
- file: args.output,
126
- format: args.format
127
- };
128
- }
129
- if (args.css) {
130
- overrides.tailwind = {
131
- v4: {
132
- cssEntries: [args.css]
133
- }
134
- };
135
- }
136
- const options = await loadPatchOptions(args.cwd, overrides);
137
- const patcher = new (0, _chunkOQKHXYAKjs.TailwindcssPatcher)(options);
138
- const result = await patcher.extract({ write: args.write });
139
- if (result.filename) {
140
- _chunkOQKHXYAKjs.logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
141
- } else {
142
- _chunkOQKHXYAKjs.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, _chunkOQKHXYAKjs.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 = () => _chunkOQKHXYAKjs.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
- _chunkOQKHXYAKjs.logger_default.success(
176
- `Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(_process2.default.cwd(), ".")}`
177
- );
178
- } else {
179
- _chunkOQKHXYAKjs.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
- _chunkOQKHXYAKjs.logger_default.log("");
184
- _chunkOQKHXYAKjs.logger_default.info(preview);
185
- if (report.entries.length > 5) {
186
- _chunkOQKHXYAKjs.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
- _chunkOQKHXYAKjs.logger_default.log("");
194
- _chunkOQKHXYAKjs.logger_default.info(preview);
195
- if (moreFiles > 0) {
196
- _chunkOQKHXYAKjs.logger_default.info(`\u2026and ${moreFiles} more files.`);
197
- }
198
- }
199
- } else {
200
- const previewEntries = report.entries.slice(0, 3);
201
- if (previewEntries.length) {
202
- _chunkOQKHXYAKjs.logger_default.log("");
203
- _chunkOQKHXYAKjs.logger_default.info(JSON.stringify(previewEntries, null, 2));
204
- }
205
- }
206
- }
207
- if (report.skippedFiles.length) {
208
- _chunkOQKHXYAKjs.logger_default.warn("Skipped files:");
209
- for (const skipped of report.skippedFiles) {
210
- _chunkOQKHXYAKjs.logger_default.warn(` \u2022 ${skipped.file} (${skipped.reason})`);
211
- }
212
- }
213
- });
214
- cli.command("init", "Generate a tailwindcss-patch config file").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
215
- await _config.initConfig.call(void 0, args.cwd);
216
- _chunkOQKHXYAKjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
217
- });
6
+ var cli = _chunk7ZWFVW77js.createTailwindcssPatchCli.call(void 0, );
218
7
  cli.help();
219
8
  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
@@ -1,238 +1,8 @@
1
1
  import {
2
- TailwindcssPatcher,
3
- fromLegacyOptions,
4
- fromUnifiedConfig,
5
- groupTokensByFile,
6
- logger_default
7
- } from "./chunk-4BI6FMCK.mjs";
2
+ createTailwindcssPatchCli
3
+ } from "./chunk-SN7IO2IS.mjs";
8
4
 
9
5
  // src/cli.ts
10
- import process from "process";
11
- import { CONFIG_NAME, getConfig, initConfig } from "@tailwindcss-mangle/config";
12
-
13
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
14
- function isPlainObject(value) {
15
- if (value === null || typeof value !== "object") {
16
- return false;
17
- }
18
- const prototype = Object.getPrototypeOf(value);
19
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
20
- return false;
21
- }
22
- if (Symbol.iterator in value) {
23
- return false;
24
- }
25
- if (Symbol.toStringTag in value) {
26
- return Object.prototype.toString.call(value) === "[object Module]";
27
- }
28
- return true;
29
- }
30
- function _defu(baseObject, defaults, namespace = ".", merger) {
31
- if (!isPlainObject(defaults)) {
32
- return _defu(baseObject, {}, namespace, merger);
33
- }
34
- const object = Object.assign({}, defaults);
35
- for (const key in baseObject) {
36
- if (key === "__proto__" || key === "constructor") {
37
- continue;
38
- }
39
- const value = baseObject[key];
40
- if (value === null || value === void 0) {
41
- continue;
42
- }
43
- if (merger && merger(object, key, value, namespace)) {
44
- continue;
45
- }
46
- if (Array.isArray(value) && Array.isArray(object[key])) {
47
- object[key] = [...value, ...object[key]];
48
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
49
- object[key] = _defu(
50
- value,
51
- object[key],
52
- (namespace ? `${namespace}.` : "") + key.toString(),
53
- merger
54
- );
55
- } else {
56
- object[key] = value;
57
- }
58
- }
59
- return object;
60
- }
61
- function createDefu(merger) {
62
- return (...arguments_) => (
63
- // eslint-disable-next-line unicorn/no-array-reduce
64
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
65
- );
66
- }
67
- var defu = createDefu();
68
- var defuFn = createDefu((object, key, currentValue) => {
69
- if (object[key] !== void 0 && typeof currentValue === "function") {
70
- object[key] = currentValue(object[key]);
71
- return true;
72
- }
73
- });
74
- var defuArrayFn = createDefu((object, key, currentValue) => {
75
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
76
- object[key] = currentValue(object[key]);
77
- return true;
78
- }
79
- });
80
-
81
- // ../shared/src/utils.ts
82
- var defuOverrideArray = createDefu((obj, key, value) => {
83
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
84
- obj[key] = value;
85
- return true;
86
- }
87
- });
88
- var preserveClassNames = [
89
- // https://tailwindcss.com/docs/transition-timing-function start
90
- // https://github.com/sonofmagic/tailwindcss-mangle/issues/21
91
- "ease-out",
92
- "ease-linear",
93
- "ease-in",
94
- "ease-in-out"
95
- // https://tailwindcss.com/docs/transition-timing-function end
96
- ];
97
- var preserveClassNamesMap = preserveClassNames.reduce((acc, cur) => {
98
- acc[cur] = true;
99
- return acc;
100
- }, {});
101
- var acceptChars = [..."abcdefghijklmnopqrstuvwxyz"];
102
-
103
- // src/cli.ts
104
- import cac from "cac";
105
- import fs from "fs-extra";
106
- import path from "pathe";
107
- var cli = cac("tw-patch");
108
- async function loadPatchOptions(cwd, overrides) {
109
- const { config } = await getConfig(cwd);
110
- const legacyConfig = config;
111
- const base = config?.registry ? fromUnifiedConfig(config.registry) : legacyConfig?.patch ? fromLegacyOptions({ patch: legacyConfig.patch }) : {};
112
- const merged = defu(overrides ?? {}, base);
113
- return merged;
114
- }
115
- cli.command("install", "Apply Tailwind CSS runtime patches").option("--cwd <dir>", "Working directory", { default: process.cwd() }).action(async (args) => {
116
- const options = await loadPatchOptions(args.cwd);
117
- const patcher = new TailwindcssPatcher(options);
118
- await patcher.patch();
119
- logger_default.success("Tailwind CSS runtime patched successfully.");
120
- });
121
- cli.command("extract", "Collect generated class names into a cache file").option("--cwd <dir>", "Working directory", { default: process.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) => {
122
- const overrides = {};
123
- if (args.output || args.format) {
124
- overrides.output = {
125
- file: args.output,
126
- format: args.format
127
- };
128
- }
129
- if (args.css) {
130
- overrides.tailwind = {
131
- v4: {
132
- cssEntries: [args.css]
133
- }
134
- };
135
- }
136
- const options = await loadPatchOptions(args.cwd, overrides);
137
- const patcher = new TailwindcssPatcher(options);
138
- const result = await patcher.extract({ write: args.write });
139
- if (result.filename) {
140
- logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
141
- } else {
142
- 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: 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
- });
214
- cli.command("init", "Generate a tailwindcss-patch config file").option("--cwd <dir>", "Working directory", { default: process.cwd() }).action(async (args) => {
215
- await initConfig(args.cwd);
216
- logger_default.success(`\u2728 ${CONFIG_NAME}.config.ts initialized!`);
217
- });
6
+ var cli = createTailwindcssPatchCli();
218
7
  cli.help();
219
8
  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
@@ -4,6 +4,7 @@ import { Config } from 'tailwindcss';
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';
7
+ import { CAC } from 'cac';
7
8
  import * as consola from 'consola';
8
9
 
9
10
  type CacheStrategy = 'merge' | 'overwrite';
@@ -422,6 +423,24 @@ declare class CacheStore {
422
423
  readSync(): Set<string>;
423
424
  }
424
425
 
426
+ type TailwindcssPatchCommand = 'install' | 'extract' | 'tokens' | 'init';
427
+ declare const tailwindcssPatchCommands: TailwindcssPatchCommand[];
428
+ interface TailwindcssPatchCommandOptions {
429
+ name?: string;
430
+ aliases?: string[];
431
+ }
432
+ interface TailwindcssPatchCliMountOptions {
433
+ commandPrefix?: string;
434
+ commands?: TailwindcssPatchCommand[];
435
+ commandOptions?: Partial<Record<TailwindcssPatchCommand, TailwindcssPatchCommandOptions>>;
436
+ }
437
+ interface TailwindcssPatchCliOptions {
438
+ name?: string;
439
+ mountOptions?: TailwindcssPatchCliMountOptions;
440
+ }
441
+ declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
442
+ declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
443
+
425
444
  declare const logger: consola.ConsolaInstance;
426
445
 
427
446
  declare function normalizeOptions(options?: TailwindcssPatchOptions): NormalizedTailwindcssPatchOptions;
@@ -439,4 +458,4 @@ interface TailwindBuildOptions {
439
458
  }
440
459
  declare function runTailwindBuild(options: TailwindBuildOptions): Promise<postcss.Result<postcss.Root>>;
441
460
 
442
- 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 };
461
+ export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandOptions, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, groupTokensByFile, loadRuntimeContexts, logger, mountTailwindcssPatchCommands, normalizeOptions, runTailwindBuild, tailwindcssPatchCommands };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Config } from 'tailwindcss';
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';
7
+ import { CAC } from 'cac';
7
8
  import * as consola from 'consola';
8
9
 
9
10
  type CacheStrategy = 'merge' | 'overwrite';
@@ -422,6 +423,24 @@ declare class CacheStore {
422
423
  readSync(): Set<string>;
423
424
  }
424
425
 
426
+ type TailwindcssPatchCommand = 'install' | 'extract' | 'tokens' | 'init';
427
+ declare const tailwindcssPatchCommands: TailwindcssPatchCommand[];
428
+ interface TailwindcssPatchCommandOptions {
429
+ name?: string;
430
+ aliases?: string[];
431
+ }
432
+ interface TailwindcssPatchCliMountOptions {
433
+ commandPrefix?: string;
434
+ commands?: TailwindcssPatchCommand[];
435
+ commandOptions?: Partial<Record<TailwindcssPatchCommand, TailwindcssPatchCommandOptions>>;
436
+ }
437
+ interface TailwindcssPatchCliOptions {
438
+ name?: string;
439
+ mountOptions?: TailwindcssPatchCliMountOptions;
440
+ }
441
+ declare function createTailwindcssPatchCli(options?: TailwindcssPatchCliOptions): CAC;
442
+ declare function mountTailwindcssPatchCommands(cli: CAC, options?: TailwindcssPatchCliMountOptions): CAC;
443
+
425
444
  declare const logger: consola.ConsolaInstance;
426
445
 
427
446
  declare function normalizeOptions(options?: TailwindcssPatchOptions): NormalizedTailwindcssPatchOptions;
@@ -439,4 +458,4 @@ interface TailwindBuildOptions {
439
458
  }
440
459
  declare function runTailwindBuild(options: TailwindBuildOptions): Promise<postcss.Result<postcss.Root>>;
441
460
 
442
- 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 };
461
+ export { CacheStore, type CacheStrategy, type ExtractResult, type ILengthUnitsPatchOptions, type NormalizedTailwindcssPatchOptions, type TailwindPatchRuntime, type TailwindTokenByFileMap, type TailwindTokenFileKey, type TailwindTokenLocation, type TailwindTokenReport, type TailwindcssClassCache, type TailwindcssPatchCliMountOptions, type TailwindcssPatchCliOptions, type TailwindcssPatchCommand, type TailwindcssPatchCommandOptions, type TailwindcssPatchOptions, TailwindcssPatcher, type TailwindcssRuntimeContext, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindcssPatchCli, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractValidCandidates, groupTokensByFile, loadRuntimeContexts, logger, mountTailwindcssPatchCommands, normalizeOptions, runTailwindBuild, tailwindcssPatchCommands };
package/dist/index.js CHANGED
@@ -12,7 +12,10 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkOQKHXYAKjs = require('./chunk-OQKHXYAK.js');
15
+
16
+
17
+
18
+ var _chunk7ZWFVW77js = require('./chunk-7ZWFVW77.js');
16
19
 
17
20
  // src/index.ts
18
21
  var _config = require('@tailwindcss-mangle/config');
@@ -31,4 +34,7 @@ var _config = require('@tailwindcss-mangle/config');
31
34
 
32
35
 
33
36
 
34
- exports.CacheStore = _chunkOQKHXYAKjs.CacheStore; exports.TailwindcssPatcher = _chunkOQKHXYAKjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkOQKHXYAKjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkOQKHXYAKjs.collectClassesFromTailwindV4; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkOQKHXYAKjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkOQKHXYAKjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkOQKHXYAKjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkOQKHXYAKjs.extractValidCandidates; exports.groupTokensByFile = _chunkOQKHXYAKjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkOQKHXYAKjs.loadRuntimeContexts; exports.logger = _chunkOQKHXYAKjs.logger_default; exports.normalizeOptions = _chunkOQKHXYAKjs.normalizeOptions; exports.runTailwindBuild = _chunkOQKHXYAKjs.runTailwindBuild;
37
+
38
+
39
+
40
+ exports.CacheStore = _chunk7ZWFVW77js.CacheStore; exports.TailwindcssPatcher = _chunk7ZWFVW77js.TailwindcssPatcher; exports.collectClassesFromContexts = _chunk7ZWFVW77js.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunk7ZWFVW77js.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunk7ZWFVW77js.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunk7ZWFVW77js.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunk7ZWFVW77js.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunk7ZWFVW77js.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunk7ZWFVW77js.extractValidCandidates; exports.groupTokensByFile = _chunk7ZWFVW77js.groupTokensByFile; exports.loadRuntimeContexts = _chunk7ZWFVW77js.loadRuntimeContexts; exports.logger = _chunk7ZWFVW77js.logger_default; exports.mountTailwindcssPatchCommands = _chunk7ZWFVW77js.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunk7ZWFVW77js.normalizeOptions; exports.runTailwindBuild = _chunk7ZWFVW77js.runTailwindBuild; exports.tailwindcssPatchCommands = _chunk7ZWFVW77js.tailwindcssPatchCommands;
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  TailwindcssPatcher,
4
4
  collectClassesFromContexts,
5
5
  collectClassesFromTailwindV4,
6
+ createTailwindcssPatchCli,
6
7
  extractProjectCandidatesWithPositions,
7
8
  extractRawCandidates,
8
9
  extractRawCandidatesWithPositions,
@@ -10,9 +11,11 @@ import {
10
11
  groupTokensByFile,
11
12
  loadRuntimeContexts,
12
13
  logger_default,
14
+ mountTailwindcssPatchCommands,
13
15
  normalizeOptions,
14
- runTailwindBuild
15
- } from "./chunk-4BI6FMCK.mjs";
16
+ runTailwindBuild,
17
+ tailwindcssPatchCommands
18
+ } from "./chunk-SN7IO2IS.mjs";
16
19
 
17
20
  // src/index.ts
18
21
  import { defineConfig } from "@tailwindcss-mangle/config";
@@ -21,6 +24,7 @@ export {
21
24
  TailwindcssPatcher,
22
25
  collectClassesFromContexts,
23
26
  collectClassesFromTailwindV4,
27
+ createTailwindcssPatchCli,
24
28
  defineConfig,
25
29
  extractProjectCandidatesWithPositions,
26
30
  extractRawCandidates,
@@ -29,6 +33,8 @@ export {
29
33
  groupTokensByFile,
30
34
  loadRuntimeContexts,
31
35
  logger_default as logger,
36
+ mountTailwindcssPatchCommands,
32
37
  normalizeOptions,
33
- runTailwindBuild
38
+ runTailwindBuild,
39
+ tailwindcssPatchCommands
34
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss-patch",
3
- "version": "8.2.4",
3
+ "version": "8.3.0",
4
4
  "description": "patch tailwindcss for exposing context and extract classes",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "@tailwindcss/vite": "^4.1.17",
72
72
  "tailwindcss": "^4.1.17",
73
73
  "tailwindcss-3": "npm:tailwindcss@^3.4.18",
74
- "tailwindcss-4": "npm:tailwindcss@^4.1.16"
74
+ "tailwindcss-4": "npm:tailwindcss@^4.1.17"
75
75
  },
76
76
  "scripts": {
77
77
  "dev": "tsup --watch --sourcemap",