MCPcopy
hub / github.com/angular/angular-cli / addImport

Function addImport

packages/schematics/angular/service-worker/index.ts:162–171  ·  view source on GitHub ↗
(host: Tree, filePath: string, symbolName: string, moduleName: string)

Source from the content-addressed store, hash-verified

160export default serviceWorkerSchematic;
161
162function addImport(host: Tree, filePath: string, symbolName: string, moduleName: string): void {
163 const moduleSource = getTsSourceFile(host, filePath);
164 const change = insertImport(moduleSource, filePath, symbolName, moduleName);
165
166 if (change) {
167 const recorder = host.beginUpdate(filePath);
168 applyToUpdateRecorder(recorder, [change]);
169 host.commitUpdate(recorder);
170 }
171}

Callers 2

updateAppModuleFunction · 0.85
addProvideServiceWorkerFunction · 0.85

Calls 5

insertImportFunction · 0.90
applyToUpdateRecorderFunction · 0.90
getTsSourceFileFunction · 0.85
beginUpdateMethod · 0.65
commitUpdateMethod · 0.65

Tested by

no test coverage detected