tailwindcss-patch 9.4.0 → 9.4.2

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.
@@ -14,7 +14,9 @@ let node_url = require("node:url");
14
14
  let node_fs = require("node:fs");
15
15
  let postcss = require("postcss");
16
16
  postcss = require_chunk.__toESM(postcss);
17
- require("micromatch");
17
+ let node_fs_promises = require("node:fs/promises");
18
+ let micromatch = require("micromatch");
19
+ micromatch = require_chunk.__toESM(micromatch);
18
20
  let _babel_types = require("@babel/types");
19
21
  _babel_types = require_chunk.__toESM(_babel_types);
20
22
  let _babel_generator = require("@babel/generator");
@@ -24,7 +26,7 @@ _babel_traverse = require_chunk.__toESM(_babel_traverse);
24
26
  let _babel_parser = require("@babel/parser");
25
27
  let tailwindcss_config = require("tailwindcss-config");
26
28
  //#region package.json
27
- var version = "9.4.0";
29
+ var version = "9.4.2";
28
30
  //#endregion
29
31
  //#region src/constants.ts
30
32
  const pkgName = "tailwindcss-patch";
@@ -1490,6 +1492,8 @@ const DEFAULT_BARE_ARBITRARY_VALUE_UNITS = [
1490
1492
  const NUMBER_RE = /^-?(?:\d+|\d*\.\d+)$/;
1491
1493
  const FUNCTION_VALUE_RE = /^[a-z_-][\w-]*\(/i;
1492
1494
  const HEX_ESCAPE_RE = /^[\da-f]$/i;
1495
+ const ASPECT_RATIO_RE = /^\d+\/\d+$/;
1496
+ const ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
1493
1497
  function splitVariantPrefix(candidate) {
1494
1498
  let depth = 0;
1495
1499
  let quote;
@@ -1609,6 +1613,9 @@ function normalizeBareArbitraryValueOptions(options) {
1609
1613
  if (normalizedUnits.length === 0) return;
1610
1614
  return { units: normalizedUnits.sort((a, b) => b.length - a.length) };
1611
1615
  }
1616
+ function isBareArbitraryValuesEnabled(options) {
1617
+ return normalizeBareArbitraryValueOptions(options) !== void 0;
1618
+ }
1612
1619
  function normalizeEscapedValue(value) {
1613
1620
  let result = "";
1614
1621
  for (let index = 0; index < value.length; index++) {
@@ -1650,13 +1657,17 @@ function resolveValueWithUnit(body, units) {
1650
1657
  if (NUMBER_RE.test(numberPart)) return `${numberPart}${unit}`;
1651
1658
  }
1652
1659
  }
1653
- function resolveArbitraryValue(body, units) {
1660
+ function resolveArbitraryValue(utility, body, units) {
1654
1661
  const value = normalizeEscapedValue(body);
1655
1662
  const withUnit = resolveValueWithUnit(value, units);
1656
1663
  if (withUnit) return withUnit;
1664
+ if (utility === "aspect" && ASPECT_RATIO_RE.test(value)) return value;
1657
1665
  if (isHexColorValue(value)) return value;
1658
1666
  if (isQuotedValue(value)) return value;
1659
- if (FUNCTION_VALUE_RE.test(value) && value.endsWith(")") && isBalancedFunctionValue(value)) return value;
1667
+ if (FUNCTION_VALUE_RE.test(value) && value.endsWith(")") && isBalancedFunctionValue(value)) {
1668
+ if (utility === "text" && /^var\(/i.test(value)) return `color:${value}`;
1669
+ return value;
1670
+ }
1660
1671
  }
1661
1672
  function resolveUtilityAndValue(body, units) {
1662
1673
  let depth = 0;
@@ -1684,7 +1695,7 @@ function resolveUtilityAndValue(body, units) {
1684
1695
  const utility = body.slice(0, index);
1685
1696
  const rawValue = body.slice(index + 1);
1686
1697
  if (!utility || !rawValue) continue;
1687
- const value = resolveArbitraryValue(rawValue, units);
1698
+ const value = resolveArbitraryValue(utility, rawValue, units);
1688
1699
  if (value) return {
1689
1700
  utility,
1690
1701
  value
@@ -1707,6 +1718,65 @@ function resolveBareArbitraryValueCandidate(candidate, options) {
1707
1718
  canonicalCandidate: `${prefix}${important}${negative}${resolved.utility}-[${resolved.value}]`
1708
1719
  };
1709
1720
  }
1721
+ function isBareArbitrarySourceSplitter(char) {
1722
+ return /\s/.test(char);
1723
+ }
1724
+ function isQuoteBoundary(content, start, index) {
1725
+ const tokenPrefix = content.slice(start, index);
1726
+ return tokenPrefix.length === 0 || !tokenPrefix.endsWith("-");
1727
+ }
1728
+ function trimBareArbitrarySourceToken(token, start) {
1729
+ let nextToken = token;
1730
+ let nextStart = start;
1731
+ while (nextToken.length > 0 && /^[<{([]$/.test(nextToken[0])) {
1732
+ nextToken = nextToken.slice(1);
1733
+ nextStart++;
1734
+ }
1735
+ while (nextToken.length > 0 && /^[>\],;]$/.test(nextToken[nextToken.length - 1])) nextToken = nextToken.slice(0, -1);
1736
+ return {
1737
+ token: nextToken,
1738
+ start: nextStart
1739
+ };
1740
+ }
1741
+ function pushBareArbitrarySourceCandidate(result, token, start, options) {
1742
+ const trimmed = trimBareArbitrarySourceToken(token, start);
1743
+ if (!trimmed.token || trimmed.token.includes("=") || trimmed.token.includes("[") || trimmed.token.includes("]")) return;
1744
+ if (!resolveBareArbitraryValueCandidate(trimmed.token, options)) return;
1745
+ result.push({
1746
+ rawCandidate: trimmed.token,
1747
+ start: trimmed.start,
1748
+ end: trimmed.start + trimmed.token.length
1749
+ });
1750
+ }
1751
+ function extractBareArbitraryValueSourceCandidatesWithPositions(content, options) {
1752
+ if (!isBareArbitraryValuesEnabled(options)) return [];
1753
+ const normalized = content.includes("\\") ? content.replace(ESCAPED_WHITESPACE_RE, " ") : content;
1754
+ const result = [];
1755
+ let depth = 0;
1756
+ let quote;
1757
+ let start = 0;
1758
+ for (let index = 0; index < normalized.length; index++) {
1759
+ const char = normalized[index];
1760
+ if (char === void 0) continue;
1761
+ if (char === "\\") {
1762
+ index++;
1763
+ continue;
1764
+ }
1765
+ if (quote) {
1766
+ if (char === quote) quote = void 0;
1767
+ } else if ((char === "\"" || char === "'" || char === "`") && !isQuoteBoundary(normalized, start, index)) quote = char;
1768
+ else if (char === "(" || char === "{" || char === "[") depth++;
1769
+ else if (char === ")" || char === "}" || char === "]") depth = Math.max(0, depth - 1);
1770
+ if (!isBareArbitrarySourceSplitter(char) && !((char === "\"" || char === "'" || char === "`") && depth === 0 && isQuoteBoundary(normalized, start, index))) continue;
1771
+ pushBareArbitrarySourceCandidate(result, normalized.slice(start, index), start, options);
1772
+ start = index + 1;
1773
+ }
1774
+ pushBareArbitrarySourceCandidate(result, normalized.slice(start), start, options);
1775
+ return result;
1776
+ }
1777
+ function extractBareArbitraryValueSourceCandidates(content, options) {
1778
+ return [...new Set(extractBareArbitraryValueSourceCandidatesWithPositions(content, options).map((candidate) => candidate.rawCandidate))];
1779
+ }
1710
1780
  function escapeCssClassName(value) {
1711
1781
  let result = "";
1712
1782
  for (let index = 0; index < value.length; index++) {
@@ -2044,7 +2114,110 @@ async function compileTailwindV4Source(source) {
2044
2114
  }
2045
2115
  //#endregion
2046
2116
  //#region src/v4/source-scan.ts
2117
+ const TAILWIND_V4_IGNORED_CONTENT_DIRS = [
2118
+ ".git",
2119
+ ".hg",
2120
+ ".jj",
2121
+ ".next",
2122
+ ".parcel-cache",
2123
+ ".pnpm-store",
2124
+ ".svelte-kit",
2125
+ ".svn",
2126
+ ".turbo",
2127
+ ".venv",
2128
+ ".vercel",
2129
+ ".yarn",
2130
+ "__pycache__",
2131
+ "node_modules",
2132
+ "venv"
2133
+ ];
2134
+ const TAILWIND_V4_IGNORED_EXTENSIONS = [
2135
+ "less",
2136
+ "lock",
2137
+ "sass",
2138
+ "scss",
2139
+ "styl",
2140
+ "log"
2141
+ ];
2142
+ const TAILWIND_V4_IGNORED_FILES = [
2143
+ "package-lock.json",
2144
+ "pnpm-lock.yaml",
2145
+ "bun.lockb",
2146
+ ".gitignore",
2147
+ ".env",
2148
+ ".env.*"
2149
+ ];
2047
2150
  const TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN = "**/*";
2151
+ function uniqueResolvedPaths(values) {
2152
+ const result = [];
2153
+ for (const value of values) {
2154
+ if (!value) continue;
2155
+ const resolved = pathe.default.resolve(value);
2156
+ if (!result.includes(resolved)) result.push(resolved);
2157
+ }
2158
+ return result;
2159
+ }
2160
+ function toPosixPath(value) {
2161
+ return value.replaceAll(pathe.default.sep, "/");
2162
+ }
2163
+ function resolveSourceScanPath(value) {
2164
+ const resolved = pathe.default.resolve(value);
2165
+ try {
2166
+ return node_fs.realpathSync.native(resolved);
2167
+ } catch {
2168
+ return resolved;
2169
+ }
2170
+ }
2171
+ function normalizeGlobPattern(pattern) {
2172
+ return pattern.startsWith("./") ? pattern.slice(2) : pattern;
2173
+ }
2174
+ function hasGlobMagic(value) {
2175
+ return /[*?[\]{}()!+@]/.test(value);
2176
+ }
2177
+ function splitStaticGlobPrefix(pattern) {
2178
+ const segments = normalizeGlobPattern(pattern).split(/[\\/]+/);
2179
+ const prefix = [];
2180
+ const rest = [];
2181
+ let reachedGlob = false;
2182
+ for (const segment of segments) {
2183
+ if (!reachedGlob && segment && !hasGlobMagic(segment)) {
2184
+ prefix.push(segment);
2185
+ continue;
2186
+ }
2187
+ reachedGlob = true;
2188
+ rest.push(segment);
2189
+ }
2190
+ return {
2191
+ prefix,
2192
+ rest
2193
+ };
2194
+ }
2195
+ async function pathExistsAsDirectory(file) {
2196
+ try {
2197
+ return (await (0, node_fs_promises.stat)(file)).isDirectory();
2198
+ } catch {
2199
+ return false;
2200
+ }
2201
+ }
2202
+ function createTailwindV4DefaultIgnoreSources(base) {
2203
+ return [
2204
+ ...TAILWIND_V4_IGNORED_CONTENT_DIRS.map((pattern) => ({
2205
+ base,
2206
+ pattern: `**/${pattern}/**`,
2207
+ negated: true
2208
+ })),
2209
+ ...TAILWIND_V4_IGNORED_EXTENSIONS.map((extension) => ({
2210
+ base,
2211
+ pattern: `**/*.${extension}`,
2212
+ negated: true
2213
+ })),
2214
+ ...TAILWIND_V4_IGNORED_FILES.map((pattern) => ({
2215
+ base,
2216
+ pattern: `**/${pattern}`,
2217
+ negated: true
2218
+ }))
2219
+ ];
2220
+ }
2048
2221
  function createTailwindV4RootSources(root, fallbackBase) {
2049
2222
  if (root === "none") return [];
2050
2223
  if (root === null) return [{
@@ -2060,6 +2233,34 @@ function createTailwindV4RootSources(root, fallbackBase) {
2060
2233
  function createTailwindV4CompiledSourceEntries(root, sources, fallbackBase) {
2061
2234
  return [...createTailwindV4RootSources(root, fallbackBase), ...sources];
2062
2235
  }
2236
+ async function resolveTailwindV4SourceEntry(sourcePath, base, negated, defaultPattern = TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN) {
2237
+ const absoluteSource = pathe.default.isAbsolute(sourcePath) ? pathe.default.resolve(sourcePath) : pathe.default.resolve(base, sourcePath);
2238
+ if (await pathExistsAsDirectory(absoluteSource)) return {
2239
+ base: absoluteSource,
2240
+ negated,
2241
+ pattern: normalizeGlobPattern(defaultPattern)
2242
+ };
2243
+ if (pathe.default.isAbsolute(sourcePath)) return {
2244
+ base: pathe.default.dirname(absoluteSource),
2245
+ negated,
2246
+ pattern: normalizeGlobPattern(pathe.default.basename(absoluteSource))
2247
+ };
2248
+ const { prefix, rest } = splitStaticGlobPrefix(sourcePath);
2249
+ if (prefix.length > 0 && rest.length > 0) return {
2250
+ base: pathe.default.resolve(base, ...prefix),
2251
+ negated,
2252
+ pattern: normalizeGlobPattern(rest.join("/"))
2253
+ };
2254
+ return {
2255
+ base,
2256
+ negated,
2257
+ pattern: normalizeGlobPattern(sourcePath)
2258
+ };
2259
+ }
2260
+ async function normalizeTailwindV4SourceEntries(sources, options = {}) {
2261
+ const cwd = options.cwd ? pathe.default.resolve(options.cwd) : node_process.default.cwd();
2262
+ return Promise.all(sources.map((source) => resolveTailwindV4SourceEntry(source.pattern, source.base ? pathe.default.resolve(source.base) : cwd, source.negated, options.defaultPattern)));
2263
+ }
2063
2264
  function expandBracePattern(pattern) {
2064
2265
  const index = pattern.indexOf("{");
2065
2266
  if (index === -1) return [pattern];
@@ -2130,6 +2331,84 @@ function normalizeTailwindV4ScannerSources(sources, cwd, ignoredSources = []) {
2130
2331
  negated: false
2131
2332
  }], ...ignoredSources]);
2132
2333
  }
2334
+ function normalizeEntryPattern(entry) {
2335
+ return pathe.default.isAbsolute(entry.pattern) ? toPosixPath(pathe.default.relative(resolveSourceScanPath(entry.base), entry.pattern)) : normalizeGlobPattern(entry.pattern);
2336
+ }
2337
+ function isFileMatchedByTailwindV4SourceEntry(file, entry) {
2338
+ const relative = toPosixPath(pathe.default.relative(resolveSourceScanPath(entry.base), file));
2339
+ return Boolean(relative) && !relative.startsWith("../") && !pathe.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeEntryPattern(entry));
2340
+ }
2341
+ function isFileExcludedByTailwindV4SourceEntries(file, entries) {
2342
+ if (!entries?.length) return false;
2343
+ const resolvedFile = resolveSourceScanPath(file);
2344
+ return entries.some((entry) => entry.negated && isFileMatchedByTailwindV4SourceEntry(resolvedFile, entry));
2345
+ }
2346
+ function isFileMatchedByTailwindV4SourceEntries(file, entries) {
2347
+ if (!entries?.length) return true;
2348
+ const positiveEntries = entries.filter((entry) => !entry.negated);
2349
+ const negativeEntries = entries.filter((entry) => entry.negated);
2350
+ if (positiveEntries.length === 0) return false;
2351
+ const resolvedFile = resolveSourceScanPath(file);
2352
+ if (!positiveEntries.some((entry) => isFileMatchedByTailwindV4SourceEntry(resolvedFile, entry))) return false;
2353
+ return !negativeEntries.some((entry) => isFileMatchedByTailwindV4SourceEntry(resolvedFile, entry));
2354
+ }
2355
+ function createTailwindV4SourceEntryMatcher(entries) {
2356
+ if (!entries?.length) return;
2357
+ return (file) => isFileMatchedByTailwindV4SourceEntries(file, entries);
2358
+ }
2359
+ function createTailwindV4SourceExclusionMatcher(entries) {
2360
+ if (!entries?.length) return;
2361
+ return (file) => isFileExcludedByTailwindV4SourceEntries(file, entries);
2362
+ }
2363
+ function groupTailwindV4SourceEntriesByBase(entries) {
2364
+ const entriesByBase = /* @__PURE__ */ new Map();
2365
+ for (const entry of entries) {
2366
+ const base = pathe.default.resolve(entry.base);
2367
+ const group = entriesByBase.get(base) ?? [];
2368
+ group.push({
2369
+ ...entry,
2370
+ base,
2371
+ pattern: normalizeGlobPattern(entry.pattern)
2372
+ });
2373
+ entriesByBase.set(base, group);
2374
+ }
2375
+ return entriesByBase;
2376
+ }
2377
+ async function expandTailwindV4SourceEntries(entries, resolveFiles) {
2378
+ if (entries.length === 0) return [];
2379
+ const files = /* @__PURE__ */ new Set();
2380
+ await Promise.all([...groupTailwindV4SourceEntriesByBase(entries).entries()].map(async ([base, group]) => {
2381
+ const matched = await resolveFiles({
2382
+ cwd: base,
2383
+ sources: group
2384
+ });
2385
+ for (const file of matched) files.add(pathe.default.resolve(file));
2386
+ }));
2387
+ return [...files].filter((file) => !isFileExcludedByTailwindV4SourceEntries(file, entries));
2388
+ }
2389
+ function mergeTailwindV4SourceEntries(...entries) {
2390
+ const result = [];
2391
+ const seen = /* @__PURE__ */ new Set();
2392
+ for (const group of entries) for (const entry of group ?? []) {
2393
+ const normalized = {
2394
+ base: pathe.default.resolve(entry.base),
2395
+ pattern: normalizeGlobPattern(entry.pattern),
2396
+ negated: entry.negated
2397
+ };
2398
+ const key = JSON.stringify(normalized);
2399
+ if (seen.has(key)) continue;
2400
+ seen.add(key);
2401
+ result.push(normalized);
2402
+ }
2403
+ return result;
2404
+ }
2405
+ function resolveTailwindV4SourceBaseCandidates(projectRoot, base, baseFallbacks) {
2406
+ return uniqueResolvedPaths([
2407
+ base,
2408
+ projectRoot,
2409
+ ...baseFallbacks
2410
+ ]);
2411
+ }
2133
2412
  //#endregion
2134
2413
  //#region src/extraction/candidate-extractor.ts
2135
2414
  let oxideImportPromise;
@@ -2159,7 +2438,7 @@ const HTML_ATTRIBUTE_NAME_CANDIDATE_RE = /^(?:class|className|hover-class|hoverC
2159
2438
  const CSS_DIRECTIVE_CANDIDATE_RE = /^@(?:apply|tailwind|source|config|plugin|theme|utility|custom-variant|variant)$/;
2160
2439
  const CSS_APPLY_IMPORTANT = "!important";
2161
2440
  const CSS_APPLY_RE = /@apply\s+([^;{}]+)/g;
2162
- const JS_LIKE_SOURCE_EXTENSION_RE = /^(?:[cm]?[jt]sx?)$/;
2441
+ const JS_LIKE_SOURCE_EXTENSION_RE = /^[cm]?[jt]sx?$/;
2163
2442
  const MIXED_TEMPLATE_SOURCE_EXTENSION_RE = /^(?:vue|uvue|nvue|svelte|mpx)$/;
2164
2443
  const CSS_LIKE_SOURCE_EXTENSION_RE = /^(?:css|wxss|acss|jxss|ttss|qss|tyss|scss|sass|less|styl|stylus)$/;
2165
2444
  const SFC_SCRIPT_BLOCK_RE = /<script\b[^>]*>([\s\S]*?)<\/script>/gi;
@@ -2175,7 +2454,7 @@ function isHtmlAttributeNameCandidate(content, candidate) {
2175
2454
  function isInsideHtmlTagText(content, candidate) {
2176
2455
  if (content.lastIndexOf("<", candidate.start) > content.lastIndexOf(">", candidate.start)) return false;
2177
2456
  const nextOpen = content.indexOf("<", candidate.end);
2178
- return nextOpen !== -1 && (nextOpen < content.indexOf(">", candidate.end) || content.indexOf(">", candidate.end) === -1);
2457
+ return nextOpen !== -1 && (nextOpen < content.indexOf(">", candidate.end) || !content.includes(">", candidate.end));
2179
2458
  }
2180
2459
  function isCssDirectiveCandidate(candidate) {
2181
2460
  return candidate === CSS_APPLY_IMPORTANT || CSS_DIRECTIVE_CANDIDATE_RE.test(candidate);
@@ -2262,7 +2541,26 @@ function createLocalCandidate(candidate) {
2262
2541
  end: candidate.localStart + candidate.rawCandidate.length
2263
2542
  };
2264
2543
  }
2265
- async function extractCssApplyCandidates(content, extension) {
2544
+ function dedupeCandidatesWithPositions(candidates) {
2545
+ const seen = /* @__PURE__ */ new Set();
2546
+ return candidates.filter((candidate) => {
2547
+ const key = `${candidate.start}:${candidate.end}:${candidate.rawCandidate}`;
2548
+ if (seen.has(key)) return false;
2549
+ seen.add(key);
2550
+ return true;
2551
+ });
2552
+ }
2553
+ function createBareArbitraryValueCandidateContexts(content, extension, offset, options) {
2554
+ return extractBareArbitraryValueSourceCandidatesWithPositions(content, options?.bareArbitraryValues).map((candidate) => ({
2555
+ content,
2556
+ extension,
2557
+ localStart: candidate.start,
2558
+ rawCandidate: candidate.rawCandidate,
2559
+ start: candidate.start + offset,
2560
+ end: candidate.end + offset
2561
+ }));
2562
+ }
2563
+ async function extractCssApplyCandidates(content, extension, options) {
2266
2564
  const candidates = [];
2267
2565
  CSS_APPLY_RE.lastIndex = 0;
2268
2566
  let match = CSS_APPLY_RE.exec(content);
@@ -2278,11 +2576,12 @@ async function extractCssApplyCandidates(content, extension) {
2278
2576
  start: candidate.start + applyParamsStart,
2279
2577
  end: candidate.end + applyParamsStart
2280
2578
  })));
2579
+ candidates.push(...createBareArbitraryValueCandidateContexts(applyParams, "html", applyParamsStart, options));
2281
2580
  match = CSS_APPLY_RE.exec(content);
2282
2581
  }
2283
2582
  return candidates;
2284
2583
  }
2285
- async function extractMixedSourceScriptCandidates(content) {
2584
+ async function extractMixedSourceScriptCandidates(content, options) {
2286
2585
  const candidates = [];
2287
2586
  SFC_SCRIPT_BLOCK_RE.lastIndex = 0;
2288
2587
  let match = SFC_SCRIPT_BLOCK_RE.exec(content);
@@ -2298,6 +2597,7 @@ async function extractMixedSourceScriptCandidates(content) {
2298
2597
  start: candidate.start + scriptStart,
2299
2598
  end: candidate.end + scriptStart
2300
2599
  })));
2600
+ candidates.push(...createBareArbitraryValueCandidateContexts(scriptContent, "js", scriptStart, options));
2301
2601
  match = SFC_SCRIPT_BLOCK_RE.exec(content);
2302
2602
  }
2303
2603
  return candidates;
@@ -2306,9 +2606,9 @@ function createCandidateCacheKey(designSystemKey, options) {
2306
2606
  if (options.bareArbitraryValues == null || options.bareArbitraryValues === false) return designSystemKey;
2307
2607
  return `${designSystemKey}:bare-arbitrary:${JSON.stringify(options.bareArbitraryValues)}`;
2308
2608
  }
2309
- async function extractRawCandidatesWithPositions(content, extension = "html") {
2609
+ async function extractRawCandidatesWithPositions(content, extension = "html", options) {
2310
2610
  const { Scanner } = await getOxideModule();
2311
- return new Scanner({}).getCandidatesWithPositions({
2611
+ const candidates = new Scanner({}).getCandidatesWithPositions({
2312
2612
  content,
2313
2613
  extension
2314
2614
  }).map(({ candidate, position }) => ({
@@ -2316,16 +2616,18 @@ async function extractRawCandidatesWithPositions(content, extension = "html") {
2316
2616
  start: position,
2317
2617
  end: position + candidate.length
2318
2618
  }));
2619
+ candidates.push(...extractBareArbitraryValueSourceCandidatesWithPositions(content, options?.bareArbitraryValues));
2620
+ return dedupeCandidatesWithPositions(candidates);
2319
2621
  }
2320
- async function extractSourceCandidatesWithPositions(content, extension = "html") {
2622
+ async function extractSourceCandidatesWithPositions(content, extension = "html", options) {
2321
2623
  const normalizedExtension = extension.replace(/^\./, "");
2322
- const candidates = CSS_LIKE_SOURCE_EXTENSION_RE.test(normalizedExtension) ? await extractCssApplyCandidates(content, normalizedExtension) : (await extractRawCandidatesWithPositions(content, normalizedExtension)).map((candidate) => ({
2624
+ const candidates = CSS_LIKE_SOURCE_EXTENSION_RE.test(normalizedExtension) ? await extractCssApplyCandidates(content, normalizedExtension, options) : (await extractRawCandidatesWithPositions(content, normalizedExtension, options)).map((candidate) => ({
2323
2625
  ...candidate,
2324
2626
  content,
2325
2627
  extension: normalizedExtension,
2326
2628
  localStart: candidate.start
2327
2629
  }));
2328
- if (MIXED_TEMPLATE_SOURCE_EXTENSION_RE.test(normalizedExtension)) candidates.push(...await extractMixedSourceScriptCandidates(content));
2630
+ if (MIXED_TEMPLATE_SOURCE_EXTENSION_RE.test(normalizedExtension)) candidates.push(...await extractMixedSourceScriptCandidates(content, options));
2329
2631
  const seen = /* @__PURE__ */ new Set();
2330
2632
  return candidates.filter((candidate) => {
2331
2633
  if (!shouldKeepSourceCandidate(candidate.content, candidate.extension, createLocalCandidate(candidate))) return false;
@@ -2339,13 +2641,22 @@ async function extractSourceCandidatesWithPositions(content, extension = "html")
2339
2641
  end
2340
2642
  }));
2341
2643
  }
2342
- async function extractSourceCandidates(content, extension = "html") {
2343
- const candidates = await extractSourceCandidatesWithPositions(content, extension);
2644
+ async function extractSourceCandidates(content, extension = "html", options) {
2645
+ const candidates = await extractSourceCandidatesWithPositions(content, extension, options);
2344
2646
  return [...new Set(candidates.map((candidate) => candidate.rawCandidate))];
2345
2647
  }
2346
- async function extractRawCandidates(sources) {
2648
+ async function extractRawCandidates(sources, options) {
2347
2649
  const { Scanner } = await getOxideModule();
2348
- return new Scanner(sources === void 0 ? {} : { sources }).scan();
2650
+ const scanner = new Scanner(sources === void 0 ? {} : { sources });
2651
+ const candidates = new Set(scanner.scan());
2652
+ if (options?.bareArbitraryValues !== void 0 && options.bareArbitraryValues !== false) await Promise.all((scanner.files ?? []).map(async (file) => {
2653
+ try {
2654
+ const content = await node_fs.promises.readFile(file, "utf8");
2655
+ const extension = toExtension(file);
2656
+ for (const candidate of extractBareArbitraryValueSourceCandidatesWithPositions(content, options.bareArbitraryValues)) if (shouldKeepSourceCandidate(content, extension, candidate)) candidates.add(candidate.rawCandidate);
2657
+ } catch {}
2658
+ }));
2659
+ return [...candidates];
2349
2660
  }
2350
2661
  async function extractValidCandidates(options) {
2351
2662
  const providedOptions = options ?? {};
@@ -2374,7 +2685,7 @@ async function extractValidCandidates(options) {
2374
2685
  const candidateCacheKey = createCandidateCacheKey(designSystemKey, providedOptions);
2375
2686
  const candidateCache = designSystemCandidateCache.get(candidateCacheKey) ?? /* @__PURE__ */ new Map();
2376
2687
  designSystemCandidateCache.set(candidateCacheKey, candidateCache);
2377
- const candidates = await extractRawCandidates(sources);
2688
+ const candidates = await extractRawCandidates(sources, providedOptions.bareArbitraryValues === void 0 ? void 0 : { bareArbitraryValues: providedOptions.bareArbitraryValues });
2378
2689
  const inlineSources = extractTailwindV4InlineSourceCandidates(css);
2379
2690
  for (const candidate of inlineSources.included) candidates.push(candidate);
2380
2691
  for (const candidate of inlineSources.excluded) {
@@ -4238,6 +4549,30 @@ Object.defineProperty(exports, "MIGRATION_REPORT_SCHEMA_VERSION", {
4238
4549
  return MIGRATION_REPORT_SCHEMA_VERSION;
4239
4550
  }
4240
4551
  });
4552
+ Object.defineProperty(exports, "TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN", {
4553
+ enumerable: true,
4554
+ get: function() {
4555
+ return TAILWIND_V4_AUTO_SOURCE_SCAN_PATTERN;
4556
+ }
4557
+ });
4558
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_CONTENT_DIRS", {
4559
+ enumerable: true,
4560
+ get: function() {
4561
+ return TAILWIND_V4_IGNORED_CONTENT_DIRS;
4562
+ }
4563
+ });
4564
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_EXTENSIONS", {
4565
+ enumerable: true,
4566
+ get: function() {
4567
+ return TAILWIND_V4_IGNORED_EXTENSIONS;
4568
+ }
4569
+ });
4570
+ Object.defineProperty(exports, "TAILWIND_V4_IGNORED_FILES", {
4571
+ enumerable: true,
4572
+ get: function() {
4573
+ return TAILWIND_V4_IGNORED_FILES;
4574
+ }
4575
+ });
4241
4576
  Object.defineProperty(exports, "TailwindcssPatcher", {
4242
4577
  enumerable: true,
4243
4578
  get: function() {
@@ -4298,6 +4633,60 @@ Object.defineProperty(exports, "createTailwindV4CompiledSourceEntries", {
4298
4633
  return createTailwindV4CompiledSourceEntries;
4299
4634
  }
4300
4635
  });
4636
+ Object.defineProperty(exports, "createTailwindV4DefaultIgnoreSources", {
4637
+ enumerable: true,
4638
+ get: function() {
4639
+ return createTailwindV4DefaultIgnoreSources;
4640
+ }
4641
+ });
4642
+ Object.defineProperty(exports, "createTailwindV4RootSources", {
4643
+ enumerable: true,
4644
+ get: function() {
4645
+ return createTailwindV4RootSources;
4646
+ }
4647
+ });
4648
+ Object.defineProperty(exports, "createTailwindV4SourceEntryMatcher", {
4649
+ enumerable: true,
4650
+ get: function() {
4651
+ return createTailwindV4SourceEntryMatcher;
4652
+ }
4653
+ });
4654
+ Object.defineProperty(exports, "createTailwindV4SourceExclusionMatcher", {
4655
+ enumerable: true,
4656
+ get: function() {
4657
+ return createTailwindV4SourceExclusionMatcher;
4658
+ }
4659
+ });
4660
+ Object.defineProperty(exports, "escapeCssClassName", {
4661
+ enumerable: true,
4662
+ get: function() {
4663
+ return escapeCssClassName;
4664
+ }
4665
+ });
4666
+ Object.defineProperty(exports, "expandTailwindV4SourceEntries", {
4667
+ enumerable: true,
4668
+ get: function() {
4669
+ return expandTailwindV4SourceEntries;
4670
+ }
4671
+ });
4672
+ Object.defineProperty(exports, "expandTailwindV4SourceEntryBraces", {
4673
+ enumerable: true,
4674
+ get: function() {
4675
+ return expandTailwindV4SourceEntryBraces;
4676
+ }
4677
+ });
4678
+ Object.defineProperty(exports, "extractBareArbitraryValueSourceCandidates", {
4679
+ enumerable: true,
4680
+ get: function() {
4681
+ return extractBareArbitraryValueSourceCandidates;
4682
+ }
4683
+ });
4684
+ Object.defineProperty(exports, "extractBareArbitraryValueSourceCandidatesWithPositions", {
4685
+ enumerable: true,
4686
+ get: function() {
4687
+ return extractBareArbitraryValueSourceCandidatesWithPositions;
4688
+ }
4689
+ });
4301
4690
  Object.defineProperty(exports, "extractProjectCandidatesWithPositions", {
4302
4691
  enumerable: true,
4303
4692
  get: function() {
@@ -4352,6 +4741,24 @@ Object.defineProperty(exports, "groupTokensByFile", {
4352
4741
  return groupTokensByFile;
4353
4742
  }
4354
4743
  });
4744
+ Object.defineProperty(exports, "isBareArbitraryValuesEnabled", {
4745
+ enumerable: true,
4746
+ get: function() {
4747
+ return isBareArbitraryValuesEnabled;
4748
+ }
4749
+ });
4750
+ Object.defineProperty(exports, "isFileExcludedByTailwindV4SourceEntries", {
4751
+ enumerable: true,
4752
+ get: function() {
4753
+ return isFileExcludedByTailwindV4SourceEntries;
4754
+ }
4755
+ });
4756
+ Object.defineProperty(exports, "isFileMatchedByTailwindV4SourceEntries", {
4757
+ enumerable: true,
4758
+ get: function() {
4759
+ return isFileMatchedByTailwindV4SourceEntries;
4760
+ }
4761
+ });
4355
4762
  Object.defineProperty(exports, "loadPatchOptionsForWorkspace", {
4356
4763
  enumerable: true,
4357
4764
  get: function() {
@@ -4382,6 +4789,12 @@ Object.defineProperty(exports, "logger", {
4382
4789
  return logger;
4383
4790
  }
4384
4791
  });
4792
+ Object.defineProperty(exports, "mergeTailwindV4SourceEntries", {
4793
+ enumerable: true,
4794
+ get: function() {
4795
+ return mergeTailwindV4SourceEntries;
4796
+ }
4797
+ });
4385
4798
  Object.defineProperty(exports, "migrateConfigFiles", {
4386
4799
  enumerable: true,
4387
4800
  get: function() {
@@ -4394,18 +4807,54 @@ Object.defineProperty(exports, "normalizeOptions", {
4394
4807
  return normalizeOptions;
4395
4808
  }
4396
4809
  });
4810
+ Object.defineProperty(exports, "normalizeTailwindV4ScannerSources", {
4811
+ enumerable: true,
4812
+ get: function() {
4813
+ return normalizeTailwindV4ScannerSources;
4814
+ }
4815
+ });
4816
+ Object.defineProperty(exports, "normalizeTailwindV4SourceEntries", {
4817
+ enumerable: true,
4818
+ get: function() {
4819
+ return normalizeTailwindV4SourceEntries;
4820
+ }
4821
+ });
4397
4822
  Object.defineProperty(exports, "replaceBareArbitraryValueSelectors", {
4398
4823
  enumerable: true,
4399
4824
  get: function() {
4400
4825
  return replaceBareArbitraryValueSelectors;
4401
4826
  }
4402
4827
  });
4828
+ Object.defineProperty(exports, "resolveBareArbitraryValueCandidate", {
4829
+ enumerable: true,
4830
+ get: function() {
4831
+ return resolveBareArbitraryValueCandidate;
4832
+ }
4833
+ });
4403
4834
  Object.defineProperty(exports, "resolveProjectSourceFiles", {
4404
4835
  enumerable: true,
4405
4836
  get: function() {
4406
4837
  return resolveProjectSourceFiles;
4407
4838
  }
4408
4839
  });
4840
+ Object.defineProperty(exports, "resolveSourceScanPath", {
4841
+ enumerable: true,
4842
+ get: function() {
4843
+ return resolveSourceScanPath;
4844
+ }
4845
+ });
4846
+ Object.defineProperty(exports, "resolveTailwindV4SourceBaseCandidates", {
4847
+ enumerable: true,
4848
+ get: function() {
4849
+ return resolveTailwindV4SourceBaseCandidates;
4850
+ }
4851
+ });
4852
+ Object.defineProperty(exports, "resolveTailwindV4SourceEntry", {
4853
+ enumerable: true,
4854
+ get: function() {
4855
+ return resolveTailwindV4SourceEntry;
4856
+ }
4857
+ });
4409
4858
  Object.defineProperty(exports, "resolveValidTailwindV4Candidates", {
4410
4859
  enumerable: true,
4411
4860
  get: function() {