tailwindcss-patch 9.0.0 → 9.1.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-8l464Juk.js +28 -0
- package/dist/cli.d.mts +1 -2
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +18 -22
- package/dist/cli.mjs +17 -22
- package/dist/commands/cli-runtime.d.mts +5 -10
- package/dist/commands/cli-runtime.d.ts +5 -10
- package/dist/commands/cli-runtime.js +582 -1217
- package/dist/commands/cli-runtime.mjs +570 -1216
- package/dist/dist-B1VBpHtd.js +21 -0
- package/dist/dist-BjUV1yEM.mjs +19 -0
- package/dist/index.bundle-0Fe7Jx8V.mjs +194 -0
- package/dist/index.bundle-C4Y53Ygf.js +232 -0
- package/dist/index.d.mts +133 -67
- package/dist/index.d.ts +133 -67
- package/dist/index.js +33 -57
- package/dist/index.mjs +3 -57
- package/dist/validate-4FCU-Ql3.mjs +3525 -0
- package/dist/validate-Bu_rkfQF.d.ts +686 -0
- package/dist/validate-BuhhSYBe.js +3700 -0
- package/dist/validate-CIMnzW8O.d.mts +685 -0
- package/package.json +11 -11
- package/src/api/tailwindcss-patcher.ts +33 -6
- package/src/commands/basic-handlers.ts +0 -1
- package/src/config/index.ts +1 -1
- package/src/config/workspace.ts +1 -1
- package/src/extraction/candidate-extractor.ts +14 -69
- package/src/index.bundle.ts +21 -0
- package/src/index.ts +16 -0
- package/src/options/legacy.ts +2 -2
- package/src/options/normalize.ts +10 -5
- package/src/runtime/collector.ts +7 -7
- package/src/runtime/process-tailwindcss.ts +33 -17
- package/src/v4/candidates.ts +224 -0
- package/src/v4/engine.ts +70 -0
- package/src/v4/index.ts +25 -0
- package/src/v4/node-adapter.ts +149 -0
- package/src/v4/source.ts +193 -0
- package/src/v4/types.ts +57 -0
- package/dist/chunk-4RRHMRLJ.js +0 -4378
- package/dist/chunk-AOSPLINO.mjs +0 -4378
- package/dist/chunk-OSH52QWA.mjs +0 -10
- package/dist/chunk-QQXAOMUH.js +0 -25
- package/dist/chunk-YYBY7EM5.mjs +0 -21
- package/dist/chunk-ZPLR2UEW.js +0 -7
- package/dist/dist-22YCNIJW.js +0 -269
- package/dist/dist-7W73GIRD.mjs +0 -269
- package/dist/validate-nbmOI2w8.d.mts +0 -677
- package/dist/validate-nbmOI2w8.d.ts +0 -677
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
let node_process = require("node:process");
|
|
3
|
+
node_process = require_chunk.__toESM(node_process, 1);
|
|
4
|
+
let defu = require("defu");
|
|
5
|
+
(0, defu.createDefu)((obj, key, value) => {
|
|
6
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
7
|
+
obj[key] = value;
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
[
|
|
12
|
+
"ease-out",
|
|
13
|
+
"ease-linear",
|
|
14
|
+
"ease-in",
|
|
15
|
+
"ease-in-out"
|
|
16
|
+
].reduce((acc, cur) => {
|
|
17
|
+
acc[cur] = true;
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.defu = defu.defu;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:process";
|
|
2
|
+
import { createDefu, defu } from "defu";
|
|
3
|
+
createDefu((obj, key, value) => {
|
|
4
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
5
|
+
obj[key] = value;
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
[
|
|
10
|
+
"ease-out",
|
|
11
|
+
"ease-linear",
|
|
12
|
+
"ease-in",
|
|
13
|
+
"ease-in-out"
|
|
14
|
+
].reduce((acc, cur) => {
|
|
15
|
+
acc[cur] = true;
|
|
16
|
+
return acc;
|
|
17
|
+
}, {});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { defu };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { C as extractTailwindV4InlineSourceCandidates, D as normalizeOptions, S as loadTailwindV4DesignSystem, v as extractRawCandidatesWithPositions, w as resolveValidTailwindV4Candidates, x as compileTailwindV4Source } from "./validate-4FCU-Ql3.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import path from "pathe";
|
|
5
|
+
import { promises } from "node:fs";
|
|
6
|
+
//#region src/v4/engine.ts
|
|
7
|
+
async function collectRawCandidates(source, options) {
|
|
8
|
+
const rawCandidates = /* @__PURE__ */ new Set();
|
|
9
|
+
for (const candidate of options?.candidates ?? []) rawCandidates.add(candidate);
|
|
10
|
+
for (const candidateSource of options?.sources ?? []) {
|
|
11
|
+
const candidates = await extractRawCandidatesWithPositions(candidateSource.content, candidateSource.extension);
|
|
12
|
+
for (const candidate of candidates) rawCandidates.add(candidate.rawCandidate);
|
|
13
|
+
}
|
|
14
|
+
const inlineSources = extractTailwindV4InlineSourceCandidates(source.css);
|
|
15
|
+
for (const candidate of inlineSources.included) rawCandidates.add(candidate);
|
|
16
|
+
for (const candidate of inlineSources.excluded) rawCandidates.delete(candidate);
|
|
17
|
+
return rawCandidates;
|
|
18
|
+
}
|
|
19
|
+
function createTailwindV4Engine(source) {
|
|
20
|
+
return {
|
|
21
|
+
source,
|
|
22
|
+
loadDesignSystem() {
|
|
23
|
+
return loadTailwindV4DesignSystem(source);
|
|
24
|
+
},
|
|
25
|
+
async validateCandidates(candidates) {
|
|
26
|
+
return resolveValidTailwindV4Candidates(await loadTailwindV4DesignSystem(source), candidates);
|
|
27
|
+
},
|
|
28
|
+
async generate(options) {
|
|
29
|
+
const rawCandidates = await collectRawCandidates(source, options);
|
|
30
|
+
const classSet = resolveValidTailwindV4Candidates(await loadTailwindV4DesignSystem(source), rawCandidates);
|
|
31
|
+
const inlineSources = extractTailwindV4InlineSourceCandidates(source.css);
|
|
32
|
+
for (const candidate of inlineSources.excluded) classSet.delete(candidate);
|
|
33
|
+
const { compiled, dependencies } = await compileTailwindV4Source(source);
|
|
34
|
+
return {
|
|
35
|
+
css: compiled.build(Array.from(classSet)),
|
|
36
|
+
classSet,
|
|
37
|
+
rawCandidates,
|
|
38
|
+
dependencies: Array.from(dependencies),
|
|
39
|
+
sources: compiled.sources,
|
|
40
|
+
root: compiled.root
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/v4/source.ts
|
|
47
|
+
function resolveBase(value, fallback) {
|
|
48
|
+
return value === void 0 ? fallback : path.isAbsolute(value) ? path.resolve(value) : path.resolve(fallback, value);
|
|
49
|
+
}
|
|
50
|
+
function uniquePaths(values) {
|
|
51
|
+
const result = [];
|
|
52
|
+
for (const value of values) {
|
|
53
|
+
if (!value) continue;
|
|
54
|
+
const resolved = path.resolve(value);
|
|
55
|
+
if (!result.includes(resolved)) result.push(resolved);
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
function toCssImportPath(value) {
|
|
60
|
+
return value.replaceAll("\\", "/");
|
|
61
|
+
}
|
|
62
|
+
function quoteCssImport(value) {
|
|
63
|
+
return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
|
|
64
|
+
}
|
|
65
|
+
function isPostcssPluginSpecifier(packageName) {
|
|
66
|
+
return packageName === "@tailwindcss/postcss" || /(?:^|[/\\])@tailwindcss[/\\]postcss(?:[/\\]|$)/.test(packageName) || /(?:^|[/\\])postcss(?:[/\\]|$)/i.test(packageName) || /postcss\.config\.[cm]?[jt]s$/i.test(packageName);
|
|
67
|
+
}
|
|
68
|
+
function createDefaultCss(packageName) {
|
|
69
|
+
return `@import "${quoteCssImport(toCssImportPath(packageName && !isPostcssPluginSpecifier(packageName) ? packageName : "tailwindcss"))}";`;
|
|
70
|
+
}
|
|
71
|
+
async function pathExists(filePath) {
|
|
72
|
+
try {
|
|
73
|
+
await promises.access(filePath);
|
|
74
|
+
return true;
|
|
75
|
+
} catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function resolveCssEntries(entries, projectRoot, base) {
|
|
80
|
+
const resolvedEntries = entries.map((entry) => ({
|
|
81
|
+
original: entry,
|
|
82
|
+
absolute: path.isAbsolute(entry) ? path.resolve(entry) : path.resolve(projectRoot, entry)
|
|
83
|
+
}));
|
|
84
|
+
const resolvedBase = base ?? path.dirname(resolvedEntries[0]?.absolute ?? projectRoot);
|
|
85
|
+
const dependencies = resolvedEntries.map((entry) => entry.absolute);
|
|
86
|
+
const cssParts = [];
|
|
87
|
+
for (const entry of resolvedEntries) {
|
|
88
|
+
if (await pathExists(entry.absolute)) {
|
|
89
|
+
cssParts.push(await promises.readFile(entry.absolute, "utf8"));
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const importPath = path.isAbsolute(entry.original) ? entry.absolute : path.relative(resolvedBase, entry.absolute);
|
|
93
|
+
cssParts.push(`@import "${quoteCssImport(toCssImportPath(importPath))}";`);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
base: resolvedBase,
|
|
97
|
+
css: cssParts.join("\n"),
|
|
98
|
+
dependencies
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function normalizeResolvedSource(source) {
|
|
102
|
+
const baseFallbacks = uniquePaths([
|
|
103
|
+
...source.baseFallbacks,
|
|
104
|
+
source.projectRoot,
|
|
105
|
+
source.cwd
|
|
106
|
+
]).filter((base) => base !== source.base);
|
|
107
|
+
return {
|
|
108
|
+
projectRoot: source.projectRoot,
|
|
109
|
+
base: source.base,
|
|
110
|
+
baseFallbacks,
|
|
111
|
+
css: source.css,
|
|
112
|
+
dependencies: Array.from(new Set(source.dependencies.map((dependency) => path.resolve(dependency))))
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async function resolveTailwindV4Source(options = {}) {
|
|
116
|
+
const projectRoot = resolveBase(options.projectRoot, process.cwd());
|
|
117
|
+
const cwd = resolveBase(options.cwd, projectRoot);
|
|
118
|
+
const configuredBase = options.base === void 0 ? void 0 : resolveBase(options.base, projectRoot);
|
|
119
|
+
const baseFallbacks = uniquePaths(options.baseFallbacks?.map((base) => resolveBase(base, projectRoot)) ?? []);
|
|
120
|
+
if (options.css !== void 0) return normalizeResolvedSource({
|
|
121
|
+
projectRoot,
|
|
122
|
+
cwd,
|
|
123
|
+
base: configuredBase ?? cwd,
|
|
124
|
+
baseFallbacks,
|
|
125
|
+
css: options.css,
|
|
126
|
+
dependencies: []
|
|
127
|
+
});
|
|
128
|
+
if (options.cssEntries?.length) {
|
|
129
|
+
const entries = await resolveCssEntries(options.cssEntries, projectRoot, configuredBase);
|
|
130
|
+
return normalizeResolvedSource({
|
|
131
|
+
projectRoot,
|
|
132
|
+
cwd,
|
|
133
|
+
base: entries.base,
|
|
134
|
+
baseFallbacks,
|
|
135
|
+
css: entries.css,
|
|
136
|
+
dependencies: entries.dependencies
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return normalizeResolvedSource({
|
|
140
|
+
projectRoot,
|
|
141
|
+
cwd,
|
|
142
|
+
base: configuredBase ?? cwd,
|
|
143
|
+
baseFallbacks,
|
|
144
|
+
css: createDefaultCss(options.packageName),
|
|
145
|
+
dependencies: []
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function resolveConfigDir(config, projectRoot) {
|
|
149
|
+
if (!config) return;
|
|
150
|
+
const configPath = path.isAbsolute(config) ? config : path.resolve(projectRoot, config);
|
|
151
|
+
return path.dirname(configPath);
|
|
152
|
+
}
|
|
153
|
+
function createSourceOptionsFromNormalizedPatchOptions(options) {
|
|
154
|
+
const v4 = options.tailwind.v4;
|
|
155
|
+
const configDir = resolveConfigDir(options.tailwind.config, options.projectRoot);
|
|
156
|
+
const baseFallbacks = uniquePaths([
|
|
157
|
+
v4?.configuredBase,
|
|
158
|
+
options.tailwind.cwd,
|
|
159
|
+
options.projectRoot,
|
|
160
|
+
configDir
|
|
161
|
+
]);
|
|
162
|
+
return {
|
|
163
|
+
projectRoot: options.projectRoot,
|
|
164
|
+
...options.tailwind.cwd === void 0 ? {} : { cwd: options.tailwind.cwd },
|
|
165
|
+
...v4?.configuredBase === void 0 ? {} : { base: v4.configuredBase },
|
|
166
|
+
baseFallbacks,
|
|
167
|
+
...v4?.css === void 0 ? {} : { css: v4.css },
|
|
168
|
+
...v4?.cssEntries === void 0 ? {} : { cssEntries: v4.cssEntries },
|
|
169
|
+
packageName: options.tailwind.packageName
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function tailwindV4SourceOptionsFromPatchOptions(options) {
|
|
173
|
+
return createSourceOptionsFromNormalizedPatchOptions(normalizeOptions(options));
|
|
174
|
+
}
|
|
175
|
+
async function resolveTailwindV4SourceFromPatchOptions(options) {
|
|
176
|
+
return resolveTailwindV4Source(tailwindV4SourceOptionsFromPatchOptions(options));
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/index.bundle.ts
|
|
180
|
+
const require = createRequire(import.meta.url);
|
|
181
|
+
function loadCliModule() {
|
|
182
|
+
return require("./commands/cli-runtime.js");
|
|
183
|
+
}
|
|
184
|
+
function mountTailwindcssPatchCommands(cli, options = {}) {
|
|
185
|
+
return loadCliModule().mountTailwindcssPatchCommands(cli, options);
|
|
186
|
+
}
|
|
187
|
+
function createTailwindcssPatchCli(options = {}) {
|
|
188
|
+
return loadCliModule().createTailwindcssPatchCli(options);
|
|
189
|
+
}
|
|
190
|
+
function defineConfig(config) {
|
|
191
|
+
return config;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
export { resolveTailwindV4SourceFromPatchOptions as a, resolveTailwindV4Source as i, defineConfig as n, createTailwindV4Engine as o, mountTailwindcssPatchCommands as r, createTailwindcssPatchCli as t };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_validate = require("./validate-BuhhSYBe.js");
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
node_process = require_chunk.__toESM(node_process);
|
|
6
|
+
let pathe = require("pathe");
|
|
7
|
+
pathe = require_chunk.__toESM(pathe);
|
|
8
|
+
let node_fs = require("node:fs");
|
|
9
|
+
//#region src/v4/engine.ts
|
|
10
|
+
async function collectRawCandidates(source, options) {
|
|
11
|
+
const rawCandidates = /* @__PURE__ */ new Set();
|
|
12
|
+
for (const candidate of options?.candidates ?? []) rawCandidates.add(candidate);
|
|
13
|
+
for (const candidateSource of options?.sources ?? []) {
|
|
14
|
+
const candidates = await require_validate.extractRawCandidatesWithPositions(candidateSource.content, candidateSource.extension);
|
|
15
|
+
for (const candidate of candidates) rawCandidates.add(candidate.rawCandidate);
|
|
16
|
+
}
|
|
17
|
+
const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
|
|
18
|
+
for (const candidate of inlineSources.included) rawCandidates.add(candidate);
|
|
19
|
+
for (const candidate of inlineSources.excluded) rawCandidates.delete(candidate);
|
|
20
|
+
return rawCandidates;
|
|
21
|
+
}
|
|
22
|
+
function createTailwindV4Engine(source) {
|
|
23
|
+
return {
|
|
24
|
+
source,
|
|
25
|
+
loadDesignSystem() {
|
|
26
|
+
return require_validate.loadTailwindV4DesignSystem(source);
|
|
27
|
+
},
|
|
28
|
+
async validateCandidates(candidates) {
|
|
29
|
+
return require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), candidates);
|
|
30
|
+
},
|
|
31
|
+
async generate(options) {
|
|
32
|
+
const rawCandidates = await collectRawCandidates(source, options);
|
|
33
|
+
const classSet = require_validate.resolveValidTailwindV4Candidates(await require_validate.loadTailwindV4DesignSystem(source), rawCandidates);
|
|
34
|
+
const inlineSources = require_validate.extractTailwindV4InlineSourceCandidates(source.css);
|
|
35
|
+
for (const candidate of inlineSources.excluded) classSet.delete(candidate);
|
|
36
|
+
const { compiled, dependencies } = await require_validate.compileTailwindV4Source(source);
|
|
37
|
+
return {
|
|
38
|
+
css: compiled.build(Array.from(classSet)),
|
|
39
|
+
classSet,
|
|
40
|
+
rawCandidates,
|
|
41
|
+
dependencies: Array.from(dependencies),
|
|
42
|
+
sources: compiled.sources,
|
|
43
|
+
root: compiled.root
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/v4/source.ts
|
|
50
|
+
function resolveBase(value, fallback) {
|
|
51
|
+
return value === void 0 ? fallback : pathe.default.isAbsolute(value) ? pathe.default.resolve(value) : pathe.default.resolve(fallback, value);
|
|
52
|
+
}
|
|
53
|
+
function uniquePaths(values) {
|
|
54
|
+
const result = [];
|
|
55
|
+
for (const value of values) {
|
|
56
|
+
if (!value) continue;
|
|
57
|
+
const resolved = pathe.default.resolve(value);
|
|
58
|
+
if (!result.includes(resolved)) result.push(resolved);
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function toCssImportPath(value) {
|
|
63
|
+
return value.replaceAll("\\", "/");
|
|
64
|
+
}
|
|
65
|
+
function quoteCssImport(value) {
|
|
66
|
+
return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
|
|
67
|
+
}
|
|
68
|
+
function isPostcssPluginSpecifier(packageName) {
|
|
69
|
+
return packageName === "@tailwindcss/postcss" || /(?:^|[/\\])@tailwindcss[/\\]postcss(?:[/\\]|$)/.test(packageName) || /(?:^|[/\\])postcss(?:[/\\]|$)/i.test(packageName) || /postcss\.config\.[cm]?[jt]s$/i.test(packageName);
|
|
70
|
+
}
|
|
71
|
+
function createDefaultCss(packageName) {
|
|
72
|
+
return `@import "${quoteCssImport(toCssImportPath(packageName && !isPostcssPluginSpecifier(packageName) ? packageName : "tailwindcss"))}";`;
|
|
73
|
+
}
|
|
74
|
+
async function pathExists(filePath) {
|
|
75
|
+
try {
|
|
76
|
+
await node_fs.promises.access(filePath);
|
|
77
|
+
return true;
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function resolveCssEntries(entries, projectRoot, base) {
|
|
83
|
+
const resolvedEntries = entries.map((entry) => ({
|
|
84
|
+
original: entry,
|
|
85
|
+
absolute: pathe.default.isAbsolute(entry) ? pathe.default.resolve(entry) : pathe.default.resolve(projectRoot, entry)
|
|
86
|
+
}));
|
|
87
|
+
const resolvedBase = base ?? pathe.default.dirname(resolvedEntries[0]?.absolute ?? projectRoot);
|
|
88
|
+
const dependencies = resolvedEntries.map((entry) => entry.absolute);
|
|
89
|
+
const cssParts = [];
|
|
90
|
+
for (const entry of resolvedEntries) {
|
|
91
|
+
if (await pathExists(entry.absolute)) {
|
|
92
|
+
cssParts.push(await node_fs.promises.readFile(entry.absolute, "utf8"));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const importPath = pathe.default.isAbsolute(entry.original) ? entry.absolute : pathe.default.relative(resolvedBase, entry.absolute);
|
|
96
|
+
cssParts.push(`@import "${quoteCssImport(toCssImportPath(importPath))}";`);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
base: resolvedBase,
|
|
100
|
+
css: cssParts.join("\n"),
|
|
101
|
+
dependencies
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function normalizeResolvedSource(source) {
|
|
105
|
+
const baseFallbacks = uniquePaths([
|
|
106
|
+
...source.baseFallbacks,
|
|
107
|
+
source.projectRoot,
|
|
108
|
+
source.cwd
|
|
109
|
+
]).filter((base) => base !== source.base);
|
|
110
|
+
return {
|
|
111
|
+
projectRoot: source.projectRoot,
|
|
112
|
+
base: source.base,
|
|
113
|
+
baseFallbacks,
|
|
114
|
+
css: source.css,
|
|
115
|
+
dependencies: Array.from(new Set(source.dependencies.map((dependency) => pathe.default.resolve(dependency))))
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
async function resolveTailwindV4Source(options = {}) {
|
|
119
|
+
const projectRoot = resolveBase(options.projectRoot, node_process.default.cwd());
|
|
120
|
+
const cwd = resolveBase(options.cwd, projectRoot);
|
|
121
|
+
const configuredBase = options.base === void 0 ? void 0 : resolveBase(options.base, projectRoot);
|
|
122
|
+
const baseFallbacks = uniquePaths(options.baseFallbacks?.map((base) => resolveBase(base, projectRoot)) ?? []);
|
|
123
|
+
if (options.css !== void 0) return normalizeResolvedSource({
|
|
124
|
+
projectRoot,
|
|
125
|
+
cwd,
|
|
126
|
+
base: configuredBase ?? cwd,
|
|
127
|
+
baseFallbacks,
|
|
128
|
+
css: options.css,
|
|
129
|
+
dependencies: []
|
|
130
|
+
});
|
|
131
|
+
if (options.cssEntries?.length) {
|
|
132
|
+
const entries = await resolveCssEntries(options.cssEntries, projectRoot, configuredBase);
|
|
133
|
+
return normalizeResolvedSource({
|
|
134
|
+
projectRoot,
|
|
135
|
+
cwd,
|
|
136
|
+
base: entries.base,
|
|
137
|
+
baseFallbacks,
|
|
138
|
+
css: entries.css,
|
|
139
|
+
dependencies: entries.dependencies
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return normalizeResolvedSource({
|
|
143
|
+
projectRoot,
|
|
144
|
+
cwd,
|
|
145
|
+
base: configuredBase ?? cwd,
|
|
146
|
+
baseFallbacks,
|
|
147
|
+
css: createDefaultCss(options.packageName),
|
|
148
|
+
dependencies: []
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function resolveConfigDir(config, projectRoot) {
|
|
152
|
+
if (!config) return;
|
|
153
|
+
const configPath = pathe.default.isAbsolute(config) ? config : pathe.default.resolve(projectRoot, config);
|
|
154
|
+
return pathe.default.dirname(configPath);
|
|
155
|
+
}
|
|
156
|
+
function createSourceOptionsFromNormalizedPatchOptions(options) {
|
|
157
|
+
const v4 = options.tailwind.v4;
|
|
158
|
+
const configDir = resolveConfigDir(options.tailwind.config, options.projectRoot);
|
|
159
|
+
const baseFallbacks = uniquePaths([
|
|
160
|
+
v4?.configuredBase,
|
|
161
|
+
options.tailwind.cwd,
|
|
162
|
+
options.projectRoot,
|
|
163
|
+
configDir
|
|
164
|
+
]);
|
|
165
|
+
return {
|
|
166
|
+
projectRoot: options.projectRoot,
|
|
167
|
+
...options.tailwind.cwd === void 0 ? {} : { cwd: options.tailwind.cwd },
|
|
168
|
+
...v4?.configuredBase === void 0 ? {} : { base: v4.configuredBase },
|
|
169
|
+
baseFallbacks,
|
|
170
|
+
...v4?.css === void 0 ? {} : { css: v4.css },
|
|
171
|
+
...v4?.cssEntries === void 0 ? {} : { cssEntries: v4.cssEntries },
|
|
172
|
+
packageName: options.tailwind.packageName
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function tailwindV4SourceOptionsFromPatchOptions(options) {
|
|
176
|
+
return createSourceOptionsFromNormalizedPatchOptions(require_validate.normalizeOptions(options));
|
|
177
|
+
}
|
|
178
|
+
async function resolveTailwindV4SourceFromPatchOptions(options) {
|
|
179
|
+
return resolveTailwindV4Source(tailwindV4SourceOptionsFromPatchOptions(options));
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/index.bundle.ts
|
|
183
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
184
|
+
function loadCliModule() {
|
|
185
|
+
return require$1("./commands/cli-runtime.js");
|
|
186
|
+
}
|
|
187
|
+
function mountTailwindcssPatchCommands(cli, options = {}) {
|
|
188
|
+
return loadCliModule().mountTailwindcssPatchCommands(cli, options);
|
|
189
|
+
}
|
|
190
|
+
function createTailwindcssPatchCli(options = {}) {
|
|
191
|
+
return loadCliModule().createTailwindcssPatchCli(options);
|
|
192
|
+
}
|
|
193
|
+
function defineConfig(config) {
|
|
194
|
+
return config;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
Object.defineProperty(exports, "createTailwindV4Engine", {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function() {
|
|
200
|
+
return createTailwindV4Engine;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, "createTailwindcssPatchCli", {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function() {
|
|
206
|
+
return createTailwindcssPatchCli;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(exports, "defineConfig", {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function() {
|
|
212
|
+
return defineConfig;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
Object.defineProperty(exports, "mountTailwindcssPatchCommands", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function() {
|
|
218
|
+
return mountTailwindcssPatchCommands;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
Object.defineProperty(exports, "resolveTailwindV4Source", {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function() {
|
|
224
|
+
return resolveTailwindV4Source;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, "resolveTailwindV4SourceFromPatchOptions", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function() {
|
|
230
|
+
return resolveTailwindV4SourceFromPatchOptions;
|
|
231
|
+
}
|
|
232
|
+
});
|