@@ -35,29 +35,29 @@ export class Server {
35
35
try {
36
36
// serve hmr ws
37
37
if ( pathname === '/_hmr' ) {
38
- const { websocket , response } = Deno . upgradeWebSocket ( req )
38
+ const { socket , response } = Deno . upgradeWebSocket ( req )
39
39
const watcher = aleph . createFSWatcher ( )
40
- websocket . addEventListener ( 'open' , ( ) => {
41
- watcher . on ( 'add' , ( mod : any ) => websocket . send ( JSON . stringify ( { ...mod , type : 'add' } ) ) )
40
+ socket . addEventListener ( 'open' , ( ) => {
41
+ watcher . on ( 'add' , ( mod : any ) => socket . send ( JSON . stringify ( { ...mod , type : 'add' } ) ) )
42
42
watcher . on ( 'remove' , ( specifier : string ) => {
43
43
watcher . removeAllListeners ( 'modify-' + specifier )
44
- websocket . send ( JSON . stringify ( { type : 'remove' , specifier } ) )
44
+ socket . send ( JSON . stringify ( { type : 'remove' , specifier } ) )
45
45
} )
46
46
log . debug ( 'hmr connected' )
47
47
} )
48
- websocket . addEventListener ( 'close' , ( ) => {
48
+ socket . addEventListener ( 'close' , ( ) => {
49
49
aleph . removeFSWatcher ( watcher )
50
50
log . debug ( 'hmr closed' )
51
51
} )
52
- websocket . addEventListener ( 'message' , ( e ) => {
52
+ socket . addEventListener ( 'message' , ( e ) => {
53
53
if ( util . isFilledString ( e . data ) ) {
54
54
try {
55
55
const data = JSON . parse ( e . data )
56
56
if ( data . type === 'hotAccept' && util . isFilledString ( data . specifier ) ) {
57
57
const mod = aleph . getModule ( data . specifier )
58
58
if ( mod ) {
59
59
watcher . on ( `modify-${ mod . specifier } ` , ( data ) => {
60
- websocket . send ( JSON . stringify ( {
60
+ socket . send ( JSON . stringify ( {
61
61
...data ,
62
62
type : 'update' ,
63
63
specifier : mod . specifier ,
0 commit comments