Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b7291c9
feat(ivy): use the ReflectionHost to resolve parameters and initializers
alxhub Jul 20, 2018
aff6b54
feat(ivy): implement `getDefinitionOfFunction` on ES2015 and ES5 refl…
petebacondarwin Jul 25, 2018
bd830ec
fix(ivy): allow `FunctionExpression` to indicate a method declaration
petebacondarwin Jul 16, 2018
dd09cae
refactor(ivy): remove unused arg from ngcc `Analyzer`
gkalpak Jul 24, 2018
65b5927
feat(ivy): add support for esm2015 and esm5 in ngcc `PackageParser`
gkalpak Jul 24, 2018
b07ef6a
fix(ivy): correctly detect classes in ngcc `Esm5ReflectionHost`
gkalpak Jul 25, 2018
9c36a1c
feat(ivy): enable processing of esm5 format in ngcc
gkalpak Jul 25, 2018
8f44731
refactor(ivy): minor refactorings
gkalpak Jul 26, 2018
df1e2e4
refactor(ivy): make `ReflectionHost` a parameter of `Renderer`
gkalpak Jul 27, 2018
86e8557
feat(ivy): support custom prefix for imports in `DtsFileTransformer`
gkalpak Jul 26, 2018
4aec807
refactor(ivy): export ngcc import prefix into constant
gkalpak Jul 26, 2018
3ede97f
refactor(ivy): rename spec files to match corresponding source files
gkalpak Jul 30, 2018
ea86cbe
test(ivy): clean up ngcc spec
gkalpak Jul 30, 2018
4907717
feat(ivy): support getting the corresponding `.d.ts` file in ngcc
gkalpak Jul 30, 2018
346a619
refactor(ivy): minor re-organization of ngcc `PackageTransformer#tran…
gkalpak Jul 30, 2018
5e7c24d
feat(ivy): add support for typings in ngcc
gkalpak Jul 30, 2018
b5761fb
fix(ivy): emit generic types when needed in defs in .d.ts file
alxhub Aug 9, 2018
80af50a
test(ivy): add an integration test for ngcc
alxhub Aug 9, 2018
098e066
refactor(ivy): rename `Esm2015ReflectionHost` to `Fesm2015ReflectionH…
petebacondarwin Aug 22, 2018
52a19b9
feat(ivy): implement `Esm5ReflectionHost.getGenericArityOfClass()`
petebacondarwin Aug 22, 2018
09a5db5
fix(ivy): ngcc is resilient to bad source-map comments
petebacondarwin Jul 17, 2018
432ee2e
feat(ivy): compile all package formats in ngcc
petebacondarwin Aug 8, 2018
94fc118
feat(ivy): find all packages to be compiled by ngcc
petebacondarwin Aug 9, 2018
950639c
fix(ivy): ensure factory statements are emitted correctly
alxhub Aug 10, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions integration/ngcc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "angular-integration",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/http": "file:../../dist/packages-dist/http",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/router": "file:../../dist/packages-dist/router",
"@types/node": "^9.4.0",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "file:../../node_modules/typescript",
"zone.js": "file:../../node_modules/zone.js"
},
"devDependencies": {
"@types/jasmine": "2.5.41",
"concurrently": "3.4.0",
"lite-server": "2.2.2",
"protractor": "file:../../node_modules/protractor"
},
"scripts": {
"test": "./test.sh"
}
}
20 changes: 20 additions & 0 deletions integration/ngcc/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Component, NgModule, ɵrenderComponent as renderComponent} from '@angular/core';
import {CommonModule} from '@angular/common';
@Component({
selector: 'hello-world',
template: `
<button (click)="visible = true">See Message</button>
<h2 *ngIf="visible">Hello World</h2>
`,
})
class HelloWorld {
visible = false;
}

@NgModule({
declarations: [HelloWorld],
imports: [CommonModule],
})
class Module {}

renderComponent(HelloWorld);
11 changes: 11 additions & 0 deletions integration/ngcc/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e -x

PATH=$PATH:$(npm bin)

ivy-ngcc fesm2015,esm2015
ngc -p tsconfig-app.json

# Look for correct output
grep "directives: \[\S*\.NgIf\]" dist/src/main.js > /dev/null
19 changes: 19 additions & 0 deletions integration/ngcc/tsconfig-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"lib": ["es2015", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": "dist",
"types": ["node"],
"rootDir": "."
},
"files": [
"src/main.ts"
],
"angularCompilerOptions": {
"enableIvy": "ngtsc"
}
}
5 changes: 3 additions & 2 deletions packages/compiler-cli/src/metadata/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
import * as path from 'path';
import * as ts from 'typescript';

import {MetadataCollector} from '../metadata/collector';
import {ClassMetadata, ConstructorMetadata, FunctionMetadata, METADATA_VERSION, MemberMetadata, MetadataEntry, MetadataError, MetadataImportedSymbolReferenceExpression, MetadataMap, MetadataObject, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, ModuleExportMetadata, ModuleMetadata, isClassMetadata, isConstructorMetadata, isFunctionMetadata, isInterfaceMetadata, isMetadataError, isMetadataGlobalReferenceExpression, isMetadataImportedSymbolReferenceExpression, isMetadataModuleReferenceExpression, isMetadataSymbolicExpression, isMethodMetadata} from '../metadata/schema';
import {MetadataCache} from '../transformers/metadata_cache';

import {MetadataCollector} from './collector';
import {ClassMetadata, ConstructorMetadata, FunctionMetadata, METADATA_VERSION, MemberMetadata, MetadataEntry, MetadataError, MetadataImportedSymbolReferenceExpression, MetadataMap, MetadataObject, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, ModuleExportMetadata, ModuleMetadata, isClassMetadata, isConstructorMetadata, isFunctionMetadata, isInterfaceMetadata, isMetadataError, isMetadataGlobalReferenceExpression, isMetadataImportedSymbolReferenceExpression, isMetadataModuleReferenceExpression, isMetadataSymbolicExpression, isMethodMetadata} from './schema';



// The character set used to produce private names.
Expand Down
5 changes: 2 additions & 3 deletions packages/compiler-cli/src/ngcc/src/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Analyzer {
analyzeFile(file: ParsedFile): AnalyzedFile {
const constantPool = new ConstantPool();
const analyzedClasses =
file.decoratedClasses.map(clazz => this.analyzeClass(file.sourceFile, constantPool, clazz))
file.decoratedClasses.map(clazz => this.analyzeClass(constantPool, clazz))
.filter(isDefined);

return {
Expand All @@ -75,8 +75,7 @@ export class Analyzer {
};
}

protected analyzeClass(file: ts.SourceFile, pool: ConstantPool, clazz: ParsedClass): AnalyzedClass
|undefined {
protected analyzeClass(pool: ConstantPool, clazz: ParsedClass): AnalyzedClass|undefined {
const matchingHandlers = this.handlers
.map(handler => ({
handler,
Expand Down
9 changes: 9 additions & 0 deletions packages/compiler-cli/src/ngcc/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export const IMPORT_PREFIX = 'ɵngcc';
32 changes: 32 additions & 0 deletions packages/compiler-cli/src/ngcc/src/host/dts_mapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {relative, resolve} from 'path';

/**
* Map source files to their associated typings definitions files.
*/
export class DtsMapper {
constructor(private sourceRoot: string, private dtsRoot: string) {}

/**
* Given the absolute path to a source file, return the absolute path to the corresponding `.d.ts`
* file. Assume that source files and `.d.ts` files have the same directory layout and the names
* of the `.d.ts` files can be derived by replacing the `.js` extension of the source file with
* `.d.ts`.
*
* @param sourceFileName The absolute path to the source file whose corresponding `.d.ts` file
* should be returned.
*
* @returns The absolute path to the `.d.ts` file that corresponds to the specified source file.
*/
getDtsFileNameFor(sourceFileName: string): string {
const relativeSourcePath = relative(this.sourceRoot, sourceFileName);
return resolve(this.dtsRoot, relativeSourcePath).replace(/\.js$/, '.d.ts');
}
}
Loading