rebuildjs 0.34.4 → 0.35.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/browser/index.js +56 -45
- package/build/index.js +46 -45
- package/package.json +3 -3
- package/server/index.js +45 -42
package/browser/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { file_exists__waitfor } from 'ctx-core/fs'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
be_lock_memosig_triple_,
|
|
4
|
+
be_memo_pair_,
|
|
5
|
+
Cancel,
|
|
6
|
+
memo_,
|
|
7
|
+
nullish__none_,
|
|
8
|
+
sleep,
|
|
9
|
+
tup,
|
|
10
|
+
waitfor
|
|
11
|
+
} from 'ctx-core/rmemo'
|
|
3
12
|
import { mkdir, readFile, writeFile } from 'node:fs/promises'
|
|
4
13
|
import { join, relative } from 'path'
|
|
5
14
|
import { browser__relative_path_, browser_path_, cwd_ } from '../app/index.js'
|
|
@@ -11,7 +20,6 @@ export const [
|
|
|
11
20
|
] = be_memo_pair_(ctx=>
|
|
12
21
|
join(browser_path_(ctx), 'metafile.json'),
|
|
13
22
|
{ ns: 'app', id: 'browser__metafile_path' })
|
|
14
|
-
let browser__metafile__waitfor_promise
|
|
15
23
|
export const [
|
|
16
24
|
browser__metafile$_,
|
|
17
25
|
browser__metafile_,
|
|
@@ -20,51 +28,54 @@ export const [
|
|
|
20
28
|
be_lock_memosig_triple_(
|
|
21
29
|
()=>undefined,
|
|
22
30
|
{ ns: 'app', id: 'browser__metafile' }
|
|
23
|
-
).add(
|
|
24
|
-
browser__metafile__waitfor_promise
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
).add((ctx, browser__metafile$)=>
|
|
32
|
+
memo_(browser__metafile__waitfor_promise$=>{
|
|
33
|
+
browser__metafile__waitfor_promise$.val?.cancel?.()
|
|
34
|
+
if (browser__metafile$.lock) return
|
|
35
|
+
return nullish__none_([browser__metafile_path_(ctx)],
|
|
36
|
+
browser__metafile_path=>{
|
|
37
|
+
const browser__metafile__waitfor_promise =
|
|
38
|
+
file_exists__waitfor(
|
|
39
|
+
browser__metafile_path,
|
|
40
|
+
1000,
|
|
41
|
+
()=>cmd(sleep(0)))
|
|
42
|
+
cmd(browser__metafile__waitfor_promise)
|
|
43
|
+
.then(async success=>{
|
|
44
|
+
if (success) {
|
|
45
|
+
browser__metafile$._ = await cmd(
|
|
46
|
+
waitfor(async ()=>{
|
|
47
|
+
const buf = await cmd(readFile(browser__metafile_path))
|
|
48
|
+
const json = buf + ''
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(json)
|
|
51
|
+
} catch {
|
|
52
|
+
return undefined
|
|
53
|
+
}
|
|
54
|
+
}, 1000))
|
|
55
|
+
}
|
|
56
|
+
}).catch(err=>{
|
|
57
|
+
if (err instanceof Cancel) return
|
|
58
|
+
throw err
|
|
59
|
+
})
|
|
60
|
+
return browser__metafile__waitfor_promise
|
|
61
|
+
async function cmd(promise) {
|
|
62
|
+
if (cancel_()) throw new Cancel()
|
|
63
|
+
const rv = await promise
|
|
64
|
+
if (cancel_()) {
|
|
65
|
+
promise.cancel?.()
|
|
66
|
+
throw new Cancel()
|
|
67
|
+
}
|
|
68
|
+
return rv
|
|
46
69
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (cancel_()) throw new Cancel()
|
|
53
|
-
const rv = await promise
|
|
54
|
-
if (cancel_()) {
|
|
55
|
-
promise.cancel?.()
|
|
56
|
-
throw new Cancel()
|
|
70
|
+
function cancel_() {
|
|
71
|
+
return (
|
|
72
|
+
browser__metafile$.lock
|
|
73
|
+
|| browser__metafile_path !== browser__metafile_path_(ctx)
|
|
74
|
+
)
|
|
57
75
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
browser__metafile$.lock
|
|
63
|
-
|| browser__metafile_path !== browser__metafile_path_(ctx)
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
)
|
|
68
79
|
export function browser__metafile__persist() {
|
|
69
80
|
return nullish__none_([
|
|
70
81
|
browser__metafile_path_(app_ctx),
|
package/build/index.js
CHANGED
|
@@ -56,56 +56,57 @@ export const [
|
|
|
56
56
|
] = be_memo_pair_(
|
|
57
57
|
()=>undefined,
|
|
58
58
|
{ id: 'persist__metafile__build_id', ns: 'app' }
|
|
59
|
-
).add((ctx, persist__metafile__build_id$)=>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
59
|
+
).add((ctx, persist__metafile__build_id$)=>
|
|
60
|
+
memo_(()=>{
|
|
61
|
+
const build_id = build_id_(ctx)
|
|
62
|
+
const metafile__build_id = metafile__build_id_(ctx)
|
|
63
|
+
const server__metafile_path = server__metafile_path_(ctx)
|
|
64
|
+
const browser__metafile_path = browser__metafile_path_(ctx)
|
|
65
|
+
if (metafile__build_id) {
|
|
66
|
+
const cancel__period = cancel__period_(0, cancel_)
|
|
67
|
+
run(async ()=>{
|
|
68
|
+
try {
|
|
69
|
+
await cmd(
|
|
70
|
+
file_exists__waitfor(server__metafile_path, 1000, cancel__period))
|
|
71
|
+
await cmd(
|
|
72
|
+
waitfor(()=>
|
|
73
|
+
readFile(server__metafile_path).then(buf=>
|
|
74
|
+
JSON.parse('' + buf)?.build_id === build_id),
|
|
75
|
+
1000,
|
|
76
|
+
cancel__period))
|
|
77
|
+
await cmd(
|
|
78
|
+
file_exists__waitfor(browser__metafile_path, 1000, cancel__period))
|
|
79
|
+
await cmd(
|
|
80
|
+
waitfor(()=>
|
|
81
|
+
readFile(browser__metafile_path).then(buf=>
|
|
82
|
+
JSON.parse('' + buf)?.build_id === build_id),
|
|
83
|
+
1000,
|
|
84
|
+
cancel__period))
|
|
85
|
+
persist__metafile__build_id$._ = build_id
|
|
86
|
+
} catch (err) {
|
|
87
|
+
if (err instanceof Cancel) return
|
|
88
|
+
throw err
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
async function cmd(promise) {
|
|
93
|
+
if (cancel_()) throw new Cancel
|
|
94
|
+
const rv = await promise
|
|
95
|
+
if (cancel_()) {
|
|
96
|
+
promise.cancel?.()
|
|
97
|
+
throw new Cancel
|
|
88
98
|
}
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
async function cmd(promise) {
|
|
92
|
-
if (cancel_()) throw new Cancel
|
|
93
|
-
const rv = await promise
|
|
94
|
-
if (cancel_()) {
|
|
95
|
-
promise.cancel?.()
|
|
96
|
-
throw new Cancel
|
|
99
|
+
return rv
|
|
97
100
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
build_id_(ctx) !== build_id
|
|
101
|
+
function cancel_() {
|
|
102
|
+
return (
|
|
103
|
+
build_id_(ctx) !== build_id
|
|
103
104
|
|| metafile__build_id_(ctx) !== metafile__build_id
|
|
104
105
|
|| server__metafile_path_(ctx) !== server__metafile_path
|
|
105
106
|
|| browser__metafile_path_(ctx) !== browser__metafile_path
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
})
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
}))
|
|
109
110
|
export const [
|
|
110
111
|
persist__metafile__ready$_,
|
|
111
112
|
persist__metafile__ready_,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"./package.json": "./package.json"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"ctx-core": "^5.
|
|
57
|
-
"elysia": "^0.8.
|
|
56
|
+
"ctx-core": "^5.17.1",
|
|
57
|
+
"elysia": "^0.8.9",
|
|
58
58
|
"esbuild": "^0.19.11",
|
|
59
59
|
"fdir": "^6.1.1",
|
|
60
60
|
"picomatch": "^3.0.1"
|
package/server/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
be_memo_pair_,
|
|
5
5
|
be_sig_triple_,
|
|
6
6
|
Cancel,
|
|
7
|
+
memo_,
|
|
7
8
|
nullish__none_,
|
|
8
9
|
sleep,
|
|
9
10
|
tup,
|
|
@@ -28,50 +29,52 @@ export const [
|
|
|
28
29
|
be_lock_memosig_triple_(
|
|
29
30
|
()=>undefined,
|
|
30
31
|
{ ns: 'app', id: 'server__metafile' }
|
|
31
|
-
).add(
|
|
32
|
-
server__metafile__waitfor_promise
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
).add((ctx, server__metafile$)=>
|
|
33
|
+
memo_(server__metafile__waitfor_promise$=>{
|
|
34
|
+
server__metafile__waitfor_promise$.val?.cancel?.()
|
|
35
|
+
if (server__metafile$.lock) return
|
|
36
|
+
return nullish__none_([server__metafile_path_(ctx)],
|
|
37
|
+
server__metafile_path=>{
|
|
38
|
+
const server__metafile__waitfor_promise =
|
|
39
|
+
file_exists__waitfor(
|
|
40
|
+
server__metafile_path,
|
|
41
|
+
1000,
|
|
42
|
+
()=>cmd(sleep(0)))
|
|
43
|
+
cmd(server__metafile__waitfor_promise)
|
|
44
|
+
.then(async success=>{
|
|
45
|
+
if (success) {
|
|
46
|
+
server__metafile$._ = await cmd(
|
|
47
|
+
waitfor(async ()=>{
|
|
48
|
+
const buf = await cmd(readFile(server__metafile_path))
|
|
49
|
+
const json = buf + ''
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse(json)
|
|
52
|
+
} catch {
|
|
53
|
+
return undefined
|
|
54
|
+
}
|
|
55
|
+
}, 1000))
|
|
56
|
+
}
|
|
57
|
+
}).catch(err=>{
|
|
58
|
+
if (err instanceof Cancel) return
|
|
59
|
+
throw err
|
|
60
|
+
})
|
|
61
|
+
return server__metafile__waitfor_promise
|
|
62
|
+
async function cmd(promise) {
|
|
63
|
+
if (cancel_()) throw new Cancel()
|
|
64
|
+
const rv = await promise
|
|
65
|
+
if (cancel_()) {
|
|
66
|
+
promise.cancel?.()
|
|
67
|
+
throw new Cancel()
|
|
68
|
+
}
|
|
69
|
+
return rv
|
|
54
70
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
async function cmd(promise) {
|
|
60
|
-
if (cancel_()) throw new Cancel()
|
|
61
|
-
const rv = await promise
|
|
62
|
-
if (cancel_()) {
|
|
63
|
-
promise.cancel?.()
|
|
64
|
-
throw new Cancel()
|
|
71
|
+
function cancel_() {
|
|
72
|
+
return (
|
|
73
|
+
server__metafile$.lock
|
|
74
|
+
|| server__metafile_path !== server__metafile_path_(ctx))
|
|
65
75
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function cancel_() {
|
|
69
|
-
return (
|
|
70
|
-
server__metafile$.lock
|
|
71
|
-
|| server__metafile_path !== server__metafile_path_(ctx))
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
})
|
|
76
|
+
})
|
|
77
|
+
}))
|
|
75
78
|
export function server__metafile__persist() {
|
|
76
79
|
return nullish__none_([
|
|
77
80
|
server__metafile_path_(app_ctx),
|