rebuildjs 0.6.0 → 0.9.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/app/index.d.ts +5 -5
- package/app/index.js +11 -12
- package/browser/index.d.ts +7 -3
- package/browser/index.js +16 -10
- package/browser/index.test.ts +0 -5
- package/build/index.d.ts +1 -0
- package/build/index.js +12 -6
- package/package.json +3 -3
- package/server/index.d.ts +6 -2
- package/server/index.js +18 -13
- package/server/index.test.ts +0 -5
package/app/index.d.ts
CHANGED
|
@@ -14,16 +14,16 @@ export const [
|
|
|
14
14
|
is_prod_,
|
|
15
15
|
is_prod__set,
|
|
16
16
|
]: be_lock_memosig_triple_T<string>
|
|
17
|
-
export const [
|
|
18
|
-
dist_path$_,
|
|
19
|
-
dist_path_,
|
|
20
|
-
dist_path__set,
|
|
21
|
-
]:be_lock_memosig_triple_T<string>
|
|
22
17
|
export const [
|
|
23
18
|
public_path$_,
|
|
24
19
|
public_path_,
|
|
25
20
|
public_path__set,
|
|
26
21
|
]:be_lock_memosig_triple_T<string>
|
|
22
|
+
export const [
|
|
23
|
+
dist_path$_,
|
|
24
|
+
dist_path_,
|
|
25
|
+
dist_path__set,
|
|
26
|
+
]:be_lock_memosig_triple_T<string>
|
|
27
27
|
export const [
|
|
28
28
|
src_path$_,
|
|
29
29
|
src_path_,
|
package/app/index.js
CHANGED
|
@@ -9,73 +9,72 @@ export const [
|
|
|
9
9
|
process.env.PORT
|
|
10
10
|
? parseInt(process.env.PORT)
|
|
11
11
|
: 3000,
|
|
12
|
-
app_ctx__be_config)
|
|
12
|
+
{ ...app_ctx__be_config, id: 'port' })
|
|
13
13
|
export const [
|
|
14
14
|
cwd$_,
|
|
15
15
|
cwd_,
|
|
16
16
|
cwd__set,
|
|
17
17
|
] = be_sig_triple_(()=>
|
|
18
18
|
resolve('.'),
|
|
19
|
-
app_ctx__be_config)
|
|
19
|
+
{ ...app_ctx__be_config, id: 'cwd' })
|
|
20
20
|
export const [
|
|
21
21
|
is_prod$_,
|
|
22
22
|
is_prod_,
|
|
23
23
|
is_prod__set,
|
|
24
24
|
] = be_lock_memosig_triple_(()=>
|
|
25
25
|
process.env.NODE_ENV === 'production',
|
|
26
|
-
app_ctx__be_config
|
|
27
|
-
)
|
|
26
|
+
{ ...app_ctx__be_config, id: 'is_prod' })
|
|
28
27
|
export const [
|
|
29
28
|
public_path$_,
|
|
30
29
|
public_path_,
|
|
31
30
|
public_path__set,
|
|
32
31
|
] = be_lock_memosig_triple_(ctx=>
|
|
33
32
|
join(cwd_(ctx), 'public'),
|
|
34
|
-
app_ctx__be_config)
|
|
33
|
+
{ ...app_ctx__be_config, id: 'public_path' })
|
|
35
34
|
export const [
|
|
36
35
|
dist_path$_,
|
|
37
36
|
dist_path_,
|
|
38
37
|
dist_path__set,
|
|
39
38
|
] = be_memosig_triple_(ctx=>
|
|
40
39
|
join(cwd_(ctx), 'dist'),
|
|
41
|
-
app_ctx__be_config)
|
|
40
|
+
{ ...app_ctx__be_config, id: 'dist_path' })
|
|
42
41
|
export const [
|
|
43
42
|
src_path$_,
|
|
44
43
|
src_path_,
|
|
45
44
|
src_path__set,
|
|
46
45
|
] = be_lock_memosig_triple_(ctx=>
|
|
47
46
|
join(cwd_(ctx), 'src'),
|
|
48
|
-
app_ctx__be_config)
|
|
47
|
+
{ ...app_ctx__be_config, id: 'src_path' })
|
|
49
48
|
export const [
|
|
50
49
|
app_path$_,
|
|
51
50
|
app_path_,
|
|
52
51
|
app_path__set,
|
|
53
52
|
] = be_lock_memosig_triple_(ctx=>
|
|
54
53
|
join(src_path_(ctx), 'app'),
|
|
55
|
-
app_ctx__be_config)
|
|
54
|
+
{ ...app_ctx__be_config, id: 'app' })
|
|
56
55
|
export const [
|
|
57
56
|
browser_relative_path$_,
|
|
58
57
|
browser_relative_path_,
|
|
59
58
|
] = be_memo_pair_(ctx=>
|
|
60
59
|
join('dist', is_prod_(ctx) ? 'browser' : 'dev-browser'),
|
|
61
|
-
app_ctx__be_config)
|
|
60
|
+
{ ...app_ctx__be_config, is: 'browser_relative_path' })
|
|
62
61
|
export const [
|
|
63
62
|
browser_path$_,
|
|
64
63
|
browser_path_,
|
|
65
64
|
browser_path__set,
|
|
66
65
|
] = be_lock_memosig_triple_(ctx=>
|
|
67
66
|
join(cwd_(ctx), browser_relative_path_(ctx)),
|
|
68
|
-
app_ctx__be_config)
|
|
67
|
+
{ ...app_ctx__be_config, id: 'browser_path' })
|
|
69
68
|
export const [
|
|
70
69
|
server_relative_path$_,
|
|
71
70
|
server_relative_path_,
|
|
72
71
|
] = be_memo_pair_(ctx=>
|
|
73
72
|
join('dist', is_prod_(ctx) ? 'server' : 'dev-server'),
|
|
74
|
-
app_ctx__be_config)
|
|
73
|
+
{ ...app_ctx__be_config, id: 'server_relative_path' })
|
|
75
74
|
export const [
|
|
76
75
|
server_path$_,
|
|
77
76
|
server_path_,
|
|
78
77
|
server_path__set,
|
|
79
78
|
] = be_lock_memosig_triple_(ctx=>
|
|
80
79
|
join(cwd_(ctx), server_relative_path_(ctx)),
|
|
81
|
-
app_ctx__be_config)
|
|
80
|
+
{ ...app_ctx__be_config, id: 'server_path' })
|
package/browser/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import type { be_memo_pair_T, be_sig_triple_T } from 'ctx-core/rmemo'
|
|
2
2
|
import type { Metafile } from 'esbuild'
|
|
3
|
+
export declare const [
|
|
4
|
+
browser__metafile_path$_,
|
|
5
|
+
browser__metafile_path_,
|
|
6
|
+
]:be_memo_pair_T<string>
|
|
3
7
|
export declare const [
|
|
4
8
|
browser__metafile$_,
|
|
5
9
|
browser__metafile_,
|
|
6
10
|
browser__metafile__set
|
|
7
|
-
]:be_sig_triple_T<Metafile|
|
|
11
|
+
]:be_sig_triple_T<Metafile|undefined>
|
|
8
12
|
export declare const [
|
|
9
13
|
browser__input_path$_,
|
|
10
14
|
browser__input_path_
|
|
11
15
|
]:be_memo_pair_T<string|undefined>
|
|
12
16
|
export declare const [
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
browser__output__relative_path$_,
|
|
18
|
+
browser__output__relative_path_
|
|
15
19
|
]:be_memo_pair_T<string|undefined>
|
|
16
20
|
export declare const [
|
|
17
21
|
browser__script$_,
|
package/browser/index.js
CHANGED
|
@@ -6,6 +6,12 @@ import { join } from 'path'
|
|
|
6
6
|
import { browser_path_, browser_relative_path_ } from '../app/index.js'
|
|
7
7
|
import { app_ctx__be_config, middleware_ctx__be_config } from '../ctx/index.js'
|
|
8
8
|
import { server__input_path_ } from '../server/index.js'
|
|
9
|
+
export const [
|
|
10
|
+
browser__metafile_path$_,
|
|
11
|
+
browser__metafile_path_,
|
|
12
|
+
] = be_memo_pair_(ctx=>
|
|
13
|
+
join(browser_path_(ctx), 'metafile.json'),
|
|
14
|
+
{ ...app_ctx__be_config, id: 'browser__metafile_path' })
|
|
9
15
|
export const [
|
|
10
16
|
browser__metafile$_,
|
|
11
17
|
browser__metafile_,
|
|
@@ -13,12 +19,12 @@ export const [
|
|
|
13
19
|
] = be_sig_triple_(()=>
|
|
14
20
|
undefined,
|
|
15
21
|
async (ctx, browser__metafile$)=>{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
browser__metafile$.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
let metafile_path
|
|
23
|
+
if (
|
|
24
|
+
!browser__metafile$.lock
|
|
25
|
+
&& await file_exists_(metafile_path = join(browser_path_(ctx), 'metafile.json'))
|
|
26
|
+
) {
|
|
27
|
+
browser__metafile$._ = JSON.parse(await readFile(metafile_path).then(buf=>buf.toString()))
|
|
22
28
|
}
|
|
23
29
|
},
|
|
24
30
|
{ ...app_ctx__be_config, id: 'browser__metafile' })
|
|
@@ -36,8 +42,8 @@ export const [
|
|
|
36
42
|
}),
|
|
37
43
|
{ ...middleware_ctx__be_config, id: 'browser__input_path' })
|
|
38
44
|
export const [
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
browser__output__relative_path$_,
|
|
46
|
+
browser__output__relative_path_
|
|
41
47
|
] = be_memo_pair_(ctx=>
|
|
42
48
|
nullish__none_([browser__metafile_(ctx), browser__input_path_(ctx)],
|
|
43
49
|
(browser__metafile, browser__input_path)=>{
|
|
@@ -48,12 +54,12 @@ export const [
|
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
}),
|
|
51
|
-
{ ...middleware_ctx__be_config, id: '
|
|
57
|
+
{ ...middleware_ctx__be_config, id: 'browser__output__relative_path' })
|
|
52
58
|
export const [
|
|
53
59
|
browser__script$_,
|
|
54
60
|
browser__script_,
|
|
55
61
|
] = be_memo_pair_(ctx=>
|
|
56
|
-
nullish__none_([
|
|
62
|
+
nullish__none_([browser__output__relative_path_(ctx), browser_relative_path_(ctx)],
|
|
57
63
|
(browser__output_path, browser_relative_path)=>
|
|
58
64
|
browser__output_path.replace(browser_relative_path, '')),
|
|
59
65
|
{ ...middleware_ctx__be_config, id: 'browser__script' })
|
package/browser/index.test.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { rmemo__wait } from 'ctx-core/all'
|
|
2
1
|
import { test } from 'uvu'
|
|
3
2
|
import { equal } from 'uvu/assert'
|
|
4
3
|
import { app_ctx } from '../ctx/index.js'
|
|
5
4
|
import { browser__metafile$_ } from './index.js'
|
|
6
5
|
test('server__metafile', async ()=>{
|
|
7
6
|
equal(browser__metafile$_(app_ctx)._, undefined)
|
|
8
|
-
const val = await rmemo__wait(
|
|
9
|
-
browser__metafile$_(app_ctx),
|
|
10
|
-
val=>val !== undefined)
|
|
11
|
-
equal(val, null)
|
|
12
7
|
})
|
|
13
8
|
test.run()
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BuildOptions, Plugin } from 'esbuild'
|
|
2
2
|
export declare function server__build(config?:Partial<BuildOptions>):Promise<void>
|
|
3
|
+
export declare function server__external_(config?:Partial<BuildOptions>):Promise<string[]>
|
|
3
4
|
export declare function browser__build(config?:Partial<BuildOptions>):Promise<void>
|
|
4
5
|
export declare function rebuildjs_plugin_():Plugin
|
package/build/index.js
CHANGED
|
@@ -27,14 +27,12 @@ export async function server__build(config = {}) {
|
|
|
27
27
|
.crawl(app_path_(app_ctx))
|
|
28
28
|
.withPromise()
|
|
29
29
|
/** @type {string[]} */
|
|
30
|
-
const entryPoints = []
|
|
30
|
+
const entryPoints = config?.entryPoints ?? []
|
|
31
31
|
for (const path of path_a) {
|
|
32
32
|
entryPoints.push(path)
|
|
33
33
|
}
|
|
34
|
-
const external = ['bun', 'node_modules/*', ...(config.external || [])]
|
|
35
34
|
const plugins = [rebuildjs_plugin_(), ...(config.plugins || [])]
|
|
36
35
|
const esbuild_config = {
|
|
37
|
-
entryPoints,
|
|
38
36
|
entryNames: '[name]-[hash]',
|
|
39
37
|
assetNames: '[name]-[hash]',
|
|
40
38
|
bundle: true,
|
|
@@ -43,12 +41,13 @@ export async function server__build(config = {}) {
|
|
|
43
41
|
minify: is_prod_(app_ctx),
|
|
44
42
|
sourcemap: 'external',
|
|
45
43
|
...config,
|
|
44
|
+
entryPoints,
|
|
46
45
|
format: 'esm',
|
|
47
46
|
platform: 'node',
|
|
48
47
|
absWorkingDir: cwd_(app_ctx),
|
|
49
48
|
metafile: true,
|
|
50
49
|
outdir: server_path_(app_ctx),
|
|
51
|
-
external,
|
|
50
|
+
external: server__external_(config),
|
|
52
51
|
plugins,
|
|
53
52
|
}
|
|
54
53
|
if (is_prod_(app_ctx)) {
|
|
@@ -59,6 +58,13 @@ export async function server__build(config = {}) {
|
|
|
59
58
|
console.log('server__build|watch')
|
|
60
59
|
}
|
|
61
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {Partial<BuildOptions>}config
|
|
63
|
+
* @returns {Promise<string[]>}
|
|
64
|
+
*/
|
|
65
|
+
export function server__external_(config) {
|
|
66
|
+
return ['bun', 'node_modules/*', ...(config.external || [])]
|
|
67
|
+
}
|
|
62
68
|
/**
|
|
63
69
|
* @param {Plugin}config
|
|
64
70
|
* @returns {Promise<void>}
|
|
@@ -73,14 +79,13 @@ export async function browser__build(config = {}) {
|
|
|
73
79
|
.crawl(app_path_(app_ctx))
|
|
74
80
|
.withPromise()
|
|
75
81
|
/** @type {string[]} */
|
|
76
|
-
const entryPoints = []
|
|
82
|
+
const entryPoints = config?.entryPoints ?? []
|
|
77
83
|
for (const path of path_a) {
|
|
78
84
|
entryPoints.push(path)
|
|
79
85
|
}
|
|
80
86
|
const plugins = [rebuildjs_plugin_(), ...(config.plugins || [])]
|
|
81
87
|
/** @type {BuildOptions} */
|
|
82
88
|
const esbuild_config = {
|
|
83
|
-
entryPoints,
|
|
84
89
|
entryNames: '[name]-[hash]',
|
|
85
90
|
assetNames: '[name]-[hash]',
|
|
86
91
|
bundle: true,
|
|
@@ -90,6 +95,7 @@ export async function browser__build(config = {}) {
|
|
|
90
95
|
minify: is_prod_(app_ctx),
|
|
91
96
|
sourcemap: 'external',
|
|
92
97
|
...config,
|
|
98
|
+
entryPoints,
|
|
93
99
|
format: 'esm',
|
|
94
100
|
platform: 'browser',
|
|
95
101
|
absWorkingDir: cwd_(app_ctx),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"./package.json": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ctx-core/fs": "^1.4.
|
|
49
|
-
"ctx-core": "^4.
|
|
48
|
+
"@ctx-core/fs": "^1.4.35",
|
|
49
|
+
"ctx-core": "^4.18.0",
|
|
50
50
|
"elysia": "^0.7.30",
|
|
51
51
|
"esbuild": "^0.19.9",
|
|
52
52
|
"fdir": "^6.1.1",
|
package/server/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { be_memo_pair_T, be_sig_triple_T } from 'ctx-core/rmemo'
|
|
2
2
|
import type { Metafile } from 'esbuild'
|
|
3
|
+
export const [
|
|
4
|
+
server__metafile_path$_,
|
|
5
|
+
server__metafile_path_,
|
|
6
|
+
] = be_memo_pair_T<string>
|
|
3
7
|
export declare const [
|
|
4
8
|
server__metafile$_,
|
|
5
9
|
server__metafile_,
|
|
@@ -11,8 +15,8 @@ export declare const [
|
|
|
11
15
|
server__input_path__set
|
|
12
16
|
]:be_sig_triple_T<string|undefined>
|
|
13
17
|
export declare const [
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
server__output__relative_path$_,
|
|
19
|
+
server__output__relative_path_
|
|
16
20
|
]:be_memo_pair_T<string|undefined>
|
|
17
21
|
export declare const [
|
|
18
22
|
server__output$_,
|
package/server/index.js
CHANGED
|
@@ -4,7 +4,13 @@ import { be_lock_memosig_triple_, be_memo_pair_, be_sig_triple_ } from 'ctx-core
|
|
|
4
4
|
import { readFile } from 'fs/promises'
|
|
5
5
|
import { join } from 'path'
|
|
6
6
|
import { cwd_, server_path_ } from '../app/index.js'
|
|
7
|
-
import { middleware_ctx__be_config } from '../ctx/index.js'
|
|
7
|
+
import { app_ctx__be_config, middleware_ctx__be_config } from '../ctx/index.js'
|
|
8
|
+
export const [
|
|
9
|
+
server__metafile_path$_,
|
|
10
|
+
server__metafile_path_,
|
|
11
|
+
] = be_memo_pair_(ctx=>
|
|
12
|
+
join(server_path_(ctx), 'metafile.json'),
|
|
13
|
+
{ ...app_ctx__be_config, id: 'server__metafile_path' })
|
|
8
14
|
export const [
|
|
9
15
|
server__metafile$_,
|
|
10
16
|
server__metafile_,
|
|
@@ -12,15 +18,14 @@ export const [
|
|
|
12
18
|
] = be_lock_memosig_triple_(()=>
|
|
13
19
|
undefined,
|
|
14
20
|
async (ctx, server__metafile$)=>{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
server__metafile$.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
let metafile_path
|
|
22
|
+
if (
|
|
23
|
+
!server__metafile$.lock
|
|
24
|
+
&& await file_exists_(metafile_path = server__metafile_path_(ctx))
|
|
25
|
+
) {
|
|
26
|
+
server__metafile$._ = JSON.parse(await readFile(metafile_path).then(buf=>buf.toString()))
|
|
21
27
|
}
|
|
22
|
-
},
|
|
23
|
-
{ ...middleware_ctx__be_config, id: 'server__metafile' })
|
|
28
|
+
}, { ...app_ctx__be_config, id: 'server__metafile' })
|
|
24
29
|
export const [
|
|
25
30
|
server__input_path$_,
|
|
26
31
|
server__input_path_,
|
|
@@ -29,8 +34,8 @@ export const [
|
|
|
29
34
|
undefined,
|
|
30
35
|
{ ...middleware_ctx__be_config, id: 'server__input_path' })
|
|
31
36
|
export const [
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
server__output__relative_path$_,
|
|
38
|
+
server__output__relative_path_
|
|
34
39
|
] = be_memo_pair_(ctx=>
|
|
35
40
|
nullish__none_(tup(server__metafile_(ctx), server__input_path_(ctx)),
|
|
36
41
|
(server__metafile, input_path)=>{
|
|
@@ -40,12 +45,12 @@ export const [
|
|
|
40
45
|
if (output.entryPoint === input_path) return output_path
|
|
41
46
|
}
|
|
42
47
|
}),
|
|
43
|
-
{ ...middleware_ctx__be_config, id: '
|
|
48
|
+
{ ...middleware_ctx__be_config, id: 'server__output__relative_path' })
|
|
44
49
|
export const [
|
|
45
50
|
server__output$_,
|
|
46
51
|
server__output_
|
|
47
52
|
] = be_memo_pair_(ctx=>
|
|
48
|
-
nullish__none_(tup(server__metafile_(ctx),
|
|
53
|
+
nullish__none_(tup(server__metafile_(ctx), server__output__relative_path_(ctx)),
|
|
49
54
|
(server__metafile, output_path)=>
|
|
50
55
|
server__metafile.outputs[output_path]),
|
|
51
56
|
{ ...middleware_ctx__be_config, id: 'server__output' })
|
package/server/index.test.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { rmemo__wait } from 'ctx-core/rmemo'
|
|
2
1
|
import { test } from 'uvu'
|
|
3
2
|
import { equal } from 'uvu/assert'
|
|
4
3
|
import { app_ctx } from '../ctx/index.js'
|
|
5
4
|
import { server__metafile$_ } from './index.js'
|
|
6
5
|
test('server__metafile', async ()=>{
|
|
7
6
|
equal(server__metafile$_(app_ctx)._, undefined)
|
|
8
|
-
const val = await rmemo__wait(
|
|
9
|
-
server__metafile$_(app_ctx),
|
|
10
|
-
val=>val !== undefined)
|
|
11
|
-
equal(val, null)
|
|
12
7
|
})
|
|
13
8
|
test.run()
|