rebuildjs 0.70.45 → 0.70.47
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 +1 -1
- package/server/build/index.d.ts +2 -2
- package/server/build/index.js +17 -7
package/package.json
CHANGED
package/server/build/index.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const rebuildjs__ready$_:ctx__be_T<sig_T<boolean>, 'app'>
|
|
|
26
26
|
export declare const rebuildjs__ready_:ctx__get_T<boolean, 'app'>
|
|
27
27
|
export declare function rebuildjs__ready__add(ready$_:rebuildjs__ready__add__ready$__T):rebuildjs__ready__add__ready$__T[]
|
|
28
28
|
export declare function rebuildjs__ready__wait(timeout?:number):rmemo__wait_ret_T<unknown>
|
|
29
|
-
export declare function rebuildjs_browser__build(config?:rebuildjs_build_config_T):Promise<BuildContext>
|
|
30
|
-
export declare function rebuildjs_server__build(config?:rebuildjs_build_config_T):Promise<BuildContext>
|
|
29
|
+
export declare function rebuildjs_browser__build(config?:rebuildjs_build_config_T):Promise<BuildContext|undefined>
|
|
30
|
+
export declare function rebuildjs_server__build(config?:rebuildjs_build_config_T):Promise<BuildContext|undefined>
|
|
31
31
|
export declare function server__external_(config?:Partial<BuildOptions>):Promise<string[]>
|
|
32
32
|
export declare function rebuildjs_plugin_():Plugin
|
|
33
33
|
export declare function cssBundle__annotate(cssBundle:string, suffix?:string):string
|
package/server/build/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
run
|
|
19
19
|
} from 'ctx-core/rmemo'
|
|
20
20
|
import { short_uuid_ } from 'ctx-core/uuid'
|
|
21
|
-
import { context } from 'esbuild'
|
|
21
|
+
import { build, context } from 'esbuild'
|
|
22
22
|
import { fdir } from 'fdir'
|
|
23
23
|
import { cp, link, mkdir, readFile, rm } from 'node:fs/promises'
|
|
24
24
|
import { basename, dirname, extname, join, relative, resolve } from 'node:path'
|
|
@@ -276,6 +276,7 @@ export async function rebuildjs_browser__build(config) {
|
|
|
276
276
|
sourcemap: 'external',
|
|
277
277
|
loader: default_loader,
|
|
278
278
|
publicPath: '/',
|
|
279
|
+
write: true,
|
|
279
280
|
...esbuild__config,
|
|
280
281
|
entryPoints,
|
|
281
282
|
format: 'esm',
|
|
@@ -286,14 +287,18 @@ export async function rebuildjs_browser__build(config) {
|
|
|
286
287
|
external,
|
|
287
288
|
plugins,
|
|
288
289
|
}
|
|
289
|
-
const esbuild_ctx = await context(esbuild_config)
|
|
290
290
|
if (rebuildjs?.watch ?? !is_prod_(app_ctx)) {
|
|
291
|
+
const esbuild_ctx = await context(esbuild_config)
|
|
291
292
|
await esbuild_ctx.watch()
|
|
292
293
|
console.log('browser__build|watch')
|
|
294
|
+
return esbuild_ctx
|
|
293
295
|
} else {
|
|
294
|
-
await
|
|
296
|
+
const result = await build(esbuild_config)
|
|
297
|
+
if (!result.metafile) {
|
|
298
|
+
throw new Error('rebuildjs_browser__build: esbuild.build() produced no metafile')
|
|
299
|
+
}
|
|
300
|
+
return undefined
|
|
295
301
|
}
|
|
296
|
-
return esbuild_ctx
|
|
297
302
|
}
|
|
298
303
|
/**
|
|
299
304
|
* @param {rebuildjs_build_config_T}[config]
|
|
@@ -332,6 +337,7 @@ export async function rebuildjs_server__build(config) {
|
|
|
332
337
|
sourcemap: 'external',
|
|
333
338
|
loader: default_loader,
|
|
334
339
|
publicPath: '/',
|
|
340
|
+
write: true,
|
|
335
341
|
...esbuild__config,
|
|
336
342
|
entryPoints,
|
|
337
343
|
format: 'esm',
|
|
@@ -342,14 +348,18 @@ export async function rebuildjs_server__build(config) {
|
|
|
342
348
|
external,
|
|
343
349
|
plugins,
|
|
344
350
|
}
|
|
345
|
-
const esbuild_ctx = await context(esbuild_config)
|
|
346
351
|
if (rebuildjs?.watch ?? !is_prod_(app_ctx)) {
|
|
352
|
+
const esbuild_ctx = await context(esbuild_config)
|
|
347
353
|
await esbuild_ctx.watch()
|
|
348
354
|
console.log('server__build|watch')
|
|
355
|
+
return esbuild_ctx
|
|
349
356
|
} else {
|
|
350
|
-
await
|
|
357
|
+
const result = await build(esbuild_config)
|
|
358
|
+
if (!result.metafile) {
|
|
359
|
+
throw new Error('rebuildjs_server__build: esbuild.build() produced no metafile')
|
|
360
|
+
}
|
|
361
|
+
return undefined
|
|
351
362
|
}
|
|
352
|
-
return esbuild_ctx
|
|
353
363
|
}
|
|
354
364
|
/**
|
|
355
365
|
* @param {rebuildjs_build_config_T}[config]
|