rebuildjs 0.34.3 → 0.34.6

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.
Files changed (2) hide show
  1. package/build/index.js +97 -93
  2. package/package.json +3 -3
package/build/index.js CHANGED
@@ -292,107 +292,111 @@ export function rebuildjs_plugin_() {
292
292
  function rebuildjs_plugin__postprocess$_() {
293
293
  return (
294
294
  be(app_ctx, ctx=>
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
295
+ run(memo_(rebuildjs__assets__link$=>{
296
+ r()
297
+ return rebuildjs__assets__link$
298
+ function r() {
299
+ if (!persist__metafile__ready_(ctx)) return
300
+ nullish__none_([
301
+ build_id_(ctx),
302
+ metafile__build_id_(ctx),
303
+ server__metafile_(ctx),
304
+ browser__metafile_(ctx),
305
+ cwd_(ctx),
306
+ browser_path_(ctx),
307
+ server__relative_path_(ctx),
308
+ ], (
309
+ build_id,
310
+ metafile__build_id,
311
+ server__metafile,
312
+ browser__metafile,
313
+ cwd,
314
+ browser_path,
315
+ server__relative_path,
316
+ )=>{
317
+ if (build_id === metafile__build_id) {
318
+ run(async ()=>{
319
+ try {
320
+ await esbuild_cssBundle__cp()
321
+ await rebuildjs__assets__link()
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
+ }
322
351
  }
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
352
+ }
353
+ async function rebuildjs__assets__link() {
354
+ const outputs = server__metafile.outputs ?? {}
355
+ for (let output__relative_path in outputs) {
330
356
  switch (extname(output__relative_path)) {
331
357
  case '.js':
332
358
  case '.mjs':
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
- }
359
+ case '.map':
360
+ continue
346
361
  }
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))
347
372
  }
348
373
  }
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))
374
+ async function cmd(promise) {
375
+ if (cancel_()) throw new Cancel()
376
+ promise.rebuildjs_cancel$ = run(memo_(rebuildjs_cancel$=>{
377
+ if (cancel_()) {
378
+ promise.cancel?.()
379
+ off(rebuildjs_cancel$)
380
+ }
381
+ return rebuildjs_cancel$
382
+ }))
383
+ const ret = await promise
384
+ if (cancel_()) throw new Cancel()
385
+ return ret
369
386
  }
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
- })
387
+ function cancel_() {
388
+ return (
389
+ build_id_(ctx) !== build_id
390
+ || metafile__build_id_(ctx) !== metafile__build_id
391
+ || server__metafile_(ctx) !== server__metafile
392
+ || browser__metafile_(ctx) !== browser__metafile
393
+ || cwd_(ctx) !== cwd
394
+ || browser_path_(ctx) !== browser_path
395
+ || server__relative_path_(ctx) !== server__relative_path
396
+ )
397
+ }
398
+ })
399
+ }
396
400
  })),
397
401
  { id: 'rebuildjs__assets__link$', ns: 'app' })
398
402
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rebuildjs",
3
- "version": "0.34.3",
3
+ "version": "0.34.6",
4
4
  "description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
5
5
  "keywords": [
6
6
  "reactive",
@@ -53,8 +53,8 @@
53
53
  "./package.json": "./package.json"
54
54
  },
55
55
  "dependencies": {
56
- "ctx-core": "^5.16.1",
57
- "elysia": "^0.8.8",
56
+ "ctx-core": "^5.16.2",
57
+ "elysia": "^0.8.9",
58
58
  "esbuild": "^0.19.11",
59
59
  "fdir": "^6.1.1",
60
60
  "picomatch": "^3.0.1"