From 932680dd439668e12829c71a23a022be19a1c771 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Tue, 25 Jun 2019 22:59:25 +0200 Subject: [PATCH 1/2] Update to webpack-asset-relocator-loader 0.5.6, filterAssetBase --- package.json | 2 +- readme.md | 2 ++ src/index.js | 2 ++ test/integration/npm.js | 2 ++ test/unit/externals/output.js | 1 + test/unit/runtime-notfound/output.js | 1 + test/unit/shebang/output.js | 1 + test/unit/ts-decl/output-coverage.js | 1 + test/unit/ts-decl/output.js | 1 + .../output-coverage.js | 1 + test/unit/tsconfig-paths-conflicting-external/output.js | 1 + test/unit/tsconfig-paths/output-coverage.js | 1 + test/unit/tsconfig-paths/output.js | 1 + yarn.lock | 8 ++++---- 14 files changed, 20 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 63d16a4a..40552f0e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@google-cloud/firestore": "^2.2.0", "@sentry/node": "^4.3.0", "@tensorflow/tfjs-node": "^0.3.0", - "@zeit/webpack-asset-relocator-loader": "0.5.5", + "@zeit/webpack-asset-relocator-loader": "0.5.6", "analytics-node": "^3.3.0", "apollo-server-express": "^2.2.2", "arg": "^4.1.0", diff --git a/readme.md b/readme.md index 32f55f3d..9bbc770f 100644 --- a/readme.md +++ b/readme.md @@ -72,6 +72,8 @@ require('@zeit/ncc')('/path/to/input', { cache: "./custom/cache/path" | false, // externals to leave as requires of the build externals: ["externalpackage"], + // directory outside of which never to emit assets + filterAssetBase: process.cwd(), // default minify: false, // default sourceMap: false, // default sourceMapBasePrefix: '../' // default treats sources as output-relative diff --git a/src/index.js b/src/index.js index fa57f503..e2257ad4 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,7 @@ module.exports = ( sourceMapBasePrefix = '../', watch = false, v8cache = false, + filterAssetBase = process.cwd(), quiet = false, debugLog = false } = {} @@ -154,6 +155,7 @@ module.exports = ( }, { loader: eval('__dirname + "/loaders/relocate-loader.js"'), options: { + filterAssetBase, existingAssetNames, escapeNonAnalyzableRequires: true, wrapperCompatibility: true, diff --git a/test/integration/npm.js b/test/integration/npm.js index 76f7ec7e..31c3aa6e 100644 --- a/test/integration/npm.js +++ b/test/integration/npm.js @@ -1,5 +1,6 @@ const npm = require('npm'); const install = require('npm/lib/install'); +const rimraf = require('rimraf'); npm.load((err) => { if (err) { @@ -13,4 +14,5 @@ npm.load((err) => { } const args = [`lodash@4.1.17`]; install('./asdf', args, () => {}); + rimraf.sync('./asdf'); }); diff --git a/test/unit/externals/output.js b/test/unit/externals/output.js index 5515062c..a31c3913 100644 --- a/test/unit/externals/output.js +++ b/test/unit/externals/output.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/runtime-notfound/output.js b/test/unit/runtime-notfound/output.js index 10b35a07..2c6d4994 100644 --- a/test/unit/runtime-notfound/output.js +++ b/test/unit/runtime-notfound/output.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/shebang/output.js b/test/unit/shebang/output.js index 700c3afc..7598b825 100644 --- a/test/unit/shebang/output.js +++ b/test/unit/shebang/output.js @@ -30,6 +30,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/ts-decl/output-coverage.js b/test/unit/ts-decl/output-coverage.js index a6973e53..5a0a3d79 100644 --- a/test/unit/ts-decl/output-coverage.js +++ b/test/unit/ts-decl/output-coverage.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/ts-decl/output.js b/test/unit/ts-decl/output.js index b12eda06..18739246 100644 --- a/test/unit/ts-decl/output.js +++ b/test/unit/ts-decl/output.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js index e369ee72..4680131f 100644 --- a/test/unit/tsconfig-paths-conflicting-external/output-coverage.js +++ b/test/unit/tsconfig-paths-conflicting-external/output-coverage.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/tsconfig-paths-conflicting-external/output.js b/test/unit/tsconfig-paths-conflicting-external/output.js index 213714f2..5c8025c4 100644 --- a/test/unit/tsconfig-paths-conflicting-external/output.js +++ b/test/unit/tsconfig-paths-conflicting-external/output.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/tsconfig-paths/output-coverage.js b/test/unit/tsconfig-paths/output-coverage.js index 65518eba..ec7119cc 100644 --- a/test/unit/tsconfig-paths/output-coverage.js +++ b/test/unit/tsconfig-paths/output-coverage.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/tsconfig-paths/output.js b/test/unit/tsconfig-paths/output.js index 04194837..26335193 100644 --- a/test/unit/tsconfig-paths/output.js +++ b/test/unit/tsconfig-paths/output.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/yarn.lock b/yarn.lock index d35fb0ab..d04b716b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1328,10 +1328,10 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== -"@zeit/webpack-asset-relocator-loader@0.5.5": - version "0.5.5" - resolved "https://registry.yarnpkg.com/@zeit/webpack-asset-relocator-loader/-/webpack-asset-relocator-loader-0.5.5.tgz#c50543e479feb642c68356f0216759325544b507" - integrity sha512-QrAytM+XznVV1q3E1nkg95ASYka2kz/OEoDTZ/GeDRWihYmk8iyqqI4XpzystIYOc4vi7jXkHmuQutscs6PgAw== +"@zeit/webpack-asset-relocator-loader@0.5.6": + version "0.5.6" + resolved "https://registry.yarnpkg.com/@zeit/webpack-asset-relocator-loader/-/webpack-asset-relocator-loader-0.5.6.tgz#adfa4d3b0cc740aee57950e29efbaf2d40dc15c7" + integrity sha512-fK1zeOB67cob8eBkhgN+OKU5HsEe/XmKq1As6SVzmy1BxyWVpdUIIDeQtRHZM6veG/j7/a5XOeP/VpOOz1ingw== dependencies: sourcemap-codec "^1.4.4" From 98eeb5fe261cee7500d2f24f6d35645af53cd9ee Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 26 Jun 2019 01:18:31 +0200 Subject: [PATCH 2/2] update coverage tests --- test/unit/externals/output-coverage.js | 1 + test/unit/runtime-notfound/output-coverage.js | 1 + test/unit/shebang/output-coverage.js | 1 + 3 files changed, 3 insertions(+) diff --git a/test/unit/externals/output-coverage.js b/test/unit/externals/output-coverage.js index ca362203..8e3e0163 100644 --- a/test/unit/externals/output-coverage.js +++ b/test/unit/externals/output-coverage.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/runtime-notfound/output-coverage.js b/test/unit/runtime-notfound/output-coverage.js index 0f530efc..f5911044 100644 --- a/test/unit/runtime-notfound/output-coverage.js +++ b/test/unit/runtime-notfound/output-coverage.js @@ -29,6 +29,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() { diff --git a/test/unit/shebang/output-coverage.js b/test/unit/shebang/output-coverage.js index 2d7cae7a..571ba32a 100644 --- a/test/unit/shebang/output-coverage.js +++ b/test/unit/shebang/output-coverage.js @@ -30,6 +30,7 @@ module.exports = /******/ } /******/ /******/ +/******/ __webpack_require__.ab = __dirname + "/"; /******/ /******/ // the startup function /******/ function startup() {