@wix/zero-config-implementation 1.70.0 → 1.71.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.
@@ -7352,7 +7352,7 @@ function ane() {
7352
7352
  return Promise.resolve();
7353
7353
  if (!p)
7354
7354
  return Promise.reject({ error: "unable to copy null value" });
7355
- (await import("./index-D_XmjZkE.js").then((E) => E.i)).default(p);
7355
+ (await import("./index-DT1jTZEG.js").then((E) => E.i)).default(p);
7356
7356
  };
7357
7357
  function u(p, y, E) {
7358
7358
  if (typeof p !== E)
@@ -41292,7 +41292,9 @@ const RLe = (t) => t.declarations && t.declarations.length > 0 ? !t.declarations
41292
41292
  }) : !0, LLe = {
41293
41293
  shouldRemoveUndefinedFromOptional: !0,
41294
41294
  shouldIncludePropTagMap: !0,
41295
- skipChildrenPropWithoutDoc: !0,
41295
+ // historically `children` were skipped as in older versions of React they ALWAYS were present in props
41296
+ // as we using newer React versions, we don't need to skip them
41297
+ skipChildrenPropWithoutDoc: !1,
41296
41298
  propFilter: RLe,
41297
41299
  // react-docgen-typescript resolves `commentSource` for known wrapper types (MemoExoticComponent,
41298
41300
  // ForwardRefExoticComponent, etc.) but not for NamedExoticComponent — the base type that
@@ -1,4 +1,4 @@
1
- import { g as x } from "./index-DnxDZx90.js";
1
+ import { g as x } from "./index-C4cP1dwy.js";
2
2
  function h(r, a) {
3
3
  for (var i = 0; i < a.length; i++) {
4
4
  const o = a[i];
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as t, D as e, E as o, I as n, N as c, P as l, R as i, a as p, V as E, b as m, c as x, d as f, e as d, f as u, h as C, i as I, j as k, k as y, l as A, m as D, n as P, o as R, p as h, q as B, r as M, s as T, t as b, w } from "./index-DnxDZx90.js";
1
+ import { B as t, D as e, E as o, I as n, N as c, P as l, R as i, a as p, V as E, b as m, c as x, d as f, e as d, f as u, h as C, i as I, j as k, k as y, l as A, m as D, n as P, o as R, p as h, q as B, r as M, s as T, t as b, w } from "./index-C4cP1dwy.js";
2
2
  import "react";
3
3
  export {
4
4
  t as BaseError,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.70.0",
7
+ "version": "1.71.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  }
83
83
  },
84
- "falconPackageHash": "f7f9d07ab6659b53c4a239fd98c2c3f0e24345cb528a5f5108c7e6ba"
84
+ "falconPackageHash": "d6c8e03493b96fe9947b6b075e997e8ba6e5fea0f79a417f6e26c201"
85
85
  }
@@ -78,3 +78,36 @@ describe('buildDataItem — arrayItems oneof branching', () => {
78
78
  expect(arrayItems?.dataItem).toBeUndefined()
79
79
  })
80
80
  })
81
+
82
+ describe('buildDataItem — container dataType', () => {
83
+ const buildProp = (name: string, type: string, resolvedType: ResolvedType): PropInfo => ({
84
+ name,
85
+ type,
86
+ required: false,
87
+ resolvedType,
88
+ })
89
+
90
+ it('maps a React `ReactNode` semantic type to dataType container', () => {
91
+ const result = buildDataItem(
92
+ buildProp('content', 'ReactNode', { kind: 'semantic', value: 'ReactNode', source: '@types/react' }),
93
+ )
94
+ expect(result.isOk()).toBe(true)
95
+ expect(result._unsafeUnwrap().dataType).toBe('container')
96
+ })
97
+
98
+ it('maps a React `ReactElement` semantic type to dataType container', () => {
99
+ const result = buildDataItem(
100
+ buildProp('icon', 'ReactElement', { kind: 'semantic', value: 'ReactElement', source: 'react' }),
101
+ )
102
+ expect(result.isOk()).toBe(true)
103
+ expect(result._unsafeUnwrap().dataType).toBe('container')
104
+ })
105
+
106
+ it('maps a Wix `Container` semantic type to dataType container', () => {
107
+ const result = buildDataItem(
108
+ buildProp('children', 'Container', { kind: 'semantic', value: 'Container', source: '@wix/editor-react-types' }),
109
+ )
110
+ expect(result.isOk()).toBe(true)
111
+ expect(result._unsafeUnwrap().dataType).toBe('container')
112
+ })
113
+ })
@@ -8,6 +8,16 @@ const propTriggeredFixture = path.resolve(
8
8
  '../../../../example-components/src/components/DesignStates/Custom/PropTriggered/WithMatchingClass/component.tsx',
9
9
  )
