@lwc/engine-core 3.0.1 → 3.1.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.
@@ -0,0 +1,2 @@
1
+ export declare const instrumentDef: any;
2
+ export declare const instrumentInstance: any;
package/dist/index.cjs.js CHANGED
@@ -429,6 +429,10 @@ function isCircularModuleDependency(obj) {
429
429
  return shared.isFunction(obj) && shared.hasOwnProperty.call(obj, '__circular__');
430
430
  }
431
431
 
432
+ var _a, _b;
433
+ const instrumentDef = (_a = shared.globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : shared.noop;
434
+ const instrumentInstance = (_b = shared.globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : shared.noop;
435
+
432
436
  /*
433
437
  * Copyright (c) 2018, salesforce.com, inc.
434
438
  * All rights reserved.
@@ -1397,6 +1401,8 @@ const LightningElement = function () {
1397
1401
  // `class Foo extends LightningElement {}; new Foo()`
1398
1402
  throw new TypeError('Illegal constructor');
1399
1403
  }
1404
+ // This is a no-op unless Lightning DevTools are enabled.
1405
+ instrumentInstance(this, vmBeingConstructed);
1400
1406
  const vm = vmBeingConstructed;
1401
1407
  const { def, elm } = vm;
1402
1408
  const { bridge } = def;
@@ -2545,35 +2551,8 @@ function createAttributeChangedCallback(attributeToPropMap, superAttributeChange
2545
2551
  };
2546
2552
  }
2547
2553
  function HTMLBridgeElementFactory(SuperClass, props, methods) {
2548
- let HTMLBridgeElement;
2549
- /**
2550
- * Modern browsers will have all Native Constructors as regular Classes
2551
- * and must be instantiated with the new keyword. In older browsers,
2552
- * specifically IE11, those are objects with a prototype property defined,
2553
- * since they are not supposed to be extended or instantiated with the
2554
- * new keyword. This forking logic supports both cases, specifically because
2555
- * wc.ts relies on the construction path of the bridges to create new
2556
- * fully qualifying web components.
2557
- */
2558
- if (shared.isFunction(SuperClass)) {
2559
- HTMLBridgeElement = class extends SuperClass {
2560
- };
2561
- }
2562
- else {
2563
- HTMLBridgeElement = function () {
2564
- // Bridge classes are not supposed to be instantiated directly in
2565
- // browsers that do not support web components.
2566
- throw new TypeError('Illegal constructor');
2567
- };
2568
- // prototype inheritance dance
2569
- shared.setPrototypeOf(HTMLBridgeElement, SuperClass);
2570
- shared.setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
2571
- shared.defineProperty(HTMLBridgeElement.prototype, 'constructor', {
2572
- writable: true,
2573
- configurable: true,
2574
- value: HTMLBridgeElement,
2575
- });
2576
- }
2554
+ const HTMLBridgeElement = class extends SuperClass {
2555
+ };
2577
2556
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
2578
2557
  // and false positives in case of inheritance.
2579
2558
  const attributeToPropMap = shared.create(null);
@@ -2981,6 +2960,8 @@ function createComponentDef(Ctor) {
2981
2960
  errorCallback,
2982
2961
  render,
2983
2962
  };
2963
+ // This is a no-op unless Lightning DevTools are enabled.
2964
+ instrumentDef(def);
2984
2965
  if (process.env.NODE_ENV !== 'production') {
2985
2966
  shared.freeze(Ctor.prototype);
2986
2967
  }
@@ -4148,12 +4129,11 @@ function allocateInSlot(vm, children, owner) {
4148
4129
  }
4149
4130
  }
4150
4131
  }
4151
- // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4152
- const DynamicChildren = new WeakMap();
4132
+ const DynamicChildren = new WeakSet();
4153
4133
  // dynamic children means it was either generated by an iteration in a template
4154
4134
  // or part of an unstable fragment, and will require a more complex diffing algo.
4155
4135
  function markAsDynamicChildren(children) {
4156
- DynamicChildren.set(children, 1);
4136
+ DynamicChildren.add(children);
4157
4137
  }
4158
4138
  function hasDynamicChildren(children) {
4159
4139
  return DynamicChildren.has(children);
@@ -6945,5 +6925,5 @@ exports.swapTemplate = swapTemplate;
6945
6925
  exports.track = track;
6946
6926
  exports.unwrap = unwrap;
6947
6927
  exports.wire = wire;
6948
- /** version: 3.0.1 */
6928
+ /** version: 3.1.0 */
6949
6929
  //# sourceMappingURL=index.cjs.js.map