MCPcopy Create free account
hub / github.com/angular/components / readIntoSourceFile

Function readIntoSourceFile

src/cdk/schematics/utils/build-component.ts:59–66  ·  view source on GitHub ↗
(host: Tree, modulePath: string)

Source from the content-addressed store, hash-verified

57const supportedCssExtensions = ['css', 'scss', 'less'];
58
59function readIntoSourceFile(host: Tree, modulePath: string) {
60 const text = host.read(modulePath);
61 if (text === null) {
62 throw new SchematicsException(`File ${modulePath} does not exist.`);
63 }
64
65 return ts.createSourceFile(modulePath, text.toString('utf-8'), ts.ScriptTarget.Latest, true);
66}
67
68function addDeclarationToNgModule(options: ComponentOptions): Rule {
69 return (host: Tree) => {

Callers 1

addDeclarationToNgModuleFunction · 0.85

Calls 2

readMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected