@rebuildjs/tailwindcss 0.1.14 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuildjs/tailwindcss",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Tailwindcss integration with rebuildjs",
5
5
  "keywords": [
6
6
  "tailwindcss",
@@ -38,7 +38,7 @@
38
38
  "ctx-core": "^5.16.1",
39
39
  "esbuild": "^0.19.11",
40
40
  "postcss": "^8.4.33",
41
- "rebuildjs": "^0.34.2",
41
+ "rebuildjs": "^0.34.3",
42
42
  "tailwindcss": "^3.4.1"
43
43
  },
44
44
  "devDependencies": {
@@ -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_(tailwind__build$=>{
51
- r()
52
- return tailwind__build$
53
- function r() {
54
- if (!rebuildjs__ready_(ctx)) return
55
- nullish__none_(tup(
56
- build_id_(ctx),
57
- rebuildjs__build_id_(ctx),
58
- server__output__relative_path_M_middleware_ctx_(app_ctx),
59
- ), async (
60
- build_id,
61
- rebuildjs__build_id,
62
- server__output__relative_path_M_middleware_ctx,
63
- )=>{
64
- try {
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
- * @param {rebuildjs_metafile_T['outputs'][string]}output
76
- * @returns {Promise<void>}
77
- */
78
- async function output__process(
79
- output
80
- ) {
81
- const cssBundle = output?.cssBundle
82
- if (!cssBundle) return
83
- const cssBundle_path = join(cwd_(ctx), cssBundle)
84
- const esbuild_cssBundle = output.esbuild_cssBundle ?? cssBundle
85
- const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
86
- await file_exists__waitfor(
87
- esbuild_cssBundle_path,
88
- 1000,
89
- ()=>cmd(sleep(0)))
90
- const esbuild_cssBundle_map_path = esbuild_cssBundle_path + '.map'
91
- const esbuild_cssBundle_map_exists = await cmd(file_exists_(esbuild_cssBundle_map_path))
92
- const result = await cmd(postcss([
93
- tailwind({
94
- content: output.cssBundle_content.map(content__relative_path=>
95
- join(cwd_(ctx), content__relative_path))
96
- })
97
- ]).process(
98
- await cmd(readFile(esbuild_cssBundle_path)),
99
- {
100
- from: esbuild_cssBundle_path,
101
- to: cssBundle_path,
102
- map: esbuild_cssBundle_map_exists
103
- ? {
104
- prev: JSON.parse(await cmd(readFile(esbuild_cssBundle_path + '.map')))
105
- }
106
- : false,
107
- }))
108
- await cmd(writeFile(cssBundle_path, result.css))
109
- if (result.map) {
110
- await cmd(writeFile(cssBundle_path + '.map', JSON.stringify(result.map)))
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
- async function cmd(promise) {
114
- if (cancel_()) throw new Cancel()
115
- const rv = await promise
116
- if (cancel_()) {
117
- promise.cancel?.()
118
- throw new Cancel()
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
- function cancel_() {
123
- return (
124
- build_id_(ctx) !== build_id
125
- || rebuildjs__build_id_(ctx) !== rebuildjs__build_id
126
- || server__output__relative_path_M_middleware_ctx_(
127
- ctx) !== server__output__relative_path_M_middleware_ctx
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
  }