lwc 2.38.1 → 2.39.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.
Files changed (64) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +203 -122
  2. package/dist/engine-dom/esm/es2017/engine-dom.js.map +1 -1
  3. package/dist/engine-dom/iife/es2017/engine-dom.js +203 -122
  4. package/dist/engine-dom/iife/es2017/engine-dom.js.map +1 -1
  5. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  6. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +154 -40
  7. package/dist/engine-dom/iife/es2017/engine-dom_debug.js.map +1 -1
  8. package/dist/engine-dom/iife/es5/engine-dom.js +353 -207
  9. package/dist/engine-dom/iife/es5/engine-dom.js.map +1 -1
  10. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  11. package/dist/engine-dom/iife/es5/engine-dom_debug.js +305 -153
  12. package/dist/engine-dom/iife/es5/engine-dom_debug.js.map +1 -1
  13. package/dist/engine-dom/umd/es2017/engine-dom.js +203 -122
  14. package/dist/engine-dom/umd/es2017/engine-dom.js.map +1 -1
  15. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  16. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +154 -40
  17. package/dist/engine-dom/umd/es2017/engine-dom_debug.js.map +1 -1
  18. package/dist/engine-dom/umd/es5/engine-dom.js +353 -207
  19. package/dist/engine-dom/umd/es5/engine-dom.js.map +1 -1
  20. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  21. package/dist/engine-dom/umd/es5/engine-dom_debug.js +305 -153
  22. package/dist/engine-dom/umd/es5/engine-dom_debug.js.map +1 -1
  23. package/dist/engine-server/commonjs/es2017/engine-server.js +168 -75
  24. package/dist/engine-server/commonjs/es2017/engine-server.js.map +1 -1
  25. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  26. package/dist/engine-server/esm/es2017/engine-server.js +168 -75
  27. package/dist/engine-server/esm/es2017/engine-server.js.map +1 -1
  28. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  29. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js.map +1 -1
  30. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  31. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js.map +1 -1
  32. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  33. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js.map +1 -1
  34. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  35. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js.map +1 -1
  36. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  37. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js.map +1 -1
  38. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  39. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js.map +1 -1
  40. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  41. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js.map +1 -1
  42. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  43. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js.map +1 -1
  44. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  45. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js.map +1 -1
  46. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  47. package/dist/wire-service/esm/es2017/wire-service.js.map +1 -1
  48. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  49. package/dist/wire-service/iife/es2017/wire-service.js.map +1 -1
  50. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  51. package/dist/wire-service/iife/es2017/wire-service_debug.js.map +1 -1
  52. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  53. package/dist/wire-service/iife/es5/wire-service.js.map +1 -1
  54. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  55. package/dist/wire-service/iife/es5/wire-service_debug.js.map +1 -1
  56. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  57. package/dist/wire-service/umd/es2017/wire-service.js.map +1 -1
  58. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  59. package/dist/wire-service/umd/es2017/wire-service_debug.js.map +1 -1
  60. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  61. package/dist/wire-service/umd/es5/wire-service.js.map +1 -1
  62. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  63. package/dist/wire-service/umd/es5/wire-service_debug.js.map +1 -1
  64. package/package.json +7 -7
