@lwc/engine-core 8.13.0 → 8.13.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.js CHANGED
@@ -304,6 +304,18 @@ function safelyCallGetter(target, key) {
304
304
  /* ignore */
305
305
  }
306
306
  }
307
+ function isRevokedProxy(target) {
308
+ try {
309
+ // `str in obj` will never throw for normal objects or active proxies,
310
+ // but the operation is not allowed for revoked proxies
311
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
312
+ '' in target;
313
+ return false;
314
+ }
315
+ catch (_) {
316
+ return true;
317
+ }
318
+ }
307
319
  /**
308
320
  * Flush all the logs we've written so far and return the current logs.
309
321
  */
@@ -366,7 +378,8 @@ function trackTargetForMutationLogging(key, target) {
366
378
  // Guard against recursive objects - don't traverse forever
367
379
  return;
368
380
  }
369
- if (shared.isObject(target) && !shared.isNull(target)) {
381
+ // Revoked proxies (e.g. window props in LWS sandboxes) throw an error if we try to track them
382
+ if (shared.isObject(target) && !shared.isNull(target) && !isRevokedProxy(target)) {
370
383
  // only track non-primitives; others are invalid as WeakMap keys
371
384
  targetsToPropertyKeys.set(target, key);
372
385
  // Deeply traverse arrays and objects to track every object within
@@ -6481,9 +6494,11 @@ function invokeComponentConstructor(vm, Ctor) {
6481
6494
  // the "instanceof" operator would not work here since Locker Service provides its own
6482
6495
  // implementation of LightningElement, so we indirectly check if the base constructor is
6483
6496
  // invoked by accessing the component on the vm.
6484
- const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6485
- ? vmBeingConstructed.component !== result
6486
- : !(result instanceof LightningElement);
6497
+ // TODO [W-17769475]: Restore this fix when we can reliably detect Locker enabled
6498
+ // const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6499
+ // ? vmBeingConstructed.component !== result
6500
+ // : !(result instanceof LightningElement);
6501
+ const isInvalidConstructor = vmBeingConstructed.component !== result;
6487
6502
  if (isInvalidConstructor) {
6488
6503
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6489
6504
  }
@@ -8487,5 +8502,5 @@ exports.swapTemplate = swapTemplate;
8487
8502
  exports.track = track;
8488
8503
  exports.unwrap = unwrap;
8489
8504
  exports.wire = wire;
8490
- /** version: 8.13.0 */
8505
+ /** version: 8.13.1 */
8491
8506
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -301,6 +301,18 @@ function safelyCallGetter(target, key) {
301
301
  /* ignore */
302
302
  }
303
303
  }
304
+ function isRevokedProxy(target) {
305
+ try {
306
+ // `str in obj` will never throw for normal objects or active proxies,
307
+ // but the operation is not allowed for revoked proxies
308
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
309
+ '' in target;
310
+ return false;
311
+ }
312
+ catch (_) {
313
+ return true;
314
+ }
315
+ }
304
316
  /**
305
317
  * Flush all the logs we've written so far and return the current logs.
306
318
  */
@@ -363,7 +375,8 @@ function trackTargetForMutationLogging(key, target) {
363
375
  // Guard against recursive objects - don't traverse forever
364
376
  return;
365
377
  }
366
- if (isObject(target) && !isNull(target)) {
378
+ // Revoked proxies (e.g. window props in LWS sandboxes) throw an error if we try to track them
379
+ if (isObject(target) && !isNull(target) && !isRevokedProxy(target)) {
367
380
  // only track non-primitives; others are invalid as WeakMap keys
368
381
  targetsToPropertyKeys.set(target, key);
369
382
  // Deeply traverse arrays and objects to track every object within
@@ -6478,9 +6491,11 @@ function invokeComponentConstructor(vm, Ctor) {
6478
6491
  // the "instanceof" operator would not work here since Locker Service provides its own
6479
6492
  // implementation of LightningElement, so we indirectly check if the base constructor is
6480
6493
  // invoked by accessing the component on the vm.
6481
- const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6482
- ? vmBeingConstructed.component !== result
6483
- : !(result instanceof LightningElement);
6494
+ // TODO [W-17769475]: Restore this fix when we can reliably detect Locker enabled
6495
+ // const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6496
+ // ? vmBeingConstructed.component !== result
6497
+ // : !(result instanceof LightningElement);
6498
+ const isInvalidConstructor = vmBeingConstructed.component !== result;
6484
6499
  if (isInvalidConstructor) {
6485
6500
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6486
6501
  }
@@ -8433,5 +8448,5 @@ function readonly(obj) {
8433
8448
  }
8434
8449
 
8435
8450
  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 };
8436
- /** version: 8.13.0 */
8451
+ /** version: 8.13.1 */
8437
8452
  //# 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": "8.13.0",
7
+ "version": "8.13.1",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -46,9 +46,9 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@lwc/features": "8.13.0",
50
- "@lwc/shared": "8.13.0",
51
- "@lwc/signals": "8.13.0"
49
+ "@lwc/features": "8.13.1",
50
+ "@lwc/shared": "8.13.1",
51
+ "@lwc/signals": "8.13.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"