@@ -294,90 +294,10 @@ func (c *CombinedSymbolTable) Values() iter.Seq[*Symbol] {
294294
295295var _ SymbolTable = (* CombinedSymbolTable )(nil )
296296
297- var NodeOnlyGlobalNames = collections .NewSetFromItems (
298- "__dirname" ,
299- "__filename" ,
300- "buffer" ,
301- "Buffer" ,
302- "BufferConstructor" ,
303- "BufferEncoding" ,
304- "clearImmediate" ,
305- "clearInterval" ,
306- "clearTimeout" ,
307- "console" ,
308- "Console" ,
309- "crypto" ,
310- "ErrorConstructor" ,
311- "gc" ,
312- "Global" ,
313- "localStorage" ,
314- "queueMicrotask" ,
315- "RequestInit" ,
316- "ResponseInit" ,
317- "sessionStorage" ,
318- "setImmediate" ,
319- "setInterval" ,
320- "setTimeout" ,
321- )
322-
323- var TypesNodeIgnorableNames = collections .NewSetFromItems (
324- "AbortController" ,
325- "AbortSignal" ,
326- "AsyncIteratorObject" ,
327- "atob" ,
328- "Blob" ,
329- "BroadcastChannel" ,
330- "btoa" ,
331- "ByteLengthQueuingStrategy" ,
332- "CloseEvent" ,
333- "CompressionStream" ,
334- "CountQueuingStrategy" ,
335- "CustomEvent" ,
336- "DecompressionStream" ,
337- "Disposable" ,
338- "DOMException" ,
339- "Event" ,
340- "EventSource" ,
341- "EventTarget" ,
342- "fetch" ,
343- "File" ,
344- "Float32Array" ,
345- "Float64Array" ,
346- "FormData" ,
347- "Headers" ,
348- "ImportMeta" ,
349- "MessageChannel" ,
350- "MessageEvent" ,
351- "MessagePort" ,
352- "performance" ,
353- "PerformanceEntry" ,
354- "PerformanceMark" ,
355- "PerformanceMeasure" ,
356- "QueuingStrategy" ,
357- "ReadableByteStreamController" ,
358- "ReadableStream" ,
359- "ReadableStreamBYOBReader" ,
360- "ReadableStreamBYOBRequest" ,
361- "ReadableStreamDefaultController" ,
362- "ReadableStreamDefaultReader" ,
363- "ReadonlyArray" ,
364- "Request" ,
365- "Response" ,
366- "Storage" ,
367- "TextDecoder" ,
368- "TextDecoderStream" ,
369- "TextEncoder" ,
370- "TextEncoderStream" ,
371- "TransformStream" ,
372- "TransformStreamDefaultController" ,
373- "URL" ,
374- "URLPattern" ,
375- "URLSearchParams" ,
376- "WebSocket" ,
377- "WritableStream" ,
378- "WritableStreamDefaultController" ,
379- "WritableStreamDefaultWriter" ,
380- )
297+ type DenoForkContextInfo struct {
298+ TypesNodeIgnorableNames * collections.Set [string ]
299+ NodeOnlyGlobalNames * collections.Set [string ]
300+ }
381301
382302type DenoForkContext struct {
383303 globals SymbolTable
@@ -386,6 +306,7 @@ type DenoForkContext struct {
386306 mergeSymbol func (target * Symbol , source * Symbol , unidirectional bool ) * Symbol
387307 getMergedSymbol func (source * Symbol ) * Symbol
388308 isNodeSourceFile func (path tspath.Path ) bool
309+ info DenoForkContextInfo
389310}
390311
391312func NewDenoForkContext (
@@ -394,6 +315,7 @@ func NewDenoForkContext(
394315 mergeSymbol func (target * Symbol , source * Symbol , unidirectional bool ) * Symbol ,
395316 getMergedSymbol func (source * Symbol ) * Symbol ,
396317 isNodeSourceFile func (path tspath.Path ) bool ,
318+ info DenoForkContextInfo ,
397319) * DenoForkContext {
398320 return & DenoForkContext {
399321 globals : globals ,
@@ -405,11 +327,12 @@ func NewDenoForkContext(
405327 mergeSymbol : mergeSymbol ,
406328 getMergedSymbol : getMergedSymbol ,
407329 isNodeSourceFile : isNodeSourceFile ,
330+ info : info ,
408331 }
409332}
410333
411334func (c * DenoForkContext ) GetGlobalsForName (name string ) SymbolTable {
412- if NodeOnlyGlobalNames .Has (name ) {
335+ if c . info . NodeOnlyGlobalNames .Has (name ) {
413336 return c .nodeGlobals
414337 } else {
415338 return c .globals
@@ -448,7 +371,7 @@ func (c *DenoForkContext) MergeGlobalSymbolTable(node *Node, source SymbolTable,
448371 targetSymbol := target .Get (id )
449372 if isTypesNodeSourceFile {
450373 }
451- if isTypesNodeSourceFile && targetSymbol != nil && TypesNodeIgnorableNames .Has (id ) && ! symbolHasAnyTypesNodePkgDecl (targetSymbol , c .HasNodeSourceFile ) {
374+ if isTypesNodeSourceFile && targetSymbol != nil && c . info . TypesNodeIgnorableNames .Has (id ) && ! symbolHasAnyTypesNodePkgDecl (targetSymbol , c .HasNodeSourceFile ) {
452375 continue
453376 }
454377 var merged * Symbol
0 commit comments