@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.
Files changed (267) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli-bundle/bundle-manifest.json +1 -1
  3. package/dist/cli-bundle/chunks/{chunk-CWPR234D.js → chunk-7NAO7I75.js} +2 -2
  4. package/dist/cli-bundle/chunks/{chunk-4YQMQOUO.js → chunk-7V65VACG.js} +52 -52
  5. package/dist/cli-bundle/chunks/{chunk-NA6D75V5.js → chunk-G6TARHFK.js} +2 -2
  6. package/dist/cli-bundle/chunks/{chunk-YSVOXCYH.js → chunk-GOEQXVOI.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-OKEJ4U2I.js → chunk-ROTEELDL.js} +3 -3
  8. package/dist/cli-bundle/chunks/{chunk-U7RBJGLF.js → chunk-SDXCJZKB.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-XME6GIFQ.js → chunk-TKUG2X24.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-Q6GLSAJY.js → chunk-UNBW2LF3.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-V2S4XAX3.js +2 -0
  12. package/dist/cli-bundle/chunks/{item-transaction-66RDV7PH.js → item-transaction-56J5OCHA.js} +2 -2
  13. package/dist/cli-bundle/chunks/{linked-resource-value-list-E2DX52LY.js → linked-resource-value-list-ZBIY4H23.js} +2 -2
  14. package/dist/cli-bundle/chunks/{register-mutation-2F6JUBST.js → register-mutation-EK6DVIQK.js} +2 -2
  15. package/dist/cli-bundle/chunks/{register-operations-ET3UKPYK.js → register-operations-6MURXE4V.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-setup-I63QTFCU.js → register-setup-RW26X3GJ.js} +2 -2
  17. package/dist/cli-bundle/focused-chunks/{chunk-SQ72CVUH.js → chunk-3COWDIPX.js} +54 -54
  18. package/dist/cli-bundle/focused-chunks/{chunk-PT7RT3T6.js → chunk-J72TRWR5.js} +3 -3
  19. package/dist/cli-bundle/focused-chunks/{item-transaction-2K4SFLJ7.js → item-transaction-LQLQLZE7.js} +2 -2
  20. package/dist/cli-bundle/main.js +3 -3
  21. package/dist/cli-bundle/sdk-core.js +1 -1
  22. package/dist/cli-bundle/sdk-governance.js +1 -1
  23. package/dist/cli-bundle/sdk-merge.js +1 -1
  24. package/dist/cli-bundle/sdk-runtime.js +1 -1
  25. package/dist/cli-bundle/sdk-testing.js +1 -1
  26. package/dist/cli-bundle/sdk.js +1 -1
  27. package/dist/sdk/extension/install-sources.d.ts +2 -2
  28. package/dist/sdk/extension/install-sources.js +5 -5
  29. package/marketplace.json +1 -1
  30. package/node_modules/tar/README.md +1792 -1147
  31. package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
  32. package/node_modules/tar/dist/commonjs/bytes.js +83 -0
  33. package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
  34. package/node_modules/tar/dist/commonjs/codec.js +35 -0
  35. package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
  36. package/node_modules/tar/dist/commonjs/concat.js +20 -0
  37. package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
  38. package/node_modules/tar/dist/commonjs/create.js +150 -64
  39. package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
  40. package/node_modules/tar/dist/commonjs/dealias.js +50 -0
  41. package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
  42. package/node_modules/tar/dist/commonjs/delete.js +121 -0
  43. package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
  44. package/node_modules/tar/dist/commonjs/entries.js +398 -0
  45. package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
  46. package/node_modules/tar/dist/commonjs/extract.js +40 -81
  47. package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
  48. package/node_modules/tar/dist/commonjs/fs.js +5 -0
  49. package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
  50. package/node_modules/tar/dist/commonjs/header.js +71 -53
  51. package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
  52. package/node_modules/tar/dist/commonjs/index.js +46 -18
  53. package/node_modules/tar/dist/commonjs/index.min.js +2 -3
  54. package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
  55. package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
  56. package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
  57. package/node_modules/tar/dist/commonjs/list.js +99 -138
  58. package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
  59. package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
  60. package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
  61. package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
  62. package/node_modules/tar/dist/commonjs/options.js +20 -61
  63. package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
  64. package/node_modules/tar/dist/commonjs/pack.js +752 -445
  65. package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
  66. package/node_modules/tar/dist/commonjs/parser.js +452 -0
  67. package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
  68. package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
  69. package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
  70. package/node_modules/tar/dist/commonjs/path.js +90 -0
  71. package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
  72. package/node_modules/tar/dist/commonjs/pax.js +67 -36
  73. package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
  74. package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
  75. package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
  76. package/node_modules/tar/dist/commonjs/read-file.js +104 -0
  77. package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
  78. package/node_modules/tar/dist/commonjs/replace.js +164 -211
  79. package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
  80. package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
  81. package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
  82. package/node_modules/tar/dist/commonjs/server/index.js +166 -0
  83. package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
  84. package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
  85. package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
  86. package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
  87. package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
  88. package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
  89. package/node_modules/tar/dist/commonjs/types.js +4 -3
  90. package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
  91. package/node_modules/tar/dist/commonjs/unpack.js +780 -725
  92. package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
  93. package/node_modules/tar/dist/commonjs/update.js +37 -28
  94. package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
  95. package/node_modules/tar/dist/commonjs/warn.js +36 -0
  96. package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
  97. package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
  98. package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
  99. package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
  100. package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
  101. package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
  102. package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
  103. package/node_modules/tar/dist/esm/bytes.js +72 -0
  104. package/node_modules/tar/dist/esm/codec.d.ts +53 -0
  105. package/node_modules/tar/dist/esm/codec.js +32 -0
  106. package/node_modules/tar/dist/esm/concat.d.ts +3 -0
  107. package/node_modules/tar/dist/esm/concat.js +16 -0
  108. package/node_modules/tar/dist/esm/create.d.ts +39 -2
  109. package/node_modules/tar/dist/esm/create.js +144 -61
  110. package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
  111. package/node_modules/tar/dist/esm/dealias.js +46 -0
  112. package/node_modules/tar/dist/esm/delete.d.ts +19 -0
  113. package/node_modules/tar/dist/esm/delete.js +117 -0
  114. package/node_modules/tar/dist/esm/entries.d.ts +82 -0
  115. package/node_modules/tar/dist/esm/entries.js +388 -0
  116. package/node_modules/tar/dist/esm/extract.d.ts +14 -2
  117. package/node_modules/tar/dist/esm/extract.js +37 -44
  118. package/node_modules/tar/dist/esm/fs.d.ts +201 -0
  119. package/node_modules/tar/dist/esm/fs.js +4 -0
  120. package/node_modules/tar/dist/esm/header.d.ts +4 -4
  121. package/node_modules/tar/dist/esm/header.js +71 -53
  122. package/node_modules/tar/dist/esm/index.d.ts +25 -18
  123. package/node_modules/tar/dist/esm/index.js +23 -18
  124. package/node_modules/tar/dist/esm/index.min.js +2 -3
  125. package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
  126. package/node_modules/tar/dist/esm/large-numbers.js +4 -4
  127. package/node_modules/tar/dist/esm/list.d.ts +23 -6
  128. package/node_modules/tar/dist/esm/list.js +96 -101
  129. package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
  130. package/node_modules/tar/dist/esm/mkdir.js +119 -154
  131. package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
  132. package/node_modules/tar/dist/esm/options.d.ts +284 -513
  133. package/node_modules/tar/dist/esm/options.js +17 -51
  134. package/node_modules/tar/dist/esm/pack.d.ts +150 -96
  135. package/node_modules/tar/dist/esm/pack.js +750 -441
  136. package/node_modules/tar/dist/esm/parser.d.ts +98 -0
  137. package/node_modules/tar/dist/esm/parser.js +448 -0
  138. package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
  139. package/node_modules/tar/dist/esm/path-reservations.js +110 -140
  140. package/node_modules/tar/dist/esm/path.d.ts +19 -0
  141. package/node_modules/tar/dist/esm/path.js +80 -0
  142. package/node_modules/tar/dist/esm/pax.d.ts +3 -1
  143. package/node_modules/tar/dist/esm/pax.js +66 -35
  144. package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
  145. package/node_modules/tar/dist/esm/read-entry.js +248 -96
  146. package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
  147. package/node_modules/tar/dist/esm/read-file.js +99 -0
  148. package/node_modules/tar/dist/esm/replace.d.ts +45 -1
  149. package/node_modules/tar/dist/esm/replace.js +160 -207
  150. package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
  151. package/node_modules/tar/dist/esm/server/codecs.js +214 -0
  152. package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
  153. package/node_modules/tar/dist/esm/server/index.js +102 -0
  154. package/node_modules/tar/dist/esm/server/index.min.js +3 -0
  155. package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
  156. package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
  157. package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
  158. package/node_modules/tar/dist/esm/to-stream.js +18 -0
  159. package/node_modules/tar/dist/esm/types.d.ts +4 -3
  160. package/node_modules/tar/dist/esm/types.js +4 -3
  161. package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
  162. package/node_modules/tar/dist/esm/unpack.js +776 -719
  163. package/node_modules/tar/dist/esm/update.d.ts +11 -1
  164. package/node_modules/tar/dist/esm/update.js +35 -28
  165. package/node_modules/tar/dist/esm/warn.d.ts +27 -0
  166. package/node_modules/tar/dist/esm/warn.js +31 -0
  167. package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
  168. package/node_modules/tar/dist/esm/win32-path.js +60 -0
  169. package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
  170. package/node_modules/tar/dist/esm/write-entry.js +107 -633
  171. package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
  172. package/node_modules/tar/dist/esm/write-flag.js +25 -0
  173. package/node_modules/tar/package.json +68 -224
  174. package/package.json +2 -2
  175. package/packages/pm-beads/package.json +1 -1
  176. package/packages/pm-calendar/package.json +1 -1
  177. package/packages/pm-command-kit/package.json +1 -1
  178. package/packages/pm-digital-twin/package.json +1 -1
  179. package/packages/pm-governance-audit/package.json +1 -1
  180. package/packages/pm-guide-shell/package.json +1 -1
  181. package/packages/pm-kanban/package.json +1 -1
  182. package/packages/pm-lifecycle-hooks/package.json +1 -1
  183. package/packages/pm-linked-test-adapters/package.json +1 -1
  184. package/packages/pm-search-advanced/package.json +1 -1
  185. package/packages/pm-templates/package.json +1 -1
  186. package/packages/pm-todos/package.json +1 -1
  187. package/packages/pm-vcs/package.json +1 -1
  188. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  189. package/plugins/pm-claude/package.json +1 -1
  190. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  191. package/plugins/pm-codex/package.json +1 -1
  192. package/plugins/pm-codex/plugin.json +1 -1
  193. package/runtime-dependencies.json +1 -1
  194. package/dist/cli-bundle/chunks/chunk-AJLU6KLW.js +0 -2
  195. package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
  196. package/node_modules/@isaacs/fs-minipass/README.md +0 -71
  197. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
  198. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
  199. package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
  200. package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
  201. package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
  202. package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
  203. package/node_modules/@isaacs/fs-minipass/package.json +0 -72
  204. package/node_modules/chownr/LICENSE.md +0 -63
  205. package/node_modules/chownr/README.md +0 -3
  206. package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
  207. package/node_modules/chownr/dist/commonjs/index.js +0 -93
  208. package/node_modules/chownr/dist/commonjs/package.json +0 -3
  209. package/node_modules/chownr/dist/esm/index.d.ts +0 -3
  210. package/node_modules/chownr/dist/esm/index.js +0 -85
  211. package/node_modules/chownr/dist/esm/package.json +0 -3
  212. package/node_modules/chownr/package.json +0 -69
  213. package/node_modules/minipass/LICENSE.md +0 -55
  214. package/node_modules/minipass/README.md +0 -825
  215. package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
  216. package/node_modules/minipass/dist/commonjs/index.js +0 -1038
  217. package/node_modules/minipass/dist/commonjs/package.json +0 -3
  218. package/node_modules/minipass/dist/esm/index.d.ts +0 -545
  219. package/node_modules/minipass/dist/esm/index.js +0 -1020
  220. package/node_modules/minipass/dist/esm/package.json +0 -3
  221. package/node_modules/minipass/package.json +0 -77
  222. package/node_modules/minizlib/LICENSE +0 -26
  223. package/node_modules/minizlib/README.md +0 -64
  224. package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
  225. package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
  226. package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
  227. package/node_modules/minizlib/dist/commonjs/index.js +0 -416
  228. package/node_modules/minizlib/dist/commonjs/package.json +0 -3
  229. package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
  230. package/node_modules/minizlib/dist/esm/constants.js +0 -117
  231. package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
  232. package/node_modules/minizlib/dist/esm/index.js +0 -363
  233. package/node_modules/minizlib/dist/esm/package.json +0 -3
  234. package/node_modules/minizlib/package.json +0 -80
  235. package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
  236. package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
  237. package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
  238. package/node_modules/tar/dist/commonjs/make-command.js +0 -52
  239. package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
  240. package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
  241. package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
  242. package/node_modules/tar/dist/commonjs/parse.js +0 -655
  243. package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
  244. package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
  245. package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
  246. package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
  247. package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
  248. package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
  249. package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
  250. package/node_modules/tar/dist/esm/make-command.js +0 -48
  251. package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
  252. package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
  253. package/node_modules/tar/dist/esm/parse.d.ts +0 -92
  254. package/node_modules/tar/dist/esm/parse.js +0 -651
  255. package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
  256. package/node_modules/tar/dist/esm/process-umask.js +0 -3
  257. package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
  258. package/node_modules/tar/dist/esm/warn-method.js +0 -27
  259. package/node_modules/yallist/LICENSE.md +0 -63
  260. package/node_modules/yallist/README.md +0 -205
  261. package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
  262. package/node_modules/yallist/dist/commonjs/index.js +0 -384
  263. package/node_modules/yallist/dist/commonjs/package.json +0 -3
  264. package/node_modules/yallist/dist/esm/index.d.ts +0 -39
  265. package/node_modules/yallist/dist/esm/index.js +0 -379
  266. package/node_modules/yallist/dist/esm/package.json +0 -3
  267. package/node_modules/yallist/package.json +0 -68
@@ -1,88 +1,47 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.extract = void 0;
40
- // tar -x
41
- const fsm = __importStar(require("@isaacs/fs-minipass"));
42
- const node_fs_1 = __importDefault(require("node:fs"));
3
+ exports.extractSync = exports.extract = void 0;
4
+ const dealias_js_1 = require("./dealias.js");
43
5
  const list_js_1 = require("./list.js");
44
- const make_command_js_1 = require("./make-command.js");
6
+ const read_file_js_1 = require("./read-file.js");
45
7
  const unpack_js_1 = require("./unpack.js");
46
- const extractFileSync = (opt) => {
47
- const u = new unpack_js_1.UnpackSync(opt);
48
- const file = opt.file;
49
- const stat = node_fs_1.default.statSync(file);
50
- // This trades a zero-byte read() syscall for a stat
51
- // However, it will usually result in less memory allocation
52
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
53
- const stream = new fsm.ReadStreamSync(file, {
54
- readSize: readSize,
55
- size: stat.size,
56
- });
57
- stream.pipe(u);
8
+ const noInput = () => new TypeError('extract needs input or file');
9
+ /**
10
+ * Extract the entries of an archive into the directory `opt.cwd`.
11
+ * If `files` is set, only the entries that it lists, and the entries
12
+ * in the directories that it lists.
13
+ *
14
+ * A problem with one entry is a warning for `opt.onwarn`, and the
15
+ * extraction continues. A listed path that no entry matches is a
16
+ * warning when the archive ends. With `opt.strict`, each is an error.
17
+ */
18
+ const extract = async (options, files) => {
19
+ const opt = (0, dealias_js_1.dealias)(options);
20
+ const source = opt.input ??
21
+ (opt.file ? (0, read_file_js_1.readFile)(opt.fs, opt.file, opt.maxReadSize) : undefined);
22
+ if (!source)
23
+ throw noInput();
24
+ const [filter, report] = files?.length ? (0, list_js_1.filesFilter)(files, opt.filter) : [];
25
+ if (filter)
26
+ opt.filter = filter;
27
+ await new unpack_js_1.Unpack(opt).extract(source);
28
+ report?.(opt);
58
29
  };
59
- const extractFile = (opt, _) => {
60
- const u = new unpack_js_1.Unpack(opt);
61
- const readSize = opt.maxReadSize || 16 * 1024 * 1024;
62
- const file = opt.file;
63
- const p = new Promise((resolve, reject) => {
64
- u.on('error', reject);
65
- u.on('close', resolve);
66
- // This trades a zero-byte read() syscall for a stat
67
- // However, it will usually result in less memory allocation
68
- node_fs_1.default.stat(file, (er, stat) => {
69
- if (er) {
70
- reject(er);
71
- }
72
- else {
73
- const stream = new fsm.ReadStream(file, {
74
- readSize: readSize,
75
- size: stat.size,
76
- });
77
- stream.on('error', reject);
78
- stream.pipe(u);
79
- }
80
- });
81
- });
82
- return p;
30
+ exports.extract = extract;
31
+ /** The sync form of `extract`. */
32
+ const extractSync = (options, files) => {
33
+ const opt = (0, dealias_js_1.dealias)(options);
34
+ const source = opt.input ??
35
+ (opt.file ?
36
+ (0, read_file_js_1.readFileSync)(opt.fs, opt.file, opt.maxReadSize)
37
+ : undefined);
38
+ if (!source)
39
+ throw noInput();
40
+ const [filter, report] = files?.length ? (0, list_js_1.filesFilter)(files, opt.filter) : [];
41
+ if (filter)
42
+ opt.filter = filter;
43
+ new unpack_js_1.UnpackSync(opt).extract(source);
44
+ report?.(opt);
83
45
  };
84
- exports.extract = (0, make_command_js_1.makeCommand)(extractFileSync, extractFile, opt => new unpack_js_1.UnpackSync(opt), opt => new unpack_js_1.Unpack(opt), (opt, files) => {
85
- if (files?.length)
86
- (0, list_js_1.filesFilter)(opt, files);
87
- });
46
+ exports.extractSync = extractSync;
88
47
  //# sourceMappingURL=extract.js.map
@@ -0,0 +1,201 @@
1
+ import type { OpenConstants } from './write-flag.js';
2
+ /** The subset of a `node:fs/promises` `FileHandle` that the code uses. */
3
+ export type TarFileHandle = {
4
+ read(buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
5
+ bytesRead: number;
6
+ }>;
7
+ stat(): Promise<{
8
+ size: number;
9
+ }>;
10
+ close(): Promise<void>;
11
+ };
12
+ /** The subset of `node:fs/promises` that the code uses. */
13
+ export type TarFS = {
14
+ open(path: string, flags: string): Promise<TarFileHandle>;
15
+ };
16
+ /** The subset of `node:fs` that the sync code uses. */
17
+ export type TarFSSync = {
18
+ openSync(path: string, flags: string): number;
19
+ fstatSync(fd: number): {
20
+ size: number;
21
+ };
22
+ readSync(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;
23
+ closeSync(fd: number): void;
24
+ };
25
+ /** The subset of the `Stats` of `lstat` that the extraction uses. */
26
+ export type ExtractStats = {
27
+ isDirectory(): boolean;
28
+ isFile(): boolean;
29
+ isSymbolicLink(): boolean;
30
+ nlink: number;
31
+ mode: number;
32
+ mtime: Date;
33
+ };
34
+ /** The subset of a `FileHandle` that the extraction uses. */
35
+ export type ExtractFileHandle = {
36
+ write(data: Uint8Array): Promise<unknown>;
37
+ utimes(atime: Date, mtime: Date): Promise<void>;
38
+ chown(uid: number, gid: number): Promise<void>;
39
+ close(): Promise<void>;
40
+ };
41
+ /**
42
+ * The subset of `node:fs/promises` that the extraction uses. To read
43
+ * the archive from a file, it also uses `TarFS`.
44
+ */
45
+ export type ExtractFS = {
46
+ /** Without it, the flag of `open` is `'w'`. */
47
+ constants?: OpenConstants;
48
+ open(path: string, flags: string | number, mode: number): Promise<ExtractFileHandle>;
49
+ stat(path: string): Promise<{
50
+ isDirectory(): boolean;
51
+ }>;
52
+ lstat(path: string): Promise<ExtractStats>;
53
+ mkdir(path: string, options: {
54
+ mode: number;
55
+ recursive?: boolean;
56
+ }): Promise<string | undefined>;
57
+ chmod(path: string, mode: number): Promise<void>;
58
+ chown(path: string, uid: number, gid: number): Promise<void>;
59
+ lchown(path: string, uid: number, gid: number): Promise<void>;
60
+ utimes(path: string, atime: Date, mtime: Date): Promise<void>;
61
+ lutimes(path: string, atime: Date, mtime: Date): Promise<void>;
62
+ rmdir(path: string): Promise<void>;
63
+ unlink(path: string): Promise<void>;
64
+ rename(from: string, to: string): Promise<void>;
65
+ link(target: string, path: string): Promise<void>;
66
+ symlink(target: string, path: string): Promise<void>;
67
+ };
68
+ /**
69
+ * The subset of `node:fs` that the sync extraction uses. To read the
70
+ * archive from a file, it also uses `TarFSSync`.
71
+ */
72
+ export type ExtractFSSync = {
73
+ /** Without it, the flag of `openSync` is `'w'`. */
74
+ constants?: OpenConstants;
75
+ openSync(path: string, flags: string | number, mode: number): number;
76
+ writeSync(fd: number, data: Uint8Array): number;
77
+ futimesSync(fd: number, atime: Date, mtime: Date): void;
78
+ fchownSync(fd: number, uid: number, gid: number): void;
79
+ closeSync(fd: number): void;
80
+ statSync(path: string): {
81
+ isDirectory(): boolean;
82
+ };
83
+ lstatSync(path: string): ExtractStats;
84
+ mkdirSync(path: string, options: {
85
+ mode: number;
86
+ recursive?: boolean;
87
+ }): string | undefined;
88
+ chmodSync(path: string, mode: number): void;
89
+ chownSync(path: string, uid: number, gid: number): void;
90
+ lchownSync(path: string, uid: number, gid: number): void;
91
+ utimesSync(path: string, atime: Date, mtime: Date): void;
92
+ lutimesSync(path: string, atime: Date, mtime: Date): void;
93
+ rmdirSync(path: string): void;
94
+ unlinkSync(path: string): void;
95
+ renameSync(from: string, to: string): void;
96
+ linkSync(target: string, path: string): void;
97
+ symlinkSync(target: string, path: string): void;
98
+ };
99
+ /**
100
+ * The device number and the inode number of a file. With the option
101
+ * `bigint: true`, `node:fs` gives them as `bigint` values, which are
102
+ * exact. A `number` larger than `Number.MAX_SAFE_INTEGER` is not
103
+ * exact: two files can have the same value.
104
+ */
105
+ export type FileId = {
106
+ dev: number | bigint;
107
+ ino: number | bigint;
108
+ };
109
+ /** The option that asks for the exact `FileId` of a file. */
110
+ export type BigIntOption = {
111
+ bigint: true;
112
+ };
113
+ /** The subset of the `Stats` of `lstat` that the creation uses. */
114
+ export type CreateStats = {
115
+ isFile(): boolean;
116
+ isDirectory(): boolean;
117
+ isSymbolicLink(): boolean;
118
+ dev: number;
119
+ ino: number;
120
+ nlink: number;
121
+ mode: number;
122
+ uid: number;
123
+ gid: number;
124
+ size: number;
125
+ mtime: Date;
126
+ atime: Date;
127
+ ctime: Date;
128
+ };
129
+ /** The subset of a `FileHandle` that the creation uses. */
130
+ export type CreateFileHandle = {
131
+ read(buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
132
+ bytesRead: number;
133
+ }>;
134
+ write(buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
135
+ bytesWritten: number;
136
+ }>;
137
+ stat(): Promise<{
138
+ size: number;
139
+ dev: number;
140
+ ino: number;
141
+ }>;
142
+ close(): Promise<void>;
143
+ };
144
+ /**
145
+ * The subset of `node:fs/promises` that the creation uses. It also
146
+ * fits `TarFS`, which reads an `@archive` operand.
147
+ *
148
+ * The creation calls `lstat` (`stat` with `follow`) a second time,
149
+ * with the option `bigint: true`, only when the `dev` or `ino` number
150
+ * is not a safe integer, and only for a file with more than one link,
151
+ * or with `follow` for a directory. A function can ignore the option
152
+ * and return numbers.
153
+ */
154
+ export type CreateFS = {
155
+ open(path: string, flags: string, mode?: number): Promise<CreateFileHandle>;
156
+ lstat(path: string): Promise<CreateStats>;
157
+ lstat(path: string, options: BigIntOption): Promise<FileId>;
158
+ stat(path: string): Promise<CreateStats>;
159
+ stat(path: string, options: BigIntOption): Promise<FileId>;
160
+ readdir(path: string): Promise<string[]>;
161
+ readlink(path: string): Promise<string>;
162
+ };
163
+ /**
164
+ * The subset of `node:fs` that the sync creation uses. It also fits
165
+ * `TarFSSync`, which reads an `@archive` operand. The `bigint` option
166
+ * is used as in `CreateFS`.
167
+ */
168
+ export type CreateFSSync = {
169
+ openSync(path: string, flags: string, mode?: number): number;
170
+ fstatSync(fd: number): {
171
+ size: number;
172
+ dev: number;
173
+ ino: number;
174
+ };
175
+ readSync(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;
176
+ writeSync(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;
177
+ closeSync(fd: number): void;
178
+ lstatSync(path: string): CreateStats;
179
+ lstatSync(path: string, options: BigIntOption): FileId;
180
+ statSync(path: string): CreateStats;
181
+ statSync(path: string, options: BigIntOption): FileId;
182
+ readdirSync(path: string): string[];
183
+ readlinkSync(path: string): string;
184
+ };
185
+ /**
186
+ * The subset of `node:fs/promises` that `replace` and `update` use:
187
+ * `open` with the flags `'r+'`, `'w+'`, and `'r'`, the functions of a
188
+ * file handle, and the functions that read the files to add.
189
+ */
190
+ export type ReplaceFS = CreateFS;
191
+ /** The subset of `node:fs` that `replaceSync` and `updateSync` use. */
192
+ export type ReplaceFSSync = CreateFSSync;
193
+ /**
194
+ * The subset of `node:fs/promises` that `delete` uses: the functions
195
+ * that read and write an archive file, `stat`, `rename`, and
196
+ * `unlink`.
197
+ */
198
+ export type DeleteFS = TarFS & CreateFS & Pick<ExtractFS, 'rename' | 'unlink'>;
199
+ /** The subset of `node:fs` that `deleteSync` uses. */
200
+ export type DeleteFSSync = TarFSSync & CreateFSSync & Pick<ExtractFSSync, 'renameSync' | 'unlinkSync'>;
201
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // The file system functions that this package calls. `node:fs/promises`
3
+ // fits `TarFS`, and `node:fs` fits `TarFSSync`.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=fs.js.map
@@ -26,7 +26,7 @@ export declare class Header implements HeaderData {
26
26
  cksumValid: boolean;
27
27
  needPax: boolean;
28
28
  nullBlock: boolean;
29
- block?: Buffer;
29
+ block?: Uint8Array;
30
30
  path?: string;
31
31
  mode?: number;
32
32
  uid?: number;
@@ -43,9 +43,9 @@ export declare class Header implements HeaderData {
43
43
  mtime?: Date;
44
44
  charset?: string;
45
45
  comment?: string;
46
- constructor(data?: Buffer | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData);
47
- decode(buf: Buffer, off: number, ex?: HeaderData, gex?: HeaderData): void;
48
- encode(buf?: Buffer, off?: number): boolean;
46
+ constructor(data?: Uint8Array | HeaderData, off?: number, ex?: HeaderData, gex?: HeaderData);
47
+ decode(buf: Uint8Array, off: number, ex?: HeaderData, gex?: HeaderData): void;
48
+ encode(buf?: Uint8Array, off?: number): boolean;
49
49
  get type(): EntryTypeName;
50
50
  get typeKey(): EntryTypeCode | 'Unsupported';
51
51
  set type(type: EntryTypeCode | EntryTypeName | 'Unsupported');
@@ -38,8 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  })();
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.Header = void 0;
41
- const node_path_1 = require("node:path");
41
+ const bytes_js_1 = require("./bytes.js");
42
42
  const large = __importStar(require("./large-numbers.js"));
43
+ const path_js_1 = require("./path.js");
43
44
  const types = __importStar(require("./types.js"));
44
45
  const notNegative = (n) => n === undefined || n < 0 ? undefined : n;
45
46
  class Header {
@@ -65,7 +66,7 @@ class Header {
65
66
  charset;
66
67
  comment;
67
68
  constructor(data, off = 0, ex, gex) {
68
- if (Buffer.isBuffer(data)) {
69
+ if ((0, bytes_js_1.isUint8Array)(data)) {
69
70
  this.decode(data, off || 0, ex, gex);
70
71
  }
71
72
  else if (data) {
@@ -79,18 +80,20 @@ class Header {
79
80
  if (!buf || !(buf.length >= off + 512)) {
80
81
  throw new Error('need 512 bytes for header');
81
82
  }
82
- // Decode the typeflag (independent of any pending PAX/GNU extended header)
83
- // up front so we can tell whether THIS block is itself an intermediary
84
- // extension header (PAX `x`/`g`, GNU long-name `L`, GNU long-link `K`).
85
- // Per POSIX pax, a PAX extended header describes the *next file entry*, not
86
- // the extension headers that may sit between it and that file. Applying the
87
- // pending PAX overrides (notably `size`) to an intervening `L`/`K`/`x`/`g`
88
- // header desynchronizes the stream relative to other tar implementations
89
- // and enables tar interpretation-conflict / file-smuggling attacks.
83
+ // Decode the typeflag (independent of any pending PAX/GNU extended
84
+ // header) up front so we can tell whether THIS block is itself an
85
+ // intermediary extension header (PAX `x`/`g`, GNU long-name `L`,
86
+ // GNU long-link `K`). Per POSIX pax, a PAX extended header
87
+ // describes the *next file entry*, not the extension headers that
88
+ // may sit between it and that file. Applying the pending PAX
89
+ // overrides (notably `size`) to an intervening `L`/`K`/`x`/`g`
90
+ // header desynchronizes the stream relative to other tar
91
+ // implementations and enables tar interpretation-conflict /
92
+ // file-smuggling attacks.
90
93
  const t = decString(buf, off + 156, 1);
91
- const isNormalFS = types.normalFsTypes.has(t);
92
- const exForFields = isNormalFS ? ex : undefined;
93
- const gexForFields = isNormalFS ? gex : undefined;
94
+ const isMeta = /^[xgXLK]$/.test(t);
95
+ const exForFields = isMeta ? undefined : ex;
96
+ const gexForFields = isMeta ? undefined : gex;
94
97
  this.path = exForFields?.path ?? decString(buf, off, 100);
95
98
  this.mode =
96
99
  exForFields?.mode ??
@@ -100,9 +103,9 @@ class Header {
100
103
  exForFields?.uid ?? gexForFields?.uid ?? decNumber(buf, off + 108, 8);
101
104
  this.gid =
102
105
  exForFields?.gid ?? gexForFields?.gid ?? decNumber(buf, off + 116, 8);
103
- this.size = notNegative(exForFields?.size ??
104
- gexForFields?.size ??
105
- decNumber(buf, off + 124, 12));
106
+ this.size = notNegative(
107
+ // A global header does not set a size.
108
+ exForFields?.size ?? decSize(buf, off + 124));
106
109
  this.mtime =
107
110
  exForFields?.mtime ??
108
111
  gexForFields?.mtime ??
@@ -132,8 +135,7 @@ class Header {
132
135
  this.size = 0;
133
136
  }
134
137
  this.linkpath = decString(buf, off + 157, 100);
135
- if (buf.subarray(off + 257, off + 265).toString() === 'ustar\u000000') {
136
- /* c8 ignore start */
138
+ if ((0, bytes_js_1.decodeUtf8)(buf, off + 257, off + 265) === 'ustar\u000000') {
137
139
  this.uname =
138
140
  exForFields?.uname ??
139
141
  gexForFields?.uname ??
@@ -152,7 +154,6 @@ class Header {
152
154
  gexForFields?.devmin ??
153
155
  decNumber(buf, off + 337, 8) ??
154
156
  0;
155
- /* c8 ignore stop */
156
157
  if (buf[off + 475] !== 0) {
157
158
  // definitely a prefix, definitely >130 chars.
158
159
  const prefix = decString(buf, off + 345, 155);
@@ -163,10 +164,8 @@ class Header {
163
164
  if (prefix) {
164
165
  this.path = prefix + '/' + this.path;
165
166
  }
166
- /* c8 ignore start */
167
167
  this.atime = ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
168
168
  this.ctime = ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
169
- /* c8 ignore stop */
170
169
  }
171
170
  }
172
171
  let sum = 8 * 0x20;
@@ -183,12 +182,12 @@ class Header {
183
182
  }
184
183
  #slurp(ex, gex = false) {
185
184
  Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
186
- // we slurp in everything except for the path attribute in
187
- // a global extended header, because that's weird. Also, any
188
- // null/undefined values are ignored.
185
+ // A global extended header does not set a path, a
186
+ // linkpath, or a size. Also, any null/undefined values are
187
+ // ignored.
189
188
  return !(v === null ||
190
189
  v === undefined ||
191
- (k === 'size' && Number(v) < 0) ||
190
+ (k === 'size' && (gex || Number(v) < 0)) ||
192
191
  (k === 'path' && gex) ||
193
192
  (k === 'linkpath' && gex) ||
194
193
  k === 'global');
@@ -196,7 +195,7 @@ class Header {
196
195
  }
197
196
  encode(buf, off = 0) {
198
197
  if (!buf) {
199
- buf = this.block = Buffer.alloc(512);
198
+ buf = this.block = new Uint8Array(512);
200
199
  }
201
200
  if (this.#type === 'Unsupported') {
202
201
  this.#type = '0';
@@ -218,7 +217,7 @@ class Header {
218
217
  buf[off + 156] = Number(this.#type.codePointAt(0));
219
218
  this.needPax =
220
219
  encString(buf, off + 157, 100, this.linkpath) || this.needPax;
221
- buf.write('ustar\u000000', off + 257, 8);
220
+ (0, bytes_js_1.writeAscii)('ustar\u000000', buf, off + 257);
222
221
  this.needPax =
223
222
  encString(buf, off + 265, 32, this.uname) || this.needPax;
224
223
  this.needPax =
@@ -278,29 +277,28 @@ const splitPrefix = (p, prefixSize) => {
278
277
  let pp = p;
279
278
  let prefix = '';
280
279
  let ret = undefined;
281
- const root = node_path_1.posix.parse(p).root || '.';
282
- if (Buffer.byteLength(pp) < pathSize) {
280
+ const root = p.charAt(0) === '/' ? '/' : '.';
281
+ if ((0, bytes_js_1.utf8Length)(pp) < pathSize) {
283
282
  ret = [pp, prefix, false];
284
283
  }
285
284
  else {
286
285
  // first set prefix to the dir, and path to the base
287
- prefix = node_path_1.posix.dirname(pp);
288
- pp = node_path_1.posix.basename(pp);
286
+ prefix = (0, path_js_1.dirname)(pp);
287
+ pp = (0, path_js_1.basename)(pp);
289
288
  do {
290
- if (Buffer.byteLength(pp) <= pathSize &&
291
- Buffer.byteLength(prefix) <= prefixSize) {
289
+ if ((0, bytes_js_1.utf8Length)(pp) <= pathSize && (0, bytes_js_1.utf8Length)(prefix) <= prefixSize) {
292
290
  // both fit!
293
291
  ret = [pp, prefix, false];
294
292
  }
295
- else if (Buffer.byteLength(pp) > pathSize &&
296
- Buffer.byteLength(prefix) <= prefixSize) {
293
+ else if ((0, bytes_js_1.utf8Length)(pp) > pathSize &&
294
+ (0, bytes_js_1.utf8Length)(prefix) <= prefixSize) {
297
295
  // prefix fits in prefix, but path doesn't fit in path
298
296
  ret = [pp.slice(0, pathSize - 1), prefix, true];
299
297
  }
300
298
  else {
301
299
  // make path take a bit from prefix
302
- pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp);
303
- prefix = node_path_1.posix.dirname(prefix);
300
+ pp = (0, path_js_1.join)((0, path_js_1.basename)(prefix), pp);
301
+ prefix = (0, path_js_1.dirname)(prefix);
304
302
  }
305
303
  } while (prefix !== root && ret === undefined);
306
304
  // at this point, found no resolution, just truncate
@@ -310,21 +308,43 @@ const splitPrefix = (p, prefixSize) => {
310
308
  }
311
309
  return ret;
312
310
  };
313
- const decString = (buf, off, size) => buf
314
- .subarray(off, off + size)
315
- .toString('utf8')
316
- .replace(/\0.*/, '');
311
+ // The string ends at the first NUL, or at the end of the field.
312
+ const decString = (buf, off, size) => {
313
+ let end = off;
314
+ const max = Math.min(off + size, buf.length);
315
+ while (end < max && buf[end] !== 0)
316
+ end++;
317
+ return (0, bytes_js_1.decodeUtf8)(buf, off, end);
318
+ };
317
319
  const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size));
318
320
  const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000);
319
321
  const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ?
320
- large.parse(buf.subarray(off, off + size))
322
+ decLarge(buf.subarray(off, off + size))
321
323
  : decSmallNumber(buf, off, size);
324
+ // A base-256 field that is not valid has no value.
325
+ const decLarge = (buf) => {
326
+ try {
327
+ return large.parse(buf);
328
+ }
329
+ catch {
330
+ return undefined;
331
+ }
332
+ };
333
+ // The size sets where the next header is. Other tar programs read a
334
+ // field that is not only octal digits in different ways, so such a
335
+ // field has no value. A field with no digits is 0.
336
+ const decSize = (buf, off) => {
337
+ if (Number(buf[off]) & 0x80)
338
+ return decNumber(buf, off, 12);
339
+ const s = decString(buf, off, 12);
340
+ // No byte after the first NUL has a value.
341
+ return (/^ *[0-7]* *$/.test(s) &&
342
+ buf.subarray(off + s.length, off + 12).every(b => b === 0)) ?
343
+ parseInt(s, 8) || 0
344
+ : undefined;
345
+ };
322
346
  const nanUndef = (value) => (isNaN(value) ? undefined : value);
323
- const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf
324
- .subarray(off, off + size)
325
- .toString('utf8')
326
- .replace(/\0.*$/, '')
327
- .trim(), 8));
347
+ const decSmallNumber = (buf, off, size) => nanUndef(parseInt(decString(buf, off, size).trim(), 8));
328
348
  // the maximum encodable as a null-terminated octal, by field size
329
349
  const MAXNUM = {
330
350
  12: 0o77777777777,
@@ -334,15 +354,13 @@ const encNumber = (buf, off, size, num) => num === undefined ? false
334
354
  : num > MAXNUM[size] || num < 0 ?
335
355
  (large.encode(num, buf.subarray(off, off + size)), true)
336
356
  : (encSmallNumber(buf, off, size, num), false);
337
- const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii');
357
+ const encSmallNumber = (buf, off, size, num) => (0, bytes_js_1.writeAscii)(octalString(num, size), buf, off);
338
358
  const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size);
339
359
  const padOctal = (str, size) => (str.length === size - 1 ?
340
360
  str
341
- : new Array(size - str.length - 1).join('0') + str + ' ') + '\0';
361
+ : '0'.repeat(size - str.length - 2) + str + ' ') + '\0';
342
362
  const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000));
343
- // enough to fill the longest string we've got
344
- const NULLS = new Array(156).join('\0');
345
363
  // pad with nulls, return true if it's longer or non-ascii
346
- const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'),
347
- str.length !== Buffer.byteLength(str) || str.length > size));
364
+ const encString = (buf, off, size, str) => str === undefined ? false : (((0, bytes_js_1.encodeUtf8Into)(str, buf, off, size),
365
+ str.length !== (0, bytes_js_1.utf8Length)(str) || str.length > size));
348
366
  //# sourceMappingURL=header.js.map
@@ -1,20 +1,27 @@
1
- export { type TarOptionsWithAliasesAsync, type TarOptionsWithAliasesAsyncFile, type TarOptionsWithAliasesAsyncNoFile, type TarOptionsWithAliasesSyncNoFile, type TarOptionsWithAliases, type TarOptionsWithAliasesFile, type TarOptionsWithAliasesSync, type TarOptionsWithAliasesSyncFile, } from './options.js';
2
- export * from './create.js';
3
- export { create as c } from './create.js';
4
- export * from './extract.js';
5
- export { extract as x } from './extract.js';
6
- export * from './header.js';
7
- export * from './list.js';
8
- export { list as t } from './list.js';
9
- export * from './pack.js';
10
- export * from './parse.js';
11
- export * from './pax.js';
12
- export * from './read-entry.js';
13
- export * from './replace.js';
14
- export { replace as r } from './replace.js';
1
+ export { Header, type HeaderData } from './header.js';
2
+ export { Pax } from './pax.js';
15
3
  export * as types from './types.js';
16
- export * from './unpack.js';
17
- export * from './update.js';
18
- export { update as u } from './update.js';
19
- export * from './write-entry.js';
4
+ export { gzip, type Codec, type CodecStream } from './codec.js';
5
+ export { create, create as c } from './create.js';
6
+ export { delete } from './delete.js';
7
+ export { CwdError } from './cwd-error.js';
8
+ export { aliases } from './dealias.js';
9
+ export type { Aliased, Aliases, AliasOf, FileOption, NoFileOption, RequiredOption, WithAliases, } from './dealias.js';
10
+ export { entries, EntryCursor, TarReader } from './entries.js';
11
+ export { extract, extract as x } from './extract.js';
12
+ export type * from './fs.js';
13
+ export { list, list as t } from './list.js';
14
+ export type { MkdirOptions } from './mkdir.js';
15
+ export type * from './options.js';
16
+ export { Pack, PackBase, PackJob, type Ancestor, type QueueNode, type PackInput, type PackInputSync, type PackLoad, } from './pack.js';
17
+ export { Parser, type CreateEntry, type ParseEvent } from './parser.js';
18
+ export { PathReservations } from './path-reservations.js';
19
+ export { EntryData, ReadEntry, type BodySource, type BodySourceSync, } from './read-entry.js';
20
+ export { AppendScan, replace, replace as r } from './replace.js';
21
+ export { SymlinkError } from './symlink-error.js';
22
+ export { Unpack, UnpackBase, type UnpackBaseOptions } from './unpack.js';
23
+ export { update, update as u } from './update.js';
24
+ export type { TarError, WarnData, WarnOptions } from './warn.js';
25
+ export { WriteEntry, type EncodeOptions, type WriteBody, type WriteEntryData, } from './write-entry.js';
26
+ export type { OpenConstants } from './write-flag.js';
20
27
  //# sourceMappingURL=index.d.ts.map