@lwc/engine-core 8.23.0 → 8.25.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.
@@ -9,6 +9,10 @@ type ComponentConstructorMetadata = {
9
9
  sel: string;
10
10
  apiVersion: APIVersion;
11
11
  enableSyntheticElementInternals?: boolean | undefined;
12
+ componentFeatureFlag?: {
13
+ value: boolean;
14
+ path: string;
15
+ } | undefined;
12
16
  };
13
17
  /**
14
18
  * INTERNAL: This function can only be invoked by compiled code. The compiler
@@ -21,6 +25,8 @@ export declare function getComponentRegisteredTemplate(Ctor: LightningElementCon
21
25
  export declare function getComponentRegisteredName(Ctor: LightningElementConstructor): string | undefined;
22
26
  export declare function getComponentAPIVersion(Ctor: LightningElementConstructor): APIVersion;
23
27
  export declare function supportsSyntheticElementInternals(Ctor: LightningElementConstructor): boolean;
28
+ export declare function isComponentFeatureEnabled(Ctor: LightningElementConstructor): boolean;
29
+ export declare function getComponentMetadata(Ctor: LightningElementConstructor): ComponentConstructorMetadata | undefined;
24
30
  export declare function getTemplateReactiveObserver(vm: VM): ReactiveObserver;
25
31
  export declare function resetTemplateObserverAndUnsubscribe(vm: VM): void;
26
32
  export declare function renderComponent(vm: VM): VNodes;
package/dist/index.cjs.js CHANGED
@@ -139,7 +139,7 @@ function addErrorComponentStack(vm, error) {
139
139
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
140
140
  */
141
141
  const alreadyLoggedMessages = new Set();
