@lwc/engine-core 2.5.0 → 2.5.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.
@@ -2943,18 +2943,33 @@ function createObservedFieldPropertyDescriptor(key) {
2943
2943
 
2944
2944
  function getClassDescriptorType(descriptor) {
2945
2945
  if (shared.isFunction(descriptor.value)) {
2946
- return 'method';
2946
+ return "method"
2947
+ /* Method */
2948
+ ;
2947
2949
  } else if (shared.isFunction(descriptor.set) || shared.isFunction(descriptor.get)) {
2948
- return 'accessor';
2950
+ return "accessor"
2951
+ /* Accessor */
2952
+ ;
2949
2953
  } else {
2950
- return 'field';
2954
+ return "field"
2955
+ /* Field */
2956
+ ;
2951
2957
  }
2952
2958
  }
2953
2959
 
2954
2960
  function validateObservedField(Ctor, fieldName, descriptor) {
2955
2961
  if (!shared.isUndefined(descriptor)) {
2956
2962
  const type = getClassDescriptorType(descriptor);
2957
- shared.assert.fail(`Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`);
2963
+ const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2964
+ // This branch is only here for backward compatibility reasons.
2965
+
2966
+ if (type === "accessor"
2967
+ /* Accessor */
2968
+ ) {
2969
+ logError(message);
2970
+ } else {
2971
+ shared.assert.fail(message);
2972
+ }
2958
2973
  }
2959
2974
  }
2960
2975
 
@@ -2981,7 +2996,16 @@ function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2981
2996
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2982
2997
  if (!shared.isUndefined(descriptor)) {
2983
2998
  const type = getClassDescriptorType(descriptor);
2984
- shared.assert.fail(`Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`);
2999
+ const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
3000
+ // This branch is only here for backward compatibility reasons.
3001
+
3002
+ if (type === "accessor"
3003
+ /* Accessor */
3004
+ ) {
3005
+ logError(message);
3006
+ } else {
3007
+ shared.assert.fail(message);
3008
+ }
2985
3009
  }
2986
3010
  }
2987
3011
 
@@ -3044,9 +3068,16 @@ function registerDecorators(Ctor, meta) {
3044
3068
  // field declaration
3045
3069
  if (process.env.NODE_ENV !== 'production') {
3046
3070
  validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);
3047
- }
3071
+ } // [W-9927596] If a component has both a public property and a private setter/getter
3072
+ // with the same name, the property is defined as a public accessor. This branch is
3073
+ // only here for backward compatibility reasons.
3074
+
3048
3075
 
3049
- descriptor = createPublicPropertyDescriptor(fieldName);
3076
+ if (!shared.isUndefined(descriptor) && !shared.isUndefined(descriptor.get)) {
3077
+ descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
3078
+ } else {
3079
+ descriptor = createPublicPropertyDescriptor(fieldName);
3080
+ }
3050
3081
  }
3051
3082
 
3052
3083
  apiFields[fieldName] = descriptor;
@@ -3126,9 +3157,16 @@ function registerDecorators(Ctor, meta) {
3126
3157
 
3127
3158
  if (process.env.NODE_ENV !== 'production') {
3128
3159
  validateObservedField(Ctor, fieldName, descriptor);
3129
- }
3160
+ } // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
3161
+ // tracked property. This is only here for backward compatibility purposes.
3162
+
3130
3163
 
3131
- observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
3164
+ const isDuplicatePublicProp = !shared.isUndefined(publicProps) && fieldName in publicProps;
3165
+ const isDuplicateTrackedProp = !shared.isUndefined(track) && fieldName in track;
3166
+
3167
+ if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
3168
+ observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
3169
+ }
3132
3170
  }
3133
3171
  }
3134
3172
 
@@ -6763,4 +6801,4 @@ exports.swapTemplate = swapTemplate;
6763
6801
  exports.track = track;
6764
6802
  exports.unwrap = unwrap;
6765
6803
  exports.wire = wire;
6766
- /* version: 2.5.0 */
6804
+ /* version: 2.5.1 */
@@ -2940,18 +2940,33 @@ function createObservedFieldPropertyDescriptor(key) {
2940
2940
 
2941
2941
  function getClassDescriptorType(descriptor) {
2942
2942
  if (isFunction$1(descriptor.value)) {
2943
- return 'method';
2943
+ return "method"
2944
+ /* Method */
2945
+ ;
2944
2946
  } else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
2945
- return 'accessor';
2947
+ return "accessor"
2948
+ /* Accessor */
2949
+ ;
2946
2950
  } else {
2947
- return 'field';
2951
+ return "field"
2952
+ /* Field */
2953
+ ;
2948
2954
  }
2949
2955
  }
