dsh-unlag 1.9.52 → 1.9.53
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/index.js +20 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1312,6 +1312,7 @@ function serveBundlesAtCurrentRevision(ctx) {
|
|
|
1312
1312
|
const ask = async (url) => {
|
|
1313
1313
|
let held = null
|
|
1314
1314
|
let body
|
|
1315
|
+
const parts = []
|
|
1315
1316
|
let failed = false
|
|
1316
1317
|
if (url !== originalUrl) {
|
|
1317
1318
|
try {
|
|
@@ -1329,10 +1330,27 @@ function serveBundlesAtCurrentRevision(ctx) {
|
|
|
1329
1330
|
return realWriteHead.call(res, status, ...rest)
|
|
1330
1331
|
}
|
|
1331
1332
|
}
|
|
1333
|
+
/**
|
|
1334
|
+
* A held 404 can still be written to in pieces. Passing those pieces through would send the
|
|
1335
|
+
* implicit 200 headers Node writes on a first `write`, and the real answer could then never
|
|
1336
|
+
* be sent; so the pieces are kept with the body and the socket stays untouched.
|
|
1337
|
+
*/
|
|
1338
|
+
const realWrite = res.write
|
|
1339
|
+
if (typeof realWrite === 'function') {
|
|
1340
|
+
res.write = (chunk, ...rest) => {
|
|
1341
|
+
if (held !== null) {
|
|
1342
|
+
if (typeof chunk === 'string' || Buffer.isBuffer(chunk)) parts.push(Buffer.from(chunk))
|
|
1343
|
+
return true
|
|
1344
|
+
}
|
|
1345
|
+
return realWrite.call(res, chunk, ...rest)
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1332
1348
|
if (typeof realEnd === 'function') {
|
|
1333
1349
|
res.end = (...args) => {
|
|
1334
1350
|
if (held !== null) {
|
|
1335
|
-
|
|
1351
|
+
const last = args[0]
|
|
1352
|
+
if (typeof last === 'string' || Buffer.isBuffer(last)) parts.push(Buffer.from(last))
|
|
1353
|
+
body = parts.length === 0 ? '' : Buffer.concat(parts)
|
|
1336
1354
|
return res
|
|
1337
1355
|
}
|
|
1338
1356
|
return realEnd.apply(res, args)
|
|
@@ -1346,6 +1364,7 @@ function serveBundlesAtCurrentRevision(ctx) {
|
|
|
1346
1364
|
} finally {
|
|
1347
1365
|
try {
|
|
1348
1366
|
res.writeHead = realWriteHead
|
|
1367
|
+
if (realWrite !== undefined) res.write = realWrite
|
|
1349
1368
|
res.end = realEnd
|
|
1350
1369
|
} catch {
|
|
1351
1370
|
/* the response object owns its own shape */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
|
|
6
6
|
"license": "MIT",
|