MCPcopy Create free account
hub / github.com/Effect-TS/effect / addImport

Method addImport

packages/effect/src/Codegen.ts:557–565  ·  view source on GitHub ↗

* Registers a structured import request and returns its binding.

(input: Import)

Source from the content-addressed store, hash-verified

555 * Registers a structured import request and returns its binding.
556 */
557 addImport(input: Import): Binding {
558 const key = JSON.stringify([importKey(input), input.local, input.typeOnly])
559 const existing = this.#imports.get(key)
560 if (existing !== undefined) return existing
561 const result = imported(input)
562 this.#imports.set(key, result)
563 this.#importOrder.push(result)
564 return result
565 }
566
567 /**
568 * Registers a fixed import binding supplied by surrounding code without emitting its import declaration.

Callers 7

printImportsFunction · 0.95
registerModuleFunction · 0.80
registerImportsFunction · 0.80
Codegen.test.tsFile · 0.80
addSchemasFunction · 0.80
compileCallbackFunction · 0.80

Calls 5

importKeyFunction · 0.85
importedFunction · 0.85
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected