Skip to content

Commit be3dfaf

Browse files
authored
feat: Allow specifying transforms via the compiler API (#1786)
1 parent 057ce46 commit be3dfaf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

cli/asc.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { OptionDescription } from "./util/options";
77
export { OptionDescription };
8+
import { Transform } from "./transform";
89

910
/** Ready promise resolved once/if the compiler is ready. */
1011
export const ready: Promise<void>;
@@ -192,6 +193,8 @@ export interface APIOptions {
192193
listFiles?: (dirname: string, baseDir: string) => string[] | null;
193194
/** Handler for diagnostic messages. */
194195
reportDiagnostic?: DiagnosticReporter;
196+
/** Additional transforms to apply. */
197+
transforms?: Transform[];
195198
}
196199

197200
/** Convenience function that parses and compiles source strings directly. */

cli/asc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ exports.main = function main(argv, options, callback) {
501501

502502
// Set up transforms
503503
const transforms = [];
504+
if (Array.isArray(options.transforms)) {
505+
transforms.push(...options.transforms);
506+
}
504507
if (opts.transform) {
505508
let tsNodeRegistered = false;
506509
let transformArgs = unique(opts.transform);

0 commit comments

Comments
 (0)