@lwc/engine-core 9.1.0 → 9.1.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.
@@ -1,4 +1,4 @@
1
- import { LightningElement } from './base-lightning-element';
1
+ import { type LightningElement } from './base-lightning-element';
2
2
  import type { VM } from './vm';
3
3
  import type { LightningElementConstructor } from './base-lightning-element';
4
4
  import type { VNodes } from './vnodes';
package/dist/index.cjs CHANGED
@@ -6602,16 +6602,11 @@ function invokeComponentConstructor(vm, Ctor) {
6602
6602
  try {
6603
6603
  // job
6604
6604
  const result = new Ctor();
6605
- // Check indirectly if the constructor result is an instance of LightningElement.
6606
- // When Locker is enabled, the "instanceof" operator would not work since Locker Service
6607
- // provides its own implementation of LightningElement, so we indirectly check
6608
- // if the base constructor is invoked by accessing the component on the vm.
6609
- // When the DISABLE_LOCKER_VALIDATION gate is false or LEGACY_LOCKER_ENABLED is false,
6610
- // then the instanceof LightningElement can be used.
6611
- const useLegacyConstructorCheck = !lwcRuntimeFlags.DISABLE_LEGACY_VALIDATION || lwcRuntimeFlags.LEGACY_LOCKER_ENABLED;
6612
- const isInvalidConstructor = useLegacyConstructorCheck
6613
- ? vmBeingConstructed.component !== result
6614
- : !(result instanceof LightningElement);
6605
+ // When strict, reject when the constructor returns a *native* HTMLElement that is,
6606
+ // result instanceof HTMLElement.
6607
+ const useStrictValidation = !lwcRuntimeFlags.DISABLE_STRICT_VALIDATION && process.env.IS_BROWSER;
6608
+ const isMismatchedConstructor = vmBeingConstructed.component !== result;
6609
+ const isInvalidConstructor = isMismatchedConstructor || (useStrictValidation && result instanceof HTMLElement);
6615
6610
  if (isInvalidConstructor) {
6616
6611
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6617
6612
  }
@@ -8819,5 +8814,5 @@ exports.swapTemplate = swapTemplate;
8819
8814
  exports.track = track;
8820
8815
  exports.unwrap = unwrap;
8821
8816
  exports.wire = wire;
8822
- /** version: 9.1.0 */
8817
+ /** version: 9.1.1 */
8823
8818
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -6599,16 +6599,11 @@ function invokeComponentConstructor(vm, Ctor) {
6599
6599
  try {
6600
6600
  // job
6601
6601
  const result = new Ctor();
6602
- // Check indirectly if the constructor result is an instance of LightningElement.
6603
- // When Locker is enabled, the "instanceof" operator would not work since Locker Service
6604
- // provides its own implementation of LightningElement, so we indirectly check
6605
- // if the base constructor is invoked by accessing the component on the vm.
6606
- // When the DISABLE_LOCKER_VALIDATION gate is false or LEGACY_LOCKER_ENABLED is false,
6607
- // then the instanceof LightningElement can be used.
6608
- const useLegacyConstructorCheck = !lwcRuntimeFlags.DISABLE_LEGACY_VALIDATION || lwcRuntimeFlags.LEGACY_LOCKER_ENABLED;
6609
- const isInvalidConstructor = useLegacyConstructorCheck
6610
- ? vmBeingConstructed.component !== result
6611
- : !(result instanceof LightningElement);
6602
+ // When strict, reject when the constructor returns a *native* HTMLElement that is,
6603
+ // result instanceof HTMLElement.
6604
+ const useStrictValidation = !lwcRuntimeFlags.DISABLE_STRICT_VALIDATION && process.env.IS_BROWSER;
6605
+ const isMismatchedConstructor = vmBeingConstructed.component !== result;
6606
+ const isInvalidConstructor = isMismatchedConstructor || (useStrictValidation && result instanceof HTMLElement);
6612
6607
  if (isInvalidConstructor) {
6613
6608
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6614
6609
  }
@@ -8745,5 +8740,5 @@ function readonly(obj) {
8745
8740
  }
8746
8741
 
8747
8742
  export { BaseBridgeElement, LightningElement, profilerControl as __unstable__ProfilerControl, reportingControl as __unstable__ReportingControl, api$1 as api, computeShadowAndRenderMode, connectRootElement, createContextProviderWithRegister, createVM, disconnectRootElement, freezeTemplate, getAssociatedVMIfPresent, getComponentAPIVersion, getComponentConstructor, getComponentDef, getComponentHtmlPrototype, hydrateRoot, isComponentConstructor, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, runFormAssociatedCallback, runFormDisabledCallback, runFormResetCallback, runFormStateRestoreCallback, sanitizeAttribute, shouldBeFormAssociated, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
8748
- /** version: 9.1.0 */
8743
+ /** version: 9.1.1 */
8749
8744
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/engine-core",
7
- "version": "9.1.0",
7
+ "version": "9.1.1",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -51,9 +51,9 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@lwc/features": "9.1.0",
55
- "@lwc/shared": "9.1.0",
56
- "@lwc/signals": "9.1.0"
54
+ "@lwc/features": "9.1.1",
55
+ "@lwc/shared": "9.1.1",
56
+ "@lwc/signals": "9.1.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "observable-membrane": "2.0.0"