refactor(compiler-cli): remove tsickle from dependencies (#25649)
Users can still install tsickle if they want closure-compatible output. PR Close #25649
This commit is contained in:

committed by
Matias Niemelä

parent
a22fb91e1a
commit
29761ea5f8
@ -11,11 +11,8 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import * as ts from 'typescript';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as tsickle from 'tsickle';
|
||||
import * as api from './transformers/api';
|
||||
import * as ngc from './transformers/entry_points';
|
||||
import {GENERATED_FILES} from './transformers/util';
|
||||
|
||||
import {exitCodeFromResult, performCompilation, readConfiguration, formatDiagnostics, Diagnostics, ParsedConfiguration, PerformCompilationResult, filterErrorsAndWarnings} from './perform_compile';
|
||||
@ -66,22 +63,37 @@ function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|un
|
||||
convertIndexImportShorthand: false, transformDecorators, transformTypesToClosure,
|
||||
};
|
||||
|
||||
return ({
|
||||
program,
|
||||
targetSourceFile,
|
||||
writeFile,
|
||||
cancellationToken,
|
||||
emitOnlyDtsFiles,
|
||||
customTransformers = {},
|
||||
host,
|
||||
options
|
||||
}) =>
|
||||
tsickle.emitWithTsickle(
|
||||
program, {...tsickleHost, options, host}, host, options, targetSourceFile,
|
||||
writeFile, cancellationToken, emitOnlyDtsFiles, {
|
||||
beforeTs: customTransformers.before,
|
||||
afterTs: customTransformers.after,
|
||||
});
|
||||
if (options.annotateForClosureCompiler || options.annotationsAs === 'static fields') {
|
||||
return ({
|
||||
program,
|
||||
targetSourceFile,
|
||||
writeFile,
|
||||
cancellationToken,
|
||||
emitOnlyDtsFiles,
|
||||
customTransformers = {},
|
||||
host,
|
||||
options
|
||||
}) =>
|
||||
// tslint:disable-next-line:no-require-imports only depend on tsickle if requested
|
||||
require('tsickle').emitWithTsickle(
|
||||
program, {...tsickleHost, options, host}, host, options, targetSourceFile, writeFile,
|
||||
cancellationToken, emitOnlyDtsFiles, {
|
||||
beforeTs: customTransformers.before,
|
||||
afterTs: customTransformers.after,
|
||||
});
|
||||
} else {
|
||||
return ({
|
||||
program,
|
||||
targetSourceFile,
|
||||
writeFile,
|
||||
cancellationToken,
|
||||
emitOnlyDtsFiles,
|
||||
customTransformers = {},
|
||||
}) =>
|
||||
program.emit(
|
||||
targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles,
|
||||
{after: customTransformers.after, before: customTransformers.before});
|
||||
}
|
||||
}
|
||||
|
||||
export interface NgcParsedConfiguration extends ParsedConfiguration { watch?: boolean; }
|
||||
|
Reference in New Issue
Block a user