rebuildjs 0.32.0 → 0.34.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/browser/index.js +44 -43
- package/build/index.js +51 -50
- package/package.json +4 -4
- package/server/index.js +43 -42
- package/server/index.test.ts +12 -3
package/browser/index.js
CHANGED
|
@@ -19,51 +19,52 @@ export const [
|
|
|
19
19
|
] = /** @type {be_lock_memosig_triple_T<rebuildjs_metafile_T>} */
|
|
20
20
|
be_lock_memosig_triple_(
|
|
21
21
|
()=>undefined,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
} catch (err) {
|
|
47
|
-
if (err instanceof Cancel) return
|
|
48
|
-
throw err
|
|
22
|
+
{ ns: 'app', id: 'browser__metafile' }
|
|
23
|
+
).add(async (ctx, browser__metafile$)=>{
|
|
24
|
+
browser__metafile__waitfor_promise?.cancel?.()
|
|
25
|
+
if (browser__metafile$.lock) return
|
|
26
|
+
nullish__none_([browser__metafile_path_(ctx)],
|
|
27
|
+
async browser__metafile_path=>{
|
|
28
|
+
try {
|
|
29
|
+
if (await cmd(
|
|
30
|
+
browser__metafile__waitfor_promise =
|
|
31
|
+
file_exists__waitfor(
|
|
32
|
+
browser__metafile_path,
|
|
33
|
+
1000,
|
|
34
|
+
()=>cmd(sleep(0))))
|
|
35
|
+
) {
|
|
36
|
+
browser__metafile$._ = await cmd(
|
|
37
|
+
waitfor(async ()=>{
|
|
38
|
+
const buf = await cmd(readFile(browser__metafile_path))
|
|
39
|
+
const json = buf + ''
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(json)
|
|
42
|
+
} catch {
|
|
43
|
+
return undefined
|
|
44
|
+
}
|
|
45
|
+
}, 1000))
|
|
49
46
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
browser__metafile$.lock
|
|
62
|
-
|| browser__metafile_path !== browser__metafile_path_(ctx)
|
|
63
|
-
)
|
|
47
|
+
} catch (err) {
|
|
48
|
+
if (err instanceof Cancel) return
|
|
49
|
+
throw err
|
|
50
|
+
}
|
|
51
|
+
async function cmd(promise) {
|
|
52
|
+
if (cancel_()) throw new Cancel()
|
|
53
|
+
const rv = await promise
|
|
54
|
+
if (cancel_()) {
|
|
55
|
+
promise.cancel?.()
|
|
56
|
+
throw new Cancel()
|
|
64
57
|
}
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
return rv
|
|
59
|
+
}
|
|
60
|
+
function cancel_() {
|
|
61
|
+
return (
|
|
62
|
+
browser__metafile$.lock
|
|
63
|
+
|| browser__metafile_path !== browser__metafile_path_(ctx)
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
67
68
|
export function browser__metafile__persist() {
|
|
68
69
|
return nullish__none_([
|
|
69
70
|
browser__metafile_path_(app_ctx),
|
package/build/index.js
CHANGED
|
@@ -53,58 +53,59 @@ export function build_id__refresh() {
|
|
|
53
53
|
export const [
|
|
54
54
|
persist__metafile__build_id$_,
|
|
55
55
|
persist__metafile__build_id_,
|
|
56
|
-
] = be_memo_pair_(
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
88
|
-
}
|
|
89
|
-
async function cmd(promise) {
|
|
90
|
-
if (cancel_()) throw new Cancel
|
|
91
|
-
const rv = await promise
|
|
92
|
-
if (cancel_()) {
|
|
93
|
-
promise.cancel?.()
|
|
94
|
-
throw new Cancel
|
|
56
|
+
] = be_memo_pair_(
|
|
57
|
+
()=>undefined,
|
|
58
|
+
{ id: 'persist__metafile__build_id', ns: 'app' }
|
|
59
|
+
).add((ctx, persist__metafile__build_id$)=>{
|
|
60
|
+
const build_id = build_id_(ctx)
|
|
61
|
+
const metafile__build_id = metafile__build_id_(ctx)
|
|
62
|
+
const server__metafile_path = server__metafile_path_(ctx)
|
|
63
|
+
const browser__metafile_path = browser__metafile_path_(ctx)
|
|
64
|
+
if (metafile__build_id) {
|
|
65
|
+
const cancel__period = cancel__period_(0, cancel_)
|
|
66
|
+
run(async ()=>{
|
|
67
|
+
try {
|
|
68
|
+
await cmd(
|
|
69
|
+
file_exists__waitfor(server__metafile_path, 1000, cancel__period))
|
|
70
|
+
await cmd(
|
|
71
|
+
waitfor(()=>
|
|
72
|
+
readFile(server__metafile_path).then(buf=>
|
|
73
|
+
JSON.parse('' + buf)?.build_id === build_id),
|
|
74
|
+
1000,
|
|
75
|
+
cancel__period))
|
|
76
|
+
await cmd(
|
|
77
|
+
file_exists__waitfor(browser__metafile_path, 1000, cancel__period))
|
|
78
|
+
await cmd(
|
|
79
|
+
waitfor(()=>
|
|
80
|
+
readFile(browser__metafile_path).then(buf=>
|
|
81
|
+
JSON.parse('' + buf)?.build_id === build_id),
|
|
82
|
+
1000,
|
|
83
|
+
cancel__period))
|
|
84
|
+
persist__metafile__build_id$._ = build_id
|
|
85
|
+
} catch (err) {
|
|
86
|
+
if (err instanceof Cancel) return
|
|
87
|
+
throw err
|
|
95
88
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
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
|
|
105
97
|
}
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
return rv
|
|
99
|
+
}
|
|
100
|
+
function cancel_() {
|
|
101
|
+
return (
|
|
102
|
+
build_id_(ctx) !== build_id
|
|
103
|
+
|| metafile__build_id_(ctx) !== metafile__build_id
|
|
104
|
+
|| server__metafile_path_(ctx) !== server__metafile_path
|
|
105
|
+
|| browser__metafile_path_(ctx) !== browser__metafile_path
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
})
|
|
108
109
|
export const [
|
|
109
110
|
persist__metafile__ready$_,
|
|
110
111
|
persist__metafile__ready_,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.2",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"./package.json": "./package.json"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"ctx-core": "^5.
|
|
56
|
+
"ctx-core": "^5.16.1",
|
|
57
57
|
"elysia": "^0.8.8",
|
|
58
58
|
"esbuild": "^0.19.11",
|
|
59
59
|
"fdir": "^6.1.1",
|
|
60
60
|
"picomatch": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^6.18.
|
|
64
|
-
"@typescript-eslint/parser": "^6.18.
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
64
|
+
"@typescript-eslint/parser": "^6.18.1",
|
|
65
65
|
"c8": "^9.0.0",
|
|
66
66
|
"check-dts": "^0.7.2",
|
|
67
67
|
"eslint": "^8.56.0",
|
package/server/index.js
CHANGED
|
@@ -27,50 +27,51 @@ export const [
|
|
|
27
27
|
] = /** @type {be_lock_memosig_triple_T<rebuildjs_metafile_T>} */
|
|
28
28
|
be_lock_memosig_triple_(
|
|
29
29
|
()=>undefined,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
} catch (err) {
|
|
55
|
-
if (err instanceof Cancel) return
|
|
56
|
-
throw err
|
|
30
|
+
{ ns: 'app', id: 'server__metafile' }
|
|
31
|
+
).add(async (ctx, server__metafile$)=>{
|
|
32
|
+
server__metafile__waitfor_promise?.cancel?.()
|
|
33
|
+
if (server__metafile$.lock) return
|
|
34
|
+
nullish__none_([server__metafile_path_(ctx)],
|
|
35
|
+
async server__metafile_path=>{
|
|
36
|
+
try {
|
|
37
|
+
if (await cmd(
|
|
38
|
+
server__metafile__waitfor_promise =
|
|
39
|
+
file_exists__waitfor(
|
|
40
|
+
server__metafile_path,
|
|
41
|
+
1000,
|
|
42
|
+
()=>cmd(sleep(0))))
|
|
43
|
+
) {
|
|
44
|
+
server__metafile$._ = await cmd(
|
|
45
|
+
waitfor(async ()=>{
|
|
46
|
+
const buf = await cmd(readFile(server__metafile_path))
|
|
47
|
+
const json = buf + ''
|
|
48
|
+
try {
|
|
49
|
+
return JSON.parse(json)
|
|
50
|
+
} catch {
|
|
51
|
+
return undefined
|
|
52
|
+
}
|
|
53
|
+
}, 1000))
|
|
57
54
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
} catch (err) {
|
|
56
|
+
if (err instanceof Cancel) return
|
|
57
|
+
throw err
|
|
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()
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
return rv
|
|
67
|
+
}
|
|
68
|
+
function cancel_() {
|
|
69
|
+
return (
|
|
70
|
+
server__metafile$.lock
|
|
71
|
+
|| server__metafile_path !== server__metafile_path_(ctx))
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
})
|
|
74
75
|
export function server__metafile__persist() {
|
|
75
76
|
return nullish__none_([
|
|
76
77
|
server__metafile_path_(app_ctx),
|
package/server/index.test.ts
CHANGED
|
@@ -103,13 +103,19 @@ test('server__metafile', async ()=>{
|
|
|
103
103
|
equal(_server__metafile$_(app_ctx)._, server__metafile0)
|
|
104
104
|
equal(_server__metafile_(app_ctx), server__metafile0)
|
|
105
105
|
dist_path__set(app_ctx, '/cwd/dist1')
|
|
106
|
-
await rmemo__wait(
|
|
106
|
+
await rmemo__wait(
|
|
107
|
+
_server__metafile$_(app_ctx),
|
|
108
|
+
m=>deep_equal(m, server__metafile1),
|
|
109
|
+
100)
|
|
107
110
|
equal(_server__metafile$_(app_ctx)._, server__metafile1)
|
|
108
111
|
equal(_server__metafile_(app_ctx), server__metafile1)
|
|
109
112
|
equal(file_exists__waitfor__path, '/cwd/dist1/server/metafile.json')
|
|
110
113
|
equal(readFile_path, '/cwd/dist1/server/metafile.json')
|
|
111
114
|
dist_path__set(app_ctx, '/cwd/dist0')
|
|
112
|
-
await rmemo__wait(
|
|
115
|
+
await rmemo__wait(
|
|
116
|
+
_server__metafile$_(app_ctx),
|
|
117
|
+
m=>deep_equal(m, server__metafile0),
|
|
118
|
+
100)
|
|
113
119
|
equal(_server__metafile$_(app_ctx)._, server__metafile0)
|
|
114
120
|
equal(_server__metafile_(app_ctx), server__metafile0)
|
|
115
121
|
equal(file_exists__waitfor__path, '/cwd/dist0/server/metafile.json')
|
|
@@ -120,7 +126,10 @@ test('server__metafile', async ()=>{
|
|
|
120
126
|
dist_path__set(app_ctx, '/cwd/dist1')
|
|
121
127
|
let error_msg:string|undefined = undefined
|
|
122
128
|
try {
|
|
123
|
-
await rmemo__wait(
|
|
129
|
+
await rmemo__wait(
|
|
130
|
+
_server__metafile$_(app_ctx),
|
|
131
|
+
m=>deep_equal(m, server__metafile1),
|
|
132
|
+
100)
|
|
124
133
|
} catch (e) {
|
|
125
134
|
error_msg = (e as Error).message
|
|
126
135
|
}
|