@lwc/template-compiler 3.7.3 → 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.js CHANGED
@@ -12733,6 +12733,11 @@ function collectParamsFromMemberExpression(_node, _vars) {
12733
12733
  * SPDX-License-Identifier: MIT
12734
12734
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
12735
12735
  */
12736
+ // structuredClone is only available in Node 17+
12737
+ // https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility
12738
+ const doStructuredClone = typeof structuredClone === 'function'
12739
+ ? structuredClone
12740
+ : (obj) => JSON.parse(JSON.stringify(obj));
12736
12741
  const RENDER_APIS = {
12737
12742
  iterator: { name: 'i', alias: 'api_iterator' },
12738
12743
  flatten: { name: 'f', alias: 'api_flatten' },
@@ -12990,6 +12995,9 @@ class CodeGen {
12990
12995
  return bindComplexExpression(expression, this);
12991
12996
  }
12992
12997
  const scope = this;
12998
+ // Cloning here is necessary because `this.replace()` is destructive, and we might use the
12999
+ // node later during static content optimization
13000
+ expression = doStructuredClone(expression);
12993
13001
  walk(expression, {
12994
13002
  leave(node, parent) {
12995
13003
  if (parent !== null &&
@@ -13805,5 +13813,5 @@ function compile(source, config) {
13805
13813
  }
13806
13814
 
13807
13815
  export { ElementDirectiveName, LWCDirectiveDomMode, LWCDirectiveRenderMode, LwcTagName, RootDirectiveName, TemplateDirectiveName, compile, compile as default, parse };
13808
- /** version: 3.7.3 */
13816
+ /** version: 3.8.0 */
13809
13817
  //# sourceMappingURL=index.js.map