@knapsack/renderer-react 4.72.0--canary.4920.be98a9b.0 → 4.72.0--canary.5313.51b7b5f.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/CHANGELOG.md +217 -0
- package/ava.config.cjs +7 -1
- package/dist/analyze/infer-spec.test.d.ts +2 -0
- package/dist/analyze/infer-spec.test.d.ts.map +1 -0
- package/dist/analyze/infer-spec.test.js +112 -0
- package/dist/analyze/infer-spec.test.js.map +1 -0
- package/dist/analyze/mui.test.d.ts +2 -0
- package/dist/analyze/mui.test.d.ts.map +1 -0
- package/dist/analyze/mui.test.js +60 -0
- package/dist/analyze/mui.test.js.map +1 -0
- package/dist/analyze/pkg-basic.test.d.ts +2 -0
- package/dist/analyze/pkg-basic.test.d.ts.map +1 -0
- package/dist/analyze/pkg-basic.test.js +33 -0
- package/dist/analyze/pkg-basic.test.js.map +1 -0
- package/dist/analyze/pkg-diff-types.test.d.ts +2 -0
- package/dist/analyze/pkg-diff-types.test.d.ts.map +1 -0
- package/dist/analyze/pkg-diff-types.test.js +43 -0
- package/dist/analyze/pkg-diff-types.test.js.map +1 -0
- package/dist/client/init.d.mts +2 -2
- package/dist/client/init.d.mts.map +1 -0
- package/dist/client/init.mjs +38 -10
- package/dist/client/init.mjs.map +1 -1
- package/dist/index.d.ts +3 -45
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -52
- package/dist/index.js.map +1 -1
- package/dist/react-creators.d.ts +20 -0
- package/dist/react-creators.d.ts.map +1 -0
- package/dist/react-creators.js +170 -0
- package/dist/react-creators.js.map +1 -0
- package/dist/{index.d.mts → renderer-react.d.ts} +2 -5
- package/dist/renderer-react.d.ts.map +1 -0
- package/dist/renderer-react.js +569 -0
- package/dist/renderer-react.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +500 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.test.d.ts +2 -0
- package/dist/utils.test.d.ts.map +1 -0
- package/dist/utils.test.js +59 -0
- package/dist/utils.test.js.map +1 -0
- package/package.json +27 -31
- package/prototype-template.d.mts +3 -0
- package/prototype-template.mjs +3 -0
- package/test-fixtures/pkg-diff-types/button.js +10 -0
- package/test-fixtures/pkg-diff-types/package.json +4 -0
- package/test-fixtures/pkg-diff-types/readme.md +1 -0
- package/test-fixtures/pkg-diff-types/types/button.d.ts +5 -0
- package/tsconfig.json +3 -2
- package/dist/client/init.d.ts +0 -2
- package/dist/client/init.js +0 -20
- package/dist/client/init.js.map +0 -1
- package/dist/demo-wrapper.d.mts +0 -7
- package/dist/demo-wrapper.d.ts +0 -7
- package/dist/demo-wrapper.js +0 -9
- package/dist/demo-wrapper.js.map +0 -1
- package/dist/demo-wrapper.mjs +0 -7
- package/dist/demo-wrapper.mjs.map +0 -1
- package/dist/error-catcher.d.mts +0 -20
- package/dist/error-catcher.d.ts +0 -20
- package/dist/error-catcher.js +0 -30
- package/dist/error-catcher.js.map +0 -1
- package/dist/error-catcher.mjs +0 -8
- package/dist/error-catcher.mjs.map +0 -1
- package/dist/index.mjs +0 -47
- package/dist/index.mjs.map +0 -1
- package/dist/prototype-template.d.mts +0 -7
- package/dist/prototype-template.d.ts +0 -7
- package/dist/prototype-template.js +0 -7
- package/dist/prototype-template.js.map +0 -1
- package/dist/prototype-template.mjs +0 -5
- package/dist/prototype-template.mjs.map +0 -1
- package/dist/types-CivTHEEo.d.mts +0 -10
- package/dist/types-CivTHEEo.d.ts +0 -10
- package/tsup.config.cjs +0 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,220 @@
|
|
1
|
+
# v4.71.16 (Thu Dec 05 2024)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- refactor React Renderer to use `tsc` for build [#5224](https://github.com/knapsack-labs/app-monorepo/pull/5224) ([@EvanLovely](https://github.com/EvanLovely) [@mabry1985](https://github.com/mabry1985))
|
6
|
+
- cleanup ([@EvanLovely](https://github.com/EvanLovely))
|
7
|
+
- remove concurrency in CI change ([@EvanLovely](https://github.com/EvanLovely))
|
8
|
+
- remove memory bump ([@EvanLovely](https://github.com/EvanLovely))
|
9
|
+
- set MUI Button test to failing ([@EvanLovely](https://github.com/EvanLovely))
|
10
|
+
- do not mutate arrays ([@EvanLovely](https://github.com/EvanLovely))
|
11
|
+
- Remove use of __dirname ([@EvanLovely](https://github.com/EvanLovely))
|
12
|
+
- bump memory for CI test run ([@EvanLovely](https://github.com/EvanLovely))
|
13
|
+
- restore use of tsconfig ([@EvanLovely](https://github.com/EvanLovely))
|
14
|
+
- serial test run ([@EvanLovely](https://github.com/EvanLovely))
|
15
|
+
- temp disabling possibility of using custom config to help troubleshoot CI issue ([@EvanLovely](https://github.com/EvanLovely))
|
16
|
+
- skip cache during ava tests ([@EvanLovely](https://github.com/EvanLovely))
|
17
|
+
- pass MUI pkg name directly in ([@EvanLovely](https://github.com/EvanLovely))
|
18
|
+
- re-enable MUI test ([@EvanLovely](https://github.com/EvanLovely))
|
19
|
+
- Merge branch 'latest' into feature/react-renderer-build ([@EvanLovely](https://github.com/EvanLovely))
|
20
|
+
- Merge branch 'latest' into feature/react-renderer-build ([@mabry1985](https://github.com/mabry1985))
|
21
|
+
- undo skipping of utils test ([@mabry1985](https://github.com/mabry1985))
|
22
|
+
- skip both mui tests ([@mabry1985](https://github.com/mabry1985))
|
23
|
+
- skip mui test ([@mabry1985](https://github.com/mabry1985))
|
24
|
+
- revert to run all suites ([@mabry1985](https://github.com/mabry1985))
|
25
|
+
- remove utils test for debugging ([@mabry1985](https://github.com/mabry1985))
|
26
|
+
- revert to run tests individually ([@mabry1985](https://github.com/mabry1985))
|
27
|
+
- remove skip ([@mabry1985](https://github.com/mabry1985))
|
28
|
+
- check prop types test for bug ([@mabry1985](https://github.com/mabry1985))
|
29
|
+
- revert to failing ([@mabry1985](https://github.com/mabry1985))
|
30
|
+
- revert to run all tests ([@mabry1985](https://github.com/mabry1985))
|
31
|
+
- skip test using jsx-runtime ([@mabry1985](https://github.com/mabry1985))
|
32
|
+
- add getReactDocs import to testing ([@mabry1985](https://github.com/mabry1985))
|
33
|
+
- add minimal testing file ([@mabry1985](https://github.com/mabry1985))
|
34
|
+
- revert debugging ([@mabry1985](https://github.com/mabry1985))
|
35
|
+
- skip all suites for testing ([@mabry1985](https://github.com/mabry1985))
|
36
|
+
- remove garbage cleanup step ([@mabry1985](https://github.com/mabry1985))
|
37
|
+
- update to use config ([@mabry1985](https://github.com/mabry1985))
|
38
|
+
- update to use serial ([@mabry1985](https://github.com/mabry1985))
|
39
|
+
- add cleanup steps ([@mabry1985](https://github.com/mabry1985))
|
40
|
+
- add concurrency limit to ava test ([@mabry1985](https://github.com/mabry1985))
|
41
|
+
- re-order scripts ([@mabry1985](https://github.com/mabry1985))
|
42
|
+
- revert to individual tests ([@mabry1985](https://github.com/mabry1985))
|
43
|
+
- try garbage cleanup ([@mabry1985](https://github.com/mabry1985))
|
44
|
+
- update to run in serial ([@mabry1985](https://github.com/mabry1985))
|
45
|
+
- revert test script ([@mabry1985](https://github.com/mabry1985))
|
46
|
+
- fix default demo wrapper path resolution ([@EvanLovely](https://github.com/EvanLovely))
|
47
|
+
- break tests up to debug CI ([@EvanLovely](https://github.com/EvanLovely))
|
48
|
+
- set unit tests to run serially to prevent segmentation fault in CI ([@EvanLovely](https://github.com/EvanLovely))
|
49
|
+
- add sideEffects ([@EvanLovely](https://github.com/EvanLovely))
|
50
|
+
- cleanup file ([@EvanLovely](https://github.com/EvanLovely))
|
51
|
+
- adjust line command ([@EvanLovely](https://github.com/EvanLovely))
|
52
|
+
- refactor React Renderer to use `tsc` for build ([@EvanLovely](https://github.com/EvanLovely))
|
53
|
+
|
54
|
+
#### Authors: 2
|
55
|
+
|
56
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
57
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
58
|
+
|
59
|
+
---
|
60
|
+
|
61
|
+
# v4.71.13 (Wed Dec 04 2024)
|
62
|
+
|
63
|
+
#### 🐛 Bug Fix
|
64
|
+
|
65
|
+
- Merge branch 'feature/ksp-5777-gsk-sso-issues' into feature/sso-config-via-db ([@EvanLovely](https://github.com/EvanLovely))
|
66
|
+
- Merge branch 'latest' into feature/ksp-5777-gsk-sso-issues ([@illepic](https://github.com/illepic))
|
67
|
+
- Bump version to: v4.71.12 \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
|
68
|
+
- Update CHANGELOG.md \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
|
69
|
+
- Bump version to: v4.71.11 \[skip ci\] ([@KnapsackBot](https://github.com/KnapsackBot))
|
70
|
+
|
71
|
+
#### 🏠 Internal
|
72
|
+
|
73
|
+
- refactor Cypress user login [#5225](https://github.com/knapsack-labs/app-monorepo/pull/5225) ([@EvanLovely](https://github.com/EvanLovely))
|
74
|
+
- Update Node.js to v20.18.1 [#5197](https://github.com/knapsack-labs/app-monorepo/pull/5197) ([@renovate[bot]](https://github.com/renovate[bot]))
|
75
|
+
- adds evt handlers for design src logs [#5194](https://github.com/knapsack-labs/app-monorepo/pull/5194) ([@mabry1985](https://github.com/mabry1985))
|
76
|
+
- setup login w popup [#5209](https://github.com/knapsack-labs/app-monorepo/pull/5209) ([@GormanDesign](https://github.com/GormanDesign) [@mabry1985](https://github.com/mabry1985) [@EvanLovely](https://github.com/EvanLovely) [@KnapsackBot](https://github.com/KnapsackBot) [@illepic](https://github.com/illepic))
|
77
|
+
- migrate to new Figma oAuth endpoints and configuration [#5206](https://github.com/knapsack-labs/app-monorepo/pull/5206) ([@mabry1985](https://github.com/mabry1985))
|
78
|
+
|
79
|
+
#### Authors: 6
|
80
|
+
|
81
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
82
|
+
- Christopher Bloom ([@illepic](https://github.com/illepic))
|
83
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
84
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
85
|
+
- KnapsackBot ([@KnapsackBot](https://github.com/KnapsackBot))
|
86
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
87
|
+
|
88
|
+
---
|
89
|
+
|
90
|
+
# v4.71.12 (Thu Nov 21 2024)
|
91
|
+
|
92
|
+
#### 🐛 Bug Fix
|
93
|
+
|
94
|
+
- Fix component alignment in pattern stage and embeds [#5138](https://github.com/knapsack-labs/app-monorepo/pull/5138) ([@GormanDesign](https://github.com/GormanDesign))
|
95
|
+
- Merge branch 'latest' into feature/ksp-5732-fix-component-alignment-in-pattern-stage-and-embeds ([@GormanDesign](https://github.com/GormanDesign))
|
96
|
+
|
97
|
+
#### Authors: 1
|
98
|
+
|
99
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
100
|
+
|
101
|
+
---
|
102
|
+
|
103
|
+
# v4.71.10 (Thu Nov 21 2024)
|
104
|
+
|
105
|
+
#### 🐛 Bug Fix
|
106
|
+
|
107
|
+
- fix prop reordering doesnt stick [#5196](https://github.com/knapsack-labs/app-monorepo/pull/5196) ([@mabry1985](https://github.com/mabry1985))
|
108
|
+
|
109
|
+
#### Authors: 1
|
110
|
+
|
111
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
112
|
+
|
113
|
+
---
|
114
|
+
|
115
|
+
# v4.71.9 (Wed Nov 20 2024)
|
116
|
+
|
117
|
+
#### 🏠 Internal
|
118
|
+
|
119
|
+
- setup TS strict mode KSP-5492 [#5183](https://github.com/knapsack-labs/app-monorepo/pull/5183) ([@EvanLovely](https://github.com/EvanLovely))
|
120
|
+
|
121
|
+
#### Authors: 1
|
122
|
+
|
123
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
124
|
+
|
125
|
+
---
|
126
|
+
|
127
|
+
# v4.71.8 (Fri Nov 15 2024)
|
128
|
+
|
129
|
+
#### 🐛 Bug Fix
|
130
|
+
|
131
|
+
- Add button modes for sales demos [#5173](https://github.com/knapsack-labs/app-monorepo/pull/5173) ([@brittanysmart](https://github.com/brittanysmart))
|
132
|
+
- Merge branch 'latest' into feature/KSP-5764-add-button-modes ([@brittanysmart](https://github.com/brittanysmart))
|
133
|
+
- feat: add mode prop to Button infer spec test ([@brittanysmart](https://github.com/brittanysmart))
|
134
|
+
- Merge branch 'latest' into GormanDesign-patch-2 ([@GormanDesign](https://github.com/GormanDesign))
|
135
|
+
- Merge branch 'latest' into feature/ksp-5775-update-gsk-digital-channels-sso-page-content ([@GormanDesign](https://github.com/GormanDesign))
|
136
|
+
|
137
|
+
#### 🏠 Internal
|
138
|
+
|
139
|
+
- update gsk-digital-channels sso page content [#5178](https://github.com/knapsack-labs/app-monorepo/pull/5178) ([@GormanDesign](https://github.com/GormanDesign))
|
140
|
+
- fix figma tiles show processing message indefinitely [#5179](https://github.com/knapsack-labs/app-monorepo/pull/5179) ([@mabry1985](https://github.com/mabry1985))
|
141
|
+
|
142
|
+
#### Authors: 3
|
143
|
+
|
144
|
+
- Brittany Smart ([@brittanysmart](https://github.com/brittanysmart))
|
145
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
146
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
147
|
+
|
148
|
+
---
|
149
|
+
|
150
|
+
# v4.71.6 (Thu Nov 14 2024)
|
151
|
+
|
152
|
+
#### 🐛 Bug Fix
|
153
|
+
|
154
|
+
- update template alias suggestion logic [#5174](https://github.com/knapsack-labs/app-monorepo/pull/5174) ([@mabry1985](https://github.com/mabry1985))
|
155
|
+
- deduplicate suggestions in react renderer ([@mabry1985](https://github.com/mabry1985))
|
156
|
+
- remove sorting from individual renderer logic ([@mabry1985](https://github.com/mabry1985))
|
157
|
+
- handles sorting of used vs unused paths ([@mabry1985](https://github.com/mabry1985))
|
158
|
+
- Merge branch 'latest' into feature/ksp-5738-text-editor-block-has-stale-state ([@mabry1985](https://github.com/mabry1985))
|
159
|
+
- Merge branch 'latest' into feature/nuke-old-claims ([@illepic](https://github.com/illepic))
|
160
|
+
- Merge branch 'latest' into feature/ksp-5437-update-auth0-node-sdk ([@freneticpixel](https://github.com/freneticpixel))
|
161
|
+
- Merge branch 'latest' into feature/ksp-5710-collections-block-filters ([@GormanDesign](https://github.com/GormanDesign))
|
162
|
+
- Merge remote-tracking branch 'origin/latest' into feature/ksp-5437-update-auth0-node-sdk ([@freneticpixel](https://github.com/freneticpixel))
|
163
|
+
|
164
|
+
#### 🏠 Internal
|
165
|
+
|
166
|
+
- update text editor to handle external data changes [#5146](https://github.com/knapsack-labs/app-monorepo/pull/5146) ([@mabry1985](https://github.com/mabry1985))
|
167
|
+
- Remove vestigial claims routes and terrible auth [#5154](https://github.com/knapsack-labs/app-monorepo/pull/5154) ([@illepic](https://github.com/illepic))
|
168
|
+
- Update syncpack to current major version [#5159](https://github.com/knapsack-labs/app-monorepo/pull/5159) ([@greylabel](https://github.com/greylabel))
|
169
|
+
- Update babel [#5074](https://github.com/knapsack-labs/app-monorepo/pull/5074) ([@renovate[bot]](https://github.com/renovate[bot]))
|
170
|
+
- Update dependency @types/node to ^20.17.6 [#5127](https://github.com/knapsack-labs/app-monorepo/pull/5127) ([@renovate[bot]](https://github.com/renovate[bot]))
|
171
|
+
|
172
|
+
#### Authors: 6
|
173
|
+
|
174
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
175
|
+
- Christopher Bloom ([@illepic](https://github.com/illepic))
|
176
|
+
- Grant Gaudet ([@greylabel](https://github.com/greylabel))
|
177
|
+
- Jim Frenette ([@freneticpixel](https://github.com/freneticpixel))
|
178
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
179
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
180
|
+
|
181
|
+
---
|
182
|
+
|
183
|
+
# v4.71.5 (Tue Nov 05 2024)
|
184
|
+
|
185
|
+
#### 🐛 Bug Fix
|
186
|
+
|
187
|
+
- Merge branch 'latest' into feature/ksp-5668-handle-figma-blocks-when-updating-design-source-file ([@GormanDesign](https://github.com/GormanDesign))
|
188
|
+
|
189
|
+
#### 🏠 Internal
|
190
|
+
|
191
|
+
- Update Typescript [#5051](https://github.com/knapsack-labs/app-monorepo/pull/5051) ([@renovate[bot]](https://github.com/renovate[bot]))
|
192
|
+
- Update dependency @types/node to ^20.17.5 [#5086](https://github.com/knapsack-labs/app-monorepo/pull/5086) ([@renovate[bot]](https://github.com/renovate[bot]))
|
193
|
+
- Update react monorepo [#5072](https://github.com/knapsack-labs/app-monorepo/pull/5072) ([@renovate[bot]](https://github.com/renovate[bot]))
|
194
|
+
- Update dependency @react-aria/visually-hidden to ^3.8.17 [#5078](https://github.com/knapsack-labs/app-monorepo/pull/5078) ([@renovate[bot]](https://github.com/renovate[bot]))
|
195
|
+
- Update dependency @types/node to ^20.17.4 [#5080](https://github.com/knapsack-labs/app-monorepo/pull/5080) ([@renovate[bot]](https://github.com/renovate[bot]))
|
196
|
+
- Update dependency @types/node to ^20.17.3 [#5046](https://github.com/knapsack-labs/app-monorepo/pull/5046) ([@renovate[bot]](https://github.com/renovate[bot]))
|
197
|
+
|
198
|
+
#### Authors: 2
|
199
|
+
|
200
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
201
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
202
|
+
|
203
|
+
---
|
204
|
+
|
205
|
+
# v4.71.4 (Tue Oct 29 2024)
|
206
|
+
|
207
|
+
#### 🏠 Internal
|
208
|
+
|
209
|
+
- Update dependency @types/node to ^20.17.2 [#5020](https://github.com/knapsack-labs/app-monorepo/pull/5020) ([@renovate[bot]](https://github.com/renovate[bot]))
|
210
|
+
- Update dependency ava to ^6.2.0 [#5022](https://github.com/knapsack-labs/app-monorepo/pull/5022) ([@renovate[bot]](https://github.com/renovate[bot]))
|
211
|
+
|
212
|
+
#### Authors: 1
|
213
|
+
|
214
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
215
|
+
|
216
|
+
---
|
217
|
+
|
1
218
|
# v4.71.1 (Wed Oct 23 2024)
|
2
219
|
|
3
220
|
#### 🐛 Bug Fix
|
package/ava.config.cjs
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"infer-spec.test.d.ts","sourceRoot":"","sources":["../../src/analyze/infer-spec.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
7
|
+
const types_1 = require("@knapsack/types");
|
8
|
+
const renderers_1 = require("@knapsack/app/renderers");
|
9
|
+
const utils_1 = require("../utils");
|
10
|
+
(0, ava_1.default)('infer types in packages with different files name for types', async (t) => {
|
11
|
+
const spec = await (0, utils_1.getReactDocs)({
|
12
|
+
src: '@knapsack/sandbox-components/react',
|
13
|
+
exportName: 'Button',
|
14
|
+
resolveFromDir: __dirname,
|
15
|
+
});
|
16
|
+
if (spec === false) {
|
17
|
+
t.fail(`Spec could not be inferred`);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
t.truthy(spec);
|
21
|
+
t.deepEqual(Object.keys(spec.props.properties).sort(), ['label', 'mode', 'size', 'type'].sort());
|
22
|
+
if ((0, types_1.isOptionsProp)(spec.props.properties.size)) {
|
23
|
+
t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
t.log(spec.props.properties.size);
|
27
|
+
t.fail(`size prop should be an options prop`);
|
28
|
+
}
|
29
|
+
if ((0, types_1.isOptionsProp)(spec.props.properties.type)) {
|
30
|
+
t.deepEqual(spec.props.properties.type.enum, ['filled', 'outlined']);
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
t.log(spec.props.properties.type);
|
34
|
+
t.fail(`type prop should be an options prop`);
|
35
|
+
}
|
36
|
+
if ((0, types_1.isOptionsProp)(spec.props.properties.mode)) {
|
37
|
+
t.deepEqual(spec.props.properties.mode.enum, [
|
38
|
+
'default',
|
39
|
+
'success',
|
40
|
+
'error',
|
41
|
+
'warning',
|
42
|
+
]);
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
t.log(spec.props.properties.mode);
|
46
|
+
t.fail(`mode prop should be an options prop`);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
(0, ava_1.default)('inferDocs card.tsx with types', async (t) => {
|
50
|
+
const spec = await (0, utils_1.getReactDocs)({
|
51
|
+
src: '@knapsack/renderer-react-components/test-fixtures',
|
52
|
+
exportName: 'Card',
|
53
|
+
resolveFromDir: process.cwd(),
|
54
|
+
});
|
55
|
+
const expectedSpec = {
|
56
|
+
props: {
|
57
|
+
$schema: 'http://json-schema.org/draft-07/schema',
|
58
|
+
type: 'object',
|
59
|
+
required: ['cardBody', 'items'],
|
60
|
+
properties: {
|
61
|
+
textAlign: {
|
62
|
+
type: 'string',
|
63
|
+
enum: ['left', 'center', 'right'],
|
64
|
+
// @todo We lost proper default value when the source switched from `.tsx` to being from a package, which results in analyzing a `.d.ts` files... which doesn't have default values.
|
65
|
+
// default: 'left',
|
66
|
+
default: undefined,
|
67
|
+
},
|
68
|
+
imgSrc: {
|
69
|
+
type: 'string',
|
70
|
+
},
|
71
|
+
isDark: {
|
72
|
+
type: 'boolean',
|
73
|
+
// @todo We lost proper default value when the source switched from `.tsx` to being from a package, which results in analyzing a `.d.ts` files... which doesn't have default values.
|
74
|
+
// default: true,
|
75
|
+
},
|
76
|
+
cardTitle: {
|
77
|
+
type: 'string',
|
78
|
+
},
|
79
|
+
cardSubTitle: {
|
80
|
+
type: 'string',
|
81
|
+
},
|
82
|
+
cardBody: {
|
83
|
+
type: 'string',
|
84
|
+
},
|
85
|
+
handleIt: {
|
86
|
+
typeof: 'function',
|
87
|
+
tsType: '(x: string) => boolean',
|
88
|
+
},
|
89
|
+
items: {
|
90
|
+
tsType: '{ id: string; title: string; description?: string; }[]',
|
91
|
+
},
|
92
|
+
},
|
93
|
+
},
|
94
|
+
slots: {
|
95
|
+
children: {
|
96
|
+
description: 'Goes in footer',
|
97
|
+
title: 'children',
|
98
|
+
},
|
99
|
+
header: {
|
100
|
+
title: 'header',
|
101
|
+
},
|
102
|
+
},
|
103
|
+
};
|
104
|
+
if (spec === false) {
|
105
|
+
t.fail('Spec could not be inferred');
|
106
|
+
return;
|
107
|
+
}
|
108
|
+
const { ok, message } = (0, renderers_1.validateSpec)(spec);
|
109
|
+
t.is(ok, true, message);
|
110
|
+
t.deepEqual(spec, expectedSpec);
|
111
|
+
});
|
112
|
+
//# sourceMappingURL=infer-spec.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"infer-spec.test.js","sourceRoot":"","sources":["../../src/analyze/infer-spec.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,2CAAgE;AAChE,uDAAuD;AACvD,oCAAwC;AAExC,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,oCAAoC;QACzC,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,CAAC,CAAC,SAAS,CACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACzC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,M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CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IACD,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;IAE3C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxB,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mui.test.d.ts","sourceRoot":"","sources":["../../src/analyze/mui.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
7
|
+
const types_1 = require("@knapsack/types");
|
8
|
+
const utils_1 = require("../utils");
|
9
|
+
ava_1.default.serial('MUI strings with extra quotes', async (t) => {
|
10
|
+
const results = await (0, utils_1.getReactDocs)({
|
11
|
+
src: '@mui/x-data-grid',
|
12
|
+
exportName: 'DataGrid',
|
13
|
+
resolveFromDir: process.cwd(),
|
14
|
+
});
|
15
|
+
if (results === false) {
|
16
|
+
t.fail('Could not infer spec');
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
Object.entries(results.props.properties).forEach(([propName, prop]) => {
|
20
|
+
if ((0, types_1.isStringProp)(prop) || (0, types_1.isOptionsProp)(prop)) {
|
21
|
+
if (typeof prop.default === 'string') {
|
22
|
+
t.true(!prop.default.startsWith('"') && !prop.default.endsWith('"'), `prop "${propName}" has a default that should not be quoted: ${prop.default} - ${JSON.stringify(prop)}`);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
if ((0, types_1.isOptionsProp)(prop)) {
|
26
|
+
if (prop.default) {
|
27
|
+
t.true(prop.enum.includes(prop.default), `For prop "${propName}", the default value "${prop.default}" is not in the enum: ${prop.enum}`);
|
28
|
+
}
|
29
|
+
prop.enum.forEach((option) => {
|
30
|
+
t.true(!option.startsWith('"') && !option.endsWith('"'), `option should not be quoted: ${prop.default}`);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
if ((0, types_1.isNumberProp)(prop) && prop.default) {
|
34
|
+
const ok = t.is(typeof prop.default, 'number', `prop "${propName}" default should be a number: ${prop.default}`);
|
35
|
+
if (!ok) {
|
36
|
+
t.log(prop);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
if ((0, types_1.isBooleanProp)(prop) && prop.default) {
|
40
|
+
const ok = t.is(typeof prop.default, 'boolean', `prop "${propName}" should be a boolean: ${prop.default}`);
|
41
|
+
if (!ok) {
|
42
|
+
t.log(prop);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
});
|
46
|
+
});
|
47
|
+
ava_1.default.failing('infer types for MUI Component', async (t) => {
|
48
|
+
const spec = await (0, utils_1.getReactDocs)({
|
49
|
+
src: '@mui/material',
|
50
|
+
exportName: 'Button',
|
51
|
+
resolveFromDir: process.cwd(),
|
52
|
+
});
|
53
|
+
if (spec === false) {
|
54
|
+
t.fail('Spec could not be inferred for MUI Component');
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
t.pass('Spec was successfully inferred for MUI Component');
|
58
|
+
}
|
59
|
+
});
|
60
|
+
//# sourceMappingURL=mui.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mui.test.js","sourceRoot":"","sources":["../../src/analyze/mui.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,2CAKyB;AACzB,oCAAwC;AAExC,aAAI,CAAC,MAAM,CAAC,+BAA+B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvD,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAY,EAAC;QACjC,GAAG,EAAE,kBAAkB;QACvB,U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C"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pkg-basic.test.d.ts","sourceRoot":"","sources":["../../src/analyze/pkg-basic.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
7
|
+
const types_1 = require("@knapsack/types");
|
8
|
+
const utils_1 = require("../utils");
|
9
|
+
(0, ava_1.default)('infer types in basic packages', async (t) => {
|
10
|
+
const spec = await (0, utils_1.getReactDocs)({
|
11
|
+
src: '@knapsack/renderer-react-components/test-fixtures',
|
12
|
+
exportName: 'Button',
|
13
|
+
resolveFromDir: __dirname,
|
14
|
+
});
|
15
|
+
if (spec === false) {
|
16
|
+
t.fail(`Spec could not be inferred`);
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
t.deepEqual(Object.keys(spec.props.properties).sort(), ['size', 'text'].sort());
|
20
|
+
if (!(0, types_1.isStringProp)(spec.props.properties.text)) {
|
21
|
+
t.log(spec.props.properties.text);
|
22
|
+
t.fail(`text prop should be a string`);
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
if (!(0, types_1.isOptionsProp)(spec.props.properties.size)) {
|
26
|
+
t.log(spec.props.properties.size);
|
27
|
+
t.fail(`size prop should be an options prop`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
|
31
|
+
t.is(spec.slots.children.title, 'children', `Should detect "children" slot`);
|
32
|
+
});
|
33
|
+
//# sourceMappingURL=pkg-basic.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pkg-basic.test.js","sourceRoot":"","sources":["../../src/analyze/pkg-basic.test.ts"],"names":[],"mappings":";;;;;AAAA,8CA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C,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,+BAA+B,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pkg-diff-types.test.d.ts","sourceRoot":"","sources":["../../src/analyze/pkg-diff-types.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
7
|
+
const path_1 = require("path");
|
8
|
+
const types_1 = require("@knapsack/types");
|
9
|
+
const utils_1 = require("../utils");
|
10
|
+
(0, ava_1.default)('infer types in packages with different files name for types', async (t) => {
|
11
|
+
const spec = await (0, utils_1.getReactDocs)({
|
12
|
+
src: (0, path_1.join)(__dirname, '../../test-fixtures/pkg-diff-types'),
|
13
|
+
exportName: 'Button',
|
14
|
+
resolveFromDir: __dirname,
|
15
|
+
});
|
16
|
+
if (spec === false) {
|
17
|
+
t.fail(`Spec could not be inferred`);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
t.truthy(spec);
|
21
|
+
if (!spec.props) {
|
22
|
+
t.fail(`Spec should have props`);
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
if (!spec.slots) {
|
26
|
+
t.fail(`Spec should have slots`);
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
t.deepEqual(Object.keys(spec.props.properties).sort(), ['size', 'text'].sort());
|
30
|
+
if (!(0, types_1.isStringProp)(spec.props.properties.text)) {
|
31
|
+
t.log(spec.props.properties.text);
|
32
|
+
t.fail(`text prop should be a string`);
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
if (!(0, types_1.isOptionsProp)(spec.props.properties.size)) {
|
36
|
+
t.log(spec.props.properties.size);
|
37
|
+
t.fail(`size prop should be an options prop`);
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
t.deepEqual(spec.props.properties.size.enum, ['small', 'medium', 'large']);
|
41
|
+
t.is(spec.slots.children.title, 'children', `Should detect "children" slot`);
|
42
|
+
});
|
43
|
+
//# sourceMappingURL=pkg-diff-types.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pkg-diff-types.test.js","sourceRoot":"","sources":["../../src/analyze/pkg-diff-types.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AACvB,+BAA4B;AAC5B,2CAA8D;AAC9D,oCAAwC;AAExC,IAAA,aAAI,EAAC,6DAA6D,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAY,EAAC;QAC9B,GAAG,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,oCAAoC,CAAC;QAC1D,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;IACH,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,OAAO;IACT,CAAC;IACD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IACD,CAAC,CAAC,SAAS,CACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACzC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CACxB,CAAC;IACF,IAAI,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IACD,IAAI,CAAC,IAAA,qBAAa,EAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,+BAA+B,CAAC,CAAC;AAC/E,CAAC,CAAC,CAAC"}
|
package/dist/client/init.d.mts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export {};
|
2
|
+
//# sourceMappingURL=init.d.mts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"init.d.mts","sourceRoot":"","sources":["../../src/client/init.mts"],"names":[],"mappings":""}
|
package/dist/client/init.mjs
CHANGED
@@ -1,13 +1,41 @@
|
|
1
|
-
|
2
|
-
import
|
1
|
+
/// <reference lib="dom" />
|
2
|
+
import ReactDOM from 'react-dom/client';
|
3
3
|
import { getKsRendererClientUtils } from '@knapsack/renderer-webpack-base/client';
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
4
|
+
import { ReactRendererClientApp } from '@knapsack/renderer-react-components/react-renderer-client-app';
|
5
|
+
import { rendererMetaScriptTagId, } from '../types.js';
|
6
|
+
async function init() {
|
7
|
+
try {
|
8
|
+
const { getNeededImports, getExtraImports, rendererMeta: { disableReactStrictMode, demoWrapperProps }, rendererMethods: { getDemoApp }, } = getKsRendererClientUtils({
|
9
|
+
rendererMetaScriptTagId,
|
10
|
+
});
|
11
|
+
const [neededImports, { DemoWrapper }] = await Promise.all([
|
12
|
+
getNeededImports(),
|
13
|
+
getExtraImports(),
|
14
|
+
]);
|
15
|
+
const root = document.getElementById('render-root');
|
16
|
+
if (!root) {
|
17
|
+
throw new Error('No root element found');
|
18
|
+
}
|
19
|
+
const demoComponents = neededImports;
|
20
|
+
const DemoApp = getDemoApp(demoComponents);
|
21
|
+
const app = ReactRendererClientApp({
|
22
|
+
DemoWrapper,
|
23
|
+
DemoApp,
|
24
|
+
disableReactStrictMode,
|
25
|
+
demoWrapperProps,
|
26
|
+
});
|
27
|
+
ReactDOM.createRoot(root).render(app);
|
28
|
+
}
|
29
|
+
catch (e) {
|
30
|
+
console.error(e);
|
31
|
+
// create html element with error message
|
32
|
+
const errorElement = document.createElement('div');
|
33
|
+
errorElement.innerHTML = `
|
7
34
|
<h1>Error</h1>
|
8
|
-
<p>${
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
35
|
+
<p>${e.message}</p>
|
36
|
+
`;
|
37
|
+
document.body.appendChild(errorElement);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
init();
|
13
41
|
//# sourceMappingURL=init.mjs.map
|
package/dist/client/init.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"file":"init.mjs","sourceRoot":"","sources":["../../src/client/init.mts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA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