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)
| 42 | // |
| 43 | // Repeat calls for the same module are deduplicated. |
| 44 | func 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 | |
| 54 | func injectImport(module string, isTypeOnly bool, names ...string) guts.MutationFunc { |
| 55 | specs := make([]*bindings.ImportSpecifier, 0, len(names)) |
searching dependent graphs…