tailwindcss-patch 8.6.0 → 8.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-J27TPXH5.js → chunk-DRPYVUDA.js} +26 -5
- package/dist/{chunk-RVSD53YX.mjs → chunk-LOJHMBK5.mjs} +26 -5
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -221,6 +221,25 @@ async function importNode() {
|
|
|
221
221
|
async function importOxide() {
|
|
222
222
|
return Promise.resolve().then(() => _interopRequireWildcard(require("@tailwindcss/oxide")));
|
|
223
223
|
}
|
|
224
|
+
async function loadDesignSystem(css, bases) {
|
|
225
|
+
const uniqueBases = Array.from(new Set(bases.filter(Boolean)));
|
|
226
|
+
if (uniqueBases.length === 0) {
|
|
227
|
+
throw new Error("No base directories provided for Tailwind CSS design system.");
|
|
228
|
+
}
|
|
229
|
+
const { __unstable__loadDesignSystem } = await importNode();
|
|
230
|
+
let lastError;
|
|
231
|
+
for (const base of uniqueBases) {
|
|
232
|
+
try {
|
|
233
|
+
return await __unstable__loadDesignSystem(css, { base });
|
|
234
|
+
} catch (error) {
|
|
235
|
+
lastError = error;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (lastError instanceof Error) {
|
|
239
|
+
throw lastError;
|
|
240
|
+
}
|
|
241
|
+
throw new Error("Failed to load Tailwind CSS design system.");
|
|
242
|
+
}
|
|
224
243
|
async function extractRawCandidatesWithPositions(content, extension = "html") {
|
|
225
244
|
const { Scanner } = await importOxide();
|
|
226
245
|
const scanner = new Scanner({});
|
|
@@ -242,6 +261,7 @@ async function extractValidCandidates(options) {
|
|
|
242
261
|
const providedOptions = _nullishCoalesce(options, () => ( {}));
|
|
243
262
|
const defaultCwd = _nullishCoalesce(providedOptions.cwd, () => ( _process2.default.cwd()));
|
|
244
263
|
const base = _nullishCoalesce(providedOptions.base, () => ( defaultCwd));
|
|
264
|
+
const baseFallbacks = _nullishCoalesce(providedOptions.baseFallbacks, () => ( []));
|
|
245
265
|
const css = _nullishCoalesce(providedOptions.css, () => ( '@import "tailwindcss";'));
|
|
246
266
|
const sources = (_nullishCoalesce(providedOptions.sources, () => ( [
|
|
247
267
|
{
|
|
@@ -254,8 +274,7 @@ async function extractValidCandidates(options) {
|
|
|
254
274
|
pattern: source.pattern,
|
|
255
275
|
negated: source.negated
|
|
256
276
|
}));
|
|
257
|
-
const
|
|
258
|
-
const designSystem = await __unstable__loadDesignSystem(css, { base });
|
|
277
|
+
const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks]);
|
|
259
278
|
const candidates = await extractRawCandidates(sources);
|
|
260
279
|
const parsedCandidates = candidates.filter(
|
|
261
280
|
(rawCandidate) => designSystem.parseCandidate(rawCandidate).length > 0
|
|
@@ -1347,11 +1366,13 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
1347
1366
|
}
|
|
1348
1367
|
const css = await _fsextra2.default.readFile(filePath, "utf8");
|
|
1349
1368
|
const entryDir = _pathe2.default.dirname(filePath);
|
|
1350
|
-
const
|
|
1351
|
-
const
|
|
1369
|
+
const designSystemBases = resolvedConfiguredBase && resolvedConfiguredBase !== entryDir ? [entryDir, resolvedConfiguredBase] : [entryDir];
|
|
1370
|
+
const sourcesBase = _nullishCoalesce(resolvedConfiguredBase, () => ( entryDir));
|
|
1371
|
+
const sources = resolveSources(sourcesBase);
|
|
1352
1372
|
const candidates = await extractValidCandidates({
|
|
1353
1373
|
cwd: options.projectRoot,
|
|
1354
|
-
base:
|
|
1374
|
+
base: designSystemBases[0],
|
|
1375
|
+
baseFallbacks: designSystemBases.slice(1),
|
|
1355
1376
|
css,
|
|
1356
1377
|
sources
|
|
1357
1378
|
});
|
|
@@ -217,6 +217,25 @@ async function importNode() {
|
|
|
217
217
|
async function importOxide() {
|
|
218
218
|
return import("@tailwindcss/oxide");
|
|
219
219
|
}
|
|
220
|
+
async function loadDesignSystem(css, bases) {
|
|
221
|
+
const uniqueBases = Array.from(new Set(bases.filter(Boolean)));
|
|
222
|
+
if (uniqueBases.length === 0) {
|
|
223
|
+
throw new Error("No base directories provided for Tailwind CSS design system.");
|
|
224
|
+
}
|
|
225
|
+
const { __unstable__loadDesignSystem } = await importNode();
|
|
226
|
+
let lastError;
|
|
227
|
+
for (const base of uniqueBases) {
|
|
228
|
+
try {
|
|
229
|
+
return await __unstable__loadDesignSystem(css, { base });
|
|
230
|
+
} catch (error) {
|
|
231
|
+
lastError = error;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (lastError instanceof Error) {
|
|
235
|
+
throw lastError;
|
|
236
|
+
}
|
|
237
|
+
throw new Error("Failed to load Tailwind CSS design system.");
|
|
238
|
+
}
|
|
220
239
|
async function extractRawCandidatesWithPositions(content, extension = "html") {
|
|
221
240
|
const { Scanner } = await importOxide();
|
|
222
241
|
const scanner = new Scanner({});
|
|
@@ -238,6 +257,7 @@ async function extractValidCandidates(options) {
|
|
|
238
257
|
const providedOptions = options ?? {};
|
|
239
258
|
const defaultCwd = providedOptions.cwd ?? process2.cwd();
|
|
240
259
|
const base = providedOptions.base ?? defaultCwd;
|
|
260
|
+
const baseFallbacks = providedOptions.baseFallbacks ?? [];
|
|
241
261
|
const css = providedOptions.css ?? '@import "tailwindcss";';
|
|
242
262
|
const sources = (providedOptions.sources ?? [
|
|
243
263
|
{
|
|
@@ -250,8 +270,7 @@ async function extractValidCandidates(options) {
|
|
|
250
270
|
pattern: source.pattern,
|
|
251
271
|
negated: source.negated
|
|
252
272
|
}));
|
|
253
|
-
const
|
|
254
|
-
const designSystem = await __unstable__loadDesignSystem(css, { base });
|
|
273
|
+
const designSystem = await loadDesignSystem(css, [base, ...baseFallbacks]);
|
|
255
274
|
const candidates = await extractRawCandidates(sources);
|
|
256
275
|
const parsedCandidates = candidates.filter(
|
|
257
276
|
(rawCandidate) => designSystem.parseCandidate(rawCandidate).length > 0
|
|
@@ -1343,11 +1362,13 @@ async function collectClassesFromTailwindV4(options) {
|
|
|
1343
1362
|
}
|
|
1344
1363
|
const css = await fs5.readFile(filePath, "utf8");
|
|
1345
1364
|
const entryDir = path5.dirname(filePath);
|
|
1346
|
-
const
|
|
1347
|
-
const
|
|
1365
|
+
const designSystemBases = resolvedConfiguredBase && resolvedConfiguredBase !== entryDir ? [entryDir, resolvedConfiguredBase] : [entryDir];
|
|
1366
|
+
const sourcesBase = resolvedConfiguredBase ?? entryDir;
|
|
1367
|
+
const sources = resolveSources(sourcesBase);
|
|
1348
1368
|
const candidates = await extractValidCandidates({
|
|
1349
1369
|
cwd: options.projectRoot,
|
|
1350
|
-
base:
|
|
1370
|
+
base: designSystemBases[0],
|
|
1371
|
+
baseFallbacks: designSystemBases.slice(1),
|
|
1351
1372
|
css,
|
|
1352
1373
|
sources
|
|
1353
1374
|
});
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkDRPYVUDAjs = require('./chunk-DRPYVUDA.js');
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
|
-
var cli =
|
|
6
|
+
var cli = _chunkDRPYVUDAjs.createTailwindcssPatchCli.call(void 0, );
|
|
7
7
|
cli.help();
|
|
8
8
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkDRPYVUDAjs = require('./chunk-DRPYVUDA.js');
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var _config = require('@tailwindcss-mangle/config');
|
|
@@ -39,4 +39,4 @@ var _config = require('@tailwindcss-mangle/config');
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
exports.CacheStore =
|
|
42
|
+
exports.CacheStore = _chunkDRPYVUDAjs.CacheStore; exports.TailwindcssPatcher = _chunkDRPYVUDAjs.TailwindcssPatcher; exports.collectClassesFromContexts = _chunkDRPYVUDAjs.collectClassesFromContexts; exports.collectClassesFromTailwindV4 = _chunkDRPYVUDAjs.collectClassesFromTailwindV4; exports.createTailwindcssPatchCli = _chunkDRPYVUDAjs.createTailwindcssPatchCli; exports.defineConfig = _config.defineConfig; exports.extractProjectCandidatesWithPositions = _chunkDRPYVUDAjs.extractProjectCandidatesWithPositions; exports.extractRawCandidates = _chunkDRPYVUDAjs.extractRawCandidates; exports.extractRawCandidatesWithPositions = _chunkDRPYVUDAjs.extractRawCandidatesWithPositions; exports.extractValidCandidates = _chunkDRPYVUDAjs.extractValidCandidates; exports.getPatchStatusReport = _chunkDRPYVUDAjs.getPatchStatusReport; exports.groupTokensByFile = _chunkDRPYVUDAjs.groupTokensByFile; exports.loadRuntimeContexts = _chunkDRPYVUDAjs.loadRuntimeContexts; exports.logger = _chunkDRPYVUDAjs.logger_default; exports.mountTailwindcssPatchCommands = _chunkDRPYVUDAjs.mountTailwindcssPatchCommands; exports.normalizeOptions = _chunkDRPYVUDAjs.normalizeOptions; exports.runTailwindBuild = _chunkDRPYVUDAjs.runTailwindBuild; exports.tailwindcssPatchCommands = _chunkDRPYVUDAjs.tailwindcssPatchCommands;
|
package/dist/index.mjs
CHANGED