2950
2956
 
2951
2957
  function validateObservedField(Ctor, fieldName, descriptor) {
2952
2958
  if (!isUndefined$1(descriptor)) {
2953
2959
  const type = getClassDescriptorType(descriptor);
2954
- assert.fail(`Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`);
2960
+ const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
2961
+ // This branch is only here for backward compatibility reasons.
2962
+
2963
+ if (type === "accessor"
2964
+ /* Accessor */
2965
+ ) {
2966
+ logError(message);
2967
+ } else {
2968
+ assert.fail(message);
2969
+ }
2955
2970
  }
2956
2971
  }
2957
2972
 
@@ -2978,7 +2993,16 @@ function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2978
2993
  function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2979
2994
  if (!isUndefined$1(descriptor)) {
2980
2995
  const type = getClassDescriptorType(descriptor);
2981
- assert.fail(`Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`);
2996
+ const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
2997
+ // This branch is only here for backward compatibility reasons.
2998
+
2999
+ if (type === "accessor"
3000
+ /* Accessor */
3001
+ ) {
3002
+ logError(message);
3003
+ } else {
3004
+ assert.fail(message);
3005
+ }
2982
3006
  }
2983
3007
  }
2984
3008
 
@@ -3041,9 +3065,16 @@ function registerDecorators(Ctor, meta) {
3041
3065
  // field declaration
3042
3066
  if (process.env.NODE_ENV !== 'production') {
3043
3067
  validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);
3044
- }
3068
+ } // [W-9927596] If a component has both a public property and a private setter/getter
3069
+ // with the same name, the property is defined as a public accessor. This branch is
3070
+ // only here for backward compatibility reasons.
3071
+
3045
3072
 
3046
- descriptor = createPublicPropertyDescriptor(fieldName);
3073
+ if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
3074
+ descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
3075
+ } else {
3076
+ descriptor = createPublicPropertyDescriptor(fieldName);
3077
+ }
3047
3078
  }
3048
3079
 
3049
3080
  apiFields[fieldName] = descriptor;
@@ -3123,9 +3154,16 @@ function registerDecorators(Ctor, meta) {
3123
3154
 
3124
3155
  if (process.env.NODE_ENV !== 'production') {
3125
3156
  validateObservedField(Ctor, fieldName, descriptor);
3126
- }
3157
+ } // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
3158
+ // tracked property. This is only here for backward compatibility purposes.
3159
+
3127
3160
 
3128
- observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
3161
+ const isDuplicatePublicProp = !isUndefined$1(publicProps) && fieldName in publicProps;
3162
+ const isDuplicateTrackedProp = !isUndefined$1(track) && fieldName in track;
3163
+
3164
+ if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
3165
+ observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
3166
+ }
3129
3167
  }
3130
3168
  }
3131
3169
 
@@ -6725,4 +6763,4 @@ function readonly(obj) {
6725
6763
  }
6726
6764
 
6727
6765
  export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, connectRootElement, createContextProvider, createVM, disconnectRootElement, getAssociatedVMIfPresent, getComponentDef, getComponentInternalDef, getUpgradableConstructor, isComponentConstructor, readonly, register, registerComponent, registerDecorators, registerTemplate, sanitizeAttribute, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
6728
- /* version: 2.5.0 */
6766
+ /* version: 2.5.1 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lwc/engine-core",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Core LWC engine APIs.",
5
5
  "homepage": "https://lwc.dev/",
6
6
  "repository": {
@@ -24,8 +24,8 @@
24
24
  "types/"
25
25
  ],
26
26
  "dependencies": {
27
- "@lwc/features": "2.5.0",
28
- "@lwc/shared": "2.5.0"
27
+ "@lwc/features": "2.5.1",
28
+ "@lwc/shared": "2.5.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "observable-membrane": "1.0.1"
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "29e9766d5dd3ac93c157a950aa533ab668c0e423"
36
+ "gitHead": "443fa2e0a54c8940814292aac84d40e7eb69b22f"
37
37
  }