@lwc/engine-core 9.0.4-alpha.0 → 9.0.4-alpha.2

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,17 +1,20 @@
1
1
  import type { LightningElement } from '../base-lightning-element';
2
- import type { ConfigValue, ConfigWithReactiveProps, WireAdapterConstructor } from '../wiring';
2
+ import type { ConfigValue, ContextValue, ReplaceReactiveValues, WireAdapterConstructor } from '../wiring';
3
3
  /**
4
4
  * The decorator returned by `@wire()`; not the `wire` function.
5
+ *
6
+ * For TypeScript users:
7
+ * - If you are seeing an unclear error message, ensure that both the type of the decorated prop and
8
+ * the config used match the types expected by the wire adapter.
9
+ * - String literal types in the config are resolved to the corresponding prop on the component.
10
+ * For example, a component with `id = 555` and `@wire(getBook, {id: "$id"} as const) book` will
11
+ * have `"$id"` resolve to type `number`.
5
12
  */
6
13
  interface WireDecorator<Value, Class> {
7
14
  (target: unknown, context: ClassFieldDecoratorContext<Class, Value | undefined> | ClassMethodDecoratorContext<Class, Value extends (value: any) => any ? Value : (this: Class, value: Value) => void> | ClassGetterDecoratorContext<Class, Value | undefined> | ClassSetterDecoratorContext<Class, Value>): void;
8
15
  }
9
16
  /**
10
17
  * Decorator factory to wire a property or method to a wire adapter data source.
11
- *
12
- * TypeScript users: Due to limitations of the type system, some edge cases are
13
- * not fully type checked. See the type definition for {@linkcode ConfigWithReactiveProps}
14
- * for details.
15
18
  * @param adapter the adapter used to provision data
16
19
  * @param config configuration object for the adapter
17
20
  * @returns A decorator function
@@ -21,9 +24,9 @@ interface WireDecorator<Value, Class> {
21
24
  * \@wire(getBook, { id: '$bookId'}) book;
22
25
  * }
23
26
  */
24
- export default function wire<const Config extends ConfigValue = ConfigValue, const Value = any, const Class = LightningElement>(adapter: WireAdapterConstructor<Config, Value> | {
25
- adapter: WireAdapterConstructor<Config, Value>;
26
- }, config?: ConfigWithReactiveProps<Config, Class>): WireDecorator<Value, Class>;
27
+ export default function wire<ReactiveConfig extends ConfigValue = ConfigValue, Value = any, Context extends ContextValue = ContextValue, Class = LightningElement>(adapter: WireAdapterConstructor<ReplaceReactiveValues<ReactiveConfig, Class>, Value, Context> | {
28
+ adapter: WireAdapterConstructor<ReplaceReactiveValues<ReactiveConfig, Class>, Value, Context>;
29
+ }, config?: ReactiveConfig): WireDecorator<Value, Class>;
27
30
  export declare function internalWireFieldDecorator(key: string): PropertyDescriptor;
28
31
  export {};
29
32
  //# sourceMappingURL=wire.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export { createContextProviderWithRegister, createContextWatcher } from './context';
