@unbrained/pm-cli 2026.12.1 → 2026.12.2
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/.claude-plugin/marketplace.json +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-CWPR234D.js → chunk-7NAO7I75.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4YQMQOUO.js → chunk-7V65VACG.js} +52 -52
- package/dist/cli-bundle/chunks/{chunk-NA6D75V5.js → chunk-G6TARHFK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YSVOXCYH.js → chunk-GOEQXVOI.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OKEJ4U2I.js → chunk-ROTEELDL.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-U7RBJGLF.js → chunk-SDXCJZKB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XME6GIFQ.js → chunk-TKUG2X24.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-Q6GLSAJY.js → chunk-UNBW2LF3.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-V2S4XAX3.js +2 -0
- package/dist/cli-bundle/chunks/{item-transaction-66RDV7PH.js → item-transaction-56J5OCHA.js} +2 -2
- package/dist/cli-bundle/chunks/{linked-resource-value-list-E2DX52LY.js → linked-resource-value-list-ZBIY4H23.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-2F6JUBST.js → register-mutation-EK6DVIQK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-ET3UKPYK.js → register-operations-6MURXE4V.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-I63QTFCU.js → register-setup-RW26X3GJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SQ72CVUH.js → chunk-3COWDIPX.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-PT7RT3T6.js → chunk-J72TRWR5.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{item-transaction-2K4SFLJ7.js → item-transaction-LQLQLZE7.js} +2 -2
- package/dist/cli-bundle/main.js +3 -3
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/sdk/extension/install-sources.d.ts +2 -2
- package/dist/sdk/extension/install-sources.js +5 -5
- package/marketplace.json +1 -1
- package/node_modules/tar/README.md +1792 -1147
- package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
- package/node_modules/tar/dist/commonjs/bytes.js +83 -0
- package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
- package/node_modules/tar/dist/commonjs/codec.js +35 -0
- package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
- package/node_modules/tar/dist/commonjs/concat.js +20 -0
- package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
- package/node_modules/tar/dist/commonjs/create.js +150 -64
- package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
- package/node_modules/tar/dist/commonjs/dealias.js +50 -0
- package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
- package/node_modules/tar/dist/commonjs/delete.js +121 -0
- package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
- package/node_modules/tar/dist/commonjs/entries.js +398 -0
- package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
- package/node_modules/tar/dist/commonjs/extract.js +40 -81
- package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
- package/node_modules/tar/dist/commonjs/fs.js +5 -0
- package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
- package/node_modules/tar/dist/commonjs/header.js +71 -53
- package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
- package/node_modules/tar/dist/commonjs/index.js +46 -18
- package/node_modules/tar/dist/commonjs/index.min.js +2 -3
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
- package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
- package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
- package/node_modules/tar/dist/commonjs/list.js +99 -138
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
- package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
- package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
- package/node_modules/tar/dist/commonjs/options.js +20 -61
- package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
- package/node_modules/tar/dist/commonjs/pack.js +752 -445
- package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
- package/node_modules/tar/dist/commonjs/parser.js +452 -0
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
- package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
- package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
- package/node_modules/tar/dist/commonjs/path.js +90 -0
- package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
- package/node_modules/tar/dist/commonjs/pax.js +67 -36
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
- package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
- package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
- package/node_modules/tar/dist/commonjs/read-file.js +104 -0
- package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
- package/node_modules/tar/dist/commonjs/replace.js +164 -211
- package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
- package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
- package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
- package/node_modules/tar/dist/commonjs/server/index.js +166 -0
- package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
- package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
- package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
- package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
- package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
- package/node_modules/tar/dist/commonjs/types.js +4 -3
- package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
- package/node_modules/tar/dist/commonjs/unpack.js +780 -725
- package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
- package/node_modules/tar/dist/commonjs/update.js +37 -28
- package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
- package/node_modules/tar/dist/commonjs/warn.js +36 -0
- package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
- package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
- package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
- package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
- package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
- package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
- package/node_modules/tar/dist/esm/bytes.js +72 -0
- package/node_modules/tar/dist/esm/codec.d.ts +53 -0
- package/node_modules/tar/dist/esm/codec.js +32 -0
- package/node_modules/tar/dist/esm/concat.d.ts +3 -0
- package/node_modules/tar/dist/esm/concat.js +16 -0
- package/node_modules/tar/dist/esm/create.d.ts +39 -2
- package/node_modules/tar/dist/esm/create.js +144 -61
- package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
- package/node_modules/tar/dist/esm/dealias.js +46 -0
- package/node_modules/tar/dist/esm/delete.d.ts +19 -0
- package/node_modules/tar/dist/esm/delete.js +117 -0
- package/node_modules/tar/dist/esm/entries.d.ts +82 -0
- package/node_modules/tar/dist/esm/entries.js +388 -0
- package/node_modules/tar/dist/esm/extract.d.ts +14 -2
- package/node_modules/tar/dist/esm/extract.js +37 -44
- package/node_modules/tar/dist/esm/fs.d.ts +201 -0
- package/node_modules/tar/dist/esm/fs.js +4 -0
- package/node_modules/tar/dist/esm/header.d.ts +4 -4
- package/node_modules/tar/dist/esm/header.js +71 -53
- package/node_modules/tar/dist/esm/index.d.ts +25 -18
- package/node_modules/tar/dist/esm/index.js +23 -18
- package/node_modules/tar/dist/esm/index.min.js +2 -3
- package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
- package/node_modules/tar/dist/esm/large-numbers.js +4 -4
- package/node_modules/tar/dist/esm/list.d.ts +23 -6
- package/node_modules/tar/dist/esm/list.js +96 -101
- package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
- package/node_modules/tar/dist/esm/mkdir.js +119 -154
- package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
- package/node_modules/tar/dist/esm/options.d.ts +284 -513
- package/node_modules/tar/dist/esm/options.js +17 -51
- package/node_modules/tar/dist/esm/pack.d.ts +150 -96
- package/node_modules/tar/dist/esm/pack.js +750 -441
- package/node_modules/tar/dist/esm/parser.d.ts +98 -0
- package/node_modules/tar/dist/esm/parser.js +448 -0
- package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
- package/node_modules/tar/dist/esm/path-reservations.js +110 -140
- package/node_modules/tar/dist/esm/path.d.ts +19 -0
- package/node_modules/tar/dist/esm/path.js +80 -0
- package/node_modules/tar/dist/esm/pax.d.ts +3 -1
- package/node_modules/tar/dist/esm/pax.js +66 -35
- package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
- package/node_modules/tar/dist/esm/read-entry.js +248 -96
- package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
- package/node_modules/tar/dist/esm/read-file.js +99 -0
- package/node_modules/tar/dist/esm/replace.d.ts +45 -1
- package/node_modules/tar/dist/esm/replace.js +160 -207
- package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
- package/node_modules/tar/dist/esm/server/codecs.js +214 -0
- package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
- package/node_modules/tar/dist/esm/server/index.js +102 -0
- package/node_modules/tar/dist/esm/server/index.min.js +3 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
- package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
- package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
- package/node_modules/tar/dist/esm/to-stream.js +18 -0
- package/node_modules/tar/dist/esm/types.d.ts +4 -3
- package/node_modules/tar/dist/esm/types.js +4 -3
- package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
- package/node_modules/tar/dist/esm/unpack.js +776 -719
- package/node_modules/tar/dist/esm/update.d.ts +11 -1
- package/node_modules/tar/dist/esm/update.js +35 -28
- package/node_modules/tar/dist/esm/warn.d.ts +27 -0
- package/node_modules/tar/dist/esm/warn.js +31 -0
- package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
- package/node_modules/tar/dist/esm/win32-path.js +60 -0
- package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
- package/node_modules/tar/dist/esm/write-entry.js +107 -633
- package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
- package/node_modules/tar/dist/esm/write-flag.js +25 -0
- package/node_modules/tar/package.json +68 -224
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-AJLU6KLW.js +0 -2
- package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
- package/node_modules/@isaacs/fs-minipass/README.md +0 -71
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
- package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
- package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
- package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
- package/node_modules/@isaacs/fs-minipass/package.json +0 -72
- package/node_modules/chownr/LICENSE.md +0 -63
- package/node_modules/chownr/README.md +0 -3
- package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
- package/node_modules/chownr/dist/commonjs/index.js +0 -93
- package/node_modules/chownr/dist/commonjs/package.json +0 -3
- package/node_modules/chownr/dist/esm/index.d.ts +0 -3
- package/node_modules/chownr/dist/esm/index.js +0 -85
- package/node_modules/chownr/dist/esm/package.json +0 -3
- package/node_modules/chownr/package.json +0 -69
- package/node_modules/minipass/LICENSE.md +0 -55
- package/node_modules/minipass/README.md +0 -825
- package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
- package/node_modules/minipass/dist/commonjs/index.js +0 -1038
- package/node_modules/minipass/dist/commonjs/package.json +0 -3
- package/node_modules/minipass/dist/esm/index.d.ts +0 -545
- package/node_modules/minipass/dist/esm/index.js +0 -1020
- package/node_modules/minipass/dist/esm/package.json +0 -3
- package/node_modules/minipass/package.json +0 -77
- package/node_modules/minizlib/LICENSE +0 -26
- package/node_modules/minizlib/README.md +0 -64
- package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
- package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
- package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
- package/node_modules/minizlib/dist/commonjs/index.js +0 -416
- package/node_modules/minizlib/dist/commonjs/package.json +0 -3
- package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
- package/node_modules/minizlib/dist/esm/constants.js +0 -117
- package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
- package/node_modules/minizlib/dist/esm/index.js +0 -363
- package/node_modules/minizlib/dist/esm/package.json +0 -3
- package/node_modules/minizlib/package.json +0 -80
- package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
- package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
- package/node_modules/tar/dist/commonjs/make-command.js +0 -52
- package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
- package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
- package/node_modules/tar/dist/commonjs/parse.js +0 -655
- package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
- package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
- package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
- package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
- package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
- package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
- package/node_modules/tar/dist/esm/make-command.js +0 -48
- package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
- package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
- package/node_modules/tar/dist/esm/parse.d.ts +0 -92
- package/node_modules/tar/dist/esm/parse.js +0 -651
- package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
- package/node_modules/tar/dist/esm/process-umask.js +0 -3
- package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
- package/node_modules/tar/dist/esm/warn-method.js +0 -27
- package/node_modules/yallist/LICENSE.md +0 -63
- package/node_modules/yallist/README.md +0 -205
- package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
- package/node_modules/yallist/dist/commonjs/index.js +0 -384
- package/node_modules/yallist/dist/commonjs/package.json +0 -3
- package/node_modules/yallist/dist/esm/index.d.ts +0 -39
- package/node_modules/yallist/dist/esm/index.js +0 -379
- package/node_modules/yallist/dist/esm/package.json +0 -3
- package/node_modules/yallist/package.json +0 -68
|
@@ -1,221 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
fd = fs.openSync(opt.file, 'r+');
|
|
23
|
-
}
|
|
24
|
-
catch (er) {
|
|
25
|
-
if (er?.code === 'ENOENT') {
|
|
26
|
-
fd = fs.openSync(opt.file, 'w+');
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
throw er;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const st = fs.fstatSync(fd);
|
|
33
|
-
const headBuf = Buffer.alloc(512);
|
|
34
|
-
POSITION: for (position = 0; position < st.size; position += 512) {
|
|
35
|
-
for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {
|
|
36
|
-
bytes = fs.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos);
|
|
37
|
-
if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) {
|
|
38
|
-
throw new Error('cannot append to compressed archives');
|
|
39
|
-
}
|
|
40
|
-
if (!bytes) {
|
|
41
|
-
break POSITION;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const h = new Header(headBuf);
|
|
45
|
-
if (!h.cksumValid) {
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512);
|
|
49
|
-
if (position + entryBlockSize + 512 > st.size) {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
// the 512 for the header we just parsed will be added as well
|
|
53
|
-
// also jump ahead all the blocks for the body
|
|
54
|
-
position += entryBlockSize;
|
|
55
|
-
if (opt.mtimeCache && h.mtime) {
|
|
56
|
-
opt.mtimeCache.set(String(h.path), h.mtime);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
threw = false;
|
|
60
|
-
streamSync(opt, p, position, fd, files);
|
|
1
|
+
import { gzip } from './codec.js';
|
|
2
|
+
import { dealias } from './dealias.js';
|
|
3
|
+
import { packFiles, packFilesSync, writeChunks, writeChunksSync, } from './create.js';
|
|
4
|
+
import { Parser } from './parser.js';
|
|
5
|
+
// The most bytes to read from the archive at one time.
|
|
6
|
+
const CHUNK = 64 * 1024;
|
|
7
|
+
// Thrown in the parser to stop at the first block that is not valid.
|
|
8
|
+
const STOP = {};
|
|
9
|
+
const noop = () => { };
|
|
10
|
+
const compressed = () => new Error('cannot append to compressed archives');
|
|
11
|
+
const check = (opt, files) => {
|
|
12
|
+
const { file } = opt;
|
|
13
|
+
if (!file)
|
|
14
|
+
throw new TypeError('file is required');
|
|
15
|
+
if (opt.gzip ||
|
|
16
|
+
opt.brotli ||
|
|
17
|
+
opt.zstd ||
|
|
18
|
+
file.endsWith('.br') ||
|
|
19
|
+
file.endsWith('.tbr')) {
|
|
20
|
+
throw new TypeError(compressed().message);
|
|
61
21
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
fs.closeSync(fd);
|
|
66
|
-
}
|
|
67
|
-
catch { }
|
|
68
|
-
}
|
|
22
|
+
if (!files?.length) {
|
|
23
|
+
throw new TypeError('no paths specified to add/replace');
|
|
69
24
|
}
|
|
70
25
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Finds the place in an archive file where new entries go: the end
|
|
28
|
+
* of the last complete entry before the first block that is not a
|
|
29
|
+
* valid header. A PAX or GNU header with no entry after it is not a
|
|
30
|
+
* complete entry.
|
|
31
|
+
*
|
|
32
|
+
* Read the file into `buf` at `pos`, and call `push()`, until it
|
|
33
|
+
* returns false. The bodies of the entries are not read.
|
|
34
|
+
*/
|
|
35
|
+
export class AppendScan {
|
|
36
|
+
buf = new Uint8Array(CHUNK);
|
|
37
|
+
/** The place in the file of the next read. */
|
|
38
|
+
pos = 0;
|
|
39
|
+
#size;
|
|
40
|
+
#parser;
|
|
41
|
+
#codecs;
|
|
42
|
+
#mtimes;
|
|
43
|
+
/**
|
|
44
|
+
* @param size the size of the file
|
|
45
|
+
* @param mtimes gets the path and the `mtime` of each complete entry
|
|
46
|
+
*/
|
|
47
|
+
constructor(size, codecs = [], mtimes) {
|
|
48
|
+
this.#size = size;
|
|
49
|
+
this.#codecs = [...codecs, gzip];
|
|
50
|
+
this.#mtimes = mtimes;
|
|
51
|
+
this.#parser = new Parser({
|
|
52
|
+
// The parser must not give the bodies.
|
|
53
|
+
filter: () => false,
|
|
54
|
+
onwarn: () => {
|
|
55
|
+
throw STOP;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** The place in the file where new entries go. */
|
|
60
|
+
get position() {
|
|
61
|
+
return this.#parser.position;
|
|
62
|
+
}
|
|
63
|
+
/** The number of bytes to read into `buf` at `pos`. */
|
|
64
|
+
get want() {
|
|
65
|
+
return Math.min(CHUNK, this.#size - this.pos);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse the first `length` bytes of `buf`. False if the place is
|
|
69
|
+
* found. Throws if the file is compressed.
|
|
70
|
+
*/
|
|
71
|
+
push(length) {
|
|
72
|
+
const chunk = this.buf.subarray(0, length);
|
|
73
|
+
if (this.pos === 0 && this.#codecs.some(c => c.detect(chunk))) {
|
|
74
|
+
throw compressed();
|
|
94
75
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
/* c8 ignore next */
|
|
117
|
-
const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512);
|
|
118
|
-
if (position + entryBlockSize + 512 > size) {
|
|
119
|
-
return cb(null, position);
|
|
120
|
-
}
|
|
121
|
-
position += entryBlockSize + 512;
|
|
122
|
-
if (position >= size) {
|
|
123
|
-
return cb(null, position);
|
|
124
|
-
}
|
|
125
|
-
if (opt.mtimeCache && h.mtime) {
|
|
126
|
-
opt.mtimeCache.set(String(h.path), h.mtime);
|
|
127
|
-
}
|
|
128
|
-
bufPos = 0;
|
|
129
|
-
fs.read(fd, headBuf, 0, 512, position, onread);
|
|
130
|
-
};
|
|
131
|
-
fs.read(fd, headBuf, 0, 512, position, onread);
|
|
132
|
-
};
|
|
133
|
-
const promise = new Promise((resolve, reject) => {
|
|
134
|
-
p.on('error', reject);
|
|
135
|
-
let flag = 'r+';
|
|
136
|
-
const onopen = (er, fd) => {
|
|
137
|
-
if (er && er.code === 'ENOENT' && flag === 'r+') {
|
|
138
|
-
flag = 'w+';
|
|
139
|
-
return fs.open(opt.file, flag, onopen);
|
|
140
|
-
}
|
|
141
|
-
if (er || !fd) {
|
|
142
|
-
return reject(er);
|
|
76
|
+
const parser = this.#parser;
|
|
77
|
+
this.pos += length;
|
|
78
|
+
// the end of the body of the last entry in the chunk
|
|
79
|
+
let end = 0;
|
|
80
|
+
parser.push(chunk);
|
|
81
|
+
try {
|
|
82
|
+
for (let ev; (ev = parser.next());) {
|
|
83
|
+
if (ev.type !== 'entry')
|
|
84
|
+
return false;
|
|
85
|
+
const { entry } = ev;
|
|
86
|
+
end = parser.offset + 512 * Math.ceil(entry.size / 512);
|
|
87
|
+
if (end > this.#size)
|
|
88
|
+
return false;
|
|
89
|
+
if (entry.mtime)
|
|
90
|
+
this.#mtimes?.set(entry.path, entry.mtime);
|
|
91
|
+
}
|
|
92
|
+
// The rest of the body of the last entry is not read.
|
|
93
|
+
if (this.pos < end) {
|
|
94
|
+
parser.skipBody();
|
|
95
|
+
this.pos = end;
|
|
143
96
|
}
|
|
144
|
-
fs.fstat(fd, (er, st) => {
|
|
145
|
-
if (er) {
|
|
146
|
-
return fs.close(fd, () => reject(er));
|
|
147
|
-
}
|
|
148
|
-
getPos(fd, st.size, (er, position) => {
|
|
149
|
-
if (er) {
|
|
150
|
-
return reject(er);
|
|
151
|
-
}
|
|
152
|
-
const stream = new WriteStream(opt.file, {
|
|
153
|
-
fd: fd,
|
|
154
|
-
start: position,
|
|
155
|
-
});
|
|
156
|
-
p.pipe(stream);
|
|
157
|
-
stream.on('error', reject);
|
|
158
|
-
stream.on('close', resolve);
|
|
159
|
-
addFilesAsync(p, files);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
fs.open(opt.file, flag, onopen);
|
|
164
|
-
});
|
|
165
|
-
return promise;
|
|
166
|
-
};
|
|
167
|
-
const addFilesSync = (p, files) => {
|
|
168
|
-
files.forEach(file => {
|
|
169
|
-
if (file.charAt(0) === '@') {
|
|
170
|
-
list({
|
|
171
|
-
file: path.resolve(p.cwd, file.slice(1)),
|
|
172
|
-
sync: true,
|
|
173
|
-
noResume: true,
|
|
174
|
-
onReadEntry: entry => p.add(entry),
|
|
175
|
-
});
|
|
176
97
|
}
|
|
177
|
-
|
|
178
|
-
|
|
98
|
+
catch (er) {
|
|
99
|
+
if (er !== STOP)
|
|
100
|
+
throw er;
|
|
101
|
+
return false;
|
|
179
102
|
}
|
|
103
|
+
return length > 0 && this.pos < this.#size;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Add the files to the end of an archive file that is not
|
|
108
|
+
* compressed. The files are the same as for `create`. If the archive
|
|
109
|
+
* does not exist, it is made.
|
|
110
|
+
*
|
|
111
|
+
* The new entries go after the last complete entry of the archive.
|
|
112
|
+
* A reader of the archive gets the old entry and then the new entry
|
|
113
|
+
* of a path that is in it two times.
|
|
114
|
+
*/
|
|
115
|
+
export const replace = async (options, files) => {
|
|
116
|
+
const opt = dealias(options);
|
|
117
|
+
check(opt, files);
|
|
118
|
+
const { fs, file } = opt;
|
|
119
|
+
const pack = packFiles(opt, files);
|
|
120
|
+
if (pack.codec)
|
|
121
|
+
throw new TypeError(compressed().message);
|
|
122
|
+
const handle = await fs.open(file, 'r+').catch(er => {
|
|
123
|
+
if (er?.code !== 'ENOENT')
|
|
124
|
+
throw er;
|
|
125
|
+
return fs.open(file, 'w+', opt.mode || 0o666);
|
|
180
126
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
p.add(file);
|
|
194
|
-
}
|
|
127
|
+
let ok = false;
|
|
128
|
+
try {
|
|
129
|
+
const { size } = await handle.stat();
|
|
130
|
+
const scan = new AppendScan(size, opt.codecs, opt.mtimeCache);
|
|
131
|
+
while (scan.push((await handle.read(scan.buf, 0, scan.want, scan.pos)).bytesRead))
|
|
132
|
+
;
|
|
133
|
+
await writeChunks(handle, pack, scan.position);
|
|
134
|
+
ok = true;
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
const closed = handle.close();
|
|
138
|
+
await (ok ? closed : closed.catch(noop));
|
|
195
139
|
}
|
|
196
|
-
p.end();
|
|
197
140
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
()
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
141
|
+
/** The sync form of `replace`. */
|
|
142
|
+
export const replaceSync = (options, files) => {
|
|
143
|
+
const opt = dealias(options);
|
|
144
|
+
check(opt, files);
|
|
145
|
+
const { fs, file } = opt;
|
|
146
|
+
const pack = packFilesSync(opt, files);
|
|
147
|
+
if (pack.codec)
|
|
148
|
+
throw new TypeError(compressed().message);
|
|
149
|
+
let fd;
|
|
150
|
+
try {
|
|
151
|
+
fd = fs.openSync(file, 'r+');
|
|
209
152
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
opt.file.endsWith('.tbr')) {
|
|
215
|
-
throw new TypeError('cannot append to compressed archives');
|
|
153
|
+
catch (er) {
|
|
154
|
+
if (er?.code !== 'ENOENT')
|
|
155
|
+
throw er;
|
|
156
|
+
fd = fs.openSync(file, 'w+', opt.mode || 0o666);
|
|
216
157
|
}
|
|
217
|
-
|
|
218
|
-
|
|
158
|
+
try {
|
|
159
|
+
const { size } = fs.fstatSync(fd);
|
|
160
|
+
const scan = new AppendScan(size, opt.codecs, opt.mtimeCache);
|
|
161
|
+
while (scan.push(fs.readSync(fd, scan.buf, 0, scan.want, scan.pos)))
|
|
162
|
+
;
|
|
163
|
+
writeChunksSync(fs, fd, pack, scan.position);
|
|
219
164
|
}
|
|
220
|
-
|
|
165
|
+
catch (er) {
|
|
166
|
+
try {
|
|
167
|
+
fs.closeSync(fd);
|
|
168
|
+
}
|
|
169
|
+
catch { }
|
|
170
|
+
throw er;
|
|
171
|
+
}
|
|
172
|
+
fs.closeSync(fd);
|
|
173
|
+
};
|
|
221
174
|
//# sourceMappingURL=replace.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Transform } from 'node:stream';
|
|
2
|
+
import * as nodeZlib from 'node:zlib';
|
|
3
|
+
import type { Codec, CodecStream } from '../codec.js';
|
|
4
|
+
/**
|
|
5
|
+
* The functions of `node:zlib` that the codecs use. A runtime can
|
|
6
|
+
* have no brotli functions or no zstd functions.
|
|
7
|
+
*/
|
|
8
|
+
export type ZlibModule = Pick<typeof nodeZlib, 'createGzip' | 'createGunzip' | 'gzipSync' | 'gunzipSync'> & Partial<Pick<typeof nodeZlib, 'createBrotliCompress' | 'createBrotliDecompress' | 'brotliCompressSync' | 'brotliDecompressSync' | 'createZstdCompress' | 'createZstdDecompress' | 'zstdCompressSync' | 'zstdDecompressSync'>>;
|
|
9
|
+
/**
|
|
10
|
+
* Make the two web streams of a `node:zlib` stream, or of another
|
|
11
|
+
* `Transform` stream of `node:stream`. The result fits the
|
|
12
|
+
* `transform` option of `extract`.
|
|
13
|
+
*
|
|
14
|
+
* As with a `TransformStream`, a write is complete only when the
|
|
15
|
+
* reader asks for more output than the stream has. The zlib stream
|
|
16
|
+
* makes output only until its buffer is full. So the reader of an
|
|
17
|
+
* archive can stop before more is decompressed.
|
|
18
|
+
*
|
|
19
|
+
* @param batch put small chunks of input together for one write.
|
|
20
|
+
* Each write is a task for a thread.
|
|
21
|
+
* @param first called with the first chunk of output
|
|
22
|
+
*/
|
|
23
|
+
export declare const codecStream: (stream: Transform, batch?: boolean, first?: (chunk: Uint8Array) => void) => CodecStream;
|
|
24
|
+
/**
|
|
25
|
+
* The codecs of a `node:zlib` module: gzip, then brotli and zstd if
|
|
26
|
+
* the module has their functions.
|
|
27
|
+
*
|
|
28
|
+
* The value of a `gzip`, `brotli`, or `zstd` option of `create` goes
|
|
29
|
+
* to the zlib function as its options. A gzip codec reads the tar
|
|
30
|
+
* option `portable` in its options: it makes output that does not
|
|
31
|
+
* name the system.
|
|
32
|
+
*
|
|
33
|
+
* A brotli archive has no magic number. The readers use the brotli
|
|
34
|
+
* codec for a file with a name that ends in `.tar.br` or `.tbr`, if
|
|
35
|
+
* the file does not start with a tar header.
|
|
36
|
+
*/
|
|
37
|
+
export declare const zlibCodecs: (z?: ZlibModule) => Codec[];
|
|
38
|
+
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { constants } from 'node:buffer';
|
|
2
|
+
import * as nodeZlib from 'node:zlib';
|
|
3
|
+
// The size of each chunk of decompressed output, and the size below
|
|
4
|
+
// which chunks of input to compress are put together.
|
|
5
|
+
const CHUNK = 64 * 1024;
|
|
6
|
+
/**
|
|
7
|
+
* Make the two web streams of a `node:zlib` stream, or of another
|
|
8
|
+
* `Transform` stream of `node:stream`. The result fits the
|
|
9
|
+
* `transform` option of `extract`.
|
|
10
|
+
*
|
|
11
|
+
* As with a `TransformStream`, a write is complete only when the
|
|
12
|
+
* reader asks for more output than the stream has. The zlib stream
|
|
13
|
+
* makes output only until its buffer is full. So the reader of an
|
|
14
|
+
* archive can stop before more is decompressed.
|
|
15
|
+
*
|
|
16
|
+
* @param batch put small chunks of input together for one write.
|
|
17
|
+
* Each write is a task for a thread.
|
|
18
|
+
* @param first called with the first chunk of output
|
|
19
|
+
*/
|
|
20
|
+
export const codecStream = (stream, batch = false, first) => {
|
|
21
|
+
let output;
|
|
22
|
+
let input;
|
|
23
|
+
// True while the reader waits for output.
|
|
24
|
+
let wanted = false;
|
|
25
|
+
// True when the zlib stream is closed.
|
|
26
|
+
let done = false;
|
|
27
|
+
// settles the write or the close that waits for the zlib stream
|
|
28
|
+
let settle;
|
|
29
|
+
// settles the write that waits for the reader
|
|
30
|
+
let wake;
|
|
31
|
+
const held = batch ? new Uint8Array(CHUNK) : undefined;
|
|
32
|
+
let used = 0;
|
|
33
|
+
const write = (chunk) => new Promise(res => {
|
|
34
|
+
settle = res;
|
|
35
|
+
stream.write(chunk, () => res());
|
|
36
|
+
});
|
|
37
|
+
const flush = async (held) => {
|
|
38
|
+
if (used)
|
|
39
|
+
await write(held.subarray(0, used));
|
|
40
|
+
used = 0;
|
|
41
|
+
};
|
|
42
|
+
// A write has no callback when the zlib stream fails or is
|
|
43
|
+
// destroyed.
|
|
44
|
+
const release = () => {
|
|
45
|
+
done = true;
|
|
46
|
+
settle?.();
|
|
47
|
+
wake?.();
|
|
48
|
+
};
|
|
49
|
+
const stop = () => {
|
|
50
|
+
release();
|
|
51
|
+
stream.destroy();
|
|
52
|
+
};
|
|
53
|
+
stream.pause();
|
|
54
|
+
stream.on('data', (chunk) => {
|
|
55
|
+
first?.(chunk);
|
|
56
|
+
first = undefined;
|
|
57
|
+
wanted = false;
|
|
58
|
+
stream.pause();
|
|
59
|
+
output.enqueue(chunk);
|
|
60
|
+
});
|
|
61
|
+
// On Deno, a zlib stream that already has all its output emits
|
|
62
|
+
// 'end' after it is destroyed. The output is then closed already.
|
|
63
|
+
stream.on('end', () => {
|
|
64
|
+
if (!done)
|
|
65
|
+
output.close();
|
|
66
|
+
});
|
|
67
|
+
stream.on('error', er => {
|
|
68
|
+
output.error(er);
|
|
69
|
+
input.error(er);
|
|
70
|
+
release();
|
|
71
|
+
});
|
|
72
|
+
stream.on('close', release);
|
|
73
|
+
return {
|
|
74
|
+
readable: new ReadableStream({
|
|
75
|
+
start: controller => {
|
|
76
|
+
output = controller;
|
|
77
|
+
},
|
|
78
|
+
pull: () => {
|
|
79
|
+
wanted = true;
|
|
80
|
+
wake?.();
|
|
81
|
+
stream.resume();
|
|
82
|
+
},
|
|
83
|
+
cancel: reason => {
|
|
84
|
+
// Stop the source of the input also.
|
|
85
|
+
input.error(reason);
|
|
86
|
+
stop();
|
|
87
|
+
},
|
|
88
|
+
}, { highWaterMark: 0 }),
|
|
89
|
+
writable: new WritableStream({
|
|
90
|
+
start: controller => {
|
|
91
|
+
input = controller;
|
|
92
|
+
// An abort does not wait for a write that waits.
|
|
93
|
+
const { signal } = controller;
|
|
94
|
+
signal.addEventListener('abort', () => {
|
|
95
|
+
output.error(signal.reason);
|
|
96
|
+
stop();
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
write: async (chunk) => {
|
|
100
|
+
if (!held)
|
|
101
|
+
await write(chunk);
|
|
102
|
+
else {
|
|
103
|
+
if (used + chunk.length > CHUNK)
|
|
104
|
+
await flush(held);
|
|
105
|
+
if (chunk.length > CHUNK)
|
|
106
|
+
await write(chunk);
|
|
107
|
+
else {
|
|
108
|
+
held.set(chunk, used);
|
|
109
|
+
used += chunk.length;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// As with a `TransformStream`, the write waits until the
|
|
113
|
+
// reader wants output. Then a pipe from the source does not
|
|
114
|
+
// start a write to a stream that the reader canceled.
|
|
115
|
+
if (!wanted && !done)
|
|
116
|
+
await new Promise(res => (wake = res));
|
|
117
|
+
},
|
|
118
|
+
close: async () => {
|
|
119
|
+
if (held)
|
|
120
|
+
await flush(held);
|
|
121
|
+
await new Promise(res => {
|
|
122
|
+
settle = res;
|
|
123
|
+
stream.end();
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
// The option of the sync functions that limits the output. They
|
|
130
|
+
// refuse a number that is not in the range of a buffer length.
|
|
131
|
+
const limit = (max) => max >= constants.MAX_LENGTH ?
|
|
132
|
+
{}
|
|
133
|
+
: { maxOutputLength: Math.max(1, Math.floor(max)) };
|
|
134
|
+
const make = (base, compress, decompress, compressSync, decompressSync) => ({
|
|
135
|
+
...base,
|
|
136
|
+
decompress: () => codecStream(decompress({ chunkSize: CHUNK })),
|
|
137
|
+
compress: options => codecStream(compress(options), true),
|
|
138
|
+
decompressSync: (data, { maxOutputLength }) => {
|
|
139
|
+
try {
|
|
140
|
+
return decompressSync(data, limit(maxOutputLength));
|
|
141
|
+
}
|
|
142
|
+
catch (er) {
|
|
143
|
+
if (er?.code !== 'ERR_BUFFER_TOO_LARGE') {
|
|
144
|
+
throw er;
|
|
145
|
+
}
|
|
146
|
+
throw new Error(`max decompression ratio exceeded: the output is larger than ${maxOutputLength} bytes`);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
compressSync,
|
|
150
|
+
});
|
|
151
|
+
// Byte 9 of a gzip stream names the system that made it. Set it to
|
|
152
|
+
// 255, "unknown", so that each system makes the same bytes.
|
|
153
|
+
const portable = (chunk) => {
|
|
154
|
+
chunk[9] = 255;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* The codecs of a `node:zlib` module: gzip, then brotli and zstd if
|
|
158
|
+
* the module has their functions.
|
|
159
|
+
*
|
|
160
|
+
* The value of a `gzip`, `brotli`, or `zstd` option of `create` goes
|
|
161
|
+
* to the zlib function as its options. A gzip codec reads the tar
|
|
162
|
+
* option `portable` in its options: it makes output that does not
|
|
163
|
+
* name the system.
|
|
164
|
+
*
|
|
165
|
+
* A brotli archive has no magic number. The readers use the brotli
|
|
166
|
+
* codec for a file with a name that ends in `.tar.br` or `.tbr`, if
|
|
167
|
+
* the file does not start with a tar header.
|
|
168
|
+
*/
|
|
169
|
+
export const zlibCodecs = (z = nodeZlib) => {
|
|
170
|
+
const { createBrotliCompress, createBrotliDecompress, brotliCompressSync, brotliDecompressSync, createZstdCompress, createZstdDecompress, zstdCompressSync, zstdDecompressSync, } = z;
|
|
171
|
+
const gzip = make({
|
|
172
|
+
name: 'gzip',
|
|
173
|
+
headLength: 2,
|
|
174
|
+
detect: head => head[0] === 0x1f && head[1] === 0x8b,
|
|
175
|
+
}, z.createGzip, z.createGunzip, z.gzipSync, z.gunzipSync);
|
|
176
|
+
const codecs = [
|
|
177
|
+
{
|
|
178
|
+
...gzip,
|
|
179
|
+
compress: ({ portable: p, ...options } = {}) => codecStream(z.createGzip(options), true, p ? portable : undefined),
|
|
180
|
+
compressSync: (data, { portable: p, ...options } = {}) => {
|
|
181
|
+
const out = z.gzipSync(data, options);
|
|
182
|
+
if (p)
|
|
183
|
+
portable(out);
|
|
184
|
+
return out;
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
if (createBrotliCompress &&
|
|
189
|
+
createBrotliDecompress &&
|
|
190
|
+
brotliCompressSync &&
|
|
191
|
+
brotliDecompressSync) {
|
|
192
|
+
codecs.push(make({
|
|
193
|
+
name: 'brotli',
|
|
194
|
+
headLength: 0,
|
|
195
|
+
detect: () => false,
|
|
196
|
+
extensions: ['.tar.br', '.tbr'],
|
|
197
|
+
}, createBrotliCompress, createBrotliDecompress, brotliCompressSync, brotliDecompressSync));
|
|
198
|
+
}
|
|
199
|
+
if (createZstdCompress &&
|
|
200
|
+
createZstdDecompress &&
|
|
201
|
+
zstdCompressSync &&
|
|
202
|
+
zstdDecompressSync) {
|
|
203
|
+
codecs.push(make({
|
|
204
|
+
name: 'zstd',
|
|
205
|
+
headLength: 4,
|
|
206
|
+
detect: head => head[0] === 0x28 &&
|
|
207
|
+
head[1] === 0xb5 &&
|
|
208
|
+
head[2] === 0x2f &&
|
|
209
|
+
head[3] === 0xfd,
|
|
210
|
+
}, createZstdCompress, createZstdDecompress, zstdCompressSync, zstdDecompressSync));
|
|
211
|
+
}
|
|
212
|
+
return codecs;
|
|
213
|
+
};
|
|
214
|
+
//# sourceMappingURL=codecs.js.map
|