lwc 2.31.7 → 2.31.8

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.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +144 -113
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +144 -113
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +98 -4
  5. package/dist/engine-dom/iife/es5/engine-dom.js +272 -175
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +201 -77
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +144 -113
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +98 -4
  11. package/dist/engine-dom/umd/es5/engine-dom.js +272 -175
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +201 -77
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +105 -65
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +105 -65
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -347,9 +347,9 @@
347
347
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
348
348
  */
349
349
  // Increment whenever the LWC template compiler changes
350
- const LWC_VERSION = "2.31.7";
350
+ const LWC_VERSION = "2.31.8";
351
351
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
352
- /** version: 2.31.7 */
352
+ /** version: 2.31.8 */
353
353
 
354
354
  /**
355
355
  * Copyright (C) 2018 salesforce.com, inc.
@@ -431,7 +431,7 @@
431
431
  patch$1(propName);
432
432
  }
433
433
  }
434
- /** version: 2.31.7 */
434
+ /** version: 2.31.8 */
435
435
 
436
436
  /**
437
437
  * Copyright (C) 2018 salesforce.com, inc.
@@ -511,7 +511,7 @@
511
511
  setFeatureFlag(name, value);
512
512
  }
513
513
  }
514
- /** version: 2.31.7 */
514
+ /** version: 2.31.8 */
515
515
 
