MCPcopy Index your code
hub / github.com/dropbox/ts-transform-react-constant-elements / compile

Function compile

compile.ts:22–52  ·  view source on GitHub ↗
(
  input: string,
  transformOpts: Opts,
  options: ts.CompilerOptions = CJS_CONFIG
)

Source from the content-addressed store, hash-verified

20};
21
22export default function compile(
23 input: string,
24 transformOpts: Opts,
25 options: ts.CompilerOptions = CJS_CONFIG
26) {
27 const files = globSync(input);
28 const compilerHost = ts.createCompilerHost(options);
29 const program = ts.createProgram(files, options, compilerHost);
30
31 const msgs = {};
32
33 let emitResult = program.emit(undefined, undefined, undefined, undefined, {
34 before: [hoist(transformOpts)]
35 });
36
37 let allDiagnostics = ts
38 .getPreEmitDiagnostics(program)
39 .concat(emitResult.diagnostics);
40
41 allDiagnostics.forEach(diagnostic => {
42 let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(
43 diagnostic.start
44 );
45 let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
46 console.log(
47 `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
48 );
49 });
50
51 return msgs;
52}

Callers 1

transform.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected