tailwindcss-patch 9.0.0-alpha.4 → 9.0.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/{chunk-HIOIM42J.js → chunk-4RRHMRLJ.js} +18 -11
- package/dist/{chunk-H2BKL24E.mjs → chunk-AOSPLINO.mjs} +16 -9
- package/dist/{chunk-A67ABH3M.mjs → chunk-OSH52QWA.mjs} +1 -1
- package/dist/{chunk-PMN7HS4Y.js → chunk-QQXAOMUH.js} +2 -2
- package/dist/{chunk-5CWNAWKP.js → chunk-ZPLR2UEW.js} +1 -1
- package/dist/cli.js +6 -6
- package/dist/cli.mjs +2 -2
- package/dist/commands/cli-runtime.js +62 -62
- package/dist/commands/cli-runtime.mjs +2 -2
- package/dist/{dist-7O2232CU.js → dist-22YCNIJW.js} +1 -1
- package/dist/{dist-7UDSGIWH.mjs → dist-7W73GIRD.mjs} +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +2 -2
- package/package.json +7 -7
- package/src/runtime/class-collector.ts +10 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZPLR2UEWjs = require('./chunk-ZPLR2UEW.js');
|
|
4
4
|
|
|
5
5
|
// src/logger.ts
|
|
6
6
|
var _consola = require('consola');
|
|
@@ -20,7 +20,7 @@ var _pathe = require('pathe'); var _pathe2 = _interopRequireDefault(_pathe);
|
|
|
20
20
|
// package.json
|
|
21
21
|
var package_default = {
|
|
22
22
|
name: "tailwindcss-patch",
|
|
23
|
-
version: "9.0.0
|
|
23
|
+
version: "9.0.0",
|
|
24
24
|
description: "patch tailwindcss for exposing context and extract classes",
|
|
25
25
|
author: "ice breaker <1324318532@qq.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -110,11 +110,11 @@ var package_default = {
|
|
|
110
110
|
},
|
|
111
111
|
dependencies: {
|
|
112
112
|
"@babel/generator": "^7.29.1",
|
|
113
|
-
"@babel/parser": "^7.29.
|
|
113
|
+
"@babel/parser": "^7.29.2",
|
|
114
114
|
"@babel/traverse": "^7.29.0",
|
|
115
115
|
"@babel/types": "^7.29.0",
|
|
116
116
|
"@tailwindcss-mangle/config": "workspace:*",
|
|
117
|
-
"@tailwindcss/node": "^4.2.
|
|
117
|
+
"@tailwindcss/node": "^4.2.2",
|
|
118
118
|
cac: "6.7.14",
|
|
119
119
|
consola: "^3.4.2",
|
|
120
120
|
"fs-extra": "^11.3.4",
|
|
@@ -125,9 +125,9 @@ var package_default = {
|
|
|
125
125
|
"tailwindcss-config": "^1.1.4"
|
|
126
126
|
},
|
|
127
127
|
devDependencies: {
|
|
128
|
-
"@tailwindcss/oxide": "^4.2.
|
|
129
|
-
"@tailwindcss/postcss": "^4.2.
|
|
130
|
-
"@tailwindcss/vite": "^4.2.
|
|
128
|
+
"@tailwindcss/oxide": "^4.2.2",
|
|
129
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
130
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
131
131
|
tailwindcss: "catalog:tailwindcss4",
|
|
132
132
|
"tailwindcss-3": "catalog:tailwindcss3",
|
|
133
133
|
"tailwindcss-4": "catalog:tailwindcss4"
|
|
@@ -1824,7 +1824,7 @@ async function loadWorkspaceConfigModule() {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
async function loadWorkspaceDefu() {
|
|
1826
1826
|
if (!defuPromise) {
|
|
1827
|
-
defuPromise = Promise.resolve().then(() => _interopRequireWildcard(require("./dist-
|
|
1827
|
+
defuPromise = Promise.resolve().then(() => _interopRequireWildcard(require("./dist-22YCNIJW.js"))).then((mod) => mod.defu).catch(async (error) => {
|
|
1828
1828
|
if (!isMissingSharedModuleError(error)) {
|
|
1829
1829
|
throw error;
|
|
1830
1830
|
}
|
|
@@ -2152,13 +2152,20 @@ function spliceChangesIntoString(str, changes) {
|
|
|
2152
2152
|
}
|
|
2153
2153
|
|
|
2154
2154
|
// src/runtime/class-collector.ts
|
|
2155
|
+
function collectRuntimeCandidateKeys(context) {
|
|
2156
|
+
const candidateRuleCache = context.candidateRuleCache;
|
|
2157
|
+
if (candidateRuleCache instanceof Map && candidateRuleCache.size > 0) {
|
|
2158
|
+
return candidateRuleCache.keys();
|
|
2159
|
+
}
|
|
2160
|
+
return context.classCache.keys();
|
|
2161
|
+
}
|
|
2155
2162
|
function collectClassesFromContexts(contexts, filter) {
|
|
2156
2163
|
const set = /* @__PURE__ */ new Set();
|
|
2157
2164
|
for (const context of contexts) {
|
|
2158
2165
|
if (!isObject(context) || !context.classCache) {
|
|
2159
2166
|
continue;
|
|
2160
2167
|
}
|
|
2161
|
-
for (const key of context
|
|
2168
|
+
for (const key of collectRuntimeCandidateKeys(context)) {
|
|
2162
2169
|
const className = key.toString();
|
|
2163
2170
|
if (filter(className)) {
|
|
2164
2171
|
set.add(className);
|
|
@@ -2240,7 +2247,7 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
2240
2247
|
var _module = require('module');
|
|
2241
2248
|
|
|
2242
2249
|
|
|
2243
|
-
var require2 = _module.createRequire.call(void 0,
|
|
2250
|
+
var require2 = _module.createRequire.call(void 0, _chunkZPLR2UEWjs.importMetaUrl);
|
|
2244
2251
|
function resolveRuntimeEntry(packageInfo, majorVersion) {
|
|
2245
2252
|
const root = packageInfo.rootPath;
|
|
2246
2253
|
if (majorVersion === 2) {
|
|
@@ -2291,7 +2298,7 @@ function loadRuntimeContexts(packageInfo, majorVersion, refProperty) {
|
|
|
2291
2298
|
|
|
2292
2299
|
var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
|
|
2293
2300
|
var _tailwindcssconfig = require('tailwindcss-config');
|
|
2294
|
-
var require3 = _module.createRequire.call(void 0,
|
|
2301
|
+
var require3 = _module.createRequire.call(void 0, _chunkZPLR2UEWjs.importMetaUrl);
|
|
2295
2302
|
function resolveModuleEntry(id) {
|
|
2296
2303
|
return _pathe2.default.isAbsolute(id) ? id : require3.resolve(id);
|
|
2297
2304
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__dirname
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OSH52QWA.mjs";
|
|
4
4
|
|
|
5
5
|
// src/logger.ts
|
|
6
6
|
import { createConsola } from "consola";
|
|
@@ -20,7 +20,7 @@ import path from "pathe";
|
|
|
20
20
|
// package.json
|
|
21
21
|
var package_default = {
|
|
22
22
|
name: "tailwindcss-patch",
|
|
23
|
-
version: "9.0.0
|
|
23
|
+
version: "9.0.0",
|
|
24
24
|
description: "patch tailwindcss for exposing context and extract classes",
|
|
25
25
|
author: "ice breaker <1324318532@qq.com>",
|
|
26
26
|
license: "MIT",
|
|
@@ -110,11 +110,11 @@ var package_default = {
|
|
|
110
110
|
},
|
|
111
111
|
dependencies: {
|
|
112
112
|
"@babel/generator": "^7.29.1",
|
|
113
|
-
"@babel/parser": "^7.29.
|
|
113
|
+
"@babel/parser": "^7.29.2",
|
|
114
114
|
"@babel/traverse": "^7.29.0",
|
|
115
115
|
"@babel/types": "^7.29.0",
|
|
116
116
|
"@tailwindcss-mangle/config": "workspace:*",
|
|
117
|
-
"@tailwindcss/node": "^4.2.
|
|
117
|
+
"@tailwindcss/node": "^4.2.2",
|
|
118
118
|
cac: "6.7.14",
|
|
119
119
|
consola: "^3.4.2",
|
|
120
120
|
"fs-extra": "^11.3.4",
|
|
@@ -125,9 +125,9 @@ var package_default = {
|
|
|
125
125
|
"tailwindcss-config": "^1.1.4"
|
|
126
126
|
},
|
|
127
127
|
devDependencies: {
|
|
128
|
-
"@tailwindcss/oxide": "^4.2.
|
|
129
|
-
"@tailwindcss/postcss": "^4.2.
|
|
130
|
-
"@tailwindcss/vite": "^4.2.
|
|
128
|
+
"@tailwindcss/oxide": "^4.2.2",
|
|
129
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
130
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
131
131
|
tailwindcss: "catalog:tailwindcss4",
|
|
132
132
|
"tailwindcss-3": "catalog:tailwindcss3",
|
|
133
133
|
"tailwindcss-4": "catalog:tailwindcss4"
|
|
@@ -1824,7 +1824,7 @@ async function loadWorkspaceConfigModule() {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
async function loadWorkspaceDefu() {
|
|
1826
1826
|
if (!defuPromise) {
|
|
1827
|
-
defuPromise = import("./dist-
|
|
1827
|
+
defuPromise = import("./dist-7W73GIRD.mjs").then((mod) => mod.defu).catch(async (error) => {
|
|
1828
1828
|
if (!isMissingSharedModuleError(error)) {
|
|
1829
1829
|
throw error;
|
|
1830
1830
|
}
|
|
@@ -2152,13 +2152,20 @@ function spliceChangesIntoString(str, changes) {
|
|
|
2152
2152
|
}
|
|
2153
2153
|
|
|
2154
2154
|
// src/runtime/class-collector.ts
|
|
2155
|
+
function collectRuntimeCandidateKeys(context) {
|
|
2156
|
+
const candidateRuleCache = context.candidateRuleCache;
|
|
2157
|
+
if (candidateRuleCache instanceof Map && candidateRuleCache.size > 0) {
|
|
2158
|
+
return candidateRuleCache.keys();
|
|
2159
|
+
}
|
|
2160
|
+
return context.classCache.keys();
|
|
2161
|
+
}
|
|
2155
2162
|
function collectClassesFromContexts(contexts, filter) {
|
|
2156
2163
|
const set = /* @__PURE__ */ new Set();
|
|
2157
2164
|
for (const context of contexts) {
|
|
2158
2165
|
if (!isObject(context) || !context.classCache) {
|
|
2159
2166
|
continue;
|
|
2160
2167
|
}
|
|
2161
|
-
for (const key of context
|
|
2168
|
+
for (const key of collectRuntimeCandidateKeys(context)) {
|
|
2162
2169
|
const className = key.toString();
|
|
2163
2170
|
if (filter(className)) {
|
|
2164
2171
|
set.add(className);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.
|
|
1
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/esm_shims.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZPLR2UEWjs = require('./chunk-ZPLR2UEW.js');
|
|
4
4
|
|
|
5
5
|
// src/index.bundle.ts
|
|
6
6
|
var _module = require('module');
|
|
7
|
-
var require2 = _module.createRequire.call(void 0,
|
|
7
|
+
var require2 = _module.createRequire.call(void 0, _chunkZPLR2UEWjs.importMetaUrl);
|
|
8
8
|
function loadCliModule() {
|
|
9
9
|
return require2("./commands/cli-runtime.js");
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|
package/dist/cli.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQQXAOMUHjs = require('./chunk-QQXAOMUH.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunk4RRHMRLJjs = require('./chunk-4RRHMRLJ.js');
|
|
8
|
+
require('./chunk-ZPLR2UEW.js');
|
|
9
9
|
|
|
10
10
|
// src/cli.bundle.ts
|
|
11
11
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
12
12
|
async function main() {
|
|
13
|
-
const cli =
|
|
13
|
+
const cli = _chunkQQXAOMUHjs.createTailwindcssPatchCli.call(void 0, );
|
|
14
14
|
cli.help();
|
|
15
15
|
cli.parse(_process2.default.argv, { run: false });
|
|
16
16
|
await cli.runMatchedCommand();
|
|
17
17
|
}
|
|
18
18
|
main().catch((error) => {
|
|
19
|
-
if (error instanceof
|
|
19
|
+
if (error instanceof _chunk4RRHMRLJjs.ValidateCommandError) {
|
|
20
20
|
_process2.default.exitCode = error.exitCode;
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
const message = error instanceof Error ? error.message : String(error);
|
|
24
|
-
|
|
24
|
+
_chunk4RRHMRLJjs.logger_default.error(message);
|
|
25
25
|
_process2.default.exitCode = 1;
|
|
26
26
|
});
|
package/dist/cli.mjs
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
require('../chunk-
|
|
14
|
+
var _chunk4RRHMRLJjs = require('../chunk-4RRHMRLJ.js');
|
|
15
|
+
require('../chunk-ZPLR2UEW.js');
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
18
18
|
var _events = require('events');
|
|
@@ -779,25 +779,25 @@ function createMemoizedPromiseRunner(factory) {
|
|
|
779
779
|
}
|
|
780
780
|
function createTailwindcssPatchCommandContext(cli, command, commandName, args, cwd) {
|
|
781
781
|
const loadCachedConfig = createMemoizedPromiseRunner(
|
|
782
|
-
() =>
|
|
782
|
+
() => _chunk4RRHMRLJjs.loadWorkspaceConfigModule.call(void 0, ).then((mod) => mod.getConfig(cwd))
|
|
783
783
|
);
|
|
784
784
|
const loadCachedPatchOptions = createMemoizedPromiseRunner(
|
|
785
|
-
() =>
|
|
785
|
+
() => _chunk4RRHMRLJjs.loadPatchOptionsForWorkspace.call(void 0, cwd)
|
|
786
786
|
);
|
|
787
787
|
const createCachedPatcher = createMemoizedPromiseRunner(async () => {
|
|
788
788
|
const patchOptions = await loadCachedPatchOptions();
|
|
789
|
-
return new (0,
|
|
789
|
+
return new (0, _chunk4RRHMRLJjs.TailwindcssPatcher)(patchOptions);
|
|
790
790
|
});
|
|
791
791
|
const loadPatchOptionsForContext = (overrides) => {
|
|
792
792
|
if (overrides) {
|
|
793
|
-
return
|
|
793
|
+
return _chunk4RRHMRLJjs.loadPatchOptionsForWorkspace.call(void 0, cwd, overrides);
|
|
794
794
|
}
|
|
795
795
|
return loadCachedPatchOptions();
|
|
796
796
|
};
|
|
797
797
|
const createPatcherForContext = async (overrides) => {
|
|
798
798
|
if (overrides) {
|
|
799
|
-
const patchOptions = await
|
|
800
|
-
return new (0,
|
|
799
|
+
const patchOptions = await _chunk4RRHMRLJjs.loadPatchOptionsForWorkspace.call(void 0, cwd, overrides);
|
|
800
|
+
return new (0, _chunk4RRHMRLJjs.TailwindcssPatcher)(patchOptions);
|
|
801
801
|
}
|
|
802
802
|
return createCachedPatcher();
|
|
803
803
|
};
|
|
@@ -807,7 +807,7 @@ function createTailwindcssPatchCommandContext(cli, command, commandName, args, c
|
|
|
807
807
|
commandName,
|
|
808
808
|
args,
|
|
809
809
|
cwd,
|
|
810
|
-
logger:
|
|
810
|
+
logger: _chunk4RRHMRLJjs.logger_default,
|
|
811
811
|
loadConfig: loadCachedConfig,
|
|
812
812
|
loadPatchOptions: loadPatchOptionsForContext,
|
|
813
813
|
createPatcher: createPatcherForContext
|
|
@@ -833,7 +833,7 @@ var DEFAULT_CONFIG_NAME = "tailwindcss-mangle";
|
|
|
833
833
|
async function installCommandDefaultHandler(_ctx) {
|
|
834
834
|
const patcher = await _ctx.createPatcher();
|
|
835
835
|
await patcher.patch();
|
|
836
|
-
|
|
836
|
+
_chunk4RRHMRLJjs.logger_default.success("Tailwind CSS runtime patched successfully.");
|
|
837
837
|
}
|
|
838
838
|
async function extractCommandDefaultHandler(ctx) {
|
|
839
839
|
const { args } = ctx;
|
|
@@ -858,9 +858,9 @@ async function extractCommandDefaultHandler(ctx) {
|
|
|
858
858
|
const extractOptions = args.write === void 0 ? {} : { write: args.write };
|
|
859
859
|
const result = await patcher.extract(extractOptions);
|
|
860
860
|
if (result.filename) {
|
|
861
|
-
|
|
861
|
+
_chunk4RRHMRLJjs.logger_default.success(`Collected ${result.classList.length} classes \u2192 ${result.filename}`);
|
|
862
862
|
} else {
|
|
863
|
-
|
|
863
|
+
_chunk4RRHMRLJjs.logger_default.success(`Collected ${result.classList.length} classes.`);
|
|
864
864
|
}
|
|
865
865
|
return result;
|
|
866
866
|
}
|
|
@@ -875,7 +875,7 @@ async function tokensCommandDefaultHandler(ctx) {
|
|
|
875
875
|
}
|
|
876
876
|
const targetFile = _nullishCoalesce(args.output, () => ( DEFAULT_TOKEN_REPORT));
|
|
877
877
|
const groupKey = args.groupKey === "absolute" ? "absolute" : "relative";
|
|
878
|
-
const buildGrouped = () =>
|
|
878
|
+
const buildGrouped = () => _chunk4RRHMRLJjs.groupTokensByFile.call(void 0, report, {
|
|
879
879
|
key: groupKey,
|
|
880
880
|
stripAbsolutePaths: groupKey !== "absolute"
|
|
881
881
|
});
|
|
@@ -893,49 +893,49 @@ async function tokensCommandDefaultHandler(ctx) {
|
|
|
893
893
|
await _fsextra2.default.writeFile(target, `${lines.join("\n")}
|
|
894
894
|
`, "utf8");
|
|
895
895
|
}
|
|
896
|
-
|
|
896
|
+
_chunk4RRHMRLJjs.logger_default.success(`Collected ${report.entries.length} tokens (${format}) \u2192 ${target.replace(_process2.default.cwd(), ".")}`);
|
|
897
897
|
} else {
|
|
898
|
-
|
|
898
|
+
_chunk4RRHMRLJjs.logger_default.success(`Collected ${report.entries.length} tokens from ${report.filesScanned} files.`);
|
|
899
899
|
if (format === "lines") {
|
|
900
900
|
const preview = report.entries.slice(0, 5).map(formatTokenLine).join("\n");
|
|
901
901
|
if (preview) {
|
|
902
|
-
|
|
903
|
-
|
|
902
|
+
_chunk4RRHMRLJjs.logger_default.log("");
|
|
903
|
+
_chunk4RRHMRLJjs.logger_default.info(preview);
|
|
904
904
|
if (report.entries.length > 5) {
|
|
905
|
-
|
|
905
|
+
_chunk4RRHMRLJjs.logger_default.info(`\u2026and ${report.entries.length - 5} more.`);
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
908
|
} else if (format === "grouped-json") {
|
|
909
909
|
const map = resolveGrouped();
|
|
910
910
|
const { preview, moreFiles } = formatGroupedPreview(map);
|
|
911
911
|
if (preview) {
|
|
912
|
-
|
|
913
|
-
|
|
912
|
+
_chunk4RRHMRLJjs.logger_default.log("");
|
|
913
|
+
_chunk4RRHMRLJjs.logger_default.info(preview);
|
|
914
914
|
if (moreFiles > 0) {
|
|
915
|
-
|
|
915
|
+
_chunk4RRHMRLJjs.logger_default.info(`\u2026and ${moreFiles} more files.`);
|
|
916
916
|
}
|
|
917
917
|
}
|
|
918
918
|
} else {
|
|
919
919
|
const previewEntries = report.entries.slice(0, 3);
|
|
920
920
|
if (previewEntries.length) {
|
|
921
|
-
|
|
922
|
-
|
|
921
|
+
_chunk4RRHMRLJjs.logger_default.log("");
|
|
922
|
+
_chunk4RRHMRLJjs.logger_default.info(JSON.stringify(previewEntries, null, 2));
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
926
|
if (report.skippedFiles.length) {
|
|
927
|
-
|
|
927
|
+
_chunk4RRHMRLJjs.logger_default.warn("Skipped files:");
|
|
928
928
|
for (const skipped of report.skippedFiles) {
|
|
929
|
-
|
|
929
|
+
_chunk4RRHMRLJjs.logger_default.warn(` \u2022 ${skipped.file} (${skipped.reason})`);
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
return report;
|
|
933
933
|
}
|
|
934
934
|
async function initCommandDefaultHandler(ctx) {
|
|
935
|
-
const configModule = await
|
|
935
|
+
const configModule = await _chunk4RRHMRLJjs.loadWorkspaceConfigModule.call(void 0, );
|
|
936
936
|
await configModule.initConfig(ctx.cwd);
|
|
937
937
|
const configName = configModule.CONFIG_NAME || DEFAULT_CONFIG_NAME;
|
|
938
|
-
|
|
938
|
+
_chunk4RRHMRLJjs.logger_default.success(`\u2728 ${configName}.config.ts initialized!`);
|
|
939
939
|
}
|
|
940
940
|
|
|
941
941
|
// src/commands/migration-args.ts
|
|
@@ -1009,53 +1009,53 @@ async function writeMigrationReportFile(cwd, reportFile, report) {
|
|
|
1009
1009
|
const reportPath = _pathe2.default.resolve(cwd, reportFile);
|
|
1010
1010
|
await _fsextra2.default.ensureDir(_pathe2.default.dirname(reportPath));
|
|
1011
1011
|
await _fsextra2.default.writeJSON(reportPath, report, { spaces: 2 });
|
|
1012
|
-
|
|
1012
|
+
_chunk4RRHMRLJjs.logger_default.info(`Migration report written: ${formatPathForLog(reportPath)}`);
|
|
1013
1013
|
}
|
|
1014
1014
|
function logMigrationReportAsJson(report) {
|
|
1015
|
-
|
|
1015
|
+
_chunk4RRHMRLJjs.logger_default.log(JSON.stringify(report, null, 2));
|
|
1016
1016
|
}
|
|
1017
1017
|
function logNoMigrationConfigFilesWarning() {
|
|
1018
|
-
|
|
1018
|
+
_chunk4RRHMRLJjs.logger_default.warn("No config files found for migration.");
|
|
1019
1019
|
}
|
|
1020
1020
|
function logMigrationEntries(report, dryRun) {
|
|
1021
1021
|
for (const entry of report.entries) {
|
|
1022
1022
|
const fileLabel = formatPathForLog(entry.file);
|
|
1023
1023
|
if (!entry.changed) {
|
|
1024
|
-
|
|
1024
|
+
_chunk4RRHMRLJjs.logger_default.info(`No changes: ${fileLabel}`);
|
|
1025
1025
|
continue;
|
|
1026
1026
|
}
|
|
1027
1027
|
if (dryRun) {
|
|
1028
|
-
|
|
1028
|
+
_chunk4RRHMRLJjs.logger_default.info(`[dry-run] ${fileLabel}`);
|
|
1029
1029
|
} else {
|
|
1030
|
-
|
|
1030
|
+
_chunk4RRHMRLJjs.logger_default.success(`Migrated: ${fileLabel}`);
|
|
1031
1031
|
}
|
|
1032
1032
|
for (const change of entry.changes) {
|
|
1033
|
-
|
|
1033
|
+
_chunk4RRHMRLJjs.logger_default.info(` - ${change}`);
|
|
1034
1034
|
}
|
|
1035
1035
|
if (entry.backupFile) {
|
|
1036
|
-
|
|
1036
|
+
_chunk4RRHMRLJjs.logger_default.info(` - backup: ${formatPathForLog(entry.backupFile)}`);
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
function logMigrationSummary(report) {
|
|
1041
|
-
|
|
1041
|
+
_chunk4RRHMRLJjs.logger_default.info(
|
|
1042
1042
|
`Migration summary: scanned=${report.scannedFiles}, changed=${report.changedFiles}, written=${report.writtenFiles}, backups=${report.backupsWritten}, missing=${report.missingFiles}, unchanged=${report.unchangedFiles}`
|
|
1043
1043
|
);
|
|
1044
1044
|
}
|
|
1045
1045
|
function logRestoreResultAsJson(result) {
|
|
1046
|
-
|
|
1046
|
+
_chunk4RRHMRLJjs.logger_default.log(JSON.stringify(result, null, 2));
|
|
1047
1047
|
}
|
|
1048
1048
|
function logRestoreSummary(result) {
|
|
1049
|
-
|
|
1049
|
+
_chunk4RRHMRLJjs.logger_default.info(
|
|
1050
1050
|
`Restore summary: scanned=${result.scannedEntries}, restorable=${result.restorableEntries}, restored=${result.restoredFiles}, missingBackups=${result.missingBackups}, skipped=${result.skippedEntries}`
|
|
1051
1051
|
);
|
|
1052
1052
|
if (result.restored.length > 0) {
|
|
1053
1053
|
const preview = result.restored.slice(0, 5);
|
|
1054
1054
|
for (const file of preview) {
|
|
1055
|
-
|
|
1055
|
+
_chunk4RRHMRLJjs.logger_default.info(` - ${formatPathForLog(file)}`);
|
|
1056
1056
|
}
|
|
1057
1057
|
if (result.restored.length > preview.length) {
|
|
1058
|
-
|
|
1058
|
+
_chunk4RRHMRLJjs.logger_default.info(` ...and ${result.restored.length - preview.length} more`);
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
}
|
|
@@ -1064,16 +1064,16 @@ function logValidateSuccessAsJson(result) {
|
|
|
1064
1064
|
ok: true,
|
|
1065
1065
|
...result
|
|
1066
1066
|
};
|
|
1067
|
-
|
|
1067
|
+
_chunk4RRHMRLJjs.logger_default.log(JSON.stringify(payload, null, 2));
|
|
1068
1068
|
}
|
|
1069
1069
|
function logValidateSuccessSummary(result) {
|
|
1070
|
-
|
|
1070
|
+
_chunk4RRHMRLJjs.logger_default.success(
|
|
1071
1071
|
`Migration report validated: scanned=${result.scannedEntries}, restorable=${result.restorableEntries}, missingBackups=${result.missingBackups}, skipped=${result.skippedEntries}`
|
|
1072
1072
|
);
|
|
1073
1073
|
if (result.reportKind || result.reportSchemaVersion !== void 0) {
|
|
1074
1074
|
const kind = _nullishCoalesce(result.reportKind, () => ( "unknown"));
|
|
1075
1075
|
const schema = result.reportSchemaVersion === void 0 ? "unknown" : String(result.reportSchemaVersion);
|
|
1076
|
-
|
|
1076
|
+
_chunk4RRHMRLJjs.logger_default.info(` metadata: kind=${kind}, schema=${schema}`);
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
function logValidateFailureAsJson(summary) {
|
|
@@ -1083,10 +1083,10 @@ function logValidateFailureAsJson(summary) {
|
|
|
1083
1083
|
exitCode: summary.exitCode,
|
|
1084
1084
|
message: summary.message
|
|
1085
1085
|
};
|
|
1086
|
-
|
|
1086
|
+
_chunk4RRHMRLJjs.logger_default.log(JSON.stringify(payload, null, 2));
|
|
1087
1087
|
}
|
|
1088
1088
|
function logValidateFailureSummary(summary) {
|
|
1089
|
-
|
|
1089
|
+
_chunk4RRHMRLJjs.logger_default.error(`Validation failed [${summary.reason}] (exit ${summary.exitCode}): ${summary.message}`);
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
// src/commands/migrate-handler.ts
|
|
@@ -1101,9 +1101,9 @@ async function migrateCommandDefaultHandler(ctx) {
|
|
|
1101
1101
|
hasInvalidMaxDepth
|
|
1102
1102
|
} = resolveMigrateCommandArgs(args);
|
|
1103
1103
|
if (args.workspace && hasInvalidMaxDepth) {
|
|
1104
|
-
|
|
1104
|
+
_chunk4RRHMRLJjs.logger_default.warn(`Invalid --max-depth value "${String(args.maxDepth)}", fallback to default depth.`);
|
|
1105
1105
|
}
|
|
1106
|
-
const report = await
|
|
1106
|
+
const report = await _chunk4RRHMRLJjs.migrateConfigFiles.call(void 0, {
|
|
1107
1107
|
cwd: ctx.cwd,
|
|
1108
1108
|
dryRun,
|
|
1109
1109
|
...args.config ? { files: [args.config] } : {},
|
|
@@ -1142,7 +1142,7 @@ async function migrateCommandDefaultHandler(ctx) {
|
|
|
1142
1142
|
async function restoreCommandDefaultHandler(ctx) {
|
|
1143
1143
|
const { args } = ctx;
|
|
1144
1144
|
const restoreArgs = resolveRestoreCommandArgs(args);
|
|
1145
|
-
const result = await
|
|
1145
|
+
const result = await _chunk4RRHMRLJjs.restoreConfigFiles.call(void 0, {
|
|
1146
1146
|
cwd: ctx.cwd,
|
|
1147
1147
|
reportFile: restoreArgs.reportFile,
|
|
1148
1148
|
dryRun: restoreArgs.dryRun,
|
|
@@ -1174,7 +1174,7 @@ function partitionStatusEntries(report) {
|
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
1176
|
function logStatusReportAsJson(report) {
|
|
1177
|
-
|
|
1177
|
+
_chunk4RRHMRLJjs.logger_default.log(JSON.stringify(report, null, 2));
|
|
1178
1178
|
}
|
|
1179
1179
|
function logStatusReportSummary(report) {
|
|
1180
1180
|
const {
|
|
@@ -1182,25 +1182,25 @@ function logStatusReportSummary(report) {
|
|
|
1182
1182
|
pending,
|
|
1183
1183
|
skipped
|
|
1184
1184
|
} = partitionStatusEntries(report);
|
|
1185
|
-
|
|
1185
|
+
_chunk4RRHMRLJjs.logger_default.info(`Patch status for ${formatPackageLabel(report)} (v${report.majorVersion})`);
|
|
1186
1186
|
if (applied.length) {
|
|
1187
|
-
|
|
1188
|
-
applied.forEach((entry) =>
|
|
1187
|
+
_chunk4RRHMRLJjs.logger_default.success("Applied:");
|
|
1188
|
+
applied.forEach((entry) => _chunk4RRHMRLJjs.logger_default.success(` \u2022 ${entry.name}${formatFilesHint(entry)}`));
|
|
1189
1189
|
}
|
|
1190
1190
|
if (pending.length) {
|
|
1191
|
-
|
|
1191
|
+
_chunk4RRHMRLJjs.logger_default.warn("Needs attention:");
|
|
1192
1192
|
pending.forEach((entry) => {
|
|
1193
1193
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1194
|
-
|
|
1194
|
+
_chunk4RRHMRLJjs.logger_default.warn(` \u2022 ${entry.name}${formatFilesHint(entry)}${details}`);
|
|
1195
1195
|
});
|
|
1196
1196
|
} else {
|
|
1197
|
-
|
|
1197
|
+
_chunk4RRHMRLJjs.logger_default.success("All applicable patches are applied.");
|
|
1198
1198
|
}
|
|
1199
1199
|
if (skipped.length) {
|
|
1200
|
-
|
|
1200
|
+
_chunk4RRHMRLJjs.logger_default.info("Skipped:");
|
|
1201
1201
|
skipped.forEach((entry) => {
|
|
1202
1202
|
const details = entry.reason ? ` - ${entry.reason}` : "";
|
|
1203
|
-
|
|
1203
|
+
_chunk4RRHMRLJjs.logger_default.info(` \u2022 ${entry.name}${details}`);
|
|
1204
1204
|
});
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
@@ -1222,7 +1222,7 @@ async function validateCommandDefaultHandler(ctx) {
|
|
|
1222
1222
|
const { args } = ctx;
|
|
1223
1223
|
const validateArgs = resolveValidateCommandArgs(args);
|
|
1224
1224
|
try {
|
|
1225
|
-
const result = await
|
|
1225
|
+
const result = await _chunk4RRHMRLJjs.restoreConfigFiles.call(void 0, {
|
|
1226
1226
|
cwd: ctx.cwd,
|
|
1227
1227
|
reportFile: validateArgs.reportFile,
|
|
1228
1228
|
dryRun: true,
|
|
@@ -1235,13 +1235,13 @@ async function validateCommandDefaultHandler(ctx) {
|
|
|
1235
1235
|
logValidateSuccessSummary(result);
|
|
1236
1236
|
return result;
|
|
1237
1237
|
} catch (error) {
|
|
1238
|
-
const summary =
|
|
1238
|
+
const summary = _chunk4RRHMRLJjs.classifyValidateError.call(void 0, error);
|
|
1239
1239
|
if (args.json) {
|
|
1240
1240
|
logValidateFailureAsJson(summary);
|
|
1241
1241
|
} else {
|
|
1242
1242
|
logValidateFailureSummary(summary);
|
|
1243
1243
|
}
|
|
1244
|
-
throw new (0,
|
|
1244
|
+
throw new (0, _chunk4RRHMRLJjs.ValidateCommandError)(summary, { cause: error });
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
@@ -1279,7 +1279,7 @@ function registerTailwindcssPatchCommand(cli, commandName, options, prefix, defa
|
|
|
1279
1279
|
// src/commands/cli.ts
|
|
1280
1280
|
function mountTailwindcssPatchCommands(cli, options = {}) {
|
|
1281
1281
|
const prefix = _nullishCoalesce(options.commandPrefix, () => ( ""));
|
|
1282
|
-
const selectedCommands = _nullishCoalesce(options.commands, () => (
|
|
1282
|
+
const selectedCommands = _nullishCoalesce(options.commands, () => ( _chunk4RRHMRLJjs.tailwindcssPatchCommands));
|
|
1283
1283
|
const defaultDefinitions = buildDefaultCommandDefinitions();
|
|
1284
1284
|
for (const name of selectedCommands) {
|
|
1285
1285
|
registerTailwindcssPatchCommand(cli, name, options, prefix, defaultDefinitions);
|
|
@@ -1298,4 +1298,4 @@ function createTailwindcssPatchCli(options = {}) {
|
|
|
1298
1298
|
|
|
1299
1299
|
|
|
1300
1300
|
|
|
1301
|
-
exports.VALIDATE_EXIT_CODES =
|
|
1301
|
+
exports.VALIDATE_EXIT_CODES = _chunk4RRHMRLJjs.VALIDATE_EXIT_CODES; exports.VALIDATE_FAILURE_REASONS = _chunk4RRHMRLJjs.VALIDATE_FAILURE_REASONS; exports.ValidateCommandError = _chunk4RRHMRLJjs.ValidateCommandError; exports.createTailwindcssPatchCli = createTailwindcssPatchCli; exports.mountTailwindcssPatchCommands = mountTailwindcssPatchCommands; exports.tailwindcssPatchCommands = _chunk4RRHMRLJjs.tailwindcssPatchCommands;
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
migrateConfigFiles,
|
|
12
12
|
restoreConfigFiles,
|
|
13
13
|
tailwindcssPatchCommands
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-AOSPLINO.mjs";
|
|
15
|
+
import "../chunk-OSH52QWA.mjs";
|
|
16
16
|
|
|
17
17
|
// ../../node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
18
18
|
import { EventEmitter } from "events";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('./chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('./chunk-ZPLR2UEW.js');
|
|
2
2
|
|
|
3
3
|
// ../shared/dist/index.js
|
|
4
4
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQQXAOMUHjs = require('./chunk-QQXAOMUH.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -26,8 +26,8 @@ var _chunkPMN7HS4Yjs = require('./chunk-PMN7HS4Y.js');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
30
|
-
require('./chunk-
|
|
29
|
+
var _chunk4RRHMRLJjs = require('./chunk-4RRHMRLJ.js');
|
|
30
|
+
require('./chunk-ZPLR2UEW.js');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
@@ -54,4 +54,4 @@ require('./chunk-5CWNAWKP.js');
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
exports.CacheStore =
|
|
57
|
+
exports.CacheStore = _chunk4RRHMRLJjs.CacheStore; exports.MIGRATION_REPORT_KIND = _chunk4RRHMRLJjs.MIGRATION_REPORT_KIND; exports.MIGRATION_REPORT_SCHEMA_VERSION = _chunk4RRHMRLJjs.MIGRATION_REPORT_SCHEMA_VERSION; exports.TailwindcssPatcher = _chunk4RRHMRLJjs.TailwindcssPatcher; exports.VALIDATE_EXIT_CODES = _chunk4RRHMRLJjs.VALIDATE_EXIT_CODES; exports.VALIDATE_FAILURE_REASONS = _chunk4RRHMRLJjs.VALIDATE_FAILURE_REASONS; exports.ValidateCommandError = _chunk4RRHMRLJjs.ValidateCommandError; exports.collectClassesFromContexts = _chunk4RRHMRLJjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunk4RRHMRLJjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkQQXAOMUHjs.createTailwindcssPatchCli; exports.defineConfig = _chunkQQXAOMUHjs.defineConfig; exports.extractProjectCandidatesWithPositions = _chunk4RRHMRLJjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunk4RRHMRLJjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunk4RRHMRLJjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunk4RRHMRLJjs.extractValidCandidates; exports.getPatchStatusReport = _chunk4RRHMRLJjs.getPatchStatusReport; exports.groupTokensByFile = _chunk4RRHMRLJjs.groupTokensByFile; exports.loadRuntimeContexts = _chunk4RRHMRLJjs.loadRuntimeContexts; exports.logger = _chunk4RRHMRLJjs.logger_default; exports.migrateConfigFiles = _chunk4RRHMRLJjs.migrateConfigFiles; exports.mountTailwindcssPatchCommands = _chunkQQXAOMUHjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunk4RRHMRLJjs.normalizeOptions; exports.restoreConfigFiles = _chunk4RRHMRLJjs.restoreConfigFiles; exports.runTailwindBuild = _chunk4RRHMRLJjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunk4RRHMRLJjs.tailwindcssPatchCommands;
|
package/dist/index.mjs
CHANGED
|
@@ -26,8 +26,8 @@ import {
|
|
|
26
26
|
restoreConfigFiles,
|
|
27
27
|
runTailwindBuild,
|
|
28
28
|
tailwindcssPatchCommands
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-
|
|
29
|
+
} from "./chunk-AOSPLINO.mjs";
|
|
30
|
+
import "./chunk-OSH52QWA.mjs";
|
|
31
31
|
export {
|
|
32
32
|
CacheStore,
|
|
33
33
|
MIGRATION_REPORT_KIND,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-patch",
|
|
3
|
-
"version": "9.0.0
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "patch tailwindcss for exposing context and extract classes",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@babel/generator": "^7.29.1",
|
|
65
|
-
"@babel/parser": "^7.29.
|
|
65
|
+
"@babel/parser": "^7.29.2",
|
|
66
66
|
"@babel/traverse": "^7.29.0",
|
|
67
67
|
"@babel/types": "^7.29.0",
|
|
68
|
-
"@tailwindcss/node": "^4.2.
|
|
68
|
+
"@tailwindcss/node": "^4.2.2",
|
|
69
69
|
"cac": "6.7.14",
|
|
70
70
|
"consola": "^3.4.2",
|
|
71
71
|
"fs-extra": "^11.3.4",
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"postcss": "^8.5.8",
|
|
75
75
|
"semver": "^7.7.4",
|
|
76
76
|
"tailwindcss-config": "^1.1.4",
|
|
77
|
-
"@tailwindcss-mangle/config": "7.0.0
|
|
77
|
+
"@tailwindcss-mangle/config": "7.0.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@tailwindcss/oxide": "^4.2.
|
|
81
|
-
"@tailwindcss/postcss": "^4.2.
|
|
82
|
-
"@tailwindcss/vite": "^4.2.
|
|
80
|
+
"@tailwindcss/oxide": "^4.2.2",
|
|
81
|
+
"@tailwindcss/postcss": "^4.2.2",
|
|
82
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
83
83
|
"tailwindcss": "^4.1.18",
|
|
84
84
|
"tailwindcss-3": "npm:tailwindcss@^3.4.19",
|
|
85
85
|
"tailwindcss-4": "npm:tailwindcss@^4.1.18"
|
|
@@ -6,6 +6,15 @@ import path from 'pathe'
|
|
|
6
6
|
import { extractValidCandidates } from '../extraction/candidate-extractor'
|
|
7
7
|
import { isObject } from '../utils'
|
|
8
8
|
|
|
9
|
+
function collectRuntimeCandidateKeys(context: TailwindcssRuntimeContext) {
|
|
10
|
+
const candidateRuleCache = context.candidateRuleCache
|
|
11
|
+
if (candidateRuleCache instanceof Map && candidateRuleCache.size > 0) {
|
|
12
|
+
return candidateRuleCache.keys()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return context.classCache.keys()
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
export function collectClassesFromContexts(
|
|
10
19
|
contexts: TailwindcssRuntimeContext[],
|
|
11
20
|
filter: (className: string) => boolean,
|
|
@@ -16,7 +25,7 @@ export function collectClassesFromContexts(
|
|
|
16
25
|
continue
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
for (const key of context
|
|
28
|
+
for (const key of collectRuntimeCandidateKeys(context)) {
|
|
20
29
|
const className = key.toString()
|
|
21
30
|
if (filter(className)) {
|
|
22
31
|
set.add(className)
|