10
10
 
11
+ const childrenContainerFixture = path.resolve(
12
+ __dirname,
13
+ '../../../../example-components/src/components/ChildrenContainer/component.tsx',
14
+ )
15
+
16
+ const inheritedChildrenFixture = path.resolve(
17
+ __dirname,
18
+ '../../../../example-components/src/components/InheritedChildren/component.tsx',
19
+ )
20
+
11
21
  describe('TS extractor — ElementState<> trigger detection', () => {
12
22
  it('flags an ElementState<>-wrapped prop and unwraps its inner type', async () => {
13
23
  const programResult = await compileTsFile(propTriggeredFixture)
@@ -27,3 +37,45 @@ describe('TS extractor — ElementState<> trigger detection', () => {
27
37
  expect(component!.props.showLabel.isStateTrigger).toBeUndefined()
28
38
  })
29
39
  })
40
+
41
+ describe('TS extractor — container children props', () => {
42
+ const containerSemanticType = {
43
+ kind: 'semantic',
44
+ value: 'Container',
45
+ source: '@wix/editor-react-types',
46
+ }
47
+
48
+ it('keeps an undocumented `children: Container` prop and resolves it as a container', async () => {
49
+ const programResult = await compileTsFile(childrenContainerFixture)
50
+ expect(programResult.isOk()).toBe(true)
51
+ const program = programResult._unsafeUnwrap()
52
+
53
+ const components = extractAllComponentInfo(program, childrenContainerFixture)
54
+ const component = components.find((candidate) => candidate.componentName === 'ChildrenContainer')
55
+ expect(component).toBeDefined()
56
+
57
+ // `children` survives even without a JSDoc comment (skipChildrenPropWithoutDoc: false)
58
+ // and resolves to the Wix `Container` semantic type.
59
+ const childrenProp = component!.props.children
60
+ expect(childrenProp).toBeDefined()
61
+ expect(childrenProp.resolvedType).toEqual(containerSemanticType)
62
+
63
+ // A named container prop resolves the same way.
64
+ expect(component!.props.content?.resolvedType).toEqual(containerSemanticType)
65
+ })
66
+
67
+ it('still drops React-implicit `children` from PropsWithChildren (React 17 FC proxy)', async () => {
68
+ const programResult = await compileTsFile(inheritedChildrenFixture)
69
+ expect(programResult.isOk()).toBe(true)
70
+ const program = programResult._unsafeUnwrap()
71
+
72
+ const components = extractAllComponentInfo(program, inheritedChildrenFixture)
73
+ const component = components.find((candidate) => candidate.componentName === 'InheritedChildren')
74
+ expect(component).toBeDefined()
75
+
76
+ // The `children` member comes from `@types/react` (PropsWithChildren), so sharedPropFilter
77
+ // removes it — no spurious container slot. This mirrors React 17's implicit FC children.
78
+ expect(component!.props.children).toBeUndefined()
79
+ expect(component!.props.label).toBeDefined()
80
+ })
81
+ })
@@ -23,7 +23,9 @@ const sharedPropFilter = (prop: PropItem) => {
23
23
  const sharedParserOptions = {
24
24
  shouldRemoveUndefinedFromOptional: true,
25
25
  shouldIncludePropTagMap: true,
26
- skipChildrenPropWithoutDoc: true,
26
+ // historically `children` were skipped as in older versions of React they ALWAYS were present in props
27
+ // as we using newer React versions, we don't need to skip them
28
+ skipChildrenPropWithoutDoc: false,
27
29
  propFilter: sharedPropFilter,
28
30
  // react-docgen-typescript resolves `commentSource` for known wrapper types (MemoExoticComponent,
29
31
  // ForwardRefExoticComponent, etc.) but not for NamedExoticComponent — the base type that