diff --git a/package.json b/package.json index d194d41e..16c8b5e9 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/transform.ts b/src/transform.ts index b5c803a2..50ebb143 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -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'; @@ -80,7 +80,7 @@ export async function chunkLifecycle( method: 'pre' | 'post', code: string, transforms: Array, -): Promise { +): Promise { const log: Array<[string, string]> = []; const sourcemaps: Array = []; let source = new MagicString(code); @@ -117,7 +117,7 @@ export async function sourceLifecycle( printableName: string, code: string, transforms: Array, -): Promise { +): Promise { const fileName = path.basename(id); const log: Array<[string, string]> = []; const sourcemaps: Array = []; diff --git a/src/transformers/chunk/transforms.ts b/src/transformers/chunk/transforms.ts index c7076359..6bdd0c5e 100644 --- a/src/transformers/chunk/transforms.ts +++ b/src/transformers/chunk/transforms.ts @@ -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'; @@ -72,8 +66,7 @@ export function create( ): Array { 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), ); } @@ -88,7 +81,7 @@ export async function preCompilation( source: string, chunk: RenderedChunk, transforms: Array, -): Promise { +): Promise { return await chunkLifecycle(chunk.fileName, 'PreCompilation', 'pre', source, transforms); } @@ -103,6 +96,6 @@ export async function postCompilation( code: string, chunk: RenderedChunk, transforms: Array, -): Promise { +): Promise { return await chunkLifecycle(chunk.fileName, 'PostCompilation', 'post', code, transforms); } diff --git a/src/transformers/source/transforms.ts b/src/transformers/source/transforms.ts index 7043a145..e725280c 100644 --- a/src/transformers/source/transforms.ts +++ b/src/transformers/source/transforms.ts @@ -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'; @@ -43,9 +43,7 @@ export const create = ( inputOptions: InputOptions, outputOptions: OutputOptions, ): Array => - 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. @@ -57,6 +55,6 @@ export async function transform( source: string, id: string, transforms: Array, -): Promise { +): Promise { return await sourceLifecycle(id, 'Transform', source, transforms); } diff --git a/test/import/fixtures/utf8-3e9ae737.esm.advanced.js b/test/import/fixtures/utf8-3e9ae737.esm.advanced.js deleted file mode 100644 index a10dad3f..00000000 --- a/test/import/fixtures/utf8-3e9ae737.esm.advanced.js +++ /dev/null @@ -1 +0,0 @@ -console.log("foo");console.log("baz");import("./utf8-lazy-48cd6a70.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-3e9ae737.esm.default.js b/test/import/fixtures/utf8-3e9ae737.esm.default.js deleted file mode 100644 index a10dad3f..00000000 --- a/test/import/fixtures/utf8-3e9ae737.esm.default.js +++ /dev/null @@ -1 +0,0 @@ -console.log("foo");console.log("baz");import("./utf8-lazy-48cd6a70.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-3e9ae737.esm.es5.js b/test/import/fixtures/utf8-3e9ae737.esm.es5.js deleted file mode 100644 index a10dad3f..00000000 --- a/test/import/fixtures/utf8-3e9ae737.esm.es5.js +++ /dev/null @@ -1 +0,0 @@ -console.log("foo");console.log("baz");import("./utf8-lazy-48cd6a70.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-41b27160.esm.advanced.js b/test/import/fixtures/utf8-41b27160.esm.advanced.js new file mode 100644 index 00000000..de1f4094 --- /dev/null +++ b/test/import/fixtures/utf8-41b27160.esm.advanced.js @@ -0,0 +1 @@ +console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-41b27160.esm.default.js b/test/import/fixtures/utf8-41b27160.esm.default.js new file mode 100644 index 00000000..de1f4094 --- /dev/null +++ b/test/import/fixtures/utf8-41b27160.esm.default.js @@ -0,0 +1 @@ +console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-41b27160.esm.es5.js b/test/import/fixtures/utf8-41b27160.esm.es5.js new file mode 100644 index 00000000..de1f4094 --- /dev/null +++ b/test/import/fixtures/utf8-41b27160.esm.es5.js @@ -0,0 +1 @@ +console.log("foo");console.log("baz");import("./utf8-lazy-527020b7.js");function ɵɵbar(){console.log("bar")};export{ɵɵbar as ɵ} diff --git a/test/import/fixtures/utf8-3e9ae737.esm.pretty.js b/test/import/fixtures/utf8-41b27160.esm.pretty.js similarity index 75% rename from test/import/fixtures/utf8-3e9ae737.esm.pretty.js rename to test/import/fixtures/utf8-41b27160.esm.pretty.js index ee6133db..9cfb5ac1 100644 --- a/test/import/fixtures/utf8-3e9ae737.esm.pretty.js +++ b/test/import/fixtures/utf8-41b27160.esm.pretty.js @@ -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 ɵ} diff --git a/test/import/fixtures/utf8-lazy-48cd6a70.esm.advanced.js b/test/import/fixtures/utf8-lazy-48cd6a70.esm.advanced.js deleted file mode 100644 index a8abc61b..00000000 --- a/test/import/fixtures/utf8-lazy-48cd6a70.esm.advanced.js +++ /dev/null @@ -1 +0,0 @@ -import{ɵ as ɵɵbar}from'./utf8-3e9ae737.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-48cd6a70.esm.default.js b/test/import/fixtures/utf8-lazy-48cd6a70.esm.default.js deleted file mode 100644 index a8abc61b..00000000 --- a/test/import/fixtures/utf8-lazy-48cd6a70.esm.default.js +++ /dev/null @@ -1 +0,0 @@ -import{ɵ as ɵɵbar}from'./utf8-3e9ae737.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-48cd6a70.esm.es5.js b/test/import/fixtures/utf8-lazy-48cd6a70.esm.es5.js deleted file mode 100644 index a8abc61b..00000000 --- a/test/import/fixtures/utf8-lazy-48cd6a70.esm.es5.js +++ /dev/null @@ -1 +0,0 @@ -import{ɵ as ɵɵbar}from'./utf8-3e9ae737.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-48cd6a70.esm.pretty.js b/test/import/fixtures/utf8-lazy-48cd6a70.esm.pretty.js deleted file mode 100644 index c506405c..00000000 --- a/test/import/fixtures/utf8-lazy-48cd6a70.esm.pretty.js +++ /dev/null @@ -1,2 +0,0 @@ -import{ɵ as ɵɵbar}from'./utf8-3e9ae737.js'; -\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-527020b7.esm.advanced.js b/test/import/fixtures/utf8-lazy-527020b7.esm.advanced.js new file mode 100644 index 00000000..6ece6e78 --- /dev/null +++ b/test/import/fixtures/utf8-lazy-527020b7.esm.advanced.js @@ -0,0 +1 @@ +import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-527020b7.esm.default.js b/test/import/fixtures/utf8-lazy-527020b7.esm.default.js new file mode 100644 index 00000000..6ece6e78 --- /dev/null +++ b/test/import/fixtures/utf8-lazy-527020b7.esm.default.js @@ -0,0 +1 @@ +import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-527020b7.esm.es5.js b/test/import/fixtures/utf8-lazy-527020b7.esm.es5.js new file mode 100644 index 00000000..6ece6e78 --- /dev/null +++ b/test/import/fixtures/utf8-lazy-527020b7.esm.es5.js @@ -0,0 +1 @@ +import{ɵ as ɵɵbar}from'./utf8-41b27160.js';\u0275\u0275bar() diff --git a/test/import/fixtures/utf8-lazy-527020b7.esm.pretty.js b/test/import/fixtures/utf8-lazy-527020b7.esm.pretty.js new file mode 100644 index 00000000..2ecf9b76 --- /dev/null +++ b/test/import/fixtures/utf8-lazy-527020b7.esm.pretty.js @@ -0,0 +1,2 @@ +import{ɵ as ɵɵbar}from'./utf8-41b27160.js'; +\u0275\u0275bar() diff --git a/test/import/fixtures/utf8.esm.advanced.js b/test/import/fixtures/utf8.esm.advanced.js index 95d04f61..7ceeddc4 100644 --- a/test/import/fixtures/utf8.esm.advanced.js +++ b/test/import/fixtures/utf8.esm.advanced.js @@ -1 +1 @@ -import './utf8-3e9ae737.js' +import './utf8-41b27160.js' diff --git a/test/import/fixtures/utf8.esm.default.js b/test/import/fixtures/utf8.esm.default.js index 95d04f61..7ceeddc4 100644 --- a/test/import/fixtures/utf8.esm.default.js +++ b/test/import/fixtures/utf8.esm.default.js @@ -1 +1 @@ -import './utf8-3e9ae737.js' +import './utf8-41b27160.js' diff --git a/test/import/fixtures/utf8.esm.es5.js b/test/import/fixtures/utf8.esm.es5.js index 95d04f61..7ceeddc4 100644 --- a/test/import/fixtures/utf8.esm.es5.js +++ b/test/import/fixtures/utf8.esm.es5.js @@ -1 +1 @@ -import './utf8-3e9ae737.js' +import './utf8-41b27160.js' diff --git a/test/import/fixtures/utf8.esm.pretty.js b/test/import/fixtures/utf8.esm.pretty.js index 95d04f61..7ceeddc4 100644 --- a/test/import/fixtures/utf8.esm.pretty.js +++ b/test/import/fixtures/utf8.esm.pretty.js @@ -1 +1 @@ -import './utf8-3e9ae737.js' +import './utf8-41b27160.js' diff --git a/yarn.lock b/yarn.lock index 65b63e9f..3791aefb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"