fix(compiler): update to metadata version 3 (#13464)

This change retracts support for metadata version 2.

The collector used to produce version 2 metadata was incomplete
and can cause the AOT compiler to fail to resolve symbols or
produce other spurious errors.

All libraries compiled and published with 2.3.0 ngc will need
to be recompiled and updated with this change.
This commit is contained in:
Chuck Jazdzewski
2016-12-14 15:28:51 -08:00
committed by Victor Berchet
parent a72a002a8d
commit b9b557cdb0
8 changed files with 66 additions and 59 deletions

View File

@ -17,6 +17,11 @@ import {Symbols} from './symbols';
* A set of collector options to use when collecting metadata.
*/
export class CollectorOptions {
/**
* Version of the metadata to collect.
*/
version?: number;
/**
* Collect a hidden field "$quoted$" in objects literals that record when the key was quoted in
* the source.
@ -430,7 +435,10 @@ export class MetadataCollector {
else if (strict) {
validateMetadata(sourceFile, nodeMap, metadata);
}
const result: ModuleMetadata = {__symbolic: 'module', version: VERSION, metadata};
const result: ModuleMetadata = {
__symbolic: 'module',
version: this.options.version || VERSION, metadata
};
if (exports) result.exports = exports;
return result;
}