@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,36 +1,122 @@
1
- import { Minipass } from 'minipass';
2
1
  import type { Header } from './header.js';
3
2
  import type { Pax } from './pax.js';
4
3
  import type { EntryTypeName } from './types.js';
5
- export declare class ReadEntry extends Minipass<Buffer, Buffer> {
4
+ /**
5
+ * The metadata of one archive entry: the header fields, with the
6
+ * values of the PAX and GNU extended headers applied.
7
+ */
8
+ export declare class EntryData {
6
9
  #private;
10
+ /** The header block of the entry. */
11
+ header: Header;
12
+ /** The PAX header that applies to this entry only. */
7
13
  extended?: Pax;
14
+ /** The global PAX header in effect. */
8
15
  globalExtended?: Pax;
9
- header: Header;
10
- startBlockSize: number;
11
- blockRemain: number;
12
- remain: number;
13
16
  type: EntryTypeName;
14
- meta: boolean;
15
- ignore: boolean;
16
17
  path: string;
18
+ /** The permission bits only. */
17
19
  mode?: number;
18
20
  uid?: number;
19
21
  gid?: number;
20
22
  uname?: string;
21
23
  gname?: string;
24
+ /** The number of bytes in the body. */
22
25
  size: number;
23
26
  mtime?: Date;
24
27
  atime?: Date;
25
28
  ctime?: Date;
26
29
  linkpath?: string;
30
+ devmaj: number;
31
+ devmin: number;
27
32
  dev?: number;
28
33
  ino?: number;
29
34
  nlink?: number;
30
- invalid: boolean;
35
+ /** The absolute path of the entry, when a consumer resolves it. */
31
36
  absolute?: string;
37
+ /**
38
+ * The body is skipped. Set for a type that is not an object of the
39
+ * file system, and for an entry that the filter refuses.
40
+ */
41
+ ignore: boolean;
42
+ /** A consumer sets this when it refuses the entry. */
43
+ invalid: boolean;
44
+ /** A consumer sets this when it does not support the type. */
32
45
  unsupported: boolean;
33
- constructor(header: Header, ex?: Pax, gex?: Pax);
34
- write(data: Buffer): boolean;
46
+ /**
47
+ * @param win32 change each `\` in `path` and `linkpath` to `/`
48
+ */
49
+ constructor(header: Header, ex?: Pax, gex?: Pax, win32?: boolean);
50
+ }
51
+ /** Where a `ReadEntry` gets its body. */
52
+ export type BodySource = {
53
+ /**
54
+ * The next part of the body of `entry`. `null` at the end of the
55
+ * body. `undefined` if more input is needed: then await `fill()`
56
+ * and call this again. Throws if the source moved to a later entry.
57
+ */
58
+ readBody(entry: ReadEntry): Uint8Array | null | undefined;
59
+ /** Read more input. */
60
+ fill(): Promise<void>;
61
+ };
62
+ /** Where a `ReadEntrySync` gets its body. */
63
+ export type BodySourceSync = {
64
+ /**
65
+ * The next part of the body of `entry`, or `null` at the end of the
66
+ * body. Throws if the source moved to a later entry.
67
+ */
68
+ readBody(entry: ReadEntrySync): Uint8Array | null;
69
+ };
70
+ /**
71
+ * An archive entry with its body, in the shape of a `Response`. The
72
+ * body can be consumed one time, in one way. It must be consumed
73
+ * before the next entry is read: after that, the rest of it is gone.
74
+ */
75
+ export declare class ReadEntry extends EntryData {
76
+ #private;
77
+ constructor(header: Header, ex?: Pax, gex?: Pax, win32?: boolean, source?: BodySource);
78
+ /** True when the body started to be consumed. */
79
+ get bodyUsed(): boolean;
80
+ /**
81
+ * The body as a stream. Each chunk is a view into the input, not a
82
+ * copy. Input is read only when the stream is read.
83
+ */
84
+ get body(): ReadableStream<Uint8Array>;
85
+ /** The body in a new `Uint8Array`. */
86
+ bytes(): Promise<Uint8Array<ArrayBuffer>>;
87
+ /** The body in a new `ArrayBuffer`. */
88
+ arrayBuffer(): Promise<ArrayBuffer>;
89
+ /**
90
+ * The body, decoded as UTF-8. As with `Response.text()`, a byte
91
+ * order mark at the start is not in the text.
92
+ */
93
+ text(): Promise<string>;
94
+ /** The body in a new `Blob`. */
95
+ blob(): Promise<Blob>;
96
+ }
97
+ /**
98
+ * An archive entry with its body, for sync code. The body can be
99
+ * consumed one time, in one way. It must be consumed before the next
100
+ * entry is read: after that, the rest of it is gone.
101
+ */
102
+ export declare class ReadEntrySync extends EntryData {
103
+ #private;
104
+ constructor(header: Header, ex?: Pax, gex?: Pax, win32?: boolean, source?: BodySourceSync);
105
+ /** True when the body started to be consumed. */
106
+ get bodyUsed(): boolean;
107
+ /**
108
+ * The parts of the body. Each one is a view into the input, not a
109
+ * copy. Input is read only when the iterator is read.
110
+ */
111
+ get body(): IterableIterator<Uint8Array>;
112
+ /** The body in a new `Uint8Array`. */
113
+ bytes(): Uint8Array<ArrayBuffer>;
114
+ /** The body in a new `ArrayBuffer`. */
115
+ arrayBuffer(): ArrayBuffer;
116
+ /**
117
+ * The body, decoded as UTF-8. A byte order mark at the start is not
118
+ * in the text.
119
+ */
120
+ text(): string;
35
121
  }
36
122
  //# sourceMappingURL=read-entry.d.ts.map
@@ -1,136 +1,290 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReadEntry = void 0;
4
- const minipass_1 = require("minipass");
5
- const normalize_windows_path_js_1 = require("./normalize-windows-path.js");
6
- class ReadEntry extends minipass_1.Minipass {
3
+ exports.ReadEntrySync = exports.ReadEntry = exports.EntryData = void 0;
4
+ const concat_js_1 = require("./concat.js");
5
+ // The types that are an object of the file system.
6
+ const fsTypes = new Set([
7
+ 'File',
8
+ 'OldFile',
9
+ 'Link',
10
+ 'SymbolicLink',
11
+ 'CharacterDevice',
12
+ 'BlockDevice',
13
+ 'Directory',
14
+ 'FIFO',
15
+ 'ContiguousFile',
16
+ 'GNUDumpDir',
17
+ ]);
18
+ const winPath = (path) => path.replaceAll('\\', '/');
19
+ /**
20
+ * The metadata of one archive entry: the header fields, with the
21
+ * values of the PAX and GNU extended headers applied.
22
+ */
23
+ class EntryData {
24
+ /** The header block of the entry. */
25
+ header;
26
+ /** The PAX header that applies to this entry only. */
7
27
  extended;
28
+ /** The global PAX header in effect. */
8
29
  globalExtended;
9
- header;
10
- startBlockSize;
11
- blockRemain;
12
- remain;
13
30
  type;
14
- meta = false;
15
- ignore = false;
16
31
  path;
32
+ /** The permission bits only. */
17
33
  mode;
18
34
  uid;
19
35
  gid;
20
36
  uname;
21
37
  gname;
22
- size = 0;
38
+ /** The number of bytes in the body. */
39
+ size;
23
40
  mtime;
24
41
  atime;
25
42
  ctime;
26
43
  linkpath;
44
+ devmaj;
45
+ devmin;
27
46
  dev;
28
47
  ino;
29
48
  nlink;
30
- invalid = false;
49
+ /** The absolute path of the entry, when a consumer resolves it. */
31
50
  absolute;
51
+ /**
52
+ * The body is skipped. Set for a type that is not an object of the
53
+ * file system, and for an entry that the filter refuses.
54
+ */
55
+ ignore;
56
+ /** A consumer sets this when it refuses the entry. */
57
+ invalid = false;
58
+ /** A consumer sets this when it does not support the type. */
32
59
  unsupported = false;
33
- constructor(header, ex, gex) {
34
- super({});
35
- // read entries always start life paused. this is to avoid the
36
- // situation where Minipass's auto-ending empty streams results
37
- // in an entry ending before we're ready for it.
38
- this.pause();
39
- this.extended = ex;
40
- this.globalExtended = gex;
41
- this.header = header;
42
- /* c8 ignore start */
43
- this.remain = header.size ?? 0;
44
- /* c8 ignore stop */
45
- this.startBlockSize = 512 * Math.ceil(this.remain / 512);
46
- this.blockRemain = this.startBlockSize;
47
- this.type = header.type;
48
- switch (this.type) {
49
- case 'File':
50
- case 'OldFile':
51
- case 'Link':
52
- case 'SymbolicLink':
53
- case 'CharacterDevice':
54
- case 'BlockDevice':
55
- case 'Directory':
56
- case 'FIFO':
57
- case 'ContiguousFile':
58
- case 'GNUDumpDir':
59
- break;
60
- case 'NextFileHasLongLinkpath':
61
- case 'NextFileHasLongPath':
62
- case 'OldGnuLongPath':
63
- case 'GlobalExtendedHeader':
64
- case 'ExtendedHeader':
65
- case 'OldExtendedHeader':
66
- this.meta = true;
67
- break;
68
- // NOTE: gnutar and bsdtar treat unrecognized types as 'File'
69
- // it may be worth doing the same, but with a warning.
70
- default:
71
- this.ignore = true;
72
- }
73
- /* c8 ignore start */
60
+ /**
61
+ * @param win32 change each `\` in `path` and `linkpath` to `/`
62
+ */
63
+ constructor(header, ex, gex, win32 = false) {
74
64
  if (!header.path) {
75
65
  throw new Error('no path provided for tar.ReadEntry');
76
66
  }
77
- /* c8 ignore stop */
78
- this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.path);
79
- this.mode = header.mode;
80
- if (this.mode) {
81
- this.mode = this.mode & 0o7777;
82
- }
67
+ this.header = header;
68
+ this.extended = ex;
69
+ this.globalExtended = gex;
70
+ this.type = header.type;
71
+ this.ignore = !fsTypes.has(this.type);
72
+ this.path = win32 ? winPath(header.path) : header.path;
73
+ this.mode = header.mode && header.mode & 0o7777;
83
74
  this.uid = header.uid;
84
75
  this.gid = header.gid;
85
76
  this.uname = header.uname;
86
77
  this.gname = header.gname;
87
- this.size = this.remain;
78
+ this.size = header.size ?? 0;
88
79
  this.mtime = header.mtime;
89
80
  this.atime = header.atime;
90
81
  this.ctime = header.ctime;
91
- /* c8 ignore start */
82
+ // Only a link has a linkpath. Other tar programs do not use the
83
+ // link name of an entry of a different type.
84
+ const link = this.type === 'Link' || this.type === 'SymbolicLink';
92
85
  this.linkpath =
93
- header.linkpath ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.linkpath) : undefined;
94
- /* c8 ignore stop */
95
- this.uname = header.uname;
96
- this.gname = header.gname;
86
+ link && header.linkpath ?
87
+ win32 ? winPath(header.linkpath)
88
+ : header.linkpath
89
+ : undefined;
90
+ this.devmaj = header.devmaj;
91
+ this.devmin = header.devmin;
92
+ // Apply the global values first, so that the local values win.
93
+ // The header already has the size.
94
+ if (gex)
95
+ this.#apply(gex);
97
96
  if (ex) {
98
- this.#slurp(ex);
99
- }
100
- if (gex) {
101
- this.#slurp(gex, true);
97
+ this.#apply(ex);
98
+ // A global header does not set a path or a linkpath.
99
+ if (ex.path != null)
100
+ this.path = win32 ? winPath(ex.path) : ex.path;
101
+ if (link && ex.linkpath != null) {
102
+ this.linkpath = win32 ? winPath(ex.linkpath) : ex.linkpath;
103
+ }
102
104
  }
103
105
  }
104
- write(data) {
105
- const writeLen = data.length;
106
- if (writeLen > this.blockRemain) {
107
- throw new Error('writing more to entry than is appropriate');
108
- }
109
- const r = this.remain;
110
- const br = this.blockRemain;
111
- this.remain = Math.max(0, r - writeLen);
112
- this.blockRemain = Math.max(0, br - writeLen);
113
- if (this.ignore) {
114
- return true;
115
- }
116
- if (r >= writeLen) {
117
- return super.write(data);
106
+ #apply(ex) {
107
+ if (ex.uid != null)
108
+ this.uid = ex.uid;
109
+ if (ex.gid != null)
110
+ this.gid = ex.gid;
111
+ if (ex.uname != null)
112
+ this.uname = ex.uname;
113
+ if (ex.gname != null)
114
+ this.gname = ex.gname;
115
+ if (ex.mtime != null)
116
+ this.mtime = ex.mtime;
117
+ if (ex.atime != null)
118
+ this.atime = ex.atime;
119
+ if (ex.ctime != null)
120
+ this.ctime = ex.ctime;
121
+ if (ex.dev != null)
122
+ this.dev = ex.dev;
123
+ if (ex.ino != null)
124
+ this.ino = ex.ino;
125
+ if (ex.nlink != null)
126
+ this.nlink = ex.nlink;
127
+ }
128
+ }
129
+ exports.EntryData = EntryData;
130
+ // As `Response.text()` does, this decoder removes a byte order mark
131
+ // at the start of the body.
132
+ const decoder = new TextDecoder();
133
+ const decode = (parts) => {
134
+ let text = '';
135
+ for (const part of parts)
136
+ text += decoder.decode(part, { stream: true });
137
+ return text + decoder.decode();
138
+ };
139
+ const usedError = () => new TypeError('Body has already been consumed');
140
+ /**
141
+ * An archive entry with its body, in the shape of a `Response`. The
142
+ * body can be consumed one time, in one way. It must be consumed
143
+ * before the next entry is read: after that, the rest of it is gone.
144
+ */
145
+ class ReadEntry extends EntryData {
146
+ #source;
147
+ #used = false;
148
+ #stream;
149
+ constructor(header, ex, gex, win32, source) {
150
+ super(header, ex, gex, win32);
151
+ this.#source = source;
152
+ }
153
+ /** True when the body started to be consumed. */
154
+ get bodyUsed() {
155
+ return this.#used;
156
+ }
157
+ /**
158
+ * The body as a stream. Each chunk is a view into the input, not a
159
+ * copy. Input is read only when the stream is read.
160
+ */
161
+ get body() {
162
+ if (this.#stream)
163
+ return this.#stream;
164
+ let started = false;
165
+ return (this.#stream = new ReadableStream({
166
+ pull: async (controller) => {
167
+ if (!started) {
168
+ this.#claim();
169
+ started = true;
170
+ }
171
+ const [part] = await this.#read(1);
172
+ if (part)
173
+ controller.enqueue(part);
174
+ else
175
+ controller.close();
176
+ },
177
+ }, { highWaterMark: 0 }));
178
+ }
179
+ #claim() {
180
+ if (this.#used)
181
+ throw usedError();
182
+ this.#used = true;
183
+ }
184
+ // Add the parts of the body that are in memory to `parts`, up to
185
+ // `max` parts. False if the body has more parts that need input.
186
+ #collect(parts, max = Infinity) {
187
+ const source = this.#source;
188
+ while (source && parts.length < max) {
189
+ const part = source.readBody(this);
190
+ if (part === null)
191
+ break;
192
+ if (part === undefined)
193
+ return false;
194
+ parts.push(part);
118
195
  }
119
- // r < writeLen
120
- return super.write(data.subarray(0, r));
121
- }
122
- #slurp(ex, gex = false) {
123
- if (ex.path)
124
- ex.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.path);
125
- if (ex.linkpath)
126
- ex.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.linkpath);
127
- Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => {
128
- // we slurp in everything except for the path attribute in
129
- // a global extended header, because that's weird. Also, any
130
- // null/undefined values are ignored.
131
- return !(v === null || v === undefined || (k === 'path' && gex));
132
- })));
196
+ return true;
197
+ }
198
+ // Read all the parts of the body that are left, or `max` of them.
199
+ async #read(max) {
200
+ const parts = [];
201
+ while (!this.#collect(parts, max))
202
+ await this.#source?.fill();
203
+ return parts;
204
+ }
205
+ /** The body in a new `Uint8Array`. */
206
+ async bytes() {
207
+ this.#claim();
208
+ const parts = [];
209
+ while (!this.#collect(parts))
210
+ await this.#source?.fill();
211
+ return (0, concat_js_1.concat)(parts);
212
+ }
213
+ /** The body in a new `ArrayBuffer`. */
214
+ async arrayBuffer() {
215
+ return (await this.bytes()).buffer;
216
+ }
217
+ /**
218
+ * The body, decoded as UTF-8. As with `Response.text()`, a byte
219
+ * order mark at the start is not in the text.
220
+ */
221
+ async text() {
222
+ this.#claim();
223
+ return decode(await this.#read());
224
+ }
225
+ /** The body in a new `Blob`. */
226
+ async blob() {
227
+ this.#claim();
228
+ return new Blob((await this.#read()));
133
229
  }
134
230
  }
135
231
  exports.ReadEntry = ReadEntry;
232
+ /**
233
+ * An archive entry with its body, for sync code. The body can be
234
+ * consumed one time, in one way. It must be consumed before the next
235
+ * entry is read: after that, the rest of it is gone.
236
+ */
237
+ class ReadEntrySync extends EntryData {
238
+ #source;
239
+ #used = false;
240
+ #body;
241
+ constructor(header, ex, gex, win32, source) {
242
+ super(header, ex, gex, win32);
243
+ this.#source = source;
244
+ }
245
+ /** True when the body started to be consumed. */
246
+ get bodyUsed() {
247
+ return this.#used;
248
+ }
249
+ /**
250
+ * The parts of the body. Each one is a view into the input, not a
251
+ * copy. Input is read only when the iterator is read.
252
+ */
253
+ get body() {
254
+ return (this.#body ??= this.#iterate());
255
+ }
256
+ *#iterate() {
257
+ this.#claim();
258
+ for (let part; (part = this.#source?.readBody(this));)
259
+ yield part;
260
+ }
261
+ #claim() {
262
+ if (this.#used)
263
+ throw usedError();
264
+ this.#used = true;
265
+ }
266
+ #read() {
267
+ this.#claim();
268
+ const parts = [];
269
+ for (let part; (part = this.#source?.readBody(this));)
270
+ parts.push(part);
271
+ return parts;
272
+ }
273
+ /** The body in a new `Uint8Array`. */
274
+ bytes() {
275
+ return (0, concat_js_1.concat)(this.#read());
276
+ }
277
+ /** The body in a new `ArrayBuffer`. */
278
+ arrayBuffer() {
279
+ return this.bytes().buffer;
280
+ }
281
+ /**
282
+ * The body, decoded as UTF-8. A byte order mark at the start is not
283
+ * in the text.
284
+ */
285
+ text() {
286
+ return decode(this.#read());
287
+ }
288
+ }
289
+ exports.ReadEntrySync = ReadEntrySync;
136
290
  //# sourceMappingURL=read-entry.js.map
@@ -0,0 +1,22 @@
1
+ import type { TarFS, TarFSSync } from './fs.js';
2
+ /**
3
+ * The key of the method of a chunk source that skips input. A
4
+ * `TarReader` calls it with the number of bytes of a body that are
5
+ * after the chunks given so far, when no consumer reads that body.
6
+ * If it returns true, the next chunk starts after those bytes.
7
+ */
8
+ export declare const SKIP: unique symbol;
9
+ /** A chunk source that can skip input. */
10
+ export type Skip = {
11
+ [SKIP](n: number): boolean;
12
+ };
13
+ /**
14
+ * Read a file in chunks of `maxReadSize` bytes at most. The default,
15
+ * and the value for 0, is 16 MiB. Each chunk is a new array. The
16
+ * first chunk is small, and the chunks grow. A reader can skip a
17
+ * large part of the file.
18
+ */
19
+ export declare const readFile: (fs: TarFS, file: string, maxReadSize?: number) => AsyncGenerator<Uint8Array, void, void> & Skip;
20
+ /** The sync form of `readFile`. */
21
+ export declare const readFileSync: (fs: TarFSSync, file: string, maxReadSize?: number) => Generator<Uint8Array, void, void> & Skip;
22
+ //# sourceMappingURL=read-file.d.ts.map
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readFileSync = exports.readFile = exports.SKIP = void 0;
4
+ const options_js_1 = require("./options.js");
5
+ const MAX_READ = 16 * 1024 * 1024;
6
+ // The size of the first read, and of the read after a skip.
7
+ const FIRST_READ = 64 * 1024;
8
+ // A skip of fewer bytes than this is slower than a read of them.
9
+ const MIN_SKIP = 1024 * 1024;
10
+ /**
11
+ * The key of the method of a chunk source that skips input. A
12
+ * `TarReader` calls it with the number of bytes of a body that are
13
+ * after the chunks given so far, when no consumer reads that body.
14
+ * If it returns true, the next chunk starts after those bytes.
15
+ */
16
+ exports.SKIP = Symbol.for('tar.readFile.skip');
17
+ // The place and the size of the next read of a file.
18
+ class Plan {
19
+ pos = 0;
20
+ /** The size of the file. 0 before the file is open. */
21
+ size = 0;
22
+ #max;
23
+ #want = FIRST_READ;
24
+ constructor(maxReadSize) {
25
+ this.#max = (0, options_js_1.countOption)('maxReadSize', maxReadSize, MAX_READ);
26
+ }
27
+ // The number of bytes to read at `pos`. 0 at the end of the file.
28
+ // Each read is two times the size of the read before it, so that
29
+ // an archive of small entries is read in few reads.
30
+ next() {
31
+ const n = Math.min(this.#want, this.#max, this.size - this.pos);
32
+ this.#want *= 2;
33
+ return n;
34
+ }
35
+ // Skip only inside the file: the parser must see where a truncated
36
+ // file ends. The read after a skip is small, because a header
37
+ // comes next, and the body after it can be skipped also.
38
+ skip(n) {
39
+ if (n < MIN_SKIP || this.pos + n > this.size)
40
+ return false;
41
+ this.pos += n;
42
+ this.#want = FIRST_READ;
43
+ return true;
44
+ }
45
+ }
46
+ async function* chunks(fs, file, plan) {
47
+ const handle = await fs.open(file, 'r');
48
+ try {
49
+ plan.size = (await handle.stat()).size;
50
+ for (let n; (n = plan.next());) {
51
+ const buf = new Uint8Array(n);
52
+ const { bytesRead } = await handle.read(buf, 0, n, plan.pos);
53
+ if (!bytesRead)
54
+ break;
55
+ plan.pos += bytesRead;
56
+ yield bytesRead < n ? buf.subarray(0, bytesRead) : buf;
57
+ }
58
+ }
59
+ finally {
60
+ await handle.close().catch(() => { });
61
+ }
62
+ }
63
+ function* chunksSync(fs, file, plan) {
64
+ const fd = fs.openSync(file, 'r');
65
+ try {
66
+ plan.size = fs.fstatSync(fd).size;
67
+ for (let n; (n = plan.next());) {
68
+ const buf = new Uint8Array(n);
69
+ const bytesRead = fs.readSync(fd, buf, 0, n, plan.pos);
70
+ if (!bytesRead)
71
+ break;
72
+ plan.pos += bytesRead;
73
+ yield bytesRead < n ? buf.subarray(0, bytesRead) : buf;
74
+ }
75
+ }
76
+ finally {
77
+ try {
78
+ fs.closeSync(fd);
79
+ }
80
+ catch { }
81
+ }
82
+ }
83
+ /**
84
+ * Read a file in chunks of `maxReadSize` bytes at most. The default,
85
+ * and the value for 0, is 16 MiB. Each chunk is a new array. The
86
+ * first chunk is small, and the chunks grow. A reader can skip a
87
+ * large part of the file.
88
+ */
89
+ const readFile = (fs, file, maxReadSize) => {
90
+ const plan = new Plan(maxReadSize);
91
+ return Object.assign(chunks(fs, file, plan), {
92
+ [exports.SKIP]: (n) => plan.skip(n),
93
+ });
94
+ };
95
+ exports.readFile = readFile;
96
+ /** The sync form of `readFile`. */
97
+ const readFileSync = (fs, file, maxReadSize) => {
98
+ const plan = new Plan(maxReadSize);
99
+ return Object.assign(chunksSync(fs, file, plan), {
100
+ [exports.SKIP]: (n) => plan.skip(n),
101
+ });
102
+ };
103
+ exports.readFileSync = readFileSync;
104
+ //# sourceMappingURL=read-file.js.map