Skip to content

Commit

Permalink
Upgrade to rollup 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferbaxter committed Mar 6, 2020
1 parent c3a06e1 commit 55df63b
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 46 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"npm-run-all": "4.1.5",
"prettier": "1.19.1",
"rimraf": "3.0.2",
"rollup": "1.32.0",
"rollup": "2.0.0",
"sirv-cli": "0.4.5",
"typescript": "3.8.3"
},
Expand Down
6 changes: 3 additions & 3 deletions src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { logTransformChain } from './debug';
import { TransformInterface, PluginOptions } from './types';
import { PluginContext, InputOptions, OutputOptions, TransformSourceDescription } from 'rollup';
import { PluginContext, InputOptions, OutputOptions, SourceDescription } from 'rollup';
import { Mangle } from './transformers/mangle';
import { Ebbinghaus } from './transformers/ebbinghaus';
import * as path from 'path';
Expand Down Expand Up @@ -80,7 +80,7 @@ export async function chunkLifecycle(
method: 'pre' | 'post',
code: string,
transforms: Array<ChunkTransform>,
): Promise<TransformSourceDescription> {
): Promise<SourceDescription> {
const log: Array<[string, string]> = [];
const sourcemaps: Array<RemappingDecodedSourceMap> = [];
let source = new MagicString(code);
Expand Down Expand Up @@ -117,7 +117,7 @@ export async function sourceLifecycle(
printableName: string,
code: string,
transforms: Array<SourceTransform>,
): Promise<TransformSourceDescription> {
): Promise<SourceDescription> {
const fileName = path.basename(id);
const log: Array<[string, string]> = [];
const sourcemaps: Array<RemappingDecodedSourceMap> = [];
Expand Down
15 changes: 4 additions & 11 deletions src/transformers/chunk/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
* limitations under the License.
*/

import {
OutputOptions,
PluginContext,
InputOptions,
RenderedChunk,
TransformSourceDescription,
} from 'rollup';
import { OutputOptions, PluginContext, InputOptions, RenderedChunk, SourceDescription } from 'rollup';
import HashbangRemoveTransform from './hashbang-remove';
import HashbangApplyTransform from './hashbang-apply';
import IifeTransform from './iife';
Expand Down Expand Up @@ -72,8 +66,7 @@ export function create(
): Array<ChunkTransform> {
const pluginOptions = pluckPluginOptions(requestedCompileOptions);
return TRANSFORMS.map(
transform =>
new transform(context, pluginOptions, mangler, memory, inputOptions, outputOptions),
transform => new transform(context, pluginOptions, mangler, memory, inputOptions, outputOptions),
);
}

Expand All @@ -88,7 +81,7 @@ export async function preCompilation(
source: string,
chunk: RenderedChunk,
transforms: Array<ChunkTransform>,
): Promise<TransformSourceDescription> {
): Promise<SourceDescription> {
return await chunkLifecycle(chunk.fileName, 'PreCompilation', 'pre', source, transforms);
}

Expand All @@ -103,6 +96,6 @@ export async function postCompilation(
code: string,
chunk: RenderedChunk,
transforms: Array<ChunkTransform>,
): Promise<TransformSourceDescription> {
): Promise<SourceDescription> {
return await chunkLifecycle(chunk.fileName, 'PostCompilation', 'post', code, transforms);
}
8 changes: 3 additions & 5 deletions src/transformers/source/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { SourceTransform, sourceLifecycle } from '../../transform';
import { Mangle } from '../mangle';
import { PluginContext, InputOptions, OutputOptions, TransformSourceDescription } from 'rollup';
import { PluginContext, InputOptions, OutputOptions, SourceDescription } from 'rollup';
import { CompileOptions } from 'google-closure-compiler';
import HashbangTransform from './hashbang';
import { Ebbinghaus } from '../ebbinghaus';
Expand All @@ -43,9 +43,7 @@ export const create = (
inputOptions: InputOptions,
outputOptions: OutputOptions,
): Array<SourceTransform> =>
TRANSFORMS.map(
transform => new transform(context, {}, mangler, memory, inputOptions, outputOptions),
);
TRANSFORMS.map(transform => new transform(context, {}, mangler, memory, inputOptions, outputOptions));

/**
* Run each transform's `transform` lifecycle.
Expand All @@ -57,6 +55,6 @@ export async function transform(
source: string,
id: string,
transforms: Array<SourceTransform>,
): Promise<TransformSourceDescription> {
): Promise<SourceDescription> {
return await sourceLifecycle(id, 'Transform', source, transforms);
}
1 change: 0 additions & 1 deletion test/import/fixtures/utf8-3e9ae737.esm.advanced.js

This file was deleted.

1 change: 0 additions & 1 deletion test/import/fixtures/utf8-3e9ae737.esm.default.js

This file was deleted.

1 change: 0 additions & 1 deletion test/import/fixtures/utf8-3e9ae737.esm.es5.js

This file was deleted.

1 change: 1 addition & 0 deletions test/import/fixtures/utf8-41b27160.esm.advanced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}
1 change: 1 addition & 0 deletions test/import/fixtures/utf8-41b27160.esm.default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}
1 change: 1 addition & 0 deletions test/import/fixtures/utf8-41b27160.esm.es5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

console.log("foo");
console.log("baz");
import("./utf8-lazy-48cd6a70.js");
import("./utf8-lazy-527020b7.js");
function ɵɵbar(){
console.log("bar");
};export{ɵɵbar as ɵ}
1 change: 0 additions & 1 deletion test/import/fixtures/utf8-lazy-48cd6a70.esm.advanced.js

This file was deleted.

1 change: 0 additions & 1 deletion test/import/fixtures/utf8-lazy-48cd6a70.esm.default.js

This file was deleted.

1 change: 0 additions & 1 deletion test/import/fixtures/utf8-lazy-48cd6a70.esm.es5.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/import/fixtures/utf8-lazy-48cd6a70.esm.pretty.js

This file was deleted.

1 change: 1 addition & 0 deletions test/import/fixtures/utf8-lazy-527020b7.esm.advanced.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
1 change: 1 addition & 0 deletions test/import/fixtures/utf8-lazy-527020b7.esm.default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
1 change: 1 addition & 0 deletions test/import/fixtures/utf8-lazy-527020b7.esm.es5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar()
2 changes: 2 additions & 0 deletions test/import/fixtures/utf8-lazy-527020b7.esm.pretty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import{ɵ as ɵɵbar}from'./utf8-41b27160.js';
\u0275\u0275bar()
2 changes: 1 addition & 1 deletion test/import/fixtures/utf8.esm.advanced.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './utf8-3e9ae737.js'
import './utf8-41b27160.js'
2 changes: 1 addition & 1 deletion test/import/fixtures/utf8.esm.default.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './utf8-3e9ae737.js'
import './utf8-41b27160.js'
2 changes: 1 addition & 1 deletion test/import/fixtures/utf8.esm.es5.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './utf8-3e9ae737.js'
import './utf8-41b27160.js'
2 changes: 1 addition & 1 deletion test/import/fixtures/utf8.esm.pretty.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import './utf8-3e9ae737.js'
import './utf8-41b27160.js'
19 changes: 6 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,6 @@ acorn@7.1.1:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.1.tgz#e35668de0b402f359de515c5482a1ab9f89a69bf"
integrity sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==

acorn@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==

agent-base@5:
version "5.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
Expand Down Expand Up @@ -3619,14 +3614,12 @@ rimraf@^3.0.0:
dependencies:
glob "^7.1.3"

rollup@1.32.0:
version "1.32.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.0.tgz#c65ce134850aca1ce595fcac07d1dc5d53bf227c"
integrity sha512-ab2tF5pdDqm2zuI8j02ceyrJSScl9V2C24FgWQ1v1kTFTu1UrG5H0hpP++mDZlEFyZX4k0chtGEHU2i+pAzBgA==
dependencies:
"@types/estree" "*"
"@types/node" "*"
acorn "^7.1.0"
rollup@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.0.0.tgz#0bd7a09bd7cdaa70a19ad5a356f2fab90fd2f401"
integrity sha512-tbvWownITR+0ebaX6iRr7IcLkziTCJacRpmWz03NIj3CZDmGlergYSwdG8wPx68LT0ms1YzqmbjUQHb6ut8pdw==
optionalDependencies:
fsevents "~2.1.2"

run-async@^2.2.0:
version "2.3.0"
Expand Down

0 comments on commit 55df63b

Please sign in to comment.