@@ -347,9 +347,9 @@ function htmlEscape(str, attrMode = false) {
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.38.1";
350
+ const LWC_VERSION = "2.39.0";
351
351
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
352
- /** version: 2.38.1 */
352
+ /** version: 2.39.0 */
353
353
 
354
354
  /**
355
355
  * Copyright (C) 2018 salesforce.com, inc.
@@ -428,7 +428,7 @@ function setFeatureFlagForTest(name, value) {
428
428
  setFeatureFlag(name, value);
429
429
  }
430
430
  }
431
- /** version: 2.38.1 */
431
+ /** version: 2.39.0 */
432
432
 
433
433
  /**
434
434
  * Copyright (C) 2018 salesforce.com, inc.
@@ -492,7 +492,7 @@ function applyAriaReflection(prototype = Element.prototype) {
492
492
  }
493
493
  }
494
494
  }
495
- /** version: 2.38.1 */
495
+ /** version: 2.39.0 */
496
496
 
497
497
  /*
498
498
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3237,6 +3237,93 @@ const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOw
3237
3237
  freeze(BaseBridgeElement);
3238
3238
  seal(BaseBridgeElement.prototype);
3239
3239
 
3240
+ /*
3241
+ * Copyright (c) 2023, salesforce.com, inc.
3242
+ * All rights reserved.
3243
+ * SPDX-License-Identifier: MIT
3244
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3245
+ */
3246
+ const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
3247
+ // In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
3248
+ class LegacyWeakMultiMap {
3249
+ constructor() {
3250
+ this._map = new WeakMap();
3251
+ }
3252
+ _getValues(key) {
3253
+ let values = this._map.get(key);
3254
+ if (isUndefined$1(values)) {
3255
+ values = new Set();
3256
+ this._map.set(key, values);
3257
+ }
3258
+ return values;
3259
+ }
3260
+ get(key) {
3261
+ return this._getValues(key);
3262
+ }
3263
+ add(key, vm) {
3264
+ const set = this._getValues(key);
3265
+ set.add(vm);
3266
+ }
3267
+ delete(key) {
3268
+ this._map.delete(key);
3269
+ }
3270
+ }
3271
+ // This implementation relies on the WeakRef/FinalizationRegistry proposal.
3272
+ // For some background, see: https://github.com/tc39/proposal-weakrefs
3273
+ class ModernWeakMultiMap {
3274
+ constructor() {
3275
+ this._map = new WeakMap();
3276
+ this._registry = new FinalizationRegistry((weakRefs) => {
3277
+ // This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
3278
+ // JS VMs are not obligated to call FinalizationRegistry callbacks.
3279
+ // Work backwards, removing stale VMs
3280
+ for (let i = weakRefs.length - 1; i >= 0; i--) {
3281
+ const vm = weakRefs[i].deref();
3282
+ if (isUndefined$1(vm)) {
3283
+ ArraySplice.call(weakRefs, i, 1); // remove
3284
+ }
3285
+ }
3286
+ });
3287
+ }
3288
+ _getWeakRefs(key) {
3289
+ let weakRefs = this._map.get(key);
3290
+ if (isUndefined$1(weakRefs)) {
3291
+ weakRefs = [];
3292
+ this._map.set(key, weakRefs);
3293
+ }
3294
+ return weakRefs;
3295
+ }
3296
+ get(key) {
3297
+ const weakRefs = this._getWeakRefs(key);
3298
+ const result = new Set();
3299
+ for (const weakRef of weakRefs) {
3300
+ const vm = weakRef.deref();
3301
+ if (!isUndefined$1(vm)) {
3302
+ result.add(vm);
3303
+ }
3304
+ }
3305
+ return result;
3306
+ }
3307
+ add(key, value) {
3308
+ const weakRefs = this._getWeakRefs(key);
3309
+ // We could check for duplicate values here, but it doesn't seem worth it.
3310
+ // We transform the output into a Set anyway
3311
+ ArrayPush$1.call(weakRefs, new WeakRef(value));
3312
+ // It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
3313
+ // effectively creates a strong reference between the first argument (the "target") and the held value. When
3314
+ // the target is GC'ed, the callback is called, and then the held value is GC'ed.
3315
+ // Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
3316
+ // of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
3317
+ // to anything. See also this example:
3318
+ // https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
3319
+ this._registry.register(value, weakRefs);
3320
+ }
3321
+ delete(key) {
3322
+ this._map.delete(key);
3323
+ }
3324
+ }
3325
+ const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
3326
+
3240
3327
  /*
3241
3328
  * Copyright (c) 2020, salesforce.com, inc.
3242
3329
  * All rights reserved.
@@ -3246,67 +3333,62 @@ seal(BaseBridgeElement.prototype);
3246
3333
  const swappedTemplateMap = new WeakMap();
3247
3334
  const swappedComponentMap = new WeakMap();
3248
3335
  const swappedStyleMap = new WeakMap();
3249
- const activeTemplates = new WeakMap();
3250
- const activeComponents = new WeakMap();
3251
- const activeStyles = new WeakMap();
3336
+ // The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
3337
+ // so we don't want to create strong references to them.
3338
+ // The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
3339
+ // never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
3340
+ const activeTemplates = new WeakMultiMap();
3341
+ const activeComponents = new WeakMultiMap();
3342
+ const activeStyles = new WeakMultiMap();
3252
3343
  function rehydrateHotTemplate(tpl) {
3253
3344
  const list = activeTemplates.get(tpl);
3254
- if (!isUndefined$1(list)) {
3255
- list.forEach((vm) => {
3256
- if (isFalse(vm.isDirty)) {
3257
- // forcing the vm to rehydrate in the micro-task:
3258
- markComponentAsDirty(vm);
3259
- scheduleRehydration(vm);
3260
- }
3261
- });
3262
- // resetting the Set to release the memory of those vm references
3263
- // since they are not longer related to this template, instead
3264
- // they will get re-associated once these instances are rehydrated.
3265
- list.clear();
3345
+ for (const vm of list) {
3346
+ if (isFalse(vm.isDirty)) {
3347
+ // forcing the vm to rehydrate in the micro-task:
3348
+ markComponentAsDirty(vm);
3349
+ scheduleRehydration(vm);
3350
+ }
3266
3351
  }
3352
+ // Resetting the Set since these VMs are no longer related to this template, instead
3353
+ // they will get re-associated once these instances are rehydrated.
3354
+ activeTemplates.delete(tpl);
3267
3355
  return true;
3268
3356
  }
3269
3357
  function rehydrateHotStyle(style) {
3270
3358
  const list = activeStyles.get(style);
3271
- if (!isUndefined$1(list)) {
3272
- list.forEach((vm) => {
3273
- // if a style definition is swapped, we must reset
3274
- // vm's template content in the next micro-task:
3275
- forceRehydration(vm);
3276
- });
3277
- // resetting the Set to release the memory of those vm references
3278
- // since they are not longer related to this style, instead
3279
- // they will get re-associated once these instances are rehydrated.
3280
- list.clear();
3281
- }
3359
+ for (const vm of list) {
3360
+ // if a style definition is swapped, we must reset
3361
+ // vm's template content in the next micro-task:
3362
+ forceRehydration(vm);
3363
+ }
3364
+ // Resetting the Set since these VMs are no longer related to this style, instead
3365
+ // they will get re-associated once these instances are rehydrated.
3366
+ activeStyles.delete(style);
3282
3367
  return true;
3283
3368
  }
3284
3369
  function rehydrateHotComponent(Ctor) {
3285
3370
  const list = activeComponents.get(Ctor);
3286
3371
  let canRefreshAllInstances = true;
3287
- if (!isUndefined$1(list)) {
3288
- list.forEach((vm) => {
3289
- const { owner } = vm;
3290
- if (!isNull(owner)) {
3291
- // if a component class definition is swapped, we must reset
3292
- // owner's template content in the next micro-task:
3293
- forceRehydration(owner);
3294
- }
3295
- else {
3296
- // the hot swapping for components only work for instances of components
3297
- // created from a template, root elements can't be swapped because we
3298
- // don't have a way to force the creation of the element with the same state
3299
- // of the current element.
3300
- // Instead, we can report the problem to the caller so it can take action,
3301
- // for example: reload the entire page.
3302
- canRefreshAllInstances = false;
3303
- }
3304
- });
3305
- // resetting the Set to release the memory of those vm references
3306
- // since they are not longer related to this constructor, instead
3307
- // they will get re-associated once these instances are rehydrated.
3308
- list.clear();
3309
- }
3372
+ for (const vm of list) {
3373
+ const { owner } = vm;
3374
+ if (!isNull(owner)) {
3375
+ // if a component class definition is swapped, we must reset
3376
+ // owner's template content in the next micro-task:
3377
+ forceRehydration(owner);
3378
+ }
3379
+ else {
3380
+ // the hot swapping for components only work for instances of components
3381
+ // created from a template, root elements can't be swapped because we
3382
+ // don't have a way to force the creation of the element with the same state
3383
+ // of the current element.
3384
+ // Instead, we can report the problem to the caller so it can take action,
3385
+ // for example: reload the entire page.
3386
+ canRefreshAllInstances = false;
3387
+ }
3388
+ }
3389
+ // resetting the Set since these VMs are no longer related to this constructor, instead
3390
+ // they will get re-associated once these instances are rehydrated.
3391
+ activeComponents.delete(Ctor);
3310
3392
  return canRefreshAllInstances;
3311
3393
  }
3312
3394
  function getTemplateOrSwappedTemplate(tpl) {
@@ -3340,72 +3422,27 @@ function setActiveVM(vm) {
3340
3422
  assertNotProd(); // this method should never leak to prod
3341
3423
  // tracking active component
3342
3424
  const Ctor = vm.def.ctor;
3343
- let componentVMs = activeComponents.get(Ctor);
3344
- if (isUndefined$1(componentVMs)) {
3345
- componentVMs = new Set();
3346
- activeComponents.set(Ctor, componentVMs);
3347
- }
3348
3425
  // this will allow us to keep track of the hot components
3349
- componentVMs.add(vm);
3426
+ activeComponents.add(Ctor, vm);
3350
3427
  // tracking active template
3351
3428
  const tpl = vm.cmpTemplate;
3352
3429
  if (tpl) {
3353
- let templateVMs = activeTemplates.get(tpl);
3354
- if (isUndefined$1(templateVMs)) {
3355
- templateVMs = new Set();
3356
- activeTemplates.set(tpl, templateVMs);
3357
- }
3358
3430
  // this will allow us to keep track of the templates that are
3359
3431
  // being used by a hot component
3360
- templateVMs.add(vm);
3432
+ activeTemplates.add(tpl, vm);
3361
3433
  // tracking active styles associated to template
3362
3434
  const stylesheets = tpl.stylesheets;
3363
3435
  if (!isUndefined$1(stylesheets)) {
3364
- flattenStylesheets(stylesheets).forEach((stylesheet) => {
3436
+ for (const stylesheet of flattenStylesheets(stylesheets)) {
3365
3437
  // this is necessary because we don't hold the list of styles
3366
3438
  // in the vm, we only hold the selected (already swapped template)
3367
3439
  // but the styles attached to the template might not be the actual
3368
3440
  // active ones, but the swapped versions of those.
3369
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3370
- let stylesheetVMs = activeStyles.get(stylesheet);
3371
- if (isUndefined$1(stylesheetVMs)) {
3372
- stylesheetVMs = new Set();
3373
- activeStyles.set(stylesheet, stylesheetVMs);
3374
- }
3441
+ const swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
3375
3442
  // this will allow us to keep track of the stylesheet that are
3376
3443
  // being used by a hot component
3377
- stylesheetVMs.add(vm);
3378
- });
3379
- }
3380
- }
3381
- }
3382
- function removeActiveVM(vm) {
3383
- assertNotProd(); // this method should never leak to prod
3384
- // tracking inactive component
3385
- const Ctor = vm.def.ctor;
3386
- let list = activeComponents.get(Ctor);
3387
- if (!isUndefined$1(list)) {
3388
- // deleting the vm from the set to avoid leaking memory
3389
- list.delete(vm);
3390
- }
3391
- // removing inactive template
3392
- const tpl = vm.cmpTemplate;
3393
- if (tpl) {
3394
- list = activeTemplates.get(tpl);
3395
- if (!isUndefined$1(list)) {
3396
- // deleting the vm from the set to avoid leaking memory
3397
- list.delete(vm);
3398
- }
3399
- // removing active styles associated to template
3400
- const styles = tpl.stylesheets;
3401
- if (!isUndefined$1(styles)) {
3402
- flattenStylesheets(styles).forEach((style) => {
3403
- list = activeStyles.get(style);
3404
- if (!isUndefined$1(list)) {
3405
- // deleting the vm from the set to avoid leaking memory
3406
- list.delete(vm);
3407
- }
3408
- });
3444
+ activeStyles.add(swappedStylesheet, vm);
3445
+ }
3409
3446
  }
3410
3447
  }
3411
3448
  }
@@ -4167,7 +4204,12 @@ function patch(n1, n2, parent, renderer) {
4167
4204
  return;
4168
4205
  }
4169
4206
  if (process.env.NODE_ENV !== 'production') {
4170
- if (!isSameVnode(n1, n2)) {
4207
+ if (!isSameVnode(n1, n2) &&
4208
+ // Currently the only scenario when patch does not receive the same vnodes are for
4209
+ // dynamic components. When a dynamic component's constructor changes, the value of its
4210
+ // tag name (sel) will be different. The engine will unmount the previous element
4211
+ // and mount the new one using the new constructor in patchCustomElement.
4212
+ !(isVCustomElement(n1) && isVCustomElement(n2))) {
4171
4213
  throw new Error('Expected these VNodes to be the same: ' +
4172
4214
  JSON.stringify({ sel: n1.sel, key: n1.key }) +
4173
4215
  ', ' +
@@ -4360,8 +4402,9 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
4360
4402
  }
4361
4403
  }
4362
4404
  function patchCustomElement(n1, n2, parent, renderer) {
4405
+ // TODO [#3331]: This if branch should be removed in 246 with lwc:dynamic
4363
4406
  if (n1.ctor !== n2.ctor) {
4364
- // If the constructor, unmount the current component and mount a new one using the new
4407
+ // If the constructor differs, unmount the current component and mount a new one using the new
4365
4408
  // constructor.
4366
4409
  const anchor = renderer.nextSibling(n1.elm);
4367
4410
  unmount(n1, parent, renderer, true);
@@ -4854,9 +4897,17 @@ function updateStaticChildren(c1, c2, parent, renderer) {
4854
4897
  if (n2 !== n1) {
4855
4898
  if (isVNode(n1)) {
4856
4899
  if (isVNode(n2)) {
4857
- // both vnodes are equivalent, and we just need to patch them
4858
- patch(n1, n2, parent, renderer);
4859
- anchor = n2.elm;
4900
+ if (isSameVnode(n1, n2)) {
4901
+ // both vnodes are equivalent, and we just need to patch them
4902
+ patch(n1, n2, parent, renderer);
4903
+ anchor = n2.elm;
4904
+ }
4905
+ else {
4906
+ // removing the old vnode since the new one is different
4907
+ unmount(n1, parent, renderer, true);
4908
+ mount(n2, parent, renderer, anchor);
4909
+ anchor = n2.elm;
4910
+ }
4860
4911
  }
4861
4912
  else {
4862
4913
  // removing the old vnode since the new one is null
@@ -5258,16 +5309,18 @@ function fid(url) {
5258
5309
  return url;
5259
5310
  }
5260
5311
  /**
5261
- * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5312
+ * [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5313
+ *
5314
+ * TODO [#3331]: remove usage of lwc:dynamic in 246
5262
5315
  */
5263
- function dc(sel, Ctor, data, children = EmptyArray) {
5316
+ function ddc(sel, Ctor, data, children = EmptyArray) {
5264
5317
  if (process.env.NODE_ENV !== 'production') {
5265
5318
  assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
5266
5319
  assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
5267
5320
  assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 4nd argument data must be an array.`);
5268
5321
  }
5269
5322
  // null or undefined values should produce a null value in the VNodes
5270
- if (Ctor == null) {
5323
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5271
5324
  return null;
5272
5325
  }
5273
5326
  if (!isComponentConstructor(Ctor)) {
@@ -5275,6 +5328,30 @@ function dc(sel, Ctor, data, children = EmptyArray) {
5275
5328
  }
5276
5329
  return c(sel, Ctor, data, children);
5277
5330
  }
5331
+ /**
5332
+ * [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
5333
+ */
5334
+ function dc(Ctor, data, children = EmptyArray) {
5335
+ if (process.env.NODE_ENV !== 'production') {
5336
+ assert.isTrue(isObject(data), `dc() 2nd argument data must be an object.`);
5337
+ assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 3rd argument data must be an array.`);
5338
+ }
5339
+ // Null or undefined values should produce a null value in the VNodes.
5340
+ // This is the only value at compile time as the constructor will not be known.
5341
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5342
+ return null;
5343
+ }
5344
+ if (!isComponentConstructor(Ctor)) {
5345
+ throw new Error(`Invalid constructor ${toString$1(Ctor)} is not a LightningElement constructor.`);
5346
+ }
5347
+ // Look up the dynamic component's name at runtime once the constructor is available.
5348
+ // This information is only known at runtime and is stored as part of registerComponent.
5349
+ const sel = getComponentRegisteredName(Ctor);
5350
+ if (isUndefined$1(sel) || sel === '') {
5351
+ throw new Error(`Invalid LWC constructor ${toString$1(Ctor)} does not have a registered name`);
5352
+ }
5353
+ return c(sel, Ctor, data, children);
5354
+ }
5278
5355
  /**
5279
5356
  * slow children collection marking mechanism. this API allows the compiler to signal
5280
5357
  * to the engine that a particular collection of children must be diffed using the slow
@@ -5337,6 +5414,7 @@ const api = freeze({
5337
5414
  fid,
5338
5415
  shc,
5339
5416
  ssf,
5417
+ ddc,
5340
5418
  });
5341
5419
 
5342
5420
  /*
@@ -5736,28 +5814,34 @@ function invokeEventListener(vm, fn, thisValue, event) {
5736
5814
  * SPDX-License-Identifier: MIT
5737
5815
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5738
5816
  */
