@lwc/engine-core 8.12.5 → 8.12.6

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,5 +1,6 @@
1
+ import { LightningElement } from './base-lightning-element';
1
2
  import type { VM } from './vm';
2
- import type { LightningElement, LightningElementConstructor } from './base-lightning-element';
3
+ import type { LightningElementConstructor } from './base-lightning-element';
3
4
  import type { VNodes } from './vnodes';
4
5
  export declare let isInvokingRender: boolean;
5
6
  export declare let vmBeingConstructed: VM | null;
@@ -9,10 +9,11 @@ export declare const enum OperationId {
9
9
  RenderedCallback = 4,
10
10
  DisconnectedCallback = 5,
11
11
  ErrorCallback = 6,
12
- GlobalHydrate = 7,
13
- GlobalRehydrate = 8
12
+ GlobalRender = 7,
13
+ GlobalRerender = 8,
14
+ GlobalSsrHydrate = 9
14
15
  }
15
- type GlobalOperationId = OperationId.GlobalHydrate | OperationId.GlobalRehydrate;
16
+ type GlobalOperationId = OperationId.GlobalRender | OperationId.GlobalRerender | OperationId.GlobalSsrHydrate;
16
17
  declare const enum Phase {
17
18
  Start = 0,
18
19
  Stop = 1
package/dist/index.cjs.js CHANGED
@@ -2960,7 +2960,10 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
2960
2960
  const { observedAttributes: superObservedAttributes = [] } = SuperClass;
2961
2961
  const descriptors = shared.create(null);
2962
2962
  // present a hint message so that developers are aware that they have not decorated property with @api
2963
- if (process.env.NODE_ENV !== 'production') {
2963
+ // Note that we also don't do this in SSR because we cannot sniff for what props are declared on
2964
+ // HTMLElementPrototype, and it seems not worth it to have these dev-only warnings there, since
2965
+ // an `in` check could mistakenly assume that a prop is declared on a LightningElement prototype.
2966
+ if (process.env.NODE_ENV !== 'production' && process.env.IS_BROWSER) {
2964
2967
  // TODO [#3761]: enable for components that don't extend from LightningElement
2965
2968
  if (!shared.isUndefined(proto) && !shared.isNull(proto) && !hasCustomSuperClass) {
2966
2969
  const nonPublicPropertiesToWarnOn = new Set([
@@ -5821,8 +5824,9 @@ const operationIdNameMapping = [
5821
5824
  'renderedCallback',
5822
5825
  'disconnectedCallback',
5823
5826
  'errorCallback',
5824
- 'lwc-hydrate',
5825
- 'lwc-rehydrate',
5827
+ 'lwc-render',
5828
+ 'lwc-rerender',
5829
+ 'lwc-ssr-hydrate',
5826
5830
  ];
5827
5831
  const operationTooltipMapping = [
5828
5832
  // constructor
@@ -5839,10 +5843,12 @@ const operationTooltipMapping = [
5839
5843
  'component disconnectedCallback()',
5840
5844
  // errorCallback
5841
5845
  'component errorCallback()',
5842
- // lwc-hydrate
5846
+ // lwc-render
5843
5847
  'component first rendered',
5844
- // lwc-rehydrate
5848
+ // lwc-rerender
5845
5849
  'component re-rendered',
5850
+ // lwc-ssr-hydrate
5851
+ 'component hydrated from server-rendered HTML',
5846
5852
  ];
5847
5853
  // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
5848
5854
  // JSDom (used in Jest) for example doesn't implement the UserTiming APIs.
@@ -5896,13 +5902,14 @@ function getProperties(vm) {
5896
5902
  function getColor(opId) {
5897
5903
  // As of Sept 2024: primary (dark blue), secondary (light blue), tertiary (green)
5898
5904
  switch (opId) {
5899
- // GlobalHydrate and Constructor tend to occur at the top level
5900
- case 7 /* OperationId.GlobalHydrate */:
5905
+ // GlobalSsrHydrate, GlobalRender, and Constructor tend to occur at the top level
5906
+ case 7 /* OperationId.GlobalRender */:
5907
+ case 9 /* OperationId.GlobalSsrHydrate */:
5901
5908
  case 0 /* OperationId.Constructor */:
5902
5909
  return 'primary';
5903
- // GlobalRehydrate also occurs at the top level, but we want to use tertiary (green) because it's easier to
5910
+ // GlobalRerender also occurs at the top level, but we want to use tertiary (green) because it's easier to
5904
5911
  // distinguish from primary, and at a glance you should be able to easily tell re-renders from first renders.
5905
- case 8 /* OperationId.GlobalRehydrate */:
5912
+ case 8 /* OperationId.GlobalRerender */:
5906
5913
  return 'tertiary';
5907
5914
  // Everything else (patch/render/callbacks)
5908
5915
  default:
@@ -6107,7 +6114,7 @@ function getVMBeingRendered() {
6107
6114
  function setVMBeingRendered(vm) {
6108
6115
  vmBeingRendered = vm;
6109
6116
  }
6110
- const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
6117
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
6111
6118
  // See W-16614556
6112
6119
  // TODO [#2826]: freeze the template object
6113
6120
  function isValidScopeToken(token) {
@@ -6475,7 +6482,10 @@ function invokeComponentConstructor(vm, Ctor) {
6475
6482
  // the "instanceof" operator would not work here since Locker Service provides its own
6476
6483
  // implementation of LightningElement, so we indirectly check if the base constructor is
6477
6484
  // invoked by accessing the component on the vm.
6478
- if (vmBeingConstructed.component !== result) {
6485
+ const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6486
+ ? vmBeingConstructed.component !== result
6487
+ : !(result instanceof LightningElement);
6488
+ if (isInvalidConstructor) {
6479
6489
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6480
6490
  }
6481
6491
  }
@@ -6661,10 +6671,10 @@ function connectRootElement(elm) {
6661
6671
  const vm = getAssociatedVM(elm);
6662
6672
  if (process.env.NODE_ENV !== 'production') {
6663
6673
  // Flush any logs for this VM so that the initial properties from the constructor don't "count"
6664
- // in subsequent re-renders (lwc-rehydrate). Right now we're at the first render (lwc-hydrate).
6674
+ // in subsequent re-renders (lwc-rerender). Right now we're at the first render (lwc-hydrate).
6665
6675
  flushMutationLogsForVM(vm);
6666
6676
  }
6667
- logGlobalOperationStartWithVM(7 /* OperationId.GlobalHydrate */, vm);
6677
+ logGlobalOperationStartWithVM(7 /* OperationId.GlobalRender */, vm);
6668
6678
  // Usually means moving the element from one place to another, which is observable via
6669
6679
  // life-cycle hooks.
6670
6680
  if (vm.state === 1 /* VMState.connected */) {
@@ -6672,7 +6682,7 @@ function connectRootElement(elm) {
6672
6682
  }
6673
6683
  runConnectedCallback(vm);
6674
6684
  rehydrate(vm);
6675
- logGlobalOperationEndWithVM(7 /* OperationId.GlobalHydrate */, vm);
6685
+ logGlobalOperationEndWithVM(7 /* OperationId.GlobalRender */, vm);
6676
6686
  }
6677
6687
  function disconnectRootElement(elm) {
6678
6688
  const vm = getAssociatedVM(elm);
@@ -6981,7 +6991,7 @@ function flushRehydrationQueue() {
6981
6991
  // Gather the logs before rehydration starts so they can be reported at the end of rehydration.
6982
6992
  // Note that we also clear all existing logs at this point so that subsequent re-renders start from a clean slate.
6983
6993
  const mutationLogs = process.env.NODE_ENV === 'production' ? undefined : getAndFlushMutationLogs();
6984
- logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
6994
+ logGlobalOperationStart(8 /* OperationId.GlobalRerender */);
6985
6995
  if (process.env.NODE_ENV !== 'production') {
6986
6996
  shared.assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
6987
6997
  }
@@ -7001,13 +7011,13 @@ function flushRehydrationQueue() {
7001
7011
  shared.ArrayUnshift.apply(rehydrateQueue, shared.ArraySlice.call(vms, i + 1));
7002
7012
  }
7003
7013
  // we need to end the measure before throwing.
7004
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7014
+ logGlobalOperationEnd(8 /* OperationId.GlobalRerender */, mutationLogs);
7005
7015
  // re-throwing the original error will break the current tick, but since the next tick is
7006
7016
  // already scheduled, it should continue patching the rest.
7007
7017
  throw error;
7008
7018
  }
7009
7019
  }
7010
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7020
+ logGlobalOperationEnd(8 /* OperationId.GlobalRerender */, mutationLogs);
7011
7021
  }
7012
7022
  function runConnectedCallback(vm) {
7013
7023
  const { state } = vm;
@@ -7613,6 +7623,7 @@ const EMPTY_SET = new Set();
7613
7623
  let hasMismatch = false;
7614
7624
  function hydrateRoot(vm) {
7615
7625
  hasMismatch = false;
7626
+ logGlobalOperationStartWithVM(9 /* OperationId.GlobalSsrHydrate */, vm);
7616
7627
  runConnectedCallback(vm);
7617
7628
  hydrateVM(vm);
7618
7629
  if (process.env.NODE_ENV !== 'production') {
@@ -7625,6 +7636,7 @@ function hydrateRoot(vm) {
7625
7636
  logHydrationWarning('Hydration completed with errors.');
7626
7637
  }
7627
7638
  }
7639
+ logGlobalOperationEndWithVM(9 /* OperationId.GlobalSsrHydrate */, vm);
7628
7640
  }
7629
7641
  function hydrateVM(vm) {
7630
7642
  const children = renderComponent(vm);
@@ -7632,7 +7644,9 @@ function hydrateVM(vm) {
7632
7644
  // reset the refs; they will be set during `hydrateChildren`
7633
7645
  resetRefVNodes(vm);
7634
7646
  const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
7647
+ logOperationStart(2 /* OperationId.Patch */, vm);
7635
7648
  hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
7649
+ logOperationEnd(2 /* OperationId.Patch */, vm);
7636
7650
  runRenderedCallback(vm);
7637
7651
  }
7638
7652
  function hydrateNode(node, vnode, renderer) {
@@ -8474,5 +8488,5 @@ exports.swapTemplate = swapTemplate;
8474
8488
  exports.track = track;
8475
8489
  exports.unwrap = unwrap;
8476
8490
  exports.wire = wire;
8477
- /** version: 8.12.5 */
8491
+ /** version: 8.12.6 */
8478
8492
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -2957,7 +2957,10 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
2957
2957
  const { observedAttributes: superObservedAttributes = [] } = SuperClass;
2958
2958
  const descriptors = create(null);
2959
2959
  // present a hint message so that developers are aware that they have not decorated property with @api
2960
- if (process.env.NODE_ENV !== 'production') {
2960
+ // Note that we also don't do this in SSR because we cannot sniff for what props are declared on
2961
+ // HTMLElementPrototype, and it seems not worth it to have these dev-only warnings there, since
2962
+ // an `in` check could mistakenly assume that a prop is declared on a LightningElement prototype.
2963
+ if (process.env.NODE_ENV !== 'production' && process.env.IS_BROWSER) {
2961
2964
  // TODO [#3761]: enable for components that don't extend from LightningElement
2962
2965
  if (!isUndefined$1(proto) && !isNull(proto) && !hasCustomSuperClass) {
2963
2966
  const nonPublicPropertiesToWarnOn = new Set([
@@ -5818,8 +5821,9 @@ const operationIdNameMapping = [
5818
5821
  'renderedCallback',
5819
5822
  'disconnectedCallback',
5820
5823
  'errorCallback',
5821
- 'lwc-hydrate',
5822
- 'lwc-rehydrate',
5824
+ 'lwc-render',
5825
+ 'lwc-rerender',
5826
+ 'lwc-ssr-hydrate',
5823
5827
  ];
5824
5828
  const operationTooltipMapping = [
5825
5829
  // constructor
@@ -5836,10 +5840,12 @@ const operationTooltipMapping = [
5836
5840
  'component disconnectedCallback()',
5837
5841
  // errorCallback
5838
5842
  'component errorCallback()',
5839
- // lwc-hydrate
5843
+ // lwc-render
5840
5844
  'component first rendered',
5841
- // lwc-rehydrate
5845
+ // lwc-rerender
5842
5846
  'component re-rendered',
5847
+ // lwc-ssr-hydrate
5848
+ 'component hydrated from server-rendered HTML',
5843
5849
  ];
5844
5850
  // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
5845
5851
  // JSDom (used in Jest) for example doesn't implement the UserTiming APIs.
@@ -5893,13 +5899,14 @@ function getProperties(vm) {
5893
5899
  function getColor(opId) {
5894
5900
  // As of Sept 2024: primary (dark blue), secondary (light blue), tertiary (green)
5895
5901
  switch (opId) {
5896
- // GlobalHydrate and Constructor tend to occur at the top level
5897
- case 7 /* OperationId.GlobalHydrate */:
5902
+ // GlobalSsrHydrate, GlobalRender, and Constructor tend to occur at the top level
5903
+ case 7 /* OperationId.GlobalRender */:
5904
+ case 9 /* OperationId.GlobalSsrHydrate */:
5898
5905
  case 0 /* OperationId.Constructor */:
5899
5906
  return 'primary';
5900
- // GlobalRehydrate also occurs at the top level, but we want to use tertiary (green) because it's easier to
5907
+ // GlobalRerender also occurs at the top level, but we want to use tertiary (green) because it's easier to
5901
5908
  // distinguish from primary, and at a glance you should be able to easily tell re-renders from first renders.
5902
- case 8 /* OperationId.GlobalRehydrate */:
5909
+ case 8 /* OperationId.GlobalRerender */:
5903
5910
  return 'tertiary';
5904
5911
  // Everything else (patch/render/callbacks)
5905
5912
  default:
@@ -6104,7 +6111,7 @@ function getVMBeingRendered() {
6104
6111
  function setVMBeingRendered(vm) {
6105
6112
  vmBeingRendered = vm;
6106
6113
  }
6107
- const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
6114
+ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
6108
6115
  // See W-16614556
6109
6116
  // TODO [#2826]: freeze the template object
6110
6117
  function isValidScopeToken(token) {
@@ -6472,7 +6479,10 @@ function invokeComponentConstructor(vm, Ctor) {
6472
6479
  // the "instanceof" operator would not work here since Locker Service provides its own
6473
6480
  // implementation of LightningElement, so we indirectly check if the base constructor is
6474
6481
  // invoked by accessing the component on the vm.
6475
- if (vmBeingConstructed.component !== result) {
6482
+ const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
6483
+ ? vmBeingConstructed.component !== result
6484
+ : !(result instanceof LightningElement);
6485
+ if (isInvalidConstructor) {
6476
6486
  throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
6477
6487
  }
6478
6488
  }
@@ -6658,10 +6668,10 @@ function connectRootElement(elm) {
6658
6668
  const vm = getAssociatedVM(elm);
6659
6669
  if (process.env.NODE_ENV !== 'production') {
6660
6670
  // Flush any logs for this VM so that the initial properties from the constructor don't "count"
6661
- // in subsequent re-renders (lwc-rehydrate). Right now we're at the first render (lwc-hydrate).
6671
+ // in subsequent re-renders (lwc-rerender). Right now we're at the first render (lwc-hydrate).
6662
6672
  flushMutationLogsForVM(vm);
6663
6673
  }
6664
- logGlobalOperationStartWithVM(7 /* OperationId.GlobalHydrate */, vm);
6674
+ logGlobalOperationStartWithVM(7 /* OperationId.GlobalRender */, vm);
6665
6675
  // Usually means moving the element from one place to another, which is observable via
6666
6676
  // life-cycle hooks.
6667
6677
  if (vm.state === 1 /* VMState.connected */) {
@@ -6669,7 +6679,7 @@ function connectRootElement(elm) {
6669
6679
  }
6670
6680
  runConnectedCallback(vm);
6671
6681
  rehydrate(vm);
6672
- logGlobalOperationEndWithVM(7 /* OperationId.GlobalHydrate */, vm);
6682
+ logGlobalOperationEndWithVM(7 /* OperationId.GlobalRender */, vm);
6673
6683
  }
6674
6684
  function disconnectRootElement(elm) {
6675
6685
  const vm = getAssociatedVM(elm);
@@ -6978,7 +6988,7 @@ function flushRehydrationQueue() {
6978
6988
  // Gather the logs before rehydration starts so they can be reported at the end of rehydration.
6979
6989
  // Note that we also clear all existing logs at this point so that subsequent re-renders start from a clean slate.
6980
6990
  const mutationLogs = process.env.NODE_ENV === 'production' ? undefined : getAndFlushMutationLogs();
6981
- logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
6991
+ logGlobalOperationStart(8 /* OperationId.GlobalRerender */);
6982
6992
  if (process.env.NODE_ENV !== 'production') {
6983
6993
  assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
6984
6994
  }
@@ -6998,13 +7008,13 @@ function flushRehydrationQueue() {
6998
7008
  ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
6999
7009
  }
7000
7010
  // we need to end the measure before throwing.
7001
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7011
+ logGlobalOperationEnd(8 /* OperationId.GlobalRerender */, mutationLogs);
7002
7012
  // re-throwing the original error will break the current tick, but since the next tick is
7003
7013
  // already scheduled, it should continue patching the rest.
7004
7014
  throw error;
7005
7015
  }
7006
7016
  }
7007
- logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */, mutationLogs);
7017
+ logGlobalOperationEnd(8 /* OperationId.GlobalRerender */, mutationLogs);
7008
7018
  }
7009
7019
  function runConnectedCallback(vm) {
7010
7020
  const { state } = vm;
@@ -7610,6 +7620,7 @@ const EMPTY_SET = new Set();
7610
7620
  let hasMismatch = false;
7611
7621
  function hydrateRoot(vm) {
7612
7622
  hasMismatch = false;
7623
+ logGlobalOperationStartWithVM(9 /* OperationId.GlobalSsrHydrate */, vm);
7613
7624
  runConnectedCallback(vm);
7614
7625
  hydrateVM(vm);
7615
7626
  if (process.env.NODE_ENV !== 'production') {
@@ -7622,6 +7633,7 @@ function hydrateRoot(vm) {
7622
7633
  logHydrationWarning('Hydration completed with errors.');
7623
7634
  }
7624
7635
  }
7636
+ logGlobalOperationEndWithVM(9 /* OperationId.GlobalSsrHydrate */, vm);
7625
7637
  }
7626
7638
  function hydrateVM(vm) {
7627
7639
  const children = renderComponent(vm);
@@ -7629,7 +7641,9 @@ function hydrateVM(vm) {
7629
7641
  // reset the refs; they will be set during `hydrateChildren`
7630
7642
  resetRefVNodes(vm);
7631
7643
  const { renderRoot: parentNode, renderer: { getFirstChild }, } = vm;
7644
+ logOperationStart(2 /* OperationId.Patch */, vm);
7632
7645
  hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
7646
+ logOperationEnd(2 /* OperationId.Patch */, vm);
7633
7647
  runRenderedCallback(vm);
7634
7648
  }
7635
7649
  function hydrateNode(node, vnode, renderer) {
@@ -8420,5 +8434,5 @@ function readonly(obj) {
8420
8434
  }
8421
8435
 
8422
8436
  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 };
8423
- /** version: 8.12.5 */
8437
+ /** version: 8.12.6 */
8424
8438
  //# 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.12.5",
7
+ "version": "8.12.6",
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.12.5",
50
- "@lwc/shared": "8.12.5",
51
- "@lwc/signals": "8.12.5"
49
+ "@lwc/features": "8.12.6",
50
+ "@lwc/shared": "8.12.6",
51
+ "@lwc/signals": "8.12.6"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"