@rebuildjs/tailwindcss 0.1.11 → 0.1.15
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 +4 -4
- package/rebuild_tailwind_plugin/index.js +75 -79
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuildjs/tailwindcss",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
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
|
+
"ctx-core": "^5.16.1",
|
|
39
39
|
"esbuild": "^0.19.11",
|
|
40
40
|
"postcss": "^8.4.33",
|
|
41
|
-
"rebuildjs": "^0.
|
|
41
|
+
"rebuildjs": "^0.34.3",
|
|
42
42
|
"tailwindcss": "^3.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"c8": "^9.0.0",
|
|
46
46
|
"check-dts": "^0.7.2",
|
|
47
47
|
"esmock": "^2.6.0",
|
|
48
|
-
"relementjs": "^0.
|
|
48
|
+
"relementjs": "^0.44.1",
|
|
49
49
|
"tsx": "^4.7.0",
|
|
50
50
|
"typescript": "next",
|
|
51
51
|
"uvu": "^0.5.6"
|
|
@@ -47,88 +47,84 @@ export function rebuild_tailwind_plugin_() {
|
|
|
47
47
|
return setup
|
|
48
48
|
function tailwind__build$_() {
|
|
49
49
|
return be(app_ctx, ctx=>
|
|
50
|
-
run(memo_(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
server__output__relative_path_M_middleware_ctx
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
for (const middleware_ctx of server__output__relative_path_M_middleware_ctx.values()) {
|
|
66
|
-
await output__process(server__output_(middleware_ctx))
|
|
67
|
-
await output__process(browser__output_(middleware_ctx))
|
|
68
|
-
}
|
|
69
|
-
rebuild_tailwind_plugin__build_id__set(ctx, build_id)
|
|
70
|
-
} catch (err) {
|
|
71
|
-
if (err instanceof Cancel) return
|
|
72
|
-
throw err
|
|
50
|
+
run(memo_(()=>{
|
|
51
|
+
if (!rebuildjs__ready_(ctx)) return
|
|
52
|
+
nullish__none_(tup(
|
|
53
|
+
build_id_(ctx),
|
|
54
|
+
rebuildjs__build_id_(ctx),
|
|
55
|
+
server__output__relative_path_M_middleware_ctx_(app_ctx),
|
|
56
|
+
), async (
|
|
57
|
+
build_id,
|
|
58
|
+
rebuildjs__build_id,
|
|
59
|
+
server__output__relative_path_M_middleware_ctx,
|
|
60
|
+
)=>{
|
|
61
|
+
try {
|
|
62
|
+
for (const middleware_ctx of server__output__relative_path_M_middleware_ctx.values()) {
|
|
63
|
+
await output__process(server__output_(middleware_ctx))
|
|
64
|
+
await output__process(browser__output_(middleware_ctx))
|
|
73
65
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
66
|
+
rebuild_tailwind_plugin__build_id__set(ctx, build_id)
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (err instanceof Cancel) return
|
|
69
|
+
throw err
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @param {rebuildjs_metafile_T['outputs'][string]}output
|
|
73
|
+
* @returns {Promise<void>}
|
|
74
|
+
*/
|
|
75
|
+
async function output__process(
|
|
76
|
+
output
|
|
77
|
+
) {
|
|
78
|
+
const cssBundle = output?.cssBundle
|
|
79
|
+
if (!cssBundle) return
|
|
80
|
+
const cssBundle_path = join(cwd_(ctx), cssBundle)
|
|
81
|
+
const esbuild_cssBundle = output.esbuild_cssBundle ?? cssBundle
|
|
82
|
+
const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
|
|
83
|
+
await file_exists__waitfor(
|
|
84
|
+
esbuild_cssBundle_path,
|
|
85
|
+
1000,
|
|
86
|
+
()=>cmd(sleep(0)))
|
|
87
|
+
const esbuild_cssBundle_map_path = esbuild_cssBundle_path + '.map'
|
|
88
|
+
const esbuild_cssBundle_map_exists = await cmd(file_exists_(esbuild_cssBundle_map_path))
|
|
89
|
+
const result = await cmd(postcss([
|
|
90
|
+
tailwind({
|
|
91
|
+
content: output.cssBundle_content.map(content__relative_path=>
|
|
92
|
+
join(cwd_(ctx), content__relative_path))
|
|
93
|
+
})
|
|
94
|
+
]).process(
|
|
95
|
+
await cmd(readFile(esbuild_cssBundle_path)),
|
|
96
|
+
{
|
|
97
|
+
from: esbuild_cssBundle_path,
|
|
98
|
+
to: cssBundle_path,
|
|
99
|
+
map: esbuild_cssBundle_map_exists
|
|
100
|
+
? {
|
|
101
|
+
prev: JSON.parse(await cmd(readFile(esbuild_cssBundle_path + '.map')))
|
|
102
|
+
}
|
|
103
|
+
: false,
|
|
104
|
+
}))
|
|
105
|
+
await cmd(writeFile(cssBundle_path, result.css))
|
|
106
|
+
if (result.map) {
|
|
107
|
+
await cmd(writeFile(cssBundle_path + '.map', JSON.stringify(result.map)))
|
|
112
108
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return rv
|
|
109
|
+
}
|
|
110
|
+
async function cmd(promise) {
|
|
111
|
+
if (cancel_()) throw new Cancel()
|
|
112
|
+
const rv = await promise
|
|
113
|
+
if (cancel_()) {
|
|
114
|
+
promise.cancel?.()
|
|
115
|
+
throw new Cancel()
|
|
121
116
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
return rv
|
|
118
|
+
}
|
|
119
|
+
function cancel_() {
|
|
120
|
+
return (
|
|
121
|
+
build_id_(ctx) !== build_id
|
|
122
|
+
|| rebuildjs__build_id_(ctx) !== rebuildjs__build_id
|
|
123
|
+
|| server__output__relative_path_M_middleware_ctx_(
|
|
124
|
+
ctx) !== server__output__relative_path_M_middleware_ctx
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
})
|
|
132
128
|
})), { id: 'tailwind__build$', ns: 'app' })
|
|
133
129
|
}
|
|
134
130
|
}
|