Skip to content

Commit

Permalink
feat(vue-tsc): support tracing
Browse files Browse the repository at this point in the history
Proxy tracing API to `tsserverlibrary`

fixes: vuejs#1375
  • Loading branch information
blake-newman committed Jun 6, 2022
1 parent 1630f5a commit b96bd94
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/vue-tsc/bin/vue-tsc.js
Expand Up @@ -32,6 +32,18 @@ fs.readFileSync = (...args) => {
`function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {`,
`function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) { return require(${JSON.stringify(proxyPath)}).createProgramProxy(...arguments);`,
);

// proxy tracing
tsc = tsc.replace(
`ts.startTracing = tracingEnabled.startTracing;`,
`ts.startTracing = require("typescript/lib/tsserverlibrary").startTracing;`,
);

tsc = tsc.replace(
`ts.dumpTracingLegend = tracingEnabled.dumpLegend;`,
`ts.dumpTracingLegend = require("typescript/lib/tsserverlibrary").dumpTracingLegend;`,
);

return tsc;
}
return readFileSync(...args);
Expand Down

0 comments on commit b96bd94

Please sign in to comment.