File tree 3 files changed +10
-41
lines changed
3 files changed +10
-41
lines changed Original file line number Diff line number Diff line change 3
3
import { assert } from "@std/assert/assert" ;
4
4
import { exists } from "@std/fs/exists" ;
5
5
import { BuildOptions , context } from "esbuild" ;
6
- import { AsyncDisposableStack } from "../misc/async_disposable_stack.ts" ;
7
6
import { OPTIONS } from "./config.ts" ;
8
7
9
8
const DICTIONARY = new URL ( "../dictionary/dictionary.ts" , import . meta. url ) ;
@@ -15,11 +14,16 @@ const BUILD_OPTIONS: BuildOptions = {
15
14
} ;
16
15
async function watchMain ( ) : Promise < AsyncDisposable > {
17
16
await using stack = new AsyncDisposableStack ( ) ;
18
- const buildContext = await context ( BUILD_OPTIONS ) ;
19
- stack . defer ( async ( ) => await buildContext . dispose ( ) ) ;
20
- buildContext . watch ( ) ;
21
- buildContext . serve ( { servedir : "./dist/" } ) ;
22
- return stack . move ( ) ;
17
+ const buildContext = stack . use ( {
18
+ context : await context ( BUILD_OPTIONS ) ,
19
+ async [ Symbol . asyncDispose ] ( ) : Promise < void > {
20
+ await this . context . dispose ( ) ;
21
+ } ,
22
+ } ) ;
23
+ buildContext . context . watch ( ) ;
24
+ buildContext . context . serve ( { servedir : "./dist/" } ) ;
25
+ stack . move ( ) ;
26
+ return buildContext ;
23
27
}
24
28
async function watchDictionary ( ) : Promise < number > {
25
29
const command = new Deno . Command ( Deno . execPath ( ) , {
Original file line number Diff line number Diff line change 2
2
3
3
import { unreachable } from "@std/assert/unreachable" ;
4
4
import { debounce } from "@std/async/debounce" ;
5
- import { AsyncDisposableStack } from "../misc/async_disposable_stack.ts" ;
6
5
import { build } from "./build.ts" ;
7
6
8
7
if ( import . meta. main ) {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments