@fullstacked/tailwindcss 4.3.2-patch.0 → 4.3.2-patch.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.
- package/index.ts +12 -15
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -8,16 +8,14 @@ let init: {
|
|
|
8
8
|
oxide: Promise<void>;
|
|
9
9
|
lightningcss: Promise<void>;
|
|
10
10
|
tailwindcss: string;
|
|
11
|
-
baseDirectory: string;
|
|
12
11
|
skipLightning: boolean;
|
|
13
12
|
} = null;
|
|
14
13
|
let initPromise: Promise<void> = null;
|
|
15
14
|
|
|
16
15
|
type InitializeOpts = {
|
|
17
|
-
oxide
|
|
18
|
-
tailwindcss
|
|
19
|
-
lightningcss
|
|
20
|
-
baseDirectory?: string;
|
|
16
|
+
oxide?: string;
|
|
17
|
+
tailwindcss?: string;
|
|
18
|
+
lightningcss?: string;
|
|
21
19
|
skipLightning?: boolean;
|
|
22
20
|
};
|
|
23
21
|
|
|
@@ -36,7 +34,6 @@ export function initialize(opts?: InitializeOpts) {
|
|
|
36
34
|
oxide: oxide(fs.promises.readFile(oxidePath)),
|
|
37
35
|
lightningcss: lightningcss(lightningcssPath),
|
|
38
36
|
tailwindcss: tailwindcssPath,
|
|
39
|
-
baseDirectory: opts?.baseDirectory || process.cwd(),
|
|
40
37
|
skipLightning: opts?.skipLightning
|
|
41
38
|
};
|
|
42
39
|
|
|
@@ -112,12 +109,10 @@ async function compileTailwind(
|
|
|
112
109
|
entryfile: string,
|
|
113
110
|
files: string[]
|
|
114
111
|
): Promise<string> {
|
|
115
|
-
entryfile = path.join(init.baseDirectory, entryfile);
|
|
116
|
-
|
|
117
112
|
const entry = await fs.promises.readFile(entryfile, "utf-8");
|
|
118
113
|
const contents = await Promise.all(
|
|
119
114
|
files.map((file) =>
|
|
120
|
-
fs.promises.readFile(
|
|
115
|
+
fs.promises.readFile(file, "utf-8")
|
|
121
116
|
)
|
|
122
117
|
);
|
|
123
118
|
const candidate = contents.map((content) => extract(content)).flat();
|
|
@@ -127,9 +122,9 @@ async function compileTailwind(
|
|
|
127
122
|
const result = init.skipLightning
|
|
128
123
|
? css
|
|
129
124
|
: transform({
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
filename: "input.css",
|
|
126
|
+
code: new TextEncoder().encode(css)
|
|
127
|
+
}).code;
|
|
133
128
|
|
|
134
129
|
return typeof result === "string"
|
|
135
130
|
? result
|
|
@@ -148,10 +143,12 @@ async function tailwindBuilder(params: {
|
|
|
148
143
|
return [];
|
|
149
144
|
}
|
|
150
145
|
|
|
151
|
-
const sources = params.sources
|
|
146
|
+
const sources = params.sources
|
|
147
|
+
.filter((s) => !s.endsWith(".css"));
|
|
152
148
|
await initialize(params.initializeOptions);
|
|
153
|
-
const
|
|
154
|
-
const
|
|
149
|
+
const entryfile = params.resolved.at(0).importer;
|
|
150
|
+
const css = await compileTailwind(entryfile, sources);
|
|
151
|
+
const basename = path.basename(entryfile);
|
|
155
152
|
|
|
156
153
|
return [
|
|
157
154
|
{
|