feat(build): Added a version stamp in .metadata.json files.
Also modified StaticReflector to handle multiple versions in a single .metadata.json file. Fixes #8974 Closes #8981
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {Evaluator, ImportMetadata, ImportSpecifierMetadata, isPrimitive} from './evaluator';
|
||||
import {ClassMetadata, ConstructorMetadata, ModuleMetadata, MemberMetadata, MetadataError, MetadataMap, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, isMetadataError, isMetadataSymbolicReferenceExpression,} from './schema';
|
||||
import {ClassMetadata, ConstructorMetadata, ModuleMetadata, MemberMetadata, MetadataError, MetadataMap, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, isMetadataError, isMetadataSymbolicReferenceExpression, VERSION} from './schema';
|
||||
import {Symbols} from './symbols';
|
||||
|
||||
/**
|
||||
@ -207,6 +207,6 @@ export class MetadataCollector {
|
||||
}
|
||||
});
|
||||
|
||||
return metadata && {__symbolic: 'module', metadata};
|
||||
return metadata && {__symbolic: 'module', version: VERSION, metadata};
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,17 @@
|
||||
// Metadata Schema
|
||||
|
||||
// If you make a backwards incompatible change to the schema, increment the VERSION number.
|
||||
|
||||
// If you make a backwards compatible change to the metadata (such as adding an option field) then
|
||||
// leave VERSION the same. If possible, as many versions of the metadata that can represent the
|
||||
// semantics of the file in an array. For example, when generating a version 2 file, if version 1
|
||||
// can accurately represent the metadata, generate both version 1 and version 2 in an array.
|
||||
|
||||
export const VERSION = 1;
|
||||
|
||||
export interface ModuleMetadata {
|
||||
__symbolic: 'module';
|
||||
version: number;
|
||||
metadata: {[name: string]: (ClassMetadata | MetadataValue)};
|
||||
}
|
||||
export function isModuleMetadata(value: any): value is ModuleMetadata {
|
||||
|
Reference in New Issue
Block a user