2
- export type { ConfigCallback, ConfigValue, ConfigWithReactiveProps, ContextConsumer, ContextProvider, ContextProviderOptions, ContextValue, DataCallback, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
2
+ export { ConfigCallback, ConfigValue, ContextConsumer, ContextProvider, ContextProviderOptions, ContextValue, DataCallback, ReplaceReactiveValues, WireAdapter, WireAdapterConstructor, WireAdapterSchemaValue, WireContextSubscriptionPayload, WireContextSubscriptionCallback, } from './types';
3
3
  export { connectWireAdapters, disconnectWireAdapters, installWireAdapters, storeWiredFieldMeta, storeWiredMethodMeta, } from './wiring';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -50,84 +50,19 @@ export interface ContextProviderOptions {
50
50
  }
51
51
  export type ContextProvider = (elmOrComponent: EventTarget, options: ContextProviderOptions) => void;
52
52
  export type RegisterContextProviderFn = (element: HostElement, adapterContextToken: string, onContextSubscription: WireContextSubscriptionCallback) => void;
53
+ /** Resolves a property chain to the corresponding value on the target type. */
54
+ type ResolveReactiveValue<
55
+ /** The object to search for properties; initially the component. */
56
+ Target,
57
+ /** A string representing a chain of of property keys, e.g. "data.user.name". */
58
+ Keys extends string> = Keys extends `${infer FirstKey}.${infer Rest}` ? FirstKey extends keyof Target ? ResolveReactiveValue<Target[FirstKey], Rest> : undefined : Keys extends keyof Target ? Target[Keys] : undefined;
53
59
  /**
54
- * Gets the property keys that can be used in a reactive string. Excludes symbols and string props
55
- * with `.` (`$foo.bar` maps to `Class["foo"]["bar"]`; `Class["foo.bar"]` can never be used).
60
+ * Detects if the `Value` type is a property chain starting with "$". If so, it resolves the
61
+ * properties to the corresponding value on the target type.
56
62
  */
57
- type ReactivePropsOnly<K extends PropertyKey> = Exclude<K, symbol | `${string}.${string}`>;
58
- /** The string keys of an object that match the target type. */
59
- type PropsOfType<Class, Target> = ReactivePropsOnly<{
60
- [K in keyof Class]-?: NonNullable<Class[K]> extends Target ? K : never;
61
- }[keyof Class]>;
62
- /** Gets the property keys that can be used in a reactive property chain. */
63
- type ChainableObjectProps<Class> = ReactivePropsOnly<{
64
- [K in keyof Class]-?: NonNullable<Class[K]> extends object ? keyof NonNullable<Class[K]> extends never ? never : K : never;
65
- }[keyof Class]>;
66
- /**
67
- * Extends a given wire adapter config with reactive property strings
68
- * (for example, `$prop`) for values on the given class that match the config.
69
- *
70
- * Due to limitations of the type system, and to limit the size of the
71
- * resulting type union, a number of restrictions apply to this type that can
72
- * result in false positives or false negatives.
73
- *
74
- * - Config values with a `string` type inherently permit _any_ string,
75
- * even reactive strings that resolve to the wrong type.
76
- * - Only top-level props are validated. Type checking is _not_ done on nested
77
- * property chains.
78
- * - Property chains are allowed only if the top-level property is an object.
79
- * - Property chains from `LightningElement` props are excluded.
80
- *
81
- * For property chains, a getter can be used to avoid incorrect error reporting,
82
- * as top-level properties are always validated. Alternatively, a type assertion
83
- * can be used to suppress the error.
84
- *
85
- * @example
86
- * // Wire adapter with a required number prop and optional string prop
87
- * declare const Adapter: WireAdapterConstructor<{ num: number; str?: string }>;
88
- * declare class Component extends LightningElement {
89
- * numberProp = 6_7;
90
- * stringProp = '🙌';
91
- * objectProp?: { nestedStringProp: string };
92
-
93
- * \@wire(Adapter, { num: 123 }) validNumberValue?: unknown;
94
- * \@wire(Adapter, { num: "$numberProp" }) validNumberProp?: unknown;
95
- * \@wire(Adapter, { num: "bad value" }) invalidNumberValue?: unknown;
96
- * \@wire(Adapter, { num: "$stringProp" }) invalidNumberProp?: unknown;
97
- *
98
- * \@wire(Adapter, { str: "valid string", num: 0 }) validStringValue?: unknown;
99
- * \@wire(Adapter, { str: "$stringProp", num: 0 }) validStringProp?: unknown;
100
-
101
- * // `"$numberProp"` is a string, and therefore satisfies the type,
102
- * // despite resolving to a number at runtime
103
- * \@wire(Adapter, { str: "$numberProp", num: 0 }) falseNegativeString?: unknown;
104
- *
105
- * // Nested props aren't checked to avoid crashing on recursive types
106
- * \@wire(Adapter, { num: "$objectProp.nestedStringProp" }) falseNegativeNested?: unknown;
107
- *
108
- * // Any value can have properties accessed at runtime, but property chains using
109
- * // non-objects are uncommon, and are excluded for simplicity
110
- * \@wire(Adapter, { num: "$stringProp.length" }) falsePositiveString?: unknown;
111
- *
112
- * // Using props inherited from `LightningElement` for property chains is uncommon,
113
- * // and are excluded for simplicity
114
- * \@wire(Adapter, { num: "$hostElement.childElementCount" }) falsePositiveLightningElement?: unknown;
115
- *
116
- * get propertyChainWorkaround(): string {
117
- * return this.objectProp.nestedStringProp;
118
- * }
119
- *
120
- * // Top-level prop is type checked and correctly reports an error
121
- * \@wire(Adapter, { num: "$propertyChainWorkaround" }) truePositiveGetter?: unknown;
122
- *
123
- * // Type assertion is used and correctly reports an error
124
- * \@wire(Adapter, {
125
- * num: "$objectProp.nestedStringProp" as unknown as Component["objectProp"]["nestedStringProp"]
126
- * }) truePositiveTypeAssertion?: unknown;
127
- * }
128
- */
129
- export type ConfigWithReactiveProps<Config extends ConfigValue, Class> = {
130
- [K in keyof Config]: Config[K] | `$${PropsOfType<Class, Config[K]>}` | `$${ChainableObjectProps<Class>}.${string}`;
63
+ type ResolveValueIfReactive<Value, Target> = Value extends string ? string extends Value ? any : Value extends `$${infer Keys}` ? ResolveReactiveValue<Target, Keys> : Value : Value;
64
+ export type ReplaceReactiveValues<Config extends ConfigValue, Component> = {
65
+ [K in keyof Config]: ResolveValueIfReactive<Config[K], Component>;
131
66
  };
132
67
  export {};
133
68
  //# sourceMappingURL=types.d.ts.map
@@ -2455,7 +2455,10 @@ function api$1(
2455
2455
  value,
2456
2456
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2457
2457
  context) {
2458
- shared.assert.fail(`@api decorator can only be used as a decorator function.`);
2458
+ if (process.env.NODE_ENV !== 'production') {
2459
+ shared.assert.fail(`@api decorator can only be used as a decorator function.`);
2460
+ }
2461
+ throw new Error();
2459
2462
  }
2460
2463
  function createPublicPropertyDescriptor(key) {
2461
2464
  return {
@@ -2535,7 +2538,10 @@ context) {
2535
2538
  if (arguments.length === 1) {
2536
2539
  return getReactiveProxy(target);
2537
2540
  }
2538
- shared.assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2541
+ if (process.env.NODE_ENV !== 'production') {
2542
+ shared.assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2543
+ }
2544
+ throw new Error();
2539
2545
  }
2540
2546
  function internalTrackDecorator(key) {
2541
2547
  return {
@@ -2575,10 +2581,6 @@ function internalTrackDecorator(key) {
2575
2581
  */
2576
2582
  /**
2577
2583
  * Decorator factory to wire a property or method to a wire adapter data source.
2578
- *
2579
- * TypeScript users: Due to limitations of the type system, some edge cases are
2580
- * not fully type checked. See the type definition for {@linkcode ConfigWithReactiveProps}
2581
- * for details.
2582
2584
  * @param adapter the adapter used to provision data
2583
2585
  * @param config configuration object for the adapter
2584
2586
  * @returns A decorator function
@@ -2593,7 +2595,10 @@ function wire(
2593
2595
  adapter,
2594
2596
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2595
2597
  config) {
2596
- shared.assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2598
+ if (process.env.NODE_ENV !== 'production') {
2599
+ shared.assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2600
+ }
2601
+ throw new Error();
2597
2602
  }
2598
2603
  function internalWireFieldDecorator(key) {
2599
2604
  return {
@@ -2639,7 +2644,7 @@ function validateObservedField(Ctor, fieldName, descriptor) {
2639
2644
  if (!shared.isUndefined(descriptor)) {
2640
2645
  const type = getClassDescriptorType(descriptor);
2641
2646
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2642
- // TODO [#4450]: this should throw, not log
2647
+ // TODO [#3408]: this should throw, not log
2643
2648
  logError(message);
2644
2649
  }
2645
2650
  }
@@ -2647,7 +2652,7 @@ function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2647
2652
  assertNotProd(); // this method should never leak to prod
2648
2653
  if (!shared.isUndefined(descriptor)) {
2649
2654
  const type = getClassDescriptorType(descriptor);
2650
- // TODO [#4450]: this should throw, not log
2655
+ // TODO [#3408]: this should throw, not log
2651
2656
  logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2652
2657
  }
2653
2658
  }
@@ -2655,14 +2660,14 @@ function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2655
2660
  assertNotProd(); // this method should never leak to prod
2656
2661
  if (!shared.isUndefined(descriptor)) {
2657
2662
  const type = getClassDescriptorType(descriptor);
2658
- // TODO [#4450]: this should throw, not log
2663
+ // TODO [#3408]: this should throw, not log
2659
2664
  logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2660
2665
  }
2661
2666
  }
2662
2667
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2663
2668
  assertNotProd(); // this method should never leak to prod
2664
2669
  if (shared.isUndefined(descriptor) || !shared.isFunction(descriptor.value) || shared.isFalse(descriptor.writable)) {
2665
- // TODO [#4450]: This line of code does not seem possible to reach.
2670
+ // TODO [#3441]: This line of code does not seem possible to reach.
2666
2671
  logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2667
2672
  }
2668
2673
  }
@@ -2671,7 +2676,7 @@ function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2671
2676
  if (!shared.isUndefined(descriptor)) {
2672
2677
  const type = getClassDescriptorType(descriptor);
2673
2678
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2674
- // TODO [#4450]: this should throw, not log
2679
+ // TODO [#3408]: this should throw, not log
2675
2680
  logError(message);
2676
2681
  }
2677
2682
  }
@@ -2679,7 +2684,7 @@ function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2679
2684
  assertNotProd(); // this method should never leak to prod
2680
2685
  if (shared.isFunction(descriptor.set)) {
2681
2686
  if (!shared.isFunction(descriptor.get)) {
2682
- // TODO [#4450]: This line of code does not seem possible to reach.
2687
+ // TODO [#3441]: This line of code does not seem possible to reach.
2683
2688
  logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2684
2689
  }
2685
2690
  }
@@ -2765,7 +2770,7 @@ function registerDecorators(Ctor, meta) {
2765
2770
  if (method === 1) {
2766
2771
  if (process.env.NODE_ENV !== 'production') {
2767
2772
  if (!adapter) {
2768
- // TODO [#4450]: this should throw, not log
2773
+ // TODO [#3408]: this should throw, not log
2769
2774
  logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2770
2775
  }
2771
2776
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
@@ -2779,7 +2784,7 @@ function registerDecorators(Ctor, meta) {
2779
2784
  else {
2780
2785
  if (process.env.NODE_ENV !== 'production') {
2781
2786
  if (!adapter) {
2782
- // TODO [#4450]: this should throw, not log
2787
+ // TODO [#3408]: this should throw, not log
2783
2788
  logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2784
2789
  }
2785
2790
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
@@ -5220,6 +5225,7 @@ function hasDynamicChildren(children) {
5220
5225
  }
5221
5226
  function createKeyToOldIdx(children, beginIdx, endIdx) {
5222
5227
  const map = {};
5228
+ // TODO [#1637]: simplify this by assuming that all vnodes has keys
5223
5229
  for (let j = beginIdx; j <= endIdx; ++j) {
5224
5230
  const ch = children[j];
5225
5231
  if (isVNode(ch)) {
@@ -5641,19 +5647,20 @@ function c(sel, Ctor, data, children = EmptyArray) {
5641
5647
  }
5642
5648
  }
5643
5649
  const { key, slotAssignment } = data;
5650
+ let elm, aChildren, vm;
5644
5651
  const vnode = {
5645
5652
  type: 3 /* VNodeType.CustomElement */,
5646
5653
  sel,
5647
5654
  data,
5648
5655
  children,
5649
- elm: undefined,
5656
+ elm,
5650
5657
  key,
5651
5658
  slotAssignment,
5652
5659
  ctor: Ctor,
5653
5660
  owner: vmBeingRendered,
5654
5661
  mode: 'open', // TODO [#1294]: this should be defined in Ctor
5655
- aChildren: undefined,
5656
- vm: undefined,
5662
+ aChildren,
5663
+ vm,
5657
5664
  };
5658
5665
  addVNodeToChildLWC(vnode);
5659
5666
  return vnode;
@@ -5755,23 +5762,25 @@ function f(items) {
5755
5762
  }
5756
5763
  // [t]ext node
5757
5764
  function t(text) {
5765
+ let key, elm;
5758
5766
  return {
5759
5767
  type: 0 /* VNodeType.Text */,
5760
5768
  sel: '__text__',
5761
5769
  text,
5762
- elm: undefined,
5763
- key: undefined,
5770
+ elm,
5771
+ key,
5764
5772
  owner: getVMBeingRendered(),
5765
5773
  };
5766
5774
  }
5767
5775
  // [co]mment node
5768
5776
  function co(text) {
5777
+ let elm, key;
5769
5778
  return {
5770
5779
  type: 1 /* VNodeType.Comment */,
5771
5780
  sel: '__comment__',
5772
5781
  text,
5773
- elm: undefined,
5774
- key: undefined,
5782
+ elm,
5783
+ key,
5775
5784
  owner: getVMBeingRendered(),
5776
5785
  };
5777
5786
  }
@@ -8819,5 +8828,5 @@ exports.swapTemplate = swapTemplate;
8819
8828
  exports.track = track;
8820
8829
  exports.unwrap = unwrap;
8821
8830
  exports.wire = wire;
8822
- /** version: 9.0.4-alpha.0 */
8823
- //# sourceMappingURL=index.cjs.map
8831
+ /** version: 9.0.4-alpha.2 */
8832
+ //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -2452,7 +2452,10 @@ function api$1(
2452
2452
  value,
2453
2453
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2454
2454
  context) {
2455
- assert.fail(`@api decorator can only be used as a decorator function.`);
2455
+ if (process.env.NODE_ENV !== 'production') {
2456
+ assert.fail(`@api decorator can only be used as a decorator function.`);
2457
+ }
2458
+ throw new Error();
2456
2459
  }
2457
2460
  function createPublicPropertyDescriptor(key) {
2458
2461
  return {
@@ -2532,7 +2535,10 @@ context) {
2532
2535
  if (arguments.length === 1) {
2533
2536
  return getReactiveProxy(target);
2534
2537
  }
2535
- assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2538
+ if (process.env.NODE_ENV !== 'production') {
2539
+ assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
2540
+ }
2541
+ throw new Error();
2536
2542
  }
2537
2543
  function internalTrackDecorator(key) {
2538
2544
  return {
@@ -2572,10 +2578,6 @@ function internalTrackDecorator(key) {
2572
2578
  */
2573
2579
  /**
2574
2580
  * Decorator factory to wire a property or method to a wire adapter data source.
2575
- *
2576
- * TypeScript users: Due to limitations of the type system, some edge cases are
2577
- * not fully type checked. See the type definition for {@linkcode ConfigWithReactiveProps}
2578
- * for details.
2579
2581
  * @param adapter the adapter used to provision data
2580
2582
  * @param config configuration object for the adapter
2581
2583
  * @returns A decorator function
@@ -2590,7 +2592,10 @@ function wire(
2590
2592
  adapter,
2591
2593
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2592
2594
  config) {
2593
- assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2595
+ if (process.env.NODE_ENV !== 'production') {
2596
+ assert.fail('@wire(adapter, config?) may only be used as a decorator.');
2597
+ }
2598
+ throw new Error();
2594
2599
  }
2595
2600
  function internalWireFieldDecorator(key) {
2596
2601
  return {
@@ -2636,7 +2641,7 @@ function validateObservedField(Ctor, fieldName, descriptor) {
2636
2641
  if (!isUndefined$1(descriptor)) {
2637
2642
  const type = getClassDescriptorType(descriptor);
2638
2643
  const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`;
2639
- // TODO [#4450]: this should throw, not log
2644
+ // TODO [#3408]: this should throw, not log
2640
2645
  logError(message);
2641
2646
  }
2642
2647
  }
@@ -2644,7 +2649,7 @@ function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
2644
2649
  assertNotProd(); // this method should never leak to prod
2645
2650
  if (!isUndefined$1(descriptor)) {
2646
2651
  const type = getClassDescriptorType(descriptor);
2647
- // TODO [#4450]: this should throw, not log
2652
+ // TODO [#3408]: this should throw, not log
2648
2653
  logError(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);
2649
2654
  }
2650
2655
  }
@@ -2652,14 +2657,14 @@ function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
2652
2657
  assertNotProd(); // this method should never leak to prod
2653
2658
  if (!isUndefined$1(descriptor)) {
2654
2659
  const type = getClassDescriptorType(descriptor);
2655
- // TODO [#4450]: this should throw, not log
2660
+ // TODO [#3408]: this should throw, not log
2656
2661
  logError(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);
2657
2662
  }
2658
2663
  }
2659
2664
  function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
2660
2665
  assertNotProd(); // this method should never leak to prod
2661
2666
  if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
2662
- // TODO [#4450]: This line of code does not seem possible to reach.
2667
+ // TODO [#3441]: This line of code does not seem possible to reach.
2663
2668
  logError(`Invalid @wire ${methodName} field. The field should have a valid writable descriptor.`);
2664
2669
  }
2665
2670
  }
@@ -2668,7 +2673,7 @@ function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
2668
2673
  if (!isUndefined$1(descriptor)) {
2669
2674
  const type = getClassDescriptorType(descriptor);
2670
2675
  const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`;
2671
- // TODO [#4450]: this should throw, not log
2676
+ // TODO [#3408]: this should throw, not log
2672
2677
  logError(message);
2673
2678
  }
2674
2679
  }
@@ -2676,7 +2681,7 @@ function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
2676
2681
  assertNotProd(); // this method should never leak to prod
2677
2682
  if (isFunction$1(descriptor.set)) {
2678
2683
  if (!isFunction$1(descriptor.get)) {
2679
- // TODO [#4450]: This line of code does not seem possible to reach.
2684
+ // TODO [#3441]: This line of code does not seem possible to reach.
2680
2685
  logError(`Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);
2681
2686
  }
2682
2687
  }
@@ -2762,7 +2767,7 @@ function registerDecorators(Ctor, meta) {
2762
2767
  if (method === 1) {
2763
2768
  if (process.env.NODE_ENV !== 'production') {
2764
2769
  if (!adapter) {
2765
- // TODO [#4450]: this should throw, not log
2770
+ // TODO [#3408]: this should throw, not log
2766
2771
  logError(`@wire on method "${fieldOrMethodName}": adapter id must be truthy.`);
2767
2772
  }
2768
2773
  validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
@@ -2776,7 +2781,7 @@ function registerDecorators(Ctor, meta) {
2776
2781
  else {
2777
2782
  if (process.env.NODE_ENV !== 'production') {
2778
2783
  if (!adapter) {
2779
- // TODO [#4450]: this should throw, not log
2784
+ // TODO [#3408]: this should throw, not log
2780
2785
  logError(`@wire on field "${fieldOrMethodName}": adapter id must be truthy.`);
2781
2786
  }
2782
2787
  validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
@@ -5217,6 +5222,7 @@ function hasDynamicChildren(children) {
5217
5222
  }
5218
5223
  function createKeyToOldIdx(children, beginIdx, endIdx) {
5219
5224
  const map = {};
5225
+ // TODO [#1637]: simplify this by assuming that all vnodes has keys
5220
5226
  for (let j = beginIdx; j <= endIdx; ++j) {
5221
5227
  const ch = children[j];
5222
5228
  if (isVNode(ch)) {
@@ -5638,19 +5644,20 @@ function c(sel, Ctor, data, children = EmptyArray) {
5638
5644
  }
5639
5645
  }
5640
5646
  const { key, slotAssignment } = data;
5647
+ let elm, aChildren, vm;
5641
5648
  const vnode = {
5642
5649
  type: 3 /* VNodeType.CustomElement */,
5643
5650
  sel,
5644
5651
  data,
5645
5652
  children,
5646
- elm: undefined,
5653
+ elm,
5647
5654
  key,
5648
5655
  slotAssignment,
5649
5656
  ctor: Ctor,
5650
5657
  owner: vmBeingRendered,
5651
5658
  mode: 'open', // TODO [#1294]: this should be defined in Ctor
5652
- aChildren: undefined,
5653
- vm: undefined,
5659
+ aChildren,
5660
+ vm,
5654
5661
  };
5655
5662
  addVNodeToChildLWC(vnode);
5656
5663
  return vnode;
@@ -5752,23 +5759,25 @@ function f(items) {
5752
5759
  }
5753
5760
  // [t]ext node
5754
5761
  function t(text) {
5762
+ let key, elm;
5755
5763
  return {
5756
5764
  type: 0 /* VNodeType.Text */,
5757
5765
  sel: '__text__',
5758
5766
  text,
5759
- elm: undefined,
5760
- key: undefined,
5767
+ elm,
5768
+ key,
5761
5769
  owner: getVMBeingRendered(),
5762
5770
  };
5763
5771
  }
5764
5772
  // [co]mment node
5765
5773
  function co(text) {
5774
+ let elm, key;
5766
5775
  return {
5767
5776
  type: 1 /* VNodeType.Comment */,
5768
5777
  sel: '__comment__',
5769
5778
  text,
5770
- elm: undefined,
5771
- key: undefined,
5779
+ elm,
5780
+ key,
5772
5781
  owner: getVMBeingRendered(),
5773
5782
  };
5774
5783
  }
@@ -8745,5 +8754,5 @@ function readonly(obj) {
8745
8754
  }
8746
8755
 
8747
8756
  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 };
8748
- /** version: 9.0.4-alpha.0 */
8757
+ /** version: 9.0.4-alpha.2 */
8749
8758
  //# 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": "9.0.4-alpha.0",
7
+ "version": "9.0.4-alpha.2",
8
8
  "description": "Core LWC engine APIs.",
9
9
  "keywords": [
10
10
  "lwc"
@@ -19,22 +19,17 @@
19
19
  "url": "https://github.com/salesforce/lwc/issues"
20
20
  },
21
21
  "license": "MIT",
22
- "type": "module",
23
22
  "publishConfig": {
24
23
  "access": "public"
25
24
  },
26
- "engines": {
27
- "node": ">=16.6.0"
28
- },
29
25
  "volta": {
30
26
  "extends": "../../../package.json"
31
27
  },
32
- "main": "dist/index.js",
28
+ "main": "dist/index.cjs.js",
33
29
  "module": "dist/index.js",
34
30
  "types": "dist/index.d.ts",
35
31
  "files": [
36
32
  "dist/**/*.js",
37
- "dist/**/*.cjs",
38
33
  "dist/**/*.d.ts"
39
34
  ],
40
35
  "scripts": {
@@ -51,9 +46,9 @@
51
46
  }
52
47
  },
53
48
  "dependencies": {
54
- "@lwc/features": "9.0.4-alpha.0",
55
- "@lwc/shared": "9.0.4-alpha.0",
56
- "@lwc/signals": "9.0.4-alpha.0"
49
+ "@lwc/features": "9.0.4-alpha.2",
50
+ "@lwc/shared": "9.0.4-alpha.2",
51
+ "@lwc/signals": "9.0.4-alpha.2"
57
52
  },
58
53
  "devDependencies": {
59
54
  "observable-membrane": "2.0.0"