<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">@babel/cli</p>
<h3 dir="auto">Input code</h3>
<p dir="auto"><a href="https://babeljs.io/repl#?browsers=%3E%201%25&amp;build=&amp;builtIns=false&amp;corejs=false&amp;spec=false&amp;loose=false&amp;code_lz=DYUwLgBA3hAeCsAuaEDu8A0EB0uCe8EAvsRALwQBmArgHYDGYAlgPa0DCAhsMACoAWnMAEkAzgBFqAB2BN6QkABMAFAEoA3EA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=true&amp;fileSize=true&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env%2Ctypescript&amp;prettier=false&amp;targets=&amp;version=7.13.17&amp;externalPlugins=%40babel%2Fplugin-proposal-object-rest-spread%407.14.7&amp;assumptions=%7B%7D" rel="nofollow">https://babeljs.io/repl#?browsers=%3E%201%25&amp;build=&amp;builtIns=false&amp;corejs=false&amp;spec=false&amp;loose=false&amp;code_lz=DYUwLgBA3hAeCsAuaEDu8A0EB0uCe8EAvsRALwQBmArgHYDGYAlgPa0DCAhsMACoAWnMAEkAzgBFqAB2BN6QkABMAFAEoA3EA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=true&amp;fileSize=true&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=env%2Ctypescript&amp;prettier=false&amp;targets=&amp;version=7.13.17&amp;externalPlugins=%40babel%2Fplugin-proposal-object-rest-spread%407.14.7&amp;assumptions=%7B%7D</a></p>
<p dir="auto">I've also made a reproducible test case in this branch <a href="https://github.com/dan-kez/babel/tree/duplicate_function_call_in_variable_destructuring">https://github.com/dan-kez/babel/tree/duplicate_function_call_in_variable_destructuring</a></p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto">babel.config.json</p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto"><em>Current Behavior:</em><br>
As shown in the repl above the <code class="notranslate">functionCallThatIsDuplicated</code> function is called twice in the compiled code. This is not expected as in the original code the api call is only made once.</p>
<p dir="auto"><em>Expected Behavior:</em><br>
When using <code class="notranslate">@babel/plugin-proposal-object-rest-spread</code> right hand operation is called once and only once to match the original code.</p>
<h3 dir="auto">Environment</h3>
<p dir="auto">(Reproducible in the REPL link above)</p>
<p dir="auto">Below is my project environment but the minimal reproducible example in the REPL link shows the same error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  System:
    OS: macOS 10.15.7
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.5/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
  Monorepos:
    Yarn Workspaces: 1.22.11
    Lerna: 3.20.2
  npmPackages:
    @babel/cli: 7.12.1 =&gt; 7.12.1
    @babel/core: 7.12.3 =&gt; 7.12.3
    @babel/helper-compilation-targets: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-class-properties: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-decorators: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-object-rest-spread: 7.12.1 =&gt; 7.12.1
    @babel/plugin-syntax-dynamic-import: 7.8.3 =&gt; 7.8.3
    @babel/plugin-transform-react-jsx: 7.12.1 =&gt; 7.12.1
    @babel/plugin-transform-regenerator: 7.12.1 =&gt; 7.12.1
    @babel/preset-env: 7.12.1 =&gt; 7.12.1
    @babel/preset-react: 7.12.1 =&gt; 7.12.1
    @babel/preset-typescript: 7.12.1 =&gt; 7.12.1
    @babel/runtime: 7.12.1 =&gt; 7.12.1
    babel-eslint: 10.1.0 =&gt; 10.1.0
    babel-jest: 26.6.3 =&gt; 26.6.3
    babel-loader: 8.2.2 =&gt; 8.2.2
    babel-plugin-lodash: 3.3.4 =&gt; 3.3.4
    babel-plugin-module-resolver: 4.0.0 =&gt; 4.0.0
    babel-plugin-react-docgen: 4.2.1 =&gt; 4.2.1
    babel-plugin-require-context-hook: 1.0.0 =&gt; 1.0.0
    babel-plugin-styled-components: 1.11.1 =&gt; 1.11.1
    babel-plugin-transform-dynamic-import: 2.1.0 =&gt; 2.1.0
    babel-plugin-transform-react-remove-prop-types: 0.4.24 =&gt; 0.4.24
    eslint: 7.32.0 =&gt; 7.32.0
    eslint-import-resolver-babel-module: 5.3.1 =&gt; 5.3.1
    jest: 26.6.3 =&gt; 26.6.3
    lerna: 3.20.2 =&gt; 3.20.2
    webpack: 4.46.0 =&gt; 4.46.0"><pre class="notranslate"><code class="notranslate">  System:
    OS: macOS 10.15.7
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.5/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
  Monorepos:
    Yarn Workspaces: 1.22.11
    Lerna: 3.20.2
  npmPackages:
    @babel/cli: 7.12.1 =&gt; 7.12.1
    @babel/core: 7.12.3 =&gt; 7.12.3
    @babel/helper-compilation-targets: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-class-properties: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-decorators: 7.12.1 =&gt; 7.12.1
    @babel/plugin-proposal-object-rest-spread: 7.12.1 =&gt; 7.12.1
    @babel/plugin-syntax-dynamic-import: 7.8.3 =&gt; 7.8.3
    @babel/plugin-transform-react-jsx: 7.12.1 =&gt; 7.12.1
    @babel/plugin-transform-regenerator: 7.12.1 =&gt; 7.12.1
    @babel/preset-env: 7.12.1 =&gt; 7.12.1
    @babel/preset-react: 7.12.1 =&gt; 7.12.1
    @babel/preset-typescript: 7.12.1 =&gt; 7.12.1
    @babel/runtime: 7.12.1 =&gt; 7.12.1
    babel-eslint: 10.1.0 =&gt; 10.1.0
    babel-jest: 26.6.3 =&gt; 26.6.3
    babel-loader: 8.2.2 =&gt; 8.2.2
    babel-plugin-lodash: 3.3.4 =&gt; 3.3.4
    babel-plugin-module-resolver: 4.0.0 =&gt; 4.0.0
    babel-plugin-react-docgen: 4.2.1 =&gt; 4.2.1
    babel-plugin-require-context-hook: 1.0.0 =&gt; 1.0.0
    babel-plugin-styled-components: 1.11.1 =&gt; 1.11.1
    babel-plugin-transform-dynamic-import: 2.1.0 =&gt; 2.1.0
    babel-plugin-transform-react-remove-prop-types: 0.4.24 =&gt; 0.4.24
    eslint: 7.32.0 =&gt; 7.32.0
    eslint-import-resolver-babel-module: 5.3.1 =&gt; 5.3.1
    jest: 26.6.3 =&gt; 26.6.3
    lerna: 3.20.2 =&gt; 3.20.2
    webpack: 4.46.0 =&gt; 4.46.0
</code></pre></div>
<h3 dir="auto">Possible solution</h3>
<p dir="auto">I'm not familiar with the internal implementation of <code class="notranslate">@babel/plugin-proposal-object-rest-spread</code> but it would be possible to first assign the result of the right hand assignment to a temporary variable and then use that temporary variable in subsequent calls to <code class="notranslate">_objectWithoutProperties</code></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>
<h2 dir="auto">Feature Request</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I would like to work on this feature!</li>
</ul>
<p dir="auto"><strong>Is your feature request related to a problem? Please describe.</strong><br>
Dependency scanners may report <a title="CVE-2019-20149" data-hovercard-type="advisory" data-hovercard-url="/advisories/GHSA-6c8f-qphg-qjgp/hovercard" href="https://github.com/advisories/GHSA-6c8f-qphg-qjgp">CVE-2019-20149</a> for projects that depend on @babel/cli@7.8.4. This is due to dependency on an version of kind-of because of this dependency chain: chokidar@^2.1.8 → braces (2.3.2) → is-number (3.0.0) → kind-of (3.2.2)</p>
<p dir="auto"><strong>Describe the solution you'd like</strong><br>
Upgrade to chokidar@^3.4.0. This should remove the dependency on is-number and kind-of.</p>
<p dir="auto">Note that chokidar@^3.4.0 requires "node": "&gt;= 8.10.0". What is babel 7's policy for minimum supported node version?</p>
<p dir="auto"><strong>Describe alternatives you've considered</strong><br>
Perhaps overriding the @babel/cli on chokidar dependency via "resolutions" could solve the problem within my code-base. Alternatively, we could maintain a fork with the chokdiar version upgraded.</p>
<p dir="auto"><strong>Teachability, Documentation, Adoption, Migration Strategy</strong><br>
Upgrade chokidar version, pulling along interface changes.</p>