@theholocron/react-template 0.5.3 → 0.5.4
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/README.md +12 -0
- package/dist/mockServiceWorker.js +301 -286
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ A modern React template with pre-configured tools, best practices, and CI/CD set
|
|
|
6
6
|
|
|
7
7
|
<!-- /holocron:description -->
|
|
8
8
|
|
|
9
|
+
<!-- holocron:template-only -->
|
|
10
|
+
|
|
9
11
|
## Getting Started
|
|
10
12
|
|
|
11
13
|
Use the [Holocron CLI](https://github.com/theholocron/holocron) to scaffold a new React project. It clones the template, renames all placeholder references, wires up your vault provider, and runs `holocron setup` in one step:
|
|
@@ -25,8 +27,12 @@ This will:
|
|
|
25
27
|
3. Run `pnpm install` (including Playwright browser download)
|
|
26
28
|
4. Run `holocron setup` to configure branch protection, labels, workflows, and repo settings
|
|
27
29
|
|
|
30
|
+
<!-- /holocron:template-only -->
|
|
31
|
+
|
|
28
32
|
## Development
|
|
29
33
|
|
|
34
|
+
<!-- holocron:development -->
|
|
35
|
+
|
|
30
36
|
This repo uses [pnpm workspaces](https://pnpm.io/workspaces).
|
|
31
37
|
|
|
32
38
|
```bash
|
|
@@ -39,6 +45,8 @@ pnpm typecheck # tsc --noEmit
|
|
|
39
45
|
pnpm lint # lint via super-linter (Docker)
|
|
40
46
|
```
|
|
41
47
|
|
|
48
|
+
<!-- /holocron:development -->
|
|
49
|
+
|
|
42
50
|
## What's Included
|
|
43
51
|
|
|
44
52
|
| Tool | Purpose |
|
|
@@ -57,4 +65,8 @@ pnpm lint # lint via super-linter (Docker)
|
|
|
57
65
|
|
|
58
66
|
## Releases
|
|
59
67
|
|
|
68
|
+
<!-- holocron:releases -->
|
|
69
|
+
|
|
60
70
|
Releases are automated via [semantic-release](https://semantic-release.gitbook.io) on push to `main`. See [CHANGELOG.md](CHANGELOG.md) for the release history.
|
|
71
|
+
|
|
72
|
+
<!-- /holocron:releases -->
|
|
@@ -7,111 +7,114 @@
|
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const PACKAGE_VERSION =
|
|
11
|
-
const INTEGRITY_CHECKSUM =
|
|
12
|
-
const IS_MOCKED_RESPONSE = Symbol(
|
|
13
|
-
const activeClientIds = new Set()
|
|
14
|
-
|
|
15
|
-
addEventListener(
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
addEventListener(
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
addEventListener(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
addEventListener(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
10
|
+
const PACKAGE_VERSION = '2.15.0'
|
|
11
|
+
const INTEGRITY_CHECKSUM = '03cb67ac84128e63d7cd722a6e5b7f1e'
|
|
12
|
+
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
|
+
const activeClientIds = new Set()
|
|
14
|
+
|
|
15
|
+
addEventListener('install', function () {
|
|
16
|
+
self.skipWaiting()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
addEventListener('activate', function (event) {
|
|
20
|
+
event.waitUntil(self.clients.claim())
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
addEventListener('message', async function (event) {
|
|
24
|
+
const clientId = Reflect.get(event.source || {}, 'id')
|
|
25
|
+
|
|
26
|
+
if (!clientId || !self.clients) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const client = await self.clients.get(clientId)
|
|
31
|
+
|
|
32
|
+
if (!client) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const allClients = await self.clients.matchAll({
|
|
37
|
+
type: 'window',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
switch (event.data) {
|
|
41
|
+
case 'KEEPALIVE_REQUEST': {
|
|
42
|
+
sendToClient(client, {
|
|
43
|
+
type: 'KEEPALIVE_RESPONSE',
|
|
44
|
+
})
|
|
45
|
+
break
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
case 'INTEGRITY_CHECK_REQUEST': {
|
|
49
|
+
sendToClient(client, {
|
|
50
|
+
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
51
|
+
payload: {
|
|
52
|
+
packageVersion: PACKAGE_VERSION,
|
|
53
|
+
checksum: INTEGRITY_CHECKSUM,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
break
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case 'MOCK_ACTIVATE': {
|
|
60
|
+
activeClientIds.add(clientId)
|
|
61
|
+
|
|
62
|
+
sendToClient(client, {
|
|
63
|
+
type: 'MOCKING_ENABLED',
|
|
64
|
+
payload: {
|
|
65
|
+
client: {
|
|
66
|
+
id: client.id,
|
|
67
|
+
frameType: client.frameType,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
break
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
case 'CLIENT_CLOSED': {
|
|
75
|
+
activeClientIds.delete(clientId)
|
|
76
|
+
|
|
77
|
+
const remainingClients = allClients.filter((client) => {
|
|
78
|
+
return client.id !== clientId
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Unregister itself when there are no more clients
|
|
82
|
+
if (remainingClients.length === 0) {
|
|
83
|
+
self.registration.unregister()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
break
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
addEventListener('fetch', function (event) {
|
|
92
|
+
const requestInterceptedAt = Date.now()
|
|
93
|
+
|
|
94
|
+
// Bypass navigation requests.
|
|
95
|
+
if (event.request.mode === 'navigate') {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Opening the DevTools triggers the "only-if-cached" request
|
|
100
|
+
// that cannot be handled by the worker. Bypass such requests.
|
|
101
|
+
if (
|
|
102
|
+
event.request.cache === 'only-if-cached' &&
|
|
103
|
+
event.request.mode !== 'same-origin'
|
|
104
|
+
) {
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Bypass all requests when there are no active clients.
|
|
109
|
+
// Prevents the self-unregistered worked from handling requests
|
|
110
|
+
// after it's been terminated (still remains active until the next reload).
|
|
111
|
+
if (activeClientIds.size === 0) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const requestId = crypto.randomUUID()
|
|
116
|
+
event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
|
|
117
|
+
})
|
|
115
118
|
|
|
116
119
|
/**
|
|
117
120
|
* @param {FetchEvent} event
|
|
@@ -119,53 +122,60 @@ addEventListener("fetch", function (event) {
|
|
|
119
122
|
* @param {number} requestInterceptedAt
|
|
120
123
|
*/
|
|
121
124
|
async function handleRequest(event, requestId, requestInterceptedAt) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
125
|
+
const client = await resolveMainClient(event)
|
|
126
|
+
const requestCloneForEvents = event.request.clone()
|
|
127
|
+
const response = await getResponse(
|
|
128
|
+
event,
|
|
129
|
+
client,
|
|
130
|
+
requestId,
|
|
131
|
+
requestInterceptedAt,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
// Send back the response clone for the "response:*" life-cycle events.
|
|
135
|
+
// Ensure MSW is active and ready to handle the message, otherwise
|
|
136
|
+
// this message will pend indefinitely.
|
|
137
|
+
if (client && activeClientIds.has(client.id)) {
|
|
138
|
+
const serializedRequest = await serializeRequest(requestCloneForEvents)
|
|
139
|
+
|
|
140
|
+
// Omit the body of server-sent event stream responses.
|
|
141
|
+
// Cloning such responses would prevent client-side stream cancelations
|
|
142
|
+
// from reaching the original stream (a teed stream only cancels its
|
|
143
|
+
// source once both of its branches cancel) and would buffer the
|
|
144
|
+
// entire stream into the unconsumed clone indefinitely.
|
|
145
|
+
const isEventStreamResponse = response.headers
|
|
146
|
+
.get('content-type')
|
|
147
|
+
?.toLowerCase()
|
|
148
|
+
.startsWith('text/event-stream')
|
|
149
|
+
|
|
150
|
+
// Clone the response so both the client and the library could consume it.
|
|
151
|
+
const responseClone = isEventStreamResponse ? null : response.clone()
|
|
152
|
+
|
|
153
|
+
sendToClient(
|
|
154
|
+
client,
|
|
155
|
+
{
|
|
156
|
+
type: 'RESPONSE',
|
|
157
|
+
payload: {
|
|
158
|
+
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
|
159
|
+
request: {
|
|
160
|
+
id: requestId,
|
|
161
|
+
...serializedRequest,
|
|
162
|
+
},
|
|
163
|
+
response: {
|
|
164
|
+
type: response.type,
|
|
165
|
+
status: response.status,
|
|
166
|
+
statusText: response.statusText,
|
|
167
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
168
|
+
body: responseClone ? responseClone.body : null,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
responseClone && responseClone.body
|
|
173
|
+
? [serializedRequest.body, responseClone.body]
|
|
174
|
+
: [],
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return response
|
|
169
179
|
}
|
|
170
180
|
|
|
171
181
|
/**
|
|
@@ -177,30 +187,30 @@ async function handleRequest(event, requestId, requestInterceptedAt) {
|
|
|
177
187
|
* @returns {Promise<Client | undefined>}
|
|
178
188
|
*/
|
|
179
189
|
async function resolveMainClient(event) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
190
|
+
const client = await self.clients.get(event.clientId)
|
|
191
|
+
|
|
192
|
+
if (activeClientIds.has(event.clientId)) {
|
|
193
|
+
return client
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (client?.frameType === 'top-level') {
|
|
197
|
+
return client
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const allClients = await self.clients.matchAll({
|
|
201
|
+
type: 'window',
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
return allClients
|
|
205
|
+
.filter((client) => {
|
|
206
|
+
// Get only those clients that are currently visible.
|
|
207
|
+
return client.visibilityState === 'visible'
|
|
208
|
+
})
|
|
209
|
+
.find((client) => {
|
|
210
|
+
// Find the client ID that's recorded in the
|
|
211
|
+
// set of clients that have registered the worker.
|
|
212
|
+
return activeClientIds.has(client.id)
|
|
213
|
+
})
|
|
204
214
|
}
|
|
205
215
|
|
|
206
216
|
/**
|
|
@@ -211,72 +221,74 @@ async function resolveMainClient(event) {
|
|
|
211
221
|
* @returns {Promise<Response>}
|
|
212
222
|
*/
|
|
213
223
|
async function getResponse(event, client, requestId, requestInterceptedAt) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
224
|
+
// Clone the request because it might've been already used
|
|
225
|
+
// (i.e. its body has been read and sent to the client).
|
|
226
|
+
const requestClone = event.request.clone()
|
|
227
|
+
|
|
228
|
+
function passthrough() {
|
|
229
|
+
// Cast the request headers to a new Headers instance
|
|
230
|
+
// so the headers can be manipulated with.
|
|
231
|
+
const headers = new Headers(requestClone.headers)
|
|
232
|
+
|
|
233
|
+
// Remove the "accept" header value that marked this request as passthrough.
|
|
234
|
+
// This prevents request alteration and also keeps it compliant with the
|
|
235
|
+
// user-defined CORS policies.
|
|
236
|
+
const acceptHeader = headers.get('accept')
|
|
237
|
+
if (acceptHeader) {
|
|
238
|
+
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
239
|
+
const filteredValues = values.filter(
|
|
240
|
+
(value) => value !== 'msw/passthrough',
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
if (filteredValues.length > 0) {
|
|
244
|
+
headers.set('accept', filteredValues.join(', '))
|
|
245
|
+
} else {
|
|
246
|
+
headers.delete('accept')
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return fetch(requestClone, { headers })
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Bypass mocking when the client is not active.
|
|
254
|
+
if (!client) {
|
|
255
|
+
return passthrough()
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Bypass initial page load requests (i.e. static assets).
|
|
259
|
+
// The absence of the immediate/parent client in the map of the active clients
|
|
260
|
+
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
|
261
|
+
// and is not ready to handle requests.
|
|
262
|
+
if (!activeClientIds.has(client.id)) {
|
|
263
|
+
return passthrough()
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Notify the client that a request has been intercepted.
|
|
267
|
+
const serializedRequest = await serializeRequest(event.request)
|
|
268
|
+
const clientMessage = await sendToClient(
|
|
269
|
+
client,
|
|
270
|
+
{
|
|
271
|
+
type: 'REQUEST',
|
|
272
|
+
payload: {
|
|
273
|
+
id: requestId,
|
|
274
|
+
interceptedAt: requestInterceptedAt,
|
|
275
|
+
...serializedRequest,
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
[serializedRequest.body],
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
switch (clientMessage.type) {
|
|
282
|
+
case 'MOCK_RESPONSE': {
|
|
283
|
+
return respondWithMock(clientMessage.data)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
case 'PASSTHROUGH': {
|
|
287
|
+
return passthrough()
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return passthrough()
|
|
280
292
|
}
|
|
281
293
|
|
|
282
294
|
/**
|
|
@@ -286,19 +298,22 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
|
|
|
286
298
|
* @returns {Promise<any>}
|
|
287
299
|
*/
|
|
288
300
|
function sendToClient(client, message, transferrables = []) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
return new Promise((resolve, reject) => {
|
|
302
|
+
const channel = new MessageChannel()
|
|
303
|
+
|
|
304
|
+
channel.port1.onmessage = (event) => {
|
|
305
|
+
if (event.data && event.data.error) {
|
|
306
|
+
return reject(event.data.error)
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
resolve(event.data)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
client.postMessage(message, [
|
|
313
|
+
channel.port2,
|
|
314
|
+
...transferrables.filter(Boolean),
|
|
315
|
+
])
|
|
316
|
+
})
|
|
302
317
|
}
|
|
303
318
|
|
|
304
319
|
/**
|
|
@@ -306,41 +321,41 @@ function sendToClient(client, message, transferrables = []) {
|
|
|
306
321
|
* @returns {Response}
|
|
307
322
|
*/
|
|
308
323
|
function respondWithMock(response) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
324
|
+
// Setting response status code to 0 is a no-op.
|
|
325
|
+
// However, when responding with a "Response.error()", the produced Response
|
|
326
|
+
// instance will have status code set to 0. Since it's not possible to create
|
|
327
|
+
// a Response instance with status code 0, handle that use-case separately.
|
|
328
|
+
if (response.status === 0) {
|
|
329
|
+
return Response.error()
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
const mockedResponse = new Response(response.body, response)
|
|
333
|
+
|
|
334
|
+
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
|
335
|
+
value: true,
|
|
336
|
+
enumerable: true,
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
return mockedResponse
|
|
325
340
|
}
|
|
326
341
|
|
|
327
342
|
/**
|
|
328
343
|
* @param {Request} request
|
|
329
344
|
*/
|
|
330
345
|
async function serializeRequest(request) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
+
return {
|
|
347
|
+
url: request.url,
|
|
348
|
+
mode: request.mode,
|
|
349
|
+
method: request.method,
|
|
350
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
351
|
+
cache: request.cache,
|
|
352
|
+
credentials: request.credentials,
|
|
353
|
+
destination: request.destination,
|
|
354
|
+
integrity: request.integrity,
|
|
355
|
+
redirect: request.redirect,
|
|
356
|
+
referrer: request.referrer,
|
|
357
|
+
referrerPolicy: request.referrerPolicy,
|
|
358
|
+
body: await request.arrayBuffer(),
|
|
359
|
+
keepalive: request.keepalive,
|
|
360
|
+
}
|
|
346
361
|
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/react-template",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "A modern React template with pre-configured tools, best practices, and CI/CD setup for rapid project development.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"template",
|
|
8
|
+
"theholocron"
|
|
9
|
+
],
|
|
5
10
|
"homepage": "https://docs.theholocron.dev/react-template/",
|
|
6
11
|
"bugs": "https://github.com/theholocron/react-template/issues",
|
|
7
|
-
"repository":
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/theholocron/react-template.git"
|
|
10
|
-
},
|
|
12
|
+
"repository": "theholocron/react-template",
|
|
11
13
|
"license": "GPL-3.0",
|
|
12
14
|
"author": "Newton Koumantzelis",
|
|
15
|
+
"sideEffects": false,
|
|
13
16
|
"type": "module",
|
|
14
17
|
"exports": {
|
|
15
18
|
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
16
20
|
"import": "./dist/react-template.es.js",
|
|
17
|
-
"require": "./dist/react-template.cjs.js"
|
|
21
|
+
"require": "./dist/react-template.cjs.js",
|
|
22
|
+
"default": "./dist/react-template.cjs.js"
|
|
18
23
|
},
|
|
19
24
|
"./style": "./dist/style.css"
|
|
20
25
|
},
|
|
21
|
-
"
|
|
22
|
-
"module": "dist/react-template.es.js",
|
|
23
|
-
"types": "dist/index.d.ts",
|
|
24
|
-
"style": "dist/style.css",
|
|
26
|
+
"style": "./dist/style.css",
|
|
25
27
|
"files": [
|
|
26
28
|
"dist/*"
|
|
27
29
|
],
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"@theholocron/cli": "^3.29.2",
|
|
74
76
|
"@theholocron/commitlint-config": "^7.19.1",
|
|
75
77
|
"@theholocron/docs-theme": "^1.3.5",
|
|
76
|
-
"@theholocron/eslint-config": "^7.
|
|
78
|
+
"@theholocron/eslint-config": "^7.23.2",
|
|
77
79
|
"@theholocron/holocron-config": "^7.19.1",
|
|
78
80
|
"@theholocron/holocron-plugin-github": "^3.29.2",
|
|
79
81
|
"@theholocron/lighthouse-config": "^7.19.1",
|
|
@@ -143,7 +145,7 @@
|
|
|
143
145
|
],
|
|
144
146
|
"overrides": {
|
|
145
147
|
"@commitlint/config-conventional>conventional-changelog-conventionalcommits": "7",
|
|
146
|
-
"conventional-changelog-conventionalcommits": "
|
|
148
|
+
"conventional-changelog-conventionalcommits": "9.3.1"
|
|
147
149
|
}
|
|
148
150
|
},
|
|
149
151
|
"msw": {
|