hammerkit 1.27.0-next.10 → 1.27.0-next.11

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 (2) hide show
  1. package/dist/utils/tar.js +12 -1
  2. package/package.json +1 -1
package/dist/utils/tar.js CHANGED
@@ -11,14 +11,25 @@ exports.packArchive = packArchive;
11
11
  // ids above 2^53 are rounded and files of two link groups can get the same one. Packed as
12
12
  // a link, a file would be restored with the other file's content. This cache leaves out the
13
13
  // ids that may be rounded, so those files are packed in full.
14
+ //
15
+ // node-tar asks the cache in two places. A WriteEntry links to the path it gets only when
16
+ // that path is in the packed directory, and packs the file in full otherwise. The Pack treats
17
+ // a file it gets no path for as the first of its links, and takes a path for it that ends
18
+ // the archive a second time when the file is empty and the last one packed: an empty file
19
+ // whose other link is outside the packed directory, as in a pnpm node_modules, or any empty
20
+ // file with a rounded id. That throws "write after end" (a zlib stream error with gzip)
21
+ // where nothing can catch it. With one file read at a time that path is not needed, so the
22
+ // cache never answers with nothing: for a file it has no path for, it answers NOT_PACKED,
23
+ // which is in no directory.
14
24
  class ExactLinkCache extends Map {
15
25
  get(key) {
16
- return isExact(key) ? super.get(key) : undefined;
26
+ return super.get(key) || NOT_PACKED;
17
27
  }
18
28
  set(key, path) {
19
29
  return isExact(key) ? super.set(key, path) : this;
20
30
  }
21
31
  }
32
+ const NOT_PACKED = '\0';
22
33
  function isExact(key) {
23
34
  return key.split(':').every((part) => Number.isSafeInteger(Number(part)));
24
35
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hammerkit",
3
3
  "description": "Containerized build tool with incremental caching that runs the same build file locally, in Docker and on Kubernetes.",
4
- "version": "1.27.0-next.10",
4
+ "version": "1.27.0-next.11",
5
5
  "keywords": [
6
6
  "build",
7
7
  "build-tool",