bdy 1.25.14-dev → 1.25.15-dev
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/distTs/package.json +1 -1
- package/distTs/src/utils.js +42 -50
- package/package.json +1 -1
package/distTs/package.json
CHANGED
package/distTs/src/utils.js
CHANGED
|
@@ -69,6 +69,9 @@ const cliError_1 = __importStar(require("./cliError"));
|
|
|
69
69
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
70
70
|
const texts_1 = require("./texts");
|
|
71
71
|
const node_sea_1 = require("node:sea");
|
|
72
|
+
const node_zlib_1 = __importDefault(require("node:zlib"));
|
|
73
|
+
const node_stream_1 = require("node:stream");
|
|
74
|
+
const promises_1 = require("node:stream/promises");
|
|
72
75
|
const cliCommand_1 = __importDefault(require("./cliCommand"));
|
|
73
76
|
const node_os_1 = __importStar(require("node:os"));
|
|
74
77
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -1344,56 +1347,45 @@ const OIDC_ISSUERS = new Set(APP_HOST_OIDC_ISSUERS.map(([, issuer]) => issuer));
|
|
|
1344
1347
|
function isKnownOidcIssuer(issuer) {
|
|
1345
1348
|
return OIDC_ISSUERS.has(issuer);
|
|
1346
1349
|
}
|
|
1347
|
-
const addEntryToZip = (dirPath, zip, entry) => {
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
// the ones that do set one, and a string would reach fflate as something it cannot zip
|
|
1387
|
-
file.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk, false);
|
|
1388
|
-
});
|
|
1389
|
-
rs.on('error', (err) => {
|
|
1390
|
-
finish(err);
|
|
1391
|
-
});
|
|
1392
|
-
rs.on('end', () => {
|
|
1393
|
-
file.push(new Uint8Array(0), true);
|
|
1394
|
-
finish();
|
|
1395
|
-
});
|
|
1396
|
-
});
|
|
1350
|
+
const addEntryToZip = async (dirPath, zip, entry) => {
|
|
1351
|
+
const isDir = entry.isDirectory();
|
|
1352
|
+
// A zip entry name is always a relative POSIX path: on Windows path.join builds it with
|
|
1353
|
+
// backslashes, and anything below the root keeps the separator the strip above left behind
|
|
1354
|
+
let name = node_path_1.default
|
|
1355
|
+
.join(entry.parentPath.replace(dirPath, ''), entry.name)
|
|
1356
|
+
.split(node_path_1.default.sep)
|
|
1357
|
+
.join('/')
|
|
1358
|
+
.replace(/^\/+/, '');
|
|
1359
|
+
if (isDir)
|
|
1360
|
+
name += '/';
|
|
1361
|
+
// fflate only writes the zip framing here - the entry data is deflated by node's zlib. fflate's
|
|
1362
|
+
// streaming Deflate (0.8.3, fflate#260 / fflate#282) emits back-references past the start of some
|
|
1363
|
+
// inputs (font files, for one), and the file server then rejects the whole archive with
|
|
1364
|
+
// "invalid distance too far back"
|
|
1365
|
+
const file = {
|
|
1366
|
+
filename: name,
|
|
1367
|
+
size: 0,
|
|
1368
|
+
crc: 0,
|
|
1369
|
+
compression: isDir ? 0 : 8,
|
|
1370
|
+
};
|
|
1371
|
+
zip.add(file);
|
|
1372
|
+
if (isDir) {
|
|
1373
|
+
file.ondata(null, new Uint8Array(0), true);
|
|
1374
|
+
return;
|
|
1375
|
+
}
|
|
1376
|
+
await (0, promises_1.pipeline)(node_fs_1.default.createReadStream(node_path_1.default.join(entry.parentPath, entry.name)), new node_stream_1.Transform({
|
|
1377
|
+
transform(chunk, _encoding, callback) {
|
|
1378
|
+
file.crc = node_zlib_1.default.crc32(chunk, file.crc);
|
|
1379
|
+
file.size += chunk.length;
|
|
1380
|
+
callback(null, chunk);
|
|
1381
|
+
},
|
|
1382
|
+
}), node_zlib_1.default.createDeflateRaw({ level: 3 }), new node_stream_1.Writable({
|
|
1383
|
+
write(chunk, _encoding, callback) {
|
|
1384
|
+
file.ondata(null, chunk, false);
|
|
1385
|
+
callback();
|
|
1386
|
+
},
|
|
1387
|
+
}));
|
|
1388
|
+
file.ondata(null, new Uint8Array(0), true);
|
|
1397
1389
|
};
|
|
1398
1390
|
const addEntriesToZip = async (dirPath, zip, entries, onEntry) => {
|
|
1399
1391
|
for (let i = 0; i < entries.length; i += 1) {
|