diff --git a/tasks/transform_conformance/snapshots/babel.snap.md b/tasks/transform_conformance/snapshots/babel.snap.md index a49703771d4d2..826b997bf2409 100644 --- a/tasks/transform_conformance/snapshots/babel.snap.md +++ b/tasks/transform_conformance/snapshots/babel.snap.md @@ -1,6 +1,6 @@ commit: 54a8389f -Passed: 437/846 +Passed: 439/846 # All Passed: * babel-plugin-transform-class-static-block @@ -276,7 +276,7 @@ x Output mismatch x Output mismatch -# babel-plugin-transform-class-properties (110/264) +# babel-plugin-transform-class-properties (112/264) * assumption-constantSuper/complex-super-class/input.js x Output mismatch @@ -795,9 +795,6 @@ x Output mismatch * private-loose/update/input.js x Output mismatch -* public/arrow-static-this-without-transform/input.js -x Output mismatch - * public/call/input.js Scope children mismatch: after transform: ScopeId(1): [ScopeId(2), ScopeId(3), ScopeId(4)] @@ -901,9 +898,6 @@ rebuilt : ScopeId(2): Some(ScopeId(0)) * public/super-with-collision/input.js x Output mismatch -* public-loose/arrow-static-this-without-transform/input.js -x Output mismatch - * public-loose/class-shadow-builtins/input.mjs x Output mismatch diff --git a/tasks/transform_conformance/update_fixtures.js b/tasks/transform_conformance/update_fixtures.js index 3d5ce11fd1421..0e9c86fe71c40 100644 --- a/tasks/transform_conformance/update_fixtures.js +++ b/tasks/transform_conformance/update_fixtures.js @@ -110,7 +110,7 @@ async function updateDir(dirPath, options, hasChangedOptions) { await backupFile(path); await writeFile(path, JSON.stringify(localOptions, null, 2) + '\n'); } - options = mergeOptions(options, localOptions); + options = { ...options, ...localOptions }; } // Run Babel with updated options/input @@ -154,58 +154,6 @@ function updateOptions(options) { return hasChangedOptions; } -/** - * Merge `options` into `parentOptions`. - * Returns merged options object. Does not mutate either input. - * @param {Object} parentOptions - Parent options - * @param {Object} options - Local options - * @returns {Object} - Merged options object - */ -function mergeOptions(parentOptions, options) { - parentOptions = { ...parentOptions }; - - function merge(key) { - if (!options[key]) return; - - if (!parentOptions[key]) { - parentOptions[key] = options[key]; - return; - } - - parentOptions[key] = [...parentOptions[key]]; - - const parentPluginIndexes = new Map(); - for (const [index, plugin] of parentOptions[key].entries()) { - parentPluginIndexes.set(getName(plugin), index); - } - - for (const plugin of options[key]) { - const pluginName = getName(plugin); - const parentPluginIndex = parentPluginIndexes.get(pluginName); - if (parentPluginIndex !== undefined) { - parentOptions[key][parentPluginIndex] = plugin; - } else { - parentOptions[key].push(plugin); - } - } - } - - merge('presets'); - merge('plugins'); - - if (options.assumptions) { - parentOptions.assumptions = { ...parentOptions.assumptions, ...options.assumptions }; - } - - for (const [key, value] of Object.entries(options)) { - if (key === 'plugins' || key === 'presets' || key === 'assumptions') continue; - if (Object.hasOwn(parentOptions, key)) throw new Error(`Clash: ${key}`); - parentOptions[key] = value; - } - - return parentOptions; -} - /** * Transform input with Babel and save to output file. * @param {string} inputPath - Path of input file