From e035847020286a115253f824c54674feea952615 Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Thu, 22 Feb 2018 11:11:10 -0500 Subject: [PATCH] Improved flow sourcemaps --- package.json | 1 - rollup.config.js | 16 ++++++++++++++-- yarn.lock | 20 +------------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 0068afef284..ba961982ab6 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,6 @@ "rollup-plugin-browserify-transform": "^1.0.1", "rollup-plugin-buble": "^0.18.0", "rollup-plugin-commonjs": "^8.2.6", - "rollup-plugin-flow": "^1.1.1", "rollup-plugin-node-resolve": "3.0.0", "rollup-plugin-sourcemaps": "^0.4.2", "rollup-plugin-uglify": "^3.0.0", diff --git a/rollup.config.js b/rollup.config.js index 97b5c54bde2..3b624dba318 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,4 +1,4 @@ -import flow from 'rollup-plugin-flow'; +import flowRemoveTypes from 'flow-remove-types'; import buble from 'rollup-plugin-buble'; import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; @@ -15,7 +15,7 @@ const outputFile = production ? 'dist/mapbox-gl.js' : 'dist/mapbox-gl-dev.js'; const plugins = [ sourcemaps(), - flow({pretty: true}), // setting {pretty: true} works around https://github.com/leebyron/rollup-plugin-flow/issues/5 + flow(), // setting {pretty: true} works around https://github.com/leebyron/rollup-plugin-flow/issues/5 minifyStyleSpec(), json(), buble({transforms: {dangerousForOf: true}, objectAssign: "Object.assign"}), @@ -73,4 +73,16 @@ if (!shared) { ` }]; +// Using this instead of rollup-plugin-flow due to +// https://github.com/leebyron/rollup-plugin-flow/issues/5 +function flow() { + return { + name: 'flow-remove-types', + transform: (code, id) => ({ + code: flowRemoveTypes(code).toString(), + map: null + }) + }; +} + export default config diff --git a/yarn.lock b/yarn.lock index 20ab882dc8e..729cf6730db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3760,10 +3760,6 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" -estree-walker@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e" - estree-walker@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" @@ -4112,7 +4108,7 @@ flow-coverage-report@^0.3.0: terminal-table "0.0.12" yargs "5.0.0" -flow-remove-types@^1.0.4, flow-remove-types@^1.1.0, flow-remove-types@^1.1.2: +flow-remove-types@^1.0.4, flow-remove-types@^1.1.2: version "1.2.3" resolved "https://registry.yarnpkg.com/flow-remove-types/-/flow-remove-types-1.2.3.tgz#6131aefc7da43364bb8b479758c9dec7735d1a18" dependencies: @@ -8610,13 +8606,6 @@ rollup-plugin-commonjs@^8.2.6: resolve "^1.4.0" rollup-pluginutils "^2.0.1" -rollup-plugin-flow@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-flow/-/rollup-plugin-flow-1.1.1.tgz#6ce568f1dd559666b77ab76b4bae251407528db6" - dependencies: - flow-remove-types "^1.1.0" - rollup-pluginutils "^1.5.1" - rollup-plugin-json@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/rollup-plugin-json/-/rollup-plugin-json-2.3.0.tgz#3c07a452c1b5391be28006fbfff3644056ce0add" @@ -8656,13 +8645,6 @@ rollup-plugin-unassert@^0.2.0: rollup-pluginutils "^2.0.1" unassert "^1.5.1" -rollup-pluginutils@^1.5.1: - version "1.5.2" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408" - dependencies: - estree-walker "^0.2.1" - minimatch "^3.0.2" - rollup-pluginutils@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0"