MCPcopy Create free account
hub / github.com/angular/angular / setupCompiler

Function setupCompiler

packages/compiler-cli/preprocessor/test/indexer_spec.ts:29–57  ·  view source on GitHub ↗
(content: string, options?: {strictTemplates?: boolean})

Source from the content-addressed store, hash-verified

27import {resolveWasmBinding} from './utils.js';
28
29async function setupCompiler(content: string, options?: {strictTemplates?: boolean}) {
30 const projectRoot = process.cwd();
31 const filePath = join(projectRoot, 'test.ts');
32 const tsconfigPath = join(projectRoot, 'tsconfig.json');
33 const nodeModulesPath = join(projectRoot, 'node_modules');
34
35 const virtualFiles = {
36 [filePath]: content,
37 [tsconfigPath]: JSON.stringify({
38 files: [filePath],
39 }),
40 };
41
42 const wasmBinding = resolveWasmBinding();
43 const analyzer = await createAnalyzer(tsconfigPath, {
44 virtualFiles,
45 optimize: true,
46 backend: 'wasm',
47 wasmBinding,
48 nodeModulesPathOverride: nodeModulesPath,
49 });
50
51 const compiler = new HybridCompiler(analyzer, {
52 optimize: true,
53 tcbConfig: buildTypeCheckingConfig({strictTemplates: options?.strictTemplates ?? false}),
54 });
55
56 return {compiler, filePath};
57}
58
59async function setupMultiFileCompiler(
60 files: Record<string, string>,

Callers 1

indexer_spec.tsFile · 0.85

Calls 4

joinFunction · 0.85
createAnalyzerFunction · 0.85
buildTypeCheckingConfigFunction · 0.85
resolveWasmBindingFunction · 0.70

Tested by

no test coverage detected