refactor(ivy): ngcc - remove redundant entryPoint argument from writeBundle() (#32052)

The entry-point is already available through the `bundle` argument, so
passing it separately is redundant.

PR Close #32052
This commit is contained in:
George Kalpakas
2019-08-08 02:35:22 +03:00
committed by Alex Rickabaugh
parent ed70f73794
commit 93d27eefd5
6 changed files with 27 additions and 30 deletions

View File

@ -8,7 +8,6 @@
import {absoluteFrom, getFileSystem} from '../../../src/ngtsc/file_system';
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
import {loadTestFiles} from '../../../test/helpers';
import {EntryPoint} from '../../src/packages/entry_point';
import {EntryPointBundle} from '../../src/packages/entry_point_bundle';
import {InPlaceFileWriter} from '../../src/writing/in_place_file_writer';
@ -32,7 +31,7 @@ runInEachFileSystem(() => {
it('should write all the FileInfo to the disk', () => {
const fs = getFileSystem();
const fileWriter = new InPlaceFileWriter(fs);
fileWriter.writeBundle({} as EntryPoint, {} as EntryPointBundle, [
fileWriter.writeBundle({} as EntryPointBundle, [
{path: _('/package/path/top-level.js'), contents: 'MODIFIED TOP LEVEL'},
{path: _('/package/path/folder-1/file-1.js'), contents: 'MODIFIED FILE 1'},
{path: _('/package/path/folder-2/file-4.js'), contents: 'MODIFIED FILE 4'},
@ -49,7 +48,7 @@ runInEachFileSystem(() => {
it('should create backups of all files that previously existed', () => {
const fs = getFileSystem();
const fileWriter = new InPlaceFileWriter(fs);
fileWriter.writeBundle({} as EntryPoint, {} as EntryPointBundle, [
fileWriter.writeBundle({} as EntryPointBundle, [
{path: _('/package/path/top-level.js'), contents: 'MODIFIED TOP LEVEL'},
{path: _('/package/path/folder-1/file-1.js'), contents: 'MODIFIED FILE 1'},
{path: _('/package/path/folder-2/file-4.js'), contents: 'MODIFIED FILE 4'},
@ -72,10 +71,7 @@ runInEachFileSystem(() => {
const absoluteBackupPath = _('/package/path/already-backed-up.js');
expect(
() => fileWriter.writeBundle(
{} as EntryPoint, {} as EntryPointBundle,
[
{path: absoluteBackupPath, contents: 'MODIFIED BACKED UP'},
]))
{} as EntryPointBundle, [{path: absoluteBackupPath, contents: 'MODIFIED BACKED UP'}]))
.toThrowError(
`Tried to overwrite ${absoluteBackupPath}.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.`);
});

View File

@ -96,7 +96,7 @@ runInEachFileSystem(() => {
it('should write the modified files to a new folder', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/esm5.js'),
@ -115,7 +115,7 @@ runInEachFileSystem(() => {
it('should also copy unmodified files in the program', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/es2015/foo.js'),
@ -135,7 +135,7 @@ runInEachFileSystem(() => {
it('should update the package.json properties', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/esm5.js'),
@ -148,7 +148,7 @@ runInEachFileSystem(() => {
}));
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/es2015/foo.js'),
@ -164,7 +164,7 @@ runInEachFileSystem(() => {
it('should overwrite and backup typings files', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/index.d.ts'),
@ -200,7 +200,7 @@ runInEachFileSystem(() => {
it('should write the modified file to a new folder', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/a/esm5.js'),
@ -215,7 +215,7 @@ runInEachFileSystem(() => {
it('should also copy unmodified files in the program', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/a/es2015/foo.js'),
@ -235,7 +235,7 @@ runInEachFileSystem(() => {
it('should update the package.json properties', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/a/esm5.js'),
@ -248,7 +248,7 @@ runInEachFileSystem(() => {
}));
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/a/es2015/foo.js'),
@ -264,7 +264,7 @@ runInEachFileSystem(() => {
it('should overwrite and backup typings files', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/a/index.d.ts'),
@ -293,7 +293,7 @@ runInEachFileSystem(() => {
it('should write the modified file to a new folder', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/lib/esm5.js'),
@ -309,7 +309,7 @@ runInEachFileSystem(() => {
it('should also copy unmodified files in the program', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/lib/es2015/foo.js'),
@ -330,7 +330,7 @@ runInEachFileSystem(() => {
it('should not copy typings files within the package (i.e. from a different entry-point)',
() => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/lib/es2015/foo.js'),
@ -343,7 +343,7 @@ runInEachFileSystem(() => {
it('should not copy files outside of the package', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/lib/es2015/foo.js'),
@ -357,7 +357,7 @@ runInEachFileSystem(() => {
it('should update the package.json properties', () => {
fileWriter.writeBundle(
entryPoint, esm5bundle,
esm5bundle,
[
{
path: _('/node_modules/test/lib/esm5.js'),
@ -370,7 +370,7 @@ runInEachFileSystem(() => {
}));
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/lib/es2015/foo.js'),
@ -386,7 +386,7 @@ runInEachFileSystem(() => {
it('should overwrite and backup typings files', () => {
fileWriter.writeBundle(
entryPoint, esm2015bundle,
esm2015bundle,
[
{
path: _('/node_modules/test/typings/index.d.ts'),