build: remove references to tsc-wrapped
(#19298)
With this commit `ngc` is used instead of `tsc-wrapped` for collecting metadata and tsickle rewriting and `tsc-wrapped` is removed from the repository. `@angular/tsc-wrapped@5` is now deprecated and is no longer used, updated, or maintained as part as of Angular 5.x.x. `@angular/tsc-wrapped@4` is still maintained and required by Angular 4.x.x and will be maintained as long as 4.x.x is in LTS. PR Close #19298
This commit is contained in:

committed by
Igor Minar

parent
4c73b52d5c
commit
f96142cd7c
@ -27,6 +27,7 @@ import {TypeCheckCompiler} from '../view_compiler/type_check_compiler';
|
||||
import {ViewCompileResult, ViewCompiler} from '../view_compiler/view_compiler';
|
||||
|
||||
import {AotCompilerHost} from './compiler_host';
|
||||
import {AotCompilerOptions} from './compiler_options';
|
||||
import {GeneratedFile} from './generated_file';
|
||||
import {StaticReflector} from './static_reflector';
|
||||
import {StaticSymbol} from './static_symbol';
|
||||
@ -45,16 +46,14 @@ export class AotCompiler {
|
||||
new Map<StaticSymbol, {template: TemplateAst[], pipes: CompilePipeSummary[]}>();
|
||||
|
||||
constructor(
|
||||
private _config: CompilerConfig, private _host: AotCompilerHost,
|
||||
private _reflector: StaticReflector, private _metadataResolver: CompileMetadataResolver,
|
||||
private _templateParser: TemplateParser, private _styleCompiler: StyleCompiler,
|
||||
private _viewCompiler: ViewCompiler, private _typeCheckCompiler: TypeCheckCompiler,
|
||||
private _ngModuleCompiler: NgModuleCompiler, private _outputEmitter: OutputEmitter,
|
||||
private _summaryResolver: SummaryResolver<StaticSymbol>, private _localeId: string|null,
|
||||
private _translationFormat: string|null,
|
||||
/** TODO(tbosch): remove this flag as it is always on in the new ngc */
|
||||
private _enableSummariesForJit: boolean|null, private _symbolResolver: StaticSymbolResolver) {
|
||||
}
|
||||
private _config: CompilerConfig, private options: AotCompilerOptions,
|
||||
private _host: AotCompilerHost, private _reflector: StaticReflector,
|
||||
private _metadataResolver: CompileMetadataResolver, private _templateParser: TemplateParser,
|
||||
private _styleCompiler: StyleCompiler, private _viewCompiler: ViewCompiler,
|
||||
private _typeCheckCompiler: TypeCheckCompiler, private _ngModuleCompiler: NgModuleCompiler,
|
||||
private _outputEmitter: OutputEmitter,
|
||||
private _summaryResolver: SummaryResolver<StaticSymbol>,
|
||||
private _symbolResolver: StaticSymbolResolver) {}
|
||||
|
||||
clearCache() { this._metadataResolver.clearCache(); }
|
||||
|
||||
@ -121,7 +120,8 @@ export class AotCompiler {
|
||||
|
||||
private _createNgFactoryStub(file: NgAnalyzedFile, emitFlags: StubEmitFlags): GeneratedFile[] {
|
||||
const generatedFiles: GeneratedFile[] = [];
|
||||
const outputCtx = this._createOutputContext(ngfactoryFilePath(file.fileName, true));
|
||||
const outputCtx = this._createOutputContext(
|
||||
calculateGenFileName(ngfactoryFilePath(file.fileName, true), this.options.rootDir));
|
||||
|
||||
file.ngModules.forEach((ngModuleMeta, ngModuleIndex) => {
|
||||
// Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
|
||||
@ -209,8 +209,10 @@ export class AotCompiler {
|
||||
}
|
||||
const encapsulation =
|
||||
compMeta.template !.encapsulation || this._config.defaultEncapsulation;
|
||||
const outputCtx = this._createOutputContext(_stylesModuleUrl(
|
||||
normalizedUrl, encapsulation === ViewEncapsulation.Emulated, fileSuffix));
|
||||
const outputCtx = this._createOutputContext(calculateGenFileName(
|
||||
_stylesModuleUrl(
|
||||
normalizedUrl, encapsulation === ViewEncapsulation.Emulated, fileSuffix),
|
||||
this.options.rootDir));
|
||||
_createEmptyStub(outputCtx);
|
||||
generatedFiles.push(this._codegenSourceModule(normalizedUrl, outputCtx));
|
||||
});
|
||||
@ -221,12 +223,13 @@ export class AotCompiler {
|
||||
private _createNgSummaryStub(file: NgAnalyzedFile, emitFlags: StubEmitFlags): GeneratedFile[] {
|
||||
const generatedFiles: GeneratedFile[] = [];
|
||||
// note: .ngsummary.js stubs don't change when we produce type check stubs
|
||||
if (!this._enableSummariesForJit || !(emitFlags & StubEmitFlags.Basic)) {
|
||||
if (!this.options.enableSummariesForJit || !(emitFlags & StubEmitFlags.Basic)) {
|
||||
return generatedFiles;
|
||||
}
|
||||
if (file.directives.length || file.injectables.length || file.ngModules.length ||
|
||||
file.pipes.length || file.exportsNonSourceFiles) {
|
||||
const outputCtx = this._createOutputContext(summaryForJitFileName(file.fileName, true));
|
||||
const outputCtx = this._createOutputContext(
|
||||
calculateGenFileName(summaryForJitFileName(file.fileName, true), this.options.rootDir));
|
||||
file.ngModules.forEach(ngModule => {
|
||||
// create exports that user code can reference
|
||||
createForJitStub(outputCtx, ngModule.type.reference);
|
||||
@ -295,7 +298,8 @@ export class AotCompiler {
|
||||
const fileSuffix = splitTypescriptSuffix(srcFileUrl, true)[1];
|
||||
const generatedFiles: GeneratedFile[] = [];
|
||||
|
||||
const outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
|
||||
const outputCtx = this._createOutputContext(
|
||||
calculateGenFileName(ngfactoryFilePath(srcFileUrl, true), this.options.rootDir));
|
||||
|
||||
generatedFiles.push(
|
||||
...this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx));
|
||||
@ -366,7 +370,8 @@ export class AotCompiler {
|
||||
metadata: this._metadataResolver.getInjectableSummary(ref) !.type
|
||||
}))
|
||||
];
|
||||
const forJitOutputCtx = this._createOutputContext(summaryForJitFileName(srcFileName, true));
|
||||
const forJitOutputCtx = this._createOutputContext(
|
||||
calculateGenFileName(summaryForJitFileName(srcFileName, true), this.options.rootDir));
|
||||
const {json, exportAs} = serializeSummaries(
|
||||
srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries,
|
||||
typeData);
|
||||
@ -377,7 +382,7 @@ export class AotCompiler {
|
||||
]));
|
||||
});
|
||||
const summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
|
||||
if (this._enableSummariesForJit) {
|
||||
if (this.options.enableSummariesForJit) {
|
||||
return [summaryJson, this._codegenSourceModule(srcFileName, forJitOutputCtx)];
|
||||
};
|
||||
|
||||
@ -387,18 +392,18 @@ export class AotCompiler {
|
||||
private _compileModule(outputCtx: OutputContext, ngModule: CompileNgModuleMetadata): void {
|
||||
const providers: CompileProviderMetadata[] = [];
|
||||
|
||||
if (this._localeId) {
|
||||
const normalizedLocale = this._localeId.replace(/_/g, '-');
|
||||
if (this.options.locale) {
|
||||
const normalizedLocale = this.options.locale.replace(/_/g, '-');
|
||||
providers.push({
|
||||
token: createTokenForExternalReference(this._reflector, Identifiers.LOCALE_ID),
|
||||
useValue: normalizedLocale,
|
||||
});
|
||||
}
|
||||
|
||||
if (this._translationFormat) {
|
||||
if (this.options.i18nFormat) {
|
||||
providers.push({
|
||||
token: createTokenForExternalReference(this._reflector, Identifiers.TRANSLATIONS_FORMAT),
|
||||
useValue: this._translationFormat
|
||||
useValue: this.options.i18nFormat
|
||||
});
|
||||
}
|
||||
|
||||
@ -516,8 +521,11 @@ export class AotCompiler {
|
||||
private _codegenStyles(
|
||||
srcFileUrl: string, compMeta: CompileDirectiveMetadata,
|
||||
stylesheetMetadata: CompileStylesheetMetadata, fileSuffix: string): GeneratedFile {
|
||||
const outputCtx = this._createOutputContext(_stylesModuleUrl(
|
||||
stylesheetMetadata.moduleUrl !, this._styleCompiler.needsStyleShim(compMeta), fileSuffix));
|
||||
const outputCtx = this._createOutputContext(calculateGenFileName(
|
||||
_stylesModuleUrl(
|
||||
stylesheetMetadata.moduleUrl !, this._styleCompiler.needsStyleShim(compMeta),
|
||||
fileSuffix),
|
||||
this.options.rootDir));
|
||||
const compiledStylesheet =
|
||||
this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata);
|
||||
_resolveStyleStatements(
|
||||
@ -723,3 +731,17 @@ export function mergeAnalyzedFiles(analyzedFiles: NgAnalyzedFile[]): NgAnalyzedM
|
||||
function mergeAndValidateNgFiles(files: NgAnalyzedFile[]): NgAnalyzedModules {
|
||||
return validateAnalyzedModules(mergeAnalyzedFiles(files));
|
||||
}
|
||||
|
||||
function calculateGenFileName(fileName: string, rootDir: string | undefined): string {
|
||||
if (!rootDir) return fileName;
|
||||
|
||||
const fileNameParts = fileName.split(/\\|\//);
|
||||
const rootDirParts = rootDir.split(/\\|\//);
|
||||
if (!rootDirParts[rootDirParts.length - 1]) rootDirParts.pop();
|
||||
let i = 0;
|
||||
while (i < Math.min(fileNameParts.length, rootDirParts.length) &&
|
||||
fileNameParts[i] === rootDirParts[i])
|
||||
i++;
|
||||
const result = [...rootDirParts, ...fileNameParts.slice(i)].join('/');
|
||||
return result;
|
||||
}
|
@ -84,9 +84,9 @@ export function createAotCompiler(compilerHost: AotCompilerHost, options: AotCom
|
||||
const viewCompiler = new ViewCompiler(staticReflector);
|
||||
const typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);
|
||||
const compiler = new AotCompiler(
|
||||
config, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver),
|
||||
viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector),
|
||||
new TypeScriptEmitter(), summaryResolver, options.locale || null, options.i18nFormat || null,
|
||||
options.enableSummariesForJit || null, symbolResolver);
|
||||
config, options, compilerHost, staticReflector, resolver, tmplParser,
|
||||
new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler,
|
||||
new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver,
|
||||
symbolResolver);
|
||||
return {compiler, reflector: staticReflector};
|
||||
}
|
||||
|
@ -17,4 +17,5 @@ export interface AotCompilerOptions {
|
||||
enableSummariesForJit?: boolean;
|
||||
preserveWhitespaces?: boolean;
|
||||
fullTemplateTypeCheck?: boolean;
|
||||
rootDir?: string;
|
||||
}
|
||||
|
@ -11,4 +11,4 @@
|
||||
// replaces this file with production index.ts when it rewrites private symbol
|
||||
// names.
|
||||
|
||||
export * from './public_api';
|
||||
export * from './testing';
|
||||
|
14
packages/compiler/testing/testing.ts
Normal file
14
packages/compiler/testing/testing.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
// This file is not used to build this module. It is only used during editing
|
||||
// by the TypeScript language service and during build for verification. `ngc`
|
||||
// replaces this file with production index.ts when it rewrites private symbol
|
||||
// names.
|
||||
|
||||
export * from './public_api';
|
@ -5,19 +5,20 @@
|
||||
"baseUrl": ".",
|
||||
"rootDir": "../",
|
||||
"paths": {
|
||||
"@angular/compiler": ["../../../dist/packages/compiler"]
|
||||
"@angular/compiler": ["../../../dist/packages/compiler"],
|
||||
"@angular/core": ["../../../dist/packages/core"]
|
||||
},
|
||||
"outDir": "../../../dist/packages/compiler"
|
||||
},
|
||||
|
||||
"files": [
|
||||
"public_api.ts",
|
||||
"testing.ts",
|
||||
"../../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
],
|
||||
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"flatModuleOutFile": "testing.js",
|
||||
"flatModuleId": "@angular/compiler/testing"
|
||||
"skipMetadataEmit": true,
|
||||
"skipTemplateCodegen": true
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../../dist/packages/compiler",
|
||||
"paths": {
|
||||
"@angular/core": ["../../dist/packages/core"]
|
||||
},
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
@ -23,5 +26,11 @@
|
||||
"files": [
|
||||
"index.ts",
|
||||
"../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||
]
|
||||
],
|
||||
|
||||
"angularCompilerOptions": {
|
||||
"annotateForClosureCompiler": true,
|
||||
"skipMetadataEmit": true,
|
||||
"skipTemplateCodegen": true
|
||||
}
|
||||
}
|
||||
|
9
packages/compiler/tsconfig-tools.json
Normal file
9
packages/compiler/tsconfig-tools.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "./tsconfig-build.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"outDir": "../../dist/tools/@angular/compiler"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user