@rebuildjs/tailwindcss 0.6.3 → 0.7.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuildjs/tailwindcss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Tailwindcss integration with rebuildjs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwindcss",
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"ctx-core": "^5.38.
|
|
38
|
+
"ctx-core": "^5.38.1",
|
|
39
39
|
"esbuild": "^0.20.0",
|
|
40
40
|
"postcss": "^8.4.33",
|
|
41
|
-
"rebuildjs": "^0.55.
|
|
41
|
+
"rebuildjs": "^0.55.1",
|
|
42
42
|
"tailwindcss": "^3.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"c8": "^9.1.0",
|
|
46
46
|
"check-dts": "^0.7.2",
|
|
47
47
|
"esmock": "^2.6.3",
|
|
48
|
-
"relementjs": "^0.64.
|
|
48
|
+
"relementjs": "^0.64.1",
|
|
49
49
|
"tsx": "^4.7.0",
|
|
50
50
|
"typescript": "next",
|
|
51
51
|
"uvu": "^0.5.6"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Plugin } from 'esbuild'
|
|
2
|
+
import type { AcceptedPlugin } from 'postcss'
|
|
2
3
|
import type { ctx__be_T, ctx__get_T, ctx__set_T, sig_T } from 'rebuildjs/server'
|
|
3
4
|
import type { Config } from 'tailwindcss'
|
|
4
5
|
export declare const rebuild_tailwind_plugin__build_id$_:ctx__be_T<sig_T<string|undefined>, 'app'>
|
|
@@ -7,4 +8,8 @@ export declare const rebuild_tailwind_plugin__build_id__set:ctx__set_T<string|un
|
|
|
7
8
|
export declare const rebuildjs_tailwind__ready$_:ctx__be_T<sig_T<boolean>, 'app'>
|
|
8
9
|
export declare const rebuildjs_tailwind__ready_:ctx__get_T<boolean, 'app'>
|
|
9
10
|
export declare function rebuildjs_tailwind__ready__wait(timeout?:number):Promise<boolean>
|
|
10
|
-
export declare function rebuild_tailwind_plugin_(config?:
|
|
11
|
+
export declare function rebuild_tailwind_plugin_(config?:rebuild_tailwind_plugin__config_T):Plugin
|
|
12
|
+
export type rebuild_tailwind_plugin__config_T = {
|
|
13
|
+
postcss_plugin_a1_?:(tailwindcss_plugin:Plugin)=>AcceptedPlugin[]
|
|
14
|
+
tailwindcss_config?:Config
|
|
15
|
+
}
|
|
@@ -57,6 +57,11 @@ export function rebuildjs_tailwind__ready__wait(timeout) {
|
|
|
57
57
|
ready=>ready,
|
|
58
58
|
timeout ?? 10_000)
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* @param {rebuild_tailwind_plugin__config_T}[config]
|
|
62
|
+
* @returns {{name: string, setup: setup}}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
60
65
|
export function rebuild_tailwind_plugin_(config) {
|
|
61
66
|
return { name: 'rebuild_tailwind_plugin', setup: setup_() }
|
|
62
67
|
function setup_() {
|
|
@@ -151,26 +156,29 @@ export function rebuild_tailwind_plugin_(config) {
|
|
|
151
156
|
metafile.outputs[annotated_cssBundle] = metafile.outputs[cssBundle]
|
|
152
157
|
}
|
|
153
158
|
const annotated_cssBundle_path = join(cwd_(app_ctx), annotated_cssBundle)
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
159
|
+
const tailwind_instance = tailwind({
|
|
160
|
+
...config,
|
|
161
|
+
content: [
|
|
162
|
+
...output.cssBundle_content.map(content__relative_path=>
|
|
163
|
+
join(cwd_(app_ctx), content__relative_path)),
|
|
164
|
+
...(config?.content ?? [])
|
|
165
|
+
]
|
|
166
|
+
})
|
|
167
|
+
const result = await cmd(
|
|
168
|
+
postcss(
|
|
169
|
+
config?.postcss_plugin_a1_?.(tailwind_instance)
|
|
170
|
+
?? [tailwind_instance]
|
|
171
|
+
).process(
|
|
172
|
+
await cmd(readFile(esbuild_cssBundle_path)),
|
|
173
|
+
{
|
|
174
|
+
from: esbuild_cssBundle_path,
|
|
175
|
+
to: join(cwd_(app_ctx), cssBundle),
|
|
176
|
+
map: esbuild_cssBundle_map_exists
|
|
177
|
+
? {
|
|
178
|
+
prev: JSON.parse(await cmd(readFile(esbuild_cssBundle_path + '.map')))
|
|
179
|
+
}
|
|
180
|
+
: false,
|
|
181
|
+
}))
|
|
174
182
|
await cmd(writeFile(annotated_cssBundle_path, result.css))
|
|
175
183
|
if (result.map) {
|
|
176
184
|
const map_json = JSON.stringify(result.map)
|