compile static method
void
compile(})
Invoke a dart2js compile with the given sourceFile
as input.
Implementation
static void compile(File sourceFile,
{Directory? outDir,
File? outFile,
bool minify = false,
bool csp = false,
bool enableExperimentalMirrors = false,
String? categories,
List<String> extraArgs = const []}) {
if (outFile == null) {
outDir ??= sourceFile.parent;
outFile = joinFile(outDir, ['${fileName(sourceFile)}.js']);
} else {
outDir = outFile.parent;
}
if (!outDir.existsSync()) outDir.createSync(recursive: true);
runlib.run(sdkBin('dart'),
arguments: _buildArgs(
minify: minify,
csp: csp,
enableExperimentalMirrors: enableExperimentalMirrors,
categories: categories,
extraArgs: extraArgs,
outFile: outFile,
sourceFile: sourceFile));
}