MCPcopy Create free account
hub / github.com/coder/guts / InjectSideEffectImport

Function InjectSideEffectImport

config/imports.go:44–52  ·  view source on GitHub ↗

InjectSideEffectImport returns a mutation that appends a bare side-effect import for the given module: ts.ApplyMutations(config.InjectSideEffectImport("./polyfill")) // import "./polyfill" Repeat calls for the same module are deduplicated.

(module string)

Source from the content-addressed store, hash-verified

42//
43// Repeat calls for the same module are deduplicated.
44func InjectSideEffectImport(module string) guts.MutationFunc {
45 decl := &bindings.ImportDeclaration{
46 Module: module,
47 SideEffect: true,
48 }
49 return func(ts *guts.Typescript) {
50 ts.AppendImport(decl)
51 }
52}
53
54func injectImport(module string, isTypeOnly bool, names ...string) guts.MutationFunc {
55 specs := make([]*bindings.ImportSpecifier, 0, len(names))

Callers 1

Calls 1

AppendImportMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…