516
516
  /*
517
517
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3002,6 +3002,93 @@
3002
3002
  freeze(BaseBridgeElement);
3003
3003
  seal(BaseBridgeElement.prototype);
3004
3004
 
3005
+ /*
3006
+ * Copyright (c) 2023, salesforce.com, inc.
3007
+ * All rights reserved.
3008
+ * SPDX-License-Identifier: MIT
3009
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3010
+ */
3011
+ const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
3012
+ // In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
3013
+ class LegacyWeakMultiMap {
3014
+ constructor() {
3015
+ this._map = new WeakMap();
3016
+ }
3017
+ _getValues(key) {
3018
+ let values = this._map.get(key);
3019
+ if (isUndefined$1(values)) {
3020
+ values = new Set();
3021
+ this._map.set(key, values);
3022
+ }
3023
+ return values;
3024
+ }
3025
+ get(key) {
3026
+ return this._getValues(key);
3027
+ }
3028
+ add(key, vm) {
3029
+ const set = this._getValues(key);
3030
+ set.add(vm);
3031
+ }
3032
+ delete(key) {
3033
+ this._map.delete(key);
3034
+ }
3035
+ }
3036
+ // This implementation relies on the WeakRef/FinalizationRegistry proposal.
3037
+ // For some background, see: https://github.com/tc39/proposal-weakrefs
3038
+ class ModernWeakMultiMap {
3039
+ constructor() {
3040
+ this._map = new WeakMap();
3041
+ this._registry = new FinalizationRegistry((weakRefs) => {
3042
+ // This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
3043
+ // JS VMs are not obligated to call FinalizationRegistry callbacks.
3044
+ // Work backwards, removing stale VMs
3045
+ for (let i = weakRefs.length - 1; i >= 0; i--) {
3046
+ const vm = weakRefs[i].deref();
3047
+ if (isUndefined$1(vm)) {
3048
+ ArraySplice.call(weakRefs, i, 1); // remove
3049
+ }
3050
+ }
3051
+ });
3052
+ }
3053
+ _getWeakRefs(key) {
3054
+ let weakRefs = this._map.get(key);
3055
+ if (isUndefined$1(weakRefs)) {
3056
+ weakRefs = [];
3057
+ this._map.set(key, weakRefs);
3058
+ }
3059
+ return weakRefs;
3060
+ }
3061
+ get(key) {
3062
+ const weakRefs = this._getWeakRefs(key);
3063
+ const result = new Set();
3064
+ for (const weakRef of weakRefs) {
3065
+ const vm = weakRef.deref();
3066
+ if (!isUndefined$1(vm)) {
3067
+ result.add(vm);
3068
+ }
3069
+ }
3070
+ return result;
3071
+ }
3072
+ add(key, value) {
3073
+ const weakRefs = this._getWeakRefs(key);
3074
+ // We could check for duplicate values here, but it doesn't seem worth it.
3075
+ // We transform the output into a Set anyway
3076
+ ArrayPush$1.call(weakRefs, new WeakRef(value));
3077
+ // It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
3078
+ // effectively creates a strong reference between the first argument (the "target") and the held value. When
3079
+ // the target is GC'ed, the callback is called, and then the held value is GC'ed.
3080
+ // Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
3081
+ // of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
3082
+ // to anything. See also this example:
3083
+ // https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
3084
+ this._registry.register(value, weakRefs);
3085
+ }
3086
+ delete(key) {
3087
+ this._map.delete(key);
3088
+ }
3089
+ }
3090
+ const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
3091
+
3005
3092
  /*
3006
3093
  * Copyright (c) 2020, salesforce.com, inc.
3007
3094
  * All rights reserved.
@@ -3011,67 +3098,62 @@
3011
3098
  const swappedTemplateMap = new WeakMap();
3012
3099
  const swappedComponentMap = new WeakMap();
3013
3100
  const swappedStyleMap = new WeakMap();
3014
- const activeTemplates = new WeakMap();
3015
- const activeComponents = new WeakMap();
3016
- const activeStyles = new WeakMap();
3101
+ // The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
3102
+ // so we don't want to create strong references to them.
3103
+ // The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
3104
+ // never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
3105
+ const activeTemplates = new WeakMultiMap();
3106
+ const activeComponents = new WeakMultiMap();
3107
+ const activeStyles = new WeakMultiMap();
3017
3108
  function rehydrateHotTemplate(tpl) {
3018
3109
  const list = activeTemplates.get(tpl);
3019
- if (!isUndefined$1(list)) {
3020
- list.forEach((vm) => {
3021
- if (isFalse(vm.isDirty)) {
3022
- // forcing the vm to rehydrate in the micro-task:
3023
- markComponentAsDirty(vm);
3024
- scheduleRehydration(vm);
3025
- }
3026
- });
3027
- // resetting the Set to release the memory of those vm references
3028
- // since they are not longer related to this template, instead
3029
- // they will get re-associated once these instances are rehydrated.
3030
- list.clear();
3110
+ for (const vm of list) {
3111
+ if (isFalse(vm.isDirty)) {
3112
+ // forcing the vm to rehydrate in the micro-task:
3113
+ markComponentAsDirty(vm);
3114
+ scheduleRehydration(vm);
3115
+ }
3031
3116
  }
3117
+ // Resetting the Set since these VMs are no longer related to this template, instead
3118
+ // they will get re-associated once these instances are rehydrated.
3119
+ activeTemplates.delete(tpl);
3032
3120
  return true;
3033
3121
  }
3034
3122
  function rehydrateHotStyle(style) {
3035
3123
  const list = activeStyles.get(style);
3036
- if (!isUndefined$1(list)) {
3037
- list.forEach((vm) => {
3038
- // if a style definition is swapped, we must reset
3039
- // vm's template content in the next micro-task:
3040
- forceRehydration(vm);
3041
- });
3042
- // resetting the Set to release the memory of those vm references
3043
- // since they are not longer related to this style, instead
3044
- // they will get re-associated once these instances are rehydrated.
3045
- list.clear();
3046
- }
3124
+ for (const vm of list) {
3125
+ // if a style definition is swapped, we must reset
3126
+ // vm's template content in the next micro-task:
3127
+ forceRehydration(vm);
3128
+ }
3129
+ // Resetting the Set since these VMs are no longer related to this style, instead
3130
+ // they will get re-associated once these instances are rehydrated.
3131
+ activeStyles.delete(style);
3047
3132
  return true;
3048
3133
  }
3049
3134
  function rehydrateHotComponent(Ctor) {
3050
3135
  const list = activeComponents.get(Ctor);
3051
3136
  let canRefreshAllInstances = true;
3052
- if (!isUndefined$1(list)) {
3053
- list.forEach((vm) => {
3054
- const { owner } = vm;
3055
- if (!isNull(owner)) {
3056
- // if a component class definition is swapped, we must reset
3057
- // owner's template content in the next micro-task:
3058
- forceRehydration(owner);
3059
- }
3060
- else {
3061
- // the hot swapping for components only work for instances of components
3062
- // created from a template, root elements can't be swapped because we
3063
- // don't have a way to force the creation of the element with the same state
3064
- // of the current element.
3065
- // Instead, we can report the problem to the caller so it can take action,
3066
- // for example: reload the entire page.
3067
- canRefreshAllInstances = false;
3068
- }
3069
- });
3070
- // resetting the Set to release the memory of those vm references
3071
- // since they are not longer related to this constructor, instead
3072
- // they will get re-associated once these instances are rehydrated.
3073
- list.clear();
3074
- }
3137
+ for (const vm of list) {
3138
+ const { owner } = vm;
3139
+ if (!isNull(owner)) {
3140
+ // if a component class definition is swapped, we must reset
3141
+ // owner's template content in the next micro-task:
3142
+ forceRehydration(owner);
3143
+ }
3144
+ else {
3145
+ // the hot swapping for components only work for instances of components
3146
+ // created from a template, root elements can't be swapped because we
3147
+ // don't have a way to force the creation of the element with the same state
3148
+ // of the current element.
3149
+ // Instead, we can report the problem to the caller so it can take action,
3150
+ // for example: reload the entire page.
3151
+ canRefreshAllInstances = false;
3152
+ }
3153
+ }
3154
+ // resetting the Set since these VMs are no longer related to this constructor, instead
3155
+ // they will get re-associated once these instances are rehydrated.
3156
+ activeComponents.delete(Ctor);
3075
3157
  return canRefreshAllInstances;
3076
3158
  }
3077
3159
  function getTemplateOrSwappedTemplate(tpl) {
@@ -3117,75 +3199,27 @@
3117
3199
  }
3118
3200
  // tracking active component
3119
3201
  const Ctor = vm.def.ctor;
3120
- let componentVMs = activeComponents.get(Ctor);
3121
- if (isUndefined$1(componentVMs)) {
3122
- componentVMs = new Set();
3123
- activeComponents.set(Ctor, componentVMs);
3124
- }
3125
3202
  // this will allow us to keep track of the hot components
3126
- componentVMs.add(vm);
3203
+ activeComponents.add(Ctor, vm);
3127
3204
  // tracking active template
3128
3205
  const tpl = vm.cmpTemplate;
3129
3206
  if (tpl) {
3130
- let templateVMs = activeTemplates.get(tpl);
3131
- if (isUndefined$1(templateVMs)) {
3132
- templateVMs = new Set();
3133
- activeTemplates.set(tpl, templateVMs);
3134
- }
3135
3207
  // this will allow us to keep track of the templates that are
3136
3208
  // being used by a hot component
3137
- templateVMs.add(vm);
3209
+ activeTemplates.add(tpl, vm);
3138
3210
  // tracking active styles associated to template
3139
3211
  const stylesheets = tpl.stylesheets;
3140
3212
  if (!isUndefined$1(stylesheets)) {
3141
- flattenStylesheets(stylesheets).forEach((stylesheet) => {
3213
+ for (const stylesheet of flattenStylesheets(stylesheets)) {
3142
3214
  // this is necessary because we don't hold the list of styles
3143
3215
  // in the vm, we only hold the selected (already swapped template)
3144
3216
  // but the styles attached to the template might not be the actual
3145
3217
  // active ones, but the swapped versions of those.
3146
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3147
- let stylesheetVMs = activeStyles.get(stylesheet);
3148
- if (isUndefined$1(stylesheetVMs)) {
3149
- stylesheetVMs = new Set();
3150
- activeStyles.set(stylesheet, stylesheetVMs);
3151
- }
3218
+ const swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
3152
3219
  // this will allow us to keep track of the stylesheet that are
3153
3220
  // being used by a hot component
3154
- stylesheetVMs.add(vm);
3155
- });
3156
- }
3157
- }
3158
- }
3159
- function removeActiveVM(vm) {
3160
- if (process.env.NODE_ENV === 'production') {
3161
- // this method should never leak to prod
3162
- throw new ReferenceError();
3163
- }
3164
- // tracking inactive component
3165
- const Ctor = vm.def.ctor;
3166
- let list = activeComponents.get(Ctor);
3167
- if (!isUndefined$1(list)) {
3168
- // deleting the vm from the set to avoid leaking memory
3169
- list.delete(vm);
3170
- }
3171
- // removing inactive template
3172
- const tpl = vm.cmpTemplate;
3173
- if (tpl) {
3174
- list = activeTemplates.get(tpl);
3175
- if (!isUndefined$1(list)) {
3176
- // deleting the vm from the set to avoid leaking memory
3177
- list.delete(vm);
3178
- }
3179
- // removing active styles associated to template
3180
- const styles = tpl.stylesheets;
3181
- if (!isUndefined$1(styles)) {
3182
- flattenStylesheets(styles).forEach((style) => {
3183
- list = activeStyles.get(style);
3184
- if (!isUndefined$1(list)) {
3185
- // deleting the vm from the set to avoid leaking memory
3186
- list.delete(vm);
3187
- }
3188
- });
3221
+ activeStyles.add(swappedStylesheet, vm);
3222
+ }
3189
3223
  }
3190
3224
  }
3191
3225
  }
@@ -5690,9 +5724,6 @@
5690
5724
  runChildNodesDisconnectedCallback(vm);
5691
5725
  runLightChildNodesDisconnectedCallback(vm);
5692
5726
  }
5693
- if (process.env.NODE_ENV !== 'production') {
5694
- removeActiveVM(vm);
5695
- }
5696
5727
  }
5697
5728
  // this method is triggered by the diffing algo only when a vnode from the
5698
5729
  // old vnode.children is removed from the DOM.
@@ -7041,7 +7072,7 @@
7041
7072
  }
7042
7073
  return ctor;
7043
7074
  }
7044
- /* version: 2.31.7 */
7075
+ /* version: 2.31.8 */
7045
7076
 
7046
7077
  /*
7047
7078
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8014,7 +8045,7 @@
8014
8045
  function isNull(obj) {
8015
8046
  return obj === null;
8016
8047
  }
8017
- /** version: 2.31.7 */
8048
+ /** version: 2.31.8 */
8018
8049
 
8019
8050
  /*
8020
8051
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8575,7 +8606,7 @@
8575
8606
  });
8576
8607
  freeze(LightningElement);
8577
8608
  seal(LightningElement.prototype);
8578
- /* version: 2.31.7 */
8609
+ /* version: 2.31.8 */
8579
8610
 
8580
8611
  exports.LightningElement = LightningElement;
8581
8612
  exports.__unstable__ProfilerControl = profilerControl;