5739
- const signedTemplateMap = new Map();
5817
+ const registeredComponentMap = new Map();
5740
5818
  /**
5741
5819
  * INTERNAL: This function can only be invoked by compiled code. The compiler
5742
5820
  * will prevent this function from being imported by userland code.
5743
5821
  */
5744
5822
  function registerComponent(
5745
5823
  // We typically expect a LightningElementConstructor, but technically you can call this with anything
5746
- Ctor, { tmpl }) {
5824
+ Ctor, metadata) {
5747
5825
  if (isFunction$1(Ctor)) {
5748
5826
  if (process.env.NODE_ENV !== 'production') {
5749
5827
  // There is no point in running this in production, because the version mismatch check relies
5750
5828
  // on code comments which are stripped out in production by minifiers
5751
5829
  checkVersionMismatch(Ctor, 'component');
5752
5830
  }
5753
- signedTemplateMap.set(Ctor, tmpl);
5831
+ // TODO [#3331]: add validation to check the value of metadata.sel is not an empty string.
5832
+ registeredComponentMap.set(Ctor, metadata);
5754
5833
  }
5755
5834
  // chaining this method as a way to wrap existing assignment of component constructor easily,
5756
5835
  // without too much transformation
5757
5836
  return Ctor;
5758
5837
  }
