@anansi/core 0.14.6 → 0.14.9
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 +13 -121
- package/dist/client.js +14 -2
- package/dist/client.js.map +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/lib/floodSpouts.d.ts +1 -0
- package/lib/floodSpouts.d.ts.map +1 -1
- package/lib/laySpouts.d.ts +1 -0
- package/lib/laySpouts.d.ts.map +1 -1
- package/lib/spouts/app.d.ts +1 -0
- package/lib/spouts/app.d.ts.map +1 -1
- package/lib/spouts/app.server.d.ts +1 -0
- package/lib/spouts/app.server.d.ts.map +1 -1
- package/lib/spouts/json.js +6 -1
- package/lib/spouts/restHooks.d.ts.map +1 -1
- package/lib/spouts/restHooks.js +9 -2
- package/lib/spouts/rhHelp.d.ts +1 -0
- package/lib/spouts/rhHelp.d.ts.map +1 -1
- package/lib/spouts/types.d.ts +1 -0
- package/lib/spouts/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/spouts/json.tsx +5 -0
- package/src/spouts/restHooks.tsx +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,77 +3,67 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
### [0.14.
|
|
6
|
+
### [0.14.9](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.8...@anansi/core@0.14.9) (2022-07-28)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @anansi/core
|
|
8
9
|
|
|
9
|
-
###
|
|
10
|
+
### [0.14.8](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.7...@anansi/core@0.14.8) (2022-07-26)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
### 💅 Enhancement
|
|
12
13
|
|
|
14
|
+
* Provide warnings when SSR init has issues ([27c1c8a](https://github.com/ntucker/anansi/commit/27c1c8a90e474c01ad7c5a48d05dedc36508ede0))
|
|
13
15
|
|
|
16
|
+
### [0.14.7](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.6...@anansi/core@0.14.7) (2022-07-23)
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
**Note:** Version bump only for package @anansi/core
|
|
16
19
|
|
|
20
|
+
### [0.14.6](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.5...@anansi/core@0.14.6) (2022-07-19)
|
|
17
21
|
|
|
18
22
|
### 📦 Package
|
|
19
23
|
|
|
20
|
-
* Update
|
|
24
|
+
* Update babel monorepo to v7.18.9 ([#1583](https://github.com/ntucker/anansi/issues/1583)) ([f49c211](https://github.com/ntucker/anansi/commit/f49c211c633b6bbabdf50e4c8dd62cfd13015e22))
|
|
25
|
+
|
|
26
|
+
### [0.14.5](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.4...@anansi/core@0.14.5) (2022-07-16)
|
|
21
27
|
|
|
28
|
+
### 📦 Package
|
|
22
29
|
|
|
30
|
+
* Update jest monorepo to ^28.1.3 ([#1579](https://github.com/ntucker/anansi/issues/1579)) ([67eb63f](https://github.com/ntucker/anansi/commit/67eb63f426580c74027114f33c5ebfa06c8a366b))
|
|
23
31
|
|
|
24
32
|
### [0.14.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.3...@anansi/core@0.14.4) (2022-07-08)
|
|
25
33
|
|
|
26
34
|
**Note:** Version bump only for package @anansi/core
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
36
|
### [0.14.3](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.1...@anansi/core@0.14.3) (2022-07-01)
|
|
33
37
|
|
|
34
|
-
|
|
35
38
|
### 🐛 Bug Fix
|
|
36
39
|
|
|
37
40
|
* Spout type removes provided props from needed props ([#1572](https://github.com/ntucker/anansi/issues/1572)) ([caa25fd](https://github.com/ntucker/anansi/commit/caa25fd73b1b381fea84427a26b44199d4b12314))
|
|
38
41
|
|
|
39
|
-
|
|
40
|
-
|
|
41
42
|
### [0.14.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.1...@anansi/core@0.14.2) (2022-07-01)
|
|
42
43
|
|
|
43
|
-
|
|
44
44
|
### 🐛 Bug Fix
|
|
45
45
|
|
|
46
46
|
* Spout type removes provided props from needed props ([#1572](https://github.com/ntucker/anansi/issues/1572)) ([caa25fd](https://github.com/ntucker/anansi/commit/caa25fd73b1b381fea84427a26b44199d4b12314))
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
48
|
### [0.14.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.14.0...@anansi/core@0.14.1) (2022-06-29)
|
|
51
49
|
|
|
52
|
-
|
|
53
50
|
### 🐛 Bug Fix
|
|
54
51
|
|
|
55
52
|
* Provide rest-hooks package for rest-hooks/ssr ([#1569](https://github.com/ntucker/anansi/issues/1569)) ([1dbb8ae](https://github.com/ntucker/anansi/commit/1dbb8aec39ad3180a96e76827611b05b53d7e02f))
|
|
56
53
|
|
|
57
|
-
|
|
58
54
|
### 📦 Package
|
|
59
55
|
|
|
60
56
|
* Update babel monorepo to v7.18.6 ([#1566](https://github.com/ntucker/anansi/issues/1566)) ([1634f13](https://github.com/ntucker/anansi/commit/1634f1358de98ba724433ffb462094ad17f88b72))
|
|
61
57
|
* Update jest monorepo to ^28.1.2 ([#1567](https://github.com/ntucker/anansi/issues/1567)) ([2e614b1](https://github.com/ntucker/anansi/commit/2e614b1bc54ade3cf78717e7d26d606f5e917888))
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
59
|
## [0.14.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.13.0...@anansi/core@0.14.0) (2022-06-24)
|
|
66
60
|
|
|
67
|
-
|
|
68
61
|
### 🚀 Features
|
|
69
62
|
|
|
70
63
|
* Add Spout type for easy spout construction ([8f93eb3](https://github.com/ntucker/anansi/commit/8f93eb363f1bfe30d1ac30395df1a3d9fbd9cab3))
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
65
|
## [0.13.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.12.0...@anansi/core@0.13.0) (2022-06-23)
|
|
75
66
|
|
|
76
|
-
|
|
77
67
|
### ⚠ 💥 BREAKING CHANGES
|
|
78
68
|
|
|
79
69
|
* Must use appSpout; Spouts need two generics
|
|
@@ -82,116 +72,86 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
82
72
|
|
|
83
73
|
* Spouts produce props in both directions ([#1559](https://github.com/ntucker/anansi/issues/1559)) ([898cdde](https://github.com/ntucker/anansi/commit/898cdde500a204a7a4dc155ac7ee51930172380e))
|
|
84
74
|
|
|
85
|
-
|
|
86
|
-
|
|
87
75
|
## [0.12.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.11.2...@anansi/core@0.12.0) (2022-06-15)
|
|
88
76
|
|
|
89
|
-
|
|
90
77
|
### 🚀 Features
|
|
91
78
|
|
|
92
79
|
* Add onError option to laySpouts ([a0ef72b](https://github.com/ntucker/anansi/commit/a0ef72bcaab1440a3d997d21636f81ca767a5a1c))
|
|
93
80
|
|
|
94
|
-
|
|
95
81
|
### 💅 Enhancement
|
|
96
82
|
|
|
97
83
|
* Don't crash devserver on compiler errors ([3c764e4](https://github.com/ntucker/anansi/commit/3c764e4dd67a57409c64ff7dd144386623a1d93f))
|
|
98
84
|
|
|
99
|
-
|
|
100
85
|
### 📦 Package
|
|
101
86
|
|
|
102
87
|
* Update babel monorepo to v7.18.5 ([#1545](https://github.com/ntucker/anansi/issues/1545)) ([aaaa8bc](https://github.com/ntucker/anansi/commit/aaaa8bcaa4d9188e9671ee31dc09b7aa9e3ce988))
|
|
103
88
|
|
|
104
|
-
|
|
105
|
-
|
|
106
89
|
### [0.11.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.11.1...@anansi/core@0.11.2) (2022-06-13)
|
|
107
90
|
|
|
108
|
-
|
|
109
91
|
### 💅 Enhancement
|
|
110
92
|
|
|
111
93
|
* Do not override 'unsafe-inline' with nonce for CSP ([cfbd2bd](https://github.com/ntucker/anansi/commit/cfbd2bdfa69ae97ef2db6a824496888420251371))
|
|
112
94
|
* Use 'text' to get inline JSON ([9ecdb07](https://github.com/ntucker/anansi/commit/9ecdb074d01e6f09c28a685433105cf0d6f711cc))
|
|
113
95
|
|
|
114
|
-
|
|
115
96
|
### 📦 Package
|
|
116
97
|
|
|
117
98
|
* Update `webpack-cli` to v4.10.0 ([#1543](https://github.com/ntucker/anansi/issues/1543)) ([298cb01](https://github.com/ntucker/anansi/commit/298cb018db2975fb5c926c48d2145d7c1f4515b9))
|
|
118
99
|
|
|
119
|
-
|
|
120
|
-
|
|
121
100
|
### [0.11.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.11.0...@anansi/core@0.11.1) (2022-06-13)
|
|
122
101
|
|
|
123
|
-
|
|
124
102
|
### 🐛 Bug Fix
|
|
125
103
|
|
|
126
104
|
* Use call user-config devServer.setupMiddleware ([99acd8c](https://github.com/ntucker/anansi/commit/99acd8c9386bfc338ef8733d19a734b2a8be21dd))
|
|
127
105
|
|
|
128
|
-
|
|
129
|
-
|
|
130
106
|
## [0.11.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.10.0...@anansi/core@0.11.0) (2022-06-12)
|
|
131
107
|
|
|
132
|
-
|
|
133
108
|
### 🚀 Features
|
|
134
109
|
|
|
135
110
|
* Add CSP support ([#1541](https://github.com/ntucker/anansi/issues/1541)) ([e8a7415](https://github.com/ntucker/anansi/commit/e8a7415db892d725b76a2d7d451670437d6fb8eb))
|
|
136
111
|
|
|
137
|
-
|
|
138
112
|
### 💅 Enhancement
|
|
139
113
|
|
|
140
114
|
* Multi-module server side devserver ([b1b6f87](https://github.com/ntucker/anansi/commit/b1b6f873f2a50a9af05683a80d587ac87d90f8f9))
|
|
141
115
|
|
|
142
|
-
|
|
143
|
-
|
|
144
116
|
## [0.10.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.9.0...@anansi/core@0.10.0) (2022-06-09)
|
|
145
117
|
|
|
146
|
-
|
|
147
118
|
### 🚀 Features
|
|
148
119
|
|
|
149
120
|
* add router onChange() ([5c981ed](https://github.com/ntucker/anansi/commit/5c981ed587b55a80fd4f604fc24fb143d2355a06))
|
|
150
121
|
|
|
151
|
-
|
|
152
122
|
### 💅 Enhancement
|
|
153
123
|
|
|
154
124
|
* Do require cache invalidation ourselves ([22b4e4c](https://github.com/ntucker/anansi/commit/22b4e4c2e4ce3d7de999813bd4e9397e770fe788))
|
|
155
125
|
* Improve devserver node 'require' reliability ([#1538](https://github.com/ntucker/anansi/issues/1538)) ([96b6a54](https://github.com/ntucker/anansi/commit/96b6a54562b97f116fc987b41fbf7547770debc8))
|
|
156
126
|
|
|
157
|
-
|
|
158
127
|
### 🐛 Bug Fix
|
|
159
128
|
|
|
160
129
|
* rootId is optional ([ff43166](https://github.com/ntucker/anansi/commit/ff43166d457ac93ffca2eae0738d81e734b6936e))
|
|
161
130
|
* SSR hot-reloading ([9809ad5](https://github.com/ntucker/anansi/commit/9809ad5798e9082554f0358fcd9c301a87e4acbf))
|
|
162
131
|
|
|
163
|
-
|
|
164
132
|
### 📦 Package
|
|
165
133
|
|
|
166
134
|
* Move compression to correct package ([1ce18ba](https://github.com/ntucker/anansi/commit/1ce18ba9d7dc4d04682184bc1fa74354684294bb))
|
|
167
135
|
* Update all non-major dependencies ([#1531](https://github.com/ntucker/anansi/issues/1531)) ([2677241](https://github.com/ntucker/anansi/commit/26772415c2763f35c1720a08bb4b5417214f20d3))
|
|
168
136
|
* Update jest monorepo to ^28.1.1 ([#1534](https://github.com/ntucker/anansi/issues/1534)) ([b73dea2](https://github.com/ntucker/anansi/commit/b73dea2ee14f914bdbca189000265693d7fb112f))
|
|
169
137
|
|
|
170
|
-
|
|
171
|
-
|
|
172
138
|
## [0.9.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.8.0...@anansi/core@0.9.0) (2022-05-29)
|
|
173
139
|
|
|
174
|
-
|
|
175
140
|
### 🚀 Features
|
|
176
141
|
|
|
177
142
|
* --serveProxy: [non-dev] uses webpack proxy config ([774f826](https://github.com/ntucker/anansi/commit/774f82646542d8acfcb0ddceb6fc75fcc2851a01))
|
|
178
143
|
* Add option to serve assets with production server ([bfb20eb](https://github.com/ntucker/anansi/commit/bfb20eb1564fc2c6b72fea79d0722ac6186797fe))
|
|
179
144
|
|
|
180
|
-
|
|
181
145
|
### 💅 Enhancement
|
|
182
146
|
|
|
183
147
|
* Handle root asset path ([a770c77](https://github.com/ntucker/anansi/commit/a770c77c4775b09ff86f26cfd5983eab5d211f74))
|
|
184
148
|
|
|
185
|
-
|
|
186
149
|
### 🐛 Bug Fix
|
|
187
150
|
|
|
188
151
|
* documentSpout options type ([6707d35](https://github.com/ntucker/anansi/commit/6707d3592f7f0ab772a10d623d1d765a9301c3ae))
|
|
189
152
|
|
|
190
|
-
|
|
191
|
-
|
|
192
153
|
## [0.8.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.4...@anansi/core@0.8.0) (2022-05-29)
|
|
193
154
|
|
|
194
|
-
|
|
195
155
|
### 🚀 Features
|
|
196
156
|
|
|
197
157
|
* Add anansi serve command ([#1525](https://github.com/ntucker/anansi/issues/1525)) ([ac5a396](https://github.com/ntucker/anansi/commit/ac5a396f9640ce18058813c1594d49367a8aa468))
|
|
@@ -199,181 +159,123 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
199
159
|
* Add production node service ([bceeb56](https://github.com/ntucker/anansi/commit/bceeb56c23c8f8c3dc4a15d35dc8877f277e3d2f))
|
|
200
160
|
* Handle devserver proxy ([e7c5b38](https://github.com/ntucker/anansi/commit/e7c5b38cdb60b236db15ffb28622889b0b771515))
|
|
201
161
|
|
|
202
|
-
|
|
203
|
-
|
|
204
162
|
### [0.7.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.3...@anansi/core@0.7.4) (2022-05-28)
|
|
205
163
|
|
|
206
|
-
|
|
207
164
|
### 💅 Enhancement
|
|
208
165
|
|
|
209
166
|
* Stall SSR requests until build is ready ([fe2616a](https://github.com/ntucker/anansi/commit/fe2616ac2d957f7243310d896f4a2ad5cb7d910e))
|
|
210
167
|
|
|
211
|
-
|
|
212
|
-
|
|
213
168
|
### [0.7.3](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.2...@anansi/core@0.7.3) (2022-05-28)
|
|
214
169
|
|
|
215
|
-
|
|
216
170
|
### 💅 Enhancement
|
|
217
171
|
|
|
218
172
|
* Require, then import fresh ([7de7d8d](https://github.com/ntucker/anansi/commit/7de7d8d73e533b69bdf78698965121a35375692c))
|
|
219
173
|
|
|
220
|
-
|
|
221
|
-
|
|
222
174
|
### [0.7.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.1...@anansi/core@0.7.2) (2022-05-28)
|
|
223
175
|
|
|
224
|
-
|
|
225
176
|
### 💅 Enhancement
|
|
226
177
|
|
|
227
178
|
* More error handling ([129d444](https://github.com/ntucker/anansi/commit/129d44407ac3ea9838e240d82f774c73100cc9da))
|
|
228
179
|
|
|
229
|
-
|
|
230
|
-
|
|
231
180
|
### [0.7.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.7.0...@anansi/core@0.7.1) (2022-05-28)
|
|
232
181
|
|
|
233
|
-
|
|
234
182
|
### 💅 Enhancement
|
|
235
183
|
|
|
236
184
|
* Do not use additional express server for dev ([ce29cbb](https://github.com/ntucker/anansi/commit/ce29cbb0b8547b736a31f9bac6309338b6114bae))
|
|
237
185
|
* Target current node for server devbuild ([262bd1e](https://github.com/ntucker/anansi/commit/262bd1e79d56dacdb4114d8ea959d819df16b687))
|
|
238
186
|
|
|
239
|
-
|
|
240
187
|
### 🐛 Bug Fix
|
|
241
188
|
|
|
242
189
|
* SSR hot reloading ([3b08106](https://github.com/ntucker/anansi/commit/3b081066463020fdbef2c01efd4922d09e02d8aa))
|
|
243
190
|
|
|
244
|
-
|
|
245
|
-
|
|
246
191
|
## [0.7.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.6.1...@anansi/core@0.7.0) (2022-05-28)
|
|
247
192
|
|
|
248
|
-
|
|
249
193
|
### 🚀 Features
|
|
250
194
|
|
|
251
195
|
* env.entrypath override ([a918d32](https://github.com/ntucker/anansi/commit/a918d3247c22ea00d0e1d5395553752280d32d99))
|
|
252
196
|
|
|
253
|
-
|
|
254
197
|
### 💅 Enhancement
|
|
255
198
|
|
|
256
199
|
* Improve route asset identification ([c07e9a2](https://github.com/ntucker/anansi/commit/c07e9a29935e0e24f815371ad6610bed77da967e))
|
|
257
200
|
|
|
258
|
-
|
|
259
201
|
### 📦 Package
|
|
260
202
|
|
|
261
203
|
* Update babel monorepo to v7.18.2 ([#1520](https://github.com/ntucker/anansi/issues/1520)) ([e0fe514](https://github.com/ntucker/anansi/commit/e0fe5142b0c308aff24b86faef6d70084c80691f))
|
|
262
204
|
|
|
263
|
-
|
|
264
|
-
|
|
265
205
|
### [0.6.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.6.0...@anansi/core@0.6.1) (2022-05-24)
|
|
266
206
|
|
|
267
|
-
|
|
268
207
|
### 🐛 Bug Fix
|
|
269
208
|
|
|
270
209
|
* Don't error with 'React currently only supports piping to one writable stream' ([cf55fdb](https://github.com/ntucker/anansi/commit/cf55fdb82ee158e26ee596f86db0231faa8e98f5))
|
|
271
210
|
|
|
272
|
-
|
|
273
|
-
|
|
274
211
|
## [0.6.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.2...@anansi/core@0.6.0) (2022-05-22)
|
|
275
212
|
|
|
276
|
-
|
|
277
213
|
### 🚀 Features
|
|
278
214
|
|
|
279
215
|
* Return router in spout ([dfbb685](https://github.com/ntucker/anansi/commit/dfbb68577e05216178671262db488d8aab55021e))
|
|
280
216
|
|
|
281
|
-
|
|
282
|
-
|
|
283
217
|
### [0.5.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.1...@anansi/core@0.5.2) (2022-05-21)
|
|
284
218
|
|
|
285
219
|
**Note:** Version bump only for package @anansi/core
|
|
286
220
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
221
|
### [0.5.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.5.0...@anansi/core@0.5.1) (2022-05-20)
|
|
292
222
|
|
|
293
|
-
|
|
294
223
|
### 📦 Package
|
|
295
224
|
|
|
296
225
|
* Update babel monorepo ([#1515](https://github.com/ntucker/anansi/issues/1515)) ([9d51b13](https://github.com/ntucker/anansi/commit/9d51b13218a67c17cfef56a1be88ac4af7933d03))
|
|
297
226
|
|
|
298
|
-
|
|
299
|
-
|
|
300
227
|
## [0.5.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.4...@anansi/core@0.5.0) (2022-05-18)
|
|
301
228
|
|
|
302
|
-
|
|
303
229
|
### 🚀 Features
|
|
304
230
|
|
|
305
231
|
* Add commonjs bundles ([#1508](https://github.com/ntucker/anansi/issues/1508)) ([3f1f5a2](https://github.com/ntucker/anansi/commit/3f1f5a2f881d3e314d9fd08d63607e0c8dbd34d1))
|
|
306
232
|
|
|
307
|
-
|
|
308
233
|
### 💅 Enhancement
|
|
309
234
|
|
|
310
235
|
* Ensure output works without WEBPACK_PUBLIC_HOST set ([1df3f57](https://github.com/ntucker/anansi/commit/1df3f57cf0d3966a371e89f8c2333f3f29e23b65))
|
|
311
236
|
* Only hydrate body content ([1a6412c](https://github.com/ntucker/anansi/commit/1a6412c2e2b55b176fa0491228888490e45de98f))
|
|
312
237
|
|
|
313
|
-
|
|
314
|
-
|
|
315
238
|
### [0.4.4](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.3...@anansi/core@0.4.4) (2022-05-18)
|
|
316
239
|
|
|
317
|
-
|
|
318
240
|
### 💅 Enhancement
|
|
319
241
|
|
|
320
242
|
* Supress hydration warnings in head for stackblitz compat ([38ac992](https://github.com/ntucker/anansi/commit/38ac99237af30d97408fb23bfb95b3bbe5384a03))
|
|
321
243
|
|
|
322
|
-
|
|
323
|
-
|
|
324
244
|
### [0.4.3](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.2...@anansi/core@0.4.3) (2022-05-18)
|
|
325
245
|
|
|
326
|
-
|
|
327
246
|
### 💅 Enhancement
|
|
328
247
|
|
|
329
248
|
* Use relative asset paths ([799b69e](https://github.com/ntucker/anansi/commit/799b69e52394edc26290b9f01ff60ad772f739da))
|
|
330
249
|
|
|
331
|
-
|
|
332
|
-
|
|
333
250
|
### [0.4.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.1...@anansi/core@0.4.2) (2022-05-18)
|
|
334
251
|
|
|
335
252
|
**Note:** Version bump only for package @anansi/core
|
|
336
253
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
254
|
### [0.4.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.4.0...@anansi/core@0.4.1) (2022-05-18)
|
|
342
255
|
|
|
343
|
-
|
|
344
256
|
### 🐛 Bug Fix
|
|
345
257
|
|
|
346
258
|
* Server compilation ([d8a1c9a](https://github.com/ntucker/anansi/commit/d8a1c9a05718cde13c99d56dcc79a5cc823fa6bb))
|
|
347
259
|
|
|
348
|
-
|
|
349
|
-
|
|
350
260
|
## [0.4.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.3.1...@anansi/core@0.4.0) (2022-05-17)
|
|
351
261
|
|
|
352
|
-
|
|
353
262
|
### 🚀 Features
|
|
354
263
|
|
|
355
264
|
* SSR uses webpack devserver and responds to code changes ([#1504](https://github.com/ntucker/anansi/issues/1504)) ([25803a5](https://github.com/ntucker/anansi/commit/25803a5b49316c7e73846efbe774d5cbe3eb28a3))
|
|
356
265
|
|
|
357
|
-
|
|
358
266
|
### 📦 Package
|
|
359
267
|
|
|
360
268
|
* Update babel monorepo to v7.17.12 ([#1505](https://github.com/ntucker/anansi/issues/1505)) ([cdf449c](https://github.com/ntucker/anansi/commit/cdf449c234da377c6968847a500ef77d7340c5bb))
|
|
361
269
|
* Update jest monorepo to ^28.1.0 ([#1493](https://github.com/ntucker/anansi/issues/1493)) ([7cc9df4](https://github.com/ntucker/anansi/commit/7cc9df4a439a0743bf243a5ad8393c62c067aa44))
|
|
362
270
|
|
|
363
|
-
|
|
364
|
-
|
|
365
271
|
### [0.3.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.3.0...@anansi/core@0.3.1) (2022-05-04)
|
|
366
272
|
|
|
367
|
-
|
|
368
273
|
### 📦 Package
|
|
369
274
|
|
|
370
275
|
* Update all non-major dependencies ([#1490](https://github.com/ntucker/anansi/issues/1490)) ([c333a59](https://github.com/ntucker/anansi/commit/c333a595dd912e67f64e22b4c4af58e825e75cad))
|
|
371
276
|
|
|
372
|
-
|
|
373
|
-
|
|
374
277
|
## [0.3.0](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.2...@anansi/core@0.3.0) (2022-04-30)
|
|
375
278
|
|
|
376
|
-
|
|
377
279
|
### ⚠ 💥 BREAKING CHANGES
|
|
378
280
|
|
|
379
281
|
* Requires TypeScript 4.3 and Jest 28
|
|
@@ -388,34 +290,24 @@ Co-authored-by: Nathaniel Tucker <me@ntucker.me>
|
|
|
388
290
|
* Update jest monorepo to ^28.0.3 ([#1486](https://github.com/ntucker/anansi/issues/1486)) ([a5b325a](https://github.com/ntucker/anansi/commit/a5b325af0166351f40c421d4a3a0bef59f6d1218))
|
|
389
291
|
* Update jest monorepo to v28 (major) ([#1479](https://github.com/ntucker/anansi/issues/1479)) ([06338de](https://github.com/ntucker/anansi/commit/06338de8bf871945dac4b6b35155e49fd062bfdb))
|
|
390
292
|
|
|
391
|
-
|
|
392
|
-
|
|
393
293
|
### [0.2.2](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.1...@anansi/core@0.2.2) (2022-04-22)
|
|
394
294
|
|
|
395
|
-
|
|
396
295
|
### 💅 Enhancement
|
|
397
296
|
|
|
398
297
|
* Indicate compilation errors ([82682b9](https://github.com/ntucker/anansi/commit/82682b9ed22686eb58f5421b6043852d2006842e))
|
|
399
298
|
|
|
400
|
-
|
|
401
|
-
|
|
402
299
|
### [0.2.1](https://github.com/ntucker/anansi/compare/@anansi/core@0.2.0...@anansi/core@0.2.1) (2022-04-18)
|
|
403
300
|
|
|
404
|
-
|
|
405
301
|
### 🐛 Bug Fix
|
|
406
302
|
|
|
407
303
|
* Make start-anansi command executable in bash ([4ae313c](https://github.com/ntucker/anansi/commit/4ae313c7d2137df63e74e5a8064237189c04adc8))
|
|
408
304
|
|
|
409
|
-
|
|
410
|
-
|
|
411
305
|
## 0.2.0 (2022-04-18)
|
|
412
306
|
|
|
413
|
-
|
|
414
307
|
### 🚀 Features
|
|
415
308
|
|
|
416
309
|
* React 18 partial hydration SSR ([#1427](https://github.com/ntucker/anansi/issues/1427)) ([afe12fe](https://github.com/ntucker/anansi/commit/afe12fea2e0a0f9d9a759c2f533ab925ba0e8957)), closes [#1456](https://github.com/ntucker/anansi/issues/1456)
|
|
417
310
|
|
|
418
|
-
|
|
419
311
|
### 📦 Package
|
|
420
312
|
|
|
421
313
|
* Update all non-major dependencies ([#1472](https://github.com/ntucker/anansi/issues/1472)) ([903e452](https://github.com/ntucker/anansi/commit/903e452e58dfacb14808d23e1aa883d6126dae1f))
|
package/dist/client.js
CHANGED
|
@@ -93,7 +93,14 @@ function restHooksSpout(options = {
|
|
|
93
93
|
getManagers: () => [new core_namespaceObject.NetworkManager()]
|
|
94
94
|
}) {
|
|
95
95
|
return next => async props => {
|
|
96
|
-
|
|
96
|
+
var _props$initData;
|
|
97
|
+
|
|
98
|
+
const data = (_props$initData = props.initData) == null ? void 0 : _props$initData.resthooks;
|
|
99
|
+
|
|
100
|
+
if ( true && !data) {
|
|
101
|
+
console.error('Rest Hooks init data not found');
|
|
102
|
+
}
|
|
103
|
+
|
|
97
104
|
const nextProps = await next(props);
|
|
98
105
|
return { ...nextProps,
|
|
99
106
|
app: /*#__PURE__*/external_react_default().createElement(core_namespaceObject.CacheProvider, {
|
|
@@ -102,7 +109,7 @@ function restHooksSpout(options = {
|
|
|
102
109
|
__self: this,
|
|
103
110
|
__source: {
|
|
104
111
|
fileName: _jsxFileName,
|
|
105
|
-
lineNumber:
|
|
112
|
+
lineNumber: 27,
|
|
106
113
|
columnNumber: 9
|
|
107
114
|
}
|
|
108
115
|
}, nextProps.app)
|
|
@@ -175,6 +182,11 @@ function JSONSpout({
|
|
|
175
182
|
|
|
176
183
|
function getDatafromDOM(id) {
|
|
177
184
|
const element = document.querySelector(`#${id}`);
|
|
185
|
+
|
|
186
|
+
if (element && element.text === undefined) {
|
|
187
|
+
console.error(`#${id} is completely empty. This could be due to CSP issues.`);
|
|
188
|
+
}
|
|
189
|
+
|
|
178
190
|
return element != null && element.text ? JSON.parse(element == null ? void 0 : element.text) : undefined;
|
|
179
191
|
}
|
|
180
192
|
;// CONCATENATED MODULE: ./src/spouts/app.tsx
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAEA;AAIA;AAAA;AACA;;AACA;AAAA;AAAA;AAEA;AACA;;ACNA;AAIA;AACA;AAEA;AACA;AACA;;ACdA;;;ACAA;;;;ACAA;AASA;AAGA;AAAA;AAEA;AACA;AAEA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAHA;AAQA;AACA;;
|
|
1
|
+
{"version":3,"file":"client.js","mappings":";;AAAA;AACA;AACA;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACNA;;ACAA;AAEA;AAIA;AAAA;AACA;;AACA;AAAA;AAAA;AAEA;AACA;;ACNA;AAIA;AACA;AAEA;AACA;AACA;;ACdA;;;ACAA;;;;ACAA;AASA;AAGA;AAAA;AAEA;AAAA;;AACA;;AAEA;AACA;AACA;;AAEA;AAEA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAHA;AAQA;AACA;;AChCA;;ACAA;;;ACAA;AACA;AACA;AAKA;AAaA;AAGA;AAAA;AACA;AAEA;AAEA;AACA;AACA;AAHA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;;AAEA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAJA;AAMA;AACA;;AClDA;AACA;AADA;AAMA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;;AACA;AACA;;AACA;AACA;AAGA;;AACA;AACA;;ACrBA;AAGA;AAAA;;AAEA;;ACLA;AACA;AACA;AACA;AACA","sources":["/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/client\"","/home/ntucker/src/anansi/packages/core/src/floodSpouts.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.tsx","/home/ntucker/src/anansi/packages/core/src/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/client\");","import { hydrateRoot } from 'react-dom/client';\n\nexport default async function floodSpouts(\n spouts: (props: Record<string, unknown>) => Promise<{\n app: JSX.Element;\n }>,\n { rootId = 'anansi-root' }: { rootId?: string } = {},\n) {\n const { app } = await spouts({});\n\n hydrateRoot(document.getElementById(rootId) ?? document, app);\n}\n","import React from 'react';\nimport type { Route } from '@anansi/router';\n\nimport type { ClientSpout } from './types';\n\nexport default function documentSpout(options: {\n head?: React.ReactNode;\n title: string;\n}): ClientSpout {\n return next => async props => {\n const nextProps = await next(props);\n\n return nextProps;\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","import {\n CacheProvider,\n Manager,\n NetworkManager,\n State,\n} from '@rest-hooks/core';\n\nimport type { ClientSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ClientSpout<{ initData: Record<string, unknown> }> {\n return next => async props => {\n const data = props.initData?.resthooks as State<unknown>;\n\n if (process.env.NODE_ENV !== 'production' && !data) {\n console.error('Rest Hooks init data not found');\n }\n\n const nextProps = await next(props);\n\n return {\n ...nextProps,\n app: (\n <CacheProvider initialState={data} managers={options.getManagers()}>\n {nextProps.app}\n </CacheProvider>\n ),\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createBrowserHistory } from 'history';\nimport type { Update } from 'history';\n\nimport type { CreateRouter, ClientSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n onChange?: (update: Update, callback: () => void | undefined) => void;\n}): ClientSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith, any>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider\n router={router}\n resolveWith={resolveWith}\n onChange={options.onChange}\n >\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const history = createBrowserHistory();\n const router = options.createRouter(history);\n const matchedRoutes = router.getMatchedRoutes(history.location.pathname);\n\n const nextProps = await next({ ...props, matchedRoutes, router });\n\n const Router = createRouteComponent(router);\n return {\n ...nextProps,\n matchedRoutes,\n router,\n app: <Router>{nextProps.app}</Router>,\n };\n };\n}\n","import type { ClientSpout } from './types';\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ClientSpout<\n Record<string, unknown>,\n { initData: Record<string, unknown> }\n> {\n return next => async props => {\n const initData = getDatafromDOM(id);\n return { ...(await next({ ...props, initData })), initData };\n };\n}\nfunction getDatafromDOM(id: string): Record<string, unknown> {\n const element: HTMLScriptElement | null = document.querySelector(`#${id}`);\n if (element && element.text === undefined) {\n console.error(\n `#${id} is completely empty. This could be due to CSP issues.`,\n );\n }\n return element?.text ? JSON.parse(element?.text) : undefined;\n}\n","const appSpout =\n (app: JSX.Element) =>\n <P extends Record<string, unknown>>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","export { default as floodSpouts } from './floodSpouts';\nexport { default as documentSpout } from './spouts/document';\nexport { default as restHooksSpout } from './spouts/restHooks';\nexport { default as routerSpout } from './spouts/router';\nexport { default as JSONSpout } from './spouts/json';\nexport { default as appSpout } from './spouts/app';\nexport type { ServerProps } from './spouts/types';\nexport type { ClientSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
package/dist/server.js
CHANGED
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","mappings":"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","sources":["/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/external node-commonjs \"crypto\"","/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/src/spouts/csp.ts","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/external commonjs \"rest-hooks\"","/home/ntucker/src/anansi/packages/core/external commonjs \"redux\"","/home/ntucker/src/anansi/packages/core/src/spouts/rhHelp.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.server.tsx","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/server\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto\");","import { renderToPipeableStream as reactRender } from 'react-dom/server';\nimport crypto from 'crypto';\n\nimport { Render } from './scripts/types';\nimport { ServerProps } from './spouts/types';\n\nexport default function laySpouts(\n spouts: (props: ServerProps) => Promise<{\n app: JSX.Element;\n }>,\n {\n timeoutMS = 200,\n onError,\n }: { timeoutMS?: number; onError?: (error: unknown) => void } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const nonce = crypto.randomBytes(16).toString('base64');\n\n try {\n const { app } = await spouts({ clientManifest, req, res, nonce });\n\n let didError = false;\n const { pipe, abort } = reactRender(app, {\n nonce,\n //bootstrapScripts: assets.filter(asset => asset.endsWith('.js')),\n onShellReady() {\n //managers.forEach(manager => manager.cleanup());\n // If something errored before we started streaming, we set the error code appropriately.\n res.statusCode = didError ? 500 : 200;\n res.setHeader('Content-type', 'text/html');\n pipe(res);\n },\n onShellError() {\n didError = true;\n res.statusCode = 500;\n pipe(res);\n },\n onError(e: any) {\n didError = true;\n console.error(e);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n if (onError) onError(e);\n },\n });\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(\n () => (abort as any)(`Timeout of ${timeoutMS}ms exceeded`),\n timeoutMS,\n );\n } catch (e: unknown) {\n if (onError) onError(e);\n throw e;\n }\n };\n return render;\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","export interface Policy {\n [directive: string]: string | string[];\n}\n\n// TODO: memoize this\nexport function buildPolicy(policyObj: Policy) {\n return Object.keys(policyObj)\n .map(key => {\n const val = Array.isArray(policyObj[key])\n ? [...new Set(policyObj[key]).values()].filter(v => v).join(' ')\n : policyObj[key];\n\n // move strict dynamic to the end of the policy if it exists to be backwards compatible with csp2\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic\n if (typeof val === 'string' && val.includes(\"'strict-dynamic'\")) {\n const newVal = `${val\n .replace(/\\s?'strict-dynamic'\\s?/gi, ' ')\n .trim()} 'strict-dynamic'`;\n return `${key} ${newVal}`;\n }\n\n return `${key} ${val}`;\n })\n .join('; ');\n}\n","import type { Policy } from './csp';\nimport { buildPolicy } from './csp';\n\ntype Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n scripts: React.ReactNode;\n title: string;\n rootId: string;\n charSet: string;\n csPolicy?: Policy;\n nonce?: string | undefined;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n charSet,\n csPolicy,\n nonce,\n scripts,\n}: Props) {\n let cspMeta: null | React.ReactNode = null;\n if (csPolicy) {\n // add nonce to policy\n const policy = {\n ...csPolicy,\n };\n if (\n nonce &&\n // nonces negate 'unsafe-inline' so do not add it if that directive exists\n (!policy['script-src'] ||\n !policy['script-src'].includes(\"'unsafe-inline'\"))\n ) {\n if (typeof policy['script-src'] === 'string') {\n policy['script-src'] = [policy['script-src'], `'nonce-${nonce}'`];\n } else {\n policy['script-src'] = [...policy['script-src'], `'nonce-${nonce}'`];\n }\n }\n cspMeta = (\n <meta httpEquiv=\"Content-Security-Policy\" content={buildPolicy(policy)} />\n );\n }\n return (\n <html>\n <head>\n <meta charSet={charSet} />\n {cspMeta}\n {head}\n {assets.map((asset, i) => (\n <link key={i} rel=\"preload\" {...asset} />\n ))}\n <title>{title}</title>\n </head>\n <body>\n <div id={rootId}>{children}</div>\n {scripts}\n {assets\n .filter(({ href }) => href.endsWith('.js'))\n .map(({ href }, i) => (\n <script key={i} src={href} async />\n ))}\n </body>\n </html>\n );\n}\nDocument.defaultProps = {\n head: (\n <>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link\n rel=\"shortcut icon\"\n href={`${process.env.WEBPACK_PUBLIC_PATH ?? '/'}favicon.ico`}\n />\n </>\n ),\n charSet: 'utf-8',\n rootId: 'anansi-root',\n scripts: null,\n};\n","import React from 'react';\nimport type { Route } from '@anansi/router';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { ServerSpout } from './types';\nimport type { Policy } from './csp';\nimport Document from './DocumentComponent';\n\ntype NeededNext = {\n matchedRoutes: Route<any>[];\n title?: string;\n scripts?: React.ReactNode[];\n};\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId?: string;\n charSet?: string;\n csPolicy?: Policy;\n}): ServerSpout<Record<string, unknown>, Record<string, unknown>, NeededNext> {\n return next => async props => {\n const nextProps = await next(props);\n\n const publicPath = props.clientManifest.publicPath;\n\n if (\n Object.keys(props.clientManifest?.entrypoints ?? {}).length < 1 ||\n publicPath === undefined\n )\n throw new Error('Manifest missing entries needed');\n\n // TODO: consider using this package for build stats in future:\n // https://github.com/facebook/react/tree/main/packages/react-server-dom-webpack\n const assetMap = (assets: { name: string; size?: number }[]) =>\n assets.map(({ name }) => `${publicPath}${name}`);\n\n const assetList: string[] = [];\n Object.values(props.clientManifest?.entrypoints ?? {}).forEach(\n entrypoint => {\n assetList.push(...assetMap(entrypoint.assets ?? []));\n },\n );\n new Set(\n assetMap(\n Object.values(props.clientManifest.namedChunkGroups ?? {})\n .filter(({ name }) =>\n nextProps.matchedRoutes.some(route => name?.includes(route.name)),\n )\n .flatMap(chunk => [\n ...(chunk.assets ?? []),\n // any chunk preloads\n ...childrenAssets(chunk),\n ]),\n ),\n ).forEach(asset => assetList.push(asset));\n\n // find additional assets to preload based on matched route\n const assets: {\n href: string;\n as?: string | undefined;\n rel?: string | undefined;\n }[] = assetList\n .filter(asset => !asset.endsWith('.hot-update.js'))\n .map(asset =>\n asset.endsWith('.css')\n ? { href: asset, rel: 'stylesheet' }\n : asset.endsWith('.js')\n ? { href: asset, as: 'script' }\n : { href: asset },\n );\n\n return {\n ...nextProps,\n app: (\n <Document\n {...options}\n title={nextProps.title ?? options.title}\n assets={assets}\n rootId={options.rootId}\n nonce={props.nonce}\n csPolicy={options.csPolicy}\n scripts={nextProps.scripts}\n >\n {nextProps.app}\n </Document>\n ),\n };\n };\n}\n\nfunction childrenAssets(chunk: StatsChunkGroup) {\n return chunk.children\n ? Object.values(chunk.children).flatMap(preload =>\n preload.flatMap(c => c.assets ?? []),\n )\n : [];\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"rest-hooks\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"redux\");","import { ExternalCacheProvider, PromiseifyMiddleware } from 'rest-hooks';\nimport {\n Controller,\n createReducer,\n initialState,\n Manager,\n applyManager,\n NetworkManager,\n} from '@rest-hooks/core';\nimport { createStore, applyMiddleware } from 'redux';\n\n// TODO: Rework this and upstream to rest hooks\nexport function createPersistedStore(managers?: Manager[]) {\n const controller = new Controller();\n managers = managers ?? [new NetworkManager()];\n const reducer = createReducer(controller);\n const enhancer = applyMiddleware(\n ...applyManager(managers, controller),\n PromiseifyMiddleware as any,\n );\n const store = createStore(reducer, initialState as any, enhancer);\n managers.forEach(manager => manager.init?.(store.getState()));\n\n const selector = (state: any) => state;\n function ServerCacheProvider({ children }: { children: React.ReactNode }) {\n return (\n <ExternalCacheProvider\n store={store}\n selector={selector}\n controller={controller}\n >\n {children}\n </ExternalCacheProvider>\n );\n }\n return [ServerCacheProvider, controller, store] as const;\n}\n","import { Controller, Manager, NetworkManager, State } from '@rest-hooks/core';\nimport type { Store } from 'redux';\n\nimport { createPersistedStore } from './rhHelp';\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown> }\n> {\n return next => async props => {\n const [ServerCacheProvider, controller, store] = createPersistedStore(\n options.getManagers(),\n );\n\n const nextProps = await next({\n ...props,\n controller,\n store,\n });\n\n return {\n ...nextProps,\n initData: {\n ...nextProps.initData,\n resthooks: () => store.getState(),\n },\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n // TODO: figure out how to only inject in next and not have to also put here\n controller,\n store,\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createMemoryHistory } from 'history';\n\nimport type { CreateRouter, ServerSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n}): ServerSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider router={router} resolveWith={resolveWith}>\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const url = props.req.url || '';\n const router = options.createRouter(\n createMemoryHistory({ initialEntries: [url] }),\n );\n const matchedRoutes: Route<ResolveWith>[] = router.getMatchedRoutes(url);\n\n const nextProps = await next({\n ...props,\n matchedRoutes,\n router,\n });\n\n const Router = createRouteComponent(router);\n\n return {\n ...nextProps,\n app: <Router>{nextProps.app}</Router>,\n // TODO: figure out how to only inject in next and not have to also put here\n matchedRoutes,\n router,\n };\n };\n}\n","import { Route } from '@anansi/router';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps<RouteWith> = {\n matchedRoutes: Route<RouteWith>[];\n} & ResolveProps;\n\nexport default function prefetchSpout<F extends string>(field: F) {\n return function <\n RouteWith,\n N extends NeededProps<RouteWith>,\n I extends ServerProps,\n >(\n next: (props: I) => Promise<\n {\n [K in F]: RouteWith;\n } & N\n >,\n ) {\n return async (props: I) => {\n const nextProps = await next(props);\n\n try {\n const toFetch: Promise<unknown>[] = [];\n nextProps.matchedRoutes.forEach(route => {\n if (typeof route.resolveData === 'function') {\n toFetch.push(route.resolveData(nextProps[field], route));\n }\n });\n await Promise.all(toFetch);\n } catch (e) {\n console.error(e);\n }\n return nextProps;\n };\n };\n}\n","import React from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n};\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n /*\n Object.entries(nextProps.initData ?? {}).forEach(([key, data]) => {\n try {\n const encoded = JSON.stringify(data);\n scripts.push(\n <script\n key={key}\n id={`${id}-${key}`}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />,\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error(e);\n }\n });*/\n const Script = () => {\n try {\n const data: any = {};\n Object.entries(nextProps.initData ?? {}).forEach(([key, getData]) => {\n data[key] = getData();\n });\n const encoded = JSON.stringify(data);\n return (\n <script\n key={id}\n id={id}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error('Error serializing json');\n console.error(e);\n return null;\n }\n };\n scripts.push(<Script />);\n\n return {\n ...nextProps,\n scripts,\n };\n };\n}\n","import { ServerProps } from './types';\n\nconst appSpout =\n (app: JSX.Element) =>\n <P extends ServerProps>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","export { default as laySpouts } from './laySpouts';\nexport { default as documentSpout } from './spouts/document.server';\nexport { default as restHooksSpout } from './spouts/restHooks.server';\nexport { default as routerSpout } from './spouts/router.server';\nexport { default as prefetchSpout } from './spouts/prefetch.server';\nexport { default as JSONSpout } from './spouts/json.server';\nexport { default as appSpout } from './spouts/app.server';\nexport type { ServerProps } from './spouts/types';\nexport type { ServerSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"server.js","mappings":"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","sources":["/home/ntucker/src/anansi/packages/core/webpack/bootstrap","/home/ntucker/src/anansi/packages/core/webpack/runtime/compat get default export","/home/ntucker/src/anansi/packages/core/webpack/runtime/define property getters","/home/ntucker/src/anansi/packages/core/webpack/runtime/hasOwnProperty shorthand","/home/ntucker/src/anansi/packages/core/webpack/runtime/make namespace object","/home/ntucker/src/anansi/packages/core/external commonjs \"react-dom/server\"","/home/ntucker/src/anansi/packages/core/external node-commonjs \"crypto\"","/home/ntucker/src/anansi/packages/core/src/laySpouts.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"react\"","/home/ntucker/src/anansi/packages/core/src/spouts/csp.ts","/home/ntucker/src/anansi/packages/core/src/spouts/DocumentComponent.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/document.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@rest-hooks/core\"","/home/ntucker/src/anansi/packages/core/external commonjs \"rest-hooks\"","/home/ntucker/src/anansi/packages/core/external commonjs \"redux\"","/home/ntucker/src/anansi/packages/core/src/spouts/rhHelp.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/restHooks.server.tsx","/home/ntucker/src/anansi/packages/core/external commonjs \"@anansi/router\"","/home/ntucker/src/anansi/packages/core/external commonjs \"history\"","/home/ntucker/src/anansi/packages/core/src/spouts/router.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/prefetch.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/json.server.tsx","/home/ntucker/src/anansi/packages/core/src/spouts/app.server.tsx","/home/ntucker/src/anansi/packages/core/src/index.server.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react-dom/server\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto\");","import { renderToPipeableStream as reactRender } from 'react-dom/server';\nimport crypto from 'crypto';\n\nimport { Render } from './scripts/types';\nimport { ServerProps } from './spouts/types';\n\nexport default function laySpouts(\n spouts: (props: ServerProps) => Promise<{\n app: JSX.Element;\n }>,\n {\n timeoutMS = 200,\n onError,\n }: { timeoutMS?: number; onError?: (error: unknown) => void } = {},\n) {\n const render: Render = async (clientManifest, req, res) => {\n const nonce = crypto.randomBytes(16).toString('base64');\n\n try {\n const { app } = await spouts({ clientManifest, req, res, nonce });\n\n let didError = false;\n const { pipe, abort } = reactRender(app, {\n nonce,\n //bootstrapScripts: assets.filter(asset => asset.endsWith('.js')),\n onShellReady() {\n //managers.forEach(manager => manager.cleanup());\n // If something errored before we started streaming, we set the error code appropriately.\n res.statusCode = didError ? 500 : 200;\n res.setHeader('Content-type', 'text/html');\n pipe(res);\n },\n onShellError() {\n didError = true;\n res.statusCode = 500;\n pipe(res);\n },\n onError(e: any) {\n didError = true;\n console.error(e);\n res.statusCode = 500;\n //pipe(res); Removing this avoids, \"React currently only supports piping to one writable stream.\"\n if (onError) onError(e);\n },\n });\n // Abandon and switch to client rendering if enough time passes.\n // Try lowering this to see the client recover.\n setTimeout(\n () => (abort as any)(`Timeout of ${timeoutMS}ms exceeded`),\n timeoutMS,\n );\n } catch (e: unknown) {\n if (onError) onError(e);\n throw e;\n }\n };\n return render;\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","export interface Policy {\n [directive: string]: string | string[];\n}\n\n// TODO: memoize this\nexport function buildPolicy(policyObj: Policy) {\n return Object.keys(policyObj)\n .map(key => {\n const val = Array.isArray(policyObj[key])\n ? [...new Set(policyObj[key]).values()].filter(v => v).join(' ')\n : policyObj[key];\n\n // move strict dynamic to the end of the policy if it exists to be backwards compatible with csp2\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#strict-dynamic\n if (typeof val === 'string' && val.includes(\"'strict-dynamic'\")) {\n const newVal = `${val\n .replace(/\\s?'strict-dynamic'\\s?/gi, ' ')\n .trim()} 'strict-dynamic'`;\n return `${key} ${newVal}`;\n }\n\n return `${key} ${val}`;\n })\n .join('; ');\n}\n","import type { Policy } from './csp';\nimport { buildPolicy } from './csp';\n\ntype Props = {\n children: React.ReactNode;\n assets: { href: string; as?: string; rel?: string }[];\n head: React.ReactNode;\n scripts: React.ReactNode;\n title: string;\n rootId: string;\n charSet: string;\n csPolicy?: Policy;\n nonce?: string | undefined;\n};\n\nexport default function Document({\n assets,\n head,\n children,\n title,\n rootId,\n charSet,\n csPolicy,\n nonce,\n scripts,\n}: Props) {\n let cspMeta: null | React.ReactNode = null;\n if (csPolicy) {\n // add nonce to policy\n const policy = {\n ...csPolicy,\n };\n if (\n nonce &&\n // nonces negate 'unsafe-inline' so do not add it if that directive exists\n (!policy['script-src'] ||\n !policy['script-src'].includes(\"'unsafe-inline'\"))\n ) {\n if (typeof policy['script-src'] === 'string') {\n policy['script-src'] = [policy['script-src'], `'nonce-${nonce}'`];\n } else {\n policy['script-src'] = [...policy['script-src'], `'nonce-${nonce}'`];\n }\n }\n cspMeta = (\n <meta httpEquiv=\"Content-Security-Policy\" content={buildPolicy(policy)} />\n );\n }\n return (\n <html>\n <head>\n <meta charSet={charSet} />\n {cspMeta}\n {head}\n {assets.map((asset, i) => (\n <link key={i} rel=\"preload\" {...asset} />\n ))}\n <title>{title}</title>\n </head>\n <body>\n <div id={rootId}>{children}</div>\n {scripts}\n {assets\n .filter(({ href }) => href.endsWith('.js'))\n .map(({ href }, i) => (\n <script key={i} src={href} async />\n ))}\n </body>\n </html>\n );\n}\nDocument.defaultProps = {\n head: (\n <>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link\n rel=\"shortcut icon\"\n href={`${process.env.WEBPACK_PUBLIC_PATH ?? '/'}favicon.ico`}\n />\n </>\n ),\n charSet: 'utf-8',\n rootId: 'anansi-root',\n scripts: null,\n};\n","import React from 'react';\nimport type { Route } from '@anansi/router';\nimport { StatsChunkGroup } from 'webpack';\n\nimport type { ServerSpout } from './types';\nimport type { Policy } from './csp';\nimport Document from './DocumentComponent';\n\ntype NeededNext = {\n matchedRoutes: Route<any>[];\n title?: string;\n scripts?: React.ReactNode[];\n};\n\nexport default function DocumentSpout(options: {\n head?: React.ReactNode;\n title: string;\n rootId?: string;\n charSet?: string;\n csPolicy?: Policy;\n}): ServerSpout<Record<string, unknown>, Record<string, unknown>, NeededNext> {\n return next => async props => {\n const nextProps = await next(props);\n\n const publicPath = props.clientManifest.publicPath;\n\n if (\n Object.keys(props.clientManifest?.entrypoints ?? {}).length < 1 ||\n publicPath === undefined\n )\n throw new Error('Manifest missing entries needed');\n\n // TODO: consider using this package for build stats in future:\n // https://github.com/facebook/react/tree/main/packages/react-server-dom-webpack\n const assetMap = (assets: { name: string; size?: number }[]) =>\n assets.map(({ name }) => `${publicPath}${name}`);\n\n const assetList: string[] = [];\n Object.values(props.clientManifest?.entrypoints ?? {}).forEach(\n entrypoint => {\n assetList.push(...assetMap(entrypoint.assets ?? []));\n },\n );\n new Set(\n assetMap(\n Object.values(props.clientManifest.namedChunkGroups ?? {})\n .filter(({ name }) =>\n nextProps.matchedRoutes.some(route => name?.includes(route.name)),\n )\n .flatMap(chunk => [\n ...(chunk.assets ?? []),\n // any chunk preloads\n ...childrenAssets(chunk),\n ]),\n ),\n ).forEach(asset => assetList.push(asset));\n\n // find additional assets to preload based on matched route\n const assets: {\n href: string;\n as?: string | undefined;\n rel?: string | undefined;\n }[] = assetList\n .filter(asset => !asset.endsWith('.hot-update.js'))\n .map(asset =>\n asset.endsWith('.css')\n ? { href: asset, rel: 'stylesheet' }\n : asset.endsWith('.js')\n ? { href: asset, as: 'script' }\n : { href: asset },\n );\n\n return {\n ...nextProps,\n app: (\n <Document\n {...options}\n title={nextProps.title ?? options.title}\n assets={assets}\n rootId={options.rootId}\n nonce={props.nonce}\n csPolicy={options.csPolicy}\n scripts={nextProps.scripts}\n >\n {nextProps.app}\n </Document>\n ),\n };\n };\n}\n\nfunction childrenAssets(chunk: StatsChunkGroup) {\n return chunk.children\n ? Object.values(chunk.children).flatMap(preload =>\n preload.flatMap(c => c.assets ?? []),\n )\n : [];\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@rest-hooks/core\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"rest-hooks\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"redux\");","import { ExternalCacheProvider, PromiseifyMiddleware } from 'rest-hooks';\nimport {\n Controller,\n createReducer,\n initialState,\n Manager,\n applyManager,\n NetworkManager,\n} from '@rest-hooks/core';\nimport { createStore, applyMiddleware } from 'redux';\n\n// TODO: Rework this and upstream to rest hooks\nexport function createPersistedStore(managers?: Manager[]) {\n const controller = new Controller();\n managers = managers ?? [new NetworkManager()];\n const reducer = createReducer(controller);\n const enhancer = applyMiddleware(\n ...applyManager(managers, controller),\n PromiseifyMiddleware as any,\n );\n const store = createStore(reducer, initialState as any, enhancer);\n managers.forEach(manager => manager.init?.(store.getState()));\n\n const selector = (state: any) => state;\n function ServerCacheProvider({ children }: { children: React.ReactNode }) {\n return (\n <ExternalCacheProvider\n store={store}\n selector={selector}\n controller={controller}\n >\n {children}\n </ExternalCacheProvider>\n );\n }\n return [ServerCacheProvider, controller, store] as const;\n}\n","import { Controller, Manager, NetworkManager, State } from '@rest-hooks/core';\nimport type { Store } from 'redux';\n\nimport { createPersistedStore } from './rhHelp';\nimport type { ServerSpout } from './types';\n\nexport default function restHooksSpout(\n options: {\n getManagers: () => Manager[];\n } = { getManagers: () => [new NetworkManager()] },\n): ServerSpout<\n Record<string, unknown>,\n { controller: Controller } & { store: Store<State<unknown>> },\n { initData?: Record<string, () => unknown> }\n> {\n return next => async props => {\n const [ServerCacheProvider, controller, store] = createPersistedStore(\n options.getManagers(),\n );\n\n const nextProps = await next({\n ...props,\n controller,\n store,\n });\n\n return {\n ...nextProps,\n initData: {\n ...nextProps.initData,\n resthooks: () => store.getState(),\n },\n app: <ServerCacheProvider>{nextProps.app}</ServerCacheProvider>,\n // TODO: figure out how to only inject in next and not have to also put here\n controller,\n store,\n };\n };\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@anansi/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","import { Route, RouteProvider, RouteController } from '@anansi/router';\nimport React from 'react';\nimport { createMemoryHistory } from 'history';\n\nimport type { CreateRouter, ServerSpout } from './types';\n\nexport default function routerSpout<ResolveWith>(options: {\n resolveWith?: any;\n useResolveWith: () => ResolveWith;\n createRouter: CreateRouter<ResolveWith>;\n}): ServerSpout<\n Record<string, unknown>,\n {\n matchedRoutes: Route<ResolveWith>[];\n } & {\n router: RouteController<Route<ResolveWith, any>>;\n }\n> {\n const createRouteComponent = (\n router: RouteController<Route<ResolveWith, any>>,\n ) =>\n function Router({ children }: { children: React.ReactNode }) {\n const resolveWith = options.useResolveWith();\n\n return (\n <RouteProvider router={router} resolveWith={resolveWith}>\n {children}\n </RouteProvider>\n );\n };\n\n return next => async props => {\n const url = props.req.url || '';\n const router = options.createRouter(\n createMemoryHistory({ initialEntries: [url] }),\n );\n const matchedRoutes: Route<ResolveWith>[] = router.getMatchedRoutes(url);\n\n const nextProps = await next({\n ...props,\n matchedRoutes,\n router,\n });\n\n const Router = createRouteComponent(router);\n\n return {\n ...nextProps,\n app: <Router>{nextProps.app}</Router>,\n // TODO: figure out how to only inject in next and not have to also put here\n matchedRoutes,\n router,\n };\n };\n}\n","import { Route } from '@anansi/router';\n\nimport type { ResolveProps, ServerProps } from './types';\n\ntype NeededProps<RouteWith> = {\n matchedRoutes: Route<RouteWith>[];\n} & ResolveProps;\n\nexport default function prefetchSpout<F extends string>(field: F) {\n return function <\n RouteWith,\n N extends NeededProps<RouteWith>,\n I extends ServerProps,\n >(\n next: (props: I) => Promise<\n {\n [K in F]: RouteWith;\n } & N\n >,\n ) {\n return async (props: I) => {\n const nextProps = await next(props);\n\n try {\n const toFetch: Promise<unknown>[] = [];\n nextProps.matchedRoutes.forEach(route => {\n if (typeof route.resolveData === 'function') {\n toFetch.push(route.resolveData(nextProps[field], route));\n }\n });\n await Promise.all(toFetch);\n } catch (e) {\n console.error(e);\n }\n return nextProps;\n };\n };\n}\n","import React from 'react';\n\nimport type { ServerSpout } from './types';\n\ntype NeededNext = {\n initData?: Record<string, () => unknown>;\n scripts?: React.ReactNode[];\n};\n\nexport default function JSONSpout({\n id = 'anansi-json',\n}: { id?: string } = {}): ServerSpout<\n Record<string, unknown>,\n Record<string, unknown>,\n NeededNext\n> {\n return next => async props => {\n const nextProps = await next(props);\n\n const scripts: React.ReactNode[] = nextProps.scripts ?? [];\n /*\n Object.entries(nextProps.initData ?? {}).forEach(([key, data]) => {\n try {\n const encoded = JSON.stringify(data);\n scripts.push(\n <script\n key={key}\n id={`${id}-${key}`}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />,\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error(e);\n }\n });*/\n const Script = () => {\n try {\n const data: any = {};\n Object.entries(nextProps.initData ?? {}).forEach(([key, getData]) => {\n data[key] = getData();\n });\n const encoded = JSON.stringify(data);\n return (\n <script\n key={id}\n id={id}\n type=\"application/json\"\n dangerouslySetInnerHTML={{\n __html: encoded,\n }}\n nonce={props.nonce}\n />\n );\n } catch (e) {\n // TODO: Use unified logging\n console.error('Error serializing json');\n console.error(e);\n return null;\n }\n };\n scripts.push(<Script />);\n\n return {\n ...nextProps,\n scripts,\n };\n };\n}\n","import { ServerProps } from './types';\n\nconst appSpout =\n (app: JSX.Element) =>\n <P extends ServerProps>(props: P) =>\n Promise.resolve({ ...props, app });\n\nexport default appSpout;\n","export { default as laySpouts } from './laySpouts';\nexport { default as documentSpout } from './spouts/document.server';\nexport { default as restHooksSpout } from './spouts/restHooks.server';\nexport { default as routerSpout } from './spouts/router.server';\nexport { default as prefetchSpout } from './spouts/prefetch.server';\nexport { default as JSONSpout } from './spouts/json.server';\nexport { default as appSpout } from './spouts/app.server';\nexport type { ServerProps } from './spouts/types';\nexport type { ServerSpout as Spout } from './spouts/types';\n"],"names":[],"sourceRoot":""}
|
package/lib/floodSpouts.d.ts
CHANGED
package/lib/floodSpouts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floodSpouts.d.ts","sourceRoot":"","sources":["../src/floodSpouts.tsx"],"names":[],"mappings":"AAEA,wBAA8B,WAAW,CACvC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;IAClD,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EAAE,MAAsB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBAKrD"}
|
|
1
|
+
{"version":3,"file":"floodSpouts.d.ts","sourceRoot":"","sources":["../src/floodSpouts.tsx"],"names":[],"mappings":";AAEA,wBAA8B,WAAW,CACvC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;IAClD,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EAAE,MAAsB,EAAE,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBAKrD"}
|
package/lib/laySpouts.d.ts
CHANGED
package/lib/laySpouts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"laySpouts.d.ts","sourceRoot":"","sources":["../src/laySpouts.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC;IACtC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EACE,SAAe,EACf,OAAO,GACR,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAO,UA4CnE"}
|
|
1
|
+
{"version":3,"file":"laySpouts.d.ts","sourceRoot":"","sources":["../src/laySpouts.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC;IACtC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC,EACF,EACE,SAAe,EACf,OAAO,GACR,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAO,UA4CnE"}
|
package/lib/spouts/app.d.ts
CHANGED
package/lib/spouts/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/spouts/app.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ,QACN,WAAW;;EAEmB,CAAC;AAEvC,eAAe,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/spouts/app.tsx"],"names":[],"mappings":";AAAA,QAAA,MAAM,QAAQ,QACN,WAAW;;EAEmB,CAAC;AAEvC,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.server.d.ts","sourceRoot":"","sources":["../../src/spouts/app.server.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,QAAA,MAAM,QAAQ,QACN,WAAW;;EAEmB,CAAC;AAEvC,eAAe,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"app.server.d.ts","sourceRoot":"","sources":["../../src/spouts/app.server.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,QAAA,MAAM,QAAQ,QACN,WAAW;;EAEmB,CAAC;AAEvC,eAAe,QAAQ,CAAC"}
|
package/lib/spouts/json.js
CHANGED
|
@@ -18,6 +18,11 @@ function JSONSpout({
|
|
|
18
18
|
|
|
19
19
|
function getDatafromDOM(id) {
|
|
20
20
|
const element = document.querySelector(`#${id}`);
|
|
21
|
+
|
|
22
|
+
if (element && element.text === undefined) {
|
|
23
|
+
console.error(`#${id} is completely empty. This could be due to CSP issues.`);
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
return element != null && element.text ? JSON.parse(element == null ? void 0 : element.text) : undefined;
|
|
22
27
|
}
|
|
23
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJKU09OU3BvdXQiLCJpZCIsIm5leHQiLCJwcm9wcyIsImluaXREYXRhIiwiZ2V0RGF0YWZyb21ET00iLCJlbGVtZW50IiwiZG9jdW1lbnQiLCJxdWVyeVNlbGVjdG9yIiwidGV4dCIsInVuZGVmaW5lZCIsImNvbnNvbGUiLCJlcnJvciIsIkpTT04iLCJwYXJzZSJdLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zcG91dHMvanNvbi50c3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBDbGllbnRTcG91dCB9IGZyb20gJy4vdHlwZXMnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBKU09OU3BvdXQoe1xuICBpZCA9ICdhbmFuc2ktanNvbicsXG59OiB7IGlkPzogc3RyaW5nIH0gPSB7fSk6IENsaWVudFNwb3V0PFxuICBSZWNvcmQ8c3RyaW5nLCB1bmtub3duPixcbiAgeyBpbml0RGF0YTogUmVjb3JkPHN0cmluZywgdW5rbm93bj4gfVxuPiB7XG4gIHJldHVybiBuZXh0ID0+IGFzeW5jIHByb3BzID0+IHtcbiAgICBjb25zdCBpbml0RGF0YSA9IGdldERhdGFmcm9tRE9NKGlkKTtcbiAgICByZXR1cm4geyAuLi4oYXdhaXQgbmV4dCh7IC4uLnByb3BzLCBpbml0RGF0YSB9KSksIGluaXREYXRhIH07XG4gIH07XG59XG5mdW5jdGlvbiBnZXREYXRhZnJvbURPTShpZDogc3RyaW5nKTogUmVjb3JkPHN0cmluZywgdW5rbm93bj4ge1xuICBjb25zdCBlbGVtZW50OiBIVE1MU2NyaXB0RWxlbWVudCB8IG51bGwgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGAjJHtpZH1gKTtcbiAgaWYgKGVsZW1lbnQgJiYgZWxlbWVudC50ZXh0ID09PSB1bmRlZmluZWQpIHtcbiAgICBjb25zb2xlLmVycm9yKFxuICAgICAgYCMke2lkfSBpcyBjb21wbGV0ZWx5IGVtcHR5LiBUaGlzIGNvdWxkIGJlIGR1ZSB0byBDU1AgaXNzdWVzLmAsXG4gICAgKTtcbiAgfVxuICByZXR1cm4gZWxlbWVudD8udGV4dCA/IEpTT04ucGFyc2UoZWxlbWVudD8udGV4dCkgOiB1bmRlZmluZWQ7XG59XG4iXSwibWFwcGluZ3MiOiI7Ozs7O0FBRWUsU0FBU0EsU0FBVCxDQUFtQjtFQUNoQ0MsRUFBRSxHQUFHO0FBRDJCLElBRWIsRUFGTixFQUtiO0VBQ0EsT0FBT0MsSUFBSSxJQUFJLE1BQU1DLEtBQU4sSUFBZTtJQUM1QixNQUFNQyxRQUFRLEdBQUdDLGNBQWMsQ0FBQ0osRUFBRCxDQUEvQjtJQUNBLE9BQU8sRUFBRSxJQUFJLE1BQU1DLElBQUksQ0FBQyxFQUFFLEdBQUdDLEtBQUw7UUFBWUM7TUFBWixDQUFELENBQWQsQ0FBRjtNQUEyQ0E7SUFBM0MsQ0FBUDtFQUNELENBSEQ7QUFJRDs7QUFDRCxTQUFTQyxjQUFULENBQXdCSixFQUF4QixFQUE2RDtFQUMzRCxNQUFNSyxPQUFpQyxHQUFHQyxRQUFRLENBQUNDLGFBQVQsQ0FBd0IsSUFBR1AsRUFBRyxFQUE5QixDQUExQzs7RUFDQSxJQUFJSyxPQUFPLElBQUlBLE9BQU8sQ0FBQ0csSUFBUixLQUFpQkMsU0FBaEMsRUFBMkM7SUFDekNDLE9BQU8sQ0FBQ0MsS0FBUixDQUNHLElBQUdYLEVBQUcsd0RBRFQ7RUFHRDs7RUFDRCxPQUFPSyxPQUFPLFFBQVAsSUFBQUEsT0FBTyxDQUFFRyxJQUFULEdBQWdCSSxJQUFJLENBQUNDLEtBQUwsQ0FBV1IsT0FBWCxvQkFBV0EsT0FBTyxDQUFFRyxJQUFwQixDQUFoQixHQUE0Q0MsU0FBbkQ7QUFDRCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restHooks.d.ts","sourceRoot":"","sources":["../../src/spouts/restHooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAGR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,GAAE;IACP,WAAW,EAAE,MAAM,OAAO,EAAE,CAAC;CACkB,GAChD,WAAW,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"restHooks.d.ts","sourceRoot":"","sources":["../../src/spouts/restHooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EAGR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,GAAE;IACP,WAAW,EAAE,MAAM,OAAO,EAAE,CAAC;CACkB,GAChD,WAAW,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,CAmBpD"}
|
package/lib/spouts/restHooks.js
CHANGED
|
@@ -15,7 +15,14 @@ function restHooksSpout(options = {
|
|
|
15
15
|
getManagers: () => [new _core.NetworkManager()]
|
|
16
16
|
}) {
|
|
17
17
|
return next => async props => {
|
|
18
|
-
|
|
18
|
+
var _props$initData;
|
|
19
|
+
|
|
20
|
+
const data = (_props$initData = props.initData) == null ? void 0 : _props$initData.resthooks;
|
|
21
|
+
|
|
22
|
+
if (process.env.NODE_ENV !== 'production' && !data) {
|
|
23
|
+
console.error('Rest Hooks init data not found');
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
const nextProps = await next(props);
|
|
20
27
|
return { ...nextProps,
|
|
21
28
|
app: /*#__PURE__*/(0, _jsx2.default)(_core.CacheProvider, {
|
|
@@ -25,4 +32,4 @@ function restHooksSpout(options = {
|
|
|
25
32
|
};
|
|
26
33
|
};
|
|
27
34
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZXN0SG9va3NTcG91dCIsIm9wdGlvbnMiLCJnZXRNYW5hZ2VycyIsIk5ldHdvcmtNYW5hZ2VyIiwibmV4dCIsInByb3BzIiwiZGF0YSIsImluaXREYXRhIiwicmVzdGhvb2tzIiwicHJvY2VzcyIsImVudiIsIk5PREVfRU5WIiwiY29uc29sZSIsImVycm9yIiwibmV4dFByb3BzIiwiYXBwIl0sInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Nwb3V0cy9yZXN0SG9va3MudHN4Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7XG4gIENhY2hlUHJvdmlkZXIsXG4gIE1hbmFnZXIsXG4gIE5ldHdvcmtNYW5hZ2VyLFxuICBTdGF0ZSxcbn0gZnJvbSAnQHJlc3QtaG9va3MvY29yZSc7XG5cbmltcG9ydCB0eXBlIHsgQ2xpZW50U3BvdXQgfSBmcm9tICcuL3R5cGVzJztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gcmVzdEhvb2tzU3BvdXQoXG4gIG9wdGlvbnM6IHtcbiAgICBnZXRNYW5hZ2VyczogKCkgPT4gTWFuYWdlcltdO1xuICB9ID0geyBnZXRNYW5hZ2VyczogKCkgPT4gW25ldyBOZXR3b3JrTWFuYWdlcigpXSB9LFxuKTogQ2xpZW50U3BvdXQ8eyBpbml0RGF0YTogUmVjb3JkPHN0cmluZywgdW5rbm93bj4gfT4ge1xuICByZXR1cm4gbmV4dCA9PiBhc3luYyBwcm9wcyA9PiB7XG4gICAgY29uc3QgZGF0YSA9IHByb3BzLmluaXREYXRhPy5yZXN0aG9va3MgYXMgU3RhdGU8dW5rbm93bj47XG5cbiAgICBpZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm9kdWN0aW9uJyAmJiAhZGF0YSkge1xuICAgICAgY29uc29sZS5lcnJvcignUmVzdCBIb29rcyBpbml0IGRhdGEgbm90IGZvdW5kJyk7XG4gICAgfVxuXG4gICAgY29uc3QgbmV4dFByb3BzID0gYXdhaXQgbmV4dChwcm9wcyk7XG5cbiAgICByZXR1cm4ge1xuICAgICAgLi4ubmV4dFByb3BzLFxuICAgICAgYXBwOiAoXG4gICAgICAgIDxDYWNoZVByb3ZpZGVyIGluaXRpYWxTdGF0ZT17ZGF0YX0gbWFuYWdlcnM9e29wdGlvbnMuZ2V0TWFuYWdlcnMoKX0+XG4gICAgICAgICAge25leHRQcm9wcy5hcHB9XG4gICAgICAgIDwvQ2FjaGVQcm92aWRlcj5cbiAgICAgICksXG4gICAgfTtcbiAgfTtcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFBQTs7QUFTZSxTQUFTQSxjQUFULENBQ2JDLE9BRUMsR0FBRztFQUFFQyxXQUFXLEVBQUUsTUFBTSxDQUFDLElBQUlDLG9CQUFKLEVBQUQ7QUFBckIsQ0FIUyxFQUl1QztFQUNwRCxPQUFPQyxJQUFJLElBQUksTUFBTUMsS0FBTixJQUFlO0lBQUE7O0lBQzVCLE1BQU1DLElBQUksc0JBQUdELEtBQUssQ0FBQ0UsUUFBVCxxQkFBRyxnQkFBZ0JDLFNBQTdCOztJQUVBLElBQUlDLE9BQU8sQ0FBQ0MsR0FBUixDQUFZQyxRQUFaLEtBQXlCLFlBQXpCLElBQXlDLENBQUNMLElBQTlDLEVBQW9EO01BQ2xETSxPQUFPLENBQUNDLEtBQVIsQ0FBYyxnQ0FBZDtJQUNEOztJQUVELE1BQU1DLFNBQVMsR0FBRyxNQUFNVixJQUFJLENBQUNDLEtBQUQsQ0FBNUI7SUFFQSxPQUFPLEVBQ0wsR0FBR1MsU0FERTtNQUVMQyxHQUFHLGVBQ0QsbUJBQUMsbUJBQUQ7UUFBZSxZQUFZLEVBQUVULElBQTdCO1FBQW1DLFFBQVEsRUFBRUwsT0FBTyxDQUFDQyxXQUFSO01BQTdDLFdBQ0dZLFNBQVMsQ0FBQ0MsR0FEYjtJQUhHLENBQVA7RUFRRCxDQWpCRDtBQWtCRCJ9
|
package/lib/spouts/rhHelp.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rhHelp.d.ts","sourceRoot":"","sources":["../../src/spouts/rhHelp.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAGV,OAAO,EAGR,MAAM,kBAAkB,CAAC;AAI1B,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE;cAYA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAYvE"}
|
|
1
|
+
{"version":3,"file":"rhHelp.d.ts","sourceRoot":"","sources":["../../src/spouts/rhHelp.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,UAAU,EAGV,OAAO,EAGR,MAAM,kBAAkB,CAAC;AAI1B,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE;cAYA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAYvE"}
|
package/lib/spouts/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/spouts/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/spouts/types.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGxD,oBAAY,WAAW,GAAG;IACxB,GAAG,EAAE,OAAO,GAAG,eAAe,CAAC;IAC/B,GAAG,EAAE,QAAQ,GAAG,cAAc,CAAC;IAC/B,cAAc,EAAE,gBAAgB,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAGF,oBAAY,YAAY,GAAG;IACzB,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,YAAY,CAAC,CAAC,IAAI,CAC5B,OAAO,EAAE,OAAO,KACb,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;AAGpC,oBAAY,WAAW,CACrB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE,CAAC,CAAC,SAAS,UAAU,GAAG,YAAY,EAAE,CAAC,SAAS,WAAW,EAC7D,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,KAC3C,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;AAG5D,oBAAY,WAAW,CACrB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAClE,CAAC,CAAC,SAAS,UAAU,GAAG,YAAY,EAAE,CAAC,EACzC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,KAC3C,CAAC,KAAK,EAAE,WAAW,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anansi/core",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.9",
|
|
4
4
|
"description": "React 18 Framework",
|
|
5
5
|
"homepage": "https://github.com/ntucker/anansi/tree/master/packages/core#readme",
|
|
6
6
|
"repository": {
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"browser"
|
|
66
66
|
],
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@anansi/babel-preset": "
|
|
68
|
+
"@anansi/babel-preset": "3.2.12",
|
|
69
69
|
"@anansi/browserslist-config": "1.3.3",
|
|
70
|
-
"@anansi/webpack-config": "
|
|
70
|
+
"@anansi/webpack-config": "13.0.0",
|
|
71
71
|
"@babel/cli": "7.18.9",
|
|
72
72
|
"@babel/core": "7.18.9",
|
|
73
73
|
"@types/compression": "^1.7.2",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"webpack-cli": "4.10.0"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@anansi/router": "^0.6.
|
|
83
|
+
"@anansi/router": "^0.6.11",
|
|
84
84
|
"@babel/runtime": "^7.10.5",
|
|
85
85
|
"@rest-hooks/ssr": "^0.2.0",
|
|
86
86
|
"chalk": "^4.0.0",
|
package/src/spouts/json.tsx
CHANGED
|
@@ -13,5 +13,10 @@ export default function JSONSpout({
|
|
|
13
13
|
}
|
|
14
14
|
function getDatafromDOM(id: string): Record<string, unknown> {
|
|
15
15
|
const element: HTMLScriptElement | null = document.querySelector(`#${id}`);
|
|
16
|
+
if (element && element.text === undefined) {
|
|
17
|
+
console.error(
|
|
18
|
+
`#${id} is completely empty. This could be due to CSP issues.`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
16
21
|
return element?.text ? JSON.parse(element?.text) : undefined;
|
|
17
22
|
}
|
package/src/spouts/restHooks.tsx
CHANGED
|
@@ -13,7 +13,11 @@ export default function restHooksSpout(
|
|
|
13
13
|
} = { getManagers: () => [new NetworkManager()] },
|
|
14
14
|
): ClientSpout<{ initData: Record<string, unknown> }> {
|
|
15
15
|
return next => async props => {
|
|
16
|
-
const data = props.initData
|
|
16
|
+
const data = props.initData?.resthooks as State<unknown>;
|
|
17
|
+
|
|
18
|
+
if (process.env.NODE_ENV !== 'production' && !data) {
|
|
19
|
+
console.error('Rest Hooks init data not found');
|
|
20
|
+
}
|
|
17
21
|
|
|
18
22
|
const nextProps = await next(props);
|
|
19
23
|
|