rebuildjs 0.25.0 → 0.26.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/build/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export declare function browser__build(config?:rebuildjs_build_config_T):Promise
15
15
  export declare function server__build(config?:rebuildjs_build_config_T):Promise<BuildContext>
16
16
  export declare function server__external_(config?:Partial<BuildOptions>):Promise<string[]>
17
17
  export declare function rebuildjs_plugin_():Plugin
18
+ export declare class RebuildjsInterrupt extends Error {}
18
19
  export type rebuildjs_build_config_T =
19
20
  Partial<BuildOptions>&{ rebuildjs?:rebuildjs_plugin_config_T }
20
21
  export type rebuildjs_plugin_config_T = {
package/build/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="./index.d.ts" />
3
3
  import { file_exists__waitfor } from 'ctx-core/fs'
4
4
  import { nullish__none_, run } from 'ctx-core/function'
5
- import { be, be_memo_pair_, be_sig_triple_, memo_, rmemo__wait } from 'ctx-core/rmemo'
5
+ import { be, be_memo_pair_, be_sig_triple_, memo_, off, rmemo__wait } from 'ctx-core/rmemo'
6
6
  import { short_uuid_ } from 'ctx-core/uuid'
7
7
  import { context } from 'esbuild'
8
8
  import { fdir } from 'fdir'
@@ -258,7 +258,15 @@ export function rebuildjs_plugin_() {
258
258
  }
259
259
  async function cmd(fn) {
260
260
  if (cancel_()) throw new RebuildjsInterrupt()
261
- const ret = await fn()
261
+ const promise = fn()
262
+ promise.rebuildjs_cancel$ = run(memo_(rebuildjs_cancel$=>{
263
+ if (cancel_()) {
264
+ promise.cancel?.()
265
+ off(rebuildjs_cancel$)
266
+ }
267
+ return rebuildjs_cancel$
268
+ }))
269
+ const ret = await promise
262
270
  if (cancel_()) throw new RebuildjsInterrupt()
263
271
  return ret
264
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rebuildjs",
3
- "version": "0.25.0",
3
+ "version": "0.26.1",
4
4
  "description": "Reactive esbuild...simple hackable alternative to vite for Multi Page Apps",
5
5
  "keywords": [
6
6
  "reactive",
@@ -53,7 +53,7 @@
53
53
  "./package.json": "./package.json"
54
54
  },
55
55
  "dependencies": {
56
- "ctx-core": "^5.7.0",
56
+ "ctx-core": "^5.8.0",
57
57
  "elysia": "^0.8.6",
58
58
  "esbuild": "^0.19.11",
59
59
  "fdir": "^6.1.1",