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:
Pete Bacon Darwin
2019-12-18 14:03:05 +00:00
committed by Kara Erickson
parent 44034888fc
commit 2ef633ef8b
8 changed files with 5 additions and 199 deletions

View File

@ -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', () => {

View File

@ -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', () => {

View File

@ -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', () => {

View File

@ -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', () => {