fix(compiler-cli): match string indexed partial declarations (#41747)
Some partial libraries have been minified, which results in the declaration calls being being converted from property accesses to indexed accesses. This commit ensures that the linker can process these calls. Fixes #41655 PR Close #41747
This commit is contained in:
parent
7744e1e673
commit
c3a512a9e9
|
@ -139,6 +139,8 @@ function getCalleeName(call: NodePath<t.CallExpression>): string|null {
|
|||
return callee.name;
|
||||
} else if (t.isMemberExpression(callee) && t.isIdentifier(callee.property)) {
|
||||
return callee.property.name;
|
||||
} else if (t.isMemberExpression(callee) && t.isStringLiteral(callee.property)) {
|
||||
return callee.property.value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -70,9 +70,10 @@ describe('createEs2015LinkerPlugin()', () => {
|
|||
[
|
||||
'var core;',
|
||||
`ɵɵngDeclareDirective({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, x: 1});`,
|
||||
`ɵɵngDeclareComponent({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, foo: () => ɵɵngDeclareDirective({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, x: 2})});`,
|
||||
`i0.ɵɵngDeclareComponent({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, foo: () => ɵɵngDeclareDirective({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, x: 2})});`,
|
||||
`x.qux(() => ɵɵngDeclareDirective({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, x: 3}));`,
|
||||
'spread(...x);',
|
||||
`i0['ɵɵngDeclareDirective']({minVersion: '0.0.0-PLACEHOLDER', version: '0.0.0-PLACEHOLDER', ngImport: core, x: 4});`,
|
||||
].join('\n'),
|
||||
{
|
||||
plugins: [createEs2015LinkerPlugin({fileSystem, logger})],
|
||||
|
@ -93,7 +94,11 @@ describe('createEs2015LinkerPlugin()', () => {
|
|||
[
|
||||
'ɵɵngDeclareDirective',
|
||||
'{minVersion:\'0.0.0-PLACEHOLDER\',version:\'0.0.0-PLACEHOLDER\',ngImport:core,x:3}'
|
||||
]
|
||||
],
|
||||
[
|
||||
'ɵɵngDeclareDirective',
|
||||
'{minVersion:\'0.0.0-PLACEHOLDER\',version:\'0.0.0-PLACEHOLDER\',ngImport:core,x:4}'
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue