rebuildjs 0.34.2 → 0.34.3
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/build/index.js +93 -97
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -292,111 +292,107 @@ export function rebuildjs_plugin_() {
|
|
|
292
292
|
function rebuildjs_plugin__postprocess$_() {
|
|
293
293
|
return (
|
|
294
294
|
be(app_ctx, ctx=>
|
|
295
|
-
run(memo_(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
} catch (err) {
|
|
323
|
-
if (err instanceof Cancel) return
|
|
324
|
-
throw err
|
|
325
|
-
}
|
|
326
|
-
rebuildjs__build_id__set(ctx, build_id)
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
async function esbuild_cssBundle__cp() {
|
|
330
|
-
for (const metafile of [server__metafile, browser__metafile]) {
|
|
331
|
-
for (let output__relative_path in metafile.outputs) {
|
|
332
|
-
let cssBundle, esbuild_cssBundle
|
|
333
|
-
switch (extname(output__relative_path)) {
|
|
334
|
-
case '.js':
|
|
335
|
-
case '.mjs':
|
|
336
|
-
({ cssBundle, esbuild_cssBundle } = metafile.outputs[output__relative_path])
|
|
337
|
-
if (cssBundle && esbuild_cssBundle) {
|
|
338
|
-
const cssBundle_path = join(cwd_(ctx), cssBundle)
|
|
339
|
-
const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
|
|
340
|
-
await cmd(
|
|
341
|
-
file_exists__waitfor(cssBundle_path))
|
|
342
|
-
await cmd(
|
|
343
|
-
cp(cssBundle_path, esbuild_cssBundle_path))
|
|
344
|
-
await cmd(
|
|
345
|
-
file_exists__waitfor(cssBundle_path + '.map'))
|
|
346
|
-
await cmd(
|
|
347
|
-
cp(cssBundle_path + '.map', esbuild_cssBundle_path + '.map'))
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
295
|
+
run(memo_(()=>{
|
|
296
|
+
if (!persist__metafile__ready_(ctx)) return
|
|
297
|
+
nullish__none_([
|
|
298
|
+
build_id_(ctx),
|
|
299
|
+
metafile__build_id_(ctx),
|
|
300
|
+
server__metafile_(ctx),
|
|
301
|
+
browser__metafile_(ctx),
|
|
302
|
+
cwd_(ctx),
|
|
303
|
+
browser_path_(ctx),
|
|
304
|
+
server__relative_path_(ctx),
|
|
305
|
+
], (
|
|
306
|
+
build_id,
|
|
307
|
+
metafile__build_id,
|
|
308
|
+
server__metafile,
|
|
309
|
+
browser__metafile,
|
|
310
|
+
cwd,
|
|
311
|
+
browser_path,
|
|
312
|
+
server__relative_path,
|
|
313
|
+
)=>{
|
|
314
|
+
if (build_id === metafile__build_id) {
|
|
315
|
+
run(async ()=>{
|
|
316
|
+
try {
|
|
317
|
+
await esbuild_cssBundle__cp()
|
|
318
|
+
await rebuildjs__assets__link()
|
|
319
|
+
} catch (err) {
|
|
320
|
+
if (err instanceof Cancel) return
|
|
321
|
+
throw err
|
|
351
322
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
323
|
+
rebuildjs__build_id__set(ctx, build_id)
|
|
324
|
+
})
|
|
325
|
+
}
|
|
326
|
+
async function esbuild_cssBundle__cp() {
|
|
327
|
+
for (const metafile of [server__metafile, browser__metafile]) {
|
|
328
|
+
for (let output__relative_path in metafile.outputs) {
|
|
329
|
+
let cssBundle, esbuild_cssBundle
|
|
356
330
|
switch (extname(output__relative_path)) {
|
|
357
331
|
case '.js':
|
|
358
332
|
case '.mjs':
|
|
359
|
-
|
|
360
|
-
|
|
333
|
+
({ cssBundle, esbuild_cssBundle } = metafile.outputs[output__relative_path])
|
|
334
|
+
if (cssBundle && esbuild_cssBundle) {
|
|
335
|
+
const cssBundle_path = join(cwd_(ctx), cssBundle)
|
|
336
|
+
const esbuild_cssBundle_path = join(cwd_(ctx), esbuild_cssBundle)
|
|
337
|
+
await cmd(
|
|
338
|
+
file_exists__waitfor(cssBundle_path))
|
|
339
|
+
await cmd(
|
|
340
|
+
cp(cssBundle_path, esbuild_cssBundle_path))
|
|
341
|
+
await cmd(
|
|
342
|
+
file_exists__waitfor(cssBundle_path + '.map'))
|
|
343
|
+
await cmd(
|
|
344
|
+
cp(cssBundle_path + '.map', esbuild_cssBundle_path + '.map'))
|
|
345
|
+
}
|
|
361
346
|
}
|
|
362
|
-
const server_asset_path = join(cwd, output__relative_path)
|
|
363
|
-
const browser_asset_path = join(
|
|
364
|
-
browser_path,
|
|
365
|
-
relative(server__relative_path, output__relative_path))
|
|
366
|
-
await cmd(
|
|
367
|
-
rm(browser_asset_path, { force: true }))
|
|
368
|
-
await cmd(
|
|
369
|
-
file_exists__waitfor(server_asset_path))
|
|
370
|
-
await cmd(
|
|
371
|
-
link(server_asset_path, browser_asset_path))
|
|
372
347
|
}
|
|
373
348
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|| browser_path_(ctx) !== browser_path
|
|
395
|
-
|| server__relative_path_(ctx) !== server__relative_path
|
|
396
|
-
)
|
|
349
|
+
}
|
|
350
|
+
async function rebuildjs__assets__link() {
|
|
351
|
+
const outputs = server__metafile.outputs ?? {}
|
|
352
|
+
for (let output__relative_path in outputs) {
|
|
353
|
+
switch (extname(output__relative_path)) {
|
|
354
|
+
case '.js':
|
|
355
|
+
case '.mjs':
|
|
356
|
+
case '.map':
|
|
357
|
+
continue
|
|
358
|
+
}
|
|
359
|
+
const server_asset_path = join(cwd, output__relative_path)
|
|
360
|
+
const browser_asset_path = join(
|
|
361
|
+
browser_path,
|
|
362
|
+
relative(server__relative_path, output__relative_path))
|
|
363
|
+
await cmd(
|
|
364
|
+
rm(browser_asset_path, { force: true }))
|
|
365
|
+
await cmd(
|
|
366
|
+
file_exists__waitfor(server_asset_path))
|
|
367
|
+
await cmd(
|
|
368
|
+
link(server_asset_path, browser_asset_path))
|
|
397
369
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
370
|
+
}
|
|
371
|
+
async function cmd(promise) {
|
|
372
|
+
if (cancel_()) throw new Cancel()
|
|
373
|
+
promise.rebuildjs_cancel$ = run(memo_(rebuildjs_cancel$=>{
|
|
374
|
+
if (cancel_()) {
|
|
375
|
+
promise.cancel?.()
|
|
376
|
+
off(rebuildjs_cancel$)
|
|
377
|
+
}
|
|
378
|
+
return rebuildjs_cancel$
|
|
379
|
+
}))
|
|
380
|
+
const ret = await promise
|
|
381
|
+
if (cancel_()) throw new Cancel()
|
|
382
|
+
return ret
|
|
383
|
+
}
|
|
384
|
+
function cancel_() {
|
|
385
|
+
return (
|
|
386
|
+
build_id_(ctx) !== build_id
|
|
387
|
+
|| metafile__build_id_(ctx) !== metafile__build_id
|
|
388
|
+
|| server__metafile_(ctx) !== server__metafile
|
|
389
|
+
|| browser__metafile_(ctx) !== browser__metafile
|
|
390
|
+
|| cwd_(ctx) !== cwd
|
|
391
|
+
|| browser_path_(ctx) !== browser_path
|
|
392
|
+
|| server__relative_path_(ctx) !== server__relative_path
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
})
|
|
400
396
|
})),
|
|
401
397
|
{ id: 'rebuildjs__assets__link$', ns: 'app' })
|
|
402
398
|
)
|