tailwindcss-patch 8.2.3 → 8.2.4
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/{chunk-KH3TRSVT.mjs → chunk-4BI6FMCK.mjs} +38 -10
- package/dist/{chunk-CFH3UEW6.js → chunk-OQKHXYAK.js} +54 -26
- package/dist/cli.js +22 -22
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -479,9 +479,12 @@ function normalizeExtendLengthUnitsOptions(features) {
|
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
481
|
function normalizeTailwindV4Options(v4, fallbackBase) {
|
|
482
|
-
const
|
|
482
|
+
const configuredBase = v4?.base ? path2.resolve(v4.base) : void 0;
|
|
483
|
+
const base = configuredBase ?? fallbackBase;
|
|
483
484
|
const cssEntries = Array.isArray(v4?.cssEntries) ? v4.cssEntries.filter((entry) => Boolean(entry)).map((entry) => path2.resolve(entry)) : [];
|
|
484
|
-
const
|
|
485
|
+
const userSources = v4?.sources;
|
|
486
|
+
const hasUserDefinedSources = Boolean(userSources?.length);
|
|
487
|
+
const sources = hasUserDefinedSources ? userSources : [
|
|
485
488
|
{
|
|
486
489
|
base,
|
|
487
490
|
pattern: "**/*",
|
|
@@ -490,9 +493,11 @@ function normalizeTailwindV4Options(v4, fallbackBase) {
|
|
|
490
493
|
];
|
|
491
494
|
return {
|
|
492
495
|
base,
|
|
496
|
+
configuredBase,
|
|
493
497
|
css: v4?.css,
|
|
494
498
|
cssEntries,
|
|
495
|
-
sources
|
|
499
|
+
sources,
|
|
500
|
+
hasUserDefinedSources
|
|
496
501
|
};
|
|
497
502
|
}
|
|
498
503
|
function normalizeTailwindOptions(tailwind, projectRoot) {
|
|
@@ -598,13 +603,31 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
598
603
|
if (!v4Options) {
|
|
599
604
|
return set;
|
|
600
605
|
}
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
|
|
606
|
+
const toAbsolute = (value) => {
|
|
607
|
+
if (!value) {
|
|
608
|
+
return void 0;
|
|
609
|
+
}
|
|
610
|
+
return path3.isAbsolute(value) ? value : path3.resolve(options.projectRoot, value);
|
|
611
|
+
};
|
|
612
|
+
const resolvedConfiguredBase = toAbsolute(v4Options.configuredBase);
|
|
613
|
+
const resolvedDefaultBase = toAbsolute(v4Options.base) ?? process3.cwd();
|
|
614
|
+
const resolveSources = (base) => {
|
|
615
|
+
if (!v4Options.sources?.length) {
|
|
616
|
+
return void 0;
|
|
617
|
+
}
|
|
618
|
+
if (!v4Options.hasUserDefinedSources && !resolvedConfiguredBase) {
|
|
619
|
+
return v4Options.sources.map((source) => ({
|
|
620
|
+
base,
|
|
621
|
+
pattern: source.pattern,
|
|
622
|
+
negated: source.negated
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
return v4Options.sources.map((source) => ({
|
|
626
|
+
base: source.base ?? base,
|
|
604
627
|
pattern: source.pattern,
|
|
605
628
|
negated: source.negated
|
|
606
|
-
};
|
|
607
|
-
}
|
|
629
|
+
}));
|
|
630
|
+
};
|
|
608
631
|
if (v4Options.cssEntries.length > 0) {
|
|
609
632
|
for (const entry of v4Options.cssEntries) {
|
|
610
633
|
const filePath = path3.isAbsolute(entry) ? entry : path3.resolve(options.projectRoot, entry);
|
|
@@ -612,9 +635,12 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
612
635
|
continue;
|
|
613
636
|
}
|
|
614
637
|
const css = await fs3.readFile(filePath, "utf8");
|
|
638
|
+
const entryDir = path3.dirname(filePath);
|
|
639
|
+
const baseForEntry = resolvedConfiguredBase ?? entryDir;
|
|
640
|
+
const sources = resolveSources(baseForEntry);
|
|
615
641
|
const candidates = await extractValidCandidates({
|
|
616
642
|
cwd: options.projectRoot,
|
|
617
|
-
base:
|
|
643
|
+
base: baseForEntry,
|
|
618
644
|
css,
|
|
619
645
|
sources
|
|
620
646
|
});
|
|
@@ -625,9 +651,11 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
625
651
|
}
|
|
626
652
|
}
|
|
627
653
|
} else {
|
|
654
|
+
const baseForCss = resolvedConfiguredBase ?? resolvedDefaultBase;
|
|
655
|
+
const sources = resolveSources(baseForCss);
|
|
628
656
|
const candidates = await extractValidCandidates({
|
|
629
657
|
cwd: options.projectRoot,
|
|
630
|
-
base:
|
|
658
|
+
base: baseForCss,
|
|
631
659
|
css: v4Options.css,
|
|
632
660
|
sources
|
|
633
661
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src
|
|
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.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
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
|
|
|
5
5
|
// src/logger.ts
|
|
@@ -483,9 +483,12 @@ function normalizeExtendLengthUnitsOptions(features) {
|
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
function normalizeTailwindV4Options(v4, fallbackBase) {
|
|
486
|
-
const
|
|
486
|
+
const configuredBase = _optionalChain([v4, 'optionalAccess', _35 => _35.base]) ? _pathe2.default.resolve(v4.base) : void 0;
|
|
487
|
+
const base = _nullishCoalesce(configuredBase, () => ( fallbackBase));
|
|
487
488
|
const cssEntries = Array.isArray(_optionalChain([v4, 'optionalAccess', _36 => _36.cssEntries])) ? v4.cssEntries.filter((entry) => Boolean(entry)).map((entry) => _pathe2.default.resolve(entry)) : [];
|
|
488
|
-
const
|
|
489
|
+
const userSources = _optionalChain([v4, 'optionalAccess', _37 => _37.sources]);
|
|
490
|
+
const hasUserDefinedSources = Boolean(_optionalChain([userSources, 'optionalAccess', _38 => _38.length]));
|
|
491
|
+
const sources = hasUserDefinedSources ? userSources : [
|
|
489
492
|
{
|
|
490
493
|
base,
|
|
491
494
|
pattern: "**/*",
|
|
@@ -494,9 +497,11 @@ function normalizeTailwindV4Options(v4, fallbackBase) {
|
|
|
494
497
|
];
|
|
495
498
|
return {
|
|
496
499
|
base,
|
|
500
|
+
configuredBase,
|
|
497
501
|
css: _optionalChain([v4, 'optionalAccess', _39 => _39.css]),
|
|
498
502
|
cssEntries,
|
|
499
|
-
sources
|
|
503
|
+
sources,
|
|
504
|
+
hasUserDefinedSources
|
|
500
505
|
};
|
|
501
506
|
}
|
|
502
507
|
function normalizeTailwindOptions(tailwind, projectRoot) {
|
|
@@ -602,13 +607,31 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
602
607
|
if (!v4Options) {
|
|
603
608
|
return set;
|
|
604
609
|
}
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
610
|
+
const toAbsolute = (value) => {
|
|
611
|
+
if (!value) {
|
|
612
|
+
return void 0;
|
|
613
|
+
}
|
|
614
|
+
return _pathe2.default.isAbsolute(value) ? value : _pathe2.default.resolve(options.projectRoot, value);
|
|
615
|
+
};
|
|
616
|
+
const resolvedConfiguredBase = toAbsolute(v4Options.configuredBase);
|
|
617
|
+
const resolvedDefaultBase = _nullishCoalesce(toAbsolute(v4Options.base), () => ( _process2.default.cwd()));
|
|
618
|
+
const resolveSources = (base) => {
|
|
619
|
+
if (!_optionalChain([v4Options, 'access', _49 => _49.sources, 'optionalAccess', _50 => _50.length])) {
|
|
620
|
+
return void 0;
|
|
621
|
+
}
|
|
622
|
+
if (!v4Options.hasUserDefinedSources && !resolvedConfiguredBase) {
|
|
623
|
+
return v4Options.sources.map((source) => ({
|
|
624
|
+
base,
|
|
625
|
+
pattern: source.pattern,
|
|
626
|
+
negated: source.negated
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
return v4Options.sources.map((source) => ({
|
|
630
|
+
base: _nullishCoalesce(source.base, () => ( base)),
|
|
608
631
|
pattern: source.pattern,
|
|
609
632
|
negated: source.negated
|
|
610
|
-
};
|
|
611
|
-
}
|
|
633
|
+
}));
|
|
634
|
+
};
|
|
612
635
|
if (v4Options.cssEntries.length > 0) {
|
|
613
636
|
for (const entry of v4Options.cssEntries) {
|
|
614
637
|
const filePath = _pathe2.default.isAbsolute(entry) ? entry : _pathe2.default.resolve(options.projectRoot, entry);
|
|
@@ -616,9 +639,12 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
616
639
|
continue;
|
|
617
640
|
}
|
|
618
641
|
const css = await _fsextra2.default.readFile(filePath, "utf8");
|
|
642
|
+
const entryDir = _pathe2.default.dirname(filePath);
|
|
643
|
+
const baseForEntry = _nullishCoalesce(resolvedConfiguredBase, () => ( entryDir));
|
|
644
|
+
const sources = resolveSources(baseForEntry);
|
|
619
645
|
const candidates = await extractValidCandidates({
|
|
620
646
|
cwd: options.projectRoot,
|
|
621
|
-
base:
|
|
647
|
+
base: baseForEntry,
|
|
622
648
|
css,
|
|
623
649
|
sources
|
|
624
650
|
});
|
|
@@ -629,9 +655,11 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
629
655
|
}
|
|
630
656
|
}
|
|
631
657
|
} else {
|
|
658
|
+
const baseForCss = _nullishCoalesce(resolvedConfiguredBase, () => ( resolvedDefaultBase));
|
|
659
|
+
const sources = resolveSources(baseForCss);
|
|
632
660
|
const candidates = await extractValidCandidates({
|
|
633
661
|
cwd: options.projectRoot,
|
|
634
|
-
base:
|
|
662
|
+
base: baseForCss,
|
|
635
663
|
css: v4Options.css,
|
|
636
664
|
sources
|
|
637
665
|
});
|
|
@@ -780,7 +808,7 @@ function transformProcessTailwindFeaturesReturnContextV2(content) {
|
|
|
780
808
|
traverse(ast, {
|
|
781
809
|
FunctionDeclaration(path9) {
|
|
782
810
|
const node = path9.node;
|
|
783
|
-
if (_optionalChain([node, 'access',
|
|
811
|
+
if (_optionalChain([node, 'access', _51 => _51.id, 'optionalAccess', _52 => _52.name]) !== "processTailwindFeatures" || node.body.body.length !== 1 || !t.isReturnStatement(node.body.body[0])) {
|
|
784
812
|
return;
|
|
785
813
|
}
|
|
786
814
|
const returnStatement3 = node.body.body[0];
|
|
@@ -813,7 +841,7 @@ function transformPostcssPluginV2(content, options) {
|
|
|
813
841
|
Program(path9) {
|
|
814
842
|
const program = path9.node;
|
|
815
843
|
const index = program.body.findIndex((statement) => {
|
|
816
|
-
return t.isFunctionDeclaration(statement) && _optionalChain([statement, 'access',
|
|
844
|
+
return t.isFunctionDeclaration(statement) && _optionalChain([statement, 'access', _53 => _53.id, 'optionalAccess', _54 => _54.name]) === "_default";
|
|
817
845
|
});
|
|
818
846
|
if (index === -1) {
|
|
819
847
|
return;
|
|
@@ -850,7 +878,7 @@ function transformPostcssPluginV2(content, options) {
|
|
|
850
878
|
return;
|
|
851
879
|
}
|
|
852
880
|
const fn = path9.node;
|
|
853
|
-
if (_optionalChain([fn, 'access',
|
|
881
|
+
if (_optionalChain([fn, 'access', _55 => _55.id, 'optionalAccess', _56 => _56.name]) !== "_default") {
|
|
854
882
|
return;
|
|
855
883
|
}
|
|
856
884
|
if (fn.body.body.length !== 1 || !t.isReturnStatement(fn.body.body[0])) {
|
|
@@ -940,7 +968,7 @@ function transformProcessTailwindFeaturesReturnContext(content) {
|
|
|
940
968
|
traverse(ast, {
|
|
941
969
|
FunctionDeclaration(path9) {
|
|
942
970
|
const node = path9.node;
|
|
943
|
-
if (_optionalChain([node, 'access',
|
|
971
|
+
if (_optionalChain([node, 'access', _57 => _57.id, 'optionalAccess', _58 => _58.name]) !== "processTailwindFeatures" || node.body.body.length !== 1) {
|
|
944
972
|
return;
|
|
945
973
|
}
|
|
946
974
|
const [returnStatement3] = node.body.body;
|
|
@@ -974,7 +1002,7 @@ function transformPostcssPlugin(content, { refProperty }) {
|
|
|
974
1002
|
Program(path9) {
|
|
975
1003
|
const program = path9.node;
|
|
976
1004
|
const index = program.body.findIndex((statement) => {
|
|
977
|
-
return t2.isExpressionStatement(statement) && t2.isAssignmentExpression(statement.expression) && t2.isMemberExpression(statement.expression.left) && t2.isFunctionExpression(statement.expression.right) && _optionalChain([statement, 'access',
|
|
1005
|
+
return t2.isExpressionStatement(statement) && t2.isAssignmentExpression(statement.expression) && t2.isMemberExpression(statement.expression.left) && t2.isFunctionExpression(statement.expression.right) && _optionalChain([statement, 'access', _59 => _59.expression, 'access', _60 => _60.right, 'access', _61 => _61.id, 'optionalAccess', _62 => _62.name]) === "tailwindcss";
|
|
978
1006
|
});
|
|
979
1007
|
if (index === -1) {
|
|
980
1008
|
return;
|
|
@@ -1015,7 +1043,7 @@ function transformPostcssPlugin(content, { refProperty }) {
|
|
|
1015
1043
|
return;
|
|
1016
1044
|
}
|
|
1017
1045
|
const fn = path9.node;
|
|
1018
|
-
if (_optionalChain([fn, 'access',
|
|
1046
|
+
if (_optionalChain([fn, 'access', _63 => _63.id, 'optionalAccess', _64 => _64.name]) !== "tailwindcss" || fn.body.body.length !== 1) {
|
|
1019
1047
|
return;
|
|
1020
1048
|
}
|
|
1021
1049
|
const [returnStatement3] = fn.body.body;
|
|
@@ -1323,7 +1351,7 @@ function applyTailwindPatches(context) {
|
|
|
1323
1351
|
majorVersion
|
|
1324
1352
|
});
|
|
1325
1353
|
}
|
|
1326
|
-
if (_optionalChain([options, 'access',
|
|
1354
|
+
if (_optionalChain([options, 'access', _65 => _65.features, 'access', _66 => _66.extendLengthUnits, 'optionalAccess', _67 => _67.enabled])) {
|
|
1327
1355
|
if (majorVersion === 3) {
|
|
1328
1356
|
results.extendLengthUnits = applyExtendLengthUnitsPatchV3(
|
|
1329
1357
|
packageInfo.rootPath,
|
|
@@ -1489,7 +1517,7 @@ var TailwindcssPatcher = (_class = class {
|
|
|
1489
1517
|
return this.mergeWithCacheSync(set);
|
|
1490
1518
|
}
|
|
1491
1519
|
async extract(options) {
|
|
1492
|
-
const shouldWrite = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1520
|
+
const shouldWrite = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.write]), () => ( this.options.output.enabled));
|
|
1493
1521
|
const classSet = await this.getClassSet();
|
|
1494
1522
|
const classList = Array.from(classSet);
|
|
1495
1523
|
const result = {
|
|
@@ -1518,18 +1546,18 @@ var TailwindcssPatcher = (_class = class {
|
|
|
1518
1546
|
__init() {this.extractValidCandidates = exports.extractValidCandidates = extractValidCandidates}
|
|
1519
1547
|
async collectContentTokens(options) {
|
|
1520
1548
|
return extractProjectCandidatesWithPositions({
|
|
1521
|
-
cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1522
|
-
sources: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1549
|
+
cwd: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _69 => _69.cwd]), () => ( this.options.projectRoot)),
|
|
1550
|
+
sources: _nullishCoalesce(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.sources]), () => ( _optionalChain([this, 'access', _71 => _71.options, 'access', _72 => _72.tailwind, 'access', _73 => _73.v4, 'optionalAccess', _74 => _74.sources]))), () => ( []))
|
|
1523
1551
|
});
|
|
1524
1552
|
}
|
|
1525
1553
|
async collectContentTokensByFile(options) {
|
|
1526
1554
|
const report = await this.collectContentTokens({
|
|
1527
|
-
cwd: _optionalChain([options, 'optionalAccess',
|
|
1528
|
-
sources: _optionalChain([options, 'optionalAccess',
|
|
1555
|
+
cwd: _optionalChain([options, 'optionalAccess', _75 => _75.cwd]),
|
|
1556
|
+
sources: _optionalChain([options, 'optionalAccess', _76 => _76.sources])
|
|
1529
1557
|
});
|
|
1530
1558
|
return groupTokensByFile(report, {
|
|
1531
|
-
key: _optionalChain([options, 'optionalAccess',
|
|
1532
|
-
stripAbsolutePaths: _optionalChain([options, 'optionalAccess',
|
|
1559
|
+
key: _optionalChain([options, 'optionalAccess', _77 => _77.key]),
|
|
1560
|
+
stripAbsolutePaths: _optionalChain([options, 'optionalAccess', _78 => _78.stripAbsolutePaths])
|
|
1533
1561
|
});
|
|
1534
1562
|
}
|
|
1535
1563
|
}, _class);
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkOQKHXYAKjs = require('./chunk-OQKHXYAK.js');
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -108,15 +108,15 @@ var cli = _cac2.default.call(void 0, "tw-patch");
|
|
|
108
108
|
async function loadPatchOptions(cwd, overrides) {
|
|
109
109
|
const { config } = await _config.getConfig.call(void 0, cwd);
|
|
110
110
|
const legacyConfig = config;
|
|
111
|
-
const base = _optionalChain([config, 'optionalAccess', _ => _.registry]) ?
|
|
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
112
|
const merged = defu(_nullishCoalesce(overrides, () => ( {})), base);
|
|
113
113
|
return merged;
|
|
114
114
|
}
|
|
115
115
|
cli.command("install", "Apply Tailwind CSS runtime patches").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
|
|
116
116
|
const options = await loadPatchOptions(args.cwd);
|
|
117
|
-
const patcher = new (0,
|
|
117
|
+
const patcher = new (0, _chunkOQKHXYAKjs.TailwindcssPatcher)(options);
|
|
118
118
|
await patcher.patch();
|
|
119
|
-
|
|
119
|
+
_chunkOQKHXYAKjs.logger_default.success("Tailwind CSS runtime patched successfully.");
|
|
120
120
|
});
|
|
121
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
122
|
const overrides = {};
|
|
@@ -134,18 +134,18 @@ cli.command("extract", "Collect generated class names into a cache file").option
|
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
const options = await loadPatchOptions(args.cwd, overrides);
|
|
137
|
-
const patcher = new (0,
|
|
137
|
+
const patcher = new (0, _chunkOQKHXYAKjs.TailwindcssPatcher)(options);
|
|
138
138
|
const result = await patcher.extract({ write: args.write });
|
|
139
139
|
if (result.filename) {
|
|
140
|
-
|
|
140
|
+
_chunkOQKHXYAKjs.logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
|
|
141
141
|
} else {
|
|
142
|
-
|
|
142
|
+
_chunkOQKHXYAKjs.logger_default.success(`Collected ${result.classList.length} classes.`);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
var TOKEN_FORMATS = ["json", "lines", "grouped-json"];
|
|
146
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
147
|
const options = await loadPatchOptions(args.cwd);
|
|
148
|
-
const patcher = new (0,
|
|
148
|
+
const patcher = new (0, _chunkOQKHXYAKjs.TailwindcssPatcher)(options);
|
|
149
149
|
const report = await patcher.collectContentTokens();
|
|
150
150
|
const shouldWrite = _nullishCoalesce(args.write, () => ( true));
|
|
151
151
|
let format = _nullishCoalesce(args.format, () => ( "json"));
|
|
@@ -154,7 +154,7 @@ cli.command("tokens", "Extract Tailwind tokens with file/position metadata").opt
|
|
|
154
154
|
}
|
|
155
155
|
const targetFile = _nullishCoalesce(args.output, () => ( ".tw-patch/tw-token-report.json"));
|
|
156
156
|
const groupKey = args.groupKey === "absolute" ? "absolute" : "relative";
|
|
157
|
-
const buildGrouped = () =>
|
|
157
|
+
const buildGrouped = () => _chunkOQKHXYAKjs.groupTokensByFile.call(void 0, report, {
|
|
158
158
|
key: groupKey,
|
|
159
159
|
stripAbsolutePaths: groupKey !== "absolute"
|
|
160
160
|
});
|
|
@@ -172,48 +172,48 @@ cli.command("tokens", "Extract Tailwind tokens with file/position metadata").opt
|
|
|
172
172
|
await _fsextra2.default.writeFile(target, `${lines.join("\n")}
|
|
173
173
|
`, "utf8");
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
_chunkOQKHXYAKjs.logger_default.success(
|
|
176
176
|
`Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(_process2.default.cwd(), ".")}`
|
|
177
177
|
);
|
|
178
178
|
} else {
|
|
179
|
-
|
|
179
|
+
_chunkOQKHXYAKjs.logger_default.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
|
|
180
180
|
if (format === "lines") {
|
|
181
181
|
const preview = report.entries.slice(0, 5).map(formatTokenLine).join("\n");
|
|
182
182
|
if (preview) {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
_chunkOQKHXYAKjs.logger_default.log("");
|
|
184
|
+
_chunkOQKHXYAKjs.logger_default.info(preview);
|
|
185
185
|
if (report.entries.length > 5) {
|
|
186
|
-
|
|
186
|
+
_chunkOQKHXYAKjs.logger_default.info(`\u2026and ${report.entries.length - 5} more.`);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
} else if (format === "grouped-json") {
|
|
190
190
|
const map = resolveGrouped();
|
|
191
191
|
const { preview, moreFiles } = formatGroupedPreview(map);
|
|
192
192
|
if (preview) {
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
_chunkOQKHXYAKjs.logger_default.log("");
|
|
194
|
+
_chunkOQKHXYAKjs.logger_default.info(preview);
|
|
195
195
|
if (moreFiles > 0) {
|
|
196
|
-
|
|
196
|
+
_chunkOQKHXYAKjs.logger_default.info(`\u2026and ${moreFiles} more files.`);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
} else {
|
|
200
200
|
const previewEntries = report.entries.slice(0, 3);
|
|
201
201
|
if (previewEntries.length) {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
_chunkOQKHXYAKjs.logger_default.log("");
|
|
203
|
+
_chunkOQKHXYAKjs.logger_default.info(JSON.stringify(previewEntries, null, 2));
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
if (report.skippedFiles.length) {
|
|
208
|
-
|
|
208
|
+
_chunkOQKHXYAKjs.logger_default.warn("Skipped files:");
|
|
209
209
|
for (const skipped of report.skippedFiles) {
|
|
210
|
-
|
|
210
|
+
_chunkOQKHXYAKjs.logger_default.warn(` \u2022 ${skipped.file} (${skipped.reason})`);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
cli.command("init", "Generate a tailwindcss-patch config file").option("--cwd <dir>", "Working directory", { default: _process2.default.cwd() }).action(async (args) => {
|
|
215
215
|
await _config.initConfig.call(void 0, args.cwd);
|
|
216
|
-
|
|
216
|
+
_chunkOQKHXYAKjs.logger_default.success(`\u2728 ${_config.CONFIG_NAME}.config.ts initialized!`);
|
|
217
217
|
});
|
|
218
218
|
cli.help();
|
|
219
219
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -7,66 +7,131 @@ export { defineConfig } from '@tailwindcss-mangle/config';
|
|
|
7
7
|
import * as consola from 'consola';
|
|
8
8
|
|
|
9
9
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
10
|
+
/**
|
|
11
|
+
* Configures how the Tailwind class cache is stored and where it lives on disk.
|
|
12
|
+
*/
|
|
10
13
|
interface CacheUserOptions {
|
|
14
|
+
/** Whether caching is enabled. */
|
|
11
15
|
enabled?: boolean;
|
|
16
|
+
/** Working directory used when resolving cache paths. */
|
|
12
17
|
cwd?: string;
|
|
18
|
+
/** Directory where cache files are written. */
|
|
13
19
|
dir?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Cache filename. Defaults to `class-cache.json` inside the derived cache folder
|
|
22
|
+
* when omitted.
|
|
23
|
+
*/
|
|
14
24
|
file?: string;
|
|
25
|
+
/** Strategy used when merging new class lists with an existing cache. */
|
|
15
26
|
strategy?: CacheStrategy;
|
|
16
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Controls how extracted class lists are written to disk.
|
|
30
|
+
*/
|
|
17
31
|
interface OutputUserOptions {
|
|
32
|
+
/** Whether to produce an output file. */
|
|
18
33
|
enabled?: boolean;
|
|
34
|
+
/** Optional absolute or relative path to the output file. */
|
|
19
35
|
file?: string;
|
|
36
|
+
/** Output format, defaults to JSON when omitted. */
|
|
20
37
|
format?: 'json' | 'lines';
|
|
38
|
+
/** Pretty-print spacing (truthy value enables indentation). */
|
|
21
39
|
pretty?: number | boolean;
|
|
40
|
+
/** Whether to strip the universal selector (`*`) from the final list. */
|
|
22
41
|
removeUniversalSelector?: boolean;
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Options controlling how Tailwind contexts are exposed during runtime patching.
|
|
45
|
+
*/
|
|
24
46
|
interface ExposeContextUserOptions {
|
|
47
|
+
/** Name of the property used to reference an exposed context. */
|
|
25
48
|
refProperty?: string;
|
|
26
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Extends the built-in length-unit patch with custom defaults.
|
|
52
|
+
*/
|
|
27
53
|
interface ExtendLengthUnitsUserOptions extends Partial<ILengthUnitsPatchOptions> {
|
|
54
|
+
/** Enables or disables the length-unit patch. */
|
|
28
55
|
enabled?: boolean;
|
|
29
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Feature switches that toggle optional Tailwind patch capabilities.
|
|
59
|
+
*/
|
|
30
60
|
interface FeatureUserOptions {
|
|
61
|
+
/** Whether to expose runtime Tailwind contexts (or configure how they are exposed). */
|
|
31
62
|
exposeContext?: boolean | ExposeContextUserOptions;
|
|
63
|
+
/** Extends the length-unit patch or disables it entirely. */
|
|
32
64
|
extendLengthUnits?: false | ExtendLengthUnitsUserOptions;
|
|
33
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Shared configuration used for Tailwind v2/v3 patching flows.
|
|
68
|
+
*/
|
|
34
69
|
interface TailwindConfigUserOptions {
|
|
70
|
+
/** Path to a Tailwind config file when auto-detection is insufficient. */
|
|
35
71
|
config?: string;
|
|
72
|
+
/** Custom working directory used when resolving config-relative paths. */
|
|
36
73
|
cwd?: string;
|
|
74
|
+
/** Optional PostCSS plugin name to use instead of the default. */
|
|
37
75
|
postcssPlugin?: string;
|
|
38
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Additional configuration specific to Tailwind CSS v4 extraction.
|
|
79
|
+
*/
|
|
39
80
|
interface TailwindV4UserOptions {
|
|
81
|
+
/** Base directory used when resolving v4 content sources and configs. */
|
|
40
82
|
base?: string;
|
|
83
|
+
/** Raw CSS passed directly to the v4 design system. */
|
|
41
84
|
css?: string;
|
|
85
|
+
/** Set of CSS entry files that should be scanned for `@config` directives. */
|
|
42
86
|
cssEntries?: string[];
|
|
87
|
+
/** Overrides the content sources scanned by the oxide scanner. */
|
|
43
88
|
sources?: SourceEntry[];
|
|
44
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* High-level Tailwind patch configuration shared across versions.
|
|
92
|
+
*/
|
|
45
93
|
interface TailwindUserOptions extends TailwindConfigUserOptions {
|
|
46
94
|
/**
|
|
47
95
|
* Optional hint for picking the patch strategy.
|
|
48
96
|
* When omitted we infer from the installed Tailwind CSS package version.
|
|
49
97
|
*/
|
|
50
98
|
version?: 2 | 3 | 4;
|
|
99
|
+
/** Tailwind package name if the project uses a fork. */
|
|
51
100
|
packageName?: string;
|
|
101
|
+
/** Package resolution options forwarded to `local-pkg`. */
|
|
52
102
|
resolve?: PackageResolvingOptions;
|
|
103
|
+
/** Overrides applied when patching Tailwind CSS v2. */
|
|
53
104
|
v2?: TailwindConfigUserOptions;
|
|
105
|
+
/** Overrides applied when patching Tailwind CSS v3. */
|
|
54
106
|
v3?: TailwindConfigUserOptions;
|
|
107
|
+
/** Options specific to Tailwind CSS v4 patching. */
|
|
55
108
|
v4?: TailwindV4UserOptions;
|
|
56
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Root configuration consumed by the Tailwind CSS patch runner.
|
|
112
|
+
*/
|
|
57
113
|
interface TailwindcssPatchOptions {
|
|
58
114
|
/**
|
|
59
115
|
* Base directory used when resolving Tailwind resources.
|
|
60
116
|
* Defaults to `process.cwd()`.
|
|
61
117
|
*/
|
|
62
118
|
cwd?: string;
|
|
119
|
+
/** Whether to overwrite generated artifacts (e.g., caches, outputs). */
|
|
63
120
|
overwrite?: boolean;
|
|
121
|
+
/** Tailwind-specific configuration grouped by major version. */
|
|
64
122
|
tailwind?: TailwindUserOptions;
|
|
123
|
+
/** Feature toggles for optional helpers. */
|
|
65
124
|
features?: FeatureUserOptions;
|
|
125
|
+
/** Optional function that filters final class names. */
|
|
66
126
|
filter?: (className: string) => boolean;
|
|
127
|
+
/** Cache configuration or boolean to enable/disable quickly. */
|
|
67
128
|
cache?: boolean | CacheUserOptions;
|
|
129
|
+
/** Output configuration or boolean to inherits defaults. */
|
|
68
130
|
output?: OutputUserOptions;
|
|
69
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Stable shape for output configuration after normalization.
|
|
134
|
+
*/
|
|
70
135
|
interface NormalizedOutputOptions {
|
|
71
136
|
enabled: boolean;
|
|
72
137
|
file?: string;
|
|
@@ -74,6 +139,9 @@ interface NormalizedOutputOptions {
|
|
|
74
139
|
pretty: number | false;
|
|
75
140
|
removeUniversalSelector: boolean;
|
|
76
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Stable cache configuration used internally after defaults are applied.
|
|
144
|
+
*/
|
|
77
145
|
interface NormalizedCacheOptions {
|
|
78
146
|
enabled: boolean;
|
|
79
147
|
cwd: string;
|
|
@@ -82,19 +150,27 @@ interface NormalizedCacheOptions {
|
|
|
82
150
|
path: string;
|
|
83
151
|
strategy: CacheStrategy;
|
|
84
152
|
}
|
|
153
|
+
/** Tracks whether runtime contexts should be exposed and via which property. */
|
|
85
154
|
interface NormalizedExposeContextOptions {
|
|
86
155
|
enabled: boolean;
|
|
87
156
|
refProperty: string;
|
|
88
157
|
}
|
|
158
|
+
/** Normalized representation of the extend-length-units feature flag. */
|
|
89
159
|
interface NormalizedExtendLengthUnitsOptions extends ILengthUnitsPatchOptions {
|
|
90
160
|
enabled: boolean;
|
|
91
161
|
}
|
|
162
|
+
/** Normalized Tailwind v4 configuration consumed by runtime helpers. */
|
|
92
163
|
interface NormalizedTailwindV4Options {
|
|
93
164
|
base: string;
|
|
165
|
+
configuredBase?: string;
|
|
94
166
|
css?: string;
|
|
95
167
|
cssEntries: string[];
|
|
96
168
|
sources: SourceEntry[];
|
|
169
|
+
hasUserDefinedSources: boolean;
|
|
97
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Tailwind configuration ready for consumption by the runtime after normalization.
|
|
173
|
+
*/
|
|
98
174
|
interface NormalizedTailwindConfigOptions extends TailwindConfigUserOptions {
|
|
99
175
|
packageName: string;
|
|
100
176
|
versionHint?: 2 | 3 | 4;
|
|
@@ -103,10 +179,12 @@ interface NormalizedTailwindConfigOptions extends TailwindConfigUserOptions {
|
|
|
103
179
|
v3?: TailwindConfigUserOptions;
|
|
104
180
|
v4?: NormalizedTailwindV4Options;
|
|
105
181
|
}
|
|
182
|
+
/** Grouped normalized feature flags. */
|
|
106
183
|
interface NormalizedFeatureOptions {
|
|
107
184
|
exposeContext: NormalizedExposeContextOptions;
|
|
108
185
|
extendLengthUnits: NormalizedExtendLengthUnitsOptions | null;
|
|
109
186
|
}
|
|
187
|
+
/** Final normalized shape consumed throughout the patch runtime. */
|
|
110
188
|
interface NormalizedTailwindcssPatchOptions {
|
|
111
189
|
projectRoot: string;
|
|
112
190
|
overwrite: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,66 +7,131 @@ export { defineConfig } from '@tailwindcss-mangle/config';
|
|
|
7
7
|
import * as consola from 'consola';
|
|
8
8
|
|
|
9
9
|
type CacheStrategy = 'merge' | 'overwrite';
|
|
10
|
+
/**
|
|
11
|
+
* Configures how the Tailwind class cache is stored and where it lives on disk.
|
|
12
|
+
*/
|
|
10
13
|
interface CacheUserOptions {
|
|
14
|
+
/** Whether caching is enabled. */
|
|
11
15
|
enabled?: boolean;
|
|
16
|
+
/** Working directory used when resolving cache paths. */
|
|
12
17
|
cwd?: string;
|
|
18
|
+
/** Directory where cache files are written. */
|
|
13
19
|
dir?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Cache filename. Defaults to `class-cache.json` inside the derived cache folder
|
|
22
|
+
* when omitted.
|
|
23
|
+
*/
|
|
14
24
|
file?: string;
|
|
25
|
+
/** Strategy used when merging new class lists with an existing cache. */
|
|
15
26
|
strategy?: CacheStrategy;
|
|
16
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Controls how extracted class lists are written to disk.
|
|
30
|
+
*/
|
|
17
31
|
interface OutputUserOptions {
|
|
32
|
+
/** Whether to produce an output file. */
|
|
18
33
|
enabled?: boolean;
|
|
34
|
+
/** Optional absolute or relative path to the output file. */
|
|
19
35
|
file?: string;
|
|
36
|
+
/** Output format, defaults to JSON when omitted. */
|
|
20
37
|
format?: 'json' | 'lines';
|
|
38
|
+
/** Pretty-print spacing (truthy value enables indentation). */
|
|
21
39
|
pretty?: number | boolean;
|
|
40
|
+
/** Whether to strip the universal selector (`*`) from the final list. */
|
|
22
41
|
removeUniversalSelector?: boolean;
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Options controlling how Tailwind contexts are exposed during runtime patching.
|
|
45
|
+
*/
|
|
24
46
|
interface ExposeContextUserOptions {
|
|
47
|
+
/** Name of the property used to reference an exposed context. */
|
|
25
48
|
refProperty?: string;
|
|
26
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Extends the built-in length-unit patch with custom defaults.
|
|
52
|
+
*/
|
|
27
53
|
interface ExtendLengthUnitsUserOptions extends Partial<ILengthUnitsPatchOptions> {
|
|
54
|
+
/** Enables or disables the length-unit patch. */
|
|
28
55
|
enabled?: boolean;
|
|
29
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Feature switches that toggle optional Tailwind patch capabilities.
|
|
59
|
+
*/
|
|
30
60
|
interface FeatureUserOptions {
|
|
61
|
+
/** Whether to expose runtime Tailwind contexts (or configure how they are exposed). */
|
|
31
62
|
exposeContext?: boolean | ExposeContextUserOptions;
|
|
63
|
+
/** Extends the length-unit patch or disables it entirely. */
|
|
32
64
|
extendLengthUnits?: false | ExtendLengthUnitsUserOptions;
|
|
33
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Shared configuration used for Tailwind v2/v3 patching flows.
|
|
68
|
+
*/
|
|
34
69
|
interface TailwindConfigUserOptions {
|
|
70
|
+
/** Path to a Tailwind config file when auto-detection is insufficient. */
|
|
35
71
|
config?: string;
|
|
72
|
+
/** Custom working directory used when resolving config-relative paths. */
|
|
36
73
|
cwd?: string;
|
|
74
|
+
/** Optional PostCSS plugin name to use instead of the default. */
|
|
37
75
|
postcssPlugin?: string;
|
|
38
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Additional configuration specific to Tailwind CSS v4 extraction.
|
|
79
|
+
*/
|
|
39
80
|
interface TailwindV4UserOptions {
|
|
81
|
+
/** Base directory used when resolving v4 content sources and configs. */
|
|
40
82
|
base?: string;
|
|
83
|
+
/** Raw CSS passed directly to the v4 design system. */
|
|
41
84
|
css?: string;
|
|
85
|
+
/** Set of CSS entry files that should be scanned for `@config` directives. */
|
|
42
86
|
cssEntries?: string[];
|
|
87
|
+
/** Overrides the content sources scanned by the oxide scanner. */
|
|
43
88
|
sources?: SourceEntry[];
|
|
44
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* High-level Tailwind patch configuration shared across versions.
|
|
92
|
+
*/
|
|
45
93
|
interface TailwindUserOptions extends TailwindConfigUserOptions {
|
|
46
94
|
/**
|
|
47
95
|
* Optional hint for picking the patch strategy.
|
|
48
96
|
* When omitted we infer from the installed Tailwind CSS package version.
|
|
49
97
|
*/
|
|
50
98
|
version?: 2 | 3 | 4;
|
|
99
|
+
/** Tailwind package name if the project uses a fork. */
|
|
51
100
|
packageName?: string;
|
|
101
|
+
/** Package resolution options forwarded to `local-pkg`. */
|
|
52
102
|
resolve?: PackageResolvingOptions;
|
|
103
|
+
/** Overrides applied when patching Tailwind CSS v2. */
|
|
53
104
|
v2?: TailwindConfigUserOptions;
|
|
105
|
+
/** Overrides applied when patching Tailwind CSS v3. */
|
|
54
106
|
v3?: TailwindConfigUserOptions;
|
|
107
|
+
/** Options specific to Tailwind CSS v4 patching. */
|
|
55
108
|
v4?: TailwindV4UserOptions;
|
|
56
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Root configuration consumed by the Tailwind CSS patch runner.
|
|
112
|
+
*/
|
|
57
113
|
interface TailwindcssPatchOptions {
|
|
58
114
|
/**
|
|
59
115
|
* Base directory used when resolving Tailwind resources.
|
|
60
116
|
* Defaults to `process.cwd()`.
|
|
61
117
|
*/
|
|
62
118
|
cwd?: string;
|
|
119
|
+
/** Whether to overwrite generated artifacts (e.g., caches, outputs). */
|
|
63
120
|
overwrite?: boolean;
|
|
121
|
+
/** Tailwind-specific configuration grouped by major version. */
|
|
64
122
|
tailwind?: TailwindUserOptions;
|
|
123
|
+
/** Feature toggles for optional helpers. */
|
|
65
124
|
features?: FeatureUserOptions;
|
|
125
|
+
/** Optional function that filters final class names. */
|
|
66
126
|
filter?: (className: string) => boolean;
|
|
127
|
+
/** Cache configuration or boolean to enable/disable quickly. */
|
|
67
128
|
cache?: boolean | CacheUserOptions;
|
|
129
|
+
/** Output configuration or boolean to inherits defaults. */
|
|
68
130
|
output?: OutputUserOptions;
|
|
69
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Stable shape for output configuration after normalization.
|
|
134
|
+
*/
|
|
70
135
|
interface NormalizedOutputOptions {
|
|
71
136
|
enabled: boolean;
|
|
72
137
|
file?: string;
|
|
@@ -74,6 +139,9 @@ interface NormalizedOutputOptions {
|
|
|
74
139
|
pretty: number | false;
|
|
75
140
|
removeUniversalSelector: boolean;
|
|
76
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Stable cache configuration used internally after defaults are applied.
|
|
144
|
+
*/
|
|
77
145
|
interface NormalizedCacheOptions {
|
|
78
146
|
enabled: boolean;
|
|
79
147
|
cwd: string;
|
|
@@ -82,19 +150,27 @@ interface NormalizedCacheOptions {
|
|
|
82
150
|
path: string;
|
|
83
151
|
strategy: CacheStrategy;
|
|
84
152
|
}
|
|
153
|
+
/** Tracks whether runtime contexts should be exposed and via which property. */
|
|
85
154
|
interface NormalizedExposeContextOptions {
|
|
86
155
|
enabled: boolean;
|
|
87
156
|
refProperty: string;
|
|
88
157
|
}
|
|
158
|
+
/** Normalized representation of the extend-length-units feature flag. */
|
|
89
159
|
interface NormalizedExtendLengthUnitsOptions extends ILengthUnitsPatchOptions {
|
|
90
160
|
enabled: boolean;
|
|
91
161
|
}
|
|
162
|
+
/** Normalized Tailwind v4 configuration consumed by runtime helpers. */
|
|
92
163
|
interface NormalizedTailwindV4Options {
|
|
93
164
|
base: string;
|
|
165
|
+
configuredBase?: string;
|
|
94
166
|
css?: string;
|
|
95
167
|
cssEntries: string[];
|
|
96
168
|
sources: SourceEntry[];
|
|
169
|
+
hasUserDefinedSources: boolean;
|
|
97
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Tailwind configuration ready for consumption by the runtime after normalization.
|
|
173
|
+
*/
|
|
98
174
|
interface NormalizedTailwindConfigOptions extends TailwindConfigUserOptions {
|
|
99
175
|
packageName: string;
|
|
100
176
|
versionHint?: 2 | 3 | 4;
|
|
@@ -103,10 +179,12 @@ interface NormalizedTailwindConfigOptions extends TailwindConfigUserOptions {
|
|
|
103
179
|
v3?: TailwindConfigUserOptions;
|
|
104
180
|
v4?: NormalizedTailwindV4Options;
|
|
105
181
|
}
|
|
182
|
+
/** Grouped normalized feature flags. */
|
|
106
183
|
interface NormalizedFeatureOptions {
|
|
107
184
|
exposeContext: NormalizedExposeContextOptions;
|
|
108
185
|
extendLengthUnits: NormalizedExtendLengthUnitsOptions | null;
|
|
109
186
|
}
|
|
187
|
+
/** Final normalized shape consumed throughout the patch runtime. */
|
|
110
188
|
interface NormalizedTailwindcssPatchOptions {
|
|
111
189
|
projectRoot: string;
|
|
112
190
|
overwrite: boolean;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkOQKHXYAKjs = require('./chunk-OQKHXYAK.js');
|
|
16
16
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
var _config = require('@tailwindcss-mangle/config');
|
|
@@ -31,4 +31,4 @@ var _config = require('@tailwindcss-mangle/config');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
exports.CacheStore =
|
|
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;
|
package/dist/index.mjs
CHANGED