From 0f22db981dc615d76be1c7dd74fc840fae41827c Mon Sep 17 00:00:00 2001 From: Mark Molinaro Date: Sat, 6 Nov 2021 00:01:21 +0000 Subject: [PATCH] Fix names of options to match the exported types --- lib/config/defaults.js | 2 +- .../HarmonyExportDependencyParserPlugin.js | 8 ++++---- .../HarmonyExportImportedSpecifierDependency.js | 8 ++++---- .../HarmonyImportDependencyParserPlugin.js | 8 ++++---- lib/dependencies/HarmonyImportSpecifierDependency.js | 8 ++++---- test/Defaults.unittest.js | 2 +- .../compiletime/exports-presence/webpack.config.js | 12 ++++++------ 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 8c5cdc4aa9a..0f07ff9a1c9 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -449,7 +449,7 @@ const applyJavascriptParserOptionsDefaults = ( D(parserOptions, "wrappedContextRecursive", true); D(parserOptions, "wrappedContextCritical", false); D(parserOptions, "strictThisContextOnImports", false); - if (futureDefaults) D(parserOptions, "exportPresence", "error"); + if (futureDefaults) D(parserOptions, "exportsPresence", "error"); }; /** diff --git a/lib/dependencies/HarmonyExportDependencyParserPlugin.js b/lib/dependencies/HarmonyExportDependencyParserPlugin.js index 038b2f375ab..2beefc0fe22 100644 --- a/lib/dependencies/HarmonyExportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyExportDependencyParserPlugin.js @@ -23,10 +23,10 @@ const { HarmonyStarExportsList } = HarmonyExportImportedSpecifierDependency; module.exports = class HarmonyExportDependencyParserPlugin { constructor(options) { this.exportPresenceMode = - options.reexportExportPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.reexportExportPresence) - : options.exportPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportPresence) + options.reexportExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.reexportExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) : options.strictExportPresence ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; diff --git a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js index c49967d77db..3859254f1a6 100644 --- a/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +++ b/lib/dependencies/HarmonyExportImportedSpecifierDependency.js @@ -755,8 +755,8 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @returns {WebpackError[]} warnings */ getWarnings(moduleGraph) { - const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportPresence === ExportPresenceModes.WARN) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { return this._getErrors(moduleGraph); } return null; @@ -768,8 +768,8 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency { * @returns {WebpackError[]} errors */ getErrors(moduleGraph) { - const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportPresence === ExportPresenceModes.ERROR) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { return this._getErrors(moduleGraph); } return null; diff --git a/lib/dependencies/HarmonyImportDependencyParserPlugin.js b/lib/dependencies/HarmonyImportDependencyParserPlugin.js index 4096eb97c0d..c0c1f6896ce 100644 --- a/lib/dependencies/HarmonyImportDependencyParserPlugin.js +++ b/lib/dependencies/HarmonyImportDependencyParserPlugin.js @@ -67,10 +67,10 @@ module.exports = class HarmonyImportDependencyParserPlugin { */ constructor(options) { this.exportPresenceMode = - options.importExportPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.importExportPresence) - : options.exportPresence !== undefined - ? ExportPresenceModes.fromUserOption(options.exportPresence) + options.importExportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.importExportsPresence) + : options.exportsPresence !== undefined + ? ExportPresenceModes.fromUserOption(options.exportsPresence) : options.strictExportPresence ? ExportPresenceModes.ERROR : ExportPresenceModes.AUTO; diff --git a/lib/dependencies/HarmonyImportSpecifierDependency.js b/lib/dependencies/HarmonyImportSpecifierDependency.js index 52884bf55c2..83818c8c067 100644 --- a/lib/dependencies/HarmonyImportSpecifierDependency.js +++ b/lib/dependencies/HarmonyImportSpecifierDependency.js @@ -173,8 +173,8 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { * @returns {WebpackError[]} warnings */ getWarnings(moduleGraph) { - const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportPresence === ExportPresenceModes.WARN) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.WARN) { return this._getErrors(moduleGraph); } return null; @@ -186,8 +186,8 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency { * @returns {WebpackError[]} errors */ getErrors(moduleGraph) { - const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph); - if (exportPresence === ExportPresenceModes.ERROR) { + const exportsPresence = this._getEffectiveExportPresenceLevel(moduleGraph); + if (exportsPresence === ExportPresenceModes.ERROR) { return this._getErrors(moduleGraph); } return null; diff --git a/test/Defaults.unittest.js b/test/Defaults.unittest.js index 24cc153a7f2..e1e132b6b84 100644 --- a/test/Defaults.unittest.js +++ b/test/Defaults.unittest.js @@ -1939,7 +1939,7 @@ describe("Defaults", () => { + }, + Object { @@ ... @@ - + "exportPresence": "error", + + "exportsPresence": "error", @@ ... @@ - "__dirname": "mock", - "__filename": "mock", diff --git a/test/configCases/compiletime/exports-presence/webpack.config.js b/test/configCases/compiletime/exports-presence/webpack.config.js index 2ef2a712638..7634dfd7a65 100644 --- a/test/configCases/compiletime/exports-presence/webpack.config.js +++ b/test/configCases/compiletime/exports-presence/webpack.config.js @@ -6,27 +6,27 @@ module.exports = { { test: /aaa/, parser: { - exportPresence: false + exportsPresence: false } }, { test: /bbb/, parser: { - exportPresence: "warn" + exportsPresence: "warn" } }, { test: /ccc/, parser: { - exportPresence: "error" + exportsPresence: "error" } }, { test: /ddd/, parser: { - exportPresence: "error", - importExportPresence: "warn", - reexportExportPresence: false + exportsPresence: "error", + importExportsPresence: "warn", + reexportExportsPresence: false } } ]