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