@lwc/engine-core 3.2.0 → 3.3.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.
package/README.md CHANGED
@@ -96,11 +96,6 @@ This experimental API enables the identification of LWC constructors.
96
96
  This experimental API enables the creation of a reactive readonly membrane around any object
97
97
  value.
98
98
 
99
- ### register()
100
-
101
- This experimental API enables the registration of 'services' in LWC by exposing hooks into the
102
- component life-cycle.
103
-
104
99
  ### setHooks()
105
100
 
106
101
  This experimental API allows setting overridable hooks with an application specific implementation.
@@ -18,7 +18,6 @@ export { getComponentConstructor } from './get-component-constructor';
18
18
  export type { RendererAPI, LifecycleCallback } from './renderer';
19
19
  export type { ConfigValue as WireConfigValue, ContextValue as WireContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './wiring';
20
20
  export { LightningElement } from './base-lightning-element';
21
- export { register } from './services';
22
21
  export { default as api } from './decorators/api';
23
22
  export { default as track } from './decorators/track';
24
23
  export { default as wire } from './decorators/wire';
package/dist/index.cjs.js CHANGED
@@ -5336,44 +5336,6 @@ function getWrappedComponentsListener(vm, listener) {
5336
5336
  return wrappedListener;
5337
5337
  }
5338
5338
 
5339
- /*
5340
- * Copyright (c) 2018, salesforce.com, inc.
5341
- * All rights reserved.
5342
- * SPDX-License-Identifier: MIT
5343
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5344
- */
5345
- const Services = shared.create(null);
5346
- const hooks = ['rendered', 'connected', 'disconnected'];
5347
- /**
5348
- * EXPERIMENTAL: This function allows for the registration of "services"
5349
- * in LWC by exposing hooks into the component life-cycle. This API is
5350
- * subject to change or being removed.
5351
- */
5352
- function register(service) {
5353
- if (process.env.NODE_ENV !== 'production') {
5354
- shared.assert.isTrue(shared.isObject(service), `Invalid service declaration, ${service}: service must be an object`);
5355
- }
5356
- for (let i = 0; i < hooks.length; ++i) {
5357
- const hookName = hooks[i];
5358
- if (hookName in service) {
5359
- let l = Services[hookName];
5360
- if (shared.isUndefined(l)) {
5361
- Services[hookName] = l = [];
5362
- }
5363
- shared.ArrayPush.call(l, service[hookName]);
5364
- }
5365
- }
5366
- }
5367
- function invokeServiceHook(vm, cbs) {
5368
- if (process.env.NODE_ENV !== 'production') {
5369
- shared.assert.isTrue(shared.isArray(cbs) && cbs.length > 0, `Optimize invokeServiceHook() to be invoked only when needed`);
5370
- }
5371
- const { component, def, context } = vm;
5372
- for (let i = 0, len = cbs.length; i < len; ++i) {
5373
- cbs[i].call(undefined, component, {}, def, context);
5374
- }
5375
- }
5376
-
5377
5339
  /*
5378
5340
  * Copyright (c) 2023, Salesforce.com, inc.
5379
5341
  * All rights reserved.
@@ -5432,7 +5394,13 @@ function resetComponentStateWhenRemoved(vm) {
5432
5394
  // old vnode.children is removed from the DOM.
5433
5395
  function removeVM(vm) {
5434
5396
  if (process.env.NODE_ENV !== 'production') {
5435
- shared.assert.isTrue(vm.state === 1 /* VMState.connected */ || vm.state === 2 /* VMState.disconnected */, `${vm} must have been connected.`);
5397
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
5398
+ // With native lifecycle, we cannot be certain that connectedCallback was called before a component
5399
+ // was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
5400
+ // in native mode, although it will fire in synthetic mode due to appendChild triggering it.
5401
+ // See: W-14037619 for details
5402
+ shared.assert.isTrue(vm.state === 1 /* VMState.connected */ || vm.state === 2 /* VMState.disconnected */, `${vm} must have been connected.`);
5403
+ }
5436
5404
  }
5437
5405
  resetComponentStateWhenRemoved(vm);
5438
5406
  }
@@ -5675,10 +5643,6 @@ function runRenderedCallback(vm) {
5675
5643
  if (!process.env.IS_BROWSER) {
5676
5644
  return;
5677
5645
  }
5678
- const { rendered } = Services;
5679
- if (rendered) {
5680
- invokeServiceHook(vm, rendered);
5681
- }
5682
5646
  if (!shared.isUndefined(renderedCallback)) {
5683
5647
  logOperationStart(4 /* OperationId.RenderedCallback */, vm);
5684
5648
  invokeComponentCallback(vm, renderedCallback);
@@ -5721,11 +5685,6 @@ function runConnectedCallback(vm) {
5721
5685
  return; // nothing to do since it was already connected
5722
5686
  }
5723
5687
  vm.state = 1 /* VMState.connected */;
5724
- // reporting connection
5725
- const { connected } = Services;
5726
- if (connected) {
5727
- invokeServiceHook(vm, connected);
5728
- }
5729
5688
  if (hasWireAdapters(vm)) {
5730
5689
  connectWireAdapters(vm);
5731
5690
  }
@@ -5751,11 +5710,6 @@ function runDisconnectedCallback(vm) {
5751
5710
  vm.isDirty = true;
5752
5711
  }
5753
5712
  vm.state = 2 /* VMState.disconnected */;
5754
- // reporting disconnection
5755
- const { disconnected } = Services;
5756
- if (disconnected) {
5757
- invokeServiceHook(vm, disconnected);
5758
- }
5759
5713
  if (hasWireAdapters(vm)) {
5760
5714
  disconnectWireAdapters(vm);
5761
5715
  }
@@ -6941,7 +6895,6 @@ exports.isComponentConstructor = isComponentConstructor;
6941
6895
  exports.parseFragment = parseFragment;
6942
6896
  exports.parseSVGFragment = parseSVGFragment;
6943
6897
  exports.readonly = readonly;
6944
- exports.register = register;
6945
6898
  exports.registerComponent = registerComponent;
6946
6899
  exports.registerDecorators = registerDecorators;
6947
6900
  exports.registerTemplate = registerTemplate;
@@ -6953,5 +6906,5 @@ exports.swapTemplate = swapTemplate;
6953
6906
  exports.track = track;
6954
6907
  exports.unwrap = unwrap;
6955
6908
  exports.wire = wire;
6956
- /** version: 3.2.0 */
6909
+ /** version: 3.3.0 */
6957
6910
  //# sourceMappingURL=index.cjs.js.map