142
- // Only used in LWC's Karma tests
142
+ // Only used in LWC's integration tests
143
143
  if (process.env.NODE_ENV === 'test-lwc-integration') {
144
144
  window.__lwcResetAlreadyLoggedMessages = () => {
145
145
  alreadyLoggedMessages.clear();
@@ -2856,7 +2856,7 @@ function getDecoratorsMeta(Ctor) {
2856
2856
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2857
2857
  */
2858
2858
  let warned = false;
2859
- // Only used in LWC's Karma tests
2859
+ // Only used in LWC's integration tests
2860
2860
  if (process.env.NODE_ENV === 'test-lwc-integration') {
2861
2861
  window.__lwcResetWarnedOnVersionMismatch = () => {
2862
2862
  warned = false;
@@ -3137,7 +3137,7 @@ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
3137
3137
  // The "pure" annotations are so that Rollup knows for sure it can remove these from prod mode
3138
3138
  let stylesheetsToCssContent = /*@__PURE__@*/ new WeakMap();
3139
3139
  let cssContentToAbortControllers = /*@__PURE__@*/ new Map();
3140
- // Only used in LWC's Karma tests
3140
+ // Only used in LWC's integration tests
3141
3141
  if (process.env.NODE_ENV === 'test-lwc-integration') {
3142
3142
  // Used to reset the global state between test runs
3143
3143
  window.__lwcResetStylesheetCache = () => {
@@ -3539,7 +3539,7 @@ let activeTemplates = /*@__PURE__@*/ new WeakMultiMap();
3539
3539
  let activeComponents =
3540
3540
  /*@__PURE__@*/ new WeakMultiMap();
3541
3541
  let activeStyles = /*@__PURE__@*/ new WeakMultiMap();
3542
- // Only used in LWC's Karma tests
3542
+ // Only used in LWC's integration tests
3543
3543
  if (process.env.NODE_ENV === 'test-lwc-integration') {
3544
3544
  // Used to reset the global state between test runs
3545
3545
  window.__lwcResetHotSwaps = () => {
@@ -3754,6 +3754,13 @@ function getCtorProto(Ctor) {
3754
3754
  return proto;
3755
3755
  }
3756
3756
  function createComponentDef(Ctor) {
3757
+ // Enforce component-level feature flag if provided at compile time
3758
+ if (!isComponentFeatureEnabled(Ctor)) {
3759
+ const metadata = getComponentMetadata(Ctor);
3760
+ const componentName = Ctor.name || metadata?.sel || 'Unknown';
3761
+ const componentFeatureFlagPath = metadata?.componentFeatureFlag?.path || 'Unknown';
3762
+ throw new Error(`Component ${componentName} is disabled by the feature flag at ${componentFeatureFlagPath}.`);
3763
+ }
3757
3764
  const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode, formAssociated: ctorFormAssociated, } = Ctor;
3758
3765
  if (process.env.NODE_ENV !== 'production') {
3759
3766
  const ctorName = Ctor.name;
@@ -6219,7 +6226,7 @@ const MAX_CACHE_KEY = 3;
6219
6226
  // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
6220
6227
  // Also note that this array only needs to be large enough to account for the maximum possible cache key
6221
6228
  const fragmentCache = shared.ArrayFrom({ length: MAX_CACHE_KEY + 1 }, () => new WeakMap());
6222
- // Only used in LWC's Karma tests
6229
+ // Only used in LWC's integration tests
6223
6230
  if (process.env.NODE_ENV === 'test-lwc-integration') {
6224
6231
  window.__lwcResetFragmentCache = () => {
6225
6232
  for (let i = 0; i < fragmentCache.length; i++) {
@@ -6717,7 +6724,7 @@ function getComponentAPIVersion(Ctor) {
6717
6724
  const metadata = registeredComponentMap.get(Ctor);
6718
6725
  const apiVersion = metadata?.apiVersion;
6719
6726
  if (shared.isUndefined(apiVersion)) {
6720
- // This should only occur in our Karma tests; in practice every component
6727
+ // This should only occur in our integration tests; in practice every component
6721
6728
  // is registered, and so this code path should not get hit. But to be safe,
6722
6729
  // return the lowest possible version.
6723
6730
  return shared.LOWEST_API_VERSION;
@@ -6727,6 +6734,14 @@ function getComponentAPIVersion(Ctor) {
6727
6734
  function supportsSyntheticElementInternals(Ctor) {
6728
6735
  return registeredComponentMap.get(Ctor)?.enableSyntheticElementInternals || false;
6729
6736
  }
6737
+ function isComponentFeatureEnabled(Ctor) {
6738
+ const flag = registeredComponentMap.get(Ctor)?.componentFeatureFlag;
6739
+ // Default to true if not provided
6740
+ return flag?.value !== false;
6741
+ }
6742
+ function getComponentMetadata(Ctor) {
6743
+ return registeredComponentMap.get(Ctor);
6744
+ }
6730
6745
  function getTemplateReactiveObserver(vm) {
6731
6746
  const reactiveObserver = createReactiveObserver(() => {
6732
6747
  const { isDirty } = vm;
@@ -8825,5 +8840,5 @@ exports.swapTemplate = swapTemplate;
8825
8840
  exports.track = track;
8826
8841
  exports.unwrap = unwrap;
8827
8842
  exports.wire = wire;
8828
- /** version: 8.23.0 */
8843
+ /** version: 8.25.0 */
8829
8844
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -136,7 +136,7 @@ function addErrorComponentStack(vm, error) {
136
136
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
137
137
  */
138
138
  const alreadyLoggedMessages = new Set();
139
- // Only used in LWC's Karma tests
139
+ // Only used in LWC's integration tests
140
140
  if (process.env.NODE_ENV === 'test-lwc-integration') {
141
141
  window.__lwcResetAlreadyLoggedMessages = () => {
142
142
  alreadyLoggedMessages.clear();
@@ -2853,7 +2853,7 @@ function getDecoratorsMeta(Ctor) {
2853
2853
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2854
2854
  */
2855
2855
  let warned = false;
2856
- // Only used in LWC's Karma tests
2856
+ // Only used in LWC's integration tests
2857
2857
  if (process.env.NODE_ENV === 'test-lwc-integration') {
2858
2858
  window.__lwcResetWarnedOnVersionMismatch = () => {
2859
2859
  warned = false;
@@ -3134,7 +3134,7 @@ const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;
3134
3134
  // The "pure" annotations are so that Rollup knows for sure it can remove these from prod mode
3135
3135
  let stylesheetsToCssContent = /*@__PURE__@*/ new WeakMap();
3136
3136
  let cssContentToAbortControllers = /*@__PURE__@*/ new Map();
3137
- // Only used in LWC's Karma tests
3137
+ // Only used in LWC's integration tests
3138
3138
  if (process.env.NODE_ENV === 'test-lwc-integration') {
3139
3139
  // Used to reset the global state between test runs
3140
3140
  window.__lwcResetStylesheetCache = () => {
@@ -3536,7 +3536,7 @@ let activeTemplates = /*@__PURE__@*/ new WeakMultiMap();
3536
3536
  let activeComponents =
3537
3537
  /*@__PURE__@*/ new WeakMultiMap();
3538
3538
  let activeStyles = /*@__PURE__@*/ new WeakMultiMap();
3539
- // Only used in LWC's Karma tests
3539
+ // Only used in LWC's integration tests
3540
3540
  if (process.env.NODE_ENV === 'test-lwc-integration') {
3541
3541
  // Used to reset the global state between test runs
3542
3542
  window.__lwcResetHotSwaps = () => {
@@ -3751,6 +3751,13 @@ function getCtorProto(Ctor) {
3751
3751
  return proto;
3752
3752
  }
3753
3753
  function createComponentDef(Ctor) {
3754
+ // Enforce component-level feature flag if provided at compile time
3755
+ if (!isComponentFeatureEnabled(Ctor)) {
3756
+ const metadata = getComponentMetadata(Ctor);
3757
+ const componentName = Ctor.name || metadata?.sel || 'Unknown';
3758
+ const componentFeatureFlagPath = metadata?.componentFeatureFlag?.path || 'Unknown';
3759
+ throw new Error(`Component ${componentName} is disabled by the feature flag at ${componentFeatureFlagPath}.`);
3760
+ }
3754
3761
  const { shadowSupportMode: ctorShadowSupportMode, renderMode: ctorRenderMode, formAssociated: ctorFormAssociated, } = Ctor;
3755
3762
  if (process.env.NODE_ENV !== 'production') {
3756
3763
  const ctorName = Ctor.name;
@@ -6216,7 +6223,7 @@ const MAX_CACHE_KEY = 3;
6216
6223
  // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates
6217
6224
  // Also note that this array only needs to be large enough to account for the maximum possible cache key
6218
6225
  const fragmentCache = ArrayFrom({ length: MAX_CACHE_KEY + 1 }, () => new WeakMap());
6219
- // Only used in LWC's Karma tests
6226
+ // Only used in LWC's integration tests
6220
6227
  if (process.env.NODE_ENV === 'test-lwc-integration') {
6221
6228
  window.__lwcResetFragmentCache = () => {
6222
6229
  for (let i = 0; i < fragmentCache.length; i++) {
@@ -6714,7 +6721,7 @@ function getComponentAPIVersion(Ctor) {
6714
6721
  const metadata = registeredComponentMap.get(Ctor);
6715
6722
  const apiVersion = metadata?.apiVersion;
6716
6723
  if (isUndefined$1(apiVersion)) {
6717
- // This should only occur in our Karma tests; in practice every component
6724
+ // This should only occur in our integration tests; in practice every component
6718
6725
  // is registered, and so this code path should not get hit. But to be safe,
6719
6726
  // return the lowest possible version.
6720
6727
  return LOWEST_API_VERSION;
@@ -6724,6 +6731,14 @@ function getComponentAPIVersion(Ctor) {
6724
6731
  function supportsSyntheticElementInternals(Ctor) {
6725
6732
  return registeredComponentMap.get(Ctor)?.enableSyntheticElementInternals || false;
6726
6733
  }
6734
+ function isComponentFeatureEnabled(Ctor) {
6735
+ const flag = registeredComponentMap.get(Ctor)?.componentFeatureFlag;
6736
+ // Default to true if not provided
6737
+ return flag?.value !== false;
6738
+ }
6739
+ function getComponentMetadata(Ctor) {
6740
+ return registeredComponentMap.get(Ctor);
6741
+ }
6727
6742
  function getTemplateReactiveObserver(vm) {
6728
6743
  const reactiveObserver = createReactiveObserver(() => {
6729
6744
  const { isDirty } = vm;
@@ -8751,5 +8766,5 @@ function readonly(obj) {
8751
8766
  }
8752
8767
 
8753
8768
  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 };
8754
- /** version: 8.23.0 */
8769
+ /** version: 8.25.0 */
8755
8770
  //# 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.23.0",
7
+ "version": "8.25.0",
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.23.0",
50
- "@lwc/shared": "8.23.0",
51
- "@lwc/signals": "8.23.0"
49
+ "@lwc/features": "8.25.0",
50
+ "@lwc/shared": "8.25.0",
51
+ "@lwc/signals": "8.25.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "observable-membrane": "2.0.0"