From 8c8ac9170671877be450bd9eb27bb2928ab46496 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Thu, 23 Apr 2020 23:19:48 +0200 Subject: [PATCH] build: remove babel-plugin-add-module-exports Since we have deprecated deep requires we no longer need the module.exports from the individual v*.js files. Since we now ship plain, non-babled deep require files on the top level of the npm package for legacy CommonJS deep-require support we can compensate for the lack of module.exports in there and instead simply access the "default" export of the algorithm-specific modules. This change was inspired by https://github.com/webpack/webpack/issues/7973#issuecomment-417931938 --- .babelrc.js | 1 - package-lock.json | 9 --------- package.json | 1 - v1.js | 2 +- v3.js | 2 +- v4.js | 2 +- v5.js | 2 +- 7 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.babelrc.js b/.babelrc.js index df8cb2e1..f42a05a4 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -3,7 +3,6 @@ module.exports = { plugins: [], env: { commonjs: { - plugins: ['babel-plugin-add-module-exports'], presets: [['@babel/preset-env', { targets: { node: '8' }, modules: 'commonjs' }]], }, esmBrowser: { diff --git a/package-lock.json b/package-lock.json index 783dc4f9..95db6ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3289,15 +3289,6 @@ } } }, - "babel-plugin-add-module-exports": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.2.tgz", - "integrity": "sha512-4paN7RivvU3Rzju1vGSHWPjO8Y0rI6droWvSFKI6dvEQ4mvoV0zGojnlzVRfI6N8zISo6VERXt3coIuVmzuvNg==", - "dev": true, - "requires": { - "chokidar": "^2.0.4" - } - }, "babel-plugin-dynamic-import-node": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", diff --git a/package.json b/package.json index f08f7e82..2cd78a15 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "@wdio/static-server-service": "6.0.13", "@wdio/sync": "6.0.15", "babel-eslint": "10.1.0", - "babel-plugin-add-module-exports": "1.0.2", "bundlewatch": "0.2.6", "eslint": "6.8.0", "eslint-config-prettier": "6.10.1", diff --git a/v1.js b/v1.js index aa298075..22660e52 100644 --- a/v1.js +++ b/v1.js @@ -1,6 +1,6 @@ const deprecate = require('./deprecate.js'); -const v1 = require('./dist/v1.js'); +const { default: v1 } = require('./dist/v1.js'); module.exports = deprecate( v1, diff --git a/v3.js b/v3.js index 3240e03c..758fd6d3 100644 --- a/v3.js +++ b/v3.js @@ -1,6 +1,6 @@ const deprecate = require('./deprecate.js'); -const v3 = require('./dist/v3.js'); +const { default: v3 } = require('./dist/v3.js'); module.exports = deprecate( v3, diff --git a/v4.js b/v4.js index a0385e3d..3ee74689 100644 --- a/v4.js +++ b/v4.js @@ -1,6 +1,6 @@ const deprecate = require('./deprecate.js'); -const v4 = require('./dist/v4.js'); +const { default: v4 } = require('./dist/v4.js'); module.exports = deprecate( v4, diff --git a/v5.js b/v5.js index 3d145c12..a8906f81 100644 --- a/v5.js +++ b/v5.js @@ -1,6 +1,6 @@ const deprecate = require('./deprecate.js'); -const v5 = require('./dist/v5.js'); +const { default: v5 } = require('./dist/v5.js'); module.exports = deprecate( v5,