tailwindcss-patch 9.3.4 → 9.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/commands/cli-runtime.js +1 -1
- package/dist/commands/cli-runtime.mjs +1 -1
- package/dist/{index.bundle-BU7uUzRH.mjs → index.bundle-BXhvZOy8.mjs} +1 -1
- package/dist/{index.bundle-BIcthh-J.js → index.bundle-Cz6ZOOFG.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{validate-DmELQoI2.js → validate-5TFH6ktk.js} +23 -2
- package/dist/{validate-BoTQvn7s.mjs → validate-SJIkeBUb.mjs} +23 -2
- package/package.json +1 -1
- package/src/extraction/candidate-extractor.ts +31 -7
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_validate = require("./validate-
|
|
3
|
-
const require_index_bundle = require("./index.bundle-
|
|
2
|
+
const require_validate = require("./validate-5TFH6ktk.js");
|
|
3
|
+
const require_index_bundle = require("./index.bundle-Cz6ZOOFG.js");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_chunk.__toESM(node_process);
|
|
6
6
|
//#region src/cli.bundle.ts
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as logger, r as ValidateCommandError } from "./validate-
|
|
2
|
-
import { t as createTailwindcssPatchCli } from "./index.bundle-
|
|
1
|
+
import { N as logger, r as ValidateCommandError } from "./validate-SJIkeBUb.mjs";
|
|
2
|
+
import { t as createTailwindcssPatchCli } from "./index.bundle-BXhvZOy8.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.bundle.ts
|
|
5
5
|
async function main() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../chunk-8l464Juk.js");
|
|
3
|
-
const require_validate = require("../validate-
|
|
3
|
+
const require_validate = require("../validate-5TFH6ktk.js");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_chunk.__toESM(node_process);
|
|
6
6
|
let fs_extra = require("fs-extra");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as loadWorkspaceConfigModule, N as logger, S as groupTokensByFile, a as tailwindcssPatchCommands, i as classifyValidateError, k as loadPatchOptionsForWorkspace, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher } from "../validate-
|
|
1
|
+
import { A as loadWorkspaceConfigModule, N as logger, S as groupTokensByFile, a as tailwindcssPatchCommands, i as classifyValidateError, k as loadPatchOptionsForWorkspace, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher } from "../validate-SJIkeBUb.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
import path from "pathe";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as compileTailwindV4Source, D as replaceBareArbitraryValueSelectors, E as extractTailwindV4InlineSourceCandidates, O as resolveValidTailwindV4Candidates, T as canonicalizeBareArbitraryValueCandidates, _ as extractRawCandidates, j as normalizeOptions, v as extractRawCandidatesWithPositions, w as loadTailwindV4DesignSystem } from "./validate-
|
|
1
|
+
import { C as compileTailwindV4Source, D as replaceBareArbitraryValueSelectors, E as extractTailwindV4InlineSourceCandidates, O as resolveValidTailwindV4Candidates, T as canonicalizeBareArbitraryValueCandidates, _ as extractRawCandidates, j as normalizeOptions, v as extractRawCandidatesWithPositions, w as loadTailwindV4DesignSystem } from "./validate-SJIkeBUb.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import path from "pathe";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_validate = require("./validate-
|
|
2
|
+
const require_validate = require("./validate-5TFH6ktk.js");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
let node_process = require("node:process");
|
|
5
5
|
node_process = require_chunk.__toESM(node_process);
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_validate = require("./validate-
|
|
3
|
-
const require_index_bundle = require("./index.bundle-
|
|
2
|
+
const require_validate = require("./validate-5TFH6ktk.js");
|
|
3
|
+
const require_index_bundle = require("./index.bundle-Cz6ZOOFG.js");
|
|
4
4
|
exports.CacheStore = require_validate.CacheStore;
|
|
5
5
|
exports.MIGRATION_REPORT_KIND = require_validate.MIGRATION_REPORT_KIND;
|
|
6
6
|
exports.MIGRATION_REPORT_SCHEMA_VERSION = require_validate.MIGRATION_REPORT_SCHEMA_VERSION;
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { M as CacheStore, N as logger, O as resolveValidTailwindV4Candidates, S as groupTokensByFile, _ as extractRawCandidates, a as tailwindcssPatchCommands, b as extractSourceCandidatesWithPositions, c as MIGRATION_REPORT_KIND, d as getPatchStatusReport, f as runTailwindBuild, g as extractProjectCandidatesWithPositions, h as collectClassesFromTailwindV4, j as normalizeOptions, l as MIGRATION_REPORT_SCHEMA_VERSION, m as collectClassesFromContexts, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, p as loadRuntimeContexts, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher, v as extractRawCandidatesWithPositions, w as loadTailwindV4DesignSystem, x as extractValidCandidates, y as extractSourceCandidates } from "./validate-
|
|
2
|
-
import { a as resolveTailwindV4SourceFromPatchOptions, i as resolveTailwindV4Source, n as defineConfig, o as createTailwindV4Engine, r as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "./index.bundle-
|
|
1
|
+
import { M as CacheStore, N as logger, O as resolveValidTailwindV4Candidates, S as groupTokensByFile, _ as extractRawCandidates, a as tailwindcssPatchCommands, b as extractSourceCandidatesWithPositions, c as MIGRATION_REPORT_KIND, d as getPatchStatusReport, f as runTailwindBuild, g as extractProjectCandidatesWithPositions, h as collectClassesFromTailwindV4, j as normalizeOptions, l as MIGRATION_REPORT_SCHEMA_VERSION, m as collectClassesFromContexts, n as VALIDATE_FAILURE_REASONS, o as migrateConfigFiles, p as loadRuntimeContexts, r as ValidateCommandError, s as restoreConfigFiles, t as VALIDATE_EXIT_CODES, u as TailwindcssPatcher, v as extractRawCandidatesWithPositions, w as loadTailwindV4DesignSystem, x as extractValidCandidates, y as extractSourceCandidates } from "./validate-SJIkeBUb.mjs";
|
|
2
|
+
import { a as resolveTailwindV4SourceFromPatchOptions, i as resolveTailwindV4Source, n as defineConfig, o as createTailwindV4Engine, r as mountTailwindcssPatchCommands, t as createTailwindcssPatchCli } from "./index.bundle-BXhvZOy8.mjs";
|
|
3
3
|
export { CacheStore, MIGRATION_REPORT_KIND, MIGRATION_REPORT_SCHEMA_VERSION, TailwindcssPatcher, VALIDATE_EXIT_CODES, VALIDATE_FAILURE_REASONS, ValidateCommandError, collectClassesFromContexts, collectClassesFromTailwindV4, createTailwindV4Engine, createTailwindcssPatchCli, defineConfig, extractProjectCandidatesWithPositions, extractRawCandidates, extractRawCandidatesWithPositions, extractSourceCandidates, extractSourceCandidatesWithPositions, extractValidCandidates, getPatchStatusReport, groupTokensByFile, loadRuntimeContexts, loadTailwindV4DesignSystem, logger, migrateConfigFiles, mountTailwindcssPatchCommands, normalizeOptions, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveValidTailwindV4Candidates, restoreConfigFiles, runTailwindBuild, tailwindcssPatchCommands };
|
|
@@ -23,7 +23,7 @@ _babel_traverse = require_chunk.__toESM(_babel_traverse);
|
|
|
23
23
|
let _babel_parser = require("@babel/parser");
|
|
24
24
|
let tailwindcss_config = require("tailwindcss-config");
|
|
25
25
|
//#region package.json
|
|
26
|
-
var version = "9.3.
|
|
26
|
+
var version = "9.3.5";
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/constants.ts
|
|
29
29
|
const pkgName = "tailwindcss-patch";
|
|
@@ -2069,6 +2069,7 @@ function getOxideModule() {
|
|
|
2069
2069
|
const HTML_ATTRIBUTE_NAME_CANDIDATE_RE = /^(?:class|className|hover-class|hoverClass)$/;
|
|
2070
2070
|
const CSS_DIRECTIVE_CANDIDATE_RE = /^@(?:apply|tailwind|source|config|plugin|theme|utility|custom-variant|variant)$/;
|
|
2071
2071
|
const CSS_APPLY_IMPORTANT = "!important";
|
|
2072
|
+
const CSS_APPLY_RE = /@apply\s+([^;{}]+)/g;
|
|
2072
2073
|
const JS_LIKE_SOURCE_EXTENSION_RE = /^(?:[cm]?[jt]sx?)$/;
|
|
2073
2074
|
const MIXED_TEMPLATE_SOURCE_EXTENSION_RE = /^(?:vue|uvue|nvue|svelte|mpx)$/;
|
|
2074
2075
|
const CSS_LIKE_SOURCE_EXTENSION_RE = /^(?:css|wxss|acss|jxss|ttss|qss|tyss|scss|sass|less|styl|stylus)$/;
|
|
@@ -2172,6 +2173,26 @@ function createLocalCandidate(candidate) {
|
|
|
2172
2173
|
end: candidate.localStart + candidate.rawCandidate.length
|
|
2173
2174
|
};
|
|
2174
2175
|
}
|
|
2176
|
+
async function extractCssApplyCandidates(content, extension) {
|
|
2177
|
+
const candidates = [];
|
|
2178
|
+
CSS_APPLY_RE.lastIndex = 0;
|
|
2179
|
+
let match = CSS_APPLY_RE.exec(content);
|
|
2180
|
+
while (match !== null) {
|
|
2181
|
+
const applyParams = match[1] ?? "";
|
|
2182
|
+
const applyParamsStart = match.index + match[0].indexOf(applyParams);
|
|
2183
|
+
const applyCandidates = await extractRawCandidatesWithPositions(applyParams, extension);
|
|
2184
|
+
candidates.push(...applyCandidates.map((candidate) => ({
|
|
2185
|
+
content: applyParams,
|
|
2186
|
+
extension: "html",
|
|
2187
|
+
localStart: candidate.start,
|
|
2188
|
+
rawCandidate: candidate.rawCandidate,
|
|
2189
|
+
start: candidate.start + applyParamsStart,
|
|
2190
|
+
end: candidate.end + applyParamsStart
|
|
2191
|
+
})));
|
|
2192
|
+
match = CSS_APPLY_RE.exec(content);
|
|
2193
|
+
}
|
|
2194
|
+
return candidates;
|
|
2195
|
+
}
|
|
2175
2196
|
async function extractMixedSourceScriptCandidates(content) {
|
|
2176
2197
|
const candidates = [];
|
|
2177
2198
|
SFC_SCRIPT_BLOCK_RE.lastIndex = 0;
|
|
@@ -2209,7 +2230,7 @@ async function extractRawCandidatesWithPositions(content, extension = "html") {
|
|
|
2209
2230
|
}
|
|
2210
2231
|
async function extractSourceCandidatesWithPositions(content, extension = "html") {
|
|
2211
2232
|
const normalizedExtension = extension.replace(/^\./, "");
|
|
2212
|
-
const candidates = (await extractRawCandidatesWithPositions(content, normalizedExtension)).map((candidate) => ({
|
|
2233
|
+
const candidates = CSS_LIKE_SOURCE_EXTENSION_RE.test(normalizedExtension) ? await extractCssApplyCandidates(content, normalizedExtension) : (await extractRawCandidatesWithPositions(content, normalizedExtension)).map((candidate) => ({
|
|
2213
2234
|
...candidate,
|
|
2214
2235
|
content,
|
|
2215
2236
|
extension: normalizedExtension,
|
|
@@ -16,7 +16,7 @@ import _babelTraverse from "@babel/traverse";
|
|
|
16
16
|
import { parse, parse as parse$1 } from "@babel/parser";
|
|
17
17
|
import { loadConfig } from "tailwindcss-config";
|
|
18
18
|
//#region package.json
|
|
19
|
-
var version = "9.3.
|
|
19
|
+
var version = "9.3.5";
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/constants.ts
|
|
22
22
|
const pkgName = "tailwindcss-patch";
|
|
@@ -2067,6 +2067,7 @@ function getOxideModule() {
|
|
|
2067
2067
|
const HTML_ATTRIBUTE_NAME_CANDIDATE_RE = /^(?:class|className|hover-class|hoverClass)$/;
|
|
2068
2068
|
const CSS_DIRECTIVE_CANDIDATE_RE = /^@(?:apply|tailwind|source|config|plugin|theme|utility|custom-variant|variant)$/;
|
|
2069
2069
|
const CSS_APPLY_IMPORTANT = "!important";
|
|
2070
|
+
const CSS_APPLY_RE = /@apply\s+([^;{}]+)/g;
|
|
2070
2071
|
const JS_LIKE_SOURCE_EXTENSION_RE = /^(?:[cm]?[jt]sx?)$/;
|
|
2071
2072
|
const MIXED_TEMPLATE_SOURCE_EXTENSION_RE = /^(?:vue|uvue|nvue|svelte|mpx)$/;
|
|
2072
2073
|
const CSS_LIKE_SOURCE_EXTENSION_RE = /^(?:css|wxss|acss|jxss|ttss|qss|tyss|scss|sass|less|styl|stylus)$/;
|
|
@@ -2170,6 +2171,26 @@ function createLocalCandidate(candidate) {
|
|
|
2170
2171
|
end: candidate.localStart + candidate.rawCandidate.length
|
|
2171
2172
|
};
|
|
2172
2173
|
}
|
|
2174
|
+
async function extractCssApplyCandidates(content, extension) {
|
|
2175
|
+
const candidates = [];
|
|
2176
|
+
CSS_APPLY_RE.lastIndex = 0;
|
|
2177
|
+
let match = CSS_APPLY_RE.exec(content);
|
|
2178
|
+
while (match !== null) {
|
|
2179
|
+
const applyParams = match[1] ?? "";
|
|
2180
|
+
const applyParamsStart = match.index + match[0].indexOf(applyParams);
|
|
2181
|
+
const applyCandidates = await extractRawCandidatesWithPositions(applyParams, extension);
|
|
2182
|
+
candidates.push(...applyCandidates.map((candidate) => ({
|
|
2183
|
+
content: applyParams,
|
|
2184
|
+
extension: "html",
|
|
2185
|
+
localStart: candidate.start,
|
|
2186
|
+
rawCandidate: candidate.rawCandidate,
|
|
2187
|
+
start: candidate.start + applyParamsStart,
|
|
2188
|
+
end: candidate.end + applyParamsStart
|
|
2189
|
+
})));
|
|
2190
|
+
match = CSS_APPLY_RE.exec(content);
|
|
2191
|
+
}
|
|
2192
|
+
return candidates;
|
|
2193
|
+
}
|
|
2173
2194
|
async function extractMixedSourceScriptCandidates(content) {
|
|
2174
2195
|
const candidates = [];
|
|
2175
2196
|
SFC_SCRIPT_BLOCK_RE.lastIndex = 0;
|
|
@@ -2207,7 +2228,7 @@ async function extractRawCandidatesWithPositions(content, extension = "html") {
|
|
|
2207
2228
|
}
|
|
2208
2229
|
async function extractSourceCandidatesWithPositions(content, extension = "html") {
|
|
2209
2230
|
const normalizedExtension = extension.replace(/^\./, "");
|
|
2210
|
-
const candidates = (await extractRawCandidatesWithPositions(content, normalizedExtension)).map((candidate) => ({
|
|
2231
|
+
const candidates = CSS_LIKE_SOURCE_EXTENSION_RE.test(normalizedExtension) ? await extractCssApplyCandidates(content, normalizedExtension) : (await extractRawCandidatesWithPositions(content, normalizedExtension)).map((candidate) => ({
|
|
2211
2232
|
...candidate,
|
|
2212
2233
|
content,
|
|
2213
2234
|
extension: normalizedExtension,
|
package/package.json
CHANGED
|
@@ -70,6 +70,7 @@ interface ExtractSourceCandidateWithContext extends ExtractSourceCandidate {
|
|
|
70
70
|
const HTML_ATTRIBUTE_NAME_CANDIDATE_RE = /^(?:class|className|hover-class|hoverClass)$/
|
|
71
71
|
const CSS_DIRECTIVE_CANDIDATE_RE = /^@(?:apply|tailwind|source|config|plugin|theme|utility|custom-variant|variant)$/
|
|
72
72
|
const CSS_APPLY_IMPORTANT = '!important'
|
|
73
|
+
const CSS_APPLY_RE = /@apply\s+([^;{}]+)/g
|
|
73
74
|
const JS_LIKE_SOURCE_EXTENSION_RE = /^(?:[cm]?[jt]sx?)$/
|
|
74
75
|
const MIXED_TEMPLATE_SOURCE_EXTENSION_RE = /^(?:vue|uvue|nvue|svelte|mpx)$/
|
|
75
76
|
const CSS_LIKE_SOURCE_EXTENSION_RE = /^(?:css|wxss|acss|jxss|ttss|qss|tyss|scss|sass|less|styl|stylus)$/
|
|
@@ -218,6 +219,27 @@ function createLocalCandidate(candidate: ExtractSourceCandidateWithContext): Ext
|
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
async function extractCssApplyCandidates(content: string, extension: string) {
|
|
223
|
+
const candidates: ExtractSourceCandidateWithContext[] = []
|
|
224
|
+
CSS_APPLY_RE.lastIndex = 0
|
|
225
|
+
let match = CSS_APPLY_RE.exec(content)
|
|
226
|
+
while (match !== null) {
|
|
227
|
+
const applyParams = match[1] ?? ''
|
|
228
|
+
const applyParamsStart = match.index + match[0].indexOf(applyParams)
|
|
229
|
+
const applyCandidates = await extractRawCandidatesWithPositions(applyParams, extension)
|
|
230
|
+
candidates.push(...applyCandidates.map(candidate => ({
|
|
231
|
+
content: applyParams,
|
|
232
|
+
extension: 'html',
|
|
233
|
+
localStart: candidate.start,
|
|
234
|
+
rawCandidate: candidate.rawCandidate,
|
|
235
|
+
start: candidate.start + applyParamsStart,
|
|
236
|
+
end: candidate.end + applyParamsStart,
|
|
237
|
+
})))
|
|
238
|
+
match = CSS_APPLY_RE.exec(content)
|
|
239
|
+
}
|
|
240
|
+
return candidates
|
|
241
|
+
}
|
|
242
|
+
|
|
221
243
|
async function extractMixedSourceScriptCandidates(content: string) {
|
|
222
244
|
const candidates: ExtractSourceCandidateWithContext[] = []
|
|
223
245
|
SFC_SCRIPT_BLOCK_RE.lastIndex = 0
|
|
@@ -269,13 +291,15 @@ export async function extractSourceCandidatesWithPositions(
|
|
|
269
291
|
extension: string = 'html',
|
|
270
292
|
): Promise<ExtractSourceCandidate[]> {
|
|
271
293
|
const normalizedExtension = extension.replace(/^\./, '')
|
|
272
|
-
const candidates: ExtractSourceCandidateWithContext[] = (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
294
|
+
const candidates: ExtractSourceCandidateWithContext[] = CSS_LIKE_SOURCE_EXTENSION_RE.test(normalizedExtension)
|
|
295
|
+
? await extractCssApplyCandidates(content, normalizedExtension)
|
|
296
|
+
: (await extractRawCandidatesWithPositions(content, normalizedExtension))
|
|
297
|
+
.map(candidate => ({
|
|
298
|
+
...candidate,
|
|
299
|
+
content,
|
|
300
|
+
extension: normalizedExtension,
|
|
301
|
+
localStart: candidate.start,
|
|
302
|
+
}))
|
|
279
303
|
if (MIXED_TEMPLATE_SOURCE_EXTENSION_RE.test(normalizedExtension)) {
|
|
280
304
|
candidates.push(...await extractMixedSourceScriptCandidates(content))
|
|
281
305
|
}
|