File tree Expand file tree Collapse file tree 3 files changed +10
-41
lines changed
Expand file tree Collapse file tree 3 files changed +10
-41
lines changed Original file line number Diff line number Diff line change 33import { assert } from "@std/assert/assert" ;
44import { exists } from "@std/fs/exists" ;
55import { BuildOptions , context } from "esbuild" ;
6- import { AsyncDisposableStack } from "../misc/async_disposable_stack.ts" ;
76import { OPTIONS } from "./config.ts" ;
87
98const DICTIONARY = new URL ( "../dictionary/dictionary.ts" , import . meta. url ) ;
@@ -15,11 +14,16 @@ const BUILD_OPTIONS: BuildOptions = {
1514} ;
1615async function watchMain ( ) : Promise < AsyncDisposable > {
1716 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 ;
2327}
2428async function watchDictionary ( ) : Promise < number > {
2529 const command = new Deno . Command ( Deno . execPath ( ) , {
Original file line number Diff line number Diff line change 22
33import { unreachable } from "@std/assert/unreachable" ;
44import { debounce } from "@std/async/debounce" ;
5- import { AsyncDisposableStack } from "../misc/async_disposable_stack.ts" ;
65import { build } from "./build.ts" ;
76
87if ( import . meta. main ) {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments