Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit fbf58de

Browse files
committed
refactor(): deprecate rollup, closure, and babili support
1 parent 17cc2a8 commit fbf58de

12 files changed

+3
-991
lines changed

src/babili.spec.ts

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/babili.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/bundle.spec.ts

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
import * as bundle from './bundle';
2-
import * as rollup from './rollup';
32
import * as webpack from './webpack';
43
import * as Constants from './util/constants';
54
import { ChangedFile } from './util/interfaces';
65

76
describe('bundle task', () => {
87

98
describe('bundle', () => {
10-
it('should return the value rollup task returns', () => {
11-
// arrange
12-
spyOn(rollup, rollup.rollup.name).and.returnValue(Promise.resolve());
13-
const context = { bundler: Constants.BUNDLER_ROLLUP};
14-
15-
// act
16-
return bundle.bundle(context).then(() => {
17-
// assert
18-
expect(rollup.rollup).toHaveBeenCalled();
19-
});
20-
});
21-
22-
it('should throw when rollup throws', () => {
23-
const errorText = 'simulating an error';
24-
// arrange
25-
spyOn(rollup, rollup.rollup.name).and.returnValue(Promise.reject(new Error(errorText)));
26-
const context = { bundler: Constants.BUNDLER_ROLLUP};
27-
28-
// act
29-
return bundle.bundle(context).then(() => {
30-
throw new Error('Should never happen');
31-
}).catch(err => {
32-
// assert
33-
expect(rollup.rollup).toHaveBeenCalled();
34-
expect(err.message).toBe(errorText);
35-
});
36-
});
379

3810
it('should return the value webpack task returns', () => {
3911
// arrange
@@ -47,7 +19,7 @@ describe('bundle task', () => {
4719
});
4820
});
4921

50-
it('should throw when rollup throws', () => {
22+
it('should throw when webpack throws', () => {
5123
const errorText = 'simulating an error';
5224
// arrange
5325
spyOn(webpack, webpack.webpack.name).and.returnValue(Promise.reject(new Error(errorText)));
@@ -65,35 +37,6 @@ describe('bundle task', () => {
6537
});
6638

6739
describe('bundleUpdate', () => {
68-
it('should return the value rollup returns', () => {
69-
// arrange
70-
spyOn(rollup, rollup.rollupUpdate.name).and.returnValue(Promise.resolve());
71-
const context = { bundler: Constants.BUNDLER_ROLLUP};
72-
const changedFiles: ChangedFile[] = [];
73-
74-
// act
75-
return bundle.bundleUpdate(changedFiles, context).then(() => {
76-
// assert
77-
expect(rollup.rollupUpdate).toHaveBeenCalledWith(changedFiles, context);
78-
});
79-
});
80-
81-
it('should throw when rollup throws', () => {
82-
const errorText = 'simulating an error';
83-
// arrange
84-
spyOn(rollup, rollup.rollupUpdate.name).and.returnValue(Promise.reject(new Error(errorText)));
85-
const context = { bundler: Constants.BUNDLER_ROLLUP};
86-
const changedFiles: ChangedFile[] = [];
87-
88-
// act
89-
return bundle.bundleUpdate(changedFiles, context).then(() => {
90-
throw new Error('Should never happen');
91-
}).catch(err => {
92-
// assert
93-
expect(rollup.rollupUpdate).toHaveBeenCalled();
94-
expect(err.message).toBe(errorText);
95-
});
96-
});
9740

9841
it('should return the value webpack returns', () => {
9942
// arrange
@@ -132,20 +75,6 @@ describe('bundle task', () => {
13275
});
13376

13477
describe('buildJsSourceMaps', () => {
135-
it('should get the value from the rollup config', () => {
136-
// arrange
137-
const config = {
138-
sourceMap: true
139-
};
140-
spyOn(rollup, rollup.getRollupConfig.name).and.returnValue(config);
141-
const context = { bundler: Constants.BUNDLER_ROLLUP};
142-
// act
143-
const result = bundle.buildJsSourceMaps(context);
144-
145-
// assert
146-
expect(rollup.getRollupConfig).toHaveBeenCalledWith(context, null);
147-
expect(result).toEqual(config.sourceMap);
148-
});
14978

15079
it('should get false when devtool is null for webpack', () => {
15180
// arrange
@@ -175,21 +104,6 @@ describe('bundle task', () => {
175104
});
176105

177106
describe('getJsOutputDest', () => {
178-
it('should get the value from rollup', () => {
179-
// arrange
180-
const config = { };
181-
const returnValue = 'someString';
182-
spyOn(rollup, rollup.getRollupConfig.name).and.returnValue(config);
183-
spyOn(rollup, rollup.getOutputDest.name).and.returnValue(returnValue);
184-
const context = { bundler: Constants.BUNDLER_ROLLUP};
185-
// act
186-
const result = bundle.getJsOutputDest(context);
187-
188-
// assert
189-
expect(rollup.getRollupConfig).toHaveBeenCalledWith(context, null);
190-
expect(rollup.getOutputDest).toHaveBeenCalledWith(context, config);
191-
expect(result).toEqual(returnValue);
192-
});
193107

194108
it('should get the value from webpack', () => {
195109
// arrange

src/bundle.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { BuildContext, ChangedFile } from './util/interfaces';
22
import { BuildError, IgnorableError } from './util/errors';
33
import * as Constants from './util/constants';
4-
import { rollup, rollupUpdate, getRollupConfig, getOutputDest as rollupGetOutputDest } from './rollup';
54
import { webpack, webpackUpdate, getWebpackConfig, getOutputDest as webpackGetOutputDest } from './webpack';
65

76

@@ -14,22 +13,11 @@ export function bundle(context: BuildContext, configFile?: string) {
1413

1514

1615
function bundleWorker(context: BuildContext, configFile: string) {
17-
if (context.bundler === Constants.BUNDLER_ROLLUP) {
18-
return rollup(context, configFile);
19-
}
20-
2116
return webpack(context, configFile);
2217
}
2318

2419

2520
export function bundleUpdate(changedFiles: ChangedFile[], context: BuildContext) {
26-
if (context.bundler === Constants.BUNDLER_ROLLUP) {
27-
return rollupUpdate(changedFiles, context)
28-
.catch(err => {
29-
throw new BuildError(err);
30-
});
31-
}
32-
3321
return webpackUpdate(changedFiles, context)
3422
.catch(err => {
3523
if (err instanceof IgnorableError) {
@@ -41,21 +29,11 @@ export function bundleUpdate(changedFiles: ChangedFile[], context: BuildContext)
4129

4230

4331
export function buildJsSourceMaps(context: BuildContext) {
44-
if (context.bundler === Constants.BUNDLER_ROLLUP) {
45-
const rollupConfig = getRollupConfig(context, null);
46-
return rollupConfig.sourceMap;
47-
}
48-
4932
const webpackConfig = getWebpackConfig(context, null);
5033
return !!(webpackConfig.devtool && webpackConfig.devtool.length > 0);
5134
}
5235

5336

5437
export function getJsOutputDest(context: BuildContext) {
55-
if (context.bundler === Constants.BUNDLER_ROLLUP) {
56-
const rollupConfig = getRollupConfig(context, null);
57-
return rollupGetOutputDest(context, rollupConfig);
58-
}
59-
6038
return webpackGetOutputDest(context);
6139
}

0 commit comments

Comments
 (0)