rebuildjs 0.52.9 → 0.53.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 +88 -87
- package/server/build/index.d.ts +11 -1
- package/server/build/index.js +67 -59
package/package.json
CHANGED
|
@@ -1,89 +1,90 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
2
|
+
"name": "rebuildjs",
|
|
3
|
+
"version": "0.53.0",
|
|
4
|
+
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"reactive",
|
|
7
|
+
"multi page apps",
|
|
8
|
+
"web app",
|
|
9
|
+
"web server",
|
|
10
|
+
"esbuild",
|
|
11
|
+
"rmemo",
|
|
12
|
+
"ctx-core"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/rebuildjs/rebuildjs#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/rebuildjs/rebuildjs/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/rebuildjs/rebuildjs.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"author": "Brian Takita",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"files": [
|
|
26
|
+
"*.d.ts",
|
|
27
|
+
"*.js",
|
|
28
|
+
"*.json",
|
|
29
|
+
"_fixtures",
|
|
30
|
+
"any",
|
|
31
|
+
"browser",
|
|
32
|
+
"types",
|
|
33
|
+
"server"
|
|
34
|
+
],
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./index.d.ts",
|
|
38
|
+
"default": "./index.js"
|
|
39
|
+
},
|
|
40
|
+
"./any": {
|
|
41
|
+
"types": "./any/index.d.ts",
|
|
42
|
+
"default": "./any/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./browser": {
|
|
45
|
+
"types": "./browser/index.d.ts",
|
|
46
|
+
"default": "./browser/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./types": {
|
|
49
|
+
"types": "./types/index.d.ts"
|
|
50
|
+
},
|
|
51
|
+
"./server": {
|
|
52
|
+
"types": "./server/index.d.ts",
|
|
53
|
+
"default": "./server/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./package.json": "./package.json"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": ":",
|
|
59
|
+
"clean": ":",
|
|
60
|
+
"exec": "$@",
|
|
61
|
+
"prepublishOnly": "pnpm clean && pnpm build && pnpm test",
|
|
62
|
+
"test": "pnpm test:unit && pnpm test:types",
|
|
63
|
+
"test:types": "check-dts",
|
|
64
|
+
"test:unit": "NODE_OPTIONS=--loader=esmock tsx node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'",
|
|
65
|
+
"test:unit:coverage": "c8 pnpm test:unit"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"ctx-core": "^5.37.0",
|
|
69
|
+
"elysia": "^0.8.15",
|
|
70
|
+
"esbuild": "^0.20.0",
|
|
71
|
+
"fdir": "^6.1.1",
|
|
72
|
+
"picomatch": "^3.0.1"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
76
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
77
|
+
"c8": "^9.1.0",
|
|
78
|
+
"check-dts": "^0.7.2",
|
|
79
|
+
"eslint": "^8.56.0",
|
|
80
|
+
"esmock": "^2.6.3",
|
|
81
|
+
"tsx": "^4.7.0",
|
|
82
|
+
"typescript": "next",
|
|
83
|
+
"uvu": "^0.5.6"
|
|
84
|
+
},
|
|
85
|
+
"publishConfig": {
|
|
86
|
+
"access": "public",
|
|
87
|
+
"cache": "~/.npm"
|
|
88
|
+
},
|
|
89
|
+
"sideEffects": false
|
|
89
90
|
}
|
package/server/build/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ctx__be_T, ctx__get_T, ctx__set_T, rmemo__wait_ret_T, sig_T } from 'ctx-core/rmemo'
|
|
1
|
+
import type { ctx__be_T, ctx__get_T, ctx__set_T, nullish, rmemo__wait_ret_T, sig_T } from 'ctx-core/rmemo'
|
|
2
2
|
import type { BuildContext, BuildOptions, Plugin } from 'esbuild'
|
|
3
|
+
import type { rebuildjs_metafile_T } from '../metafile_l0/index.js'
|
|
3
4
|
export declare const build_id$_:ctx__be_T<sig_T<string|undefined>, 'app'>
|
|
4
5
|
export declare const build_id_:ctx__get_T<string|undefined, 'app'>
|
|
5
6
|
export declare const build_id__set:ctx__set_T<string|undefined, 'app'>
|
|
@@ -18,6 +19,15 @@ export declare function rebuildjs_browser__build(config?:rebuildjs_build_config_
|
|
|
18
19
|
export declare function rebuildjs_server__build(config?:rebuildjs_build_config_T):Promise<BuildContext>
|
|
19
20
|
export declare function server__external_(config?:Partial<BuildOptions>):Promise<string[]>
|
|
20
21
|
export declare function rebuildjs_plugin_():Plugin
|
|
22
|
+
export declare function cssBundle__annotate(cssBundle:string, suffix?:string):string
|
|
23
|
+
export declare function server__metafile__update(
|
|
24
|
+
server__metafile:rebuildjs_metafile_T|nullish,
|
|
25
|
+
server__metafile_partial?:Partial<rebuildjs_metafile_T>
|
|
26
|
+
):Promise<rebuildjs_metafile_T>
|
|
27
|
+
export declare function browser__metafile__update(
|
|
28
|
+
browser__metafile:rebuildjs_metafile_T|nullish,
|
|
29
|
+
browser__metafile_partial?:Partial<rebuildjs_metafile_T>
|
|
30
|
+
):Promise<rebuildjs_metafile_T>
|
|
21
31
|
export type rebuildjs_build_config_T =
|
|
22
32
|
Partial<BuildOptions>&{ rebuildjs?:rebuildjs_plugin_config_T }
|
|
23
33
|
export type rebuildjs_plugin_config_T = {
|
package/server/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="../metafile_l0/index.d.ts" />
|
|
2
|
-
import { file_exists__waitfor } from 'ctx-core/fs'
|
|
2
|
+
import { file_exists_, file_exists__waitfor } from 'ctx-core/fs'
|
|
3
3
|
/// <reference types="./index.d.ts" />
|
|
4
4
|
import {
|
|
5
5
|
be,
|
|
@@ -316,15 +316,15 @@ export function rebuildjs_plugin_() {
|
|
|
316
316
|
const resolve_outdir = resolve(outdir)
|
|
317
317
|
if (resolve_outdir === server_path_(app_ctx)) {
|
|
318
318
|
const build_id = build_id__refresh()
|
|
319
|
-
await server__metafile__update(metafile, build_id)
|
|
319
|
+
await server__metafile__update(metafile, { build_id })
|
|
320
320
|
if (build_id_(app_ctx) === build_id) {
|
|
321
|
-
await browser__metafile__update(browser__metafile_(app_ctx), build_id)
|
|
321
|
+
await browser__metafile__update(browser__metafile_(app_ctx), { build_id })
|
|
322
322
|
}
|
|
323
323
|
} else if (resolve_outdir === browser_path_(app_ctx)) {
|
|
324
324
|
const build_id = build_id__refresh()
|
|
325
|
-
await browser__metafile__update(metafile, build_id)
|
|
325
|
+
await browser__metafile__update(metafile, { build_id })
|
|
326
326
|
if (build_id_(app_ctx) === build_id) {
|
|
327
|
-
await server__metafile__update(server__metafile_(app_ctx), build_id)
|
|
327
|
+
await server__metafile__update(server__metafile_(app_ctx), { build_id })
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
@@ -386,18 +386,22 @@ export function rebuildjs_plugin_() {
|
|
|
386
386
|
if (cssBundle && esbuild_cssBundle) {
|
|
387
387
|
const cssBundle_path = join(cwd_(ctx), cssBundle)
|
|
388
388
|
const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
|
|
389
|
-
|
|
390
|
-
await
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
389
|
+
if (!await file_exists_(esbuild_cssBundle_path)) {
|
|
390
|
+
await file_exists__waitfor(async ()=>{
|
|
391
|
+
await cmd(
|
|
392
|
+
cp(cssBundle_path, esbuild_cssBundle_path))
|
|
393
|
+
return true
|
|
394
|
+
})
|
|
395
|
+
}
|
|
396
|
+
if (!await file_exists_(esbuild_cssBundle_path + '.map')) {
|
|
397
|
+
await file_exists__waitfor(async ()=>{
|
|
398
|
+
await cmd(
|
|
399
|
+
cp(
|
|
400
|
+
cssBundle_path + '.map',
|
|
401
|
+
esbuild_cssBundle_path + '.map'))
|
|
402
|
+
return true
|
|
403
|
+
})
|
|
404
|
+
}
|
|
401
405
|
}
|
|
402
406
|
}
|
|
403
407
|
}
|
|
@@ -457,55 +461,59 @@ export function rebuildjs_plugin_() {
|
|
|
457
461
|
}
|
|
458
462
|
}
|
|
459
463
|
}
|
|
460
|
-
async function server__metafile__update(server__metafile,
|
|
461
|
-
if (
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
464
|
+
export async function server__metafile__update(server__metafile, server__metafile_partial) {
|
|
465
|
+
if (server__metafile) {
|
|
466
|
+
server__metafile = {
|
|
467
|
+
...server__metafile,
|
|
468
|
+
...server__metafile_partial,
|
|
469
|
+
rebuildjs_target: 'server'
|
|
470
|
+
}
|
|
471
|
+
server__metafile__set(app_ctx, server__metafile)
|
|
472
|
+
for (const [
|
|
473
|
+
server__output__relative_path,
|
|
474
|
+
middleware_ctx
|
|
475
|
+
] of server__output__relative_path_M_middleware_ctx_(app_ctx).entries()) {
|
|
476
|
+
const server__output = server__output_(middleware_ctx)
|
|
477
|
+
const { cssBundle } = server__output
|
|
478
|
+
if (cssBundle) {
|
|
479
|
+
server__output.esbuild_cssBundle ??= cssBundle__annotate(cssBundle, '_esbuild')
|
|
480
|
+
server__output.cssBundle_content = [
|
|
481
|
+
server__output__relative_path,
|
|
482
|
+
...(
|
|
483
|
+
browser__output__relative_path_(middleware_ctx)
|
|
484
|
+
? [browser__output__relative_path_(middleware_ctx)]
|
|
485
|
+
: [])
|
|
486
|
+
]
|
|
487
|
+
}
|
|
483
488
|
}
|
|
489
|
+
await server__metafile__persist()
|
|
484
490
|
}
|
|
485
|
-
|
|
491
|
+
return server__metafile
|
|
486
492
|
}
|
|
487
|
-
async function browser__metafile__update(browser__metafile,
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
493
|
+
export async function browser__metafile__update(browser__metafile, browser__metafile_partial) {
|
|
494
|
+
if (browser__metafile) {
|
|
495
|
+
browser__metafile = {
|
|
496
|
+
...browser__metafile,
|
|
497
|
+
...browser__metafile_partial,
|
|
498
|
+
rebuildjs_target: 'browser'
|
|
499
|
+
}
|
|
500
|
+
browser__metafile__set(app_ctx, browser__metafile)
|
|
501
|
+
for (const middleware_ctx of server__output__relative_path_M_middleware_ctx_(app_ctx)?.values?.() ?? []) {
|
|
502
|
+
const browser__output = browser__output_(middleware_ctx)
|
|
503
|
+
if (browser__output) {
|
|
504
|
+
const { cssBundle } = browser__output
|
|
505
|
+
if (cssBundle) {
|
|
506
|
+
browser__output.esbuild_cssBundle ??= cssBundle__annotate(cssBundle, '_esbuild')
|
|
507
|
+
browser__output.cssBundle_content = [browser__output__relative_path_(middleware_ctx)]
|
|
508
|
+
}
|
|
502
509
|
}
|
|
503
510
|
}
|
|
511
|
+
await browser__metafile__persist()
|
|
504
512
|
}
|
|
505
|
-
|
|
513
|
+
return browser__metafile
|
|
506
514
|
}
|
|
507
|
-
function
|
|
515
|
+
export function cssBundle__annotate(cssBundle, suffix) {
|
|
508
516
|
return join(
|
|
509
517
|
dirname(cssBundle),
|
|
510
|
-
basename(cssBundle, '.css') + '
|
|
518
|
+
basename(cssBundle, '.css') + (suffix ?? '') + '.css')
|
|
511
519
|
}
|