feat: typescript 3.6 support (#32946)
BREAKING CHANGE: typescript 3.4 and 3.5 are no longer supported, please update to typescript 3.6 Fixes #32380 PR Close #32946
This commit is contained in:

committed by
Matias Niemelä

parent
117ca7cf39
commit
86e1e6c082
@ -14,7 +14,7 @@
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -26,20 +26,17 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@angular-devkit/architect": "^0.800.0-beta.15",
|
||||
"@angular-devkit/core": "^8.0.0-beta.15",
|
||||
"@angular-devkit/schematics": "^8.0.0-beta.15",
|
||||
"@microsoft/api-extractor": "^7.3.9",
|
||||
"@schematics/angular": "^8.0.0-beta.15",
|
||||
"@types/node": "6.0.84",
|
||||
"semver": "^5.6.0",
|
||||
"shelljs": "0.8.2",
|
||||
"tsickle": "^0.35.0"
|
||||
"tsickle": "^0.37.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
|
||||
"@bazel/typescript": "0.*",
|
||||
"typescript": ">=3.4 <3.6"
|
||||
"typescript": ">=3.6 <3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -143,8 +143,10 @@ Hello
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -238,6 +240,14 @@ Hello
|
||||
return ar;
|
||||
}
|
||||
|
||||
function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
@ -407,8 +417,10 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -502,6 +514,14 @@ e.SecondaryModule=o,e.a=1,Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
return ar;
|
||||
}
|
||||
|
||||
function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
@ -750,12 +770,12 @@ export * from './mymodule';
|
||||
* 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
|
||||
*/
|
||||
import * as tslib_1 from "tslib";
|
||||
import { __decorate } from "tslib";
|
||||
import { NgModule } from '@angular/core';
|
||||
var MyModule = /** @class */ (function () {
|
||||
function MyModule() {
|
||||
}
|
||||
MyModule = tslib_1.__decorate([
|
||||
MyModule = __decorate([
|
||||
NgModule({})
|
||||
], MyModule);
|
||||
return MyModule;
|
||||
@ -792,12 +812,12 @@ export * from './index';
|
||||
* 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
|
||||
*/
|
||||
import * as tslib_1 from "tslib";
|
||||
import { __decorate } from "tslib";
|
||||
import { NgModule } from '@angular/core';
|
||||
var SecondaryModule = /** @class */ (function () {
|
||||
function SecondaryModule() {
|
||||
}
|
||||
SecondaryModule = tslib_1.__decorate([
|
||||
SecondaryModule = __decorate([
|
||||
NgModule({})
|
||||
], SecondaryModule);
|
||||
return SecondaryModule;
|
||||
|
@ -131,8 +131,10 @@ License: MIT
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
|
||||
t[p[i]] = s[p[i]];
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -226,6 +228,14 @@ License: MIT
|
||||
return ar;
|
||||
}
|
||||
|
||||
function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
@ -584,12 +594,12 @@ export * from './portal-module';
|
||||
* 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
|
||||
*/
|
||||
import * as tslib_1 from "tslib";
|
||||
import { __decorate } from "tslib";
|
||||
import { NgModule } from '@angular/core';
|
||||
var PortalModule = /** @class */ (function () {
|
||||
function PortalModule() {
|
||||
}
|
||||
PortalModule = tslib_1.__decorate([
|
||||
PortalModule = __decorate([
|
||||
NgModule({})
|
||||
], PortalModule);
|
||||
return PortalModule;
|
||||
|
@ -16,7 +16,7 @@
|
||||
"peerDependencies": {
|
||||
"rxjs": "^6.5.3",
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -181,11 +181,9 @@ export class CommonJsReflectionHost extends Esm5ReflectionHost {
|
||||
private resolveModuleName(moduleName: string, containingFile: ts.SourceFile): ts.SourceFile
|
||||
|undefined {
|
||||
if (this.compilerHost.resolveModuleNames) {
|
||||
// FIXME: remove the "as any" cast once on TS3.6.
|
||||
const moduleInfo = (this.compilerHost as any)
|
||||
.resolveModuleNames(
|
||||
[moduleName], containingFile.fileName, undefined, undefined,
|
||||
this.program.getCompilerOptions())[0];
|
||||
const moduleInfo = this.compilerHost.resolveModuleNames(
|
||||
[moduleName], containingFile.fileName, undefined, undefined,
|
||||
this.program.getCompilerOptions())[0];
|
||||
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
||||
} else {
|
||||
const moduleInfo = ts.resolveModuleName(
|
||||
|
@ -158,11 +158,9 @@ export class UmdReflectionHost extends Esm5ReflectionHost {
|
||||
private resolveModuleName(moduleName: string, containingFile: ts.SourceFile): ts.SourceFile
|
||||
|undefined {
|
||||
if (this.compilerHost.resolveModuleNames) {
|
||||
// FIXME: remove the "as any" cast once on TS3.6.
|
||||
const moduleInfo = (this.compilerHost as any)
|
||||
.resolveModuleNames(
|
||||
[moduleName], containingFile.fileName, undefined, undefined,
|
||||
this.program.getCompilerOptions())[0];
|
||||
const moduleInfo = this.compilerHost.resolveModuleNames(
|
||||
[moduleName], containingFile.fileName, undefined, undefined,
|
||||
this.program.getCompilerOptions())[0];
|
||||
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
||||
} else {
|
||||
const moduleInfo = ts.resolveModuleName(
|
||||
|
@ -24,8 +24,8 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/compiler": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0",
|
||||
"typescript": ">=3.4 <3.6"
|
||||
"tslib": "^1.10.0",
|
||||
"typescript": ">=3.6 <3.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
|
@ -147,7 +147,8 @@ export class NgtscProgram implements api.Program {
|
||||
}
|
||||
|
||||
if (generators.length > 0) {
|
||||
this.host = new GeneratedShimsHostWrapper(host, generators);
|
||||
// FIXME: Remove the any cast once google3 is fully on TS3.6.
|
||||
this.host = (new GeneratedShimsHostWrapper(host, generators) as any);
|
||||
}
|
||||
|
||||
this.tsProgram =
|
||||
|
@ -32,14 +32,13 @@ export interface ShimGenerator {
|
||||
export class GeneratedShimsHostWrapper implements ts.CompilerHost {
|
||||
constructor(private delegate: ts.CompilerHost, private shimGenerators: ShimGenerator[]) {
|
||||
if (delegate.resolveModuleNames !== undefined) {
|
||||
// FIXME: TypeScript 3.6 adds an "options" argument that the code below passes on, but which
|
||||
// still makes the method incompatible with TS3.5. Remove the "as any" cast once fully on 3.6.
|
||||
((this as ts.CompilerHost) as any).resolveModuleNames =
|
||||
(moduleNames: string[], containingFile: string, reusedNames: (string[] | undefined),
|
||||
redirectedReference: (ts.ResolvedProjectReference | undefined), options: any) =>
|
||||
(delegate as any)
|
||||
.resolveModuleNames !(
|
||||
moduleNames, containingFile, reusedNames, redirectedReference, options);
|
||||
this.resolveModuleNames =
|
||||
(moduleNames: string[], containingFile: string, reusedNames: string[],
|
||||
redirectedReference: ts.ResolvedProjectReference, options?: ts.CompilerOptions) =>
|
||||
// FIXME: Additional parameters are required in TS3.6, but ignored in 3.5.
|
||||
// Remove the any cast once google3 is fully on TS3.6.
|
||||
(delegate.resolveModuleNames as any) !(
|
||||
moduleNames, containingFile, reusedNames, redirectedReference, options);
|
||||
}
|
||||
if (delegate.resolveTypeReferenceDirectives) {
|
||||
// Backward compatibility with TypeScript 2.9 and older since return
|
||||
@ -59,6 +58,13 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Additional options param is needed in TS3.6, but not alloowed in 3.5.
|
||||
// Make the options param non-optional once google3 is fully on TS3.6.
|
||||
resolveModuleNames?:
|
||||
(moduleNames: string[], containingFile: string, reusedNames: string[],
|
||||
redirectedReference: ts.ResolvedProjectReference,
|
||||
options?: ts.CompilerOptions) => (ts.ResolvedModule | undefined)[];
|
||||
|
||||
resolveTypeReferenceDirectives?:
|
||||
(names: string[], containingFile: string) => ts.ResolvedTypeReferenceDirective[];
|
||||
|
||||
|
@ -14,8 +14,7 @@ describe('shim host', () => {
|
||||
const delegate = {} as unknown as ts.CompilerHost;
|
||||
const shimsHost = new GeneratedShimsHostWrapper(delegate, []);
|
||||
|
||||
// FIXME: re-enable once fully on TS3.6.
|
||||
// expect(shimsHost.resolveModuleNames).not.toBeDefined();
|
||||
expect(shimsHost.resolveModuleNames).not.toBeDefined();
|
||||
expect(shimsHost.resolveTypeReferenceDirectives).not.toBeDefined();
|
||||
expect(shimsHost.directoryExists).not.toBeDefined();
|
||||
expect(shimsHost.getDirectories).not.toBeDefined();
|
||||
@ -30,8 +29,7 @@ describe('shim host', () => {
|
||||
} as unknown as ts.CompilerHost;
|
||||
const shimsHost = new GeneratedShimsHostWrapper(delegate, []);
|
||||
|
||||
// FIXME: re-enable once fully on TS3.6.
|
||||
// expect(shimsHost.resolveModuleNames).toBeDefined();
|
||||
expect(shimsHost.resolveModuleNames).toBeDefined();
|
||||
expect(shimsHost.resolveTypeReferenceDirectives).toBeDefined();
|
||||
expect(shimsHost.directoryExists).toBeDefined();
|
||||
expect(shimsHost.getDirectories).toBeDefined();
|
||||
|
@ -114,7 +114,7 @@ export function resolveModuleName(
|
||||
compilerHost: ts.CompilerHost): ts.ResolvedModule|undefined {
|
||||
if (compilerHost.resolveModuleNames) {
|
||||
// FIXME: Additional parameters are required in TS3.6, but ignored in 3.5.
|
||||
// Remove the any cast once fully on TS3.6.
|
||||
// Remove the any cast once google3 is fully on TS3.6.
|
||||
return (compilerHost as any)
|
||||
.resolveModuleNames([moduleName], containingFile, undefined, undefined, compilerOptions)[0];
|
||||
} else {
|
||||
|
@ -36,23 +36,30 @@ export function formatDiagnosticPosition(
|
||||
}
|
||||
|
||||
export function flattenDiagnosticMessageChain(
|
||||
chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost): string {
|
||||
let result = chain.messageText;
|
||||
let indent = 1;
|
||||
let current = chain.next;
|
||||
chain: api.DiagnosticMessageChain, host: ts.FormatDiagnosticsHost = defaultFormatHost,
|
||||
indent = 0): string {
|
||||
const newLine = host.getNewLine();
|
||||
while (current) {
|
||||
let result = '';
|
||||
if (indent) {
|
||||
result += newLine;
|
||||
|
||||
for (let i = 0; i < indent; i++) {
|
||||
result += ' ';
|
||||
}
|
||||
result += current.messageText;
|
||||
const position = current.position;
|
||||
if (position) {
|
||||
result += ` at ${formatDiagnosticPosition(position, host)}`;
|
||||
}
|
||||
result += chain.messageText;
|
||||
|
||||
const position = chain.position;
|
||||
// add position if available, and we are not at the depest frame
|
||||
if (position && indent !== 0) {
|
||||
result += ` at ${formatDiagnosticPosition(position, host)}`;
|
||||
}
|
||||
|
||||
indent++;
|
||||
if (chain.next) {
|
||||
for (const kid of chain.next) {
|
||||
result += flattenDiagnosticMessageChain(kid, host, indent);
|
||||
}
|
||||
current = current.next;
|
||||
indent++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const SOURCE = 'angular' as 'angular';
|
||||
export interface DiagnosticMessageChain {
|
||||
messageText: string;
|
||||
position?: Position;
|
||||
next?: DiagnosticMessageChain;
|
||||
next?: DiagnosticMessageChain[];
|
||||
}
|
||||
|
||||
export interface Diagnostic {
|
||||
|
@ -71,14 +71,14 @@ const defaultEmitCallback: TsEmitCallback =
|
||||
* Minimum supported TypeScript version
|
||||
* ∀ supported typescript version v, v >= MIN_TS_VERSION
|
||||
*/
|
||||
const MIN_TS_VERSION = '3.4.0';
|
||||
const MIN_TS_VERSION = '3.6.4';
|
||||
|
||||
/**
|
||||
* Supremum of supported TypeScript versions
|
||||
* ∀ supported typescript version v, v < MAX_TS_VERSION
|
||||
* MAX_TS_VERSION is not considered as a supported TypeScript version
|
||||
*/
|
||||
const MAX_TS_VERSION = '3.6.0';
|
||||
const MAX_TS_VERSION = '3.7.0';
|
||||
|
||||
class AngularCompilerProgram implements Program {
|
||||
private rootNames: string[];
|
||||
@ -1109,7 +1109,7 @@ function diagnosticChainFromFormattedDiagnosticChain(chain: FormattedMessageChai
|
||||
DiagnosticMessageChain {
|
||||
return {
|
||||
messageText: chain.message,
|
||||
next: chain.next && diagnosticChainFromFormattedDiagnosticChain(chain.next),
|
||||
next: chain.next && chain.next.map(diagnosticChainFromFormattedDiagnosticChain),
|
||||
position: chain.position
|
||||
};
|
||||
}
|
||||
|
@ -2533,9 +2533,12 @@ describe('i18n support in the template compiler', () => {
|
||||
$I18N_0$ = $MSG_EXTERNAL_963542717423364282$$APP_SPEC_TS_0$;
|
||||
}
|
||||
else {
|
||||
$I18N_0$ = $localize \`\n Some text\n $` +
|
||||
$I18N_0$ = $localize \`
|
||||
Some text
|
||||
$` +
|
||||
String.raw `{"\uFFFD#3\uFFFD"}:START_TAG_SPAN:Text inside span$` +
|
||||
String.raw `{"\uFFFD/#3\uFFFD"}:CLOSE_TAG_SPAN:\n \`;
|
||||
String.raw `{"\uFFFD/#3\uFFFD"}:CLOSE_TAG_SPAN:
|
||||
\`;
|
||||
}
|
||||
…
|
||||
template: function MyComponent_Template(rf, ctx) {
|
||||
|
@ -39,7 +39,8 @@ describe('expression diagnostics', () => {
|
||||
if (typeof messageText == 'string') {
|
||||
return messageText;
|
||||
} else {
|
||||
if (messageText.next) return messageText.messageText + messageToString(messageText.next);
|
||||
if (messageText.next)
|
||||
return messageText.messageText + messageText.next.map(messageToString);
|
||||
return messageText.messageText;
|
||||
}
|
||||
}
|
||||
|
@ -154,8 +154,8 @@ describe('ngc transformer command-line', () => {
|
||||
|
||||
const exitCode = main(['-p', basePath], errorSpy);
|
||||
expect(errorSpy).toHaveBeenCalledWith(
|
||||
'test.ts(3,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. ' +
|
||||
'Type \'String\' has no compatible call signatures.\n');
|
||||
'test.ts(3,9): error TS2349: This expression is not callable.\n' +
|
||||
' Type \'String\' has no call signatures.\n');
|
||||
expect(exitCode).toEqual(1);
|
||||
});
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,7 +17,7 @@ export interface Position {
|
||||
export interface FormattedMessageChain {
|
||||
message: string;
|
||||
position?: Position;
|
||||
next?: FormattedMessageChain;
|
||||
next?: FormattedMessageChain[];
|
||||
}
|
||||
|
||||
export type FormattedError = Error & {
|
||||
@ -41,9 +41,15 @@ function formatChain(chain: FormattedMessageChain | undefined, indent: number =
|
||||
'';
|
||||
const prefix = position && indent === 0 ? `${position}: ` : '';
|
||||
const postfix = position && indent !== 0 ? ` at ${position}` : '';
|
||||
const message = `${prefix}${chain.message}${postfix}`;
|
||||
let message = `${prefix}${chain.message}${postfix}`;
|
||||
|
||||
return `${indentStr(indent)}${message}${(chain.next && ('\n' + formatChain(chain.next, indent + 2))) || ''}`;
|
||||
if (chain.next) {
|
||||
for (const kid of chain.next) {
|
||||
message += '\n' + formatChain(kid, indent + 2);
|
||||
}
|
||||
}
|
||||
|
||||
return `${indentStr(indent)}${message}`;
|
||||
}
|
||||
|
||||
export function formattedError(chain: FormattedMessageChain): FormattedError {
|
||||
|
@ -1056,7 +1056,7 @@ function formatMetadataMessageChain(
|
||||
const next: FormattedMessageChain|undefined = chain.next ?
|
||||
formatMetadataMessageChain(chain.next, advise) :
|
||||
advise ? {message: advise} : undefined;
|
||||
return {message, position, next};
|
||||
return {message, position, next: next ? [next] : undefined};
|
||||
}
|
||||
|
||||
function formatMetadataError(e: Error, context: StaticSymbol): Error {
|
||||
|
@ -14,7 +14,7 @@
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.9.0",
|
||||
"tslib": "^1.10.0",
|
||||
"zone.js": "~0.10.2"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -10,7 +10,7 @@ import {ɵɵdefineBase, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefineNgMo
|
||||
import {ɵɵInheritDefinitionFeature} from './features/inherit_definition_feature';
|
||||
import {ɵɵNgOnChangesFeature} from './features/ng_onchanges_feature';
|
||||
import {ɵɵProvidersFeature} from './features/providers_feature';
|
||||
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveType, PipeDef, ɵɵBaseDef, ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ɵɵFactoryDef, ɵɵPipeDefWithMeta} from './interfaces/definition';
|
||||
import {ComponentDef, ComponentTemplate, ComponentType, DirectiveDef, DirectiveType, PipeDef, ɵɵBaseDef, ɵɵComponentDefWithMeta, ɵɵDirectiveDefWithMeta, ɵɵFactoryDef, ɵɵPipeDefWithMeta} from './interfaces/definition';
|
||||
import {getComponent, getDirectives, getHostElement, getRenderedText} from './util/discovery_utils';
|
||||
|
||||
export {ComponentFactory, ComponentFactoryResolver, ComponentRef, injectComponentFactoryResolver} from './component_ref';
|
||||
@ -207,7 +207,6 @@ export {
|
||||
ComponentTemplate,
|
||||
ComponentType,
|
||||
DirectiveDef,
|
||||
DirectiveDefFlags,
|
||||
ɵɵDirectiveDefWithMeta,
|
||||
DirectiveType,
|
||||
ɵɵNgOnChangesFeature,
|
||||
|
@ -83,10 +83,6 @@ export interface DirectiveType<T> extends Type<T> {
|
||||
ɵfac: () => T;
|
||||
}
|
||||
|
||||
export enum DirectiveDefFlags {
|
||||
ContentQuery = 0b10
|
||||
}
|
||||
|
||||
/**
|
||||
* A subclass of `Type` which has a static `ɵpipe`:`PipeDef` field making it
|
||||
* consumable for rendering.
|
||||
|
@ -225,9 +225,7 @@ export function createContainerRef(
|
||||
ngModuleRef?: viewEngine_NgModuleRef<any>|undefined): viewEngine_ComponentRef<C> {
|
||||
const contextInjector = injector || this.parentInjector;
|
||||
if (!ngModuleRef && (componentFactory as any).ngModule == null && contextInjector) {
|
||||
// FIXME: ngModuleRef is optional, so its type allows "undefined", whereas the code
|
||||
// below is passing null for the default/absent value.
|
||||
ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null as any as undefined);
|
||||
ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null) || undefined;
|
||||
}
|
||||
|
||||
const componentRef =
|
||||
|
@ -375,7 +375,7 @@ class SomeComponent {
|
||||
}, 1);
|
||||
|
||||
const compilerFactory: CompilerFactory =
|
||||
defaultPlatform.injector.get(CompilerFactory, null);
|
||||
defaultPlatform.injector.get(CompilerFactory, null) !;
|
||||
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(
|
||||
createModule([{provide: APP_INITIALIZER, useValue: () => promise, multi: true}]));
|
||||
defaultPlatform.bootstrapModuleFactory(moduleFactory).then(_ => {
|
||||
@ -385,7 +385,7 @@ class SomeComponent {
|
||||
|
||||
it('should rethrow sync errors even if the exceptionHandler is not rethrowing', async(() => {
|
||||
const compilerFactory: CompilerFactory =
|
||||
defaultPlatform.injector.get(CompilerFactory, null);
|
||||
defaultPlatform.injector.get(CompilerFactory, null) !;
|
||||
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
|
||||
[{provide: APP_INITIALIZER, useValue: () => { throw 'Test'; }, multi: true}]));
|
||||
expect(() => defaultPlatform.bootstrapModuleFactory(moduleFactory)).toThrow('Test');
|
||||
@ -397,7 +397,7 @@ class SomeComponent {
|
||||
it('should rethrow promise errors even if the exceptionHandler is not rethrowing',
|
||||
async(() => {
|
||||
const compilerFactory: CompilerFactory =
|
||||
defaultPlatform.injector.get(CompilerFactory, null);
|
||||
defaultPlatform.injector.get(CompilerFactory, null) !;
|
||||
const moduleFactory = compilerFactory.createCompiler().compileModuleSync(createModule(
|
||||
[{provide: APP_INITIALIZER, useValue: () => Promise.reject('Test'), multi: true}]));
|
||||
defaultPlatform.bootstrapModuleFactory(moduleFactory)
|
||||
|
@ -39,7 +39,6 @@ import {clearRegisteredModuleState} from '../../src/linker/ng_module_factory_reg
|
||||
|
||||
let _nextRootElementId = 0;
|
||||
|
||||
const UNDEFINED: Symbol = Symbol('UNDEFINED');
|
||||
|
||||
/**
|
||||
* @description
|
||||
@ -268,7 +267,8 @@ export class TestBedRender3 implements TestBed {
|
||||
if (token as unknown === TestBedRender3) {
|
||||
return this as any;
|
||||
}
|
||||
const result = this.testModuleRef.injector.get(token, UNDEFINED as{}, flags);
|
||||
const UNDEFINED = {};
|
||||
const result = this.testModuleRef.injector.get(token, UNDEFINED, flags);
|
||||
return result === UNDEFINED ? this.compiler.injector.get(token, notFoundValue, flags) as any :
|
||||
result;
|
||||
}
|
||||
|
@ -16,9 +16,6 @@ import {ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, TestBedStatic, Tes
|
||||
import {TestingCompiler, TestingCompilerFactory} from './test_compiler';
|
||||
|
||||
|
||||
const UNDEFINED = new Object();
|
||||
|
||||
|
||||
let _nextRootElementId = 0;
|
||||
|
||||
/**
|
||||
@ -479,6 +476,7 @@ export class TestBedViewEngine implements TestBed {
|
||||
}
|
||||
// Tests can inject things from the ng module and from the compiler,
|
||||
// but the ng module can't inject things from the compiler and vice versa.
|
||||
const UNDEFINED = {};
|
||||
const result = this._moduleRef.injector.get(token, UNDEFINED, flags);
|
||||
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue, flags) as any :
|
||||
result;
|
||||
|
@ -16,7 +16,7 @@
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,7 +17,7 @@
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -219,7 +219,7 @@ function chainDiagnostics(chain: ng.DiagnosticMessageChain): ts.DiagnosticMessag
|
||||
messageText: chain.message,
|
||||
category: ts.DiagnosticCategory.Error,
|
||||
code: 0,
|
||||
next: chain.next ? chainDiagnostics(chain.next) : undefined
|
||||
next: chain.next ? chain.next.map(chainDiagnostics) : undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ export interface DiagnosticMessageChain {
|
||||
/**
|
||||
* The next message in the chain.
|
||||
*/
|
||||
next?: DiagnosticMessageChain;
|
||||
next?: DiagnosticMessageChain[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -612,7 +612,7 @@ function spanAt(sourceFile: ts.SourceFile, line: number, column: number): Span|u
|
||||
}
|
||||
|
||||
function convertChain(chain: FormattedMessageChain): DiagnosticMessageChain {
|
||||
return {message: chain.message, next: chain.next ? convertChain(chain.next) : undefined};
|
||||
return {message: chain.message, next: chain.next ? chain.next.map(convertChain) : undefined};
|
||||
}
|
||||
|
||||
function errorToDiagnosticWithChain(error: FormattedError, span: Span): DeclarationError {
|
||||
|
@ -230,11 +230,11 @@ describe('diagnostics', () => {
|
||||
const firstPart = messageText as ts.DiagnosticMessageChain;
|
||||
expect(firstPart.messageText).toBe(`Error during template compile of 'AppComponent'`);
|
||||
const secondPart = firstPart.next !;
|
||||
expect(secondPart.messageText).toBe('Function expressions are not supported in decorators');
|
||||
const thirdPart = secondPart.next !;
|
||||
expect(thirdPart.messageText)
|
||||
expect(secondPart[0].messageText).toBe('Function expressions are not supported in decorators');
|
||||
const thirdPart = secondPart[0].next !;
|
||||
expect(thirdPart[0].messageText)
|
||||
.toBe('Consider changing the function expression into an exported function');
|
||||
expect(thirdPart.next).toBeFalsy();
|
||||
expect(thirdPart[0].next).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not throw for an invalid class', () => {
|
||||
|
@ -17,7 +17,7 @@
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"@angular/compiler": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -15,7 +15,7 @@
|
||||
"peerDependencies": {
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -19,7 +19,7 @@
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser-dynamic": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"domino": "^2.1.2",
|
||||
|
@ -628,7 +628,7 @@ class HiddenModule {
|
||||
it('using renderModuleFactory should work',
|
||||
async(inject([PlatformRef], (defaultPlatform: PlatformRef) => {
|
||||
const compilerFactory: CompilerFactory =
|
||||
defaultPlatform.injector.get(CompilerFactory, null);
|
||||
defaultPlatform.injector.get(CompilerFactory, null) !;
|
||||
const moduleFactory =
|
||||
compilerFactory.createCompiler().compileModuleSync(AsyncServerModule);
|
||||
renderModuleFactory(moduleFactory, {document: doc}).then(output => {
|
||||
@ -836,7 +836,7 @@ class HiddenModule {
|
||||
it('adds transfer script tag when using renderModuleFactory',
|
||||
async(inject([PlatformRef], (defaultPlatform: PlatformRef) => {
|
||||
const compilerFactory: CompilerFactory =
|
||||
defaultPlatform.injector.get(CompilerFactory, null);
|
||||
defaultPlatform.injector.get(CompilerFactory, null) !;
|
||||
const moduleFactory =
|
||||
compilerFactory.createCompiler().compileModuleSync(TransferStoreModule);
|
||||
renderModuleFactory(moduleFactory, {document: '<app></app>'}).then(output => {
|
||||
|
@ -18,7 +18,7 @@
|
||||
"@angular/compiler": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-webworker": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -31,7 +31,7 @@
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"rxjs": "^6.5.3",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"ng-update": {
|
||||
"packageGroup": "NG_UPDATE_PACKAGE_GROUP"
|
||||
|
@ -15,7 +15,7 @@
|
||||
"peerDependencies": {
|
||||
"@angular/core": "0.0.0-PLACEHOLDER",
|
||||
"@angular/common": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -17,7 +17,7 @@
|
||||
"@angular/compiler": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
|
||||
"@angular/platform-browser-dynamic": "0.0.0-PLACEHOLDER",
|
||||
"tslib": "^1.9.0"
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Reference in New Issue
Block a user