5759
5838
  function getComponentRegisteredTemplate(Ctor) {
5760
- return signedTemplateMap.get(Ctor);
5839
+ var _a;
5840
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
5841
+ }
5842
+ function getComponentRegisteredName(Ctor) {
5843
+ var _a;
5844
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
5761
5845
  }
5762
5846
  function getTemplateReactiveObserver(vm) {
5763
5847
  return createReactiveObserver(() => {
@@ -5893,9 +5977,6 @@ function resetComponentStateWhenRemoved(vm) {
5893
5977
  runChildNodesDisconnectedCallback(vm);
5894
5978
  runLightChildNodesDisconnectedCallback(vm);
5895
5979
  }
5896
- if (process.env.NODE_ENV !== 'production') {
5897
- removeActiveVM(vm);
5898
- }
5899
5980
  }
5900
5981
  // this method is triggered by the diffing algo only when a vnode from the
5901
5982
  // old vnode.children is removed from the DOM.
@@ -7350,7 +7431,7 @@ function readonly(obj) {
7350
7431
  }
7351
7432
  return getReadOnlyProxy(obj);
7352
7433
  }
7353
- /* version: 2.38.1 */
7434
+ /* version: 2.39.0 */
7354
7435
 
7355
7436
  /*
7356
7437
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7778,7 +7859,7 @@ function rendererFactory(baseRenderer) {
7778
7859
  function isNull(obj) {
7779
7860
  return obj === null;
7780
7861
  }
7781
- /** version: 2.38.1 */
7862
+ /** version: 2.39.0 */
7782
7863
 
7783
7864
  /*
7784
7865
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8397,7 +8478,7 @@ function registerContextProvider(elm, adapterContextToken, onContextSubscription
8397
8478
  });
8398
8479
  }));
8399
8480
  }
8400
- /* version: 2.38.1 */
8481
+ /* version: 2.39.0 */
8401
8482
 
8402
8483
  export { LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8403
8484
  //# sourceMappingURL=engine-dom.js.map