fix(packages): use ES modules for primary build (#11120)
This commit is contained in:
committed by
Victor Berchet
parent
8cb1046ce9
commit
979657989b
@@ -6,10 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {ReflectorHostContext} from '@angular/compiler-cli/src/reflector_host';
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {ReflectorHostContext} from '../src/reflector_host';
|
||||
|
||||
export type Entry = string | Directory;
|
||||
|
||||
export interface Directory { [name: string]: Entry; }
|
||||
@@ -61,6 +60,15 @@ export class MockContext implements ReflectorHostContext {
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
getDirectories(path: string): string[] {
|
||||
const dir = this.getEntry(path);
|
||||
if (typeof dir !== 'object') {
|
||||
return [];
|
||||
} else {
|
||||
return Object.keys(dir).filter(key => typeof dir[key] === 'object');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function normalize(parts: string[]): string[] {
|
||||
@@ -117,4 +125,6 @@ export class MockCompilerHost implements ts.CompilerHost {
|
||||
useCaseSensitiveFileNames(): boolean { return false; }
|
||||
|
||||
getNewLine(): string { return '\n'; }
|
||||
|
||||
getDirectories(path: string): string[] { return this.context.getDirectories(path); }
|
||||
}
|
||||
|
||||
@@ -176,28 +176,28 @@ describe('StaticReflector', () => {
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '==', left: 0x22, right: 0x22})))
|
||||
.toBe(0x22 == 0x22);
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '==', left: 0x22, right: 0xF0})))
|
||||
.toBe(0x22 == 0xF0);
|
||||
.toBe(0x22 as any == 0xF0);
|
||||
});
|
||||
|
||||
it('should simplify !=', () => {
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '!=', left: 0x22, right: 0x22})))
|
||||
.toBe(0x22 != 0x22);
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '!=', left: 0x22, right: 0xF0})))
|
||||
.toBe(0x22 != 0xF0);
|
||||
.toBe(0x22 as any != 0xF0);
|
||||
});
|
||||
|
||||
it('should simplify ===', () => {
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '===', left: 0x22, right: 0x22})))
|
||||
.toBe(0x22 === 0x22);
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '===', left: 0x22, right: 0xF0})))
|
||||
.toBe(0x22 === 0xF0);
|
||||
.toBe(0x22 as any === 0xF0);
|
||||
});
|
||||
|
||||
it('should simplify !==', () => {
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '!==', left: 0x22, right: 0x22})))
|
||||
.toBe(0x22 !== 0x22);
|
||||
expect(simplify(noContext, ({__symbolic: 'binop', operator: '!==', left: 0x22, right: 0xF0})))
|
||||
.toBe(0x22 !== 0xF0);
|
||||
.toBe(0x22 as any !== 0xF0);
|
||||
});
|
||||
|
||||
it('should simplify >', () => {
|
||||
|
||||
Reference in New Issue
Block a user