refactor(ngcc): remove private declaration aliases (#34254)
Now that the source to typings matching is able to handle aliasing of exports, there is no need to handle aliases in private declarations analysis. These were originally added to cope when the typings files had to use the name that the original source files used when exporting. PR Close #34254
This commit is contained in:

committed by
Kara Erickson

parent
44034888fc
commit
2ef633ef8b
@ -226,36 +226,6 @@ exports.ComponentA2 = i0.ComponentA2;
|
||||
exports.ComponentB = i1.ComponentB;
|
||||
exports.TopLevelComponent = TopLevelComponent;`);
|
||||
});
|
||||
|
||||
it('should not insert alias exports in js output', () => {
|
||||
const {importManager, renderer, sourceFile} = setup(PROGRAM);
|
||||
const output = new MagicString(PROGRAM.contents);
|
||||
renderer.addExports(
|
||||
output, _(PROGRAM.name.replace(/\.js$/, '')),
|
||||
[
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA1',
|
||||
identifier: 'ComponentA1'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA2',
|
||||
identifier: 'ComponentA2'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/foo/b.js'),
|
||||
alias: 'eComponentB',
|
||||
identifier: 'ComponentB'
|
||||
},
|
||||
{from: PROGRAM.name, alias: 'eTopLevelComponent', identifier: 'TopLevelComponent'},
|
||||
],
|
||||
importManager, sourceFile);
|
||||
const outputString = output.toString();
|
||||
expect(outputString).not.toContain(`{eComponentA1 as ComponentA1}`);
|
||||
expect(outputString).not.toContain(`{eComponentB as ComponentB}`);
|
||||
expect(outputString).not.toContain(`{eTopLevelComponent as TopLevelComponent}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addConstants', () => {
|
||||
|
@ -229,36 +229,6 @@ export {ComponentA2} from './a';
|
||||
export {ComponentB} from './foo/b';
|
||||
export {TopLevelComponent};`);
|
||||
});
|
||||
|
||||
it('should not insert alias exports in js output', () => {
|
||||
const {importManager, renderer, sourceFile} = setup(PROGRAM);
|
||||
const output = new MagicString(PROGRAM.contents);
|
||||
renderer.addExports(
|
||||
output, _(PROGRAM.name.replace(/\.js$/, '')),
|
||||
[
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA1',
|
||||
identifier: 'ComponentA1'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA2',
|
||||
identifier: 'ComponentA2'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/foo/b.js'),
|
||||
alias: 'eComponentB',
|
||||
identifier: 'ComponentB'
|
||||
},
|
||||
{from: PROGRAM.name, alias: 'eTopLevelComponent', identifier: 'TopLevelComponent'},
|
||||
],
|
||||
importManager, sourceFile);
|
||||
const outputString = output.toString();
|
||||
expect(outputString).not.toContain(`{eComponentA1 as ComponentA1}`);
|
||||
expect(outputString).not.toContain(`{eComponentB as ComponentB}`);
|
||||
expect(outputString).not.toContain(`{eTopLevelComponent as TopLevelComponent}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addConstants', () => {
|
||||
|
@ -146,36 +146,6 @@ export {ComponentA2} from './a';
|
||||
export {ComponentB} from './foo/b';
|
||||
export {TopLevelComponent};`);
|
||||
});
|
||||
|
||||
it('should not insert alias exports in js output', () => {
|
||||
const {importManager, renderer, sourceFile} = setup([PROGRAM]);
|
||||
const output = new MagicString(PROGRAM.contents);
|
||||
renderer.addExports(
|
||||
output, _(PROGRAM.name.replace(/\.js$/, '')),
|
||||
[
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA1',
|
||||
identifier: 'ComponentA1'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA2',
|
||||
identifier: 'ComponentA2'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/foo/b.js'),
|
||||
alias: 'eComponentB',
|
||||
identifier: 'ComponentB'
|
||||
},
|
||||
{from: PROGRAM.name, alias: 'eTopLevelComponent', identifier: 'TopLevelComponent'},
|
||||
],
|
||||
importManager, sourceFile);
|
||||
const outputString = output.toString();
|
||||
expect(outputString).not.toContain(`{eComponentA1 as ComponentA1}`);
|
||||
expect(outputString).not.toContain(`{eComponentB as ComponentB}`);
|
||||
expect(outputString).not.toContain(`{eTopLevelComponent as TopLevelComponent}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addConstants', () => {
|
||||
|
@ -359,36 +359,6 @@ exports.TopLevelComponent = TopLevelComponent;
|
||||
expect(generateNamedImportSpy).toHaveBeenCalledWith('./a', 'ComponentA2');
|
||||
expect(generateNamedImportSpy).toHaveBeenCalledWith('./foo/b', 'ComponentB');
|
||||
});
|
||||
|
||||
it('should not insert alias exports in js output', () => {
|
||||
const {importManager, renderer, sourceFile} = setup(PROGRAM);
|
||||
const output = new MagicString(PROGRAM.contents);
|
||||
renderer.addExports(
|
||||
output, PROGRAM.name.replace(/\.js$/, ''),
|
||||
[
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA1',
|
||||
identifier: 'ComponentA1'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/a.js'),
|
||||
alias: 'eComponentA2',
|
||||
identifier: 'ComponentA2'
|
||||
},
|
||||
{
|
||||
from: _('/node_modules/test-package/some/foo/b.js'),
|
||||
alias: 'eComponentB',
|
||||
identifier: 'ComponentB'
|
||||
},
|
||||
{from: PROGRAM.name, alias: 'eTopLevelComponent', identifier: 'TopLevelComponent'},
|
||||
],
|
||||
importManager, sourceFile);
|
||||
const outputString = output.toString();
|
||||
expect(outputString).not.toContain(`eComponentA1`);
|
||||
expect(outputString).not.toContain(`eComponentB`);
|
||||
expect(outputString).not.toContain(`eTopLevelComponent`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('addConstants', () => {
|
||||
|
Reference in New Issue
Block a user