fix(compiler): propagate exports when upgrading metadata to v2
This commit is contained in:
parent
aa3769ba69
commit
ee2ac025ef
|
@ -189,7 +189,7 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
for (let prop in v1Metadata.metadata) {
|
for (let prop in v1Metadata.metadata) {
|
||||||
v2Metadata.metadata[prop] = v1Metadata.metadata[prop];
|
v2Metadata.metadata[prop] = v1Metadata.metadata[prop];
|
||||||
}
|
}
|
||||||
const sourceText = this.context.readFile(dtsFilePath);
|
|
||||||
const exports = this.metadataCollector.getMetadata(this.getSourceFile(dtsFilePath));
|
const exports = this.metadataCollector.getMetadata(this.getSourceFile(dtsFilePath));
|
||||||
if (exports) {
|
if (exports) {
|
||||||
for (let prop in exports.metadata) {
|
for (let prop in exports.metadata) {
|
||||||
|
@ -197,6 +197,9 @@ export class CompilerHost implements AotCompilerHost {
|
||||||
v2Metadata.metadata[prop] = exports.metadata[prop];
|
v2Metadata.metadata[prop] = exports.metadata[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (exports.exports) {
|
||||||
|
v2Metadata.exports = exports.exports;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
metadatas.push(v2Metadata);
|
metadatas.push(v2Metadata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,8 +174,9 @@ describe('CompilerHost', () => {
|
||||||
metadata: {
|
metadata: {
|
||||||
foo: {__symbolic: 'class'},
|
foo: {__symbolic: 'class'},
|
||||||
Bar: {__symbolic: 'class', members: {ngOnInit: [{__symbolic: 'method'}]}},
|
Bar: {__symbolic: 'class', members: {ngOnInit: [{__symbolic: 'method'}]}},
|
||||||
BarChild: {__symbolic: 'class', extends: {__symbolic: 'reference', name: 'Bar'}}
|
BarChild: {__symbolic: 'class', extends: {__symbolic: 'reference', name: 'Bar'}},
|
||||||
}
|
},
|
||||||
|
exports: [{from: './lib/utils2', export: ['Export']}],
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
@ -211,6 +212,7 @@ const FILES: Entry = {
|
||||||
},
|
},
|
||||||
'metadata_versions': {
|
'metadata_versions': {
|
||||||
'v1.d.ts': `
|
'v1.d.ts': `
|
||||||
|
export {Export} from './lib/utils2';
|
||||||
export declare class Bar {
|
export declare class Bar {
|
||||||
ngOnInit() {}
|
ngOnInit() {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue