rebuildjs 0.2.0 → 0.3.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/app/index.js +7 -2
- package/build/index.d.ts +1 -1
- package/build/index.js +5 -5
- package/package.json +2 -2
- package/server/index.js +23 -23
package/app/index.js
CHANGED
|
@@ -29,8 +29,13 @@ export const [
|
|
|
29
29
|
dist_path$_,
|
|
30
30
|
dist_path_,
|
|
31
31
|
dist_path__set,
|
|
32
|
-
] =
|
|
33
|
-
|
|
32
|
+
] = be_sig_triple_((ctx, dist_path$)=>
|
|
33
|
+
dist_path$.custom
|
|
34
|
+
? dist_path$._
|
|
35
|
+
: join(cwd_(ctx), 'dist'),
|
|
36
|
+
async dist_path$=>{
|
|
37
|
+
if (dist_path$._ != join(cwd_(ctx), 'dist')) dist_path$.custom = 1
|
|
38
|
+
},
|
|
34
39
|
app_ctx__be_config)
|
|
35
40
|
export const [
|
|
36
41
|
public_path$_,
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { BuildOptions, Plugin } from 'esbuild'
|
|
2
2
|
export declare function server__build(config?:Partial<BuildOptions>):Promise<void>
|
|
3
3
|
export declare function browser__build(config?:Partial<BuildOptions>):Promise<void>
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function rebuildjs_plugin_():Plugin
|
package/build/index.js
CHANGED
|
@@ -31,13 +31,12 @@ export async function server__build(config = {}) {
|
|
|
31
31
|
entryPoints.push(path)
|
|
32
32
|
}
|
|
33
33
|
const external = ['/assets/*', 'bun', 'node_modules/*', ...(config.external || [])]
|
|
34
|
-
const plugins = [
|
|
34
|
+
const plugins = [rebuildjs_plugin_(), ...(config.plugins || [])]
|
|
35
35
|
const esbuild_config = {
|
|
36
36
|
entryPoints,
|
|
37
37
|
entryNames: '[name]-[hash]',
|
|
38
38
|
assetNames: '[name]-[hash]',
|
|
39
39
|
bundle: true,
|
|
40
|
-
external,
|
|
41
40
|
target: 'es2020',
|
|
42
41
|
treeShaking: true,
|
|
43
42
|
minify: is_prod_(app_ctx),
|
|
@@ -48,6 +47,7 @@ export async function server__build(config = {}) {
|
|
|
48
47
|
absWorkingDir: cwd_(app_ctx),
|
|
49
48
|
metafile: true,
|
|
50
49
|
outdir: server_path_(app_ctx),
|
|
50
|
+
external,
|
|
51
51
|
plugins,
|
|
52
52
|
}
|
|
53
53
|
if (is_prod_(app_ctx)) {
|
|
@@ -70,7 +70,7 @@ export async function browser__build(config = {}) {
|
|
|
70
70
|
for (const path of path_a) {
|
|
71
71
|
entryPoints.push(path)
|
|
72
72
|
}
|
|
73
|
-
const plugins = [
|
|
73
|
+
const plugins = [rebuildjs_plugin_(), ...(config.plugins || [])]
|
|
74
74
|
/** @type {BuildOptions} */
|
|
75
75
|
const esbuild_config = {
|
|
76
76
|
entryPoints,
|
|
@@ -98,9 +98,9 @@ export async function browser__build(config = {}) {
|
|
|
98
98
|
}
|
|
99
99
|
await public__cp()
|
|
100
100
|
}
|
|
101
|
-
export function
|
|
101
|
+
export function rebuildjs_plugin_() {
|
|
102
102
|
return {
|
|
103
|
-
name: '
|
|
103
|
+
name: 'rebuildjs_plugin',
|
|
104
104
|
setup(build) {
|
|
105
105
|
build.onEnd(async result=>{
|
|
106
106
|
if (result.metafile) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rebuildjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"reactive",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"./package.json": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"ctx-core": "^4.
|
|
48
|
+
"ctx-core": "^4.15.0",
|
|
49
49
|
"elysia": "^0.7.30",
|
|
50
50
|
"fdir": "^6.1.1",
|
|
51
51
|
"picomatch": "^3.0.1"
|
package/server/index.js
CHANGED
|
@@ -9,48 +9,48 @@ export const [
|
|
|
9
9
|
server__metafile__set
|
|
10
10
|
] = be_sig_triple_(()=>
|
|
11
11
|
undefined,
|
|
12
|
-
|
|
12
|
+
{ ...middleware_ctx__be_config, id: 'server__metafile' })
|
|
13
13
|
export const [
|
|
14
14
|
server__input_path$_,
|
|
15
15
|
server__input_path_,
|
|
16
16
|
server__input_path__set
|
|
17
17
|
] = be_sig_triple_(()=>
|
|
18
18
|
undefined,
|
|
19
|
-
|
|
19
|
+
{ ...middleware_ctx__be_config, id: 'server__input_path' })
|
|
20
20
|
export const [
|
|
21
21
|
server__output_path$_,
|
|
22
22
|
server__output_path_
|
|
23
23
|
] = be_memo_pair_(ctx=>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
nullish__none_(tup(server__metafile_(ctx), server__input_path_(ctx)),
|
|
25
|
+
(server__metafile, input_path)=>{
|
|
26
|
+
const { outputs } = server__metafile
|
|
27
|
+
for (const output_path in outputs) {
|
|
28
|
+
const output = outputs[output_path]
|
|
29
|
+
if (output.entryPoint === input_path) return output_path
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
{ ...middleware_ctx__be_config, id: 'server__output_path' })
|
|
33
33
|
export const [
|
|
34
34
|
server__output$_,
|
|
35
35
|
server__output_
|
|
36
36
|
] = be_memo_pair_(ctx=>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
nullish__none_(tup(server__metafile_(ctx), server__output_path_(ctx)),
|
|
38
|
+
(server__metafile, output_path)=>
|
|
39
|
+
server__metafile.outputs[output_path]),
|
|
40
|
+
{ ...middleware_ctx__be_config, id: 'server__output' })
|
|
41
41
|
export const [
|
|
42
42
|
server__cssBundle$_,
|
|
43
43
|
server__cssBundle_
|
|
44
44
|
] = be_memo_pair_(ctx=>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
nullish__none_([server__output_(ctx)?.cssBundle],
|
|
46
|
+
cssBundle=>
|
|
47
|
+
join(cwd_(ctx), cssBundle)),
|
|
48
|
+
{ ...middleware_ctx__be_config, id: 'server__cssBundle', })
|
|
49
49
|
export const [
|
|
50
50
|
server__css$_,
|
|
51
51
|
server__css_
|
|
52
52
|
] = be_memo_pair_(ctx=>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
nullish__none_([server__cssBundle_(ctx)],
|
|
54
|
+
cssBundle=>
|
|
55
|
+
cssBundle.replace(server_path_(ctx), '')),
|
|
56
|
+
{ ...middleware_ctx__be_config, id: 'server__css' })
|