Skip to content

Commit 55df63b

Browse files
Upgrade to rollup 2.0
1 parent c3a06e1 commit 55df63b

24 files changed

+30
-46
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"npm-run-all": "4.1.5",
5858
"prettier": "1.19.1",
5959
"rimraf": "3.0.2",
60-
"rollup": "1.32.0",
60+
"rollup": "2.0.0",
6161
"sirv-cli": "0.4.5",
6262
"typescript": "3.8.3"
6363
},

src/transform.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { logTransformChain } from './debug';
1818
import { TransformInterface, PluginOptions } from './types';
19-
import { PluginContext, InputOptions, OutputOptions, TransformSourceDescription } from 'rollup';
19+
import { PluginContext, InputOptions, OutputOptions, SourceDescription } from 'rollup';
2020
import { Mangle } from './transformers/mangle';
2121
import { Ebbinghaus } from './transformers/ebbinghaus';
2222
import * as path from 'path';
@@ -80,7 +80,7 @@ export async function chunkLifecycle(
8080
method: 'pre' | 'post',
8181
code: string,
8282
transforms: Array<ChunkTransform>,
83-
): Promise<TransformSourceDescription> {
83+
): Promise<SourceDescription> {
8484
const log: Array<[string, string]> = [];
8585
const sourcemaps: Array<RemappingDecodedSourceMap> = [];
8686
let source = new MagicString(code);
@@ -117,7 +117,7 @@ export async function sourceLifecycle(
117117
printableName: string,
118118
code: string,
119119
transforms: Array<SourceTransform>,
120-
): Promise<TransformSourceDescription> {
120+
): Promise<SourceDescription> {
121121
const fileName = path.basename(id);
122122
const log: Array<[string, string]> = [];
123123
const sourcemaps: Array<RemappingDecodedSourceMap> = [];

src/transformers/chunk/transforms.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import {
18-
OutputOptions,
19-
PluginContext,
20-
InputOptions,
21-
RenderedChunk,
22-
TransformSourceDescription,
23-
} from 'rollup';
17+
import { OutputOptions, PluginContext, InputOptions, RenderedChunk, SourceDescription } from 'rollup';
2418
import HashbangRemoveTransform from './hashbang-remove';
2519
import HashbangApplyTransform from './hashbang-apply';
2620
import IifeTransform from './iife';
@@ -72,8 +66,7 @@ export function create(
7266
): Array<ChunkTransform> {
7367
const pluginOptions = pluckPluginOptions(requestedCompileOptions);
7468
return TRANSFORMS.map(
75-
transform =>
76-
new transform(context, pluginOptions, mangler, memory, inputOptions, outputOptions),
69+
transform => new transform(context, pluginOptions, mangler, memory, inputOptions, outputOptions),
7770
);
7871
}
7972

@@ -88,7 +81,7 @@ export async function preCompilation(
8881
source: string,
8982
chunk: RenderedChunk,
9083
transforms: Array<ChunkTransform>,
91-
): Promise<TransformSourceDescription> {
84+
): Promise<SourceDescription> {
9285
return await chunkLifecycle(chunk.fileName, 'PreCompilation', 'pre', source, transforms);
9386
}
9487

@@ -103,6 +96,6 @@ export async function postCompilation(
10396
code: string,
10497
chunk: RenderedChunk,
10598
transforms: Array<ChunkTransform>,
106-
): Promise<TransformSourceDescription> {
99+
): Promise<SourceDescription> {
107100
return await chunkLifecycle(chunk.fileName, 'PostCompilation', 'post', code, transforms);
108101
}

src/transformers/source/transforms.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { SourceTransform, sourceLifecycle } from '../../transform';
1818
import { Mangle } from '../mangle';
19-
import { PluginContext, InputOptions, OutputOptions, TransformSourceDescription } from 'rollup';
19+
import { PluginContext, InputOptions, OutputOptions, SourceDescription } from 'rollup';
2020
import { CompileOptions } from 'google-closure-compiler';
2121
import HashbangTransform from './hashbang';
2222
import { Ebbinghaus } from '../ebbinghaus';
@@ -43,9 +43,7 @@ export const create = (
4343
inputOptions: InputOptions,
4444
outputOptions: OutputOptions,
4545
): Array<SourceTransform> =>
46-
TRANSFORMS.map(
47-
transform => new transform(context, {}, mangler, memory, inputOptions, outputOptions),
48-
);
46+
TRANSFORMS.map(transform => new transform(context, {}, mangler, memory, inputOptions, outputOptions));
4947

5048
/**
5149
* Run each transform's `transform` lifecycle.
@@ -57,6 +55,6 @@ export async function transform(
5755
source: string,
5856
id: string,
5957
transforms: Array<SourceTransform>,
60-
): Promise<TransformSourceDescription> {
58+
): Promise<SourceDescription> {
6159
return await sourceLifecycle(id, 'Transform', source, transforms);
6260
}

test/import/fixtures/utf8-3e9ae737.esm.advanced.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/import/fixtures/utf8-3e9ae737.esm.default.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/import/fixtures/utf8-3e9ae737.esm.es5.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}

0 commit comments

Comments
 (0)