rebuildjs 0.1.2 → 0.2.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.js +18 -18
- package/browser/index.js +20 -20
- package/build/index.d.ts +2 -1
- package/build/index.js +6 -4
- package/ctx/index.js +0 -1
- package/package.json +1 -1
package/app/index.js
CHANGED
|
@@ -6,17 +6,17 @@ export const [
|
|
|
6
6
|
port_,
|
|
7
7
|
port__set,
|
|
8
8
|
] = be_sig_triple_(()=>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
process.env.PORT
|
|
10
|
+
? parseInt(process.env.PORT)
|
|
11
|
+
: 3000,
|
|
12
|
+
app_ctx__be_config)
|
|
13
13
|
export const [
|
|
14
14
|
cwd$_,
|
|
15
15
|
cwd_,
|
|
16
16
|
cwd__set,
|
|
17
17
|
] = be_sig_triple_(()=>
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
resolve('.'),
|
|
19
|
+
app_ctx__be_config)
|
|
20
20
|
export const [
|
|
21
21
|
is_prod$_,
|
|
22
22
|
is_prod_,
|
|
@@ -30,40 +30,40 @@ export const [
|
|
|
30
30
|
dist_path_,
|
|
31
31
|
dist_path__set,
|
|
32
32
|
] = be_memosig_triple_(ctx=>
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
join(cwd_(ctx), 'dist'),
|
|
34
|
+
app_ctx__be_config)
|
|
35
35
|
export const [
|
|
36
36
|
public_path$_,
|
|
37
37
|
public_path_,
|
|
38
38
|
public_path__set,
|
|
39
39
|
] = be_memosig_triple_(ctx=>
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
join(cwd_(ctx), 'public'),
|
|
41
|
+
app_ctx__be_config)
|
|
42
42
|
export const [
|
|
43
43
|
src_path$_,
|
|
44
44
|
src_path_,
|
|
45
45
|
src_path__set,
|
|
46
46
|
] = be_memosig_triple_(ctx=>
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
join(cwd_(ctx), 'src'),
|
|
48
|
+
app_ctx__be_config)
|
|
49
49
|
export const [
|
|
50
50
|
app_path$_,
|
|
51
51
|
app_path_,
|
|
52
52
|
app_path__set,
|
|
53
53
|
] = be_memosig_triple_(ctx=>
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
join(src_path_(ctx), 'app'),
|
|
55
|
+
app_ctx__be_config)
|
|
56
56
|
export const [
|
|
57
57
|
browser_path$_,
|
|
58
58
|
browser_path_,
|
|
59
59
|
browser_path__set,
|
|
60
60
|
] = be_memosig_triple_(ctx=>
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
join(dist_path_(ctx), is_prod_(ctx) ? 'browser' : 'dev-browser'),
|
|
62
|
+
app_ctx__be_config)
|
|
63
63
|
export const [
|
|
64
64
|
server_path$_,
|
|
65
65
|
server_path_,
|
|
66
66
|
server_path__set,
|
|
67
67
|
] = be_memosig_triple_(ctx=>
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
join(dist_path_(ctx), is_prod_(ctx) ? 'server' : 'dev-server'),
|
|
69
|
+
app_ctx__be_config)
|
package/browser/index.js
CHANGED
|
@@ -8,39 +8,39 @@ export const [
|
|
|
8
8
|
browser__metafile__set
|
|
9
9
|
] = be_sig_triple_(()=>
|
|
10
10
|
undefined,
|
|
11
|
-
|
|
11
|
+
{ ...app_ctx__be_config, id: 'browser__metafile' })
|
|
12
12
|
export const [
|
|
13
13
|
browser__input_path$_,
|
|
14
14
|
browser__input_path_
|
|
15
15
|
] = be_memo_pair_(ctx=>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
nullish__none_(tup(browser__metafile_(ctx), server__input_path_(ctx)),
|
|
17
|
+
(browser__metafile, server__input_path)=>{
|
|
18
|
+
const browser__input_path =
|
|
19
19
|
server__input_path.replace(
|
|
20
20
|
/\.server\.(ts|js|tsx|jsx)/,
|
|
21
21
|
'.browser.$1')
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return browser__metafile.inputs[browser__input_path] && browser__input_path
|
|
23
|
+
}),
|
|
24
|
+
{ ...middleware_ctx__be_config, id: 'browser__input_path' })
|
|
25
25
|
export const [
|
|
26
26
|
browser__output_path$_,
|
|
27
27
|
browser__output_path_
|
|
28
28
|
] = be_memo_pair_(ctx=>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
29
|
+
nullish__none_([browser__metafile_(ctx), browser__input_path_(ctx)],
|
|
30
|
+
(browser__metafile, browser__input_path)=>{
|
|
31
|
+
const { outputs } = browser__metafile
|
|
32
|
+
for (const output_path in outputs) {
|
|
33
|
+
if (outputs[output_path].entryPoint === browser__input_path) {
|
|
34
|
+
return output_path
|
|
36
35
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
{ ...middleware_ctx__be_config, id: 'browser__output_path' })
|
|
39
39
|
export const [
|
|
40
40
|
browser__script$_,
|
|
41
41
|
browser__script_,
|
|
42
42
|
] = be_memo_pair_(ctx=>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
nullish__none_([browser__output_path_(ctx)],
|
|
44
|
+
browser__output_path=>
|
|
45
|
+
browser__output_path.replace('dist/dev-browser', '')),
|
|
46
|
+
{ ...middleware_ctx__be_config, id: 'browser__script' })
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { BuildOptions } from 'esbuild'
|
|
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 cssBundle_to_browser_():Plugin
|
package/build/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { build, context } from 'esbuild'
|
|
|
4
4
|
import { fdir } from 'fdir'
|
|
5
5
|
import { link, mkdir, rm } from 'fs/promises'
|
|
6
6
|
import { dirname, join, resolve } from 'path'
|
|
7
|
-
import { app_path_, browser_path_, is_prod_, public_path_, server_path_ } from '../app/index.js'
|
|
7
|
+
import { app_path_, browser_path_, cwd_, is_prod_, public_path_, server_path_ } from '../app/index.js'
|
|
8
8
|
import { browser__metafile__set } from '../browser/index.js'
|
|
9
9
|
import { app_ctx, middleware_ctx_ } from '../ctx/index.js'
|
|
10
10
|
import {
|
|
@@ -31,7 +31,7 @@ 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 = [cssBundle_to_browser_(), ...(config.plugins || [])]
|
|
35
35
|
const esbuild_config = {
|
|
36
36
|
entryPoints,
|
|
37
37
|
entryNames: '[name]-[hash]',
|
|
@@ -45,6 +45,7 @@ export async function server__build(config = {}) {
|
|
|
45
45
|
...config,
|
|
46
46
|
format: 'esm',
|
|
47
47
|
platform: 'node',
|
|
48
|
+
absWorkingDir: cwd_(app_ctx),
|
|
48
49
|
metafile: true,
|
|
49
50
|
outdir: server_path_(app_ctx),
|
|
50
51
|
plugins,
|
|
@@ -69,7 +70,7 @@ export async function browser__build(config = {}) {
|
|
|
69
70
|
for (const path of path_a) {
|
|
70
71
|
entryPoints.push(path)
|
|
71
72
|
}
|
|
72
|
-
const plugins = [
|
|
73
|
+
const plugins = [cssBundle_to_browser_(), ...(config.plugins || [])]
|
|
73
74
|
/** @type {BuildOptions} */
|
|
74
75
|
const esbuild_config = {
|
|
75
76
|
entryPoints,
|
|
@@ -84,6 +85,7 @@ export async function browser__build(config = {}) {
|
|
|
84
85
|
...config,
|
|
85
86
|
format: 'esm',
|
|
86
87
|
platform: 'browser',
|
|
88
|
+
absWorkingDir: cwd_(app_ctx),
|
|
87
89
|
metafile: true,
|
|
88
90
|
outdir: browser_path_(app_ctx),
|
|
89
91
|
plugins,
|
|
@@ -96,7 +98,7 @@ export async function browser__build(config = {}) {
|
|
|
96
98
|
}
|
|
97
99
|
await public__cp()
|
|
98
100
|
}
|
|
99
|
-
export function
|
|
101
|
+
export function cssBundle_to_browser_() {
|
|
100
102
|
return {
|
|
101
103
|
name: 'cssBundle_to_browser',
|
|
102
104
|
setup(build) {
|
package/ctx/index.js
CHANGED