diff --git a/package.json b/package.json index 13380cf33..fb19261a5 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "build": "run-s clean build:*", "build:copy": "run-s build:copy:*", "build:copy:src": "shx mkdir -p add-on/dist && shx cp -R add-on/src/* add-on/dist", - "build:copy:ui-kit": "run-p build:copy:ui-kit:*", + "build:copy:ui-kit": "run-s build:copy:ui-kit:*", "build:copy:ui-kit:ipfs-css": "run-p build:copy:ui-kit:ipfs-css:*", "build:copy:ui-kit:ipfs-css:css": "shx mkdir -p add-on/ui-kit && shx cp node_modules/ipfs-css/ipfs.css add-on/ui-kit", "build:copy:ui-kit:ipfs-css:fonts": "shx mkdir -p add-on/ui-kit/fonts && shx cp node_modules/ipfs-css/fonts/* add-on/ui-kit/fonts", @@ -29,7 +29,7 @@ "build:webui:fetch-ipfs": "cross-env-shell \"ipfs get $CID -o add-on/webui/\"", "build:webui:fetch-http": "cross-env-shell \"node scripts/fetch-webui-from-gateway.js $CID add-on/webui/\"", "build:webui:minimize": "shx rm -rf add-on/webui/static/js/*.map && shx rm -rf add-on/webui/static/css/*.map && shx rm -rf add-on/webui/manifest.json", - "build:js": "run-p build:js:*", + "build:js": "run-s build:js:*", "build:js:webpack": "webpack -p", "build:minimize-dist": "shx rm -rf add-on/dist/lib add-on/dist/contentScripts/ add-on/dist/bundles/ipfsProxyContentScriptPayload.bundle.js", "build:bundle-all": "npm run bundle:generic && cross-env RELEASE_CHANNEL=${RELEASE_CHANNEL:=dev} npm run bundle:firefox:$RELEASE_CHANNEL || npm run bundle:firefox", @@ -98,8 +98,8 @@ "standard": "12.0.1", "tar": "4.4.8", "terser": "3.11.0", + "terser-webpack-plugin": "1.1.0", "transform-loader": "0.2.4", - "uglifyjs-webpack-plugin": "2.0.1", "web-ext": "2.9.2", "webpack": "4.27.1", "webpack-bundle-analyzer": "3.0.3", diff --git a/webpack.config.js b/webpack.config.js index c892a6035..d57c1c17e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,7 +2,8 @@ const path = require('path') const webpack = require('webpack') const merge = require('webpack-merge') const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin') -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') +const TerserPlugin = require('terser-webpack-plugin') + // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; // common configuration shared by all targets @@ -10,22 +11,18 @@ const commonConfig = { target: 'web', bail: true, output: { - path: path.resolve(__dirname, 'add-on/dist/bundles'), + path: path.resolve(__dirname, 'add-on/dist/bundles/'), publicPath: '/dist/bundles/', filename: '[name].bundle.js' }, optimization: { minimizer: [ - new UglifyJsPlugin({ - minify (file, sourceMap) { - let uglifyJsOptions = { - // Default minify settings break js-ipfs: - // https://github.com/ipfs-shipyard/ipfs-companion/issues/521 - compress: { unused: false }, - mangle: true - } - if (sourceMap) uglifyJsOptions.sourceMap = { content: sourceMap } - return require('terser').minify(file, uglifyJsOptions) + new TerserPlugin({ + terserOptions: { + // Default minify settings break js-ipfs: + // https://github.com/ipfs-shipyard/ipfs-companion/issues/521 + compress: { unused: false }, + mangle: true } }) ] @@ -80,8 +77,8 @@ const bgConfig = merge(commonConfig, { name: 'ipfs', priority: 10, enforce: true, - // Include js-ipfs and js-ipfs-api - test: /\/node_modules\/(ipfs|ipfs-api)\// + // Include js-ipfs and js-ipfs-http-client + test: /\/node_modules\/(ipfs|ipfs-api|ipfs-http-client)\// } } } diff --git a/yarn.lock b/yarn.lock index 558b58c72..0d44278ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -634,14 +634,7 @@ dependencies: any-observable "^0.3.0" -"@sinonjs/commons@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.0.2.tgz#3e0ac737781627b8844257fadc3d803997d0526e" - integrity sha512-WR3dlgqJP4QNrLC4iXN/5/2WaLQQ0VijOOkmflqFGVJ6wLEpbSjo7c0ZeGIdtY8Crk7xBBp87sM6+Mkerz7alw== - dependencies: - type-detect "4.0.8" - -"@sinonjs/commons@^1.2.0": +"@sinonjs/commons@^1.0.2", "@sinonjs/commons@^1.2.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.3.0.tgz#50a2754016b6f30a994ceda6d9a0a8c36adda849" integrity sha512-j4ZwhaHmwsCb4DlDOIWnI5YyKDNMoNThsmwEpfHx6a1EpsGZ9qYLxP++LMlmBRjtGptGHFsGItJ768snllFWpA== @@ -663,13 +656,13 @@ "@sinonjs/samsam" "^2 || ^3" "@sinonjs/samsam@^2 || ^3": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-3.0.1.tgz#1302682a71ad74308ba614582ad1768618347e1d" - integrity sha512-pSgyLnrBNtKHosNULXd+wEk6edqlBs2qfGHagS14t+zOhDkE5Yto5HbsZwQRmRoCBNg13osPHb/4uwvLOJBkug== + version "3.0.2" + resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-3.0.2.tgz#304fb33bd5585a0b2df8a4c801fcb47fa84d8e43" + integrity sha512-m08g4CS3J6lwRQk1pj1EO+KEVWbrbXsmi9Pw0ySmrIbcVxVaedoFgLvFsV8wHLwh01EpROVz3KvVcD1Jmks9FQ== dependencies: - "@sinonjs/commons" "1.0.2" + "@sinonjs/commons" "^1.0.2" array-from "^2.1.1" - lodash.get "4.4.2" + lodash.get "^4.4.2" "@sinonjs/samsam@^2.1.2": version "2.1.3" @@ -677,9 +670,9 @@ integrity sha512-8zNeBkSKhU9a5cRNbpCKau2WWPfan+Q2zDlcXvXyhn9EsMqgYs4qzo0XHNVlXC6ABQL8fT6nV+zzo5RTHJzyXw== "@types/node@*": - version "10.12.12" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47" - integrity sha512-Pr+6JRiKkfsFvmU/LK68oBRCQeEg36TyAbPhc2xpez24OOZZCuoIhWGTd39VZy6nGafSbxzGouFPTFD/rR1A0A== + version "10.12.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.14.tgz#c03b6380c5c301be0499ecd143b99b76ebe45678" + integrity sha512-0rVcFRhM93kRGAU88ASCjX9Y3FWDCh+33G5Z5evpKOea4xcpLqDGwmo64+DjgaSezTN5j9KdnUzvxhOw7fNciQ== "@webassemblyjs/ast@1.7.11": version "1.7.11" @@ -2094,7 +2087,7 @@ bytes@3.0.0: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= -cacache@^11.0.2, cacache@^11.2.0: +cacache@^11.0.2: version "11.3.1" resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.1.tgz#d09d25f6c4aca7a6d305d141ae332613aa1d515f" integrity sha512-2PEw4cRRDu+iQvBTTuttQifacYjLPhET+SYO/gEFMy8uhi+jlJREDAjSF5FWSdV/Aw5h18caHA7vMTw2c+wDzA== @@ -3011,9 +3004,9 @@ datastore-level@~0.10.0: pull-stream "^3.6.9" date-fns@^1.27.2: - version "1.29.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" - integrity sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw== + version "1.30.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" + integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== date-now@^0.1.4: version "0.1.4" @@ -3529,9 +3522,9 @@ ejs@^2.6.1: integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ== electron-to-chromium@^1.3.86: - version "1.3.88" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.88.tgz#f36ab32634f49ef2b0fdc1e82e2d1cc17feb29e7" - integrity sha512-UPV4NuQMKeUh1S0OWRvwg0PI8ASHN9kBC8yDTk1ROXLC85W5GnhTRu/MZu3Teqx3JjlQYuckuHYXSUSgtb3J+A== + version "1.3.90" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.90.tgz#b4c51b8303beff18f2b74817402bf4898e09558a" + integrity sha512-IjJZKRhFbWSOX1w0sdIXgp4CMRguu6UYcTckyFF/Gjtemsu/25eZ+RXwFlV+UWcIueHyQA1UnRJxocTpH5NdGA== elegant-spinner@^1.0.1: version "1.0.1" @@ -6292,9 +6285,9 @@ ipld-dag-pb@^0.14.4, ipld-dag-pb@~0.14.11, ipld-dag-pb@~0.14.6: stable "~0.1.8" ipld-dag-pb@~0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.15.0.tgz#f0d007fa0837ce4c7273514d3d515db992581f1f" - integrity sha512-rX8kHhiM7975LO6XgSze91TSAEVEpHLsFaLQoR1FLgKoDTwejudRdQJx6DnZmzTT+agpSvi79UYdWTI5ZP+B1w== + version "0.15.1" + resolved "https://registry.yarnpkg.com/ipld-dag-pb/-/ipld-dag-pb-0.15.1.tgz#e7a0d2b4096e5ba5d66b07e7b3c8683ade465188" + integrity sha512-/5JnKnEqSN6A7wLsW6lr7Ktxm5/NFZEdNzWFTTKQaPgyG4EL/FhnDnNqJm9m8XNZdBAGxqzGGxoDv+EzmeVkIQ== dependencies: async "^2.6.1" bs58 "^4.0.1" @@ -7878,7 +7871,7 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= -lodash.get@4.4.2, lodash.get@^4.4.2: +lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= @@ -9070,9 +9063,9 @@ node-pre-gyp@^0.11.0: tar "^4" node-releases@^1.0.5: - version "1.1.0" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.0.tgz#be7464fa8d877808237520fd49436d5e79191c3d" - integrity sha512-+qV91QMDBvARuPxUEfI/mRF/BY+UAkTIn3pvmvM2iOLIRvv6RNYklFXBgrkky6P1wXUqQW1P3qKlWxxy4JZbfg== + version "1.1.1" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.1.tgz#8fff8aea1cfcad1fb4205f805149054fbf73cafd" + integrity sha512-2UXrBr6gvaebo5TNF84C66qyJJ6r0kxBObgZIDX3D3/mt1ADKiHux3NJPWisq0wxvJJdkjECH+9IIKYViKj71Q== dependencies: semver "^5.3.0" @@ -10252,9 +10245,9 @@ pseudomap@^1.0.2: integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= psl@^1.1.24: - version "1.1.29" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.29.tgz#60f580d360170bb722a797cc704411e6da850c67" - integrity sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ== + version "1.1.31" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" + integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== public-encrypt@^4.0.0: version "4.0.3" @@ -10906,9 +10899,9 @@ release-zalgo@^1.0.0: integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== remove-array-items@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-array-items/-/remove-array-items-1.1.0.tgz#e3d4aaba795a412479ea89408dee345387da7d3b" - integrity sha512-+YAHWd5patqAM/F4uBsto9h8RXDVxPRrKW46AkbI6eH12OFrN9wlGpkNWYxCjCfwtkidTjaaCXqU634V4mysvw== + version "1.1.1" + resolved "https://registry.yarnpkg.com/remove-array-items/-/remove-array-items-1.1.1.tgz#fd745ff73d0822e561ea910bf1b401fc7843e693" + integrity sha512-MXW/jtHyl5F1PZI7NbpS8SOtympdLuF20aoWJT5lELR1p/HJDd5nqW8Eu9uLh/hCRY3FgvrIT5AwDCgBODklcA== remove-trailing-separator@^1.0.1: version "1.1.0" @@ -12590,7 +12583,7 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -terser-webpack-plugin@^1.1.0: +terser-webpack-plugin@1.1.0, terser-webpack-plugin@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.1.0.tgz#cf7c25a1eee25bf121f4a587bb9e004e3f80e528" integrity sha512-61lV0DSxMAZ8AyZG7/A4a3UPlrbOBo8NIQ4tJzLPAdGOQ+yoNC7l5ijEow27lBAL2humer01KLS6bGIMYQxKoA== @@ -12938,7 +12931,7 @@ typeforce@^1.11.3, typeforce@^1.11.5: resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc" integrity sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g== -uglify-js@^3.0.0, uglify-js@^3.1.4: +uglify-js@^3.1.4: version "3.4.9" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== @@ -12946,20 +12939,6 @@ uglify-js@^3.0.0, uglify-js@^3.1.4: commander "~2.17.1" source-map "~0.6.1" -uglifyjs-webpack-plugin@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.0.1.tgz#f346af53ed496ce72fef462517d417f62bec3010" - integrity sha512-1HhCHkOB6wRCcv7htcz1QRPVbWPEY074RP9vzt/X0LF4xXm9l4YGd0qja7z88abDixQlnVwBjXsTBs+Xsn/eeQ== - dependencies: - cacache "^11.2.0" - find-cache-dir "^2.0.0" - schema-utils "^1.0.0" - serialize-javascript "^1.4.0" - source-map "^0.6.1" - uglify-js "^3.0.0" - webpack-sources "^1.1.0" - worker-farm "^1.5.2" - ultron@1.0.x: version "1.0.2" resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa"