@lwc/template-compiler 3.7.2 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -12757,6 +12757,11 @@ function collectParamsFromMemberExpression(_node, _vars) {
12757
12757
  * SPDX-License-Identifier: MIT
12758
12758
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
12759
12759
  */
12760
+ // structuredClone is only available in Node 17+
12761
+ // https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility
12762
+ const doStructuredClone = typeof structuredClone === 'function'
12763
+ ? structuredClone
12764
+ : (obj) => JSON.parse(JSON.stringify(obj));
12760
12765
  const RENDER_APIS = {
12761
12766
  iterator: { name: 'i', alias: 'api_iterator' },
12762
12767
  flatten: { name: 'f', alias: 'api_flatten' },
@@ -13014,6 +13019,9 @@ class CodeGen {
13014
13019
  return bindComplexExpression(expression, this);
13015
13020
  }
13016
13021
  const scope = this;
13022
+ // Cloning here is necessary because `this.replace()` is destructive, and we might use the
13023
+ // node later during static content optimization
13024
+ expression = doStructuredClone(expression);
13017
13025
  estreeWalker.walk(expression, {
13018
13026
  leave(node, parent) {
13019
13027
  if (parent !== null &&
@@ -13831,5 +13839,5 @@ function compile(source, config) {
13831
13839
  exports.compile = compile;
13832
13840
  exports.default = compile;
13833
13841
  exports.parse = parse;
13834
- /** version: 3.7.2 */
13842
+ /** version: 3.8.0 */
13835
13843
  //# sourceMappingURL=index.cjs.js.map