rebuildjs 0.68.6 → 0.69.0
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 +2 -2
- package/server/build/index.js +124 -125
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"./package.json": "./package.json"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"ctx-core": "^7.0
|
|
57
|
+
"ctx-core": "^7.1.0",
|
|
58
58
|
"elysia": "^1.0.10",
|
|
59
59
|
"esbuild": "^0.20.2",
|
|
60
60
|
"fdir": "^6.1.1",
|
package/server/build/index.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
/// <reference types="./index.d.ts" />
|
|
3
3
|
import { file_exists_, file_exists__waitfor } from 'ctx-core/fs'
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
calling,
|
|
6
6
|
Cancel,
|
|
7
7
|
cancel__period_,
|
|
8
8
|
memo_,
|
|
9
|
+
ns_id_be,
|
|
9
10
|
ns_id_be_memo_pair_,
|
|
10
11
|
ns_id_be_sig_triple_,
|
|
11
12
|
nullish__none_,
|
|
@@ -403,135 +404,133 @@ export function rebuildjs_plugin_() {
|
|
|
403
404
|
*/
|
|
404
405
|
function rebuildjs_plugin__postprocess$_() {
|
|
405
406
|
return (
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
if (!await file_exists_(esbuild_cssBundle_map_path)) {
|
|
468
|
-
await file_exists__waitfor(async ()=>{
|
|
469
|
-
await cmd(
|
|
470
|
-
cp(
|
|
471
|
-
cssBundle_map_path,
|
|
472
|
-
esbuild_cssBundle_map_path))
|
|
473
|
-
return true
|
|
474
|
-
})
|
|
475
|
-
}
|
|
407
|
+
ns_id_be(
|
|
408
|
+
app_ctx,
|
|
409
|
+
'app',
|
|
410
|
+
'rebuildjs__assets__link$',
|
|
411
|
+
ctx=>calling(memo_(()=>{
|
|
412
|
+
if (!persist__metafile__ready_(ctx)) return
|
|
413
|
+
nullish__none_([
|
|
414
|
+
build_id_(ctx),
|
|
415
|
+
metafile__build_id_(ctx),
|
|
416
|
+
server__metafile_(ctx),
|
|
417
|
+
browser__metafile_(ctx),
|
|
418
|
+
cwd_(ctx),
|
|
419
|
+
browser_path_(ctx),
|
|
420
|
+
server__relative_path_(ctx),
|
|
421
|
+
], (
|
|
422
|
+
build_id,
|
|
423
|
+
metafile__build_id,
|
|
424
|
+
server__metafile,
|
|
425
|
+
browser__metafile,
|
|
426
|
+
cwd,
|
|
427
|
+
browser_path,
|
|
428
|
+
server__relative_path,
|
|
429
|
+
)=>{
|
|
430
|
+
if (build_id === metafile__build_id) {
|
|
431
|
+
run(async ()=>{
|
|
432
|
+
try {
|
|
433
|
+
await esbuild_cssBundle__cp()
|
|
434
|
+
await Promise.all(
|
|
435
|
+
rebuildjs__ready__add__ready$__a1_(ctx).map(ready$_=>
|
|
436
|
+
cmd(rmemo__wait(
|
|
437
|
+
ready$_(ctx),
|
|
438
|
+
ready=>ready,
|
|
439
|
+
30_000))))
|
|
440
|
+
await rebuildjs__assets__link()
|
|
441
|
+
rebuildjs__build_id__set(ctx, build_id)
|
|
442
|
+
} catch (err) {
|
|
443
|
+
if (err instanceof Cancel) return
|
|
444
|
+
throw err
|
|
445
|
+
}
|
|
446
|
+
}).catch(err=>console.error(err))
|
|
447
|
+
}
|
|
448
|
+
async function esbuild_cssBundle__cp() {
|
|
449
|
+
for (const metafile of [server__metafile, browser__metafile]) {
|
|
450
|
+
for (let output__relative_path in metafile.outputs) {
|
|
451
|
+
let cssBundle, esbuild_cssBundle
|
|
452
|
+
switch (extname(output__relative_path)) {
|
|
453
|
+
case '.js':
|
|
454
|
+
case '.mjs':
|
|
455
|
+
({ cssBundle, esbuild_cssBundle } = metafile.outputs[output__relative_path])
|
|
456
|
+
if (cssBundle && esbuild_cssBundle) {
|
|
457
|
+
const cssBundle_path = join(cwd_(ctx), cssBundle)
|
|
458
|
+
const cssBundle_map_path = cssBundle_path + '.map'
|
|
459
|
+
const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
|
|
460
|
+
const esbuild_cssBundle_map_path = esbuild_cssBundle_path + '.map'
|
|
461
|
+
if (!await file_exists_(esbuild_cssBundle_path)) {
|
|
462
|
+
await file_exists__waitfor(async ()=>{
|
|
463
|
+
await cmd(
|
|
464
|
+
cp(cssBundle_path, esbuild_cssBundle_path))
|
|
465
|
+
return true
|
|
466
|
+
})
|
|
476
467
|
}
|
|
477
|
-
|
|
468
|
+
if (!await file_exists_(esbuild_cssBundle_map_path)) {
|
|
469
|
+
await file_exists__waitfor(async ()=>{
|
|
470
|
+
await cmd(
|
|
471
|
+
cp(
|
|
472
|
+
cssBundle_map_path,
|
|
473
|
+
esbuild_cssBundle_map_path))
|
|
474
|
+
return true
|
|
475
|
+
})
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
)
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
await cmd(Promise.all(promise_a1))
|
|
506
|
-
}
|
|
507
|
-
async function cmd(promise) {
|
|
508
|
-
if (cancel_()) promise__cancel__throw(promise)
|
|
509
|
-
promise.rebuildjs_cancel$ = run(memo_(rebuildjs_cancel$=>{
|
|
510
|
-
if (cancel_()) {
|
|
511
|
-
promise__cancel(promise)
|
|
512
|
-
off(rebuildjs_cancel$)
|
|
513
|
-
}
|
|
514
|
-
return rebuildjs_cancel$
|
|
515
|
-
}))
|
|
516
|
-
const ret = await promise
|
|
517
|
-
if (cancel_()) promise__cancel__throw(promise)
|
|
518
|
-
return ret
|
|
519
|
-
}
|
|
520
|
-
function cancel_() {
|
|
521
|
-
return (
|
|
522
|
-
build_id_(ctx) !== build_id
|
|
523
|
-
|| metafile__build_id_(ctx) !== metafile__build_id
|
|
524
|
-
|| server__metafile_(ctx) !== server__metafile
|
|
525
|
-
|| browser__metafile_(ctx) !== browser__metafile
|
|
526
|
-
|| cwd_(ctx) !== cwd
|
|
527
|
-
|| browser_path_(ctx) !== browser_path
|
|
528
|
-
|| server__relative_path_(ctx) !== server__relative_path
|
|
529
|
-
)
|
|
481
|
+
}
|
|
482
|
+
async function rebuildjs__assets__link() {
|
|
483
|
+
const outputs = server__metafile.outputs ?? {}
|
|
484
|
+
const promise_a1 = []
|
|
485
|
+
for (let output__relative_path in outputs) {
|
|
486
|
+
const _basename = basename(output__relative_path)
|
|
487
|
+
if (
|
|
488
|
+
_basename.endsWith('.js')
|
|
489
|
+
|| _basename.endsWith('.mjs')
|
|
490
|
+
|| _basename.endsWith('.js.map')
|
|
491
|
+
|| _basename.endsWith('.mjs.map')
|
|
492
|
+
) continue
|
|
493
|
+
const server_asset_path = join(cwd, output__relative_path)
|
|
494
|
+
const browser_asset_path = join(
|
|
495
|
+
browser_path,
|
|
496
|
+
relative(server__relative_path, output__relative_path))
|
|
497
|
+
await file_exists__waitfor(async ()=>{
|
|
498
|
+
await cmd(
|
|
499
|
+
rm(browser_asset_path, { force: true }))
|
|
500
|
+
await cmd(
|
|
501
|
+
link(server_asset_path, browser_asset_path))
|
|
502
|
+
return true
|
|
503
|
+
}, Infinity)
|
|
504
|
+
promise_a1.push(file_exists__waitfor(browser_asset_path))
|
|
530
505
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
506
|
+
await cmd(Promise.all(promise_a1))
|
|
507
|
+
}
|
|
508
|
+
async function cmd(promise) {
|
|
509
|
+
if (cancel_()) promise__cancel__throw(promise)
|
|
510
|
+
promise.rebuildjs_cancel$ = run(memo_(rebuildjs_cancel$=>{
|
|
511
|
+
if (cancel_()) {
|
|
512
|
+
promise__cancel(promise)
|
|
513
|
+
off(rebuildjs_cancel$)
|
|
514
|
+
}
|
|
515
|
+
return rebuildjs_cancel$
|
|
516
|
+
}))
|
|
517
|
+
const ret = await promise
|
|
518
|
+
if (cancel_()) promise__cancel__throw(promise)
|
|
519
|
+
return ret
|
|
520
|
+
}
|
|
521
|
+
function cancel_() {
|
|
522
|
+
return (
|
|
523
|
+
build_id_(ctx) !== build_id
|
|
524
|
+
|| metafile__build_id_(ctx) !== metafile__build_id
|
|
525
|
+
|| server__metafile_(ctx) !== server__metafile
|
|
526
|
+
|| browser__metafile_(ctx) !== browser__metafile
|
|
527
|
+
|| cwd_(ctx) !== cwd
|
|
528
|
+
|| browser_path_(ctx) !== browser_path
|
|
529
|
+
|| server__relative_path_(ctx) !== server__relative_path
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
})
|
|
533
|
+
})))
|
|
535
534
|
)
|
|
536
535
|
}
|
|
537
536
|
}
|