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 ɵ}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
console.log("foo");
33
console.log("baz");
4-
import("./utf8-lazy-48cd6a70.js");
4+
import("./utf8-lazy-527020b7.js");
55
function ɵɵbar(){
66
console.log("bar");
77
};export{ɵɵbar as ɵ}

test/import/fixtures/utf8-lazy-48cd6a70.esm.advanced.js

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

test/import/fixtures/utf8-lazy-48cd6a70.esm.default.js

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

test/import/fixtures/utf8-lazy-48cd6a70.esm.es5.js

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

test/import/fixtures/utf8-lazy-48cd6a70.esm.pretty.js

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';
2+
\u0275\u0275bar()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import './utf8-3e9ae737.js'
1+
import './utf8-41b27160.js'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import './utf8-3e9ae737.js'
1+
import './utf8-41b27160.js'

test/import/fixtures/utf8.esm.es5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import './utf8-3e9ae737.js'
1+
import './utf8-41b27160.js'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import './utf8-3e9ae737.js'
1+
import './utf8-41b27160.js'

yarn.lock

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,6 @@ [email protected]:
454454
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf"
455455
integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==
456456

457-
acorn@^7.1.0:
458-
version "7.1.0"
459-
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
460-
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
461-
462457
agent-base@5:
463458
version "5.1.1"
464459
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
@@ -3619,14 +3614,12 @@ rimraf@^3.0.0:
36193614
dependencies:
36203615
glob "^7.1.3"
36213616

3622-
3623-
version "1.32.0"
3624-
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.0.tgz#c65ce134850aca1ce595fcac07d1dc5d53bf227c"
3625-
integrity sha512-ab2tF5pdDqm2zuI8j02ceyrJSScl9V2C24FgWQ1v1kTFTu1UrG5H0hpP++mDZlEFyZX4k0chtGEHU2i+pAzBgA==
3626-
dependencies:
3627-
"@types/estree" "*"
3628-
"@types/node" "*"
3629-
acorn "^7.1.0"
3617+
3618+
version "2.0.0"
3619+
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.0.0.tgz#0bd7a09bd7cdaa70a19ad5a356f2fab90fd2f401"
3620+
integrity sha512-tbvWownITR+0ebaX6iRr7IcLkziTCJacRpmWz03NIj3CZDmGlergYSwdG8wPx68LT0ms1YzqmbjUQHb6ut8pdw==
3621+
optionalDependencies:
3622+
fsevents "~2.1.2"
36303623

36313624
run-async@^2.2.0:
36323625
version "2.3.0"

0 commit comments

Comments
 (0)