refactor(ivy): Move instructions back to ɵɵ (#30546)

There is an encoding issue with using delta `Δ`, where the browser will attempt to detect the file encoding if the character set is not explicitly declared on a `<script/>` tag, and Chrome will find the `Δ` character and decide it is window-1252 encoding, which misinterprets the `Δ` character to be some other character that is not a valid JS identifier character

So back to the frog eyes we go.

```
    __
   /ɵɵ\
  ( -- ) - I am ineffable. I am forever.
 _/    \_
/  \  /  \
==  ==  ==
```

PR Close #30546
This commit is contained in:
Ben Lesh
2019-05-17 18:49:21 -07:00
committed by Jason Aden
parent 1c3ee41902
commit d7eaae6f22
141 changed files with 5361 additions and 5344 deletions

View File

@ -62,9 +62,9 @@ export function forwardRef<T>(fn: () => T): T {
export interface SimpleChanges { [propName: string]: any; }
export type ΔNgModuleDefWithMeta<ModuleT, DeclarationsT, ImportsT, ExportsT> = any;
export type ΔDirectiveDefWithMeta<DirT, SelectorT, ExportAsT, InputsT, OutputsT, QueriesT> = any;
export type ΔPipeDefWithMeta<PipeT, NameT> = any;
export type ɵɵNgModuleDefWithMeta<ModuleT, DeclarationsT, ImportsT, ExportsT> = any;
export type ɵɵDirectiveDefWithMeta<DirT, SelectorT, ExportAsT, InputsT, OutputsT, QueriesT> = any;
export type ɵɵPipeDefWithMeta<PipeT, NameT> = any;
export enum ViewEncapsulation {
Emulated = 0,

View File

@ -18,12 +18,12 @@ const varRegExp = (name: string): RegExp => new RegExp(`var \\w+ = \\[\"${name}\
const viewQueryRegExp = (descend: boolean, ref?: string): RegExp => {
const maybeRef = ref ? `${ref}` : `null`;
return new RegExp(`i0\\.ΔviewQuery\\(\\w+, ${descend}, ${maybeRef}\\)`);
return new RegExp(`i0\\.ɵɵviewQuery\\(\\w+, ${descend}, ${maybeRef}\\)`);
};
const contentQueryRegExp = (predicate: string, descend: boolean, ref?: string): RegExp => {
const maybeRef = ref ? `${ref}` : `null`;
return new RegExp(`i0\\.ΔcontentQuery\\(dirIndex, ${predicate}, ${descend}, ${maybeRef}\\)`);
return new RegExp(`i0\\.ɵɵcontentQuery\\(dirIndex, ${predicate}, ${descend}, ${maybeRef}\\)`);
};
const setClassMetadataRegExp = (expectedType: string): RegExp =>
@ -56,8 +56,8 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toContain('Service.ngInjectableDef =');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Dep>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Dep>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Service>;');
});
it('should compile Injectables with a generic service', () => {
@ -75,7 +75,7 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('Store.ngInjectableDef =');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Store<any>>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Store<any>>;');
});
it('should compile Injectables with providedIn without errors', () => {
@ -99,11 +99,11 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toContain('Dep.ngInjectableDef =');
expect(jsContents).toContain('Service.ngInjectableDef =');
expect(jsContents)
.toContain('return new (t || Service)(i0.Δinject(Dep)); }, providedIn: \'root\' });');
.toContain('return new (t || Service)(i0.ɵɵinject(Dep)); }, providedIn: \'root\' });');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Dep>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Dep>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Service>;');
});
it('should compile Injectables with providedIn and factory without errors', () => {
@ -128,7 +128,7 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toContain('return r; }, providedIn: \'root\' });');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Service>;');
});
it('should compile Injectables with providedIn and factory with deps without errors', () => {
@ -151,13 +151,13 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('Service.ngInjectableDef =');
expect(jsContents).toContain('factory: function Service_Factory(t) { var r = null; if (t) {');
expect(jsContents).toContain('(r = new t(i0.Δinject(Dep)));');
expect(jsContents).toContain('(r = new t(i0.ɵɵinject(Dep)));');
expect(jsContents)
.toContain('(r = (function (dep) { return new Service(dep); })(i0.Δinject(Dep)));');
.toContain('(r = (function (dep) { return new Service(dep); })(i0.ɵɵinject(Dep)));');
expect(jsContents).toContain('return r; }, providedIn: \'root\' });');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain('static ngInjectableDef: i0.ΔInjectableDef<Service>;');
expect(dtsContents).toContain('static ngInjectableDef: i0.ɵɵInjectableDef<Service>;');
});
it('should compile @Injectable with an @Optional dependency', () => {
@ -193,13 +193,13 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵɵdefineComponent');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
'static ngComponentDef: i0.ɵɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
});
it('should compile Components (dynamic inline template) without errors', () => {
@ -217,13 +217,13 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵɵdefineComponent');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
'static ngComponentDef: i0.ɵɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
});
it('should compile Components (function call inline template) without errors', () => {
@ -244,13 +244,13 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ΔdefineComponent');
expect(jsContents).toContain('TestCmp.ngComponentDef = i0.ɵɵdefineComponent');
expect(jsContents).not.toContain('__decorate');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
'static ngComponentDef: i0.ɵɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
});
it('should compile Components (external template) without errors', () => {
@ -351,13 +351,13 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('TestBase.ngBaseDef = i0.ΔdefineBase');
expect(jsContents).toContain('TestComponent.ngComponentDef = i0.ΔdefineComponent');
expect(jsContents).toContain('TestDirective.ngDirectiveDef = i0.ΔdefineDirective');
expect(jsContents).toContain('TestPipe.ngPipeDef = i0.ΔdefinePipe');
expect(jsContents).toContain('TestInjectable.ngInjectableDef = i0.ΔdefineInjectable');
expect(jsContents).toContain('MyModule.ngModuleDef = i0.ΔdefineNgModule');
expect(jsContents).toContain('MyModule.ngInjectorDef = i0.ΔdefineInjector');
expect(jsContents).toContain('TestBase.ngBaseDef = i0.ɵɵdefineBase');
expect(jsContents).toContain('TestComponent.ngComponentDef = i0.ɵɵdefineComponent');
expect(jsContents).toContain('TestDirective.ngDirectiveDef = i0.ɵɵdefineDirective');
expect(jsContents).toContain('TestPipe.ngPipeDef = i0.ɵɵdefinePipe');
expect(jsContents).toContain('TestInjectable.ngInjectableDef = i0.ɵɵdefineInjectable');
expect(jsContents).toContain('MyModule.ngModuleDef = i0.ɵɵdefineNgModule');
expect(jsContents).toContain('MyModule.ngInjectorDef = i0.ɵɵdefineInjector');
expect(jsContents).toContain('inputs: { input: "input" }');
expect(jsContents).toContain('outputs: { output: "output" }');
});
@ -442,25 +442,26 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule, bootstrap: [TestCmp] });');
expect(jsContents)
.toContain('/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { declarations: [TestCmp] });');
.toContain('i0.ɵɵdefineNgModule({ type: TestModule, bootstrap: [TestCmp] });');
expect(jsContents)
.toContain('/*@__PURE__*/ i0.ɵɵsetNgModuleScope(TestModule, { declarations: [TestCmp] });');
expect(jsContents)
.toContain(
'i0.ΔdefineInjector({ factory: ' +
'i0.ɵɵdefineInjector({ factory: ' +
'function TestModule_Factory(t) { return new (t || TestModule)(); } });');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngComponentDef: i0.ΔComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
'static ngComponentDef: i0.ɵɵComponentDefWithMeta<TestCmp, "test-cmp", never, {}, {}, never>');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], never, never>');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], never, never>');
expect(dtsContents).not.toContain('__decorate');
});
it('should not emit a ΔsetNgModuleScope call when no scope metadata is present', () => {
it('should not emit a ɵɵsetNgModuleScope call when no scope metadata is present', () => {
env.tsconfig();
env.write('test.ts', `
import {NgModule} from '@angular/core';
@ -472,8 +473,8 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).not.toContain('ΔsetNgModuleScope(TestModule,');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents).not.toContain('ɵɵsetNgModuleScope(TestModule,');
});
it('should emit the id when the module\'s id is a string', () => {
@ -488,7 +489,7 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain(`i0.ΔdefineNgModule({ type: TestModule, id: 'test' })`);
expect(jsContents).toContain(`i0.ɵɵdefineNgModule({ type: TestModule, id: 'test' })`);
});
it('should emit the id when the module\'s id is defined as `module.id`', () => {
@ -506,7 +507,7 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule, id: module.id })');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule, id: module.id })');
});
it('should filter out directives and pipes from module exports in the injector def', () => {
@ -547,15 +548,15 @@ describe('ngtsc behavioral tests', () => {
export class Comp {}
`);
env.write('node_modules/@angular/router/index.d.ts', `
import {ΔComponentDefWithMeta, ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵComponentDefWithMeta, ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class RouterComp {
static ngComponentDef: ΔComponentDefWithMeta<RouterComp, "lib-cmp", never, {}, {}, never>
static ngComponentDef: ɵɵComponentDefWithMeta<RouterComp, "lib-cmp", never, {}, {}, never>
}
declare class RouterModule {
static forRoot(): ModuleWithProviders<RouterModule>;
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, [typeof RouterComp], never, [typeof RouterComp]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<RouterModule, [typeof RouterComp], never, [typeof RouterComp]>;
}
`);
@ -564,7 +565,7 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents)
.toContain(
'i0.ΔdefineInjector({ factory: function TestModule_Factory(t) ' +
'i0.ɵɵdefineInjector({ factory: function TestModule_Factory(t) ' +
'{ return new (t || TestModule)(); }, imports: [[OtherModule, RouterModule.forRoot()],' +
'\n OtherModule,\n RouterModule] });');
});
@ -596,18 +597,18 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents)
.toContain(
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
`TestModule.ngInjectorDef = i0.ɵɵdefineInjector({ factory: ` +
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
`Token, useValue: 'test' }], imports: [[OtherModule]] });`);
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵɵInjectorDef');
});
it('should compile NgModules with factory providers without errors', () => {
@ -637,18 +638,18 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents)
.toContain(
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
`TestModule.ngInjectorDef = i0.ɵɵdefineInjector({ factory: ` +
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
`Token, useFactory: function () { return new Token(); } }], imports: [[OtherModule]] });`);
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵɵInjectorDef');
});
it('should compile NgModules with factory providers and deps without errors', () => {
@ -682,18 +683,18 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents)
.toContain(
`TestModule.ngInjectorDef = i0.ΔdefineInjector({ factory: ` +
`TestModule.ngInjectorDef = i0.ɵɵdefineInjector({ factory: ` +
`function TestModule_Factory(t) { return new (t || TestModule)(); }, providers: [{ provide: ` +
`Token, useFactory: function (dep) { return new Token(dep); }, deps: [Dep] }], imports: [[OtherModule]] });`);
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ΔInjectorDef');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, [typeof TestCmp], [typeof OtherModule], never>');
expect(dtsContents).toContain('static ngInjectorDef: i0.ɵɵInjectorDef');
});
it('should compile NgModules with references to local components', () => {
@ -854,9 +855,9 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents)
.toContain(
'TestPipe.ngPipeDef = i0.ΔdefinePipe({ name: "test-pipe", type: TestPipe, ' +
'TestPipe.ngPipeDef = i0.ɵɵdefinePipe({ name: "test-pipe", type: TestPipe, ' +
'factory: function TestPipe_Factory(t) { return new (t || TestPipe)(); }, pure: false })');
expect(dtsContents).toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe, "test-pipe">;');
expect(dtsContents).toContain('static ngPipeDef: i0.ɵɵPipeDefWithMeta<TestPipe, "test-pipe">;');
});
it('should compile pure Pipes without errors', () => {
@ -877,9 +878,9 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents)
.toContain(
'TestPipe.ngPipeDef = i0.ΔdefinePipe({ name: "test-pipe", type: TestPipe, ' +
'TestPipe.ngPipeDef = i0.ɵɵdefinePipe({ name: "test-pipe", type: TestPipe, ' +
'factory: function TestPipe_Factory(t) { return new (t || TestPipe)(); }, pure: true })');
expect(dtsContents).toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe, "test-pipe">;');
expect(dtsContents).toContain('static ngPipeDef: i0.ɵɵPipeDefWithMeta<TestPipe, "test-pipe">;');
});
it('should compile Pipes with dependencies', () => {
@ -901,7 +902,7 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('return new (t || TestPipe)(i0.ΔdirectiveInject(Dep));');
expect(jsContents).toContain('return new (t || TestPipe)(i0.ɵɵdirectiveInject(Dep));');
});
it('should compile Pipes with generic types', () => {
@ -921,7 +922,7 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toContain('TestPipe.ngPipeDef =');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain('static ngPipeDef: i0.ΔPipeDefWithMeta<TestPipe<any>, "test-pipe">;');
.toContain('static ngPipeDef: i0.ɵɵPipeDefWithMeta<TestPipe<any>, "test-pipe">;');
});
it('should include @Pipes in @NgModule scopes', () => {
@ -947,7 +948,7 @@ describe('ngtsc behavioral tests', () => {
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'i0.ΔNgModuleDefWithMeta<TestModule, [typeof TestPipe, typeof TestCmp], never, never>');
'i0.ɵɵNgModuleDefWithMeta<TestModule, [typeof TestPipe, typeof TestCmp], never, never>');
});
describe('empty and missing selectors', () => {
@ -1062,7 +1063,7 @@ describe('ngtsc behavioral tests', () => {
expect(dtsContents).toContain('ComponentDefWithMeta<TestCmp');
expect(dtsContents).toContain('DirectiveDefWithMeta<TestDir');
expect(dtsContents).toContain('PipeDefWithMeta<TestPipe');
expect(dtsContents).toContain('ΔNgModuleDefWithMeta<TestNgModule');
expect(dtsContents).toContain('ɵɵNgModuleDefWithMeta<TestNgModule');
// Validate that each class's .d.ts declaration also has an injectable definition.
expect(dtsContents).toContain('InjectableDef<TestCmp');
@ -1287,7 +1288,7 @@ describe('ngtsc behavioral tests', () => {
`);
env.driveMain();
expect(env.getContents('test.js')).toContain('i0.ΔpureFunction1');
expect(env.getContents('test.js')).toContain('i0.ɵɵpureFunction1');
});
it('should compile array literals inside function arguments', () => {
@ -1309,7 +1310,7 @@ describe('ngtsc behavioral tests', () => {
`);
env.driveMain();
expect(env.getContents('test.js')).toContain('i0.ΔpureFunction1');
expect(env.getContents('test.js')).toContain('i0.ɵɵpureFunction1');
});
});
@ -1325,11 +1326,11 @@ describe('ngtsc behavioral tests', () => {
`);
env.write('node_modules/router/index.d.ts', `
import {ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
import {ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core';
declare class RouterModule {
static forRoot(): ModuleWithProviders<RouterModule>;
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<RouterModule, never, never, never>;
}
`);
@ -1341,7 +1342,8 @@ describe('ngtsc behavioral tests', () => {
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents).toContain(`import * as i1 from "router";`);
expect(dtsContents)
.toContain('i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
.toContain(
'i0.ɵɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
});
it('should extract the generic type if it is provided as qualified type name', () => {
@ -1366,9 +1368,9 @@ describe('ngtsc behavioral tests', () => {
`);
env.write('node_modules/router/internal.d.ts', `
import {ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class InternalRouterModule {
static ngModuleDef: ΔNgModuleDefWithMeta<InternalRouterModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<InternalRouterModule, never, never, never>;
}
`);
@ -1381,18 +1383,18 @@ describe('ngtsc behavioral tests', () => {
expect(dtsContents).toContain(`import * as i1 from "router";`);
expect(dtsContents)
.toContain(
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.InternalRouterModule], never>');
'i0.ɵɵNgModuleDefWithMeta<TestModule, never, [typeof i1.InternalRouterModule], never>');
});
it('should not reference a constant with a ModuleWithProviders value in ngModuleDef imports',
() => {
env.tsconfig();
env.write('dep.d.ts', `
import {ModuleWithProviders, ΔNgModuleDefWithMeta as ΔNgModuleDefWithMeta} from '@angular/core';
import {ModuleWithProviders, ɵɵNgModuleDefWithMeta as ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class DepModule {
static forRoot(arg1: any, arg2: any): ModuleWithProviders<DepModule>;
static ngModuleDef: ΔNgModuleDefWithMeta<DepModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<DepModule, never, never, never>;
}
`);
env.write('test.ts', `
@ -1427,13 +1429,13 @@ describe('ngtsc behavioral tests', () => {
`);
env.write('node_modules/router/index.d.ts', `
import {ModuleWithProviders, ΔNgModuleDefWithMeta} from '@angular/core';
import {ModuleWithProviders, ɵɵNgModuleDefWithMeta} from '@angular/core';
export interface MyType extends ModuleWithProviders {}
declare class RouterModule {
static forRoot(): (MyType)&{ngModule:RouterModule};
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<RouterModule, never, never, never>;
}
`);
@ -1446,7 +1448,7 @@ describe('ngtsc behavioral tests', () => {
expect(dtsContents).toContain(`import * as i1 from "router";`);
expect(dtsContents)
.toContain(
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
'i0.ɵɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
});
it('should unwrap a namespace imported ModuleWithProviders function if a generic type is provided for it',
@ -1466,7 +1468,7 @@ describe('ngtsc behavioral tests', () => {
declare class RouterModule {
static forRoot(): core.ModuleWithProviders<RouterModule>;
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<RouterModule, never, never, never>;
}
`);
@ -1479,7 +1481,7 @@ describe('ngtsc behavioral tests', () => {
expect(dtsContents).toContain(`import * as i1 from "router";`);
expect(dtsContents)
.toContain(
'i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
'i0.ɵɵNgModuleDefWithMeta<TestModule, never, [typeof i1.RouterModule], never>');
});
it('should inject special types according to the metadata', () => {
@ -1517,7 +1519,7 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents)
.toContain(
`factory: function FooCmp_Factory(t) { return new (t || FooCmp)(i0.ΔinjectAttribute("test"), i0.ΔdirectiveInject(i0.ChangeDetectorRef), i0.ΔdirectiveInject(i0.ElementRef), i0.ΔdirectiveInject(i0.Injector), i0.ΔdirectiveInject(i0.Renderer2), i0.ΔdirectiveInject(i0.TemplateRef), i0.ΔdirectiveInject(i0.ViewContainerRef)); }`);
`factory: function FooCmp_Factory(t) { return new (t || FooCmp)(i0.ɵɵinjectAttribute("test"), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.TemplateRef), i0.ɵɵdirectiveInject(i0.ViewContainerRef)); }`);
});
it('should generate queries for components', () => {
@ -1547,9 +1549,9 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toMatch(varRegExp('test1'));
expect(jsContents).toMatch(varRegExp('test2'));
expect(jsContents).toMatch(varRegExp('accessor'));
// match `i0.ΔcontentQuery(dirIndex, _c1, true, TemplateRef)`
// match `i0.ɵɵcontentQuery(dirIndex, _c1, true, TemplateRef)`
expect(jsContents).toMatch(contentQueryRegExp('\\w+', true, 'TemplateRef'));
// match `i0.ΔviewQuery(_c2, true, null)`
// match `i0.ɵɵviewQuery(_c2, true, null)`
expect(jsContents).toMatch(viewQueryRegExp(true));
});
@ -1579,10 +1581,10 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).toMatch(varRegExp('test1'));
expect(jsContents).toMatch(varRegExp('test2'));
expect(jsContents).toMatch(varRegExp('accessor'));
// match `i0.ΔcontentQuery(dirIndex, _c1, true, TemplateRef)`
// match `i0.ɵɵcontentQuery(dirIndex, _c1, true, TemplateRef)`
expect(jsContents).toMatch(contentQueryRegExp('\\w+', true, 'TemplateRef'));
// match `i0.ΔviewQuery(_c2, true, null)`
// match `i0.ɵɵviewQuery(_c2, true, null)`
// Note that while ViewQuery doesn't necessarily make sense on a directive, because it doesn't
// have a view, we still need to handle it because a component could extend the directive.
expect(jsContents).toMatch(viewQueryRegExp(true));
@ -1608,11 +1610,11 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
// match `i0.ΔcontentQuery(dirIndex, TemplateRef, true, null)`
// match `i0.ɵɵcontentQuery(dirIndex, TemplateRef, true, null)`
expect(jsContents).toMatch(contentQueryRegExp('TemplateRef', true));
// match `i0.ΔcontentQuery(dirIndex, ViewContainerRef, true, null)`
// match `i0.ɵɵcontentQuery(dirIndex, ViewContainerRef, true, null)`
expect(jsContents).toMatch(contentQueryRegExp('ViewContainerRef', true));
// match `i0.ΔcontentQuery(dirIndex, _c0, true, null)`
// match `i0.ɵɵcontentQuery(dirIndex, _c0, true, null)`
expect(jsContents).toContain('_c0 = ["parens"];');
expect(jsContents).toMatch(contentQueryRegExp('_c0', true));
});
@ -1662,9 +1664,9 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick(); });
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onDocumentClick($event.target); }, false, i0.ΔresolveDocument);
i0.Δlistener("scroll", function FooCmp_scroll_HostBindingHandler($event) { return ctx.onWindowScroll(); }, false, i0.ΔresolveWindow);
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick(); });
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onDocumentClick($event.target); }, false, i0.ɵɵresolveDocument);
i0.ɵɵlistener("scroll", function FooCmp_scroll_HostBindingHandler($event) { return ctx.onWindowScroll(); }, false, i0.ɵɵresolveWindow);
}
}
`;
@ -1760,17 +1762,17 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.ΔallocHostVars(2);
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick($event); });
i0.Δlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onBodyClick($event); }, false, i0.ΔresolveBody);
i0.Δlistener("change", function FooCmp_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg1, ctx.arg2, ctx.arg3); });
i0.Δstyling(_c0);
i0.ɵɵallocHostVars(2);
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onClick($event); });
i0.ɵɵlistener("click", function FooCmp_click_HostBindingHandler($event) { return ctx.onBodyClick($event); }, false, i0.ɵɵresolveBody);
i0.ɵɵlistener("change", function FooCmp_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg1, ctx.arg2, ctx.arg3); });
i0.ɵɵstyling(_c0);
}
if (rf & 2) {
i0.ΔelementAttribute(elIndex, "hello", i0.Δbind(ctx.foo));
i0.Δproperty("prop", ctx.bar, null, true);
i0.ΔclassProp(0, ctx.someClass);
i0.ΔstylingApply();
i0.ɵɵelementAttribute(elIndex, "hello", i0.ɵɵbind(ctx.foo));
i0.ɵɵproperty("prop", ctx.bar, null, true);
i0.ɵɵclassProp(0, ctx.someClass);
i0.ɵɵstylingApply();
}
}
`;
@ -1799,7 +1801,7 @@ describe('ngtsc behavioral tests', () => {
`);
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔelementHostAttrs(["test", test])');
expect(jsContents).toContain('i0.ɵɵelementHostAttrs(["test", test])');
});
it('should accept enum values as host bindings', () => {
@ -1824,7 +1826,7 @@ describe('ngtsc behavioral tests', () => {
`);
env.driveMain();
expect(env.getContents('test.js')).toContain('"hello", i0.Δbind(ctx.foo)');
expect(env.getContents('test.js')).toContain('"hello", i0.ɵɵbind(ctx.foo)');
});
it('should generate host listeners for directives within hostBindings section', () => {
@ -1846,7 +1848,7 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function Dir_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.Δlistener("change", function Dir_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg); });
i0.ɵɵlistener("change", function Dir_change_HostBindingHandler($event) { return ctx.onChange(ctx.arg); });
}
}
`;
@ -2041,7 +2043,7 @@ describe('ngtsc behavioral tests', () => {
`);
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).not.toContain('i0.ΔelementProperty');
expect(jsContents).not.toContain('i0.ɵɵelementProperty');
});
it('should correctly recognize local symbols', () => {
@ -2296,8 +2298,8 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents)
.toContain('function Base_Factory(t) { return new (t || Base)(i0.Δinject(Dep)); }');
expect(jsContents).toContain('var \u0275Child_BaseFactory = i0.ΔgetInheritedFactory(Child)');
.toContain('function Base_Factory(t) { return new (t || Base)(i0.ɵɵinject(Dep)); }');
expect(jsContents).toContain('var \u0275Child_BaseFactory = i0.ɵɵgetInheritedFactory(Child)');
expect(jsContents)
.toContain('function Child_Factory(t) { return \u0275Child_BaseFactory(t || Child); }');
expect(jsContents)
@ -2322,7 +2324,7 @@ describe('ngtsc behavioral tests', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('var \u0275Dir_BaseFactory = i0.ΔgetInheritedFactory(Dir)');
expect(jsContents).toContain('var \u0275Dir_BaseFactory = i0.ɵɵgetInheritedFactory(Dir)');
});
it('should wrap "directives" in component metadata in a closure when forward references are present',
@ -2463,8 +2465,8 @@ describe('ngtsc behavioral tests', () => {
const jsContents = trim(env.getContents('test.js'));
expect(jsContents).toContain(`import Default from './types';`);
expect(jsContents).toContain(`import * as i1 from "./types";`);
expect(jsContents).toContain('i0.ΔdirectiveInject(Default)');
expect(jsContents).toContain('i0.ΔdirectiveInject(i1.Other)');
expect(jsContents).toContain('i0.ɵɵdirectiveInject(Default)');
expect(jsContents).toContain('i0.ɵɵdirectiveInject(i1.Other)');
expect(jsContents).toMatch(setClassMetadataRegExp('type: Default'));
expect(jsContents).toMatch(setClassMetadataRegExp('type: i1.Other'));
});
@ -2575,8 +2577,8 @@ describe('ngtsc behavioral tests', () => {
const jsContents = env.getContents('test.js');
expect(jsContents)
.toMatch(
/i\d\.ΔsetComponentScope\(NormalComponent,\s+\[NormalComponent,\s+CyclicComponent\],\s+\[\]\)/);
expect(jsContents).not.toContain('/*__PURE__*/ i0.ΔsetComponentScope');
/i\d\.ɵɵsetComponentScope\(NormalComponent,\s+\[NormalComponent,\s+CyclicComponent\],\s+\[\]\)/);
expect(jsContents).not.toContain('/*__PURE__*/ i0.ɵɵsetComponentScope');
});
it('should detect a cycle added entirely during compilation', () => {
@ -2767,14 +2769,14 @@ describe('ngtsc behavioral tests', () => {
it('should not emit multiple references to the same directive', () => {
env.tsconfig();
env.write('node_modules/external/index.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class ExternalDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
}
export declare class ExternalModule {
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
}
`);
env.write('test.ts', `
@ -2803,19 +2805,19 @@ describe('ngtsc behavioral tests', () => {
it('should import directives by their external name', () => {
env.tsconfig();
env.write('node_modules/external/index.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
import {InternalDir} from './internal';
export {InternalDir as ExternalDir} from './internal';
export declare class ExternalModule {
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof InternalDir], never, [typeof InternalDir]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<ExternalModule, [typeof InternalDir], never, [typeof InternalDir]>;
}
`);
env.write('node_modules/external/internal.d.ts', `
export declare class InternalDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<InternalDir, '[test]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<InternalDir, '[test]', never, never, never, never>;
}
`);
env.write('test.ts', `
@ -3024,14 +3026,14 @@ describe('ngtsc behavioral tests', () => {
export class Module {}
`);
env.write('node_modules/external/index.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class ExternalDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
}
export declare class ExternalModule {
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
}
`);
@ -3211,15 +3213,15 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function UnsafeAttrsDirective_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.ΔallocHostVars(6);
i0.ɵɵallocHostVars(6);
}
if (rf & 2) {
i0.ΔelementAttribute(elIndex, "href", i0.Δbind(ctx.attrHref), i0.ΔsanitizeUrlOrResourceUrl);
i0.ΔelementAttribute(elIndex, "src", i0.Δbind(ctx.attrSrc), i0.ΔsanitizeUrlOrResourceUrl);
i0.ΔelementAttribute(elIndex, "action", i0.Δbind(ctx.attrAction), i0.ΔsanitizeUrl);
i0.ΔelementAttribute(elIndex, "profile", i0.Δbind(ctx.attrProfile), i0.ΔsanitizeResourceUrl);
i0.ΔelementAttribute(elIndex, "innerHTML", i0.Δbind(ctx.attrInnerHTML), i0.ΔsanitizeHtml);
i0.ΔelementAttribute(elIndex, "title", i0.Δbind(ctx.attrSafeTitle));
i0.ɵɵelementAttribute(elIndex, "href", i0.ɵɵbind(ctx.attrHref), i0.ɵɵsanitizeUrlOrResourceUrl);
i0.ɵɵelementAttribute(elIndex, "src", i0.ɵɵbind(ctx.attrSrc), i0.ɵɵsanitizeUrlOrResourceUrl);
i0.ɵɵelementAttribute(elIndex, "action", i0.ɵɵbind(ctx.attrAction), i0.ɵɵsanitizeUrl);
i0.ɵɵelementAttribute(elIndex, "profile", i0.ɵɵbind(ctx.attrProfile), i0.ɵɵsanitizeResourceUrl);
i0.ɵɵelementAttribute(elIndex, "innerHTML", i0.ɵɵbind(ctx.attrInnerHTML), i0.ɵɵsanitizeHtml);
i0.ɵɵelementAttribute(elIndex, "title", i0.ɵɵbind(ctx.attrSafeTitle));
}
}
`;
@ -3266,15 +3268,15 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function UnsafePropsDirective_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.ΔallocHostVars(6);
i0.ɵɵallocHostVars(6);
}
if (rf & 2) {
i0.Δproperty("href", ctx.propHref, i0.ΔsanitizeUrlOrResourceUrl, true);
i0.Δproperty("src", ctx.propSrc, i0.ΔsanitizeUrlOrResourceUrl, true);
i0.Δproperty("action", ctx.propAction, i0.ΔsanitizeUrl, true);
i0.Δproperty("profile", ctx.propProfile, i0.ΔsanitizeResourceUrl, true);
i0.Δproperty("innerHTML", ctx.propInnerHTML, i0.ΔsanitizeHtml, true);
i0.Δproperty("title", ctx.propSafeTitle, null, true);
i0.ɵɵproperty("href", ctx.propHref, i0.ɵɵsanitizeUrlOrResourceUrl, true);
i0.ɵɵproperty("src", ctx.propSrc, i0.ɵɵsanitizeUrlOrResourceUrl, true);
i0.ɵɵproperty("action", ctx.propAction, i0.ɵɵsanitizeUrl, true);
i0.ɵɵproperty("profile", ctx.propProfile, i0.ɵɵsanitizeResourceUrl, true);
i0.ɵɵproperty("innerHTML", ctx.propInnerHTML, i0.ɵɵsanitizeHtml, true);
i0.ɵɵproperty("title", ctx.propSafeTitle, null, true);
}
}
`;
@ -3306,15 +3308,15 @@ describe('ngtsc behavioral tests', () => {
const hostBindingsFn = `
hostBindings: function FooCmp_HostBindings(rf, ctx, elIndex) {
if (rf & 1) {
i0.ΔallocHostVars(6);
i0.ɵɵallocHostVars(6);
}
if (rf & 2) {
i0.Δproperty("src", ctx.srcProp, null, true);
i0.Δproperty("href", ctx.hrefProp, null, true);
i0.Δproperty("title", ctx.titleProp, null, true);
i0.ΔelementAttribute(elIndex, "src", i0.Δbind(ctx.srcAttr));
i0.ΔelementAttribute(elIndex, "href", i0.Δbind(ctx.hrefAttr));
i0.ΔelementAttribute(elIndex, "title", i0.Δbind(ctx.titleAttr));
i0.ɵɵproperty("src", ctx.srcProp, null, true);
i0.ɵɵproperty("href", ctx.hrefProp, null, true);
i0.ɵɵproperty("title", ctx.titleProp, null, true);
i0.ɵɵelementAttribute(elIndex, "src", i0.ɵɵbind(ctx.srcAttr));
i0.ɵɵelementAttribute(elIndex, "href", i0.ɵɵbind(ctx.hrefAttr));
i0.ɵɵelementAttribute(elIndex, "title", i0.ɵɵbind(ctx.titleAttr));
}
}
`;
@ -3344,13 +3346,13 @@ describe('ngtsc behavioral tests', () => {
beforeEach(() => {
env.tsconfig();
env.write('node_modules/@angular/router/index.d.ts', `
import {ModuleWithProviders, ΔNgModuleDefWithMeta as ΔNgModuleDefWithMeta} from '@angular/core';
import {ModuleWithProviders, ɵɵNgModuleDefWithMeta as ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare var ROUTES;
export declare class RouterModule {
static forRoot(arg1: any, arg2: any): ModuleWithProviders<RouterModule>;
static forChild(arg1: any): ModuleWithProviders<RouterModule>;
static ngModuleDef: ΔNgModuleDefWithMeta<RouterModule, never, never, never>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<RouterModule, never, never, never>;
}
`);
});
@ -3980,24 +3982,24 @@ export const Foo = Foo__PRE_R3__;
// 'alpha' declares the directive which will ultimately be imported.
env.write('alpha.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class ExternalDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
}
export declare class AlphaModule {
static ngModuleDef: ΔNgModuleDefWithMeta<AlphaModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<AlphaModule, [typeof ExternalDir], never, [typeof ExternalDir]>;
}
`);
// 'beta' re-exports AlphaModule from alpha.
env.write('beta.d.ts', `
import {ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵNgModuleDefWithMeta} from '@angular/core';
import {AlphaModule} from './alpha';
export declare class BetaModule {
static ngModuleDef: ΔNgModuleDefWithMeta<AlphaModule, never, never, [typeof AlphaModule]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<AlphaModule, never, never, [typeof AlphaModule]>;
}
`);
@ -4029,26 +4031,26 @@ export const Foo = Foo__PRE_R3__;
it('should write alias ES2015 exports for NgModule exported directives', () => {
env.tsconfig({'_useHostForImportGeneration': true});
env.write('external.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
import {LibModule} from './lib';
export declare class ExternalDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<ExternalDir, '[test]', never, never, never, never>;
}
export declare class ExternalModule {
static ngModuleDef: ΔNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir, typeof LibModule]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<ExternalModule, [typeof ExternalDir], never, [typeof ExternalDir, typeof LibModule]>;
}
`);
env.write('lib.d.ts', `
import {ΔDirectiveDefWithMeta, ΔNgModuleDefWithMeta} from '@angular/core';
import {ɵɵDirectiveDefWithMeta, ɵɵNgModuleDefWithMeta} from '@angular/core';
export declare class LibDir {
static ngDirectiveDef: ΔDirectiveDefWithMeta<LibDir, '[lib]', never, never, never, never>;
static ngDirectiveDef: ɵɵDirectiveDefWithMeta<LibDir, '[lib]', never, never, never, never>;
}
export declare class LibModule {
static ngModuleDef: ΔNgModuleDefWithMeta<LibModule, [typeof LibDir], never, [typeof LibDir]>;
static ngModuleDef: ɵɵNgModuleDefWithMeta<LibModule, [typeof LibDir], never, [typeof LibDir]>;
}
`);
env.write('foo.ts', `

View File

@ -36,15 +36,15 @@ describe('ngtsc module scopes', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents)
.toContain(
'/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { imports: [OtherModule] });');
'/*@__PURE__*/ i0.ɵɵsetNgModuleScope(TestModule, { imports: [OtherModule] });');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, never, [typeof OtherModule], never>');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, never, [typeof OtherModule], never>');
});
it('should produce an error when an invalid class is imported', () => {
@ -98,15 +98,15 @@ describe('ngtsc module scopes', () => {
env.driveMain();
const jsContents = env.getContents('test.js');
expect(jsContents).toContain('i0.ΔdefineNgModule({ type: TestModule });');
expect(jsContents).toContain('i0.ɵɵdefineNgModule({ type: TestModule });');
expect(jsContents)
.toContain(
'/*@__PURE__*/ i0.ΔsetNgModuleScope(TestModule, { exports: [OtherModule] });');
'/*@__PURE__*/ i0.ɵɵsetNgModuleScope(TestModule, { exports: [OtherModule] });');
const dtsContents = env.getContents('test.d.ts');
expect(dtsContents)
.toContain(
'static ngModuleDef: i0.ΔNgModuleDefWithMeta<TestModule, never, never, [typeof OtherModule]>');
'static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<TestModule, never, never, [typeof OtherModule]>');
});
it('should produce an error when a non-NgModule class is exported', () => {

View File

@ -23,17 +23,17 @@ describe('template source-mapping', () => {
it('should map simple element with content', () => {
const mappings = compileAndMap('<h1>Heading 1</h1>');
expect(mappings).toContain(
{source: '<h1>', generated: 'i0.ΔelementStart(0, "h1")', sourceUrl: '../test.ts'});
{source: '<h1>', generated: 'i0.ɵɵelementStart(0, "h1")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: 'Heading 1', generated: 'i0.Δtext(1, "Heading 1")', sourceUrl: '../test.ts'});
{source: 'Heading 1', generated: 'i0.ɵɵtext(1, "Heading 1")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '</h1>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</h1>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map void element', () => {
const mappings = compileAndMap('<hr>');
expect(mappings).toContain(
{source: '<hr>', generated: 'i0.Δelement(0, "hr")', sourceUrl: '../test.ts'});
{source: '<hr>', generated: 'i0.ɵɵelement(0, "hr")', sourceUrl: '../test.ts'});
});
});
@ -41,40 +41,40 @@ describe('template source-mapping', () => {
it('should map a mix of interpolated and static content', () => {
const mappings = compileAndMap('<h3>Hello {{ name }}</h3>');
expect(mappings).toContain(
{source: '<h3>', generated: 'i0.ΔelementStart(0, "h3")', sourceUrl: '../test.ts'});
{source: '<h3>', generated: 'i0.ɵɵelementStart(0, "h3")', sourceUrl: '../test.ts'});
expect(mappings).toContain({
source: 'Hello {{ name }}',
generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("Hello ", ctx.name, ""))',
generated: 'i0.ɵɵtextBinding(1, i0.ɵɵinterpolation1("Hello ", ctx.name, ""))',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: '</h3>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</h3>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map a complex interpolated expression', () => {
const mappings = compileAndMap('<h2>{{ greeting + " " + name }}</h2>');
expect(mappings).toContain(
{source: '<h2>', generated: 'i0.ΔelementStart(0, "h2")', sourceUrl: '../test.ts'});
{source: '<h2>', generated: 'i0.ɵɵelementStart(0, "h2")', sourceUrl: '../test.ts'});
expect(mappings).toContain({
source: '{{ greeting + " " + name }}',
generated:
'i0.ΔtextBinding(1, i0.Δinterpolation1("", ctx.greeting + " " + ctx.name, ""))',
'i0.ɵɵtextBinding(1, i0.ɵɵinterpolation1("", ctx.greeting + " " + ctx.name, ""))',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: '</h2>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</h2>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map interpolated properties', () => {
const mappings = compileAndMap('<div id="{{name}}"></div>');
expect(mappings).toContain({
source: '<div id="{{name}}"></div>',
generated: 'i0.Δelement(0, "div", _c0)',
generated: 'i0.ɵɵelement(0, "div", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: 'id="{{name}}"',
generated: 'i0.ΔpropertyInterpolate("id", ctx.name)',
generated: 'i0.ɵɵpropertyInterpolate("id", ctx.name)',
sourceUrl: '../test.ts'
});
});
@ -82,15 +82,15 @@ describe('template source-mapping', () => {
it('should map interpolation with pipe', () => {
const mappings = compileAndMap('<div>{{200.3 | percent : 2 }}</div>');
expect(mappings).toContain(
{source: '<div>', generated: 'i0.ΔelementStart(0, "div")', sourceUrl: '../test.ts'});
{source: '<div>', generated: 'i0.ɵɵelementStart(0, "div")', sourceUrl: '../test.ts'});
expect(mappings).toContain({
source: '{{200.3 | percent : 2 }}',
generated:
'i0.ΔtextBinding(1, i0.Δinterpolation1("", i0.ΔpipeBind2(2, 1, 200.3, 2), ""))',
'i0.ɵɵtextBinding(1, i0.ɵɵinterpolation1("", i0.ɵɵpipeBind2(2, 1, 200.3, 2), ""))',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
});
@ -99,12 +99,12 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('<div [attr]="name"></div>');
expect(mappings).toContain({
source: '<div [attr]="name"></div>',
generated: 'i0.Δelement(0, "div", _c0)',
generated: 'i0.ɵɵelement(0, "div", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: '[attr]="name"',
generated: 'i0.Δproperty("attr", ctx.name)',
generated: 'i0.ɵɵproperty("attr", ctx.name)',
sourceUrl: '../test.ts'
});
});
@ -114,12 +114,12 @@ describe('template source-mapping', () => {
expect(mappings).toContain({
source: '<div [attr]="greeting + name"></div>',
generated: 'i0.Δelement(0, "div", _c0)',
generated: 'i0.ɵɵelement(0, "div", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: '[attr]="greeting + name"',
generated: 'i0.Δproperty("attr", ctx.greeting + ctx.name)',
generated: 'i0.ɵɵproperty("attr", ctx.greeting + ctx.name)',
sourceUrl: '../test.ts'
});
});
@ -128,12 +128,12 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('<div bind-attr="name"></div>');
expect(mappings).toContain({
source: '<div bind-attr="name"></div>',
generated: 'i0.Δelement(0, "div", _c0)',
generated: 'i0.ɵɵelement(0, "div", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: 'bind-attr="name"',
generated: 'i0.Δproperty("attr", ctx.name)',
generated: 'i0.ɵɵproperty("attr", ctx.name)',
sourceUrl: '../test.ts'
});
});
@ -142,15 +142,15 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('<button (click)="doSomething()">Do it</button>');
expect(mappings).toContain({
source: '<button (click)="doSomething()">',
generated: 'i0.ΔelementStart(0, "button", _c0)',
generated: 'i0.ɵɵelementStart(0, "button", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: 'Do it', generated: 'i0.Δtext(1, "Do it")', sourceUrl: '../test.ts'});
{source: 'Do it', generated: 'i0.ɵɵtext(1, "Do it")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: 'doSomething()', generated: 'ctx.doSomething()', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</button>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map a complex output binding expression', () => {
@ -158,11 +158,11 @@ describe('template source-mapping', () => {
compileAndMap(`<button (click)="items.push('item' + items.length)">Add Item</button>`);
expect(mappings).toContain({
source: `<button (click)="items.push('item' + items.length)">`,
generated: 'i0.ΔelementStart(0, "button", _c0)',
generated: 'i0.ɵɵelementStart(0, "button", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: 'Add Item', generated: 'i0.Δtext(1, "Add Item")', sourceUrl: '../test.ts'});
{source: 'Add Item', generated: 'i0.ɵɵtext(1, "Add Item")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: 'items.push(', generated: 'ctx.items.push(', sourceUrl: '../test.ts'});
expect(mappings).toContain(
@ -173,41 +173,41 @@ describe('template source-mapping', () => {
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</button>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map a longhand output binding expression', () => {
const mappings = compileAndMap('<button on-click="doSomething()">Do it</button>');
expect(mappings).toContain({
source: '<button on-click="doSomething()">',
generated: 'i0.ΔelementStart(0, "button", _c0)',
generated: 'i0.ɵɵelementStart(0, "button", _c0)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: 'Do it', generated: 'i0.Δtext(1, "Do it")', sourceUrl: '../test.ts'});
{source: 'Do it', generated: 'i0.ɵɵtext(1, "Do it")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: 'doSomething()', generated: 'ctx.doSomething()', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '</button>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</button>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
it('should map a two-way binding expression', () => {
const mappings = compileAndMap('Name: <input [(ngModel)]="name">');
expect(mappings).toContain({
source: '<input [(ngModel)]="name">',
generated: 'i0.ΔelementStart(1, "input", _c0)',
generated: 'i0.ɵɵelementStart(1, "input", _c0)',
sourceUrl: '../test.ts'
});
// TODO: improve mappings here
expect(mappings).toContain({
source: '[(ngModel)]="name"',
generated:
'i0.Δlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
'i0.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: '<input [(ngModel)]="name">',
generated: 'i0.ΔelementEnd()',
generated: 'i0.ɵɵelementEnd()',
sourceUrl: '../test.ts'
});
});
@ -216,19 +216,19 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('Name: <input bindon-ngModel="name">');
expect(mappings).toContain({
source: '<input bindon-ngModel="name">',
generated: 'i0.ΔelementStart(1, "input", _c0)',
generated: 'i0.ɵɵelementStart(1, "input", _c0)',
sourceUrl: '../test.ts'
});
// TODO: improve mappings here
expect(mappings).toContain({
source: 'bindon-ngModel="name"',
generated:
'i0.Δlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
'i0.ɵɵlistener("ngModelChange", function TestCmp_Template_input_ngModelChange_1_listener($event) { return ctx.name = $event; })',
sourceUrl: '../test.ts'
});
expect(mappings).toContain({
source: '<input bindon-ngModel="name">',
generated: 'i0.ΔelementEnd()',
generated: 'i0.ɵɵelementEnd()',
sourceUrl: '../test.ts'
});
});
@ -237,17 +237,17 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('<div [class.initial]="isInitial">Message</div>');
expect(mappings).toContain({
source: '<div [class.initial]="isInitial">',
generated: 'i0.ΔelementStart(0, "div")',
generated: 'i0.ɵɵelementStart(0, "div")',
sourceUrl: '../test.ts'
});
// TODO: Add better mappings for binding
expect(mappings).toContain(
{source: 'Message', generated: 'i0.Δtext(1, "Message")', sourceUrl: '../test.ts'});
{source: 'Message', generated: 'i0.ɵɵtext(1, "Message")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
});
@ -257,20 +257,20 @@ describe('template source-mapping', () => {
expect(mappings).toContain({
source: '<div *ngIf="showMessage()">',
generated: 'i0.ΔelementStart(0, "div")',
generated: 'i0.ɵɵelementStart(0, "div")',
sourceUrl: '../test.ts'
});
// TODO - map the bindings better
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
// expect(mappings).toContain({
// source: '{{ name }}',
// generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("", ctx_r0.name, ""))',
// generated: 'i0.ɵɵtextBinding(1, i0.ɵɵinterpolation1("", ctx_r0.name, ""))',
// sourceUrl: '../test.ts'
// });
});
@ -283,18 +283,18 @@ describe('template source-mapping', () => {
`</ng-template>`);
expect(mappings).toContain(
{source: '<div>', generated: 'i0.ΔelementStart(0, "div")', sourceUrl: '../test.ts'});
{source: '<div>', generated: 'i0.ɵɵelementStart(0, "div")', sourceUrl: '../test.ts'});
// TODO - map the bindings better
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
// TODO: the `ctx_r...` appears to be dependent upon previous tests!!!
// expect(mappings).toContain({
// source: '{{ name }}',
// generated: 'i0.ΔtextBinding(1, i0.Δinterpolation1("", ctx_r0.name, ""))',
// generated: 'i0.ɵɵtextBinding(1, i0.ɵɵinterpolation1("", ctx_r0.name, ""))',
// sourceUrl: '../test.ts'
// });
});
@ -305,14 +305,14 @@ describe('template source-mapping', () => {
expect(mappings).toContain({
source: '<div *ngFor="let item of items; index as i; trackBy: trackByFn">',
generated: 'i0.ΔelementStart(0, "div")',
generated: 'i0.ɵɵelementStart(0, "div")',
sourceUrl: '../test.ts'
});
// TODO - map the bindings better
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
@ -331,20 +331,20 @@ describe('template source-mapping', () => {
`<div><ng-content></ng-content></div>`);
expect(mappings).toContain(
{source: '<h3>', generated: 'i0.ΔelementStart(0, "h3")', sourceUrl: '../test.ts'});
{source: '<h3>', generated: 'i0.ɵɵelementStart(0, "h3")', sourceUrl: '../test.ts'});
expect(mappings).toContain({
source: '<ng-content select="title">',
generated: 'i0.Δprojection(1, 1)',
generated: 'i0.ɵɵprojection(1, 1)',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{source: '</h3>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</h3>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '<div>', generated: 'i0.ΔelementStart(2, "div")', sourceUrl: '../test.ts'});
{source: '<div>', generated: 'i0.ɵɵelementStart(2, "div")', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '<ng-content>', generated: 'i0.Δprojection(3)', sourceUrl: '../test.ts'});
{source: '<ng-content>', generated: 'i0.ɵɵprojection(3)', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{source: '</div>', generated: 'i0.ΔelementEnd()', sourceUrl: '../test.ts'});
{source: '</div>', generated: 'i0.ɵɵelementEnd()', sourceUrl: '../test.ts'});
});
});
@ -353,24 +353,24 @@ describe('template source-mapping', () => {
// Creation mode
expect(mappings).toContain(
{generated: 'i0.ΔelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
expect(mappings).toContain({
generated: 'i0.Δtext(1, "this is a test")',
generated: 'i0.ɵɵtext(1, "this is a test")',
source: 'this is a test',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.ΔelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
// Update mode
expect(mappings).toContain({
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", 1 + 2, ""))',
generated: 'i0.ɵɵtextBinding(3, i0.ɵɵinterpolation1("", 1 + 2, ""))',
source: '{{ 1 + 2 }}',
sourceUrl: '../test.ts'
});
@ -381,24 +381,24 @@ describe('template source-mapping', () => {
// Creation mode
expect(mappings).toContain(
{generated: 'i0.ΔelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementStart(0, "div")', source: '<div>', sourceUrl: '../test.ts'});
expect(mappings).toContain({
generated: 'i0.Δtext(1, "this is a test")',
generated: 'i0.ɵɵtext(1, "this is a test")',
source: 'this is a test',
sourceUrl: '../test.ts'
});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.ΔelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementStart(2, "div")', source: '<div>', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../test.ts'});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../test.ts'});
// Update mode
expect(mappings).toContain({
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", 1 + 2, ""))',
generated: 'i0.ɵɵtextBinding(3, i0.ɵɵinterpolation1("", 1 + 2, ""))',
source: '{{ 1 + 2 }}',
sourceUrl: '../test.ts'
});
@ -410,7 +410,7 @@ describe('template source-mapping', () => {
const mappings = compileAndMap('<div class=\\"some-class\\">this is a test</div>');
expect(mappings).toContain({
generated: 'i0.ΔelementStart(0, "div", _c0)',
generated: 'i0.ɵɵelementStart(0, "div", _c0)',
source: '<div class=\\"some-class\\">',
sourceUrl: '../test.ts'
});
@ -429,30 +429,30 @@ describe('template source-mapping', () => {
// Creation mode
expect(mappings).toContain({
generated: 'i0.ΔelementStart(0, "div")',
generated: 'i0.ɵɵelementStart(0, "div")',
source: '<div>',
sourceUrl: '../dir/test.html'
});
expect(mappings).toContain({
generated: 'i0.Δtext(1, "this is a test")',
generated: 'i0.ɵɵtext(1, "this is a test")',
source: 'this is a test',
sourceUrl: '../dir/test.html'
});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
expect(mappings).toContain({
generated: 'i0.ΔelementStart(2, "div")',
generated: 'i0.ɵɵelementStart(2, "div")',
source: '<div>',
sourceUrl: '../dir/test.html'
});
expect(mappings).toContain(
{generated: 'i0.Δtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../dir/test.html'});
{generated: 'i0.ɵɵtext(3)', source: '{{ 1 + 2 }}', sourceUrl: '../dir/test.html'});
expect(mappings).toContain(
{generated: 'i0.ΔelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
{generated: 'i0.ɵɵelementEnd()', source: '</div>', sourceUrl: '../dir/test.html'});
// Update mode
expect(mappings).toContain({
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", 1 + 2, ""))',
generated: 'i0.ɵɵtextBinding(3, i0.ɵɵinterpolation1("", 1 + 2, ""))',
source: '{{ 1 + 2 }}',
sourceUrl: '../dir/test.html'
});
@ -464,39 +464,39 @@ describe('template source-mapping', () => {
// Creation mode
expect(mappings).toContain({
generated: 'i0.ΔelementStart(0, "div")',
generated: 'i0.ɵɵelementStart(0, "div")',
source: '<div>',
sourceUrl: '../extraRootDir/test.html'
});
expect(mappings).toContain({
generated: 'i0.Δtext(1, "this is a test")',
generated: 'i0.ɵɵtext(1, "this is a test")',
source: 'this is a test',
sourceUrl: '../extraRootDir/test.html'
});
expect(mappings).toContain({
generated: 'i0.ΔelementEnd()',
generated: 'i0.ɵɵelementEnd()',
source: '</div>',
sourceUrl: '../extraRootDir/test.html'
});
expect(mappings).toContain({
generated: 'i0.ΔelementStart(2, "div")',
generated: 'i0.ɵɵelementStart(2, "div")',
source: '<div>',
sourceUrl: '../extraRootDir/test.html'
});
expect(mappings).toContain({
generated: 'i0.Δtext(3)',
generated: 'i0.ɵɵtext(3)',
source: '{{ 1 + 2 }}',
sourceUrl: '../extraRootDir/test.html'
});
expect(mappings).toContain({
generated: 'i0.ΔelementEnd()',
generated: 'i0.ɵɵelementEnd()',
source: '</div>',
sourceUrl: '../extraRootDir/test.html'
});
// Update mode
expect(mappings).toContain({
generated: 'i0.ΔtextBinding(3, i0.Δinterpolation1("", 1 + 2, ""))',
generated: 'i0.ɵɵtextBinding(3, i0.ɵɵinterpolation1("", 1 + 2, ""))',
source: '{{ 1 + 2 }}',
sourceUrl: '../extraRootDir/test.html'
});

View File

@ -34,17 +34,17 @@ export declare class IndexPipe {
export declare class NgForOf<T> {
ngForOf: T[];
static ngTemplateContextGuard<T>(dir: NgForOf<T>, ctx: any): ctx is NgForOfContext<T>;
static ngDirectiveDef: i0.ΔDirectiveDefWithMeta<NgForOf<any>, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>;
static ngDirectiveDef: i0.ɵɵDirectiveDefWithMeta<NgForOf<any>, '[ngFor][ngForOf]', never, {'ngForOf': 'ngForOf'}, {}, never>;
}
export declare class NgIf {
ngIf: any;
static ngTemplateGuard_ngIf: 'binding';
static ngDirectiveDef: i0.ΔDirectiveDefWithMeta<NgForOf<any>, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>;
static ngDirectiveDef: i0.ɵɵDirectiveDefWithMeta<NgForOf<any>, '[ngIf]', never, {'ngIf': 'ngIf'}, {}, never>;
}
export declare class CommonModule {
static ngModuleDef: i0.ΔNgModuleDefWithMeta<CommonModule, [typeof NgIf, typeof NgForOf, typeof IndexPipe], never, [typeof NgIf, typeof NgForOf, typeof IndexPipe]>;
static ngModuleDef: i0.ɵɵNgModuleDefWithMeta<CommonModule, [typeof NgIf, typeof NgForOf, typeof IndexPipe], never, [typeof NgIf, typeof NgForOf, typeof IndexPipe]>;
}
`);
}