lwc 2.38.1 → 2.39.1

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
@@ -350,9 +350,9 @@ var LWC = (function (exports) {
350
350
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
351
351
  */
352
352
  // Increment whenever the LWC template compiler changes
353
- const LWC_VERSION = "2.38.1";
353
+ const LWC_VERSION = "2.39.1";
354
354
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
355
- /** version: 2.38.1 */
355
+ /** version: 2.39.1 */
356
356
 
357
357
  /**
358
358
  * Copyright (C) 2018 salesforce.com, inc.
@@ -431,7 +431,7 @@ var LWC = (function (exports) {
431
431
  setFeatureFlag(name, value);
432
432
  }
433
433
  }
434
- /** version: 2.38.1 */
434
+ /** version: 2.39.1 */
435
435
 
436
436
  /**
437
437
  * Copyright (C) 2018 salesforce.com, inc.
@@ -495,7 +495,7 @@ var LWC = (function (exports) {
495
495
  }
496
496
  }
497
497
  }
498
- /** version: 2.38.1 */
498
+ /** version: 2.39.1 */
499
499
 
500
500
  /*
501
501
  * Copyright (c) 2018, salesforce.com, inc.
@@ -3240,6 +3240,93 @@ var LWC = (function (exports) {
3240
3240
  freeze(BaseBridgeElement);
3241
3241
  seal(BaseBridgeElement.prototype);
3242
3242
 
3243
+ /*
3244
+ * Copyright (c) 2023, salesforce.com, inc.
3245
+ * All rights reserved.
3246
+ * SPDX-License-Identifier: MIT
3247
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3248
+ */
3249
+ const supportsWeakRefs = typeof WeakRef === 'function' && typeof FinalizationRegistry === 'function';
3250
+ // In browsers that doesn't support WeakRefs, the values will still leak, but at least the keys won't
3251
+ class LegacyWeakMultiMap {
3252
+ constructor() {
3253
+ this._map = new WeakMap();
3254
+ }
3255
+ _getValues(key) {
3256
+ let values = this._map.get(key);
3257
+ if (isUndefined$1(values)) {
3258
+ values = new Set();
3259
+ this._map.set(key, values);
3260
+ }
3261
+ return values;
3262
+ }
3263
+ get(key) {
3264
+ return this._getValues(key);
3265
+ }
3266
+ add(key, vm) {
3267
+ const set = this._getValues(key);
3268
+ set.add(vm);
3269
+ }
3270
+ delete(key) {
3271
+ this._map.delete(key);
3272
+ }
3273
+ }
3274
+ // This implementation relies on the WeakRef/FinalizationRegistry proposal.
3275
+ // For some background, see: https://github.com/tc39/proposal-weakrefs
3276
+ class ModernWeakMultiMap {
3277
+ constructor() {
3278
+ this._map = new WeakMap();
3279
+ this._registry = new FinalizationRegistry((weakRefs) => {
3280
+ // This should be considered an optional cleanup method to remove GC'ed values from their respective arrays.
3281
+ // JS VMs are not obligated to call FinalizationRegistry callbacks.
3282
+ // Work backwards, removing stale VMs
3283
+ for (let i = weakRefs.length - 1; i >= 0; i--) {
3284
+ const vm = weakRefs[i].deref();
3285
+ if (isUndefined$1(vm)) {
3286
+ ArraySplice.call(weakRefs, i, 1); // remove
3287
+ }
3288
+ }
3289
+ });
3290
+ }
3291
+ _getWeakRefs(key) {
3292
+ let weakRefs = this._map.get(key);
3293
+ if (isUndefined$1(weakRefs)) {
3294
+ weakRefs = [];
3295
+ this._map.set(key, weakRefs);
3296
+ }
3297
+ return weakRefs;
3298
+ }
3299
+ get(key) {
3300
+ const weakRefs = this._getWeakRefs(key);
3301
+ const result = new Set();
3302
+ for (const weakRef of weakRefs) {
3303
+ const vm = weakRef.deref();
3304
+ if (!isUndefined$1(vm)) {
3305
+ result.add(vm);
3306
+ }
3307
+ }
3308
+ return result;
3309
+ }
3310
+ add(key, value) {
3311
+ const weakRefs = this._getWeakRefs(key);
3312
+ // We could check for duplicate values here, but it doesn't seem worth it.
3313
+ // We transform the output into a Set anyway
3314
+ ArrayPush$1.call(weakRefs, new WeakRef(value));
3315
+ // It's important here not to leak the second argument, which is the "held value." The FinalizationRegistry
3316
+ // effectively creates a strong reference between the first argument (the "target") and the held value. When
3317
+ // the target is GC'ed, the callback is called, and then the held value is GC'ed.
3318
+ // Putting the key here would mean the key is not GC'ed until the value is GC'ed, which defeats the purpose
3319
+ // of the WeakMap. Whereas putting the weakRefs array here is fine, because it doesn't have a strong reference
3320
+ // to anything. See also this example:
3321
+ // https://gist.github.com/nolanlawson/79a3d36e8e6cc25c5048bb17c1795aea
3322
+ this._registry.register(value, weakRefs);
3323
+ }
3324
+ delete(key) {
3325
+ this._map.delete(key);
3326
+ }
3327
+ }
3328
+ const WeakMultiMap = supportsWeakRefs ? ModernWeakMultiMap : LegacyWeakMultiMap;
3329
+
3243
3330
  /*
3244
3331
  * Copyright (c) 2020, salesforce.com, inc.
3245
3332
  * All rights reserved.
@@ -3249,67 +3336,62 @@ var LWC = (function (exports) {
3249
3336
  const swappedTemplateMap = new WeakMap();
3250
3337
  const swappedComponentMap = new WeakMap();
3251
3338
  const swappedStyleMap = new WeakMap();
3252
- const activeTemplates = new WeakMap();
3253
- const activeComponents = new WeakMap();
3254
- const activeStyles = new WeakMap();
3339
+ // The important thing here is the weak values – VMs are transient (one per component instance) and should be GC'ed,
3340
+ // so we don't want to create strong references to them.
3341
+ // The weak keys are kind of useless, because Templates, LightningElementConstructors, and StylesheetFactories are
3342
+ // never GC'ed. But maybe they will be someday, so we may as well use weak keys too.
3343
+ const activeTemplates = new WeakMultiMap();
3344
+ const activeComponents = new WeakMultiMap();
3345
+ const activeStyles = new WeakMultiMap();
3255
3346
  function rehydrateHotTemplate(tpl) {
3256
3347
  const list = activeTemplates.get(tpl);
3257
- if (!isUndefined$1(list)) {
3258
- list.forEach((vm) => {
3259
- if (isFalse(vm.isDirty)) {
3260
- // forcing the vm to rehydrate in the micro-task:
3261
- markComponentAsDirty(vm);
3262
- scheduleRehydration(vm);
3263
- }
3264
- });
3265
- // resetting the Set to release the memory of those vm references
3266
- // since they are not longer related to this template, instead
3267
- // they will get re-associated once these instances are rehydrated.
3268
- list.clear();
3348
+ for (const vm of list) {
3349
+ if (isFalse(vm.isDirty)) {
3350
+ // forcing the vm to rehydrate in the micro-task:
3351
+ markComponentAsDirty(vm);
3352
+ scheduleRehydration(vm);
3353
+ }
3269
3354
  }
3355
+ // Resetting the Set since these VMs are no longer related to this template, instead
3356
+ // they will get re-associated once these instances are rehydrated.
3357
+ activeTemplates.delete(tpl);
3270
3358
  return true;
3271
3359
  }
3272
3360
  function rehydrateHotStyle(style) {
3273
3361
  const list = activeStyles.get(style);
3274
- if (!isUndefined$1(list)) {
3275
- list.forEach((vm) => {
3276
- // if a style definition is swapped, we must reset
3277
- // vm's template content in the next micro-task:
3278
- forceRehydration(vm);
3279
- });
3280
- // resetting the Set to release the memory of those vm references
3281
- // since they are not longer related to this style, instead
3282
- // they will get re-associated once these instances are rehydrated.
3283
- list.clear();
3284
- }
3362
+ for (const vm of list) {
3363
+ // if a style definition is swapped, we must reset
3364
+ // vm's template content in the next micro-task:
3365
+ forceRehydration(vm);
3366
+ }
3367
+ // Resetting the Set since these VMs are no longer related to this style, instead
3368
+ // they will get re-associated once these instances are rehydrated.
3369
+ activeStyles.delete(style);
3285
3370
  return true;
3286
3371
  }
3287
3372
  function rehydrateHotComponent(Ctor) {
3288
3373
  const list = activeComponents.get(Ctor);
3289
3374
  let canRefreshAllInstances = true;
3290
- if (!isUndefined$1(list)) {
3291
- list.forEach((vm) => {
3292
- const { owner } = vm;
3293
- if (!isNull(owner)) {
3294
- // if a component class definition is swapped, we must reset
3295
- // owner's template content in the next micro-task:
3296
- forceRehydration(owner);
3297
- }
3298
- else {
3299
- // the hot swapping for components only work for instances of components
3300
- // created from a template, root elements can't be swapped because we
3301
- // don't have a way to force the creation of the element with the same state
3302
- // of the current element.
3303
- // Instead, we can report the problem to the caller so it can take action,
3304
- // for example: reload the entire page.
3305
- canRefreshAllInstances = false;
3306
- }
3307
- });
3308
- // resetting the Set to release the memory of those vm references
3309
- // since they are not longer related to this constructor, instead
3310
- // they will get re-associated once these instances are rehydrated.
3311
- list.clear();
3312
- }
3375
+ for (const vm of list) {
3376
+ const { owner } = vm;
3377
+ if (!isNull(owner)) {
3378
+ // if a component class definition is swapped, we must reset
3379
+ // owner's template content in the next micro-task:
3380
+ forceRehydration(owner);
3381
+ }
3382
+ else {
3383
+ // the hot swapping for components only work for instances of components
3384
+ // created from a template, root elements can't be swapped because we
3385
+ // don't have a way to force the creation of the element with the same state
3386
+ // of the current element.
3387
+ // Instead, we can report the problem to the caller so it can take action,
3388
+ // for example: reload the entire page.
3389
+ canRefreshAllInstances = false;
3390
+ }
3391
+ }
3392
+ // resetting the Set since these VMs are no longer related to this constructor, instead
3393
+ // they will get re-associated once these instances are rehydrated.
3394
+ activeComponents.delete(Ctor);
3313
3395
  return canRefreshAllInstances;
3314
3396
  }
3315
3397
  function getTemplateOrSwappedTemplate(tpl) {
@@ -3343,72 +3425,27 @@ var LWC = (function (exports) {
3343
3425
  assertNotProd(); // this method should never leak to prod
3344
3426
  // tracking active component
3345
3427
  const Ctor = vm.def.ctor;
3346
- let componentVMs = activeComponents.get(Ctor);
3347
- if (isUndefined$1(componentVMs)) {
3348
- componentVMs = new Set();
3349
- activeComponents.set(Ctor, componentVMs);
3350
- }
3351
3428
  // this will allow us to keep track of the hot components
3352
- componentVMs.add(vm);
3429
+ activeComponents.add(Ctor, vm);
3353
3430
  // tracking active template
3354
3431
  const tpl = vm.cmpTemplate;
3355
3432
  if (tpl) {
3356
- let templateVMs = activeTemplates.get(tpl);
3357
- if (isUndefined$1(templateVMs)) {
3358
- templateVMs = new Set();
3359
- activeTemplates.set(tpl, templateVMs);
3360
- }
3361
3433
  // this will allow us to keep track of the templates that are
3362
3434
  // being used by a hot component
3363
- templateVMs.add(vm);
3435
+ activeTemplates.add(tpl, vm);
3364
3436
  // tracking active styles associated to template
3365
3437
  const stylesheets = tpl.stylesheets;
3366
3438
  if (!isUndefined$1(stylesheets)) {
3367
- flattenStylesheets(stylesheets).forEach((stylesheet) => {
3439
+ for (const stylesheet of flattenStylesheets(stylesheets)) {
3368
3440
  // this is necessary because we don't hold the list of styles
3369
3441
  // in the vm, we only hold the selected (already swapped template)
3370
3442
  // but the styles attached to the template might not be the actual
3371
3443
  // active ones, but the swapped versions of those.
3372
- stylesheet = getStyleOrSwappedStyle(stylesheet);
3373
- let stylesheetVMs = activeStyles.get(stylesheet);
3374
- if (isUndefined$1(stylesheetVMs)) {
3375
- stylesheetVMs = new Set();
3376
- activeStyles.set(stylesheet, stylesheetVMs);
3377
- }
3444
+ const swappedStylesheet = getStyleOrSwappedStyle(stylesheet);
3378
3445
  // this will allow us to keep track of the stylesheet that are
3379
3446
  // being used by a hot component
3380
- stylesheetVMs.add(vm);
3381
- });
3382
- }
3383
- }
3384
- }
3385
- function removeActiveVM(vm) {
3386
- assertNotProd(); // this method should never leak to prod
3387
- // tracking inactive component
3388
- const Ctor = vm.def.ctor;
3389
- let list = activeComponents.get(Ctor);
3390
- if (!isUndefined$1(list)) {
3391
- // deleting the vm from the set to avoid leaking memory
3392
- list.delete(vm);
3393
- }
3394
- // removing inactive template
3395
- const tpl = vm.cmpTemplate;
3396
- if (tpl) {
3397
- list = activeTemplates.get(tpl);
3398
- if (!isUndefined$1(list)) {
3399
- // deleting the vm from the set to avoid leaking memory
3400
- list.delete(vm);
3401
- }
3402
- // removing active styles associated to template
3403
- const styles = tpl.stylesheets;
3404
- if (!isUndefined$1(styles)) {
3405
- flattenStylesheets(styles).forEach((style) => {
3406
- list = activeStyles.get(style);
3407
- if (!isUndefined$1(list)) {
3408
- // deleting the vm from the set to avoid leaking memory
3409
- list.delete(vm);
3410
- }
3411
- });
3447
+ activeStyles.add(swappedStylesheet, vm);
3448
+ }
3412
3449
  }
3413
3450
  }
3414
3451
  }
@@ -4170,7 +4207,12 @@ var LWC = (function (exports) {
4170
4207
  return;
4171
4208
  }
4172
4209
  if (process.env.NODE_ENV !== 'production') {
4173
- if (!isSameVnode(n1, n2)) {
4210
+ if (!isSameVnode(n1, n2) &&
4211
+ // Currently the only scenario when patch does not receive the same vnodes are for
4212
+ // dynamic components. When a dynamic component's constructor changes, the value of its
4213
+ // tag name (sel) will be different. The engine will unmount the previous element
4214
+ // and mount the new one using the new constructor in patchCustomElement.
4215
+ !(isVCustomElement(n1) && isVCustomElement(n2))) {
4174
4216
  throw new Error('Expected these VNodes to be the same: ' +
4175
4217
  JSON.stringify({ sel: n1.sel, key: n1.key }) +
4176
4218
  ', ' +
@@ -4363,8 +4405,9 @@ var LWC = (function (exports) {
4363
4405
  }
4364
4406
  }
4365
4407
  function patchCustomElement(n1, n2, parent, renderer) {
4408
+ // TODO [#3331]: This if branch should be removed in 246 with lwc:dynamic
4366
4409
  if (n1.ctor !== n2.ctor) {
4367
- // If the constructor, unmount the current component and mount a new one using the new
4410
+ // If the constructor differs, unmount the current component and mount a new one using the new
4368
4411
  // constructor.
4369
4412
  const anchor = renderer.nextSibling(n1.elm);
4370
4413
  unmount(n1, parent, renderer, true);
@@ -4857,9 +4900,17 @@ var LWC = (function (exports) {
4857
4900
  if (n2 !== n1) {
4858
4901
  if (isVNode(n1)) {
4859
4902
  if (isVNode(n2)) {
4860
- // both vnodes are equivalent, and we just need to patch them
4861
- patch(n1, n2, parent, renderer);
4862
- anchor = n2.elm;
4903
+ if (isSameVnode(n1, n2)) {
4904
+ // both vnodes are equivalent, and we just need to patch them
4905
+ patch(n1, n2, parent, renderer);
4906
+ anchor = n2.elm;
4907
+ }
4908
+ else {
4909
+ // removing the old vnode since the new one is different
4910
+ unmount(n1, parent, renderer, true);
4911
+ mount(n2, parent, renderer, anchor);
4912
+ anchor = n2.elm;
4913
+ }
4863
4914
  }
4864
4915
  else {
4865
4916
  // removing the old vnode since the new one is null
@@ -5261,16 +5312,18 @@ var LWC = (function (exports) {
5261
5312
  return url;
5262
5313
  }
5263
5314
  /**
5264
- * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5315
+ * [ddc] - create a (deprecated) dynamic component via `<x-foo lwc:dynamic={Ctor}>`
5316
+ *
5317
+ * TODO [#3331]: remove usage of lwc:dynamic in 246
5265
5318
  */
5266
- function dc(sel, Ctor, data, children = EmptyArray) {
5319
+ function ddc(sel, Ctor, data, children = EmptyArray) {
5267
5320
  if (process.env.NODE_ENV !== 'production') {
5268
5321
  assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
5269
5322
  assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);
5270
5323
  assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 4nd argument data must be an array.`);
5271
5324
  }
5272
5325
  // null or undefined values should produce a null value in the VNodes
5273
- if (Ctor == null) {
5326
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5274
5327
  return null;
5275
5328
  }
5276
5329
  if (!isComponentConstructor(Ctor)) {
@@ -5278,6 +5331,30 @@ var LWC = (function (exports) {
5278
5331
  }
5279
5332
  return c(sel, Ctor, data, children);
5280
5333
  }
5334
+ /**
5335
+ * [dc] - create a dynamic component via `<lwc:component lwc:is={Ctor}>`
5336
+ */
5337
+ function dc(Ctor, data, children = EmptyArray) {
5338
+ if (process.env.NODE_ENV !== 'production') {
5339
+ assert.isTrue(isObject(data), `dc() 2nd argument data must be an object.`);
5340
+ assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 3rd argument data must be an array.`);
5341
+ }
5342
+ // Null or undefined values should produce a null value in the VNodes.
5343
+ // This is the only value at compile time as the constructor will not be known.
5344
+ if (isNull(Ctor) || isUndefined$1(Ctor)) {
5345
+ return null;
5346
+ }
5347
+ if (!isComponentConstructor(Ctor)) {
5348
+ throw new Error(`Invalid constructor ${toString$1(Ctor)} is not a LightningElement constructor.`);
5349
+ }
5350
+ // Look up the dynamic component's name at runtime once the constructor is available.
5351
+ // This information is only known at runtime and is stored as part of registerComponent.
5352
+ const sel = getComponentRegisteredName(Ctor);
5353
+ if (isUndefined$1(sel) || sel === '') {
5354
+ throw new Error(`Invalid LWC constructor ${toString$1(Ctor)} does not have a registered name`);
5355
+ }
5356
+ return c(sel, Ctor, data, children);
5357
+ }
5281
5358
  /**
5282
5359
  * slow children collection marking mechanism. this API allows the compiler to signal
5283
5360
  * to the engine that a particular collection of children must be diffed using the slow
@@ -5340,6 +5417,7 @@ var LWC = (function (exports) {
5340
5417
  fid,
5341
5418
  shc,
5342
5419
  ssf,
5420
+ ddc,
5343
5421
  });
5344
5422
 
5345
5423
  /*
@@ -5739,28 +5817,34 @@ var LWC = (function (exports) {
5739
5817
  * SPDX-License-Identifier: MIT
5740
5818
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5741
5819
  */
5742
- const signedTemplateMap = new Map();
5820
+ const registeredComponentMap = new Map();
5743
5821
  /**
5744
5822
  * INTERNAL: This function can only be invoked by compiled code. The compiler
5745
5823
  * will prevent this function from being imported by userland code.
5746
5824
  */
5747
5825
  function registerComponent(
5748
5826
  // We typically expect a LightningElementConstructor, but technically you can call this with anything
5749
- Ctor, { tmpl }) {
5827
+ Ctor, metadata) {
5750
5828
  if (isFunction$1(Ctor)) {
5751
5829
  if (process.env.NODE_ENV !== 'production') {
5752
5830
  // There is no point in running this in production, because the version mismatch check relies
5753
5831
  // on code comments which are stripped out in production by minifiers
5754
5832
  checkVersionMismatch(Ctor, 'component');
5755
5833
  }
5756
- signedTemplateMap.set(Ctor, tmpl);
5834
+ // TODO [#3331]: add validation to check the value of metadata.sel is not an empty string.
5835
+ registeredComponentMap.set(Ctor, metadata);
5757
5836
  }
5758
5837
  // chaining this method as a way to wrap existing assignment of component constructor easily,
5759
5838
  // without too much transformation
5760
5839
  return Ctor;
5761
5840
  }
5762
5841
  function getComponentRegisteredTemplate(Ctor) {
5763
- return signedTemplateMap.get(Ctor);
5842
+ var _a;
5843
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.tmpl;
5844
+ }
5845
+ function getComponentRegisteredName(Ctor) {
5846
+ var _a;
5847
+ return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
5764
5848
  }
5765
5849
  function getTemplateReactiveObserver(vm) {
5766
5850
  return createReactiveObserver(() => {
@@ -5896,9 +5980,6 @@ var LWC = (function (exports) {
5896
5980
  runChildNodesDisconnectedCallback(vm);
5897
5981
  runLightChildNodesDisconnectedCallback(vm);
5898
5982
  }
5899
- if (process.env.NODE_ENV !== 'production') {
5900
- removeActiveVM(vm);
5901
- }
5902
5983
  }
5903
5984
  // this method is triggered by the diffing algo only when a vnode from the
5904
5985
  // old vnode.children is removed from the DOM.
@@ -7353,7 +7434,7 @@ var LWC = (function (exports) {
7353
7434
  }
7354
7435
  return getReadOnlyProxy(obj);
7355
7436
  }
7356
- /* version: 2.38.1 */
7437
+ /* version: 2.39.1 */
7357
7438
 
7358
7439
  /*
7359
7440
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7781,7 +7862,7 @@ var LWC = (function (exports) {
7781
7862
  function isNull(obj) {
7782
7863
  return obj === null;
7783
7864
  }
7784
- /** version: 2.38.1 */
7865
+ /** version: 2.39.1 */
7785
7866
 
7786
7867
  /*
7787
7868
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8400,7 +8481,7 @@ var LWC = (function (exports) {
8400
8481
  });
8401
8482
  }));
8402
8483
  }
8403
- /* version: 2.38.1 */
8484
+ /* version: 2.39.1 */
8404
8485
 
8405
8486
  exports.LightningElement = LightningElement;
8406
8487
  exports.__unstable__ProfilerControl = profilerControl;