From 60b99bff8a9021e95602e400332076dd61b9ced2 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 23 Sep 2025 14:12:49 -0700 Subject: [PATCH] deps: tar@7.5.1 --- DEPENDENCIES.md | 2 - node_modules/.gitignore | 22 +- node_modules/chownr/LICENSE | 15 - .../node_modules => }/chownr/LICENSE.md | 0 node_modules/chownr/chownr.js | 167 ---- .../chownr/dist/commonjs/index.js | 0 .../chownr/dist/commonjs/package.json | 0 .../chownr/dist/esm/index.js | 0 .../dist/mjs => chownr/dist/esm}/package.json | 0 node_modules/chownr/package.json | 61 +- node_modules/minizlib/dist/commonjs/index.js | 40 +- node_modules/minizlib/dist/esm/index.js | 37 +- node_modules/minizlib/package.json | 4 +- node_modules/mkdirp/LICENSE | 21 - node_modules/mkdirp/dist/cjs/package.json | 91 -- node_modules/mkdirp/dist/cjs/src/bin.js | 80 -- node_modules/mkdirp/dist/cjs/src/find-made.js | 35 - node_modules/mkdirp/dist/cjs/src/index.js | 53 - .../mkdirp/dist/cjs/src/mkdirp-manual.js | 79 -- .../mkdirp/dist/cjs/src/mkdirp-native.js | 50 - node_modules/mkdirp/dist/cjs/src/opts-arg.js | 38 - node_modules/mkdirp/dist/cjs/src/path-arg.js | 28 - .../mkdirp/dist/cjs/src/use-native.js | 17 - node_modules/mkdirp/dist/mjs/find-made.js | 30 - node_modules/mkdirp/dist/mjs/index.js | 43 - node_modules/mkdirp/dist/mjs/mkdirp-manual.js | 75 -- node_modules/mkdirp/dist/mjs/mkdirp-native.js | 46 - node_modules/mkdirp/dist/mjs/opts-arg.js | 34 - node_modules/mkdirp/dist/mjs/path-arg.js | 24 - node_modules/mkdirp/dist/mjs/use-native.js | 14 - node_modules/mkdirp/package.json | 91 -- .../node-gyp/node_modules/chownr/package.json | 69 -- .../node-gyp/node_modules/tar/LICENSE | 15 - .../node_modules/tar/dist/commonjs/list.js | 136 --- .../node_modules/tar/dist/commonjs/mkdir.js | 209 ---- .../tar/dist/commonjs/normalize-unicode.js | 17 - .../node_modules/tar/dist/commonjs/parse.js | 599 ------------ .../node_modules/tar/dist/commonjs/replace.js | 231 ----- .../node_modules/tar/dist/commonjs/unpack.js | 919 ----------------- .../node_modules/tar/dist/esm/list.js | 106 -- .../node_modules/tar/dist/esm/mkdir.js | 201 ---- .../tar/dist/esm/normalize-unicode.js | 13 - .../node_modules/tar/dist/esm/unpack.js | 888 ----------------- .../node-gyp/node_modules/tar/package.json | 325 ------ .../yallist/dist/esm/package.json | 3 - .../pacote/node_modules/chownr/LICENSE.md | 63 -- .../chownr/dist/commonjs/index.js | 93 -- .../chownr/dist/commonjs/package.json | 3 - .../node_modules/chownr/dist/esm/index.js | 85 -- .../node_modules/chownr/dist/esm/package.json | 3 - .../pacote/node_modules/chownr/package.json | 69 -- node_modules/pacote/node_modules/tar/LICENSE | 15 - .../node_modules/tar/dist/commonjs/create.js | 83 -- .../tar/dist/commonjs/cwd-error.js | 18 - .../node_modules/tar/dist/commonjs/extract.js | 78 -- .../tar/dist/commonjs/get-write-flag.js | 29 - .../node_modules/tar/dist/commonjs/header.js | 306 ------ .../node_modules/tar/dist/commonjs/index.js | 54 - .../tar/dist/commonjs/large-numbers.js | 99 -- .../tar/dist/commonjs/make-command.js | 61 -- .../tar/dist/commonjs/mode-fix.js | 29 - .../dist/commonjs/normalize-windows-path.js | 12 - .../node_modules/tar/dist/commonjs/options.js | 66 -- .../node_modules/tar/dist/commonjs/pack.js | 477 --------- .../tar/dist/commonjs/package.json | 3 - .../tar/dist/commonjs/path-reservations.js | 170 ---- .../node_modules/tar/dist/commonjs/pax.js | 158 --- .../tar/dist/commonjs/read-entry.js | 140 --- .../tar/dist/commonjs/strip-absolute-path.js | 29 - .../dist/commonjs/strip-trailing-slashes.js | 18 - .../tar/dist/commonjs/symlink-error.js | 19 - .../node_modules/tar/dist/commonjs/types.js | 50 - .../node_modules/tar/dist/commonjs/update.js | 33 - .../tar/dist/commonjs/warn-method.js | 31 - .../tar/dist/commonjs/winchars.js | 14 - .../tar/dist/commonjs/write-entry.js | 689 ------------- .../node_modules/tar/dist/esm/create.js | 77 -- .../node_modules/tar/dist/esm/cwd-error.js | 14 - .../node_modules/tar/dist/esm/extract.js | 49 - .../tar/dist/esm/get-write-flag.js | 23 - .../node_modules/tar/dist/esm/header.js | 279 ------ .../pacote/node_modules/tar/dist/esm/index.js | 20 - .../tar/dist/esm/large-numbers.js | 94 -- .../node_modules/tar/dist/esm/make-command.js | 57 -- .../node_modules/tar/dist/esm/mode-fix.js | 25 - .../tar/dist/esm/normalize-unicode.js | 13 - .../tar/dist/esm/normalize-windows-path.js | 9 - .../node_modules/tar/dist/esm/options.js | 54 - .../pacote/node_modules/tar/dist/esm/pack.js | 445 --------- .../node_modules/tar/dist/esm/package.json | 3 - .../pacote/node_modules/tar/dist/esm/parse.js | 595 ----------- .../tar/dist/esm/path-reservations.js | 166 ---- .../pacote/node_modules/tar/dist/esm/pax.js | 154 --- .../node_modules/tar/dist/esm/read-entry.js | 136 --- .../node_modules/tar/dist/esm/replace.js | 225 ----- .../tar/dist/esm/strip-absolute-path.js | 25 - .../tar/dist/esm/strip-trailing-slashes.js | 14 - .../tar/dist/esm/symlink-error.js | 15 - .../pacote/node_modules/tar/dist/esm/types.js | 45 - .../node_modules/tar/dist/esm/update.js | 30 - .../node_modules/tar/dist/esm/warn-method.js | 27 - .../node_modules/tar/dist/esm/winchars.js | 9 - .../node_modules/tar/dist/esm/write-entry.js | 657 ------------- .../pacote/node_modules/tar/package.json | 325 ------ .../pacote/node_modules/yallist/LICENSE.md | 63 -- .../yallist/dist/commonjs/index.js | 384 -------- .../yallist/dist/commonjs/package.json | 3 - .../node_modules/yallist/dist/esm/index.js | 379 ------- .../yallist/dist/esm/package.json | 3 - .../pacote/node_modules/yallist/package.json | 68 -- .../tar/dist/commonjs/create.js | 0 .../tar/dist/commonjs/cwd-error.js | 0 .../tar/dist/commonjs/extract.js | 0 .../tar/dist/commonjs/get-write-flag.js | 0 .../tar/dist/commonjs/header.js | 0 .../tar/dist/commonjs/index.js | 0 .../tar/dist/commonjs/large-numbers.js | 0 .../tar/dist/commonjs/list.js | 8 +- .../tar/dist/commonjs/make-command.js | 0 .../tar/dist/commonjs/mkdir.js | 65 +- .../tar/dist/commonjs/mode-fix.js | 0 .../tar/dist/commonjs/normalize-unicode.js | 23 +- .../dist/commonjs/normalize-windows-path.js | 0 .../tar/dist/commonjs/options.js | 0 .../tar/dist/commonjs/pack.js | 20 +- .../tar/dist/commonjs/package.json | 0 .../tar/dist/commonjs/parse.js | 43 +- .../tar/dist/commonjs/path-reservations.js | 0 .../tar/dist/commonjs/pax.js | 0 .../tar/dist/commonjs/read-entry.js | 0 .../tar/dist/commonjs/replace.js | 1 + .../tar/dist/commonjs/strip-absolute-path.js | 0 .../dist/commonjs/strip-trailing-slashes.js | 0 .../tar/dist/commonjs/symlink-error.js | 0 .../tar/dist/commonjs/types.js | 0 .../tar/dist/commonjs/unpack.js | 58 +- .../tar/dist/commonjs/update.js | 0 .../tar/dist/commonjs/warn-method.js | 0 .../tar/dist/commonjs/winchars.js | 0 .../tar/dist/commonjs/write-entry.js | 0 .../node_modules => }/tar/dist/esm/create.js | 0 .../tar/dist/esm/cwd-error.js | 0 .../node_modules => }/tar/dist/esm/extract.js | 0 .../tar/dist/esm/get-write-flag.js | 0 .../node_modules => }/tar/dist/esm/header.js | 0 .../node_modules => }/tar/dist/esm/index.js | 0 .../tar/dist/esm/large-numbers.js | 0 .../node_modules => }/tar/dist/esm/list.js | 8 +- .../tar/dist/esm/make-command.js | 0 .../node_modules => }/tar/dist/esm/mkdir.js | 45 +- .../tar/dist/esm/mode-fix.js | 0 .../tar/dist/esm/normalize-unicode.js | 30 + .../tar/dist/esm/normalize-windows-path.js | 0 .../node_modules => }/tar/dist/esm/options.js | 0 .../node_modules => }/tar/dist/esm/pack.js | 20 +- .../chownr => tar}/dist/esm/package.json | 0 .../node_modules => }/tar/dist/esm/parse.js | 45 +- .../tar/dist/esm/path-reservations.js | 0 .../node_modules => }/tar/dist/esm/pax.js | 0 .../tar/dist/esm/read-entry.js | 0 .../node_modules => }/tar/dist/esm/replace.js | 1 + .../tar/dist/esm/strip-absolute-path.js | 0 .../tar/dist/esm/strip-trailing-slashes.js | 0 .../tar/dist/esm/symlink-error.js | 0 .../node_modules => }/tar/dist/esm/types.js | 0 .../node_modules => }/tar/dist/esm/unpack.js | 58 +- .../node_modules => }/tar/dist/esm/update.js | 0 .../tar/dist/esm/warn-method.js | 0 .../tar/dist/esm/winchars.js | 0 .../tar/dist/esm/write-entry.js | 0 node_modules/tar/index.js | 18 - node_modules/tar/lib/create.js | 111 --- node_modules/tar/lib/extract.js | 113 --- node_modules/tar/lib/get-write-flag.js | 20 - node_modules/tar/lib/header.js | 304 ------ node_modules/tar/lib/high-level-opt.js | 29 - node_modules/tar/lib/large-numbers.js | 104 -- node_modules/tar/lib/list.js | 139 --- node_modules/tar/lib/mkdir.js | 229 ----- node_modules/tar/lib/mode-fix.js | 27 - node_modules/tar/lib/normalize-unicode.js | 12 - .../tar/lib/normalize-windows-path.js | 8 - node_modules/tar/lib/pack.js | 432 -------- node_modules/tar/lib/parse.js | 552 ----------- node_modules/tar/lib/path-reservations.js | 156 --- node_modules/tar/lib/pax.js | 150 --- node_modules/tar/lib/read-entry.js | 107 -- node_modules/tar/lib/replace.js | 246 ----- node_modules/tar/lib/strip-absolute-path.js | 24 - .../tar/lib/strip-trailing-slashes.js | 13 - node_modules/tar/lib/types.js | 44 - node_modules/tar/lib/unpack.js | 923 ------------------ node_modules/tar/lib/update.js | 40 - node_modules/tar/lib/warn-mixin.js | 24 - node_modules/tar/lib/winchars.js | 23 - node_modules/tar/lib/write-entry.js | 546 ----------- .../tar/node_modules/fs-minipass/LICENSE | 15 - .../tar/node_modules/fs-minipass/index.js | 422 -------- .../fs-minipass/node_modules/minipass/LICENSE | 15 - .../node_modules/minipass/index.js | 649 ------------ .../node_modules/minipass/package.json | 56 -- .../fs-minipass/node_modules/yallist/LICENSE | 15 - .../node_modules/yallist/iterator.js | 8 - .../node_modules/yallist/package.json | 29 - .../node_modules/yallist/yallist.js | 426 -------- .../tar/node_modules/fs-minipass/package.json | 39 - .../tar/node_modules/minipass/LICENSE | 15 - .../tar/node_modules/minipass/index.js | 702 ------------- .../tar/node_modules/minipass/index.mjs | 702 ------------- .../tar/node_modules/minipass/package.json | 76 -- .../tar/node_modules/minizlib/LICENSE | 26 - .../tar/node_modules/minizlib/constants.js | 115 --- .../tar/node_modules/minizlib/index.js | 348 ------- .../minizlib/node_modules/minipass/LICENSE | 15 - .../minizlib/node_modules/minipass/index.js | 649 ------------ .../node_modules/minipass/package.json | 56 -- .../minizlib/node_modules/yallist/LICENSE | 15 - .../minizlib/node_modules/yallist/iterator.js | 8 - .../node_modules/yallist/package.json | 29 - .../minizlib/node_modules/yallist/yallist.js | 426 -------- .../tar/node_modules/minizlib/package.json | 42 - node_modules/tar/node_modules/mkdirp/LICENSE | 21 - .../tar/node_modules/mkdirp/bin/cmd.js | 68 -- node_modules/tar/node_modules/mkdirp/index.js | 31 - .../tar/node_modules/mkdirp/lib/find-made.js | 29 - .../node_modules/mkdirp/lib/mkdirp-manual.js | 64 -- .../node_modules/mkdirp/lib/mkdirp-native.js | 39 - .../tar/node_modules/mkdirp/lib/opts-arg.js | 23 - .../tar/node_modules/mkdirp/lib/path-arg.js | 29 - .../tar/node_modules/mkdirp/lib/use-native.js | 10 - .../tar/node_modules/mkdirp/package.json | 44 - .../node_modules/yallist/LICENSE.md | 0 .../yallist/dist/commonjs/index.js | 0 .../yallist/dist/commonjs/package.json | 0 .../node_modules/yallist/dist/esm/index.js | 0 .../yallist}/dist/esm/package.json | 0 .../node_modules/yallist/package.json | 0 node_modules/tar/package.json | 338 ++++++- package-lock.json | 185 +--- package.json | 2 +- workspaces/libnpmdiff/lib/untar.js | 4 +- workspaces/libnpmdiff/package.json | 2 +- 242 files changed, 646 insertions(+), 22370 deletions(-) delete mode 100644 node_modules/chownr/LICENSE rename node_modules/{node-gyp/node_modules => }/chownr/LICENSE.md (100%) delete mode 100644 node_modules/chownr/chownr.js rename node_modules/{node-gyp/node_modules => }/chownr/dist/commonjs/index.js (100%) rename node_modules/{node-gyp/node_modules => }/chownr/dist/commonjs/package.json (100%) rename node_modules/{node-gyp/node_modules => }/chownr/dist/esm/index.js (100%) rename node_modules/{mkdirp/dist/mjs => chownr/dist/esm}/package.json (100%) delete mode 100644 node_modules/mkdirp/LICENSE delete mode 100644 node_modules/mkdirp/dist/cjs/package.json delete mode 100755 node_modules/mkdirp/dist/cjs/src/bin.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/find-made.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/index.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-native.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/opts-arg.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/path-arg.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/use-native.js delete mode 100644 node_modules/mkdirp/dist/mjs/find-made.js delete mode 100644 node_modules/mkdirp/dist/mjs/index.js delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-manual.js delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-native.js delete mode 100644 node_modules/mkdirp/dist/mjs/opts-arg.js delete mode 100644 node_modules/mkdirp/dist/mjs/path-arg.js delete mode 100644 node_modules/mkdirp/dist/mjs/use-native.js delete mode 100644 node_modules/mkdirp/package.json delete mode 100644 node_modules/node-gyp/node_modules/chownr/package.json delete mode 100644 node_modules/node-gyp/node_modules/tar/LICENSE delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/esm/list.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js delete mode 100644 node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js delete mode 100644 node_modules/node-gyp/node_modules/tar/package.json delete mode 100644 node_modules/node-gyp/node_modules/yallist/dist/esm/package.json delete mode 100644 node_modules/pacote/node_modules/chownr/LICENSE.md delete mode 100644 node_modules/pacote/node_modules/chownr/dist/commonjs/index.js delete mode 100644 node_modules/pacote/node_modules/chownr/dist/commonjs/package.json delete mode 100644 node_modules/pacote/node_modules/chownr/dist/esm/index.js delete mode 100644 node_modules/pacote/node_modules/chownr/dist/esm/package.json delete mode 100644 node_modules/pacote/node_modules/chownr/package.json delete mode 100644 node_modules/pacote/node_modules/tar/LICENSE delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/create.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/cwd-error.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/extract.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/get-write-flag.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/header.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/index.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/large-numbers.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/make-command.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/mode-fix.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/normalize-windows-path.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/options.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/pack.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/package.json delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/path-reservations.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/pax.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/read-entry.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/strip-absolute-path.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/strip-trailing-slashes.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/symlink-error.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/types.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/update.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/warn-method.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/winchars.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/commonjs/write-entry.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/create.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/cwd-error.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/extract.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/get-write-flag.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/header.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/index.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/large-numbers.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/make-command.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/mode-fix.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/normalize-unicode.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/normalize-windows-path.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/options.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/pack.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/package.json delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/parse.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/path-reservations.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/pax.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/read-entry.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/replace.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/strip-absolute-path.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/strip-trailing-slashes.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/symlink-error.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/types.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/update.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/warn-method.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/winchars.js delete mode 100644 node_modules/pacote/node_modules/tar/dist/esm/write-entry.js delete mode 100644 node_modules/pacote/node_modules/tar/package.json delete mode 100644 node_modules/pacote/node_modules/yallist/LICENSE.md delete mode 100644 node_modules/pacote/node_modules/yallist/dist/commonjs/index.js delete mode 100644 node_modules/pacote/node_modules/yallist/dist/commonjs/package.json delete mode 100644 node_modules/pacote/node_modules/yallist/dist/esm/index.js delete mode 100644 node_modules/pacote/node_modules/yallist/dist/esm/package.json delete mode 100644 node_modules/pacote/node_modules/yallist/package.json rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/create.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/cwd-error.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/extract.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/get-write-flag.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/header.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/index.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/large-numbers.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/list.js (94%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/make-command.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/mkdir.js (71%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/mode-fix.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/normalize-unicode.js (50%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/normalize-windows-path.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/options.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/pack.js (93%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/package.json (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/parse.js (93%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/path-reservations.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/pax.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/read-entry.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/replace.js (99%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/strip-absolute-path.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/strip-trailing-slashes.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/symlink-error.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/types.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/commonjs/unpack.js (92%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/update.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/warn-method.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/winchars.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/commonjs/write-entry.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/create.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/cwd-error.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/extract.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/get-write-flag.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/header.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/index.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/large-numbers.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/esm/list.js (93%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/make-command.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/esm/mkdir.js (77%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/mode-fix.js (100%) create mode 100644 node_modules/tar/dist/esm/normalize-unicode.js rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/normalize-windows-path.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/options.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/pack.js (92%) rename node_modules/{node-gyp/node_modules/chownr => tar}/dist/esm/package.json (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/parse.js (92%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/path-reservations.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/pax.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/read-entry.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/replace.js (99%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/strip-absolute-path.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/strip-trailing-slashes.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/symlink-error.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/types.js (100%) rename node_modules/{pacote/node_modules => }/tar/dist/esm/unpack.js (92%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/update.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/warn-method.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/winchars.js (100%) rename node_modules/{node-gyp/node_modules => }/tar/dist/esm/write-entry.js (100%) delete mode 100644 node_modules/tar/index.js delete mode 100644 node_modules/tar/lib/create.js delete mode 100644 node_modules/tar/lib/extract.js delete mode 100644 node_modules/tar/lib/get-write-flag.js delete mode 100644 node_modules/tar/lib/header.js delete mode 100644 node_modules/tar/lib/high-level-opt.js delete mode 100644 node_modules/tar/lib/large-numbers.js delete mode 100644 node_modules/tar/lib/list.js delete mode 100644 node_modules/tar/lib/mkdir.js delete mode 100644 node_modules/tar/lib/mode-fix.js delete mode 100644 node_modules/tar/lib/normalize-unicode.js delete mode 100644 node_modules/tar/lib/normalize-windows-path.js delete mode 100644 node_modules/tar/lib/pack.js delete mode 100644 node_modules/tar/lib/parse.js delete mode 100644 node_modules/tar/lib/path-reservations.js delete mode 100644 node_modules/tar/lib/pax.js delete mode 100644 node_modules/tar/lib/read-entry.js delete mode 100644 node_modules/tar/lib/replace.js delete mode 100644 node_modules/tar/lib/strip-absolute-path.js delete mode 100644 node_modules/tar/lib/strip-trailing-slashes.js delete mode 100644 node_modules/tar/lib/types.js delete mode 100644 node_modules/tar/lib/unpack.js delete mode 100644 node_modules/tar/lib/update.js delete mode 100644 node_modules/tar/lib/warn-mixin.js delete mode 100644 node_modules/tar/lib/winchars.js delete mode 100644 node_modules/tar/lib/write-entry.js delete mode 100644 node_modules/tar/node_modules/fs-minipass/LICENSE delete mode 100644 node_modules/tar/node_modules/fs-minipass/index.js delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/yallist/LICENSE delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/yallist/iterator.js delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/yallist/package.json delete mode 100644 node_modules/tar/node_modules/fs-minipass/node_modules/yallist/yallist.js delete mode 100644 node_modules/tar/node_modules/fs-minipass/package.json delete mode 100644 node_modules/tar/node_modules/minipass/LICENSE delete mode 100644 node_modules/tar/node_modules/minipass/index.js delete mode 100644 node_modules/tar/node_modules/minipass/index.mjs delete mode 100644 node_modules/tar/node_modules/minipass/package.json delete mode 100644 node_modules/tar/node_modules/minizlib/LICENSE delete mode 100644 node_modules/tar/node_modules/minizlib/constants.js delete mode 100644 node_modules/tar/node_modules/minizlib/index.js delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/minipass/LICENSE delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/minipass/index.js delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/minipass/package.json delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/yallist/LICENSE delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/yallist/iterator.js delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/yallist/package.json delete mode 100644 node_modules/tar/node_modules/minizlib/node_modules/yallist/yallist.js delete mode 100644 node_modules/tar/node_modules/minizlib/package.json delete mode 100644 node_modules/tar/node_modules/mkdirp/LICENSE delete mode 100755 node_modules/tar/node_modules/mkdirp/bin/cmd.js delete mode 100644 node_modules/tar/node_modules/mkdirp/index.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/find-made.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/mkdirp-manual.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/mkdirp-native.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/opts-arg.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/path-arg.js delete mode 100644 node_modules/tar/node_modules/mkdirp/lib/use-native.js delete mode 100644 node_modules/tar/node_modules/mkdirp/package.json rename node_modules/{node-gyp => tar}/node_modules/yallist/LICENSE.md (100%) rename node_modules/{node-gyp => tar}/node_modules/yallist/dist/commonjs/index.js (100%) rename node_modules/{node-gyp => tar}/node_modules/yallist/dist/commonjs/package.json (100%) rename node_modules/{node-gyp => tar}/node_modules/yallist/dist/esm/index.js (100%) rename node_modules/{node-gyp/node_modules/tar => tar/node_modules/yallist}/dist/esm/package.json (100%) rename node_modules/{node-gyp => tar}/node_modules/yallist/package.json (100%) diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index e7b7e57f50615..fe2088c69d843 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -738,11 +738,9 @@ graph LR; string-width-->strip-ansi; strip-ansi-->ansi-regex; tar-->chownr; - tar-->fs-minipass; tar-->isaacs-fs-minipass["@isaacs/fs-minipass"]; tar-->minipass; tar-->minizlib; - tar-->mkdirp; tar-->yallist; tinyglobby-->fdir; tinyglobby-->picomatch; diff --git a/node_modules/.gitignore b/node_modules/.gitignore index 2f70b335d6fa5..42ee4e89b73fa 100644 --- a/node_modules/.gitignore +++ b/node_modules/.gitignore @@ -127,7 +127,6 @@ !/minipass-sized/node_modules/minipass !/minipass !/minizlib -!/mkdirp !/ms !/mute-stream !/negotiator @@ -138,15 +137,12 @@ /node-gyp/node_modules/@npmcli/* !/node-gyp/node_modules/@npmcli/agent !/node-gyp/node_modules/cacache -!/node-gyp/node_modules/chownr !/node-gyp/node_modules/glob !/node-gyp/node_modules/jackspeak !/node-gyp/node_modules/lru-cache !/node-gyp/node_modules/make-fetch-happen !/node-gyp/node_modules/minimatch !/node-gyp/node_modules/path-scurry -!/node-gyp/node_modules/tar -!/node-gyp/node_modules/yallist !/nopt !/normalize-package-data !/npm-audit-report @@ -162,11 +158,6 @@ !/p-map !/package-json-from-dist !/pacote -!/pacote/node_modules/ -/pacote/node_modules/* -!/pacote/node_modules/chownr -!/pacote/node_modules/tar -!/pacote/node_modules/yallist !/parse-conflict-json !/path-key !/path-scurry @@ -206,18 +197,7 @@ !/tar !/tar/node_modules/ /tar/node_modules/* -!/tar/node_modules/fs-minipass -!/tar/node_modules/fs-minipass/node_modules/ -/tar/node_modules/fs-minipass/node_modules/* -!/tar/node_modules/fs-minipass/node_modules/minipass -!/tar/node_modules/fs-minipass/node_modules/yallist -!/tar/node_modules/minipass -!/tar/node_modules/minizlib -!/tar/node_modules/minizlib/node_modules/ -/tar/node_modules/minizlib/node_modules/* -!/tar/node_modules/minizlib/node_modules/minipass -!/tar/node_modules/minizlib/node_modules/yallist -!/tar/node_modules/mkdirp +!/tar/node_modules/yallist !/text-table !/tiny-relative-date !/tinyglobby diff --git a/node_modules/chownr/LICENSE b/node_modules/chownr/LICENSE deleted file mode 100644 index c925dbe826b67..0000000000000 --- a/node_modules/chownr/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2016-2022 Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/chownr/LICENSE.md b/node_modules/chownr/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/chownr/LICENSE.md rename to node_modules/chownr/LICENSE.md diff --git a/node_modules/chownr/chownr.js b/node_modules/chownr/chownr.js deleted file mode 100644 index 0d40932169654..0000000000000 --- a/node_modules/chownr/chownr.js +++ /dev/null @@ -1,167 +0,0 @@ -'use strict' -const fs = require('fs') -const path = require('path') - -/* istanbul ignore next */ -const LCHOWN = fs.lchown ? 'lchown' : 'chown' -/* istanbul ignore next */ -const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync' - -/* istanbul ignore next */ -const needEISDIRHandled = fs.lchown && - !process.version.match(/v1[1-9]+\./) && - !process.version.match(/v10\.[6-9]/) - -const lchownSync = (path, uid, gid) => { - try { - return fs[LCHOWNSYNC](path, uid, gid) - } catch (er) { - if (er.code !== 'ENOENT') - throw er - } -} - -/* istanbul ignore next */ -const chownSync = (path, uid, gid) => { - try { - return fs.chownSync(path, uid, gid) - } catch (er) { - if (er.code !== 'ENOENT') - throw er - } -} - -/* istanbul ignore next */ -const handleEISDIR = - needEISDIRHandled ? (path, uid, gid, cb) => er => { - // Node prior to v10 had a very questionable implementation of - // fs.lchown, which would always try to call fs.open on a directory - // Fall back to fs.chown in those cases. - if (!er || er.code !== 'EISDIR') - cb(er) - else - fs.chown(path, uid, gid, cb) - } - : (_, __, ___, cb) => cb - -/* istanbul ignore next */ -const handleEISDirSync = - needEISDIRHandled ? (path, uid, gid) => { - try { - return lchownSync(path, uid, gid) - } catch (er) { - if (er.code !== 'EISDIR') - throw er - chownSync(path, uid, gid) - } - } - : (path, uid, gid) => lchownSync(path, uid, gid) - -// fs.readdir could only accept an options object as of node v6 -const nodeVersion = process.version -let readdir = (path, options, cb) => fs.readdir(path, options, cb) -let readdirSync = (path, options) => fs.readdirSync(path, options) -/* istanbul ignore next */ -if (/^v4\./.test(nodeVersion)) - readdir = (path, options, cb) => fs.readdir(path, cb) - -const chown = (cpath, uid, gid, cb) => { - fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => { - // Skip ENOENT error - cb(er && er.code !== 'ENOENT' ? er : null) - })) -} - -const chownrKid = (p, child, uid, gid, cb) => { - if (typeof child === 'string') - return fs.lstat(path.resolve(p, child), (er, stats) => { - // Skip ENOENT error - if (er) - return cb(er.code !== 'ENOENT' ? er : null) - stats.name = child - chownrKid(p, stats, uid, gid, cb) - }) - - if (child.isDirectory()) { - chownr(path.resolve(p, child.name), uid, gid, er => { - if (er) - return cb(er) - const cpath = path.resolve(p, child.name) - chown(cpath, uid, gid, cb) - }) - } else { - const cpath = path.resolve(p, child.name) - chown(cpath, uid, gid, cb) - } -} - - -const chownr = (p, uid, gid, cb) => { - readdir(p, { withFileTypes: true }, (er, children) => { - // any error other than ENOTDIR or ENOTSUP means it's not readable, - // or doesn't exist. give up. - if (er) { - if (er.code === 'ENOENT') - return cb() - else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') - return cb(er) - } - if (er || !children.length) - return chown(p, uid, gid, cb) - - let len = children.length - let errState = null - const then = er => { - if (errState) - return - if (er) - return cb(errState = er) - if (-- len === 0) - return chown(p, uid, gid, cb) - } - - children.forEach(child => chownrKid(p, child, uid, gid, then)) - }) -} - -const chownrKidSync = (p, child, uid, gid) => { - if (typeof child === 'string') { - try { - const stats = fs.lstatSync(path.resolve(p, child)) - stats.name = child - child = stats - } catch (er) { - if (er.code === 'ENOENT') - return - else - throw er - } - } - - if (child.isDirectory()) - chownrSync(path.resolve(p, child.name), uid, gid) - - handleEISDirSync(path.resolve(p, child.name), uid, gid) -} - -const chownrSync = (p, uid, gid) => { - let children - try { - children = readdirSync(p, { withFileTypes: true }) - } catch (er) { - if (er.code === 'ENOENT') - return - else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP') - return handleEISDirSync(p, uid, gid) - else - throw er - } - - if (children && children.length) - children.forEach(child => chownrKidSync(p, child, uid, gid)) - - return handleEISDirSync(p, uid, gid) -} - -module.exports = chownr -chownr.sync = chownrSync diff --git a/node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js b/node_modules/chownr/dist/commonjs/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/chownr/dist/commonjs/index.js rename to node_modules/chownr/dist/commonjs/index.js diff --git a/node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json b/node_modules/chownr/dist/commonjs/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/chownr/dist/commonjs/package.json rename to node_modules/chownr/dist/commonjs/package.json diff --git a/node_modules/node-gyp/node_modules/chownr/dist/esm/index.js b/node_modules/chownr/dist/esm/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/chownr/dist/esm/index.js rename to node_modules/chownr/dist/esm/index.js diff --git a/node_modules/mkdirp/dist/mjs/package.json b/node_modules/chownr/dist/esm/package.json similarity index 100% rename from node_modules/mkdirp/dist/mjs/package.json rename to node_modules/chownr/dist/esm/package.json diff --git a/node_modules/chownr/package.json b/node_modules/chownr/package.json index 5b0214ca12e3f..09aa6b2e2e576 100644 --- a/node_modules/chownr/package.json +++ b/node_modules/chownr/package.json @@ -2,31 +2,68 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "name": "chownr", "description": "like `chown -R`", - "version": "2.0.0", + "version": "3.0.0", "repository": { "type": "git", "url": "git://github.com/isaacs/chownr.git" }, - "main": "chownr.js", "files": [ - "chownr.js" + "dist" ], "devDependencies": { - "mkdirp": "0.3", - "rimraf": "^2.7.1", - "tap": "^14.10.6" - }, - "tap": { - "check-coverage": true + "@types/node": "^20.12.5", + "mkdirp": "^3.0.1", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.12" }, "scripts": { + "prepare": "tshy", + "pretest": "npm run prepare", "test": "tap", "preversion": "npm test", "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags" + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --loglevel warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" }, - "license": "ISC", + "license": "BlueOak-1.0.0", "engines": { - "node": ">=10" + "node": ">=18" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "type": "module", + "prettier": { + "semi": false, + "printWidth": 75, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" } } diff --git a/node_modules/minizlib/dist/commonjs/index.js b/node_modules/minizlib/dist/commonjs/index.js index b4906d2783372..78c6536baf6be 100644 --- a/node_modules/minizlib/dist/commonjs/index.js +++ b/node_modules/minizlib/dist/commonjs/index.js @@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.BrotliDecompress = exports.BrotliCompress = exports.Brotli = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0; +exports.ZstdDecompress = exports.ZstdCompress = exports.BrotliDecompress = exports.BrotliCompress = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0; const assert_1 = __importDefault(require("assert")); const buffer_1 = require("buffer"); const minipass_1 = require("minipass"); @@ -56,15 +56,15 @@ const _superWrite = Symbol('_superWrite'); class ZlibError extends Error { code; errno; - constructor(err) { - super('zlib: ' + err.message); + constructor(err, origin) { + super('zlib: ' + err.message, { cause: err }); this.code = err.code; this.errno = err.errno; /* c8 ignore next */ if (!this.code) this.code = 'ZLIB_ERROR'; this.message = 'zlib: ' + err.message; - Error.captureStackTrace(this, this.constructor); + Error.captureStackTrace(this, origin ?? this.constructor); } get name() { return 'ZlibError'; @@ -105,6 +105,10 @@ class ZlibBase extends minipass_1.Minipass { this.#finishFlushFlag = opts.finishFlush ?? 0; this.#fullFlushFlag = opts.fullFlushFlag ?? 0; /* c8 ignore stop */ + //@ts-ignore + if (typeof realZlib[mode] !== 'function') { + throw new TypeError('Compression method not supported: ' + mode); + } // this will throw if any options are invalid for the class selected try { // @types/node doesn't know that it exports the classes, but they're there @@ -113,7 +117,7 @@ class ZlibBase extends minipass_1.Minipass { } catch (er) { // make sure that all errors get decorated properly - throw new ZlibError(er); + throw new ZlibError(er, this.constructor); } this.#onError = err => { // no sense raising multiple errors, since we abort on the first one. @@ -213,7 +217,7 @@ class ZlibBase extends minipass_1.Minipass { // or if we do, put Buffer.concat() back before we emit error // Error events call into user code, which may call Buffer.concat() passthroughBufferConcat(false); - this.#onError(new ZlibError(err)); + this.#onError(new ZlibError(err, this.write)); } finally { if (this.#handle) { @@ -232,7 +236,7 @@ class ZlibBase extends minipass_1.Minipass { } } if (this.#handle) - this.#handle.on('error', er => this.#onError(new ZlibError(er))); + this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write))); let writeReturn; if (result) { if (Array.isArray(result) && result.length > 0) { @@ -376,7 +380,6 @@ class Brotli extends ZlibBase { super(opts, mode); } } -exports.Brotli = Brotli; class BrotliCompress extends Brotli { constructor(opts) { super(opts, 'BrotliCompress'); @@ -389,4 +392,25 @@ class BrotliDecompress extends Brotli { } } exports.BrotliDecompress = BrotliDecompress; +class Zstd extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue; + opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end; + opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush; + super(opts, mode); + } +} +class ZstdCompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdCompress'); + } +} +exports.ZstdCompress = ZstdCompress; +class ZstdDecompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdDecompress'); + } +} +exports.ZstdDecompress = ZstdDecompress; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/minizlib/dist/esm/index.js b/node_modules/minizlib/dist/esm/index.js index f33586a8ab0ec..b70ba1f2cd84f 100644 --- a/node_modules/minizlib/dist/esm/index.js +++ b/node_modules/minizlib/dist/esm/index.js @@ -16,15 +16,15 @@ const _superWrite = Symbol('_superWrite'); export class ZlibError extends Error { code; errno; - constructor(err) { - super('zlib: ' + err.message); + constructor(err, origin) { + super('zlib: ' + err.message, { cause: err }); this.code = err.code; this.errno = err.errno; /* c8 ignore next */ if (!this.code) this.code = 'ZLIB_ERROR'; this.message = 'zlib: ' + err.message; - Error.captureStackTrace(this, this.constructor); + Error.captureStackTrace(this, origin ?? this.constructor); } get name() { return 'ZlibError'; @@ -64,6 +64,10 @@ class ZlibBase extends Minipass { this.#finishFlushFlag = opts.finishFlush ?? 0; this.#fullFlushFlag = opts.fullFlushFlag ?? 0; /* c8 ignore stop */ + //@ts-ignore + if (typeof realZlib[mode] !== 'function') { + throw new TypeError('Compression method not supported: ' + mode); + } // this will throw if any options are invalid for the class selected try { // @types/node doesn't know that it exports the classes, but they're there @@ -72,7 +76,7 @@ class ZlibBase extends Minipass { } catch (er) { // make sure that all errors get decorated properly - throw new ZlibError(er); + throw new ZlibError(er, this.constructor); } this.#onError = err => { // no sense raising multiple errors, since we abort on the first one. @@ -172,7 +176,7 @@ class ZlibBase extends Minipass { // or if we do, put Buffer.concat() back before we emit error // Error events call into user code, which may call Buffer.concat() passthroughBufferConcat(false); - this.#onError(new ZlibError(err)); + this.#onError(new ZlibError(err, this.write)); } finally { if (this.#handle) { @@ -191,7 +195,7 @@ class ZlibBase extends Minipass { } } if (this.#handle) - this.#handle.on('error', er => this.#onError(new ZlibError(er))); + this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write))); let writeReturn; if (result) { if (Array.isArray(result) && result.length > 0) { @@ -317,7 +321,7 @@ export class Unzip extends Zlib { super(opts, 'Unzip'); } } -export class Brotli extends ZlibBase { +class Brotli extends ZlibBase { constructor(opts, mode) { opts = opts || {}; opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS; @@ -337,4 +341,23 @@ export class BrotliDecompress extends Brotli { super(opts, 'BrotliDecompress'); } } +class Zstd extends ZlibBase { + constructor(opts, mode) { + opts = opts || {}; + opts.flush = opts.flush || constants.ZSTD_e_continue; + opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end; + opts.fullFlushFlag = constants.ZSTD_e_flush; + super(opts, mode); + } +} +export class ZstdCompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdCompress'); + } +} +export class ZstdDecompress extends Zstd { + constructor(opts) { + super(opts, 'ZstdDecompress'); + } +} //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/minizlib/package.json b/node_modules/minizlib/package.json index 43cb855e15a5d..dceaed923d3db 100644 --- a/node_modules/minizlib/package.json +++ b/node_modules/minizlib/package.json @@ -1,6 +1,6 @@ { "name": "minizlib", - "version": "3.0.2", + "version": "3.1.0", "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", "main": "./dist/commonjs/index.js", "dependencies": { @@ -33,7 +33,7 @@ "author": "Isaac Z. Schlueter (http://blog.izs.me/)", "license": "MIT", "devDependencies": { - "@types/node": "^22.13.14", + "@types/node": "^24.5.2", "tap": "^21.1.0", "tshy": "^3.0.2", "typedoc": "^0.28.1" diff --git a/node_modules/mkdirp/LICENSE b/node_modules/mkdirp/LICENSE deleted file mode 100644 index 0a034db7a73b5..0000000000000 --- a/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2011-2023 James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) - -This project is free software released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/mkdirp/dist/cjs/package.json b/node_modules/mkdirp/dist/cjs/package.json deleted file mode 100644 index 9d04a66e16cd9..0000000000000 --- a/node_modules/mkdirp/dist/cjs/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "3.0.1", - "keywords": [ - "mkdir", - "directory", - "make dir", - "make", - "dir", - "recursive", - "native" - ], - "bin": "./dist/cjs/src/bin.js", - "main": "./dist/cjs/src/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.d.ts", - "exports": { - ".": { - "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" - }, - "require": { - "types": "./dist/cjs/src/index.d.ts", - "default": "./dist/cjs/src/index.js" - } - } - }, - "files": [ - "dist" - ], - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "preprepare": "rm -rf dist", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json", - "postprepare": "bash fixup.sh", - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", - "format": "prettier --write . --loglevel warn", - "benchmark": "node benchmark/index.js", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" - }, - "prettier": { - "semi": false, - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - }, - "devDependencies": { - "@types/brace-expansion": "^1.1.0", - "@types/node": "^18.11.9", - "@types/tap": "^15.0.7", - "c8": "^7.12.0", - "eslint-config-prettier": "^8.6.0", - "prettier": "^2.8.2", - "tap": "^16.3.3", - "ts-node": "^10.9.1", - "typedoc": "^0.23.21", - "typescript": "^4.9.3" - }, - "tap": { - "coverage": false, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-mkdirp.git" - }, - "license": "MIT", - "engines": { - "node": ">=10" - } -} diff --git a/node_modules/mkdirp/dist/cjs/src/bin.js b/node_modules/mkdirp/dist/cjs/src/bin.js deleted file mode 100755 index 757aae1fd96cb..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/bin.js +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env node -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const package_json_1 = require("../package.json"); -const usage = () => ` -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories - that don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m If a directory needs to be created, set the mode as an octal - --mode= permission string. - - -v --version Print the mkdirp version number - - -h --help Print this helpful banner - - -p --print Print the first directories created for each path provided - - --manual Use manual implementation, even if native is available -`; -const dirs = []; -const opts = {}; -let doPrint = false; -let dashdash = false; -let manual = false; -for (const arg of process.argv.slice(2)) { - if (dashdash) - dirs.push(arg); - else if (arg === '--') - dashdash = true; - else if (arg === '--manual') - manual = true; - else if (/^-h/.test(arg) || /^--help/.test(arg)) { - console.log(usage()); - process.exit(0); - } - else if (arg === '-v' || arg === '--version') { - console.log(package_json_1.version); - process.exit(0); - } - else if (arg === '-p' || arg === '--print') { - doPrint = true; - } - else if (/^-m/.test(arg) || /^--mode=/.test(arg)) { - // these don't get covered in CI, but work locally - // weird because the tests below show as passing in the output. - /* c8 ignore start */ - const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8); - if (isNaN(mode)) { - console.error(`invalid mode argument: ${arg}\nMust be an octal number.`); - process.exit(1); - } - /* c8 ignore stop */ - opts.mode = mode; - } - else - dirs.push(arg); -} -const index_js_1 = require("./index.js"); -const impl = manual ? index_js_1.mkdirp.manual : index_js_1.mkdirp; -if (dirs.length === 0) { - console.error(usage()); -} -// these don't get covered in CI, but work locally -/* c8 ignore start */ -Promise.all(dirs.map(dir => impl(dir, opts))) - .then(made => (doPrint ? made.forEach(m => m && console.log(m)) : null)) - .catch(er => { - console.error(er.message); - if (er.code) - console.error(' code: ' + er.code); - process.exit(1); -}); -/* c8 ignore stop */ -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/find-made.js b/node_modules/mkdirp/dist/cjs/src/find-made.js deleted file mode 100644 index e831ef27cadc1..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/find-made.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.findMadeSync = exports.findMade = void 0; -const path_1 = require("path"); -const findMade = async (opts, parent, path) => { - // we never want the 'made' return value to be a root directory - if (path === parent) { - return; - } - return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later - // will fail later - er => { - const fer = er; - return fer && fer.code === 'ENOENT' - ? (0, exports.findMade)(opts, (0, path_1.dirname)(parent), parent) - : undefined; - }); -}; -exports.findMade = findMade; -const findMadeSync = (opts, parent, path) => { - if (path === parent) { - return undefined; - } - try { - return opts.statSync(parent).isDirectory() ? path : undefined; - } - catch (er) { - const fer = er; - return fer && fer.code === 'ENOENT' - ? (0, exports.findMadeSync)(opts, (0, path_1.dirname)(parent), parent) - : undefined; - } -}; -exports.findMadeSync = findMadeSync; -//# sourceMappingURL=find-made.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/index.js b/node_modules/mkdirp/dist/cjs/src/index.js deleted file mode 100644 index ab9dc62cddda3..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.mkdirp = exports.nativeSync = exports.native = exports.manualSync = exports.manual = exports.sync = exports.mkdirpSync = exports.useNativeSync = exports.useNative = exports.mkdirpNativeSync = exports.mkdirpNative = exports.mkdirpManualSync = exports.mkdirpManual = void 0; -const mkdirp_manual_js_1 = require("./mkdirp-manual.js"); -const mkdirp_native_js_1 = require("./mkdirp-native.js"); -const opts_arg_js_1 = require("./opts-arg.js"); -const path_arg_js_1 = require("./path-arg.js"); -const use_native_js_1 = require("./use-native.js"); -/* c8 ignore start */ -var mkdirp_manual_js_2 = require("./mkdirp-manual.js"); -Object.defineProperty(exports, "mkdirpManual", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManual; } }); -Object.defineProperty(exports, "mkdirpManualSync", { enumerable: true, get: function () { return mkdirp_manual_js_2.mkdirpManualSync; } }); -var mkdirp_native_js_2 = require("./mkdirp-native.js"); -Object.defineProperty(exports, "mkdirpNative", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNative; } }); -Object.defineProperty(exports, "mkdirpNativeSync", { enumerable: true, get: function () { return mkdirp_native_js_2.mkdirpNativeSync; } }); -var use_native_js_2 = require("./use-native.js"); -Object.defineProperty(exports, "useNative", { enumerable: true, get: function () { return use_native_js_2.useNative; } }); -Object.defineProperty(exports, "useNativeSync", { enumerable: true, get: function () { return use_native_js_2.useNativeSync; } }); -/* c8 ignore stop */ -const mkdirpSync = (path, opts) => { - path = (0, path_arg_js_1.pathArg)(path); - const resolved = (0, opts_arg_js_1.optsArg)(opts); - return (0, use_native_js_1.useNativeSync)(resolved) - ? (0, mkdirp_native_js_1.mkdirpNativeSync)(path, resolved) - : (0, mkdirp_manual_js_1.mkdirpManualSync)(path, resolved); -}; -exports.mkdirpSync = mkdirpSync; -exports.sync = exports.mkdirpSync; -exports.manual = mkdirp_manual_js_1.mkdirpManual; -exports.manualSync = mkdirp_manual_js_1.mkdirpManualSync; -exports.native = mkdirp_native_js_1.mkdirpNative; -exports.nativeSync = mkdirp_native_js_1.mkdirpNativeSync; -exports.mkdirp = Object.assign(async (path, opts) => { - path = (0, path_arg_js_1.pathArg)(path); - const resolved = (0, opts_arg_js_1.optsArg)(opts); - return (0, use_native_js_1.useNative)(resolved) - ? (0, mkdirp_native_js_1.mkdirpNative)(path, resolved) - : (0, mkdirp_manual_js_1.mkdirpManual)(path, resolved); -}, { - mkdirpSync: exports.mkdirpSync, - mkdirpNative: mkdirp_native_js_1.mkdirpNative, - mkdirpNativeSync: mkdirp_native_js_1.mkdirpNativeSync, - mkdirpManual: mkdirp_manual_js_1.mkdirpManual, - mkdirpManualSync: mkdirp_manual_js_1.mkdirpManualSync, - sync: exports.mkdirpSync, - native: mkdirp_native_js_1.mkdirpNative, - nativeSync: mkdirp_native_js_1.mkdirpNativeSync, - manual: mkdirp_manual_js_1.mkdirpManual, - manualSync: mkdirp_manual_js_1.mkdirpManualSync, - useNative: use_native_js_1.useNative, - useNativeSync: use_native_js_1.useNativeSync, -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js b/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js deleted file mode 100644 index d9bd1d8bb5a49..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.mkdirpManual = exports.mkdirpManualSync = void 0; -const path_1 = require("path"); -const opts_arg_js_1 = require("./opts-arg.js"); -const mkdirpManualSync = (path, options, made) => { - const parent = (0, path_1.dirname)(path); - const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: false }; - if (parent === path) { - try { - return opts.mkdirSync(path, opts); - } - catch (er) { - // swallowed by recursive implementation on posix systems - // any other error is a failure - const fer = er; - if (fer && fer.code !== 'EISDIR') { - throw er; - } - return; - } - } - try { - opts.mkdirSync(path, opts); - return made || path; - } - catch (er) { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return (0, exports.mkdirpManualSync)(path, opts, (0, exports.mkdirpManualSync)(parent, opts, made)); - } - if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') { - throw er; - } - try { - if (!opts.statSync(path).isDirectory()) - throw er; - } - catch (_) { - throw er; - } - } -}; -exports.mkdirpManualSync = mkdirpManualSync; -exports.mkdirpManual = Object.assign(async (path, options, made) => { - const opts = (0, opts_arg_js_1.optsArg)(options); - opts.recursive = false; - const parent = (0, path_1.dirname)(path); - if (parent === path) { - return opts.mkdirAsync(path, opts).catch(er => { - // swallowed by recursive implementation on posix systems - // any other error is a failure - const fer = er; - if (fer && fer.code !== 'EISDIR') { - throw er; - } - }); - } - return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return (0, exports.mkdirpManual)(parent, opts).then((made) => (0, exports.mkdirpManual)(path, opts, made)); - } - if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') { - throw er; - } - return opts.statAsync(path).then(st => { - if (st.isDirectory()) { - return made; - } - else { - throw er; - } - }, () => { - throw er; - }); - }); -}, { sync: exports.mkdirpManualSync }); -//# sourceMappingURL=mkdirp-manual.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js b/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js deleted file mode 100644 index 9f00567d7cc20..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.mkdirpNative = exports.mkdirpNativeSync = void 0; -const path_1 = require("path"); -const find_made_js_1 = require("./find-made.js"); -const mkdirp_manual_js_1 = require("./mkdirp-manual.js"); -const opts_arg_js_1 = require("./opts-arg.js"); -const mkdirpNativeSync = (path, options) => { - const opts = (0, opts_arg_js_1.optsArg)(options); - opts.recursive = true; - const parent = (0, path_1.dirname)(path); - if (parent === path) { - return opts.mkdirSync(path, opts); - } - const made = (0, find_made_js_1.findMadeSync)(opts, path); - try { - opts.mkdirSync(path, opts); - return made; - } - catch (er) { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return (0, mkdirp_manual_js_1.mkdirpManualSync)(path, opts); - } - else { - throw er; - } - } -}; -exports.mkdirpNativeSync = mkdirpNativeSync; -exports.mkdirpNative = Object.assign(async (path, options) => { - const opts = { ...(0, opts_arg_js_1.optsArg)(options), recursive: true }; - const parent = (0, path_1.dirname)(path); - if (parent === path) { - return await opts.mkdirAsync(path, opts); - } - return (0, find_made_js_1.findMade)(opts, path).then((made) => opts - .mkdirAsync(path, opts) - .then(m => made || m) - .catch(er => { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return (0, mkdirp_manual_js_1.mkdirpManual)(path, opts); - } - else { - throw er; - } - })); -}, { sync: exports.mkdirpNativeSync }); -//# sourceMappingURL=mkdirp-native.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/opts-arg.js b/node_modules/mkdirp/dist/cjs/src/opts-arg.js deleted file mode 100644 index e8f486c090595..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/opts-arg.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.optsArg = void 0; -const fs_1 = require("fs"); -const optsArg = (opts) => { - if (!opts) { - opts = { mode: 0o777 }; - } - else if (typeof opts === 'object') { - opts = { mode: 0o777, ...opts }; - } - else if (typeof opts === 'number') { - opts = { mode: opts }; - } - else if (typeof opts === 'string') { - opts = { mode: parseInt(opts, 8) }; - } - else { - throw new TypeError('invalid options argument'); - } - const resolved = opts; - const optsFs = opts.fs || {}; - opts.mkdir = opts.mkdir || optsFs.mkdir || fs_1.mkdir; - opts.mkdirAsync = opts.mkdirAsync - ? opts.mkdirAsync - : async (path, options) => { - return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made))); - }; - opts.stat = opts.stat || optsFs.stat || fs_1.stat; - opts.statAsync = opts.statAsync - ? opts.statAsync - : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))); - opts.statSync = opts.statSync || optsFs.statSync || fs_1.statSync; - opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || fs_1.mkdirSync; - return resolved; -}; -exports.optsArg = optsArg; -//# sourceMappingURL=opts-arg.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/path-arg.js b/node_modules/mkdirp/dist/cjs/src/path-arg.js deleted file mode 100644 index a6b457f6e23d5..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/path-arg.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.pathArg = void 0; -const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform; -const path_1 = require("path"); -const pathArg = (path) => { - if (/\0/.test(path)) { - // simulate same failure that node raises - throw Object.assign(new TypeError('path must be a string without null bytes'), { - path, - code: 'ERR_INVALID_ARG_VALUE', - }); - } - path = (0, path_1.resolve)(path); - if (platform === 'win32') { - const badWinChars = /[*|"<>?:]/; - const { root } = (0, path_1.parse)(path); - if (badWinChars.test(path.substring(root.length))) { - throw Object.assign(new Error('Illegal characters in path.'), { - path, - code: 'EINVAL', - }); - } - } - return path; -}; -exports.pathArg = pathArg; -//# sourceMappingURL=path-arg.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/cjs/src/use-native.js b/node_modules/mkdirp/dist/cjs/src/use-native.js deleted file mode 100644 index 550b3452688ee..0000000000000 --- a/node_modules/mkdirp/dist/cjs/src/use-native.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.useNative = exports.useNativeSync = void 0; -const fs_1 = require("fs"); -const opts_arg_js_1 = require("./opts-arg.js"); -const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version; -const versArr = version.replace(/^v/, '').split('.'); -const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12); -exports.useNativeSync = !hasNative - ? () => false - : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdirSync === fs_1.mkdirSync; -exports.useNative = Object.assign(!hasNative - ? () => false - : (opts) => (0, opts_arg_js_1.optsArg)(opts).mkdir === fs_1.mkdir, { - sync: exports.useNativeSync, -}); -//# sourceMappingURL=use-native.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/find-made.js b/node_modules/mkdirp/dist/mjs/find-made.js deleted file mode 100644 index 3e72fd59a2c1f..0000000000000 --- a/node_modules/mkdirp/dist/mjs/find-made.js +++ /dev/null @@ -1,30 +0,0 @@ -import { dirname } from 'path'; -export const findMade = async (opts, parent, path) => { - // we never want the 'made' return value to be a root directory - if (path === parent) { - return; - } - return opts.statAsync(parent).then(st => (st.isDirectory() ? path : undefined), // will fail later - // will fail later - er => { - const fer = er; - return fer && fer.code === 'ENOENT' - ? findMade(opts, dirname(parent), parent) - : undefined; - }); -}; -export const findMadeSync = (opts, parent, path) => { - if (path === parent) { - return undefined; - } - try { - return opts.statSync(parent).isDirectory() ? path : undefined; - } - catch (er) { - const fer = er; - return fer && fer.code === 'ENOENT' - ? findMadeSync(opts, dirname(parent), parent) - : undefined; - } -}; -//# sourceMappingURL=find-made.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/index.js b/node_modules/mkdirp/dist/mjs/index.js deleted file mode 100644 index 0217ecc8cdd83..0000000000000 --- a/node_modules/mkdirp/dist/mjs/index.js +++ /dev/null @@ -1,43 +0,0 @@ -import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; -import { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; -import { optsArg } from './opts-arg.js'; -import { pathArg } from './path-arg.js'; -import { useNative, useNativeSync } from './use-native.js'; -/* c8 ignore start */ -export { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; -export { mkdirpNative, mkdirpNativeSync } from './mkdirp-native.js'; -export { useNative, useNativeSync } from './use-native.js'; -/* c8 ignore stop */ -export const mkdirpSync = (path, opts) => { - path = pathArg(path); - const resolved = optsArg(opts); - return useNativeSync(resolved) - ? mkdirpNativeSync(path, resolved) - : mkdirpManualSync(path, resolved); -}; -export const sync = mkdirpSync; -export const manual = mkdirpManual; -export const manualSync = mkdirpManualSync; -export const native = mkdirpNative; -export const nativeSync = mkdirpNativeSync; -export const mkdirp = Object.assign(async (path, opts) => { - path = pathArg(path); - const resolved = optsArg(opts); - return useNative(resolved) - ? mkdirpNative(path, resolved) - : mkdirpManual(path, resolved); -}, { - mkdirpSync, - mkdirpNative, - mkdirpNativeSync, - mkdirpManual, - mkdirpManualSync, - sync: mkdirpSync, - native: mkdirpNative, - nativeSync: mkdirpNativeSync, - manual: mkdirpManual, - manualSync: mkdirpManualSync, - useNative, - useNativeSync, -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/mkdirp-manual.js b/node_modules/mkdirp/dist/mjs/mkdirp-manual.js deleted file mode 100644 index a4d044e02d3bf..0000000000000 --- a/node_modules/mkdirp/dist/mjs/mkdirp-manual.js +++ /dev/null @@ -1,75 +0,0 @@ -import { dirname } from 'path'; -import { optsArg } from './opts-arg.js'; -export const mkdirpManualSync = (path, options, made) => { - const parent = dirname(path); - const opts = { ...optsArg(options), recursive: false }; - if (parent === path) { - try { - return opts.mkdirSync(path, opts); - } - catch (er) { - // swallowed by recursive implementation on posix systems - // any other error is a failure - const fer = er; - if (fer && fer.code !== 'EISDIR') { - throw er; - } - return; - } - } - try { - opts.mkdirSync(path, opts); - return made || path; - } - catch (er) { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made)); - } - if (fer && fer.code !== 'EEXIST' && fer && fer.code !== 'EROFS') { - throw er; - } - try { - if (!opts.statSync(path).isDirectory()) - throw er; - } - catch (_) { - throw er; - } - } -}; -export const mkdirpManual = Object.assign(async (path, options, made) => { - const opts = optsArg(options); - opts.recursive = false; - const parent = dirname(path); - if (parent === path) { - return opts.mkdirAsync(path, opts).catch(er => { - // swallowed by recursive implementation on posix systems - // any other error is a failure - const fer = er; - if (fer && fer.code !== 'EISDIR') { - throw er; - } - }); - } - return opts.mkdirAsync(path, opts).then(() => made || path, async (er) => { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return mkdirpManual(parent, opts).then((made) => mkdirpManual(path, opts, made)); - } - if (fer && fer.code !== 'EEXIST' && fer.code !== 'EROFS') { - throw er; - } - return opts.statAsync(path).then(st => { - if (st.isDirectory()) { - return made; - } - else { - throw er; - } - }, () => { - throw er; - }); - }); -}, { sync: mkdirpManualSync }); -//# sourceMappingURL=mkdirp-manual.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/mkdirp-native.js b/node_modules/mkdirp/dist/mjs/mkdirp-native.js deleted file mode 100644 index 99d10a5425dad..0000000000000 --- a/node_modules/mkdirp/dist/mjs/mkdirp-native.js +++ /dev/null @@ -1,46 +0,0 @@ -import { dirname } from 'path'; -import { findMade, findMadeSync } from './find-made.js'; -import { mkdirpManual, mkdirpManualSync } from './mkdirp-manual.js'; -import { optsArg } from './opts-arg.js'; -export const mkdirpNativeSync = (path, options) => { - const opts = optsArg(options); - opts.recursive = true; - const parent = dirname(path); - if (parent === path) { - return opts.mkdirSync(path, opts); - } - const made = findMadeSync(opts, path); - try { - opts.mkdirSync(path, opts); - return made; - } - catch (er) { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return mkdirpManualSync(path, opts); - } - else { - throw er; - } - } -}; -export const mkdirpNative = Object.assign(async (path, options) => { - const opts = { ...optsArg(options), recursive: true }; - const parent = dirname(path); - if (parent === path) { - return await opts.mkdirAsync(path, opts); - } - return findMade(opts, path).then((made) => opts - .mkdirAsync(path, opts) - .then(m => made || m) - .catch(er => { - const fer = er; - if (fer && fer.code === 'ENOENT') { - return mkdirpManual(path, opts); - } - else { - throw er; - } - })); -}, { sync: mkdirpNativeSync }); -//# sourceMappingURL=mkdirp-native.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/opts-arg.js b/node_modules/mkdirp/dist/mjs/opts-arg.js deleted file mode 100644 index d47e2927fee4c..0000000000000 --- a/node_modules/mkdirp/dist/mjs/opts-arg.js +++ /dev/null @@ -1,34 +0,0 @@ -import { mkdir, mkdirSync, stat, statSync, } from 'fs'; -export const optsArg = (opts) => { - if (!opts) { - opts = { mode: 0o777 }; - } - else if (typeof opts === 'object') { - opts = { mode: 0o777, ...opts }; - } - else if (typeof opts === 'number') { - opts = { mode: opts }; - } - else if (typeof opts === 'string') { - opts = { mode: parseInt(opts, 8) }; - } - else { - throw new TypeError('invalid options argument'); - } - const resolved = opts; - const optsFs = opts.fs || {}; - opts.mkdir = opts.mkdir || optsFs.mkdir || mkdir; - opts.mkdirAsync = opts.mkdirAsync - ? opts.mkdirAsync - : async (path, options) => { - return new Promise((res, rej) => resolved.mkdir(path, options, (er, made) => er ? rej(er) : res(made))); - }; - opts.stat = opts.stat || optsFs.stat || stat; - opts.statAsync = opts.statAsync - ? opts.statAsync - : async (path) => new Promise((res, rej) => resolved.stat(path, (err, stats) => (err ? rej(err) : res(stats)))); - opts.statSync = opts.statSync || optsFs.statSync || statSync; - opts.mkdirSync = opts.mkdirSync || optsFs.mkdirSync || mkdirSync; - return resolved; -}; -//# sourceMappingURL=opts-arg.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/path-arg.js b/node_modules/mkdirp/dist/mjs/path-arg.js deleted file mode 100644 index 03539cc5a94f9..0000000000000 --- a/node_modules/mkdirp/dist/mjs/path-arg.js +++ /dev/null @@ -1,24 +0,0 @@ -const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform; -import { parse, resolve } from 'path'; -export const pathArg = (path) => { - if (/\0/.test(path)) { - // simulate same failure that node raises - throw Object.assign(new TypeError('path must be a string without null bytes'), { - path, - code: 'ERR_INVALID_ARG_VALUE', - }); - } - path = resolve(path); - if (platform === 'win32') { - const badWinChars = /[*|"<>?:]/; - const { root } = parse(path); - if (badWinChars.test(path.substring(root.length))) { - throw Object.assign(new Error('Illegal characters in path.'), { - path, - code: 'EINVAL', - }); - } - } - return path; -}; -//# sourceMappingURL=path-arg.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/dist/mjs/use-native.js b/node_modules/mkdirp/dist/mjs/use-native.js deleted file mode 100644 index ad2093867eb74..0000000000000 --- a/node_modules/mkdirp/dist/mjs/use-native.js +++ /dev/null @@ -1,14 +0,0 @@ -import { mkdir, mkdirSync } from 'fs'; -import { optsArg } from './opts-arg.js'; -const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version; -const versArr = version.replace(/^v/, '').split('.'); -const hasNative = +versArr[0] > 10 || (+versArr[0] === 10 && +versArr[1] >= 12); -export const useNativeSync = !hasNative - ? () => false - : (opts) => optsArg(opts).mkdirSync === mkdirSync; -export const useNative = Object.assign(!hasNative - ? () => false - : (opts) => optsArg(opts).mkdir === mkdir, { - sync: useNativeSync, -}); -//# sourceMappingURL=use-native.js.map \ No newline at end of file diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json deleted file mode 100644 index f31ac3314d6f6..0000000000000 --- a/node_modules/mkdirp/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "3.0.1", - "keywords": [ - "mkdir", - "directory", - "make dir", - "make", - "dir", - "recursive", - "native" - ], - "bin": "./dist/cjs/src/bin.js", - "main": "./dist/cjs/src/index.js", - "module": "./dist/mjs/index.js", - "types": "./dist/mjs/index.d.ts", - "exports": { - ".": { - "import": { - "types": "./dist/mjs/index.d.ts", - "default": "./dist/mjs/index.js" - }, - "require": { - "types": "./dist/cjs/src/index.d.ts", - "default": "./dist/cjs/src/index.js" - } - } - }, - "files": [ - "dist" - ], - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "preprepare": "rm -rf dist", - "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json", - "postprepare": "bash fixup.sh", - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "test": "c8 tap", - "snap": "c8 tap", - "format": "prettier --write . --loglevel warn", - "benchmark": "node benchmark/index.js", - "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts" - }, - "prettier": { - "semi": false, - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - }, - "devDependencies": { - "@types/brace-expansion": "^1.1.0", - "@types/node": "^18.11.9", - "@types/tap": "^15.0.7", - "c8": "^7.12.0", - "eslint-config-prettier": "^8.6.0", - "prettier": "^2.8.2", - "tap": "^16.3.3", - "ts-node": "^10.9.1", - "typedoc": "^0.23.21", - "typescript": "^4.9.3" - }, - "tap": { - "coverage": false, - "node-arg": [ - "--no-warnings", - "--loader", - "ts-node/esm" - ], - "ts": false - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-mkdirp.git" - }, - "license": "MIT", - "engines": { - "node": ">=10" - } -} diff --git a/node_modules/node-gyp/node_modules/chownr/package.json b/node_modules/node-gyp/node_modules/chownr/package.json deleted file mode 100644 index 09aa6b2e2e576..0000000000000 --- a/node_modules/node-gyp/node_modules/chownr/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "name": "chownr", - "description": "like `chown -R`", - "version": "3.0.0", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/chownr.git" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@types/node": "^20.12.5", - "mkdirp": "^3.0.1", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "tap": "^18.7.2", - "tshy": "^1.13.1", - "typedoc": "^0.25.12" - }, - "scripts": { - "prepare": "tshy", - "pretest": "npm run prepare", - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" - }, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - }, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "type": "module", - "prettier": { - "semi": false, - "printWidth": 75, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - } -} diff --git a/node_modules/node-gyp/node_modules/tar/LICENSE b/node_modules/node-gyp/node_modules/tar/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js deleted file mode 100644 index 3cd34bb4bad48..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/list.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.list = exports.filesFilter = void 0; -// tar -t -const fsm = __importStar(require("@isaacs/fs-minipass")); -const node_fs_1 = __importDefault(require("node:fs")); -const path_1 = require("path"); -const make_command_js_1 = require("./make-command.js"); -const parse_js_1 = require("./parse.js"); -const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); -const onReadEntryFunction = (opt) => { - const onReadEntry = opt.onReadEntry; - opt.onReadEntry = - onReadEntry ? - e => { - onReadEntry(e); - e.resume(); - } - : e => e.resume(); -}; -// construct a filter that limits the file entries listed -// include child entries if a dir is included -const filesFilter = (opt, files) => { - const map = new Map(files.map(f => [(0, strip_trailing_slashes_js_1.stripTrailingSlashes)(f), true])); - const filter = opt.filter; - const mapHas = (file, r = '') => { - const root = r || (0, path_1.parse)(file).root || '.'; - let ret; - if (file === root) - ret = false; - else { - const m = map.get(file); - if (m !== undefined) { - ret = m; - } - else { - ret = mapHas((0, path_1.dirname)(file), root); - } - } - map.set(file, ret); - return ret; - }; - opt.filter = - filter ? - (file, entry) => filter(file, entry) && mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)) - : file => mapHas((0, strip_trailing_slashes_js_1.stripTrailingSlashes)(file)); -}; -exports.filesFilter = filesFilter; -const listFileSync = (opt) => { - const p = new parse_js_1.Parser(opt); - const file = opt.file; - let fd; - try { - const stat = node_fs_1.default.statSync(file); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - if (stat.size < readSize) { - p.end(node_fs_1.default.readFileSync(file)); - } - else { - let pos = 0; - const buf = Buffer.allocUnsafe(readSize); - fd = node_fs_1.default.openSync(file, 'r'); - while (pos < stat.size) { - const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos); - pos += bytesRead; - p.write(buf.subarray(0, bytesRead)); - } - p.end(); - } - } - finally { - if (typeof fd === 'number') { - try { - node_fs_1.default.closeSync(fd); - /* c8 ignore next */ - } - catch (er) { } - } - } -}; -const listFile = (opt, _files) => { - const parse = new parse_js_1.Parser(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve, reject) => { - parse.on('error', reject); - parse.on('end', resolve); - node_fs_1.default.stat(file, (er, stat) => { - if (er) { - reject(er); - } - else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }); - stream.on('error', reject); - stream.pipe(parse); - } - }); - }); - return p; -}; -exports.list = (0, make_command_js_1.makeCommand)(listFileSync, listFile, opt => new parse_js_1.Parser(opt), opt => new parse_js_1.Parser(opt), (opt, files) => { - if (files?.length) - (0, exports.filesFilter)(opt, files); - if (!opt.noResume) - onReadEntryFunction(opt); -}); -//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js deleted file mode 100644 index 2b13ecbab6723..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/mkdir.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.mkdirSync = exports.mkdir = void 0; -const chownr_1 = require("chownr"); -const fs_1 = __importDefault(require("fs")); -const mkdirp_1 = require("mkdirp"); -const node_path_1 = __importDefault(require("node:path")); -const cwd_error_js_1 = require("./cwd-error.js"); -const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); -const symlink_error_js_1 = require("./symlink-error.js"); -const cGet = (cache, key) => cache.get((0, normalize_windows_path_js_1.normalizeWindowsPath)(key)); -const cSet = (cache, key, val) => cache.set((0, normalize_windows_path_js_1.normalizeWindowsPath)(key), val); -const checkCwd = (dir, cb) => { - fs_1.default.stat(dir, (er, st) => { - if (er || !st.isDirectory()) { - er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR'); - } - cb(er); - }); -}; -/** - * Wrapper around mkdirp for tar's needs. - * - * The main purpose is to avoid creating directories if we know that - * they already exist (and track which ones exist for this purpose), - * and prevent entries from being extracted into symlinked folders, - * if `preservePaths` is not set. - */ -const mkdir = (dir, opt, cb) => { - dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - /* c8 ignore next */ - const umask = opt.umask ?? 0o22; - const mode = opt.mode | 0o0700; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); - const done = (er, created) => { - if (er) { - cb(er); - } - else { - cSet(cache, dir, true); - if (created && doChown) { - (0, chownr_1.chownr)(created, uid, gid, er => done(er)); - } - else if (needChmod) { - fs_1.default.chmod(dir, mode, cb); - } - else { - cb(); - } - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - return checkCwd(dir, done); - } - if (preserve) { - return (0, mkdirp_1.mkdirp)(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts - done); - } - const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); - const parts = sub.split('/'); - mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); -}; -exports.mkdir = mkdir; -const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { - if (!parts.length) { - return cb(null, created); - } - const p = parts.shift(); - const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p)); - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); -}; -const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { - if (er) { - fs_1.default.lstat(part, (statEr, st) => { - if (statEr) { - statEr.path = - statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path); - cb(statEr); - } - else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - else if (unlink) { - fs_1.default.unlink(part, er => { - if (er) { - return cb(er); - } - fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); - }); - } - else if (st.isSymbolicLink()) { - return cb(new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/'))); - } - else { - cb(er); - } - }); - } - else { - created = created || part; - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } -}; -const checkCwdSync = (dir) => { - let ok = false; - let code = undefined; - try { - ok = fs_1.default.statSync(dir).isDirectory(); - } - catch (er) { - code = er?.code; - } - finally { - if (!ok) { - throw new cwd_error_js_1.CwdError(dir, code ?? 'ENOTDIR'); - } - } -}; -const mkdirSync = (dir, opt) => { - dir = (0, normalize_windows_path_js_1.normalizeWindowsPath)(dir); - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - /* c8 ignore next */ - const umask = opt.umask ?? 0o22; - const mode = opt.mode | 0o700; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); - const done = (created) => { - cSet(cache, dir, true); - if (created && doChown) { - (0, chownr_1.chownrSync)(created, uid, gid); - } - if (needChmod) { - fs_1.default.chmodSync(dir, mode); - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - checkCwdSync(cwd); - return done(); - } - if (preserve) { - return done((0, mkdirp_1.mkdirpSync)(dir, mode) ?? undefined); - } - const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); - const parts = sub.split('/'); - let created = undefined; - for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { - part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part)); - if (cGet(cache, part)) { - continue; - } - try { - fs_1.default.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - } - catch (er) { - const st = fs_1.default.lstatSync(part); - if (st.isDirectory()) { - cSet(cache, part, true); - continue; - } - else if (unlink) { - fs_1.default.unlinkSync(part); - fs_1.default.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - continue; - } - else if (st.isSymbolicLink()) { - return new symlink_error_js_1.SymlinkError(part, part + '/' + parts.join('/')); - } - } - } - return done(created); -}; -exports.mkdirSync = mkdirSync; -//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js deleted file mode 100644 index 2f08ce46d98c4..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-unicode.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.normalizeUnicode = void 0; -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -const normalizeCache = Object.create(null); -const { hasOwnProperty } = Object.prototype; -const normalizeUnicode = (s) => { - if (!hasOwnProperty.call(normalizeCache, s)) { - normalizeCache[s] = s.normalize('NFD'); - } - return normalizeCache[s]; -}; -exports.normalizeUnicode = normalizeUnicode; -//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js deleted file mode 100644 index 9746a25899e6e..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/parse.js +++ /dev/null @@ -1,599 +0,0 @@ -"use strict"; -// this[BUFFER] is the remainder of a chunk if we're waiting for -// the full 512 bytes of a header to come in. We will Buffer.concat() -// it to the next write(), which is a mem copy, but a small one. -// -// this[QUEUE] is a Yallist of entries that haven't been emitted -// yet this can only get filled up if the user keeps write()ing after -// a write() returns false, or does a write() with more than one entry -// -// We don't buffer chunks, we always parse them and either create an -// entry, or push it into the active entry. The ReadEntry class knows -// to throw data away if .ignore=true -// -// Shift entry off the buffer when it emits 'end', and emit 'entry' for -// the next one in the list. -// -// At any time, we're pushing body chunks into the entry at WRITEENTRY, -// and waiting for 'end' on the entry at READENTRY -// -// ignored entries get .resume() called on them straight away -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Parser = void 0; -const events_1 = require("events"); -const minizlib_1 = require("minizlib"); -const yallist_1 = require("yallist"); -const header_js_1 = require("./header.js"); -const pax_js_1 = require("./pax.js"); -const read_entry_js_1 = require("./read-entry.js"); -const warn_method_js_1 = require("./warn-method.js"); -const maxMetaEntrySize = 1024 * 1024; -const gzipHeader = Buffer.from([0x1f, 0x8b]); -const STATE = Symbol('state'); -const WRITEENTRY = Symbol('writeEntry'); -const READENTRY = Symbol('readEntry'); -const NEXTENTRY = Symbol('nextEntry'); -const PROCESSENTRY = Symbol('processEntry'); -const EX = Symbol('extendedHeader'); -const GEX = Symbol('globalExtendedHeader'); -const META = Symbol('meta'); -const EMITMETA = Symbol('emitMeta'); -const BUFFER = Symbol('buffer'); -const QUEUE = Symbol('queue'); -const ENDED = Symbol('ended'); -const EMITTEDEND = Symbol('emittedEnd'); -const EMIT = Symbol('emit'); -const UNZIP = Symbol('unzip'); -const CONSUMECHUNK = Symbol('consumeChunk'); -const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); -const CONSUMEBODY = Symbol('consumeBody'); -const CONSUMEMETA = Symbol('consumeMeta'); -const CONSUMEHEADER = Symbol('consumeHeader'); -const CONSUMING = Symbol('consuming'); -const BUFFERCONCAT = Symbol('bufferConcat'); -const MAYBEEND = Symbol('maybeEnd'); -const WRITING = Symbol('writing'); -const ABORTED = Symbol('aborted'); -const DONE = Symbol('onDone'); -const SAW_VALID_ENTRY = Symbol('sawValidEntry'); -const SAW_NULL_BLOCK = Symbol('sawNullBlock'); -const SAW_EOF = Symbol('sawEOF'); -const CLOSESTREAM = Symbol('closeStream'); -const noop = () => true; -class Parser extends events_1.EventEmitter { - file; - strict; - maxMetaEntrySize; - filter; - brotli; - writable = true; - readable = false; - [QUEUE] = new yallist_1.Yallist(); - [BUFFER]; - [READENTRY]; - [WRITEENTRY]; - [STATE] = 'begin'; - [META] = ''; - [EX]; - [GEX]; - [ENDED] = false; - [UNZIP]; - [ABORTED] = false; - [SAW_VALID_ENTRY]; - [SAW_NULL_BLOCK] = false; - [SAW_EOF] = false; - [WRITING] = false; - [CONSUMING] = false; - [EMITTEDEND] = false; - constructor(opt = {}) { - super(); - this.file = opt.file || ''; - // these BADARCHIVE errors can't be detected early. listen on DONE. - this.on(DONE, () => { - if (this[STATE] === 'begin' || - this[SAW_VALID_ENTRY] === false) { - // either less than 1 block of data, or all entries were invalid. - // Either way, probably not even a tarball. - this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); - } - }); - if (opt.ondone) { - this.on(DONE, opt.ondone); - } - else { - this.on(DONE, () => { - this.emit('prefinish'); - this.emit('finish'); - this.emit('end'); - }); - } - this.strict = !!opt.strict; - this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; - this.filter = typeof opt.filter === 'function' ? opt.filter : noop; - // Unlike gzip, brotli doesn't have any magic bytes to identify it - // Users need to explicitly tell us they're extracting a brotli file - // Or we infer from the file extension - const isTBR = opt.file && - (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); - // if it's a tbr file it MIGHT be brotli, but we don't know until - // we look at it and verify it's not a valid tar file. - this.brotli = - !opt.gzip && opt.brotli !== undefined ? opt.brotli - : isTBR ? undefined - : false; - // have to set this so that streams are ok piping into it - this.on('end', () => this[CLOSESTREAM]()); - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - if (typeof opt.onReadEntry === 'function') { - this.on('entry', opt.onReadEntry); - } - } - warn(code, message, data = {}) { - (0, warn_method_js_1.warnMethod)(this, code, message, data); - } - [CONSUMEHEADER](chunk, position) { - if (this[SAW_VALID_ENTRY] === undefined) { - this[SAW_VALID_ENTRY] = false; - } - let header; - try { - header = new header_js_1.Header(chunk, position, this[EX], this[GEX]); - } - catch (er) { - return this.warn('TAR_ENTRY_INVALID', er); - } - if (header.nullBlock) { - if (this[SAW_NULL_BLOCK]) { - this[SAW_EOF] = true; - // ending an archive with no entries. pointless, but legal. - if (this[STATE] === 'begin') { - this[STATE] = 'header'; - } - this[EMIT]('eof'); - } - else { - this[SAW_NULL_BLOCK] = true; - this[EMIT]('nullBlock'); - } - } - else { - this[SAW_NULL_BLOCK] = false; - if (!header.cksumValid) { - this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); - } - else if (!header.path) { - this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); - } - else { - const type = header.type; - if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath required', { - header, - }); - } - else if (!/^(Symbolic)?Link$/.test(type) && - !/^(Global)?ExtendedHeader$/.test(type) && - header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { - header, - }); - } - else { - const entry = (this[WRITEENTRY] = new read_entry_js_1.ReadEntry(header, this[EX], this[GEX])); - // we do this for meta & ignored entries as well, because they - // are still valid tar, or else we wouldn't know to ignore them - if (!this[SAW_VALID_ENTRY]) { - if (entry.remain) { - // this might be the one! - const onend = () => { - if (!entry.invalid) { - this[SAW_VALID_ENTRY] = true; - } - }; - entry.on('end', onend); - } - else { - this[SAW_VALID_ENTRY] = true; - } - } - if (entry.meta) { - if (entry.size > this.maxMetaEntrySize) { - entry.ignore = true; - this[EMIT]('ignoredEntry', entry); - this[STATE] = 'ignore'; - entry.resume(); - } - else if (entry.size > 0) { - this[META] = ''; - entry.on('data', c => (this[META] += c)); - this[STATE] = 'meta'; - } - } - else { - this[EX] = undefined; - entry.ignore = - entry.ignore || !this.filter(entry.path, entry); - if (entry.ignore) { - // probably valid, just not something we care about - this[EMIT]('ignoredEntry', entry); - this[STATE] = entry.remain ? 'ignore' : 'header'; - entry.resume(); - } - else { - if (entry.remain) { - this[STATE] = 'body'; - } - else { - this[STATE] = 'header'; - entry.end(); - } - if (!this[READENTRY]) { - this[QUEUE].push(entry); - this[NEXTENTRY](); - } - else { - this[QUEUE].push(entry); - } - } - } - } - } - } - } - [CLOSESTREAM]() { - queueMicrotask(() => this.emit('close')); - } - [PROCESSENTRY](entry) { - let go = true; - if (!entry) { - this[READENTRY] = undefined; - go = false; - } - else if (Array.isArray(entry)) { - const [ev, ...args] = entry; - this.emit(ev, ...args); - } - else { - this[READENTRY] = entry; - this.emit('entry', entry); - if (!entry.emittedEnd) { - entry.on('end', () => this[NEXTENTRY]()); - go = false; - } - } - return go; - } - [NEXTENTRY]() { - do { } while (this[PROCESSENTRY](this[QUEUE].shift())); - if (!this[QUEUE].length) { - // At this point, there's nothing in the queue, but we may have an - // entry which is being consumed (readEntry). - // If we don't, then we definitely can handle more data. - // If we do, and either it's flowing, or it has never had any data - // written to it, then it needs more. - // The only other possibility is that it has returned false from a - // write() call, so we wait for the next drain to continue. - const re = this[READENTRY]; - const drainNow = !re || re.flowing || re.size === re.remain; - if (drainNow) { - if (!this[WRITING]) { - this.emit('drain'); - } - } - else { - re.once('drain', () => this.emit('drain')); - } - } - } - [CONSUMEBODY](chunk, position) { - // write up to but no more than writeEntry.blockRemain - const entry = this[WRITEENTRY]; - /* c8 ignore start */ - if (!entry) { - throw new Error('attempt to consume body without entry??'); - } - const br = entry.blockRemain ?? 0; - /* c8 ignore stop */ - const c = br >= chunk.length && position === 0 ? - chunk - : chunk.subarray(position, position + br); - entry.write(c); - if (!entry.blockRemain) { - this[STATE] = 'header'; - this[WRITEENTRY] = undefined; - entry.end(); - } - return c.length; - } - [CONSUMEMETA](chunk, position) { - const entry = this[WRITEENTRY]; - const ret = this[CONSUMEBODY](chunk, position); - // if we finished, then the entry is reset - if (!this[WRITEENTRY] && entry) { - this[EMITMETA](entry); - } - return ret; - } - [EMIT](ev, data, extra) { - if (!this[QUEUE].length && !this[READENTRY]) { - this.emit(ev, data, extra); - } - else { - this[QUEUE].push([ev, data, extra]); - } - } - [EMITMETA](entry) { - this[EMIT]('meta', this[META]); - switch (entry.type) { - case 'ExtendedHeader': - case 'OldExtendedHeader': - this[EX] = pax_js_1.Pax.parse(this[META], this[EX], false); - break; - case 'GlobalExtendedHeader': - this[GEX] = pax_js_1.Pax.parse(this[META], this[GEX], true); - break; - case 'NextFileHasLongPath': - case 'OldGnuLongPath': { - const ex = this[EX] ?? Object.create(null); - this[EX] = ex; - ex.path = this[META].replace(/\0.*/, ''); - break; - } - case 'NextFileHasLongLinkpath': { - const ex = this[EX] || Object.create(null); - this[EX] = ex; - ex.linkpath = this[META].replace(/\0.*/, ''); - break; - } - /* c8 ignore start */ - default: - throw new Error('unknown meta: ' + entry.type); - /* c8 ignore stop */ - } - } - abort(error) { - this[ABORTED] = true; - this.emit('abort', error); - // always throws, even in non-strict mode - this.warn('TAR_ABORT', error, { recoverable: false }); - } - write(chunk, encoding, cb) { - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, - /* c8 ignore next */ - typeof encoding === 'string' ? encoding : 'utf8'); - } - if (this[ABORTED]) { - /* c8 ignore next */ - cb?.(); - return false; - } - // first write, might be gzipped - const needSniff = this[UNZIP] === undefined || - (this.brotli === undefined && this[UNZIP] === false); - if (needSniff && chunk) { - if (this[BUFFER]) { - chunk = Buffer.concat([this[BUFFER], chunk]); - this[BUFFER] = undefined; - } - if (chunk.length < gzipHeader.length) { - this[BUFFER] = chunk; - /* c8 ignore next */ - cb?.(); - return true; - } - // look for gzip header - for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { - if (chunk[i] !== gzipHeader[i]) { - this[UNZIP] = false; - } - } - const maybeBrotli = this.brotli === undefined; - if (this[UNZIP] === false && maybeBrotli) { - // read the first header to see if it's a valid tar file. If so, - // we can safely assume that it's not actually brotli, despite the - // .tbr or .tar.br file extension. - // if we ended before getting a full chunk, yes, def brotli - if (chunk.length < 512) { - if (this[ENDED]) { - this.brotli = true; - } - else { - this[BUFFER] = chunk; - /* c8 ignore next */ - cb?.(); - return true; - } - } - else { - // if it's tar, it's pretty reliably not brotli, chances of - // that happening are astronomical. - try { - new header_js_1.Header(chunk.subarray(0, 512)); - this.brotli = false; - } - catch (_) { - this.brotli = true; - } - } - } - if (this[UNZIP] === undefined || - (this[UNZIP] === false && this.brotli)) { - const ended = this[ENDED]; - this[ENDED] = false; - this[UNZIP] = - this[UNZIP] === undefined ? - new minizlib_1.Unzip({}) - : new minizlib_1.BrotliDecompress({}); - this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); - this[UNZIP].on('error', er => this.abort(er)); - this[UNZIP].on('end', () => { - this[ENDED] = true; - this[CONSUMECHUNK](); - }); - this[WRITING] = true; - const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); - this[WRITING] = false; - cb?.(); - return ret; - } - } - this[WRITING] = true; - if (this[UNZIP]) { - this[UNZIP].write(chunk); - } - else { - this[CONSUMECHUNK](chunk); - } - this[WRITING] = false; - // return false if there's a queue, or if the current entry isn't flowing - const ret = this[QUEUE].length ? false - : this[READENTRY] ? this[READENTRY].flowing - : true; - // if we have no queue, then that means a clogged READENTRY - if (!ret && !this[QUEUE].length) { - this[READENTRY]?.once('drain', () => this.emit('drain')); - } - /* c8 ignore next */ - cb?.(); - return ret; - } - [BUFFERCONCAT](c) { - if (c && !this[ABORTED]) { - this[BUFFER] = - this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; - } - } - [MAYBEEND]() { - if (this[ENDED] && - !this[EMITTEDEND] && - !this[ABORTED] && - !this[CONSUMING]) { - this[EMITTEDEND] = true; - const entry = this[WRITEENTRY]; - if (entry && entry.blockRemain) { - // truncated, likely a damaged file - const have = this[BUFFER] ? this[BUFFER].length : 0; - this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); - if (this[BUFFER]) { - entry.write(this[BUFFER]); - } - entry.end(); - } - this[EMIT](DONE); - } - } - [CONSUMECHUNK](chunk) { - if (this[CONSUMING] && chunk) { - this[BUFFERCONCAT](chunk); - } - else if (!chunk && !this[BUFFER]) { - this[MAYBEEND](); - } - else if (chunk) { - this[CONSUMING] = true; - if (this[BUFFER]) { - this[BUFFERCONCAT](chunk); - const c = this[BUFFER]; - this[BUFFER] = undefined; - this[CONSUMECHUNKSUB](c); - } - else { - this[CONSUMECHUNKSUB](chunk); - } - while (this[BUFFER] && - this[BUFFER]?.length >= 512 && - !this[ABORTED] && - !this[SAW_EOF]) { - const c = this[BUFFER]; - this[BUFFER] = undefined; - this[CONSUMECHUNKSUB](c); - } - this[CONSUMING] = false; - } - if (!this[BUFFER] || this[ENDED]) { - this[MAYBEEND](); - } - } - [CONSUMECHUNKSUB](chunk) { - // we know that we are in CONSUMING mode, so anything written goes into - // the buffer. Advance the position and put any remainder in the buffer. - let position = 0; - const length = chunk.length; - while (position + 512 <= length && - !this[ABORTED] && - !this[SAW_EOF]) { - switch (this[STATE]) { - case 'begin': - case 'header': - this[CONSUMEHEADER](chunk, position); - position += 512; - break; - case 'ignore': - case 'body': - position += this[CONSUMEBODY](chunk, position); - break; - case 'meta': - position += this[CONSUMEMETA](chunk, position); - break; - /* c8 ignore start */ - default: - throw new Error('invalid state: ' + this[STATE]); - /* c8 ignore stop */ - } - } - if (position < length) { - if (this[BUFFER]) { - this[BUFFER] = Buffer.concat([ - chunk.subarray(position), - this[BUFFER], - ]); - } - else { - this[BUFFER] = chunk.subarray(position); - } - } - } - end(chunk, encoding, cb) { - if (typeof chunk === 'function') { - cb = chunk; - encoding = undefined; - chunk = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - if (cb) - this.once('finish', cb); - if (!this[ABORTED]) { - if (this[UNZIP]) { - /* c8 ignore start */ - if (chunk) - this[UNZIP].write(chunk); - /* c8 ignore stop */ - this[UNZIP].end(); - } - else { - this[ENDED] = true; - if (this.brotli === undefined) - chunk = chunk || Buffer.alloc(0); - if (chunk) - this.write(chunk); - this[MAYBEEND](); - } - } - return this; - } -} -exports.Parser = Parser; -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js deleted file mode 100644 index 262deecd12f9f..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/replace.js +++ /dev/null @@ -1,231 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.replace = void 0; -// tar -r -const fs_minipass_1 = require("@isaacs/fs-minipass"); -const node_fs_1 = __importDefault(require("node:fs")); -const node_path_1 = __importDefault(require("node:path")); -const header_js_1 = require("./header.js"); -const list_js_1 = require("./list.js"); -const make_command_js_1 = require("./make-command.js"); -const options_js_1 = require("./options.js"); -const pack_js_1 = require("./pack.js"); -// starting at the head of the file, read a Header -// If the checksum is invalid, that's our position to start writing -// If it is, jump forward by the specified size (round up to 512) -// and try again. -// Write the new Pack stream starting there. -const replaceSync = (opt, files) => { - const p = new pack_js_1.PackSync(opt); - let threw = true; - let fd; - let position; - try { - try { - fd = node_fs_1.default.openSync(opt.file, 'r+'); - } - catch (er) { - if (er?.code === 'ENOENT') { - fd = node_fs_1.default.openSync(opt.file, 'w+'); - } - else { - throw er; - } - } - const st = node_fs_1.default.fstatSync(fd); - const headBuf = Buffer.alloc(512); - POSITION: for (position = 0; position < st.size; position += 512) { - for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { - bytes = node_fs_1.default.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); - if (position === 0 && - headBuf[0] === 0x1f && - headBuf[1] === 0x8b) { - throw new Error('cannot append to compressed archives'); - } - if (!bytes) { - break POSITION; - } - } - const h = new header_js_1.Header(headBuf); - if (!h.cksumValid) { - break; - } - const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); - if (position + entryBlockSize + 512 > st.size) { - break; - } - // the 512 for the header we just parsed will be added as well - // also jump ahead all the blocks for the body - position += entryBlockSize; - if (opt.mtimeCache && h.mtime) { - opt.mtimeCache.set(String(h.path), h.mtime); - } - } - threw = false; - streamSync(opt, p, position, fd, files); - } - finally { - if (threw) { - try { - node_fs_1.default.closeSync(fd); - } - catch (er) { } - } - } -}; -const streamSync = (opt, p, position, fd, files) => { - const stream = new fs_minipass_1.WriteStreamSync(opt.file, { - fd: fd, - start: position, - }); - p.pipe(stream); - addFilesSync(p, files); -}; -const replaceAsync = (opt, files) => { - files = Array.from(files); - const p = new pack_js_1.Pack(opt); - const getPos = (fd, size, cb_) => { - const cb = (er, pos) => { - if (er) { - node_fs_1.default.close(fd, _ => cb_(er)); - } - else { - cb_(null, pos); - } - }; - let position = 0; - if (size === 0) { - return cb(null, 0); - } - let bufPos = 0; - const headBuf = Buffer.alloc(512); - const onread = (er, bytes) => { - if (er || typeof bytes === 'undefined') { - return cb(er); - } - bufPos += bytes; - if (bufPos < 512 && bytes) { - return node_fs_1.default.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); - } - if (position === 0 && - headBuf[0] === 0x1f && - headBuf[1] === 0x8b) { - return cb(new Error('cannot append to compressed archives')); - } - // truncated header - if (bufPos < 512) { - return cb(null, position); - } - const h = new header_js_1.Header(headBuf); - if (!h.cksumValid) { - return cb(null, position); - } - /* c8 ignore next */ - const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); - if (position + entryBlockSize + 512 > size) { - return cb(null, position); - } - position += entryBlockSize + 512; - if (position >= size) { - return cb(null, position); - } - if (opt.mtimeCache && h.mtime) { - opt.mtimeCache.set(String(h.path), h.mtime); - } - bufPos = 0; - node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); - }; - node_fs_1.default.read(fd, headBuf, 0, 512, position, onread); - }; - const promise = new Promise((resolve, reject) => { - p.on('error', reject); - let flag = 'r+'; - const onopen = (er, fd) => { - if (er && er.code === 'ENOENT' && flag === 'r+') { - flag = 'w+'; - return node_fs_1.default.open(opt.file, flag, onopen); - } - if (er || !fd) { - return reject(er); - } - node_fs_1.default.fstat(fd, (er, st) => { - if (er) { - return node_fs_1.default.close(fd, () => reject(er)); - } - getPos(fd, st.size, (er, position) => { - if (er) { - return reject(er); - } - const stream = new fs_minipass_1.WriteStream(opt.file, { - fd: fd, - start: position, - }); - p.pipe(stream); - stream.on('error', reject); - stream.on('close', resolve); - addFilesAsync(p, files); - }); - }); - }; - node_fs_1.default.open(opt.file, flag, onopen); - }); - return promise; -}; -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - (0, list_js_1.list)({ - file: node_path_1.default.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - }); - p.end(); -}; -const addFilesAsync = async (p, files) => { - for (let i = 0; i < files.length; i++) { - const file = String(files[i]); - if (file.charAt(0) === '@') { - await (0, list_js_1.list)({ - file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - } - p.end(); -}; -exports.replace = (0, make_command_js_1.makeCommand)(replaceSync, replaceAsync, -/* c8 ignore start */ -() => { - throw new TypeError('file is required'); -}, () => { - throw new TypeError('file is required'); -}, -/* c8 ignore stop */ -(opt, entries) => { - if (!(0, options_js_1.isFile)(opt)) { - throw new TypeError('file is required'); - } - if (opt.gzip || - opt.brotli || - opt.file.endsWith('.br') || - opt.file.endsWith('.tbr')) { - throw new TypeError('cannot append to compressed archives'); - } - if (!entries?.length) { - throw new TypeError('no paths specified to add/replace'); - } -}); -//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js b/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js deleted file mode 100644 index edf8acbb18c40..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/unpack.js +++ /dev/null @@ -1,919 +0,0 @@ -"use strict"; -// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. -// but the path reservations are required to avoid race conditions where -// parallelized unpack ops may mess with one another, due to dependencies -// (like a Link depending on its target) or destructive operations (like -// clobbering an fs object to create one of a different type.) -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.UnpackSync = exports.Unpack = void 0; -const fsm = __importStar(require("@isaacs/fs-minipass")); -const node_assert_1 = __importDefault(require("node:assert")); -const node_crypto_1 = require("node:crypto"); -const node_fs_1 = __importDefault(require("node:fs")); -const node_path_1 = __importDefault(require("node:path")); -const get_write_flag_js_1 = require("./get-write-flag.js"); -const mkdir_js_1 = require("./mkdir.js"); -const normalize_unicode_js_1 = require("./normalize-unicode.js"); -const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); -const parse_js_1 = require("./parse.js"); -const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); -const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); -const wc = __importStar(require("./winchars.js")); -const path_reservations_js_1 = require("./path-reservations.js"); -const ONENTRY = Symbol('onEntry'); -const CHECKFS = Symbol('checkFs'); -const CHECKFS2 = Symbol('checkFs2'); -const PRUNECACHE = Symbol('pruneCache'); -const ISREUSABLE = Symbol('isReusable'); -const MAKEFS = Symbol('makeFs'); -const FILE = Symbol('file'); -const DIRECTORY = Symbol('directory'); -const LINK = Symbol('link'); -const SYMLINK = Symbol('symlink'); -const HARDLINK = Symbol('hardlink'); -const UNSUPPORTED = Symbol('unsupported'); -const CHECKPATH = Symbol('checkPath'); -const MKDIR = Symbol('mkdir'); -const ONERROR = Symbol('onError'); -const PENDING = Symbol('pending'); -const PEND = Symbol('pend'); -const UNPEND = Symbol('unpend'); -const ENDED = Symbol('ended'); -const MAYBECLOSE = Symbol('maybeClose'); -const SKIP = Symbol('skip'); -const DOCHOWN = Symbol('doChown'); -const UID = Symbol('uid'); -const GID = Symbol('gid'); -const CHECKED_CWD = Symbol('checkedCwd'); -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -const isWindows = platform === 'win32'; -const DEFAULT_MAX_DEPTH = 1024; -// Unlinks on Windows are not atomic. -// -// This means that if you have a file entry, followed by another -// file entry with an identical name, and you cannot re-use the file -// (because it's a hardlink, or because unlink:true is set, or it's -// Windows, which does not have useful nlink values), then the unlink -// will be committed to the disk AFTER the new file has been written -// over the old one, deleting the new file. -// -// To work around this, on Windows systems, we rename the file and then -// delete the renamed file. It's a sloppy kludge, but frankly, I do not -// know of a better way to do this, given windows' non-atomic unlink -// semantics. -// -// See: https://github.com/npm/node-tar/issues/183 -/* c8 ignore start */ -const unlinkFile = (path, cb) => { - if (!isWindows) { - return node_fs_1.default.unlink(path, cb); - } - const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); - node_fs_1.default.rename(path, name, er => { - if (er) { - return cb(er); - } - node_fs_1.default.unlink(name, cb); - }); -}; -/* c8 ignore stop */ -/* c8 ignore start */ -const unlinkFileSync = (path) => { - if (!isWindows) { - return node_fs_1.default.unlinkSync(path); - } - const name = path + '.DELETE.' + (0, node_crypto_1.randomBytes)(16).toString('hex'); - node_fs_1.default.renameSync(path, name); - node_fs_1.default.unlinkSync(name); -}; -/* c8 ignore stop */ -// this.gid, entry.gid, this.processUid -const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a - : b !== undefined && b === b >>> 0 ? b - : c; -// clear the cache if it's a case-insensitive unicode-squashing match. -// we can't know if the current file system is case-sensitive or supports -// unicode fully, so we check for similarity on the maximally compatible -// representation. Err on the side of pruning, since all it's doing is -// preventing lstats, and it's not the end of the world if we get a false -// positive. -// Note that on windows, we always drop the entire cache whenever a -// symbolic link is encountered, because 8.3 filenames are impossible -// to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = (path) => (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, normalize_windows_path_js_1.normalizeWindowsPath)((0, normalize_unicode_js_1.normalizeUnicode)(path))).toLowerCase(); -// remove all cache entries matching ${abs}/** -const pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs); - for (const path of cache.keys()) { - const pnorm = cacheKeyNormalize(path); - if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { - cache.delete(path); - } - } -}; -const dropCache = (cache) => { - for (const key of cache.keys()) { - cache.delete(key); - } -}; -class Unpack extends parse_js_1.Parser { - [ENDED] = false; - [CHECKED_CWD] = false; - [PENDING] = 0; - reservations = new path_reservations_js_1.PathReservations(); - transform; - writable = true; - readable = false; - dirCache; - uid; - gid; - setOwner; - preserveOwner; - processGid; - processUid; - maxDepth; - forceChown; - win32; - newer; - keep; - noMtime; - preservePaths; - unlink; - cwd; - strip; - processUmask; - umask; - dmode; - fmode; - chmod; - constructor(opt = {}) { - opt.ondone = () => { - this[ENDED] = true; - this[MAYBECLOSE](); - }; - super(opt); - this.transform = opt.transform; - this.dirCache = opt.dirCache || new Map(); - this.chmod = !!opt.chmod; - if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { - // need both or neither - if (typeof opt.uid !== 'number' || - typeof opt.gid !== 'number') { - throw new TypeError('cannot set owner without number uid and gid'); - } - if (opt.preserveOwner) { - throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); - } - this.uid = opt.uid; - this.gid = opt.gid; - this.setOwner = true; - } - else { - this.uid = undefined; - this.gid = undefined; - this.setOwner = false; - } - // default true for root - if (opt.preserveOwner === undefined && - typeof opt.uid !== 'number') { - this.preserveOwner = !!(process.getuid && process.getuid() === 0); - } - else { - this.preserveOwner = !!opt.preserveOwner; - } - this.processUid = - (this.preserveOwner || this.setOwner) && process.getuid ? - process.getuid() - : undefined; - this.processGid = - (this.preserveOwner || this.setOwner) && process.getgid ? - process.getgid() - : undefined; - // prevent excessively deep nesting of subfolders - // set to `Infinity` to remove this restriction - this.maxDepth = - typeof opt.maxDepth === 'number' ? - opt.maxDepth - : DEFAULT_MAX_DEPTH; - // mostly just for testing, but useful in some cases. - // Forcibly trigger a chown on every entry, no matter what - this.forceChown = opt.forceChown === true; - // turn > this[ONENTRY](entry)); - } - // a bad or damaged archive is a warning for Parser, but an error - // when extracting. Mark those errors as unrecoverable, because - // the Unpack contract cannot be met. - warn(code, msg, data = {}) { - if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { - data.recoverable = false; - } - return super.warn(code, msg, data); - } - [MAYBECLOSE]() { - if (this[ENDED] && this[PENDING] === 0) { - this.emit('prefinish'); - this.emit('finish'); - this.emit('end'); - } - } - [CHECKPATH](entry) { - const p = (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path); - const parts = p.split('/'); - if (this.strip) { - if (parts.length < this.strip) { - return false; - } - if (entry.type === 'Link') { - const linkparts = (0, normalize_windows_path_js_1.normalizeWindowsPath)(String(entry.linkpath)).split('/'); - if (linkparts.length >= this.strip) { - entry.linkpath = linkparts.slice(this.strip).join('/'); - } - else { - return false; - } - } - parts.splice(0, this.strip); - entry.path = parts.join('/'); - } - if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { - this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { - entry, - path: p, - depth: parts.length, - maxDepth: this.maxDepth, - }); - return false; - } - if (!this.preservePaths) { - if (parts.includes('..') || - /* c8 ignore next */ - (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { - this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { - entry, - path: p, - }); - return false; - } - // strip off the root - const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(p); - if (root) { - entry.path = String(stripped); - this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { - entry, - path: p, - }); - } - } - if (node_path_1.default.isAbsolute(entry.path)) { - entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(entry.path)); - } - else { - entry.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, entry.path)); - } - // if we somehow ended up with a path that escapes the cwd, and we are - // not in preservePaths mode, then something is fishy! This should have - // been prevented above, so ignore this for coverage. - /* c8 ignore start - defense in depth */ - if (!this.preservePaths && - typeof entry.absolute === 'string' && - entry.absolute.indexOf(this.cwd + '/') !== 0 && - entry.absolute !== this.cwd) { - this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { - entry, - path: (0, normalize_windows_path_js_1.normalizeWindowsPath)(entry.path), - resolvedPath: entry.absolute, - cwd: this.cwd, - }); - return false; - } - /* c8 ignore stop */ - // an archive can set properties on the extraction directory, but it - // may not replace the cwd with a different kind of thing entirely. - if (entry.absolute === this.cwd && - entry.type !== 'Directory' && - entry.type !== 'GNUDumpDir') { - return false; - } - // only encode : chars that aren't drive letter indicators - if (this.win32) { - const { root: aRoot } = node_path_1.default.win32.parse(String(entry.absolute)); - entry.absolute = - aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); - const { root: pRoot } = node_path_1.default.win32.parse(entry.path); - entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); - } - return true; - } - [ONENTRY](entry) { - if (!this[CHECKPATH](entry)) { - return entry.resume(); - } - node_assert_1.default.equal(typeof entry.absolute, 'string'); - switch (entry.type) { - case 'Directory': - case 'GNUDumpDir': - if (entry.mode) { - entry.mode = entry.mode | 0o700; - } - // eslint-disable-next-line no-fallthrough - case 'File': - case 'OldFile': - case 'ContiguousFile': - case 'Link': - case 'SymbolicLink': - return this[CHECKFS](entry); - case 'CharacterDevice': - case 'BlockDevice': - case 'FIFO': - default: - return this[UNSUPPORTED](entry); - } - } - [ONERROR](er, entry) { - // Cwd has to exist, or else nothing works. That's serious. - // Other errors are warnings, which raise the error in strict - // mode, but otherwise continue on. - if (er.name === 'CwdError') { - this.emit('error', er); - } - else { - this.warn('TAR_ENTRY_ERROR', er, { entry }); - this[UNPEND](); - entry.resume(); - } - } - [MKDIR](dir, mode, cb) { - (0, mkdir_js_1.mkdir)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - }, cb); - } - [DOCHOWN](entry) { - // in preserve owner mode, chown if the entry doesn't match process - // in set owner mode, chown if setting doesn't match process - return (this.forceChown || - (this.preserveOwner && - ((typeof entry.uid === 'number' && - entry.uid !== this.processUid) || - (typeof entry.gid === 'number' && - entry.gid !== this.processGid))) || - (typeof this.uid === 'number' && - this.uid !== this.processUid) || - (typeof this.gid === 'number' && this.gid !== this.processGid)); - } - [UID](entry) { - return uint32(this.uid, entry.uid, this.processUid); - } - [GID](entry) { - return uint32(this.gid, entry.gid, this.processGid); - } - [FILE](entry, fullyDone) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.fmode; - const stream = new fsm.WriteStream(String(entry.absolute), { - // slight lie, but it can be numeric flags - flags: (0, get_write_flag_js_1.getWriteFlag)(entry.size), - mode: mode, - autoClose: false, - }); - stream.on('error', (er) => { - if (stream.fd) { - node_fs_1.default.close(stream.fd, () => { }); - } - // flush all the data out so that we aren't left hanging - // if the error wasn't actually fatal. otherwise the parse - // is blocked, and we never proceed. - stream.write = () => true; - this[ONERROR](er, entry); - fullyDone(); - }); - let actions = 1; - const done = (er) => { - if (er) { - /* c8 ignore start - we should always have a fd by now */ - if (stream.fd) { - node_fs_1.default.close(stream.fd, () => { }); - } - /* c8 ignore stop */ - this[ONERROR](er, entry); - fullyDone(); - return; - } - if (--actions === 0) { - if (stream.fd !== undefined) { - node_fs_1.default.close(stream.fd, er => { - if (er) { - this[ONERROR](er, entry); - } - else { - this[UNPEND](); - } - fullyDone(); - }); - } - } - }; - stream.on('finish', () => { - // if futimes fails, try utimes - // if utimes fails, fail with the original error - // same for fchown/chown - const abs = String(entry.absolute); - const fd = stream.fd; - if (typeof fd === 'number' && entry.mtime && !this.noMtime) { - actions++; - const atime = entry.atime || new Date(); - const mtime = entry.mtime; - node_fs_1.default.futimes(fd, atime, mtime, er => er ? - node_fs_1.default.utimes(abs, atime, mtime, er2 => done(er2 && er)) - : done()); - } - if (typeof fd === 'number' && this[DOCHOWN](entry)) { - actions++; - const uid = this[UID](entry); - const gid = this[GID](entry); - if (typeof uid === 'number' && typeof gid === 'number') { - node_fs_1.default.fchown(fd, uid, gid, er => er ? - node_fs_1.default.chown(abs, uid, gid, er2 => done(er2 && er)) - : done()); - } - } - done(); - }); - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on('error', (er) => { - this[ONERROR](er, entry); - fullyDone(); - }); - entry.pipe(tx); - } - tx.pipe(stream); - } - [DIRECTORY](entry, fullyDone) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.dmode; - this[MKDIR](String(entry.absolute), mode, er => { - if (er) { - this[ONERROR](er, entry); - fullyDone(); - return; - } - let actions = 1; - const done = () => { - if (--actions === 0) { - fullyDone(); - this[UNPEND](); - entry.resume(); - } - }; - if (entry.mtime && !this.noMtime) { - actions++; - node_fs_1.default.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); - } - if (this[DOCHOWN](entry)) { - actions++; - node_fs_1.default.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); - } - done(); - }); - } - [UNSUPPORTED](entry) { - entry.unsupported = true; - this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); - entry.resume(); - } - [SYMLINK](entry, done) { - this[LINK](entry, String(entry.linkpath), 'symlink', done); - } - [HARDLINK](entry, done) { - const linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(this.cwd, String(entry.linkpath))); - this[LINK](entry, linkpath, 'link', done); - } - [PEND]() { - this[PENDING]++; - } - [UNPEND]() { - this[PENDING]--; - this[MAYBECLOSE](); - } - [SKIP](entry) { - this[UNPEND](); - entry.resume(); - } - // Check if we can reuse an existing filesystem entry safely and - // overwrite it, rather than unlinking and recreating - // Windows doesn't report a useful nlink, so we just never reuse entries - [ISREUSABLE](entry, st) { - return (entry.type === 'File' && - !this.unlink && - st.isFile() && - st.nlink <= 1 && - !isWindows); - } - // check if a thing is there, and if so, try to clobber it - [CHECKFS](entry) { - this[PEND](); - const paths = [entry.path]; - if (entry.linkpath) { - paths.push(entry.linkpath); - } - this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); - } - [PRUNECACHE](entry) { - // if we are not creating a directory, and the path is in the dirCache, - // then that means we are about to delete the directory we created - // previously, and it is no longer going to be a directory, and neither - // is any of its children. - // If a symbolic link is encountered, all bets are off. There is no - // reasonable way to sanitize the cache in such a way we will be able to - // avoid having filesystem collisions. If this happens with a non-symlink - // entry, it'll just fail to unpack, but a symlink to a directory, using an - // 8.3 shortname or certain unicode attacks, can evade detection and lead - // to arbitrary writes to anywhere on the system. - if (entry.type === 'SymbolicLink') { - dropCache(this.dirCache); - } - else if (entry.type !== 'Directory') { - pruneCache(this.dirCache, String(entry.absolute)); - } - } - [CHECKFS2](entry, fullyDone) { - this[PRUNECACHE](entry); - const done = (er) => { - this[PRUNECACHE](entry); - fullyDone(er); - }; - const checkCwd = () => { - this[MKDIR](this.cwd, this.dmode, er => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - this[CHECKED_CWD] = true; - start(); - }); - }; - const start = () => { - if (entry.absolute !== this.cwd) { - const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - return this[MKDIR](parent, this.dmode, er => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - afterMakeParent(); - }); - } - } - afterMakeParent(); - }; - const afterMakeParent = () => { - node_fs_1.default.lstat(String(entry.absolute), (lstatEr, st) => { - if (st && - (this.keep || - /* c8 ignore next */ - (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { - this[SKIP](entry); - done(); - return; - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry, done); - } - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = this.chmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode; - const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); - if (!needChmod) { - return afterChmod(); - } - return node_fs_1.default.chmod(String(entry.absolute), Number(entry.mode), afterChmod); - } - // Not a dir entry, have to remove it. - // NB: the only way to end up with an entry that is the cwd - // itself, in such a way that == does not detect, is a - // tricky windows absolute path with UNC or 8.3 parts (and - // preservePaths:true, or else it will have been stripped). - // In that case, the user has opted out of path protections - // explicitly, so if they blow away the cwd, c'est la vie. - if (entry.absolute !== this.cwd) { - return node_fs_1.default.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); - } - } - // not a dir, and not reusable - // don't remove if the cwd, we want that error - if (entry.absolute === this.cwd) { - return this[MAKEFS](null, entry, done); - } - unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); - }); - }; - if (this[CHECKED_CWD]) { - start(); - } - else { - checkCwd(); - } - } - [MAKEFS](er, entry, done) { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - switch (entry.type) { - case 'File': - case 'OldFile': - case 'ContiguousFile': - return this[FILE](entry, done); - case 'Link': - return this[HARDLINK](entry, done); - case 'SymbolicLink': - return this[SYMLINK](entry, done); - case 'Directory': - case 'GNUDumpDir': - return this[DIRECTORY](entry, done); - } - } - [LINK](entry, linkpath, link, done) { - // XXX: get the type ('symlink' or 'junction') for windows - node_fs_1.default[link](linkpath, String(entry.absolute), er => { - if (er) { - this[ONERROR](er, entry); - } - else { - this[UNPEND](); - entry.resume(); - } - done(); - }); - } -} -exports.Unpack = Unpack; -const callSync = (fn) => { - try { - return [null, fn()]; - } - catch (er) { - return [er, null]; - } -}; -class UnpackSync extends Unpack { - sync = true; - [MAKEFS](er, entry) { - return super[MAKEFS](er, entry, () => { }); - } - [CHECKFS](entry) { - this[PRUNECACHE](entry); - if (!this[CHECKED_CWD]) { - const er = this[MKDIR](this.cwd, this.dmode); - if (er) { - return this[ONERROR](er, entry); - } - this[CHECKED_CWD] = true; - } - // don't bother to make the parent if the current entry is the cwd, - // we've already checked it. - if (entry.absolute !== this.cwd) { - const parent = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - const mkParent = this[MKDIR](parent, this.dmode); - if (mkParent) { - return this[ONERROR](mkParent, entry); - } - } - } - const [lstatEr, st] = callSync(() => node_fs_1.default.lstatSync(String(entry.absolute))); - if (st && - (this.keep || - /* c8 ignore next */ - (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { - return this[SKIP](entry); - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry); - } - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = this.chmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode; - const [er] = needChmod ? - callSync(() => { - node_fs_1.default.chmodSync(String(entry.absolute), Number(entry.mode)); - }) - : []; - return this[MAKEFS](er, entry); - } - // not a dir entry, have to remove it - const [er] = callSync(() => node_fs_1.default.rmdirSync(String(entry.absolute))); - this[MAKEFS](er, entry); - } - // not a dir, and not reusable. - // don't remove if it's the cwd, since we want that error. - const [er] = entry.absolute === this.cwd ? - [] - : callSync(() => unlinkFileSync(String(entry.absolute))); - this[MAKEFS](er, entry); - } - [FILE](entry, done) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.fmode; - const oner = (er) => { - let closeError; - try { - node_fs_1.default.closeSync(fd); - } - catch (e) { - closeError = e; - } - if (er || closeError) { - this[ONERROR](er || closeError, entry); - } - done(); - }; - let fd; - try { - fd = node_fs_1.default.openSync(String(entry.absolute), (0, get_write_flag_js_1.getWriteFlag)(entry.size), mode); - } - catch (er) { - return oner(er); - } - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on('error', (er) => this[ONERROR](er, entry)); - entry.pipe(tx); - } - tx.on('data', (chunk) => { - try { - node_fs_1.default.writeSync(fd, chunk, 0, chunk.length); - } - catch (er) { - oner(er); - } - }); - tx.on('end', () => { - let er = null; - // try both, falling futimes back to utimes - // if either fails, handle the first error - if (entry.mtime && !this.noMtime) { - const atime = entry.atime || new Date(); - const mtime = entry.mtime; - try { - node_fs_1.default.futimesSync(fd, atime, mtime); - } - catch (futimeser) { - try { - node_fs_1.default.utimesSync(String(entry.absolute), atime, mtime); - } - catch (utimeser) { - er = futimeser; - } - } - } - if (this[DOCHOWN](entry)) { - const uid = this[UID](entry); - const gid = this[GID](entry); - try { - node_fs_1.default.fchownSync(fd, Number(uid), Number(gid)); - } - catch (fchowner) { - try { - node_fs_1.default.chownSync(String(entry.absolute), Number(uid), Number(gid)); - } - catch (chowner) { - er = er || fchowner; - } - } - } - oner(er); - }); - } - [DIRECTORY](entry, done) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.dmode; - const er = this[MKDIR](String(entry.absolute), mode); - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - if (entry.mtime && !this.noMtime) { - try { - node_fs_1.default.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); - /* c8 ignore next */ - } - catch (er) { } - } - if (this[DOCHOWN](entry)) { - try { - node_fs_1.default.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); - } - catch (er) { } - } - done(); - entry.resume(); - } - [MKDIR](dir, mode) { - try { - return (0, mkdir_js_1.mkdirSync)((0, normalize_windows_path_js_1.normalizeWindowsPath)(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - }); - } - catch (er) { - return er; - } - } - [LINK](entry, linkpath, link, done) { - const ls = `${link}Sync`; - try { - node_fs_1.default[ls](linkpath, String(entry.absolute)); - done(); - entry.resume(); - } - catch (er) { - return this[ONERROR](er, entry); - } - } -} -exports.UnpackSync = UnpackSync; -//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/list.js b/node_modules/node-gyp/node_modules/tar/dist/esm/list.js deleted file mode 100644 index f49068400b6c9..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/list.js +++ /dev/null @@ -1,106 +0,0 @@ -// tar -t -import * as fsm from '@isaacs/fs-minipass'; -import fs from 'node:fs'; -import { dirname, parse } from 'path'; -import { makeCommand } from './make-command.js'; -import { Parser } from './parse.js'; -import { stripTrailingSlashes } from './strip-trailing-slashes.js'; -const onReadEntryFunction = (opt) => { - const onReadEntry = opt.onReadEntry; - opt.onReadEntry = - onReadEntry ? - e => { - onReadEntry(e); - e.resume(); - } - : e => e.resume(); -}; -// construct a filter that limits the file entries listed -// include child entries if a dir is included -export const filesFilter = (opt, files) => { - const map = new Map(files.map(f => [stripTrailingSlashes(f), true])); - const filter = opt.filter; - const mapHas = (file, r = '') => { - const root = r || parse(file).root || '.'; - let ret; - if (file === root) - ret = false; - else { - const m = map.get(file); - if (m !== undefined) { - ret = m; - } - else { - ret = mapHas(dirname(file), root); - } - } - map.set(file, ret); - return ret; - }; - opt.filter = - filter ? - (file, entry) => filter(file, entry) && mapHas(stripTrailingSlashes(file)) - : file => mapHas(stripTrailingSlashes(file)); -}; -const listFileSync = (opt) => { - const p = new Parser(opt); - const file = opt.file; - let fd; - try { - const stat = fs.statSync(file); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - if (stat.size < readSize) { - p.end(fs.readFileSync(file)); - } - else { - let pos = 0; - const buf = Buffer.allocUnsafe(readSize); - fd = fs.openSync(file, 'r'); - while (pos < stat.size) { - const bytesRead = fs.readSync(fd, buf, 0, readSize, pos); - pos += bytesRead; - p.write(buf.subarray(0, bytesRead)); - } - p.end(); - } - } - finally { - if (typeof fd === 'number') { - try { - fs.closeSync(fd); - /* c8 ignore next */ - } - catch (er) { } - } - } -}; -const listFile = (opt, _files) => { - const parse = new Parser(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve, reject) => { - parse.on('error', reject); - parse.on('end', resolve); - fs.stat(file, (er, stat) => { - if (er) { - reject(er); - } - else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }); - stream.on('error', reject); - stream.pipe(parse); - } - }); - }); - return p; -}; -export const list = makeCommand(listFileSync, listFile, opt => new Parser(opt), opt => new Parser(opt), (opt, files) => { - if (files?.length) - filesFilter(opt, files); - if (!opt.noResume) - onReadEntryFunction(opt); -}); -//# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js b/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js deleted file mode 100644 index 13498ef0082f0..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/mkdir.js +++ /dev/null @@ -1,201 +0,0 @@ -import { chownr, chownrSync } from 'chownr'; -import fs from 'fs'; -import { mkdirp, mkdirpSync } from 'mkdirp'; -import path from 'node:path'; -import { CwdError } from './cwd-error.js'; -import { normalizeWindowsPath } from './normalize-windows-path.js'; -import { SymlinkError } from './symlink-error.js'; -const cGet = (cache, key) => cache.get(normalizeWindowsPath(key)); -const cSet = (cache, key, val) => cache.set(normalizeWindowsPath(key), val); -const checkCwd = (dir, cb) => { - fs.stat(dir, (er, st) => { - if (er || !st.isDirectory()) { - er = new CwdError(dir, er?.code || 'ENOTDIR'); - } - cb(er); - }); -}; -/** - * Wrapper around mkdirp for tar's needs. - * - * The main purpose is to avoid creating directories if we know that - * they already exist (and track which ones exist for this purpose), - * and prevent entries from being extracted into symlinked folders, - * if `preservePaths` is not set. - */ -export const mkdir = (dir, opt, cb) => { - dir = normalizeWindowsPath(dir); - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - /* c8 ignore next */ - const umask = opt.umask ?? 0o22; - const mode = opt.mode | 0o0700; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = normalizeWindowsPath(opt.cwd); - const done = (er, created) => { - if (er) { - cb(er); - } - else { - cSet(cache, dir, true); - if (created && doChown) { - chownr(created, uid, gid, er => done(er)); - } - else if (needChmod) { - fs.chmod(dir, mode, cb); - } - else { - cb(); - } - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - return checkCwd(dir, done); - } - if (preserve) { - return mkdirp(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts - done); - } - const sub = normalizeWindowsPath(path.relative(cwd, dir)); - const parts = sub.split('/'); - mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); -}; -const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { - if (!parts.length) { - return cb(null, created); - } - const p = parts.shift(); - const part = normalizeWindowsPath(path.resolve(base + '/' + p)); - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); -}; -const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { - if (er) { - fs.lstat(part, (statEr, st) => { - if (statEr) { - statEr.path = - statEr.path && normalizeWindowsPath(statEr.path); - cb(statEr); - } - else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - else if (unlink) { - fs.unlink(part, er => { - if (er) { - return cb(er); - } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); - }); - } - else if (st.isSymbolicLink()) { - return cb(new SymlinkError(part, part + '/' + parts.join('/'))); - } - else { - cb(er); - } - }); - } - else { - created = created || part; - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } -}; -const checkCwdSync = (dir) => { - let ok = false; - let code = undefined; - try { - ok = fs.statSync(dir).isDirectory(); - } - catch (er) { - code = er?.code; - } - finally { - if (!ok) { - throw new CwdError(dir, code ?? 'ENOTDIR'); - } - } -}; -export const mkdirSync = (dir, opt) => { - dir = normalizeWindowsPath(dir); - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - /* c8 ignore next */ - const umask = opt.umask ?? 0o22; - const mode = opt.mode | 0o700; - const needChmod = (mode & umask) !== 0; - const uid = opt.uid; - const gid = opt.gid; - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid); - const preserve = opt.preserve; - const unlink = opt.unlink; - const cache = opt.cache; - const cwd = normalizeWindowsPath(opt.cwd); - const done = (created) => { - cSet(cache, dir, true); - if (created && doChown) { - chownrSync(created, uid, gid); - } - if (needChmod) { - fs.chmodSync(dir, mode); - } - }; - if (cache && cGet(cache, dir) === true) { - return done(); - } - if (dir === cwd) { - checkCwdSync(cwd); - return done(); - } - if (preserve) { - return done(mkdirpSync(dir, mode) ?? undefined); - } - const sub = normalizeWindowsPath(path.relative(cwd, dir)); - const parts = sub.split('/'); - let created = undefined; - for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { - part = normalizeWindowsPath(path.resolve(part)); - if (cGet(cache, part)) { - continue; - } - try { - fs.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - } - catch (er) { - const st = fs.lstatSync(part); - if (st.isDirectory()) { - cSet(cache, part, true); - continue; - } - else if (unlink) { - fs.unlinkSync(part); - fs.mkdirSync(part, mode); - created = created || part; - cSet(cache, part, true); - continue; - } - else if (st.isSymbolicLink()) { - return new SymlinkError(part, part + '/' + parts.join('/')); - } - } - } - return done(created); -}; -//# sourceMappingURL=mkdir.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js deleted file mode 100644 index 94e5095476d6e..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-unicode.js +++ /dev/null @@ -1,13 +0,0 @@ -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -const normalizeCache = Object.create(null); -const { hasOwnProperty } = Object.prototype; -export const normalizeUnicode = (s) => { - if (!hasOwnProperty.call(normalizeCache, s)) { - normalizeCache[s] = s.normalize('NFD'); - } - return normalizeCache[s]; -}; -//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js b/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js deleted file mode 100644 index 6e744cfc1a6f9..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/unpack.js +++ /dev/null @@ -1,888 +0,0 @@ -// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. -// but the path reservations are required to avoid race conditions where -// parallelized unpack ops may mess with one another, due to dependencies -// (like a Link depending on its target) or destructive operations (like -// clobbering an fs object to create one of a different type.) -import * as fsm from '@isaacs/fs-minipass'; -import assert from 'node:assert'; -import { randomBytes } from 'node:crypto'; -import fs from 'node:fs'; -import path from 'node:path'; -import { getWriteFlag } from './get-write-flag.js'; -import { mkdir, mkdirSync } from './mkdir.js'; -import { normalizeUnicode } from './normalize-unicode.js'; -import { normalizeWindowsPath } from './normalize-windows-path.js'; -import { Parser } from './parse.js'; -import { stripAbsolutePath } from './strip-absolute-path.js'; -import { stripTrailingSlashes } from './strip-trailing-slashes.js'; -import * as wc from './winchars.js'; -import { PathReservations } from './path-reservations.js'; -const ONENTRY = Symbol('onEntry'); -const CHECKFS = Symbol('checkFs'); -const CHECKFS2 = Symbol('checkFs2'); -const PRUNECACHE = Symbol('pruneCache'); -const ISREUSABLE = Symbol('isReusable'); -const MAKEFS = Symbol('makeFs'); -const FILE = Symbol('file'); -const DIRECTORY = Symbol('directory'); -const LINK = Symbol('link'); -const SYMLINK = Symbol('symlink'); -const HARDLINK = Symbol('hardlink'); -const UNSUPPORTED = Symbol('unsupported'); -const CHECKPATH = Symbol('checkPath'); -const MKDIR = Symbol('mkdir'); -const ONERROR = Symbol('onError'); -const PENDING = Symbol('pending'); -const PEND = Symbol('pend'); -const UNPEND = Symbol('unpend'); -const ENDED = Symbol('ended'); -const MAYBECLOSE = Symbol('maybeClose'); -const SKIP = Symbol('skip'); -const DOCHOWN = Symbol('doChown'); -const UID = Symbol('uid'); -const GID = Symbol('gid'); -const CHECKED_CWD = Symbol('checkedCwd'); -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -const isWindows = platform === 'win32'; -const DEFAULT_MAX_DEPTH = 1024; -// Unlinks on Windows are not atomic. -// -// This means that if you have a file entry, followed by another -// file entry with an identical name, and you cannot re-use the file -// (because it's a hardlink, or because unlink:true is set, or it's -// Windows, which does not have useful nlink values), then the unlink -// will be committed to the disk AFTER the new file has been written -// over the old one, deleting the new file. -// -// To work around this, on Windows systems, we rename the file and then -// delete the renamed file. It's a sloppy kludge, but frankly, I do not -// know of a better way to do this, given windows' non-atomic unlink -// semantics. -// -// See: https://github.com/npm/node-tar/issues/183 -/* c8 ignore start */ -const unlinkFile = (path, cb) => { - if (!isWindows) { - return fs.unlink(path, cb); - } - const name = path + '.DELETE.' + randomBytes(16).toString('hex'); - fs.rename(path, name, er => { - if (er) { - return cb(er); - } - fs.unlink(name, cb); - }); -}; -/* c8 ignore stop */ -/* c8 ignore start */ -const unlinkFileSync = (path) => { - if (!isWindows) { - return fs.unlinkSync(path); - } - const name = path + '.DELETE.' + randomBytes(16).toString('hex'); - fs.renameSync(path, name); - fs.unlinkSync(name); -}; -/* c8 ignore stop */ -// this.gid, entry.gid, this.processUid -const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a - : b !== undefined && b === b >>> 0 ? b - : c; -// clear the cache if it's a case-insensitive unicode-squashing match. -// we can't know if the current file system is case-sensitive or supports -// unicode fully, so we check for similarity on the maximally compatible -// representation. Err on the side of pruning, since all it's doing is -// preventing lstats, and it's not the end of the world if we get a false -// positive. -// Note that on windows, we always drop the entire cache whenever a -// symbolic link is encountered, because 8.3 filenames are impossible -// to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = (path) => stripTrailingSlashes(normalizeWindowsPath(normalizeUnicode(path))).toLowerCase(); -// remove all cache entries matching ${abs}/** -const pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs); - for (const path of cache.keys()) { - const pnorm = cacheKeyNormalize(path); - if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { - cache.delete(path); - } - } -}; -const dropCache = (cache) => { - for (const key of cache.keys()) { - cache.delete(key); - } -}; -export class Unpack extends Parser { - [ENDED] = false; - [CHECKED_CWD] = false; - [PENDING] = 0; - reservations = new PathReservations(); - transform; - writable = true; - readable = false; - dirCache; - uid; - gid; - setOwner; - preserveOwner; - processGid; - processUid; - maxDepth; - forceChown; - win32; - newer; - keep; - noMtime; - preservePaths; - unlink; - cwd; - strip; - processUmask; - umask; - dmode; - fmode; - chmod; - constructor(opt = {}) { - opt.ondone = () => { - this[ENDED] = true; - this[MAYBECLOSE](); - }; - super(opt); - this.transform = opt.transform; - this.dirCache = opt.dirCache || new Map(); - this.chmod = !!opt.chmod; - if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { - // need both or neither - if (typeof opt.uid !== 'number' || - typeof opt.gid !== 'number') { - throw new TypeError('cannot set owner without number uid and gid'); - } - if (opt.preserveOwner) { - throw new TypeError('cannot preserve owner in archive and also set owner explicitly'); - } - this.uid = opt.uid; - this.gid = opt.gid; - this.setOwner = true; - } - else { - this.uid = undefined; - this.gid = undefined; - this.setOwner = false; - } - // default true for root - if (opt.preserveOwner === undefined && - typeof opt.uid !== 'number') { - this.preserveOwner = !!(process.getuid && process.getuid() === 0); - } - else { - this.preserveOwner = !!opt.preserveOwner; - } - this.processUid = - (this.preserveOwner || this.setOwner) && process.getuid ? - process.getuid() - : undefined; - this.processGid = - (this.preserveOwner || this.setOwner) && process.getgid ? - process.getgid() - : undefined; - // prevent excessively deep nesting of subfolders - // set to `Infinity` to remove this restriction - this.maxDepth = - typeof opt.maxDepth === 'number' ? - opt.maxDepth - : DEFAULT_MAX_DEPTH; - // mostly just for testing, but useful in some cases. - // Forcibly trigger a chown on every entry, no matter what - this.forceChown = opt.forceChown === true; - // turn > this[ONENTRY](entry)); - } - // a bad or damaged archive is a warning for Parser, but an error - // when extracting. Mark those errors as unrecoverable, because - // the Unpack contract cannot be met. - warn(code, msg, data = {}) { - if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { - data.recoverable = false; - } - return super.warn(code, msg, data); - } - [MAYBECLOSE]() { - if (this[ENDED] && this[PENDING] === 0) { - this.emit('prefinish'); - this.emit('finish'); - this.emit('end'); - } - } - [CHECKPATH](entry) { - const p = normalizeWindowsPath(entry.path); - const parts = p.split('/'); - if (this.strip) { - if (parts.length < this.strip) { - return false; - } - if (entry.type === 'Link') { - const linkparts = normalizeWindowsPath(String(entry.linkpath)).split('/'); - if (linkparts.length >= this.strip) { - entry.linkpath = linkparts.slice(this.strip).join('/'); - } - else { - return false; - } - } - parts.splice(0, this.strip); - entry.path = parts.join('/'); - } - if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { - this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { - entry, - path: p, - depth: parts.length, - maxDepth: this.maxDepth, - }); - return false; - } - if (!this.preservePaths) { - if (parts.includes('..') || - /* c8 ignore next */ - (isWindows && /^[a-z]:\.\.$/i.test(parts[0] ?? ''))) { - this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { - entry, - path: p, - }); - return false; - } - // strip off the root - const [root, stripped] = stripAbsolutePath(p); - if (root) { - entry.path = String(stripped); - this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { - entry, - path: p, - }); - } - } - if (path.isAbsolute(entry.path)) { - entry.absolute = normalizeWindowsPath(path.resolve(entry.path)); - } - else { - entry.absolute = normalizeWindowsPath(path.resolve(this.cwd, entry.path)); - } - // if we somehow ended up with a path that escapes the cwd, and we are - // not in preservePaths mode, then something is fishy! This should have - // been prevented above, so ignore this for coverage. - /* c8 ignore start - defense in depth */ - if (!this.preservePaths && - typeof entry.absolute === 'string' && - entry.absolute.indexOf(this.cwd + '/') !== 0 && - entry.absolute !== this.cwd) { - this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { - entry, - path: normalizeWindowsPath(entry.path), - resolvedPath: entry.absolute, - cwd: this.cwd, - }); - return false; - } - /* c8 ignore stop */ - // an archive can set properties on the extraction directory, but it - // may not replace the cwd with a different kind of thing entirely. - if (entry.absolute === this.cwd && - entry.type !== 'Directory' && - entry.type !== 'GNUDumpDir') { - return false; - } - // only encode : chars that aren't drive letter indicators - if (this.win32) { - const { root: aRoot } = path.win32.parse(String(entry.absolute)); - entry.absolute = - aRoot + wc.encode(String(entry.absolute).slice(aRoot.length)); - const { root: pRoot } = path.win32.parse(entry.path); - entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)); - } - return true; - } - [ONENTRY](entry) { - if (!this[CHECKPATH](entry)) { - return entry.resume(); - } - assert.equal(typeof entry.absolute, 'string'); - switch (entry.type) { - case 'Directory': - case 'GNUDumpDir': - if (entry.mode) { - entry.mode = entry.mode | 0o700; - } - // eslint-disable-next-line no-fallthrough - case 'File': - case 'OldFile': - case 'ContiguousFile': - case 'Link': - case 'SymbolicLink': - return this[CHECKFS](entry); - case 'CharacterDevice': - case 'BlockDevice': - case 'FIFO': - default: - return this[UNSUPPORTED](entry); - } - } - [ONERROR](er, entry) { - // Cwd has to exist, or else nothing works. That's serious. - // Other errors are warnings, which raise the error in strict - // mode, but otherwise continue on. - if (er.name === 'CwdError') { - this.emit('error', er); - } - else { - this.warn('TAR_ENTRY_ERROR', er, { entry }); - this[UNPEND](); - entry.resume(); - } - } - [MKDIR](dir, mode, cb) { - mkdir(normalizeWindowsPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - }, cb); - } - [DOCHOWN](entry) { - // in preserve owner mode, chown if the entry doesn't match process - // in set owner mode, chown if setting doesn't match process - return (this.forceChown || - (this.preserveOwner && - ((typeof entry.uid === 'number' && - entry.uid !== this.processUid) || - (typeof entry.gid === 'number' && - entry.gid !== this.processGid))) || - (typeof this.uid === 'number' && - this.uid !== this.processUid) || - (typeof this.gid === 'number' && this.gid !== this.processGid)); - } - [UID](entry) { - return uint32(this.uid, entry.uid, this.processUid); - } - [GID](entry) { - return uint32(this.gid, entry.gid, this.processGid); - } - [FILE](entry, fullyDone) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.fmode; - const stream = new fsm.WriteStream(String(entry.absolute), { - // slight lie, but it can be numeric flags - flags: getWriteFlag(entry.size), - mode: mode, - autoClose: false, - }); - stream.on('error', (er) => { - if (stream.fd) { - fs.close(stream.fd, () => { }); - } - // flush all the data out so that we aren't left hanging - // if the error wasn't actually fatal. otherwise the parse - // is blocked, and we never proceed. - stream.write = () => true; - this[ONERROR](er, entry); - fullyDone(); - }); - let actions = 1; - const done = (er) => { - if (er) { - /* c8 ignore start - we should always have a fd by now */ - if (stream.fd) { - fs.close(stream.fd, () => { }); - } - /* c8 ignore stop */ - this[ONERROR](er, entry); - fullyDone(); - return; - } - if (--actions === 0) { - if (stream.fd !== undefined) { - fs.close(stream.fd, er => { - if (er) { - this[ONERROR](er, entry); - } - else { - this[UNPEND](); - } - fullyDone(); - }); - } - } - }; - stream.on('finish', () => { - // if futimes fails, try utimes - // if utimes fails, fail with the original error - // same for fchown/chown - const abs = String(entry.absolute); - const fd = stream.fd; - if (typeof fd === 'number' && entry.mtime && !this.noMtime) { - actions++; - const atime = entry.atime || new Date(); - const mtime = entry.mtime; - fs.futimes(fd, atime, mtime, er => er ? - fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) - : done()); - } - if (typeof fd === 'number' && this[DOCHOWN](entry)) { - actions++; - const uid = this[UID](entry); - const gid = this[GID](entry); - if (typeof uid === 'number' && typeof gid === 'number') { - fs.fchown(fd, uid, gid, er => er ? - fs.chown(abs, uid, gid, er2 => done(er2 && er)) - : done()); - } - } - done(); - }); - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on('error', (er) => { - this[ONERROR](er, entry); - fullyDone(); - }); - entry.pipe(tx); - } - tx.pipe(stream); - } - [DIRECTORY](entry, fullyDone) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.dmode; - this[MKDIR](String(entry.absolute), mode, er => { - if (er) { - this[ONERROR](er, entry); - fullyDone(); - return; - } - let actions = 1; - const done = () => { - if (--actions === 0) { - fullyDone(); - this[UNPEND](); - entry.resume(); - } - }; - if (entry.mtime && !this.noMtime) { - actions++; - fs.utimes(String(entry.absolute), entry.atime || new Date(), entry.mtime, done); - } - if (this[DOCHOWN](entry)) { - actions++; - fs.chown(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry)), done); - } - done(); - }); - } - [UNSUPPORTED](entry) { - entry.unsupported = true; - this.warn('TAR_ENTRY_UNSUPPORTED', `unsupported entry type: ${entry.type}`, { entry }); - entry.resume(); - } - [SYMLINK](entry, done) { - this[LINK](entry, String(entry.linkpath), 'symlink', done); - } - [HARDLINK](entry, done) { - const linkpath = normalizeWindowsPath(path.resolve(this.cwd, String(entry.linkpath))); - this[LINK](entry, linkpath, 'link', done); - } - [PEND]() { - this[PENDING]++; - } - [UNPEND]() { - this[PENDING]--; - this[MAYBECLOSE](); - } - [SKIP](entry) { - this[UNPEND](); - entry.resume(); - } - // Check if we can reuse an existing filesystem entry safely and - // overwrite it, rather than unlinking and recreating - // Windows doesn't report a useful nlink, so we just never reuse entries - [ISREUSABLE](entry, st) { - return (entry.type === 'File' && - !this.unlink && - st.isFile() && - st.nlink <= 1 && - !isWindows); - } - // check if a thing is there, and if so, try to clobber it - [CHECKFS](entry) { - this[PEND](); - const paths = [entry.path]; - if (entry.linkpath) { - paths.push(entry.linkpath); - } - this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); - } - [PRUNECACHE](entry) { - // if we are not creating a directory, and the path is in the dirCache, - // then that means we are about to delete the directory we created - // previously, and it is no longer going to be a directory, and neither - // is any of its children. - // If a symbolic link is encountered, all bets are off. There is no - // reasonable way to sanitize the cache in such a way we will be able to - // avoid having filesystem collisions. If this happens with a non-symlink - // entry, it'll just fail to unpack, but a symlink to a directory, using an - // 8.3 shortname or certain unicode attacks, can evade detection and lead - // to arbitrary writes to anywhere on the system. - if (entry.type === 'SymbolicLink') { - dropCache(this.dirCache); - } - else if (entry.type !== 'Directory') { - pruneCache(this.dirCache, String(entry.absolute)); - } - } - [CHECKFS2](entry, fullyDone) { - this[PRUNECACHE](entry); - const done = (er) => { - this[PRUNECACHE](entry); - fullyDone(er); - }; - const checkCwd = () => { - this[MKDIR](this.cwd, this.dmode, er => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - this[CHECKED_CWD] = true; - start(); - }); - }; - const start = () => { - if (entry.absolute !== this.cwd) { - const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - return this[MKDIR](parent, this.dmode, er => { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - afterMakeParent(); - }); - } - } - afterMakeParent(); - }; - const afterMakeParent = () => { - fs.lstat(String(entry.absolute), (lstatEr, st) => { - if (st && - (this.keep || - /* c8 ignore next */ - (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { - this[SKIP](entry); - done(); - return; - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry, done); - } - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = this.chmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode; - const afterChmod = (er) => this[MAKEFS](er ?? null, entry, done); - if (!needChmod) { - return afterChmod(); - } - return fs.chmod(String(entry.absolute), Number(entry.mode), afterChmod); - } - // Not a dir entry, have to remove it. - // NB: the only way to end up with an entry that is the cwd - // itself, in such a way that == does not detect, is a - // tricky windows absolute path with UNC or 8.3 parts (and - // preservePaths:true, or else it will have been stripped). - // In that case, the user has opted out of path protections - // explicitly, so if they blow away the cwd, c'est la vie. - if (entry.absolute !== this.cwd) { - return fs.rmdir(String(entry.absolute), (er) => this[MAKEFS](er ?? null, entry, done)); - } - } - // not a dir, and not reusable - // don't remove if the cwd, we want that error - if (entry.absolute === this.cwd) { - return this[MAKEFS](null, entry, done); - } - unlinkFile(String(entry.absolute), er => this[MAKEFS](er ?? null, entry, done)); - }); - }; - if (this[CHECKED_CWD]) { - start(); - } - else { - checkCwd(); - } - } - [MAKEFS](er, entry, done) { - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - switch (entry.type) { - case 'File': - case 'OldFile': - case 'ContiguousFile': - return this[FILE](entry, done); - case 'Link': - return this[HARDLINK](entry, done); - case 'SymbolicLink': - return this[SYMLINK](entry, done); - case 'Directory': - case 'GNUDumpDir': - return this[DIRECTORY](entry, done); - } - } - [LINK](entry, linkpath, link, done) { - // XXX: get the type ('symlink' or 'junction') for windows - fs[link](linkpath, String(entry.absolute), er => { - if (er) { - this[ONERROR](er, entry); - } - else { - this[UNPEND](); - entry.resume(); - } - done(); - }); - } -} -const callSync = (fn) => { - try { - return [null, fn()]; - } - catch (er) { - return [er, null]; - } -}; -export class UnpackSync extends Unpack { - sync = true; - [MAKEFS](er, entry) { - return super[MAKEFS](er, entry, () => { }); - } - [CHECKFS](entry) { - this[PRUNECACHE](entry); - if (!this[CHECKED_CWD]) { - const er = this[MKDIR](this.cwd, this.dmode); - if (er) { - return this[ONERROR](er, entry); - } - this[CHECKED_CWD] = true; - } - // don't bother to make the parent if the current entry is the cwd, - // we've already checked it. - if (entry.absolute !== this.cwd) { - const parent = normalizeWindowsPath(path.dirname(String(entry.absolute))); - if (parent !== this.cwd) { - const mkParent = this[MKDIR](parent, this.dmode); - if (mkParent) { - return this[ONERROR](mkParent, entry); - } - } - } - const [lstatEr, st] = callSync(() => fs.lstatSync(String(entry.absolute))); - if (st && - (this.keep || - /* c8 ignore next */ - (this.newer && st.mtime > (entry.mtime ?? st.mtime)))) { - return this[SKIP](entry); - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry); - } - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = this.chmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode; - const [er] = needChmod ? - callSync(() => { - fs.chmodSync(String(entry.absolute), Number(entry.mode)); - }) - : []; - return this[MAKEFS](er, entry); - } - // not a dir entry, have to remove it - const [er] = callSync(() => fs.rmdirSync(String(entry.absolute))); - this[MAKEFS](er, entry); - } - // not a dir, and not reusable. - // don't remove if it's the cwd, since we want that error. - const [er] = entry.absolute === this.cwd ? - [] - : callSync(() => unlinkFileSync(String(entry.absolute))); - this[MAKEFS](er, entry); - } - [FILE](entry, done) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.fmode; - const oner = (er) => { - let closeError; - try { - fs.closeSync(fd); - } - catch (e) { - closeError = e; - } - if (er || closeError) { - this[ONERROR](er || closeError, entry); - } - done(); - }; - let fd; - try { - fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode); - } - catch (er) { - return oner(er); - } - const tx = this.transform ? this.transform(entry) || entry : entry; - if (tx !== entry) { - tx.on('error', (er) => this[ONERROR](er, entry)); - entry.pipe(tx); - } - tx.on('data', (chunk) => { - try { - fs.writeSync(fd, chunk, 0, chunk.length); - } - catch (er) { - oner(er); - } - }); - tx.on('end', () => { - let er = null; - // try both, falling futimes back to utimes - // if either fails, handle the first error - if (entry.mtime && !this.noMtime) { - const atime = entry.atime || new Date(); - const mtime = entry.mtime; - try { - fs.futimesSync(fd, atime, mtime); - } - catch (futimeser) { - try { - fs.utimesSync(String(entry.absolute), atime, mtime); - } - catch (utimeser) { - er = futimeser; - } - } - } - if (this[DOCHOWN](entry)) { - const uid = this[UID](entry); - const gid = this[GID](entry); - try { - fs.fchownSync(fd, Number(uid), Number(gid)); - } - catch (fchowner) { - try { - fs.chownSync(String(entry.absolute), Number(uid), Number(gid)); - } - catch (chowner) { - er = er || fchowner; - } - } - } - oner(er); - }); - } - [DIRECTORY](entry, done) { - const mode = typeof entry.mode === 'number' ? - entry.mode & 0o7777 - : this.dmode; - const er = this[MKDIR](String(entry.absolute), mode); - if (er) { - this[ONERROR](er, entry); - done(); - return; - } - if (entry.mtime && !this.noMtime) { - try { - fs.utimesSync(String(entry.absolute), entry.atime || new Date(), entry.mtime); - /* c8 ignore next */ - } - catch (er) { } - } - if (this[DOCHOWN](entry)) { - try { - fs.chownSync(String(entry.absolute), Number(this[UID](entry)), Number(this[GID](entry))); - } - catch (er) { } - } - done(); - entry.resume(); - } - [MKDIR](dir, mode) { - try { - return mkdirSync(normalizeWindowsPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - }); - } - catch (er) { - return er; - } - } - [LINK](entry, linkpath, link, done) { - const ls = `${link}Sync`; - try { - fs[ls](linkpath, String(entry.absolute)); - done(); - entry.resume(); - } - catch (er) { - return this[ONERROR](er, entry); - } - } -} -//# sourceMappingURL=unpack.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/package.json b/node_modules/node-gyp/node_modules/tar/package.json deleted file mode 100644 index 0283103ee9eaf..0000000000000 --- a/node_modules/node-gyp/node_modules/tar/package.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "author": "Isaac Z. Schlueter", - "name": "tar", - "description": "tar for node", - "version": "7.4.3", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-tar.git" - }, - "scripts": { - "genparse": "node scripts/generate-parse-fixtures.js", - "snap": "tap", - "test": "tap", - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "prepare": "tshy", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "format": "prettier --write . --log-level warn", - "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" - }, - "dependencies": { - "@isaacs/fs-minipass": "^4.0.0", - "chownr": "^3.0.0", - "minipass": "^7.1.2", - "minizlib": "^3.0.1", - "mkdirp": "^3.0.1", - "yallist": "^5.0.0" - }, - "devDependencies": { - "chmodr": "^1.2.0", - "end-of-stream": "^1.4.3", - "events-to-array": "^2.0.3", - "mutate-fs": "^2.1.1", - "nock": "^13.5.4", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "tap": "^18.7.2", - "tshy": "^1.13.1", - "typedoc": "^0.25.13" - }, - "license": "ISC", - "engines": { - "node": ">=18" - }, - "files": [ - "dist" - ], - "tap": { - "coverage-map": "map.js", - "timeout": 0, - "typecheck": true - }, - "prettier": { - "experimentalTernaries": true, - "semi": false, - "printWidth": 70, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - }, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts", - "./c": "./src/create.ts", - "./create": "./src/create.ts", - "./replace": "./src/create.ts", - "./r": "./src/create.ts", - "./list": "./src/list.ts", - "./t": "./src/list.ts", - "./update": "./src/update.ts", - "./u": "./src/update.ts", - "./extract": "./src/extract.ts", - "./x": "./src/extract.ts", - "./pack": "./src/pack.ts", - "./unpack": "./src/unpack.ts", - "./parse": "./src/parse.ts", - "./read-entry": "./src/read-entry.ts", - "./write-entry": "./src/write-entry.ts", - "./header": "./src/header.ts", - "./pax": "./src/pax.ts", - "./types": "./src/types.ts" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "source": "./src/index.ts", - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "source": "./src/index.ts", - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./c": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./create": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./replace": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./r": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./list": { - "import": { - "source": "./src/list.ts", - "types": "./dist/esm/list.d.ts", - "default": "./dist/esm/list.js" - }, - "require": { - "source": "./src/list.ts", - "types": "./dist/commonjs/list.d.ts", - "default": "./dist/commonjs/list.js" - } - }, - "./t": { - "import": { - "source": "./src/list.ts", - "types": "./dist/esm/list.d.ts", - "default": "./dist/esm/list.js" - }, - "require": { - "source": "./src/list.ts", - "types": "./dist/commonjs/list.d.ts", - "default": "./dist/commonjs/list.js" - } - }, - "./update": { - "import": { - "source": "./src/update.ts", - "types": "./dist/esm/update.d.ts", - "default": "./dist/esm/update.js" - }, - "require": { - "source": "./src/update.ts", - "types": "./dist/commonjs/update.d.ts", - "default": "./dist/commonjs/update.js" - } - }, - "./u": { - "import": { - "source": "./src/update.ts", - "types": "./dist/esm/update.d.ts", - "default": "./dist/esm/update.js" - }, - "require": { - "source": "./src/update.ts", - "types": "./dist/commonjs/update.d.ts", - "default": "./dist/commonjs/update.js" - } - }, - "./extract": { - "import": { - "source": "./src/extract.ts", - "types": "./dist/esm/extract.d.ts", - "default": "./dist/esm/extract.js" - }, - "require": { - "source": "./src/extract.ts", - "types": "./dist/commonjs/extract.d.ts", - "default": "./dist/commonjs/extract.js" - } - }, - "./x": { - "import": { - "source": "./src/extract.ts", - "types": "./dist/esm/extract.d.ts", - "default": "./dist/esm/extract.js" - }, - "require": { - "source": "./src/extract.ts", - "types": "./dist/commonjs/extract.d.ts", - "default": "./dist/commonjs/extract.js" - } - }, - "./pack": { - "import": { - "source": "./src/pack.ts", - "types": "./dist/esm/pack.d.ts", - "default": "./dist/esm/pack.js" - }, - "require": { - "source": "./src/pack.ts", - "types": "./dist/commonjs/pack.d.ts", - "default": "./dist/commonjs/pack.js" - } - }, - "./unpack": { - "import": { - "source": "./src/unpack.ts", - "types": "./dist/esm/unpack.d.ts", - "default": "./dist/esm/unpack.js" - }, - "require": { - "source": "./src/unpack.ts", - "types": "./dist/commonjs/unpack.d.ts", - "default": "./dist/commonjs/unpack.js" - } - }, - "./parse": { - "import": { - "source": "./src/parse.ts", - "types": "./dist/esm/parse.d.ts", - "default": "./dist/esm/parse.js" - }, - "require": { - "source": "./src/parse.ts", - "types": "./dist/commonjs/parse.d.ts", - "default": "./dist/commonjs/parse.js" - } - }, - "./read-entry": { - "import": { - "source": "./src/read-entry.ts", - "types": "./dist/esm/read-entry.d.ts", - "default": "./dist/esm/read-entry.js" - }, - "require": { - "source": "./src/read-entry.ts", - "types": "./dist/commonjs/read-entry.d.ts", - "default": "./dist/commonjs/read-entry.js" - } - }, - "./write-entry": { - "import": { - "source": "./src/write-entry.ts", - "types": "./dist/esm/write-entry.d.ts", - "default": "./dist/esm/write-entry.js" - }, - "require": { - "source": "./src/write-entry.ts", - "types": "./dist/commonjs/write-entry.d.ts", - "default": "./dist/commonjs/write-entry.js" - } - }, - "./header": { - "import": { - "source": "./src/header.ts", - "types": "./dist/esm/header.d.ts", - "default": "./dist/esm/header.js" - }, - "require": { - "source": "./src/header.ts", - "types": "./dist/commonjs/header.d.ts", - "default": "./dist/commonjs/header.js" - } - }, - "./pax": { - "import": { - "source": "./src/pax.ts", - "types": "./dist/esm/pax.d.ts", - "default": "./dist/esm/pax.js" - }, - "require": { - "source": "./src/pax.ts", - "types": "./dist/commonjs/pax.d.ts", - "default": "./dist/commonjs/pax.js" - } - }, - "./types": { - "import": { - "source": "./src/types.ts", - "types": "./dist/esm/types.d.ts", - "default": "./dist/esm/types.js" - }, - "require": { - "source": "./src/types.ts", - "types": "./dist/commonjs/types.d.ts", - "default": "./dist/commonjs/types.js" - } - } - }, - "type": "module", - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts" -} diff --git a/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json b/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/node-gyp/node_modules/yallist/dist/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/pacote/node_modules/chownr/LICENSE.md b/node_modules/pacote/node_modules/chownr/LICENSE.md deleted file mode 100644 index 881248b6d7f0c..0000000000000 --- a/node_modules/pacote/node_modules/chownr/LICENSE.md +++ /dev/null @@ -1,63 +0,0 @@ -All packages under `src/` are licensed according to the terms in -their respective `LICENSE` or `LICENSE.md` files. - -The remainder of this project is licensed under the Blue Oak -Model License, as follows: - ------ - -# Blue Oak Model License - -Version 1.0.0 - -## Purpose - -This license gives everyone as much permission to work with -this software as possible, while protecting contributors -from liability. - -## Acceptance - -In order to receive this license, you must agree to its -rules. The rules of this license are both obligations -under that agreement and conditions to your license. -You must not do anything with this software that triggers -a rule that you cannot or will not follow. - -## Copyright - -Each contributor licenses you to do everything with this -software that would otherwise infringe that contributor's -copyright in it. - -## Notices - -You must ensure that everyone who gets a copy of -any part of this software from you, with or without -changes, also gets the text of this license or a link to -. - -## Excuse - -If anyone notifies you in writing that you have not -complied with [Notices](#notices), you can keep your -license by taking all practical steps to comply within 30 -days after the notice. If you do not do so, your license -ends immediately. - -## Patent - -Each contributor licenses you to do everything with this -software that would otherwise infringe any patent claims -they can license or become able to license. - -## Reliability - -No contributor can revoke this license. - -## No Liability - -***As far as the law allows, this software comes as is, -without any warranty or condition, and no contributor -will be liable to anyone for any damages related to this -software or this license, under any kind of legal claim.*** diff --git a/node_modules/pacote/node_modules/chownr/dist/commonjs/index.js b/node_modules/pacote/node_modules/chownr/dist/commonjs/index.js deleted file mode 100644 index 6a7b68d5eac26..0000000000000 --- a/node_modules/pacote/node_modules/chownr/dist/commonjs/index.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.chownrSync = exports.chownr = void 0; -const node_fs_1 = __importDefault(require("node:fs")); -const node_path_1 = __importDefault(require("node:path")); -const lchownSync = (path, uid, gid) => { - try { - return node_fs_1.default.lchownSync(path, uid, gid); - } - catch (er) { - if (er?.code !== 'ENOENT') - throw er; - } -}; -const chown = (cpath, uid, gid, cb) => { - node_fs_1.default.lchown(cpath, uid, gid, er => { - // Skip ENOENT error - cb(er && er?.code !== 'ENOENT' ? er : null); - }); -}; -const chownrKid = (p, child, uid, gid, cb) => { - if (child.isDirectory()) { - (0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => { - if (er) - return cb(er); - const cpath = node_path_1.default.resolve(p, child.name); - chown(cpath, uid, gid, cb); - }); - } - else { - const cpath = node_path_1.default.resolve(p, child.name); - chown(cpath, uid, gid, cb); - } -}; -const chownr = (p, uid, gid, cb) => { - node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => { - // any error other than ENOTDIR or ENOTSUP means it's not readable, - // or doesn't exist. give up. - if (er) { - if (er.code === 'ENOENT') - return cb(); - else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') - return cb(er); - } - if (er || !children.length) - return chown(p, uid, gid, cb); - let len = children.length; - let errState = null; - const then = (er) => { - /* c8 ignore start */ - if (errState) - return; - /* c8 ignore stop */ - if (er) - return cb((errState = er)); - if (--len === 0) - return chown(p, uid, gid, cb); - }; - for (const child of children) { - chownrKid(p, child, uid, gid, then); - } - }); -}; -exports.chownr = chownr; -const chownrKidSync = (p, child, uid, gid) => { - if (child.isDirectory()) - (0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid); - lchownSync(node_path_1.default.resolve(p, child.name), uid, gid); -}; -const chownrSync = (p, uid, gid) => { - let children; - try { - children = node_fs_1.default.readdirSync(p, { withFileTypes: true }); - } - catch (er) { - const e = er; - if (e?.code === 'ENOENT') - return; - else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') - return lchownSync(p, uid, gid); - else - throw e; - } - for (const child of children) { - chownrKidSync(p, child, uid, gid); - } - return lchownSync(p, uid, gid); -}; -exports.chownrSync = chownrSync; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/chownr/dist/commonjs/package.json b/node_modules/pacote/node_modules/chownr/dist/commonjs/package.json deleted file mode 100644 index 5bbefffbabee3..0000000000000 --- a/node_modules/pacote/node_modules/chownr/dist/commonjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/pacote/node_modules/chownr/dist/esm/index.js b/node_modules/pacote/node_modules/chownr/dist/esm/index.js deleted file mode 100644 index 5c2815297a67c..0000000000000 --- a/node_modules/pacote/node_modules/chownr/dist/esm/index.js +++ /dev/null @@ -1,85 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -const lchownSync = (path, uid, gid) => { - try { - return fs.lchownSync(path, uid, gid); - } - catch (er) { - if (er?.code !== 'ENOENT') - throw er; - } -}; -const chown = (cpath, uid, gid, cb) => { - fs.lchown(cpath, uid, gid, er => { - // Skip ENOENT error - cb(er && er?.code !== 'ENOENT' ? er : null); - }); -}; -const chownrKid = (p, child, uid, gid, cb) => { - if (child.isDirectory()) { - chownr(path.resolve(p, child.name), uid, gid, (er) => { - if (er) - return cb(er); - const cpath = path.resolve(p, child.name); - chown(cpath, uid, gid, cb); - }); - } - else { - const cpath = path.resolve(p, child.name); - chown(cpath, uid, gid, cb); - } -}; -export const chownr = (p, uid, gid, cb) => { - fs.readdir(p, { withFileTypes: true }, (er, children) => { - // any error other than ENOTDIR or ENOTSUP means it's not readable, - // or doesn't exist. give up. - if (er) { - if (er.code === 'ENOENT') - return cb(); - else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP') - return cb(er); - } - if (er || !children.length) - return chown(p, uid, gid, cb); - let len = children.length; - let errState = null; - const then = (er) => { - /* c8 ignore start */ - if (errState) - return; - /* c8 ignore stop */ - if (er) - return cb((errState = er)); - if (--len === 0) - return chown(p, uid, gid, cb); - }; - for (const child of children) { - chownrKid(p, child, uid, gid, then); - } - }); -}; -const chownrKidSync = (p, child, uid, gid) => { - if (child.isDirectory()) - chownrSync(path.resolve(p, child.name), uid, gid); - lchownSync(path.resolve(p, child.name), uid, gid); -}; -export const chownrSync = (p, uid, gid) => { - let children; - try { - children = fs.readdirSync(p, { withFileTypes: true }); - } - catch (er) { - const e = er; - if (e?.code === 'ENOENT') - return; - else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP') - return lchownSync(p, uid, gid); - else - throw e; - } - for (const child of children) { - chownrKidSync(p, child, uid, gid); - } - return lchownSync(p, uid, gid); -}; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/chownr/dist/esm/package.json b/node_modules/pacote/node_modules/chownr/dist/esm/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/pacote/node_modules/chownr/dist/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/pacote/node_modules/chownr/package.json b/node_modules/pacote/node_modules/chownr/package.json deleted file mode 100644 index 09aa6b2e2e576..0000000000000 --- a/node_modules/pacote/node_modules/chownr/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "name": "chownr", - "description": "like `chown -R`", - "version": "3.0.0", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/chownr.git" - }, - "files": [ - "dist" - ], - "devDependencies": { - "@types/node": "^20.12.5", - "mkdirp": "^3.0.1", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "tap": "^18.7.2", - "tshy": "^1.13.1", - "typedoc": "^0.25.12" - }, - "scripts": { - "prepare": "tshy", - "pretest": "npm run prepare", - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "format": "prettier --write . --loglevel warn", - "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" - }, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - }, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "type": "module", - "prettier": { - "semi": false, - "printWidth": 75, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - } -} diff --git a/node_modules/pacote/node_modules/tar/LICENSE b/node_modules/pacote/node_modules/tar/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/pacote/node_modules/tar/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/create.js b/node_modules/pacote/node_modules/tar/dist/commonjs/create.js deleted file mode 100644 index 3190afc48318f..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/create.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.create = void 0; -const fs_minipass_1 = require("@isaacs/fs-minipass"); -const node_path_1 = __importDefault(require("node:path")); -const list_js_1 = require("./list.js"); -const make_command_js_1 = require("./make-command.js"); -const pack_js_1 = require("./pack.js"); -const createFileSync = (opt, files) => { - const p = new pack_js_1.PackSync(opt); - const stream = new fs_minipass_1.WriteStreamSync(opt.file, { - mode: opt.mode || 0o666, - }); - p.pipe(stream); - addFilesSync(p, files); -}; -const createFile = (opt, files) => { - const p = new pack_js_1.Pack(opt); - const stream = new fs_minipass_1.WriteStream(opt.file, { - mode: opt.mode || 0o666, - }); - p.pipe(stream); - const promise = new Promise((res, rej) => { - stream.on('error', rej); - stream.on('close', res); - p.on('error', rej); - }); - addFilesAsync(p, files); - return promise; -}; -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - (0, list_js_1.list)({ - file: node_path_1.default.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - }); - p.end(); -}; -const addFilesAsync = async (p, files) => { - for (let i = 0; i < files.length; i++) { - const file = String(files[i]); - if (file.charAt(0) === '@') { - await (0, list_js_1.list)({ - file: node_path_1.default.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: entry => { - p.add(entry); - }, - }); - } - else { - p.add(file); - } - } - p.end(); -}; -const createSync = (opt, files) => { - const p = new pack_js_1.PackSync(opt); - addFilesSync(p, files); - return p; -}; -const createAsync = (opt, files) => { - const p = new pack_js_1.Pack(opt); - addFilesAsync(p, files); - return p; -}; -exports.create = (0, make_command_js_1.makeCommand)(createFileSync, createFile, createSync, createAsync, (_opt, files) => { - if (!files?.length) { - throw new TypeError('no paths specified to add to archive'); - } -}); -//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/cwd-error.js b/node_modules/pacote/node_modules/tar/dist/commonjs/cwd-error.js deleted file mode 100644 index d703a7772be3a..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/cwd-error.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CwdError = void 0; -class CwdError extends Error { - path; - code; - syscall = 'chdir'; - constructor(path, code) { - super(`${code}: Cannot cd into '${path}'`); - this.path = path; - this.code = code; - } - get name() { - return 'CwdError'; - } -} -exports.CwdError = CwdError; -//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/extract.js b/node_modules/pacote/node_modules/tar/dist/commonjs/extract.js deleted file mode 100644 index f848cbcbf779e..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/extract.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.extract = void 0; -// tar -x -const fsm = __importStar(require("@isaacs/fs-minipass")); -const node_fs_1 = __importDefault(require("node:fs")); -const list_js_1 = require("./list.js"); -const make_command_js_1 = require("./make-command.js"); -const unpack_js_1 = require("./unpack.js"); -const extractFileSync = (opt) => { - const u = new unpack_js_1.UnpackSync(opt); - const file = opt.file; - const stat = node_fs_1.default.statSync(file); - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const stream = new fsm.ReadStreamSync(file, { - readSize: readSize, - size: stat.size, - }); - stream.pipe(u); -}; -const extractFile = (opt, _) => { - const u = new unpack_js_1.Unpack(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve, reject) => { - u.on('error', reject); - u.on('close', resolve); - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - node_fs_1.default.stat(file, (er, stat) => { - if (er) { - reject(er); - } - else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }); - stream.on('error', reject); - stream.pipe(u); - } - }); - }); - return p; -}; -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) => { - if (files?.length) - (0, list_js_1.filesFilter)(opt, files); -}); -//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/get-write-flag.js b/node_modules/pacote/node_modules/tar/dist/commonjs/get-write-flag.js deleted file mode 100644 index 94add8f6b2231..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/get-write-flag.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -// Get the appropriate flag to use for creating files -// We use fmap on Windows platforms for files less than -// 512kb. This is a fairly low limit, but avoids making -// things slower in some cases. Since most of what this -// library is used for is extracting tarballs of many -// relatively small files in npm packages and the like, -// it can be a big boost on Windows platforms. -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getWriteFlag = void 0; -const fs_1 = __importDefault(require("fs")); -const platform = process.env.__FAKE_PLATFORM__ || process.platform; -const isWindows = platform === 'win32'; -/* c8 ignore start */ -const { O_CREAT, O_TRUNC, O_WRONLY } = fs_1.default.constants; -const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || - fs_1.default.constants.UV_FS_O_FILEMAP || - 0; -/* c8 ignore stop */ -const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; -const fMapLimit = 512 * 1024; -const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; -exports.getWriteFlag = !fMapEnabled ? - () => 'w' - : (size) => (size < fMapLimit ? fMapFlag : 'w'); -//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/header.js b/node_modules/pacote/node_modules/tar/dist/commonjs/header.js deleted file mode 100644 index b3a48037b849a..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/header.js +++ /dev/null @@ -1,306 +0,0 @@ -"use strict"; -// parse a 512-byte header block to a data object, or vice-versa -// encode returns `true` if a pax extended header is needed, because -// the data could not be faithfully encoded in a simple header. -// (Also, check header.needPax to see if it needs a pax header.) -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Header = void 0; -const node_path_1 = require("node:path"); -const large = __importStar(require("./large-numbers.js")); -const types = __importStar(require("./types.js")); -class Header { - cksumValid = false; - needPax = false; - nullBlock = false; - block; - path; - mode; - uid; - gid; - size; - cksum; - #type = 'Unsupported'; - linkpath; - uname; - gname; - devmaj = 0; - devmin = 0; - atime; - ctime; - mtime; - charset; - comment; - constructor(data, off = 0, ex, gex) { - if (Buffer.isBuffer(data)) { - this.decode(data, off || 0, ex, gex); - } - else if (data) { - this.#slurp(data); - } - } - decode(buf, off, ex, gex) { - if (!off) { - off = 0; - } - if (!buf || !(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header'); - } - this.path = decString(buf, off, 100); - this.mode = decNumber(buf, off + 100, 8); - this.uid = decNumber(buf, off + 108, 8); - this.gid = decNumber(buf, off + 116, 8); - this.size = decNumber(buf, off + 124, 12); - this.mtime = decDate(buf, off + 136, 12); - this.cksum = decNumber(buf, off + 148, 12); - // if we have extended or global extended headers, apply them now - // See https://github.com/npm/node-tar/pull/187 - // Apply global before local, so it overrides - if (gex) - this.#slurp(gex, true); - if (ex) - this.#slurp(ex); - // old tar versions marked dirs as a file with a trailing / - const t = decString(buf, off + 156, 1); - if (types.isCode(t)) { - this.#type = t || '0'; - } - if (this.#type === '0' && this.path.slice(-1) === '/') { - this.#type = '5'; - } - // tar implementations sometimes incorrectly put the stat(dir).size - // as the size in the tarball, even though Directory entries are - // not able to have any body at all. In the very rare chance that - // it actually DOES have a body, we weren't going to do anything with - // it anyway, and it'll just be a warning about an invalid header. - if (this.#type === '5') { - this.size = 0; - } - this.linkpath = decString(buf, off + 157, 100); - if (buf.subarray(off + 257, off + 265).toString() === - 'ustar\u000000') { - this.uname = decString(buf, off + 265, 32); - this.gname = decString(buf, off + 297, 32); - /* c8 ignore start */ - this.devmaj = decNumber(buf, off + 329, 8) ?? 0; - this.devmin = decNumber(buf, off + 337, 8) ?? 0; - /* c8 ignore stop */ - if (buf[off + 475] !== 0) { - // definitely a prefix, definitely >130 chars. - const prefix = decString(buf, off + 345, 155); - this.path = prefix + '/' + this.path; - } - else { - const prefix = decString(buf, off + 345, 130); - if (prefix) { - this.path = prefix + '/' + this.path; - } - this.atime = decDate(buf, off + 476, 12); - this.ctime = decDate(buf, off + 488, 12); - } - } - let sum = 8 * 0x20; - for (let i = off; i < off + 148; i++) { - sum += buf[i]; - } - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i]; - } - this.cksumValid = sum === this.cksum; - if (this.cksum === undefined && sum === 8 * 0x20) { - this.nullBlock = true; - } - } - #slurp(ex, gex = false) { - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. Also, any - // null/undefined values are ignored. - return !(v === null || - v === undefined || - (k === 'path' && gex) || - (k === 'linkpath' && gex) || - k === 'global'); - }))); - } - encode(buf, off = 0) { - if (!buf) { - buf = this.block = Buffer.alloc(512); - } - if (this.#type === 'Unsupported') { - this.#type = '0'; - } - if (!(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header'); - } - const prefixSize = this.ctime || this.atime ? 130 : 155; - const split = splitPrefix(this.path || '', prefixSize); - const path = split[0]; - const prefix = split[1]; - this.needPax = !!split[2]; - this.needPax = encString(buf, off, 100, path) || this.needPax; - this.needPax = - encNumber(buf, off + 100, 8, this.mode) || this.needPax; - this.needPax = - encNumber(buf, off + 108, 8, this.uid) || this.needPax; - this.needPax = - encNumber(buf, off + 116, 8, this.gid) || this.needPax; - this.needPax = - encNumber(buf, off + 124, 12, this.size) || this.needPax; - this.needPax = - encDate(buf, off + 136, 12, this.mtime) || this.needPax; - buf[off + 156] = this.#type.charCodeAt(0); - this.needPax = - encString(buf, off + 157, 100, this.linkpath) || this.needPax; - buf.write('ustar\u000000', off + 257, 8); - this.needPax = - encString(buf, off + 265, 32, this.uname) || this.needPax; - this.needPax = - encString(buf, off + 297, 32, this.gname) || this.needPax; - this.needPax = - encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; - this.needPax = - encNumber(buf, off + 337, 8, this.devmin) || this.needPax; - this.needPax = - encString(buf, off + 345, prefixSize, prefix) || this.needPax; - if (buf[off + 475] !== 0) { - this.needPax = - encString(buf, off + 345, 155, prefix) || this.needPax; - } - else { - this.needPax = - encString(buf, off + 345, 130, prefix) || this.needPax; - this.needPax = - encDate(buf, off + 476, 12, this.atime) || this.needPax; - this.needPax = - encDate(buf, off + 488, 12, this.ctime) || this.needPax; - } - let sum = 8 * 0x20; - for (let i = off; i < off + 148; i++) { - sum += buf[i]; - } - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i]; - } - this.cksum = sum; - encNumber(buf, off + 148, 8, this.cksum); - this.cksumValid = true; - return this.needPax; - } - get type() { - return (this.#type === 'Unsupported' ? - this.#type - : types.name.get(this.#type)); - } - get typeKey() { - return this.#type; - } - set type(type) { - const c = String(types.code.get(type)); - if (types.isCode(c) || c === 'Unsupported') { - this.#type = c; - } - else if (types.isCode(type)) { - this.#type = type; - } - else { - throw new TypeError('invalid entry type: ' + type); - } - } -} -exports.Header = Header; -const splitPrefix = (p, prefixSize) => { - const pathSize = 100; - let pp = p; - let prefix = ''; - let ret = undefined; - const root = node_path_1.posix.parse(p).root || '.'; - if (Buffer.byteLength(pp) < pathSize) { - ret = [pp, prefix, false]; - } - else { - // first set prefix to the dir, and path to the base - prefix = node_path_1.posix.dirname(pp); - pp = node_path_1.posix.basename(pp); - do { - if (Buffer.byteLength(pp) <= pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // both fit! - ret = [pp, prefix, false]; - } - else if (Buffer.byteLength(pp) > pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // prefix fits in prefix, but path doesn't fit in path - ret = [pp.slice(0, pathSize - 1), prefix, true]; - } - else { - // make path take a bit from prefix - pp = node_path_1.posix.join(node_path_1.posix.basename(prefix), pp); - prefix = node_path_1.posix.dirname(prefix); - } - } while (prefix !== root && ret === undefined); - // at this point, found no resolution, just truncate - if (!ret) { - ret = [p.slice(0, pathSize - 1), '', true]; - } - } - return ret; -}; -const decString = (buf, off, size) => buf - .subarray(off, off + size) - .toString('utf8') - .replace(/\0.*/, ''); -const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); -const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); -const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? - large.parse(buf.subarray(off, off + size)) - : decSmallNumber(buf, off, size); -const nanUndef = (value) => (isNaN(value) ? undefined : value); -const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf - .subarray(off, off + size) - .toString('utf8') - .replace(/\0.*$/, '') - .trim(), 8)); -// the maximum encodable as a null-terminated octal, by field size -const MAXNUM = { - 12: 0o77777777777, - 8: 0o7777777, -}; -const encNumber = (buf, off, size, num) => num === undefined ? false - : num > MAXNUM[size] || num < 0 ? - (large.encode(num, buf.subarray(off, off + size)), true) - : (encSmallNumber(buf, off, size, num), false); -const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); -const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); -const padOctal = (str, size) => (str.length === size - 1 ? - str - : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; -const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); -// enough to fill the longest string we've got -const NULLS = new Array(156).join('\0'); -// pad with nulls, return true if it's longer or non-ascii -const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), - str.length !== Buffer.byteLength(str) || str.length > size)); -//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/index.js b/node_modules/pacote/node_modules/tar/dist/commonjs/index.js deleted file mode 100644 index e93ed5ad54aa6..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/index.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.u = exports.types = exports.r = exports.t = exports.x = exports.c = void 0; -__exportStar(require("./create.js"), exports); -var create_js_1 = require("./create.js"); -Object.defineProperty(exports, "c", { enumerable: true, get: function () { return create_js_1.create; } }); -__exportStar(require("./extract.js"), exports); -var extract_js_1 = require("./extract.js"); -Object.defineProperty(exports, "x", { enumerable: true, get: function () { return extract_js_1.extract; } }); -__exportStar(require("./header.js"), exports); -__exportStar(require("./list.js"), exports); -var list_js_1 = require("./list.js"); -Object.defineProperty(exports, "t", { enumerable: true, get: function () { return list_js_1.list; } }); -// classes -__exportStar(require("./pack.js"), exports); -__exportStar(require("./parse.js"), exports); -__exportStar(require("./pax.js"), exports); -__exportStar(require("./read-entry.js"), exports); -__exportStar(require("./replace.js"), exports); -var replace_js_1 = require("./replace.js"); -Object.defineProperty(exports, "r", { enumerable: true, get: function () { return replace_js_1.replace; } }); -exports.types = __importStar(require("./types.js")); -__exportStar(require("./unpack.js"), exports); -__exportStar(require("./update.js"), exports); -var update_js_1 = require("./update.js"); -Object.defineProperty(exports, "u", { enumerable: true, get: function () { return update_js_1.update; } }); -__exportStar(require("./write-entry.js"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/large-numbers.js b/node_modules/pacote/node_modules/tar/dist/commonjs/large-numbers.js deleted file mode 100644 index 5b07aa7f71b48..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/large-numbers.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -// Tar can encode large and negative numbers using a leading byte of -// 0xff for negative, and 0x80 for positive. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parse = exports.encode = void 0; -const encode = (num, buf) => { - if (!Number.isSafeInteger(num)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('cannot encode number outside of javascript safe integer range'); - } - else if (num < 0) { - encodeNegative(num, buf); - } - else { - encodePositive(num, buf); - } - return buf; -}; -exports.encode = encode; -const encodePositive = (num, buf) => { - buf[0] = 0x80; - for (var i = buf.length; i > 1; i--) { - buf[i - 1] = num & 0xff; - num = Math.floor(num / 0x100); - } -}; -const encodeNegative = (num, buf) => { - buf[0] = 0xff; - var flipped = false; - num = num * -1; - for (var i = buf.length; i > 1; i--) { - var byte = num & 0xff; - num = Math.floor(num / 0x100); - if (flipped) { - buf[i - 1] = onesComp(byte); - } - else if (byte === 0) { - buf[i - 1] = 0; - } - else { - flipped = true; - buf[i - 1] = twosComp(byte); - } - } -}; -const parse = (buf) => { - const pre = buf[0]; - const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) - : pre === 0xff ? twos(buf) - : null; - if (value === null) { - throw Error('invalid base256 encoding'); - } - if (!Number.isSafeInteger(value)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('parsed number outside of javascript safe integer range'); - } - return value; -}; -exports.parse = parse; -const twos = (buf) => { - var len = buf.length; - var sum = 0; - var flipped = false; - for (var i = len - 1; i > -1; i--) { - var byte = Number(buf[i]); - var f; - if (flipped) { - f = onesComp(byte); - } - else if (byte === 0) { - f = byte; - } - else { - flipped = true; - f = twosComp(byte); - } - if (f !== 0) { - sum -= f * Math.pow(256, len - i - 1); - } - } - return sum; -}; -const pos = (buf) => { - var len = buf.length; - var sum = 0; - for (var i = len - 1; i > -1; i--) { - var byte = Number(buf[i]); - if (byte !== 0) { - sum += byte * Math.pow(256, len - i - 1); - } - } - return sum; -}; -const onesComp = (byte) => (0xff ^ byte) & 0xff; -const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; -//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/make-command.js b/node_modules/pacote/node_modules/tar/dist/commonjs/make-command.js deleted file mode 100644 index 1814319e78bc6..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/make-command.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.makeCommand = void 0; -const options_js_1 = require("./options.js"); -const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { - return Object.assign((opt_ = [], entries, cb) => { - if (Array.isArray(opt_)) { - entries = opt_; - opt_ = {}; - } - if (typeof entries === 'function') { - cb = entries; - entries = undefined; - } - if (!entries) { - entries = []; - } - else { - entries = Array.from(entries); - } - const opt = (0, options_js_1.dealias)(opt_); - validate?.(opt, entries); - if ((0, options_js_1.isSyncFile)(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions'); - } - return syncFile(opt, entries); - } - else if ((0, options_js_1.isAsyncFile)(opt)) { - const p = asyncFile(opt, entries); - // weirdness to make TS happy - const c = cb ? cb : undefined; - return c ? p.then(() => c(), c) : p; - } - else if ((0, options_js_1.isSyncNoFile)(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions'); - } - return syncNoFile(opt, entries); - } - else if ((0, options_js_1.isAsyncNoFile)(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback only supported with file option'); - } - return asyncNoFile(opt, entries); - /* c8 ignore start */ - } - else { - throw new Error('impossible options??'); - } - /* c8 ignore stop */ - }, { - syncFile, - asyncFile, - syncNoFile, - asyncNoFile, - validate, - }); -}; -exports.makeCommand = makeCommand; -//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/mode-fix.js b/node_modules/pacote/node_modules/tar/dist/commonjs/mode-fix.js deleted file mode 100644 index 49dd727961d29..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/mode-fix.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.modeFix = void 0; -const modeFix = (mode, isDir, portable) => { - mode &= 0o7777; - // in portable mode, use the minimum reasonable umask - // if this system creates files with 0o664 by default - // (as some linux distros do), then we'll write the - // archive with 0o644 instead. Also, don't ever create - // a file that is not readable/writable by the owner. - if (portable) { - mode = (mode | 0o600) & ~0o22; - } - // if dirs are readable, then they should be listable - if (isDir) { - if (mode & 0o400) { - mode |= 0o100; - } - if (mode & 0o40) { - mode |= 0o10; - } - if (mode & 0o4) { - mode |= 0o1; - } - } - return mode; -}; -exports.modeFix = modeFix; -//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/normalize-windows-path.js b/node_modules/pacote/node_modules/tar/dist/commonjs/normalize-windows-path.js deleted file mode 100644 index b0c7aaa9f2d17..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/normalize-windows-path.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -// on windows, either \ or / are valid directory separators. -// on unix, \ is a valid character in filenames. -// so, on windows, and only on windows, we replace all \ chars with /, -// so that we can use / as our one and only directory separator char. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.normalizeWindowsPath = void 0; -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -exports.normalizeWindowsPath = platform !== 'win32' ? - (p) => p - : (p) => p && p.replace(/\\/g, '/'); -//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/options.js b/node_modules/pacote/node_modules/tar/dist/commonjs/options.js deleted file mode 100644 index 4cd06505bc72b..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/options.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -// turn tar(1) style args like `C` into the more verbose things like `cwd` -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dealias = exports.isNoFile = exports.isFile = exports.isAsync = exports.isSync = exports.isAsyncNoFile = exports.isSyncNoFile = exports.isAsyncFile = exports.isSyncFile = void 0; -const argmap = new Map([ - ['C', 'cwd'], - ['f', 'file'], - ['z', 'gzip'], - ['P', 'preservePaths'], - ['U', 'unlink'], - ['strip-components', 'strip'], - ['stripComponents', 'strip'], - ['keep-newer', 'newer'], - ['keepNewer', 'newer'], - ['keep-newer-files', 'newer'], - ['keepNewerFiles', 'newer'], - ['k', 'keep'], - ['keep-existing', 'keep'], - ['keepExisting', 'keep'], - ['m', 'noMtime'], - ['no-mtime', 'noMtime'], - ['p', 'preserveOwner'], - ['L', 'follow'], - ['h', 'follow'], - ['onentry', 'onReadEntry'], -]); -const isSyncFile = (o) => !!o.sync && !!o.file; -exports.isSyncFile = isSyncFile; -const isAsyncFile = (o) => !o.sync && !!o.file; -exports.isAsyncFile = isAsyncFile; -const isSyncNoFile = (o) => !!o.sync && !o.file; -exports.isSyncNoFile = isSyncNoFile; -const isAsyncNoFile = (o) => !o.sync && !o.file; -exports.isAsyncNoFile = isAsyncNoFile; -const isSync = (o) => !!o.sync; -exports.isSync = isSync; -const isAsync = (o) => !o.sync; -exports.isAsync = isAsync; -const isFile = (o) => !!o.file; -exports.isFile = isFile; -const isNoFile = (o) => !o.file; -exports.isNoFile = isNoFile; -const dealiasKey = (k) => { - const d = argmap.get(k); - if (d) - return d; - return k; -}; -const dealias = (opt = {}) => { - if (!opt) - return {}; - const result = {}; - for (const [key, v] of Object.entries(opt)) { - // TS doesn't know that aliases are going to always be the same type - const k = dealiasKey(key); - result[k] = v; - } - // affordance for deprecated noChmod -> chmod - if (result.chmod === undefined && result.noChmod === false) { - result.chmod = true; - } - delete result.noChmod; - return result; -}; -exports.dealias = dealias; -//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/pack.js b/node_modules/pacote/node_modules/tar/dist/commonjs/pack.js deleted file mode 100644 index 303e93063c2db..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/pack.js +++ /dev/null @@ -1,477 +0,0 @@ -"use strict"; -// A readable tar stream creator -// Technically, this is a transform stream that you write paths into, -// and tar format comes out of. -// The `add()` method is like `write()` but returns this, -// and end() return `this` as well, so you can -// do `new Pack(opt).add('files').add('dir').end().pipe(output) -// You could also do something like: -// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PackSync = exports.Pack = exports.PackJob = void 0; -const fs_1 = __importDefault(require("fs")); -const write_entry_js_1 = require("./write-entry.js"); -class PackJob { - path; - absolute; - entry; - stat; - readdir; - pending = false; - ignore = false; - piped = false; - constructor(path, absolute) { - this.path = path || './'; - this.absolute = absolute; - } -} -exports.PackJob = PackJob; -const minipass_1 = require("minipass"); -const zlib = __importStar(require("minizlib")); -const yallist_1 = require("yallist"); -const read_entry_js_1 = require("./read-entry.js"); -const warn_method_js_1 = require("./warn-method.js"); -const EOF = Buffer.alloc(1024); -const ONSTAT = Symbol('onStat'); -const ENDED = Symbol('ended'); -const QUEUE = Symbol('queue'); -const CURRENT = Symbol('current'); -const PROCESS = Symbol('process'); -const PROCESSING = Symbol('processing'); -const PROCESSJOB = Symbol('processJob'); -const JOBS = Symbol('jobs'); -const JOBDONE = Symbol('jobDone'); -const ADDFSENTRY = Symbol('addFSEntry'); -const ADDTARENTRY = Symbol('addTarEntry'); -const STAT = Symbol('stat'); -const READDIR = Symbol('readdir'); -const ONREADDIR = Symbol('onreaddir'); -const PIPE = Symbol('pipe'); -const ENTRY = Symbol('entry'); -const ENTRYOPT = Symbol('entryOpt'); -const WRITEENTRYCLASS = Symbol('writeEntryClass'); -const WRITE = Symbol('write'); -const ONDRAIN = Symbol('ondrain'); -const path_1 = __importDefault(require("path")); -const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); -class Pack extends minipass_1.Minipass { - opt; - cwd; - maxReadSize; - preservePaths; - strict; - noPax; - prefix; - linkCache; - statCache; - file; - portable; - zip; - readdirCache; - noDirRecurse; - follow; - noMtime; - mtime; - filter; - jobs; - [WRITEENTRYCLASS]; - onWriteEntry; - [QUEUE]; - [JOBS] = 0; - [PROCESSING] = false; - [ENDED] = false; - constructor(opt = {}) { - //@ts-ignore - super(); - this.opt = opt; - this.file = opt.file || ''; - this.cwd = opt.cwd || process.cwd(); - this.maxReadSize = opt.maxReadSize; - this.preservePaths = !!opt.preservePaths; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.prefix = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix || ''); - this.linkCache = opt.linkCache || new Map(); - this.statCache = opt.statCache || new Map(); - this.readdirCache = opt.readdirCache || new Map(); - this.onWriteEntry = opt.onWriteEntry; - this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntry; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - this.portable = !!opt.portable; - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError('gzip and brotli are mutually exclusive'); - } - if (opt.gzip) { - if (typeof opt.gzip !== 'object') { - opt.gzip = {}; - } - if (this.portable) { - opt.gzip.portable = true; - } - this.zip = new zlib.Gzip(opt.gzip); - } - if (opt.brotli) { - if (typeof opt.brotli !== 'object') { - opt.brotli = {}; - } - this.zip = new zlib.BrotliCompress(opt.brotli); - } - /* c8 ignore next */ - if (!this.zip) - throw new Error('impossible'); - const zip = this.zip; - zip.on('data', chunk => super.write(chunk)); - zip.on('end', () => super.end()); - zip.on('drain', () => this[ONDRAIN]()); - this.on('resume', () => zip.resume()); - } - else { - this.on('drain', this[ONDRAIN]); - } - this.noDirRecurse = !!opt.noDirRecurse; - this.follow = !!opt.follow; - this.noMtime = !!opt.noMtime; - if (opt.mtime) - this.mtime = opt.mtime; - this.filter = - typeof opt.filter === 'function' ? opt.filter : () => true; - this[QUEUE] = new yallist_1.Yallist(); - this[JOBS] = 0; - this.jobs = Number(opt.jobs) || 4; - this[PROCESSING] = false; - this[ENDED] = false; - } - [WRITE](chunk) { - return super.write(chunk); - } - add(path) { - this.write(path); - return this; - } - end(path, encoding, cb) { - /* c8 ignore start */ - if (typeof path === 'function') { - cb = path; - path = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - /* c8 ignore stop */ - if (path) { - this.add(path); - } - this[ENDED] = true; - this[PROCESS](); - /* c8 ignore next */ - if (cb) - cb(); - return this; - } - write(path) { - if (this[ENDED]) { - throw new Error('write after end'); - } - if (path instanceof read_entry_js_1.ReadEntry) { - this[ADDTARENTRY](path); - } - else { - this[ADDFSENTRY](path); - } - return this.flowing; - } - [ADDTARENTRY](p) { - const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p.path)); - // in this case, we don't have to wait for the stat - if (!this.filter(p.path, p)) { - p.resume(); - } - else { - const job = new PackJob(p.path, absolute); - job.entry = new write_entry_js_1.WriteEntryTar(p, this[ENTRYOPT](job)); - job.entry.on('end', () => this[JOBDONE](job)); - this[JOBS] += 1; - this[QUEUE].push(job); - } - this[PROCESS](); - } - [ADDFSENTRY](p) { - const absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.resolve(this.cwd, p)); - this[QUEUE].push(new PackJob(p, absolute)); - this[PROCESS](); - } - [STAT](job) { - job.pending = true; - this[JOBS] += 1; - const stat = this.follow ? 'stat' : 'lstat'; - fs_1.default[stat](job.absolute, (er, stat) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - this.emit('error', er); - } - else { - this[ONSTAT](job, stat); - } - }); - } - [ONSTAT](job, stat) { - this.statCache.set(job.absolute, stat); - job.stat = stat; - // now we have the stat, we can filter it. - if (!this.filter(job.path, stat)) { - job.ignore = true; - } - this[PROCESS](); - } - [READDIR](job) { - job.pending = true; - this[JOBS] += 1; - fs_1.default.readdir(job.absolute, (er, entries) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - return this.emit('error', er); - } - this[ONREADDIR](job, entries); - }); - } - [ONREADDIR](job, entries) { - this.readdirCache.set(job.absolute, entries); - job.readdir = entries; - this[PROCESS](); - } - [PROCESS]() { - if (this[PROCESSING]) { - return; - } - this[PROCESSING] = true; - for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { - this[PROCESSJOB](w.value); - if (w.value.ignore) { - const p = w.next; - this[QUEUE].removeNode(w); - w.next = p; - } - } - this[PROCESSING] = false; - if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { - if (this.zip) { - this.zip.end(EOF); - } - else { - super.write(EOF); - super.end(); - } - } - } - get [CURRENT]() { - return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; - } - [JOBDONE](_job) { - this[QUEUE].shift(); - this[JOBS] -= 1; - this[PROCESS](); - } - [PROCESSJOB](job) { - if (job.pending) { - return; - } - if (job.entry) { - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - return; - } - if (!job.stat) { - const sc = this.statCache.get(job.absolute); - if (sc) { - this[ONSTAT](job, sc); - } - else { - this[STAT](job); - } - } - if (!job.stat) { - return; - } - // filtered out! - if (job.ignore) { - return; - } - if (!this.noDirRecurse && - job.stat.isDirectory() && - !job.readdir) { - const rc = this.readdirCache.get(job.absolute); - if (rc) { - this[ONREADDIR](job, rc); - } - else { - this[READDIR](job); - } - if (!job.readdir) { - return; - } - } - // we know it doesn't have an entry, because that got checked above - job.entry = this[ENTRY](job); - if (!job.entry) { - job.ignore = true; - return; - } - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - } - [ENTRYOPT](job) { - return { - onwarn: (code, msg, data) => this.warn(code, msg, data), - noPax: this.noPax, - cwd: this.cwd, - absolute: job.absolute, - preservePaths: this.preservePaths, - maxReadSize: this.maxReadSize, - strict: this.strict, - portable: this.portable, - linkCache: this.linkCache, - statCache: this.statCache, - noMtime: this.noMtime, - mtime: this.mtime, - prefix: this.prefix, - onWriteEntry: this.onWriteEntry, - }; - } - [ENTRY](job) { - this[JOBS] += 1; - try { - const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); - return e - .on('end', () => this[JOBDONE](job)) - .on('error', er => this.emit('error', er)); - } - catch (er) { - this.emit('error', er); - } - } - [ONDRAIN]() { - if (this[CURRENT] && this[CURRENT].entry) { - this[CURRENT].entry.resume(); - } - } - // like .pipe() but using super, because our write() is special - [PIPE](job) { - job.piped = true; - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path; - const base = p === './' ? '' : p.replace(/\/*$/, '/'); - this[ADDFSENTRY](base + entry); - }); - } - const source = job.entry; - const zip = this.zip; - /* c8 ignore start */ - if (!source) - throw new Error('cannot pipe without source'); - /* c8 ignore stop */ - if (zip) { - source.on('data', chunk => { - if (!zip.write(chunk)) { - source.pause(); - } - }); - } - else { - source.on('data', chunk => { - if (!super.write(chunk)) { - source.pause(); - } - }); - } - } - pause() { - if (this.zip) { - this.zip.pause(); - } - return super.pause(); - } - warn(code, message, data = {}) { - (0, warn_method_js_1.warnMethod)(this, code, message, data); - } -} -exports.Pack = Pack; -class PackSync extends Pack { - sync = true; - constructor(opt) { - super(opt); - this[WRITEENTRYCLASS] = write_entry_js_1.WriteEntrySync; - } - // pause/resume are no-ops in sync streams. - pause() { } - resume() { } - [STAT](job) { - const stat = this.follow ? 'statSync' : 'lstatSync'; - this[ONSTAT](job, fs_1.default[stat](job.absolute)); - } - [READDIR](job) { - this[ONREADDIR](job, fs_1.default.readdirSync(job.absolute)); - } - // gotta get it all in this tick - [PIPE](job) { - const source = job.entry; - const zip = this.zip; - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path; - const base = p === './' ? '' : p.replace(/\/*$/, '/'); - this[ADDFSENTRY](base + entry); - }); - } - /* c8 ignore start */ - if (!source) - throw new Error('Cannot pipe without source'); - /* c8 ignore stop */ - if (zip) { - source.on('data', chunk => { - zip.write(chunk); - }); - } - else { - source.on('data', chunk => { - super[WRITE](chunk); - }); - } - } -} -exports.PackSync = PackSync; -//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/package.json b/node_modules/pacote/node_modules/tar/dist/commonjs/package.json deleted file mode 100644 index 5bbefffbabee3..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/path-reservations.js b/node_modules/pacote/node_modules/tar/dist/commonjs/path-reservations.js deleted file mode 100644 index 9ff391c44092c..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/path-reservations.js +++ /dev/null @@ -1,170 +0,0 @@ -"use strict"; -// A path exclusive reservation system -// reserve([list, of, paths], fn) -// When the fn is first in line for all its paths, it -// is called with a cb that clears the reservation. -// -// Used by async unpack to avoid clobbering paths in use, -// while still allowing maximal safe parallelization. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PathReservations = void 0; -const node_path_1 = require("node:path"); -const normalize_unicode_js_1 = require("./normalize-unicode.js"); -const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -const isWindows = platform === 'win32'; -// return a set of parent dirs for a given path -// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] -const getDirs = (path) => { - const dirs = path - .split('/') - .slice(0, -1) - .reduce((set, path) => { - const s = set[set.length - 1]; - if (s !== undefined) { - path = (0, node_path_1.join)(s, path); - } - set.push(path || '/'); - return set; - }, []); - return dirs; -}; -class PathReservations { - // path => [function or Set] - // A Set object means a directory reservation - // A fn is a direct reservation on that path - #queues = new Map(); - // fn => {paths:[path,...], dirs:[path, ...]} - #reservations = new Map(); - // functions currently running - #running = new Set(); - reserve(paths, fn) { - paths = - isWindows ? - ['win32 parallelization disabled'] - : paths.map(p => { - // don't need normPath, because we skip this entirely for windows - return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, node_path_1.join)((0, normalize_unicode_js_1.normalizeUnicode)(p))).toLowerCase(); - }); - const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); - this.#reservations.set(fn, { dirs, paths }); - for (const p of paths) { - const q = this.#queues.get(p); - if (!q) { - this.#queues.set(p, [fn]); - } - else { - q.push(fn); - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - if (!q) { - this.#queues.set(dir, [new Set([fn])]); - } - else { - const l = q[q.length - 1]; - if (l instanceof Set) { - l.add(fn); - } - else { - q.push(new Set([fn])); - } - } - } - return this.#run(fn); - } - // return the queues for each path the function cares about - // fn => {paths, dirs} - #getQueues(fn) { - const res = this.#reservations.get(fn); - /* c8 ignore start */ - if (!res) { - throw new Error('function does not have any path reservations'); - } - /* c8 ignore stop */ - return { - paths: res.paths.map((path) => this.#queues.get(path)), - dirs: [...res.dirs].map(path => this.#queues.get(path)), - }; - } - // check if fn is first in line for all its paths, and is - // included in the first set for all its dir queues - check(fn) { - const { paths, dirs } = this.#getQueues(fn); - return (paths.every(q => q && q[0] === fn) && - dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); - } - // run the function if it's first in line and not already running - #run(fn) { - if (this.#running.has(fn) || !this.check(fn)) { - return false; - } - this.#running.add(fn); - fn(() => this.#clear(fn)); - return true; - } - #clear(fn) { - if (!this.#running.has(fn)) { - return false; - } - const res = this.#reservations.get(fn); - /* c8 ignore start */ - if (!res) { - throw new Error('invalid reservation'); - } - /* c8 ignore stop */ - const { paths, dirs } = res; - const next = new Set(); - for (const path of paths) { - const q = this.#queues.get(path); - /* c8 ignore start */ - if (!q || q?.[0] !== fn) { - continue; - } - /* c8 ignore stop */ - const q0 = q[1]; - if (!q0) { - this.#queues.delete(path); - continue; - } - q.shift(); - if (typeof q0 === 'function') { - next.add(q0); - } - else { - for (const f of q0) { - next.add(f); - } - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - const q0 = q?.[0]; - /* c8 ignore next - type safety only */ - if (!q || !(q0 instanceof Set)) - continue; - if (q0.size === 1 && q.length === 1) { - this.#queues.delete(dir); - continue; - } - else if (q0.size === 1) { - q.shift(); - // next one must be a function, - // or else the Set would've been reused - const n = q[0]; - if (typeof n === 'function') { - next.add(n); - } - } - else { - q0.delete(fn); - } - } - this.#running.delete(fn); - next.forEach(fn => this.#run(fn)); - return true; - } -} -exports.PathReservations = PathReservations; -//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/pax.js b/node_modules/pacote/node_modules/tar/dist/commonjs/pax.js deleted file mode 100644 index d30c0f3efbe9e..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/pax.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Pax = void 0; -const node_path_1 = require("node:path"); -const header_js_1 = require("./header.js"); -class Pax { - atime; - mtime; - ctime; - charset; - comment; - gid; - uid; - gname; - uname; - linkpath; - dev; - ino; - nlink; - path; - size; - mode; - global; - constructor(obj, global = false) { - this.atime = obj.atime; - this.charset = obj.charset; - this.comment = obj.comment; - this.ctime = obj.ctime; - this.dev = obj.dev; - this.gid = obj.gid; - this.global = global; - this.gname = obj.gname; - this.ino = obj.ino; - this.linkpath = obj.linkpath; - this.mtime = obj.mtime; - this.nlink = obj.nlink; - this.path = obj.path; - this.size = obj.size; - this.uid = obj.uid; - this.uname = obj.uname; - } - encode() { - const body = this.encodeBody(); - if (body === '') { - return Buffer.allocUnsafe(0); - } - const bodyLen = Buffer.byteLength(body); - // round up to 512 bytes - // add 512 for header - const bufLen = 512 * Math.ceil(1 + bodyLen / 512); - const buf = Buffer.allocUnsafe(bufLen); - // 0-fill the header section, it might not hit every field - for (let i = 0; i < 512; i++) { - buf[i] = 0; - } - new header_js_1.Header({ - // XXX split the path - // then the path should be PaxHeader + basename, but less than 99, - // prepend with the dirname - /* c8 ignore start */ - path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99), - /* c8 ignore stop */ - mode: this.mode || 0o644, - uid: this.uid, - gid: this.gid, - size: bodyLen, - mtime: this.mtime, - type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', - linkpath: '', - uname: this.uname || '', - gname: this.gname || '', - devmaj: 0, - devmin: 0, - atime: this.atime, - ctime: this.ctime, - }).encode(buf); - buf.write(body, 512, bodyLen, 'utf8'); - // null pad after the body - for (let i = bodyLen + 512; i < buf.length; i++) { - buf[i] = 0; - } - return buf; - } - encodeBody() { - return (this.encodeField('path') + - this.encodeField('ctime') + - this.encodeField('atime') + - this.encodeField('dev') + - this.encodeField('ino') + - this.encodeField('nlink') + - this.encodeField('charset') + - this.encodeField('comment') + - this.encodeField('gid') + - this.encodeField('gname') + - this.encodeField('linkpath') + - this.encodeField('mtime') + - this.encodeField('size') + - this.encodeField('uid') + - this.encodeField('uname')); - } - encodeField(field) { - if (this[field] === undefined) { - return ''; - } - const r = this[field]; - const v = r instanceof Date ? r.getTime() / 1000 : r; - const s = ' ' + - (field === 'dev' || field === 'ino' || field === 'nlink' ? - 'SCHILY.' - : '') + - field + - '=' + - v + - '\n'; - const byteLen = Buffer.byteLength(s); - // the digits includes the length of the digits in ascii base-10 - // so if it's 9 characters, then adding 1 for the 9 makes it 10 - // which makes it 11 chars. - let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; - if (byteLen + digits >= Math.pow(10, digits)) { - digits += 1; - } - const len = digits + byteLen; - return len + s; - } - static parse(str, ex, g = false) { - return new Pax(merge(parseKV(str), ex), g); - } -} -exports.Pax = Pax; -const merge = (a, b) => b ? Object.assign({}, b, a) : a; -const parseKV = (str) => str - .replace(/\n$/, '') - .split('\n') - .reduce(parseKVLine, Object.create(null)); -const parseKVLine = (set, line) => { - const n = parseInt(line, 10); - // XXX Values with \n in them will fail this. - // Refactor to not be a naive line-by-line parse. - if (n !== Buffer.byteLength(line) + 1) { - return set; - } - line = line.slice((n + ' ').length); - const kv = line.split('='); - const r = kv.shift(); - if (!r) { - return set; - } - const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); - const v = kv.join('='); - set[k] = - /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? - new Date(Number(v) * 1000) - : /^[0-9]+$/.test(v) ? +v - : v; - return set; -}; -//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/read-entry.js b/node_modules/pacote/node_modules/tar/dist/commonjs/read-entry.js deleted file mode 100644 index 15e2d55c938a4..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/read-entry.js +++ /dev/null @@ -1,140 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReadEntry = void 0; -const minipass_1 = require("minipass"); -const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); -class ReadEntry extends minipass_1.Minipass { - extended; - globalExtended; - header; - startBlockSize; - blockRemain; - remain; - type; - meta = false; - ignore = false; - path; - mode; - uid; - gid; - uname; - gname; - size = 0; - mtime; - atime; - ctime; - linkpath; - dev; - ino; - nlink; - invalid = false; - absolute; - unsupported = false; - constructor(header, ex, gex) { - super({}); - // read entries always start life paused. this is to avoid the - // situation where Minipass's auto-ending empty streams results - // in an entry ending before we're ready for it. - this.pause(); - this.extended = ex; - this.globalExtended = gex; - this.header = header; - /* c8 ignore start */ - this.remain = header.size ?? 0; - /* c8 ignore stop */ - this.startBlockSize = 512 * Math.ceil(this.remain / 512); - this.blockRemain = this.startBlockSize; - this.type = header.type; - switch (this.type) { - case 'File': - case 'OldFile': - case 'Link': - case 'SymbolicLink': - case 'CharacterDevice': - case 'BlockDevice': - case 'Directory': - case 'FIFO': - case 'ContiguousFile': - case 'GNUDumpDir': - break; - case 'NextFileHasLongLinkpath': - case 'NextFileHasLongPath': - case 'OldGnuLongPath': - case 'GlobalExtendedHeader': - case 'ExtendedHeader': - case 'OldExtendedHeader': - this.meta = true; - break; - // NOTE: gnutar and bsdtar treat unrecognized types as 'File' - // it may be worth doing the same, but with a warning. - default: - this.ignore = true; - } - /* c8 ignore start */ - if (!header.path) { - throw new Error('no path provided for tar.ReadEntry'); - } - /* c8 ignore stop */ - this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.path); - this.mode = header.mode; - if (this.mode) { - this.mode = this.mode & 0o7777; - } - this.uid = header.uid; - this.gid = header.gid; - this.uname = header.uname; - this.gname = header.gname; - this.size = this.remain; - this.mtime = header.mtime; - this.atime = header.atime; - this.ctime = header.ctime; - /* c8 ignore start */ - this.linkpath = - header.linkpath ? - (0, normalize_windows_path_js_1.normalizeWindowsPath)(header.linkpath) - : undefined; - /* c8 ignore stop */ - this.uname = header.uname; - this.gname = header.gname; - if (ex) { - this.#slurp(ex); - } - if (gex) { - this.#slurp(gex, true); - } - } - write(data) { - const writeLen = data.length; - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate'); - } - const r = this.remain; - const br = this.blockRemain; - this.remain = Math.max(0, r - writeLen); - this.blockRemain = Math.max(0, br - writeLen); - if (this.ignore) { - return true; - } - if (r >= writeLen) { - return super.write(data); - } - // r < writeLen - return super.write(data.subarray(0, r)); - } - #slurp(ex, gex = false) { - if (ex.path) - ex.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.path); - if (ex.linkpath) - ex.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(ex.linkpath); - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. Also, any - // null/undefined values are ignored. - return !(v === null || - v === undefined || - (k === 'path' && gex)); - }))); - } -} -exports.ReadEntry = ReadEntry; -//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/strip-absolute-path.js b/node_modules/pacote/node_modules/tar/dist/commonjs/strip-absolute-path.js deleted file mode 100644 index bb7639c35a110..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/strip-absolute-path.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stripAbsolutePath = void 0; -// unix absolute paths are also absolute on win32, so we use this for both -const node_path_1 = require("node:path"); -const { isAbsolute, parse } = node_path_1.win32; -// returns [root, stripped] -// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in -// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / -// explicitly if it's the first character. -// drive-specific relative paths on Windows get their root stripped off even -// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] -const stripAbsolutePath = (path) => { - let r = ''; - let parsed = parse(path); - while (isAbsolute(path) || parsed.root) { - // windows will think that //x/y/z has a "root" of //x/y/ - // but strip the //?/C:/ off of //?/C:/path - const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? - '/' - : parsed.root; - path = path.slice(root.length); - r += root; - parsed = parse(path); - } - return [r, path]; -}; -exports.stripAbsolutePath = stripAbsolutePath; -//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/strip-trailing-slashes.js b/node_modules/pacote/node_modules/tar/dist/commonjs/strip-trailing-slashes.js deleted file mode 100644 index 6fa74ad6a4ac9..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stripTrailingSlashes = void 0; -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -const stripTrailingSlashes = (str) => { - let i = str.length - 1; - let slashesStart = -1; - while (i > -1 && str.charAt(i) === '/') { - slashesStart = i; - i--; - } - return slashesStart === -1 ? str : str.slice(0, slashesStart); -}; -exports.stripTrailingSlashes = stripTrailingSlashes; -//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/symlink-error.js b/node_modules/pacote/node_modules/tar/dist/commonjs/symlink-error.js deleted file mode 100644 index cc19ac1a2e3c6..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/symlink-error.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SymlinkError = void 0; -class SymlinkError extends Error { - path; - symlink; - syscall = 'symlink'; - code = 'TAR_SYMLINK_ERROR'; - constructor(symlink, path) { - super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); - this.symlink = symlink; - this.path = path; - } - get name() { - return 'SymlinkError'; - } -} -exports.SymlinkError = SymlinkError; -//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/types.js b/node_modules/pacote/node_modules/tar/dist/commonjs/types.js deleted file mode 100644 index cb9b684e843b7..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/types.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.code = exports.name = exports.isName = exports.isCode = void 0; -const isCode = (c) => exports.name.has(c); -exports.isCode = isCode; -const isName = (c) => exports.code.has(c); -exports.isName = isName; -// map types from key to human-friendly name -exports.name = new Map([ - ['0', 'File'], - // same as File - ['', 'OldFile'], - ['1', 'Link'], - ['2', 'SymbolicLink'], - // Devices and FIFOs aren't fully supported - // they are parsed, but skipped when unpacking - ['3', 'CharacterDevice'], - ['4', 'BlockDevice'], - ['5', 'Directory'], - ['6', 'FIFO'], - // same as File - ['7', 'ContiguousFile'], - // pax headers - ['g', 'GlobalExtendedHeader'], - ['x', 'ExtendedHeader'], - // vendor-specific stuff - // skip - ['A', 'SolarisACL'], - // like 5, but with data, which should be skipped - ['D', 'GNUDumpDir'], - // metadata only, skip - ['I', 'Inode'], - // data = link path of next file - ['K', 'NextFileHasLongLinkpath'], - // data = path of next file - ['L', 'NextFileHasLongPath'], - // skip - ['M', 'ContinuationFile'], - // like L - ['N', 'OldGnuLongPath'], - // skip - ['S', 'SparseFile'], - // skip - ['V', 'TapeVolumeHeader'], - // like x - ['X', 'OldExtendedHeader'], -]); -// map the other direction -exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/update.js b/node_modules/pacote/node_modules/tar/dist/commonjs/update.js deleted file mode 100644 index 7687896f4bfee..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/update.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -// tar -u -Object.defineProperty(exports, "__esModule", { value: true }); -exports.update = void 0; -const make_command_js_1 = require("./make-command.js"); -const replace_js_1 = require("./replace.js"); -// just call tar.r with the filter and mtimeCache -exports.update = (0, make_command_js_1.makeCommand)(replace_js_1.replace.syncFile, replace_js_1.replace.asyncFile, replace_js_1.replace.syncNoFile, replace_js_1.replace.asyncNoFile, (opt, entries = []) => { - replace_js_1.replace.validate?.(opt, entries); - mtimeFilter(opt); -}); -const mtimeFilter = (opt) => { - const filter = opt.filter; - if (!opt.mtimeCache) { - opt.mtimeCache = new Map(); - } - opt.filter = - filter ? - (path, stat) => filter(path, stat) && - !( - /* c8 ignore start */ - ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > - (stat.mtime ?? 0)) - /* c8 ignore stop */ - ) - : (path, stat) => !( - /* c8 ignore start */ - ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > - (stat.mtime ?? 0)) - /* c8 ignore stop */ - ); -}; -//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/warn-method.js b/node_modules/pacote/node_modules/tar/dist/commonjs/warn-method.js deleted file mode 100644 index f25502776e36a..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/warn-method.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.warnMethod = void 0; -const warnMethod = (self, code, message, data = {}) => { - if (self.file) { - data.file = self.file; - } - if (self.cwd) { - data.cwd = self.cwd; - } - data.code = - (message instanceof Error && - message.code) || - code; - data.tarCode = code; - if (!self.strict && data.recoverable !== false) { - if (message instanceof Error) { - data = Object.assign(message, data); - message = message.message; - } - self.emit('warn', code, message, data); - } - else if (message instanceof Error) { - self.emit('error', Object.assign(message, data)); - } - else { - self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); - } -}; -exports.warnMethod = warnMethod; -//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/winchars.js b/node_modules/pacote/node_modules/tar/dist/commonjs/winchars.js deleted file mode 100644 index c0a4405812929..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/winchars.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -// When writing files on Windows, translate the characters to their -// 0xf000 higher-encoded versions. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.decode = exports.encode = void 0; -const raw = ['|', '<', '>', '?', ':']; -const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); -const toWin = new Map(raw.map((char, i) => [char, win[i]])); -const toRaw = new Map(win.map((char, i) => [char, raw[i]])); -const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); -exports.encode = encode; -const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); -exports.decode = decode; -//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/write-entry.js b/node_modules/pacote/node_modules/tar/dist/commonjs/write-entry.js deleted file mode 100644 index 45b7efeb79502..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/write-entry.js +++ /dev/null @@ -1,689 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WriteEntryTar = exports.WriteEntrySync = exports.WriteEntry = void 0; -const fs_1 = __importDefault(require("fs")); -const minipass_1 = require("minipass"); -const path_1 = __importDefault(require("path")); -const header_js_1 = require("./header.js"); -const mode_fix_js_1 = require("./mode-fix.js"); -const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); -const options_js_1 = require("./options.js"); -const pax_js_1 = require("./pax.js"); -const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); -const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); -const warn_method_js_1 = require("./warn-method.js"); -const winchars = __importStar(require("./winchars.js")); -const prefixPath = (path, prefix) => { - if (!prefix) { - return (0, normalize_windows_path_js_1.normalizeWindowsPath)(path); - } - path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path).replace(/^\.(\/|$)/, ''); - return (0, strip_trailing_slashes_js_1.stripTrailingSlashes)(prefix) + '/' + path; -}; -const maxReadSize = 16 * 1024 * 1024; -const PROCESS = Symbol('process'); -const FILE = Symbol('file'); -const DIRECTORY = Symbol('directory'); -const SYMLINK = Symbol('symlink'); -const HARDLINK = Symbol('hardlink'); -const HEADER = Symbol('header'); -const READ = Symbol('read'); -const LSTAT = Symbol('lstat'); -const ONLSTAT = Symbol('onlstat'); -const ONREAD = Symbol('onread'); -const ONREADLINK = Symbol('onreadlink'); -const OPENFILE = Symbol('openfile'); -const ONOPENFILE = Symbol('onopenfile'); -const CLOSE = Symbol('close'); -const MODE = Symbol('mode'); -const AWAITDRAIN = Symbol('awaitDrain'); -const ONDRAIN = Symbol('ondrain'); -const PREFIX = Symbol('prefix'); -class WriteEntry extends minipass_1.Minipass { - path; - portable; - myuid = (process.getuid && process.getuid()) || 0; - // until node has builtin pwnam functions, this'll have to do - myuser = process.env.USER || ''; - maxReadSize; - linkCache; - statCache; - preservePaths; - cwd; - strict; - mtime; - noPax; - noMtime; - prefix; - fd; - blockLen = 0; - blockRemain = 0; - buf; - pos = 0; - remain = 0; - length = 0; - offset = 0; - win32; - absolute; - header; - type; - linkpath; - stat; - onWriteEntry; - #hadError = false; - constructor(p, opt_ = {}) { - const opt = (0, options_js_1.dealias)(opt_); - super(); - this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(p); - // suppress atime, ctime, uid, gid, uname, gname - this.portable = !!opt.portable; - this.maxReadSize = opt.maxReadSize || maxReadSize; - this.linkCache = opt.linkCache || new Map(); - this.statCache = opt.statCache || new Map(); - this.preservePaths = !!opt.preservePaths; - this.cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd || process.cwd()); - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.mtime = opt.mtime; - this.prefix = - opt.prefix ? (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.prefix) : undefined; - this.onWriteEntry = opt.onWriteEntry; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); - if (root && typeof stripped === 'string') { - this.path = stripped; - pathWarn = root; - } - } - this.win32 = !!opt.win32 || process.platform === 'win32'; - if (this.win32) { - // force the \ to / normalization, since we might not *actually* - // be on windows, but want \ to be considered a path separator. - this.path = winchars.decode(this.path.replace(/\\/g, '/')); - p = p.replace(/\\/g, '/'); - } - this.absolute = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.absolute || path_1.default.resolve(this.cwd, p)); - if (this.path === '') { - this.path = './'; - } - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }); - } - const cs = this.statCache.get(this.absolute); - if (cs) { - this[ONLSTAT](cs); - } - else { - this[LSTAT](); - } - } - warn(code, message, data = {}) { - return (0, warn_method_js_1.warnMethod)(this, code, message, data); - } - emit(ev, ...data) { - if (ev === 'error') { - this.#hadError = true; - } - return super.emit(ev, ...data); - } - [LSTAT]() { - fs_1.default.lstat(this.absolute, (er, stat) => { - if (er) { - return this.emit('error', er); - } - this[ONLSTAT](stat); - }); - } - [ONLSTAT](stat) { - this.statCache.set(this.absolute, stat); - this.stat = stat; - if (!stat.isFile()) { - stat.size = 0; - } - this.type = getType(stat); - this.emit('stat', stat); - this[PROCESS](); - } - [PROCESS]() { - switch (this.type) { - case 'File': - return this[FILE](); - case 'Directory': - return this[DIRECTORY](); - case 'SymbolicLink': - return this[SYMLINK](); - // unsupported types are ignored. - default: - return this.end(); - } - } - [MODE](mode) { - return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); - } - [PREFIX](path) { - return prefixPath(path, this.prefix); - } - [HEADER]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot write header before stat'); - } - /* c8 ignore stop */ - if (this.type === 'Directory' && this.portable) { - this.noMtime = true; - } - this.onWriteEntry?.(this); - this.header = new header_js_1.Header({ - path: this[PREFIX](this.path), - // only apply the prefix to hard links. - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this[MODE](this.stat.mode), - uid: this.portable ? undefined : this.stat.uid, - gid: this.portable ? undefined : this.stat.gid, - size: this.stat.size, - mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, - /* c8 ignore next */ - type: this.type === 'Unsupported' ? undefined : this.type, - uname: this.portable ? undefined - : this.stat.uid === this.myuid ? this.myuser - : '', - atime: this.portable ? undefined : this.stat.atime, - ctime: this.portable ? undefined : this.stat.ctime, - }); - if (this.header.encode() && !this.noPax) { - super.write(new pax_js_1.Pax({ - atime: this.portable ? undefined : this.header.atime, - ctime: this.portable ? undefined : this.header.ctime, - gid: this.portable ? undefined : this.header.gid, - mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - size: this.header.size, - uid: this.portable ? undefined : this.header.uid, - uname: this.portable ? undefined : this.header.uname, - dev: this.portable ? undefined : this.stat.dev, - ino: this.portable ? undefined : this.stat.ino, - nlink: this.portable ? undefined : this.stat.nlink, - }).encode()); - } - const block = this.header?.block; - /* c8 ignore start */ - if (!block) { - throw new Error('failed to encode header'); - } - /* c8 ignore stop */ - super.write(block); - } - [DIRECTORY]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create directory entry without stat'); - } - /* c8 ignore stop */ - if (this.path.slice(-1) !== '/') { - this.path += '/'; - } - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [SYMLINK]() { - fs_1.default.readlink(this.absolute, (er, linkpath) => { - if (er) { - return this.emit('error', er); - } - this[ONREADLINK](linkpath); - }); - } - [ONREADLINK](linkpath) { - this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(linkpath); - this[HEADER](); - this.end(); - } - [HARDLINK](linkpath) { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create link entry without stat'); - } - /* c8 ignore stop */ - this.type = 'Link'; - this.linkpath = (0, normalize_windows_path_js_1.normalizeWindowsPath)(path_1.default.relative(this.cwd, linkpath)); - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [FILE]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create file entry without stat'); - } - /* c8 ignore stop */ - if (this.stat.nlink > 1) { - const linkKey = `${this.stat.dev}:${this.stat.ino}`; - const linkpath = this.linkCache.get(linkKey); - if (linkpath?.indexOf(this.cwd) === 0) { - return this[HARDLINK](linkpath); - } - this.linkCache.set(linkKey, this.absolute); - } - this[HEADER](); - if (this.stat.size === 0) { - return this.end(); - } - this[OPENFILE](); - } - [OPENFILE]() { - fs_1.default.open(this.absolute, 'r', (er, fd) => { - if (er) { - return this.emit('error', er); - } - this[ONOPENFILE](fd); - }); - } - [ONOPENFILE](fd) { - this.fd = fd; - if (this.#hadError) { - return this[CLOSE](); - } - /* c8 ignore start */ - if (!this.stat) { - throw new Error('should stat before calling onopenfile'); - } - /* c8 ignore start */ - this.blockLen = 512 * Math.ceil(this.stat.size / 512); - this.blockRemain = this.blockLen; - const bufLen = Math.min(this.blockLen, this.maxReadSize); - this.buf = Buffer.allocUnsafe(bufLen); - this.offset = 0; - this.pos = 0; - this.remain = this.stat.size; - this.length = this.buf.length; - this[READ](); - } - [READ]() { - const { fd, buf, offset, length, pos } = this; - if (fd === undefined || buf === undefined) { - throw new Error('cannot read file without first opening'); - } - fs_1.default.read(fd, buf, offset, length, pos, (er, bytesRead) => { - if (er) { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - return this[CLOSE](() => this.emit('error', er)); - } - this[ONREAD](bytesRead); - }); - } - /* c8 ignore start */ - [CLOSE](cb = () => { }) { - /* c8 ignore stop */ - if (this.fd !== undefined) - fs_1.default.close(this.fd, cb); - } - [ONREAD](bytesRead) { - if (bytesRead <= 0 && this.remain > 0) { - const er = Object.assign(new Error('encountered unexpected EOF'), { - path: this.absolute, - syscall: 'read', - code: 'EOF', - }); - return this[CLOSE](() => this.emit('error', er)); - } - if (bytesRead > this.remain) { - const er = Object.assign(new Error('did not encounter expected EOF'), { - path: this.absolute, - syscall: 'read', - code: 'EOF', - }); - return this[CLOSE](() => this.emit('error', er)); - } - /* c8 ignore start */ - if (!this.buf) { - throw new Error('should have created buffer prior to reading'); - } - /* c8 ignore stop */ - // null out the rest of the buffer, if we could fit the block padding - // at the end of this loop, we've incremented bytesRead and this.remain - // to be incremented up to the blockRemain level, as if we had expected - // to get a null-padded file, and read it until the end. then we will - // decrement both remain and blockRemain by bytesRead, and know that we - // reached the expected EOF, without any null buffer to append. - if (bytesRead === this.remain) { - for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { - this.buf[i + this.offset] = 0; - bytesRead++; - this.remain++; - } - } - const chunk = this.offset === 0 && bytesRead === this.buf.length ? - this.buf - : this.buf.subarray(this.offset, this.offset + bytesRead); - const flushed = this.write(chunk); - if (!flushed) { - this[AWAITDRAIN](() => this[ONDRAIN]()); - } - else { - this[ONDRAIN](); - } - } - [AWAITDRAIN](cb) { - this.once('drain', cb); - } - write(chunk, encoding, cb) { - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); - } - /* c8 ignore stop */ - if (this.blockRemain < chunk.length) { - const er = Object.assign(new Error('writing more data than expected'), { - path: this.absolute, - }); - return this.emit('error', er); - } - this.remain -= chunk.length; - this.blockRemain -= chunk.length; - this.pos += chunk.length; - this.offset += chunk.length; - return super.write(chunk, null, cb); - } - [ONDRAIN]() { - if (!this.remain) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - return this[CLOSE](er => er ? this.emit('error', er) : this.end()); - } - /* c8 ignore start */ - if (!this.buf) { - throw new Error('buffer lost somehow in ONDRAIN'); - } - /* c8 ignore stop */ - if (this.offset >= this.length) { - // if we only have a smaller bit left to read, alloc a smaller buffer - // otherwise, keep it the same length it was before. - this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); - this.offset = 0; - } - this.length = this.buf.length - this.offset; - this[READ](); - } -} -exports.WriteEntry = WriteEntry; -class WriteEntrySync extends WriteEntry { - sync = true; - [LSTAT]() { - this[ONLSTAT](fs_1.default.lstatSync(this.absolute)); - } - [SYMLINK]() { - this[ONREADLINK](fs_1.default.readlinkSync(this.absolute)); - } - [OPENFILE]() { - this[ONOPENFILE](fs_1.default.openSync(this.absolute, 'r')); - } - [READ]() { - let threw = true; - try { - const { fd, buf, offset, length, pos } = this; - /* c8 ignore start */ - if (fd === undefined || buf === undefined) { - throw new Error('fd and buf must be set in READ method'); - } - /* c8 ignore stop */ - const bytesRead = fs_1.default.readSync(fd, buf, offset, length, pos); - this[ONREAD](bytesRead); - threw = false; - } - finally { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - if (threw) { - try { - this[CLOSE](() => { }); - } - catch (er) { } - } - } - } - [AWAITDRAIN](cb) { - cb(); - } - /* c8 ignore start */ - [CLOSE](cb = () => { }) { - /* c8 ignore stop */ - if (this.fd !== undefined) - fs_1.default.closeSync(this.fd); - cb(); - } -} -exports.WriteEntrySync = WriteEntrySync; -class WriteEntryTar extends minipass_1.Minipass { - blockLen = 0; - blockRemain = 0; - buf = 0; - pos = 0; - remain = 0; - length = 0; - preservePaths; - portable; - strict; - noPax; - noMtime; - readEntry; - type; - prefix; - path; - mode; - uid; - gid; - uname; - gname; - header; - mtime; - atime; - ctime; - linkpath; - size; - onWriteEntry; - warn(code, message, data = {}) { - return (0, warn_method_js_1.warnMethod)(this, code, message, data); - } - constructor(readEntry, opt_ = {}) { - const opt = (0, options_js_1.dealias)(opt_); - super(); - this.preservePaths = !!opt.preservePaths; - this.portable = !!opt.portable; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.onWriteEntry = opt.onWriteEntry; - this.readEntry = readEntry; - const { type } = readEntry; - /* c8 ignore start */ - if (type === 'Unsupported') { - throw new Error('writing entry that should be ignored'); - } - /* c8 ignore stop */ - this.type = type; - if (this.type === 'Directory' && this.portable) { - this.noMtime = true; - } - this.prefix = opt.prefix; - this.path = (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.path); - this.mode = - readEntry.mode !== undefined ? - this[MODE](readEntry.mode) - : undefined; - this.uid = this.portable ? undefined : readEntry.uid; - this.gid = this.portable ? undefined : readEntry.gid; - this.uname = this.portable ? undefined : readEntry.uname; - this.gname = this.portable ? undefined : readEntry.gname; - this.size = readEntry.size; - this.mtime = - this.noMtime ? undefined : opt.mtime || readEntry.mtime; - this.atime = this.portable ? undefined : readEntry.atime; - this.ctime = this.portable ? undefined : readEntry.ctime; - this.linkpath = - readEntry.linkpath !== undefined ? - (0, normalize_windows_path_js_1.normalizeWindowsPath)(readEntry.linkpath) - : undefined; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = (0, strip_absolute_path_js_1.stripAbsolutePath)(this.path); - if (root && typeof stripped === 'string') { - this.path = stripped; - pathWarn = root; - } - } - this.remain = readEntry.size; - this.blockRemain = readEntry.startBlockSize; - this.onWriteEntry?.(this); - this.header = new header_js_1.Header({ - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this.mode, - uid: this.portable ? undefined : this.uid, - gid: this.portable ? undefined : this.gid, - size: this.size, - mtime: this.noMtime ? undefined : this.mtime, - type: this.type, - uname: this.portable ? undefined : this.uname, - atime: this.portable ? undefined : this.atime, - ctime: this.portable ? undefined : this.ctime, - }); - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }); - } - if (this.header.encode() && !this.noPax) { - super.write(new pax_js_1.Pax({ - atime: this.portable ? undefined : this.atime, - ctime: this.portable ? undefined : this.ctime, - gid: this.portable ? undefined : this.gid, - mtime: this.noMtime ? undefined : this.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - size: this.size, - uid: this.portable ? undefined : this.uid, - uname: this.portable ? undefined : this.uname, - dev: this.portable ? undefined : this.readEntry.dev, - ino: this.portable ? undefined : this.readEntry.ino, - nlink: this.portable ? undefined : this.readEntry.nlink, - }).encode()); - } - const b = this.header?.block; - /* c8 ignore start */ - if (!b) - throw new Error('failed to encode header'); - /* c8 ignore stop */ - super.write(b); - readEntry.pipe(this); - } - [PREFIX](path) { - return prefixPath(path, this.prefix); - } - [MODE](mode) { - return (0, mode_fix_js_1.modeFix)(mode, this.type === 'Directory', this.portable); - } - write(chunk, encoding, cb) { - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); - } - /* c8 ignore stop */ - const writeLen = chunk.length; - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate'); - } - this.blockRemain -= writeLen; - return super.write(chunk, cb); - } - end(chunk, encoding, cb) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof chunk === 'function') { - cb = chunk; - encoding = undefined; - chunk = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding ?? 'utf8'); - } - if (cb) - this.once('finish', cb); - chunk ? super.end(chunk, cb) : super.end(cb); - /* c8 ignore stop */ - return this; - } -} -exports.WriteEntryTar = WriteEntryTar; -const getType = (stat) => stat.isFile() ? 'File' - : stat.isDirectory() ? 'Directory' - : stat.isSymbolicLink() ? 'SymbolicLink' - : 'Unsupported'; -//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/create.js b/node_modules/pacote/node_modules/tar/dist/esm/create.js deleted file mode 100644 index 512a9911d70d5..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/create.js +++ /dev/null @@ -1,77 +0,0 @@ -import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; -import path from 'node:path'; -import { list } from './list.js'; -import { makeCommand } from './make-command.js'; -import { Pack, PackSync } from './pack.js'; -const createFileSync = (opt, files) => { - const p = new PackSync(opt); - const stream = new WriteStreamSync(opt.file, { - mode: opt.mode || 0o666, - }); - p.pipe(stream); - addFilesSync(p, files); -}; -const createFile = (opt, files) => { - const p = new Pack(opt); - const stream = new WriteStream(opt.file, { - mode: opt.mode || 0o666, - }); - p.pipe(stream); - const promise = new Promise((res, rej) => { - stream.on('error', rej); - stream.on('close', res); - p.on('error', rej); - }); - addFilesAsync(p, files); - return promise; -}; -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - list({ - file: path.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - }); - p.end(); -}; -const addFilesAsync = async (p, files) => { - for (let i = 0; i < files.length; i++) { - const file = String(files[i]); - if (file.charAt(0) === '@') { - await list({ - file: path.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: entry => { - p.add(entry); - }, - }); - } - else { - p.add(file); - } - } - p.end(); -}; -const createSync = (opt, files) => { - const p = new PackSync(opt); - addFilesSync(p, files); - return p; -}; -const createAsync = (opt, files) => { - const p = new Pack(opt); - addFilesAsync(p, files); - return p; -}; -export const create = makeCommand(createFileSync, createFile, createSync, createAsync, (_opt, files) => { - if (!files?.length) { - throw new TypeError('no paths specified to add to archive'); - } -}); -//# sourceMappingURL=create.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/cwd-error.js b/node_modules/pacote/node_modules/tar/dist/esm/cwd-error.js deleted file mode 100644 index 289a066b8e031..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/cwd-error.js +++ /dev/null @@ -1,14 +0,0 @@ -export class CwdError extends Error { - path; - code; - syscall = 'chdir'; - constructor(path, code) { - super(`${code}: Cannot cd into '${path}'`); - this.path = path; - this.code = code; - } - get name() { - return 'CwdError'; - } -} -//# sourceMappingURL=cwd-error.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/extract.js b/node_modules/pacote/node_modules/tar/dist/esm/extract.js deleted file mode 100644 index 2274feef26e78..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/extract.js +++ /dev/null @@ -1,49 +0,0 @@ -// tar -x -import * as fsm from '@isaacs/fs-minipass'; -import fs from 'node:fs'; -import { filesFilter } from './list.js'; -import { makeCommand } from './make-command.js'; -import { Unpack, UnpackSync } from './unpack.js'; -const extractFileSync = (opt) => { - const u = new UnpackSync(opt); - const file = opt.file; - const stat = fs.statSync(file); - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const stream = new fsm.ReadStreamSync(file, { - readSize: readSize, - size: stat.size, - }); - stream.pipe(u); -}; -const extractFile = (opt, _) => { - const u = new Unpack(opt); - const readSize = opt.maxReadSize || 16 * 1024 * 1024; - const file = opt.file; - const p = new Promise((resolve, reject) => { - u.on('error', reject); - u.on('close', resolve); - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - fs.stat(file, (er, stat) => { - if (er) { - reject(er); - } - else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }); - stream.on('error', reject); - stream.pipe(u); - } - }); - }); - return p; -}; -export const extract = makeCommand(extractFileSync, extractFile, opt => new UnpackSync(opt), opt => new Unpack(opt), (opt, files) => { - if (files?.length) - filesFilter(opt, files); -}); -//# sourceMappingURL=extract.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/get-write-flag.js b/node_modules/pacote/node_modules/tar/dist/esm/get-write-flag.js deleted file mode 100644 index 2c7f3e8b28fda..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/get-write-flag.js +++ /dev/null @@ -1,23 +0,0 @@ -// Get the appropriate flag to use for creating files -// We use fmap on Windows platforms for files less than -// 512kb. This is a fairly low limit, but avoids making -// things slower in some cases. Since most of what this -// library is used for is extracting tarballs of many -// relatively small files in npm packages and the like, -// it can be a big boost on Windows platforms. -import fs from 'fs'; -const platform = process.env.__FAKE_PLATFORM__ || process.platform; -const isWindows = platform === 'win32'; -/* c8 ignore start */ -const { O_CREAT, O_TRUNC, O_WRONLY } = fs.constants; -const UV_FS_O_FILEMAP = Number(process.env.__FAKE_FS_O_FILENAME__) || - fs.constants.UV_FS_O_FILEMAP || - 0; -/* c8 ignore stop */ -const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP; -const fMapLimit = 512 * 1024; -const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY; -export const getWriteFlag = !fMapEnabled ? - () => 'w' - : (size) => (size < fMapLimit ? fMapFlag : 'w'); -//# sourceMappingURL=get-write-flag.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/header.js b/node_modules/pacote/node_modules/tar/dist/esm/header.js deleted file mode 100644 index e15192b14b16e..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/header.js +++ /dev/null @@ -1,279 +0,0 @@ -// parse a 512-byte header block to a data object, or vice-versa -// encode returns `true` if a pax extended header is needed, because -// the data could not be faithfully encoded in a simple header. -// (Also, check header.needPax to see if it needs a pax header.) -import { posix as pathModule } from 'node:path'; -import * as large from './large-numbers.js'; -import * as types from './types.js'; -export class Header { - cksumValid = false; - needPax = false; - nullBlock = false; - block; - path; - mode; - uid; - gid; - size; - cksum; - #type = 'Unsupported'; - linkpath; - uname; - gname; - devmaj = 0; - devmin = 0; - atime; - ctime; - mtime; - charset; - comment; - constructor(data, off = 0, ex, gex) { - if (Buffer.isBuffer(data)) { - this.decode(data, off || 0, ex, gex); - } - else if (data) { - this.#slurp(data); - } - } - decode(buf, off, ex, gex) { - if (!off) { - off = 0; - } - if (!buf || !(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header'); - } - this.path = decString(buf, off, 100); - this.mode = decNumber(buf, off + 100, 8); - this.uid = decNumber(buf, off + 108, 8); - this.gid = decNumber(buf, off + 116, 8); - this.size = decNumber(buf, off + 124, 12); - this.mtime = decDate(buf, off + 136, 12); - this.cksum = decNumber(buf, off + 148, 12); - // if we have extended or global extended headers, apply them now - // See https://github.com/npm/node-tar/pull/187 - // Apply global before local, so it overrides - if (gex) - this.#slurp(gex, true); - if (ex) - this.#slurp(ex); - // old tar versions marked dirs as a file with a trailing / - const t = decString(buf, off + 156, 1); - if (types.isCode(t)) { - this.#type = t || '0'; - } - if (this.#type === '0' && this.path.slice(-1) === '/') { - this.#type = '5'; - } - // tar implementations sometimes incorrectly put the stat(dir).size - // as the size in the tarball, even though Directory entries are - // not able to have any body at all. In the very rare chance that - // it actually DOES have a body, we weren't going to do anything with - // it anyway, and it'll just be a warning about an invalid header. - if (this.#type === '5') { - this.size = 0; - } - this.linkpath = decString(buf, off + 157, 100); - if (buf.subarray(off + 257, off + 265).toString() === - 'ustar\u000000') { - this.uname = decString(buf, off + 265, 32); - this.gname = decString(buf, off + 297, 32); - /* c8 ignore start */ - this.devmaj = decNumber(buf, off + 329, 8) ?? 0; - this.devmin = decNumber(buf, off + 337, 8) ?? 0; - /* c8 ignore stop */ - if (buf[off + 475] !== 0) { - // definitely a prefix, definitely >130 chars. - const prefix = decString(buf, off + 345, 155); - this.path = prefix + '/' + this.path; - } - else { - const prefix = decString(buf, off + 345, 130); - if (prefix) { - this.path = prefix + '/' + this.path; - } - this.atime = decDate(buf, off + 476, 12); - this.ctime = decDate(buf, off + 488, 12); - } - } - let sum = 8 * 0x20; - for (let i = off; i < off + 148; i++) { - sum += buf[i]; - } - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i]; - } - this.cksumValid = sum === this.cksum; - if (this.cksum === undefined && sum === 8 * 0x20) { - this.nullBlock = true; - } - } - #slurp(ex, gex = false) { - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. Also, any - // null/undefined values are ignored. - return !(v === null || - v === undefined || - (k === 'path' && gex) || - (k === 'linkpath' && gex) || - k === 'global'); - }))); - } - encode(buf, off = 0) { - if (!buf) { - buf = this.block = Buffer.alloc(512); - } - if (this.#type === 'Unsupported') { - this.#type = '0'; - } - if (!(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header'); - } - const prefixSize = this.ctime || this.atime ? 130 : 155; - const split = splitPrefix(this.path || '', prefixSize); - const path = split[0]; - const prefix = split[1]; - this.needPax = !!split[2]; - this.needPax = encString(buf, off, 100, path) || this.needPax; - this.needPax = - encNumber(buf, off + 100, 8, this.mode) || this.needPax; - this.needPax = - encNumber(buf, off + 108, 8, this.uid) || this.needPax; - this.needPax = - encNumber(buf, off + 116, 8, this.gid) || this.needPax; - this.needPax = - encNumber(buf, off + 124, 12, this.size) || this.needPax; - this.needPax = - encDate(buf, off + 136, 12, this.mtime) || this.needPax; - buf[off + 156] = this.#type.charCodeAt(0); - this.needPax = - encString(buf, off + 157, 100, this.linkpath) || this.needPax; - buf.write('ustar\u000000', off + 257, 8); - this.needPax = - encString(buf, off + 265, 32, this.uname) || this.needPax; - this.needPax = - encString(buf, off + 297, 32, this.gname) || this.needPax; - this.needPax = - encNumber(buf, off + 329, 8, this.devmaj) || this.needPax; - this.needPax = - encNumber(buf, off + 337, 8, this.devmin) || this.needPax; - this.needPax = - encString(buf, off + 345, prefixSize, prefix) || this.needPax; - if (buf[off + 475] !== 0) { - this.needPax = - encString(buf, off + 345, 155, prefix) || this.needPax; - } - else { - this.needPax = - encString(buf, off + 345, 130, prefix) || this.needPax; - this.needPax = - encDate(buf, off + 476, 12, this.atime) || this.needPax; - this.needPax = - encDate(buf, off + 488, 12, this.ctime) || this.needPax; - } - let sum = 8 * 0x20; - for (let i = off; i < off + 148; i++) { - sum += buf[i]; - } - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i]; - } - this.cksum = sum; - encNumber(buf, off + 148, 8, this.cksum); - this.cksumValid = true; - return this.needPax; - } - get type() { - return (this.#type === 'Unsupported' ? - this.#type - : types.name.get(this.#type)); - } - get typeKey() { - return this.#type; - } - set type(type) { - const c = String(types.code.get(type)); - if (types.isCode(c) || c === 'Unsupported') { - this.#type = c; - } - else if (types.isCode(type)) { - this.#type = type; - } - else { - throw new TypeError('invalid entry type: ' + type); - } - } -} -const splitPrefix = (p, prefixSize) => { - const pathSize = 100; - let pp = p; - let prefix = ''; - let ret = undefined; - const root = pathModule.parse(p).root || '.'; - if (Buffer.byteLength(pp) < pathSize) { - ret = [pp, prefix, false]; - } - else { - // first set prefix to the dir, and path to the base - prefix = pathModule.dirname(pp); - pp = pathModule.basename(pp); - do { - if (Buffer.byteLength(pp) <= pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // both fit! - ret = [pp, prefix, false]; - } - else if (Buffer.byteLength(pp) > pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // prefix fits in prefix, but path doesn't fit in path - ret = [pp.slice(0, pathSize - 1), prefix, true]; - } - else { - // make path take a bit from prefix - pp = pathModule.join(pathModule.basename(prefix), pp); - prefix = pathModule.dirname(prefix); - } - } while (prefix !== root && ret === undefined); - // at this point, found no resolution, just truncate - if (!ret) { - ret = [p.slice(0, pathSize - 1), '', true]; - } - } - return ret; -}; -const decString = (buf, off, size) => buf - .subarray(off, off + size) - .toString('utf8') - .replace(/\0.*/, ''); -const decDate = (buf, off, size) => numToDate(decNumber(buf, off, size)); -const numToDate = (num) => num === undefined ? undefined : new Date(num * 1000); -const decNumber = (buf, off, size) => Number(buf[off]) & 0x80 ? - large.parse(buf.subarray(off, off + size)) - : decSmallNumber(buf, off, size); -const nanUndef = (value) => (isNaN(value) ? undefined : value); -const decSmallNumber = (buf, off, size) => nanUndef(parseInt(buf - .subarray(off, off + size) - .toString('utf8') - .replace(/\0.*$/, '') - .trim(), 8)); -// the maximum encodable as a null-terminated octal, by field size -const MAXNUM = { - 12: 0o77777777777, - 8: 0o7777777, -}; -const encNumber = (buf, off, size, num) => num === undefined ? false - : num > MAXNUM[size] || num < 0 ? - (large.encode(num, buf.subarray(off, off + size)), true) - : (encSmallNumber(buf, off, size, num), false); -const encSmallNumber = (buf, off, size, num) => buf.write(octalString(num, size), off, size, 'ascii'); -const octalString = (num, size) => padOctal(Math.floor(num).toString(8), size); -const padOctal = (str, size) => (str.length === size - 1 ? - str - : new Array(size - str.length - 1).join('0') + str + ' ') + '\0'; -const encDate = (buf, off, size, date) => date === undefined ? false : (encNumber(buf, off, size, date.getTime() / 1000)); -// enough to fill the longest string we've got -const NULLS = new Array(156).join('\0'); -// pad with nulls, return true if it's longer or non-ascii -const encString = (buf, off, size, str) => str === undefined ? false : ((buf.write(str + NULLS, off, size, 'utf8'), - str.length !== Buffer.byteLength(str) || str.length > size)); -//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/index.js b/node_modules/pacote/node_modules/tar/dist/esm/index.js deleted file mode 100644 index 1bac6415c8d73..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/index.js +++ /dev/null @@ -1,20 +0,0 @@ -export * from './create.js'; -export { create as c } from './create.js'; -export * from './extract.js'; -export { extract as x } from './extract.js'; -export * from './header.js'; -export * from './list.js'; -export { list as t } from './list.js'; -// classes -export * from './pack.js'; -export * from './parse.js'; -export * from './pax.js'; -export * from './read-entry.js'; -export * from './replace.js'; -export { replace as r } from './replace.js'; -export * as types from './types.js'; -export * from './unpack.js'; -export * from './update.js'; -export { update as u } from './update.js'; -export * from './write-entry.js'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/large-numbers.js b/node_modules/pacote/node_modules/tar/dist/esm/large-numbers.js deleted file mode 100644 index 4f2f7e5f14fc1..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/large-numbers.js +++ /dev/null @@ -1,94 +0,0 @@ -// Tar can encode large and negative numbers using a leading byte of -// 0xff for negative, and 0x80 for positive. -export const encode = (num, buf) => { - if (!Number.isSafeInteger(num)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('cannot encode number outside of javascript safe integer range'); - } - else if (num < 0) { - encodeNegative(num, buf); - } - else { - encodePositive(num, buf); - } - return buf; -}; -const encodePositive = (num, buf) => { - buf[0] = 0x80; - for (var i = buf.length; i > 1; i--) { - buf[i - 1] = num & 0xff; - num = Math.floor(num / 0x100); - } -}; -const encodeNegative = (num, buf) => { - buf[0] = 0xff; - var flipped = false; - num = num * -1; - for (var i = buf.length; i > 1; i--) { - var byte = num & 0xff; - num = Math.floor(num / 0x100); - if (flipped) { - buf[i - 1] = onesComp(byte); - } - else if (byte === 0) { - buf[i - 1] = 0; - } - else { - flipped = true; - buf[i - 1] = twosComp(byte); - } - } -}; -export const parse = (buf) => { - const pre = buf[0]; - const value = pre === 0x80 ? pos(buf.subarray(1, buf.length)) - : pre === 0xff ? twos(buf) - : null; - if (value === null) { - throw Error('invalid base256 encoding'); - } - if (!Number.isSafeInteger(value)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('parsed number outside of javascript safe integer range'); - } - return value; -}; -const twos = (buf) => { - var len = buf.length; - var sum = 0; - var flipped = false; - for (var i = len - 1; i > -1; i--) { - var byte = Number(buf[i]); - var f; - if (flipped) { - f = onesComp(byte); - } - else if (byte === 0) { - f = byte; - } - else { - flipped = true; - f = twosComp(byte); - } - if (f !== 0) { - sum -= f * Math.pow(256, len - i - 1); - } - } - return sum; -}; -const pos = (buf) => { - var len = buf.length; - var sum = 0; - for (var i = len - 1; i > -1; i--) { - var byte = Number(buf[i]); - if (byte !== 0) { - sum += byte * Math.pow(256, len - i - 1); - } - } - return sum; -}; -const onesComp = (byte) => (0xff ^ byte) & 0xff; -const twosComp = (byte) => ((0xff ^ byte) + 1) & 0xff; -//# sourceMappingURL=large-numbers.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/make-command.js b/node_modules/pacote/node_modules/tar/dist/esm/make-command.js deleted file mode 100644 index f2f737bca78fd..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/make-command.js +++ /dev/null @@ -1,57 +0,0 @@ -import { dealias, isAsyncFile, isAsyncNoFile, isSyncFile, isSyncNoFile, } from './options.js'; -export const makeCommand = (syncFile, asyncFile, syncNoFile, asyncNoFile, validate) => { - return Object.assign((opt_ = [], entries, cb) => { - if (Array.isArray(opt_)) { - entries = opt_; - opt_ = {}; - } - if (typeof entries === 'function') { - cb = entries; - entries = undefined; - } - if (!entries) { - entries = []; - } - else { - entries = Array.from(entries); - } - const opt = dealias(opt_); - validate?.(opt, entries); - if (isSyncFile(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions'); - } - return syncFile(opt, entries); - } - else if (isAsyncFile(opt)) { - const p = asyncFile(opt, entries); - // weirdness to make TS happy - const c = cb ? cb : undefined; - return c ? p.then(() => c(), c) : p; - } - else if (isSyncNoFile(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions'); - } - return syncNoFile(opt, entries); - } - else if (isAsyncNoFile(opt)) { - if (typeof cb === 'function') { - throw new TypeError('callback only supported with file option'); - } - return asyncNoFile(opt, entries); - /* c8 ignore start */ - } - else { - throw new Error('impossible options??'); - } - /* c8 ignore stop */ - }, { - syncFile, - asyncFile, - syncNoFile, - asyncNoFile, - validate, - }); -}; -//# sourceMappingURL=make-command.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/mode-fix.js b/node_modules/pacote/node_modules/tar/dist/esm/mode-fix.js deleted file mode 100644 index 5fd3bb88c1cb2..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/mode-fix.js +++ /dev/null @@ -1,25 +0,0 @@ -export const modeFix = (mode, isDir, portable) => { - mode &= 0o7777; - // in portable mode, use the minimum reasonable umask - // if this system creates files with 0o664 by default - // (as some linux distros do), then we'll write the - // archive with 0o644 instead. Also, don't ever create - // a file that is not readable/writable by the owner. - if (portable) { - mode = (mode | 0o600) & ~0o22; - } - // if dirs are readable, then they should be listable - if (isDir) { - if (mode & 0o400) { - mode |= 0o100; - } - if (mode & 0o40) { - mode |= 0o10; - } - if (mode & 0o4) { - mode |= 0o1; - } - } - return mode; -}; -//# sourceMappingURL=mode-fix.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/pacote/node_modules/tar/dist/esm/normalize-unicode.js deleted file mode 100644 index 94e5095476d6e..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/normalize-unicode.js +++ /dev/null @@ -1,13 +0,0 @@ -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -const normalizeCache = Object.create(null); -const { hasOwnProperty } = Object.prototype; -export const normalizeUnicode = (s) => { - if (!hasOwnProperty.call(normalizeCache, s)) { - normalizeCache[s] = s.normalize('NFD'); - } - return normalizeCache[s]; -}; -//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/normalize-windows-path.js b/node_modules/pacote/node_modules/tar/dist/esm/normalize-windows-path.js deleted file mode 100644 index 2d97d2b884e62..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/normalize-windows-path.js +++ /dev/null @@ -1,9 +0,0 @@ -// on windows, either \ or / are valid directory separators. -// on unix, \ is a valid character in filenames. -// so, on windows, and only on windows, we replace all \ chars with /, -// so that we can use / as our one and only directory separator char. -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -export const normalizeWindowsPath = platform !== 'win32' ? - (p) => p - : (p) => p && p.replace(/\\/g, '/'); -//# sourceMappingURL=normalize-windows-path.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/options.js b/node_modules/pacote/node_modules/tar/dist/esm/options.js deleted file mode 100644 index a006d36c23c92..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/options.js +++ /dev/null @@ -1,54 +0,0 @@ -// turn tar(1) style args like `C` into the more verbose things like `cwd` -const argmap = new Map([ - ['C', 'cwd'], - ['f', 'file'], - ['z', 'gzip'], - ['P', 'preservePaths'], - ['U', 'unlink'], - ['strip-components', 'strip'], - ['stripComponents', 'strip'], - ['keep-newer', 'newer'], - ['keepNewer', 'newer'], - ['keep-newer-files', 'newer'], - ['keepNewerFiles', 'newer'], - ['k', 'keep'], - ['keep-existing', 'keep'], - ['keepExisting', 'keep'], - ['m', 'noMtime'], - ['no-mtime', 'noMtime'], - ['p', 'preserveOwner'], - ['L', 'follow'], - ['h', 'follow'], - ['onentry', 'onReadEntry'], -]); -export const isSyncFile = (o) => !!o.sync && !!o.file; -export const isAsyncFile = (o) => !o.sync && !!o.file; -export const isSyncNoFile = (o) => !!o.sync && !o.file; -export const isAsyncNoFile = (o) => !o.sync && !o.file; -export const isSync = (o) => !!o.sync; -export const isAsync = (o) => !o.sync; -export const isFile = (o) => !!o.file; -export const isNoFile = (o) => !o.file; -const dealiasKey = (k) => { - const d = argmap.get(k); - if (d) - return d; - return k; -}; -export const dealias = (opt = {}) => { - if (!opt) - return {}; - const result = {}; - for (const [key, v] of Object.entries(opt)) { - // TS doesn't know that aliases are going to always be the same type - const k = dealiasKey(key); - result[k] = v; - } - // affordance for deprecated noChmod -> chmod - if (result.chmod === undefined && result.noChmod === false) { - result.chmod = true; - } - delete result.noChmod; - return result; -}; -//# sourceMappingURL=options.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/pack.js b/node_modules/pacote/node_modules/tar/dist/esm/pack.js deleted file mode 100644 index f59f32f94201f..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/pack.js +++ /dev/null @@ -1,445 +0,0 @@ -// A readable tar stream creator -// Technically, this is a transform stream that you write paths into, -// and tar format comes out of. -// The `add()` method is like `write()` but returns this, -// and end() return `this` as well, so you can -// do `new Pack(opt).add('files').add('dir').end().pipe(output) -// You could also do something like: -// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) -import fs from 'fs'; -import { WriteEntry, WriteEntrySync, WriteEntryTar, } from './write-entry.js'; -export class PackJob { - path; - absolute; - entry; - stat; - readdir; - pending = false; - ignore = false; - piped = false; - constructor(path, absolute) { - this.path = path || './'; - this.absolute = absolute; - } -} -import { Minipass } from 'minipass'; -import * as zlib from 'minizlib'; -import { Yallist } from 'yallist'; -import { ReadEntry } from './read-entry.js'; -import { warnMethod, } from './warn-method.js'; -const EOF = Buffer.alloc(1024); -const ONSTAT = Symbol('onStat'); -const ENDED = Symbol('ended'); -const QUEUE = Symbol('queue'); -const CURRENT = Symbol('current'); -const PROCESS = Symbol('process'); -const PROCESSING = Symbol('processing'); -const PROCESSJOB = Symbol('processJob'); -const JOBS = Symbol('jobs'); -const JOBDONE = Symbol('jobDone'); -const ADDFSENTRY = Symbol('addFSEntry'); -const ADDTARENTRY = Symbol('addTarEntry'); -const STAT = Symbol('stat'); -const READDIR = Symbol('readdir'); -const ONREADDIR = Symbol('onreaddir'); -const PIPE = Symbol('pipe'); -const ENTRY = Symbol('entry'); -const ENTRYOPT = Symbol('entryOpt'); -const WRITEENTRYCLASS = Symbol('writeEntryClass'); -const WRITE = Symbol('write'); -const ONDRAIN = Symbol('ondrain'); -import path from 'path'; -import { normalizeWindowsPath } from './normalize-windows-path.js'; -export class Pack extends Minipass { - opt; - cwd; - maxReadSize; - preservePaths; - strict; - noPax; - prefix; - linkCache; - statCache; - file; - portable; - zip; - readdirCache; - noDirRecurse; - follow; - noMtime; - mtime; - filter; - jobs; - [WRITEENTRYCLASS]; - onWriteEntry; - [QUEUE]; - [JOBS] = 0; - [PROCESSING] = false; - [ENDED] = false; - constructor(opt = {}) { - //@ts-ignore - super(); - this.opt = opt; - this.file = opt.file || ''; - this.cwd = opt.cwd || process.cwd(); - this.maxReadSize = opt.maxReadSize; - this.preservePaths = !!opt.preservePaths; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.prefix = normalizeWindowsPath(opt.prefix || ''); - this.linkCache = opt.linkCache || new Map(); - this.statCache = opt.statCache || new Map(); - this.readdirCache = opt.readdirCache || new Map(); - this.onWriteEntry = opt.onWriteEntry; - this[WRITEENTRYCLASS] = WriteEntry; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - this.portable = !!opt.portable; - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError('gzip and brotli are mutually exclusive'); - } - if (opt.gzip) { - if (typeof opt.gzip !== 'object') { - opt.gzip = {}; - } - if (this.portable) { - opt.gzip.portable = true; - } - this.zip = new zlib.Gzip(opt.gzip); - } - if (opt.brotli) { - if (typeof opt.brotli !== 'object') { - opt.brotli = {}; - } - this.zip = new zlib.BrotliCompress(opt.brotli); - } - /* c8 ignore next */ - if (!this.zip) - throw new Error('impossible'); - const zip = this.zip; - zip.on('data', chunk => super.write(chunk)); - zip.on('end', () => super.end()); - zip.on('drain', () => this[ONDRAIN]()); - this.on('resume', () => zip.resume()); - } - else { - this.on('drain', this[ONDRAIN]); - } - this.noDirRecurse = !!opt.noDirRecurse; - this.follow = !!opt.follow; - this.noMtime = !!opt.noMtime; - if (opt.mtime) - this.mtime = opt.mtime; - this.filter = - typeof opt.filter === 'function' ? opt.filter : () => true; - this[QUEUE] = new Yallist(); - this[JOBS] = 0; - this.jobs = Number(opt.jobs) || 4; - this[PROCESSING] = false; - this[ENDED] = false; - } - [WRITE](chunk) { - return super.write(chunk); - } - add(path) { - this.write(path); - return this; - } - end(path, encoding, cb) { - /* c8 ignore start */ - if (typeof path === 'function') { - cb = path; - path = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - /* c8 ignore stop */ - if (path) { - this.add(path); - } - this[ENDED] = true; - this[PROCESS](); - /* c8 ignore next */ - if (cb) - cb(); - return this; - } - write(path) { - if (this[ENDED]) { - throw new Error('write after end'); - } - if (path instanceof ReadEntry) { - this[ADDTARENTRY](path); - } - else { - this[ADDFSENTRY](path); - } - return this.flowing; - } - [ADDTARENTRY](p) { - const absolute = normalizeWindowsPath(path.resolve(this.cwd, p.path)); - // in this case, we don't have to wait for the stat - if (!this.filter(p.path, p)) { - p.resume(); - } - else { - const job = new PackJob(p.path, absolute); - job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)); - job.entry.on('end', () => this[JOBDONE](job)); - this[JOBS] += 1; - this[QUEUE].push(job); - } - this[PROCESS](); - } - [ADDFSENTRY](p) { - const absolute = normalizeWindowsPath(path.resolve(this.cwd, p)); - this[QUEUE].push(new PackJob(p, absolute)); - this[PROCESS](); - } - [STAT](job) { - job.pending = true; - this[JOBS] += 1; - const stat = this.follow ? 'stat' : 'lstat'; - fs[stat](job.absolute, (er, stat) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - this.emit('error', er); - } - else { - this[ONSTAT](job, stat); - } - }); - } - [ONSTAT](job, stat) { - this.statCache.set(job.absolute, stat); - job.stat = stat; - // now we have the stat, we can filter it. - if (!this.filter(job.path, stat)) { - job.ignore = true; - } - this[PROCESS](); - } - [READDIR](job) { - job.pending = true; - this[JOBS] += 1; - fs.readdir(job.absolute, (er, entries) => { - job.pending = false; - this[JOBS] -= 1; - if (er) { - return this.emit('error', er); - } - this[ONREADDIR](job, entries); - }); - } - [ONREADDIR](job, entries) { - this.readdirCache.set(job.absolute, entries); - job.readdir = entries; - this[PROCESS](); - } - [PROCESS]() { - if (this[PROCESSING]) { - return; - } - this[PROCESSING] = true; - for (let w = this[QUEUE].head; !!w && this[JOBS] < this.jobs; w = w.next) { - this[PROCESSJOB](w.value); - if (w.value.ignore) { - const p = w.next; - this[QUEUE].removeNode(w); - w.next = p; - } - } - this[PROCESSING] = false; - if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { - if (this.zip) { - this.zip.end(EOF); - } - else { - super.write(EOF); - super.end(); - } - } - } - get [CURRENT]() { - return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value; - } - [JOBDONE](_job) { - this[QUEUE].shift(); - this[JOBS] -= 1; - this[PROCESS](); - } - [PROCESSJOB](job) { - if (job.pending) { - return; - } - if (job.entry) { - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - return; - } - if (!job.stat) { - const sc = this.statCache.get(job.absolute); - if (sc) { - this[ONSTAT](job, sc); - } - else { - this[STAT](job); - } - } - if (!job.stat) { - return; - } - // filtered out! - if (job.ignore) { - return; - } - if (!this.noDirRecurse && - job.stat.isDirectory() && - !job.readdir) { - const rc = this.readdirCache.get(job.absolute); - if (rc) { - this[ONREADDIR](job, rc); - } - else { - this[READDIR](job); - } - if (!job.readdir) { - return; - } - } - // we know it doesn't have an entry, because that got checked above - job.entry = this[ENTRY](job); - if (!job.entry) { - job.ignore = true; - return; - } - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job); - } - } - [ENTRYOPT](job) { - return { - onwarn: (code, msg, data) => this.warn(code, msg, data), - noPax: this.noPax, - cwd: this.cwd, - absolute: job.absolute, - preservePaths: this.preservePaths, - maxReadSize: this.maxReadSize, - strict: this.strict, - portable: this.portable, - linkCache: this.linkCache, - statCache: this.statCache, - noMtime: this.noMtime, - mtime: this.mtime, - prefix: this.prefix, - onWriteEntry: this.onWriteEntry, - }; - } - [ENTRY](job) { - this[JOBS] += 1; - try { - const e = new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)); - return e - .on('end', () => this[JOBDONE](job)) - .on('error', er => this.emit('error', er)); - } - catch (er) { - this.emit('error', er); - } - } - [ONDRAIN]() { - if (this[CURRENT] && this[CURRENT].entry) { - this[CURRENT].entry.resume(); - } - } - // like .pipe() but using super, because our write() is special - [PIPE](job) { - job.piped = true; - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path; - const base = p === './' ? '' : p.replace(/\/*$/, '/'); - this[ADDFSENTRY](base + entry); - }); - } - const source = job.entry; - const zip = this.zip; - /* c8 ignore start */ - if (!source) - throw new Error('cannot pipe without source'); - /* c8 ignore stop */ - if (zip) { - source.on('data', chunk => { - if (!zip.write(chunk)) { - source.pause(); - } - }); - } - else { - source.on('data', chunk => { - if (!super.write(chunk)) { - source.pause(); - } - }); - } - } - pause() { - if (this.zip) { - this.zip.pause(); - } - return super.pause(); - } - warn(code, message, data = {}) { - warnMethod(this, code, message, data); - } -} -export class PackSync extends Pack { - sync = true; - constructor(opt) { - super(opt); - this[WRITEENTRYCLASS] = WriteEntrySync; - } - // pause/resume are no-ops in sync streams. - pause() { } - resume() { } - [STAT](job) { - const stat = this.follow ? 'statSync' : 'lstatSync'; - this[ONSTAT](job, fs[stat](job.absolute)); - } - [READDIR](job) { - this[ONREADDIR](job, fs.readdirSync(job.absolute)); - } - // gotta get it all in this tick - [PIPE](job) { - const source = job.entry; - const zip = this.zip; - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path; - const base = p === './' ? '' : p.replace(/\/*$/, '/'); - this[ADDFSENTRY](base + entry); - }); - } - /* c8 ignore start */ - if (!source) - throw new Error('Cannot pipe without source'); - /* c8 ignore stop */ - if (zip) { - source.on('data', chunk => { - zip.write(chunk); - }); - } - else { - source.on('data', chunk => { - super[WRITE](chunk); - }); - } - } -} -//# sourceMappingURL=pack.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/package.json b/node_modules/pacote/node_modules/tar/dist/esm/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/pacote/node_modules/tar/dist/esm/parse.js b/node_modules/pacote/node_modules/tar/dist/esm/parse.js deleted file mode 100644 index cce430479cd0c..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/parse.js +++ /dev/null @@ -1,595 +0,0 @@ -// this[BUFFER] is the remainder of a chunk if we're waiting for -// the full 512 bytes of a header to come in. We will Buffer.concat() -// it to the next write(), which is a mem copy, but a small one. -// -// this[QUEUE] is a Yallist of entries that haven't been emitted -// yet this can only get filled up if the user keeps write()ing after -// a write() returns false, or does a write() with more than one entry -// -// We don't buffer chunks, we always parse them and either create an -// entry, or push it into the active entry. The ReadEntry class knows -// to throw data away if .ignore=true -// -// Shift entry off the buffer when it emits 'end', and emit 'entry' for -// the next one in the list. -// -// At any time, we're pushing body chunks into the entry at WRITEENTRY, -// and waiting for 'end' on the entry at READENTRY -// -// ignored entries get .resume() called on them straight away -import { EventEmitter as EE } from 'events'; -import { BrotliDecompress, Unzip } from 'minizlib'; -import { Yallist } from 'yallist'; -import { Header } from './header.js'; -import { Pax } from './pax.js'; -import { ReadEntry } from './read-entry.js'; -import { warnMethod, } from './warn-method.js'; -const maxMetaEntrySize = 1024 * 1024; -const gzipHeader = Buffer.from([0x1f, 0x8b]); -const STATE = Symbol('state'); -const WRITEENTRY = Symbol('writeEntry'); -const READENTRY = Symbol('readEntry'); -const NEXTENTRY = Symbol('nextEntry'); -const PROCESSENTRY = Symbol('processEntry'); -const EX = Symbol('extendedHeader'); -const GEX = Symbol('globalExtendedHeader'); -const META = Symbol('meta'); -const EMITMETA = Symbol('emitMeta'); -const BUFFER = Symbol('buffer'); -const QUEUE = Symbol('queue'); -const ENDED = Symbol('ended'); -const EMITTEDEND = Symbol('emittedEnd'); -const EMIT = Symbol('emit'); -const UNZIP = Symbol('unzip'); -const CONSUMECHUNK = Symbol('consumeChunk'); -const CONSUMECHUNKSUB = Symbol('consumeChunkSub'); -const CONSUMEBODY = Symbol('consumeBody'); -const CONSUMEMETA = Symbol('consumeMeta'); -const CONSUMEHEADER = Symbol('consumeHeader'); -const CONSUMING = Symbol('consuming'); -const BUFFERCONCAT = Symbol('bufferConcat'); -const MAYBEEND = Symbol('maybeEnd'); -const WRITING = Symbol('writing'); -const ABORTED = Symbol('aborted'); -const DONE = Symbol('onDone'); -const SAW_VALID_ENTRY = Symbol('sawValidEntry'); -const SAW_NULL_BLOCK = Symbol('sawNullBlock'); -const SAW_EOF = Symbol('sawEOF'); -const CLOSESTREAM = Symbol('closeStream'); -const noop = () => true; -export class Parser extends EE { - file; - strict; - maxMetaEntrySize; - filter; - brotli; - writable = true; - readable = false; - [QUEUE] = new Yallist(); - [BUFFER]; - [READENTRY]; - [WRITEENTRY]; - [STATE] = 'begin'; - [META] = ''; - [EX]; - [GEX]; - [ENDED] = false; - [UNZIP]; - [ABORTED] = false; - [SAW_VALID_ENTRY]; - [SAW_NULL_BLOCK] = false; - [SAW_EOF] = false; - [WRITING] = false; - [CONSUMING] = false; - [EMITTEDEND] = false; - constructor(opt = {}) { - super(); - this.file = opt.file || ''; - // these BADARCHIVE errors can't be detected early. listen on DONE. - this.on(DONE, () => { - if (this[STATE] === 'begin' || - this[SAW_VALID_ENTRY] === false) { - // either less than 1 block of data, or all entries were invalid. - // Either way, probably not even a tarball. - this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format'); - } - }); - if (opt.ondone) { - this.on(DONE, opt.ondone); - } - else { - this.on(DONE, () => { - this.emit('prefinish'); - this.emit('finish'); - this.emit('end'); - }); - } - this.strict = !!opt.strict; - this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize; - this.filter = typeof opt.filter === 'function' ? opt.filter : noop; - // Unlike gzip, brotli doesn't have any magic bytes to identify it - // Users need to explicitly tell us they're extracting a brotli file - // Or we infer from the file extension - const isTBR = opt.file && - (opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')); - // if it's a tbr file it MIGHT be brotli, but we don't know until - // we look at it and verify it's not a valid tar file. - this.brotli = - !opt.gzip && opt.brotli !== undefined ? opt.brotli - : isTBR ? undefined - : false; - // have to set this so that streams are ok piping into it - this.on('end', () => this[CLOSESTREAM]()); - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - if (typeof opt.onReadEntry === 'function') { - this.on('entry', opt.onReadEntry); - } - } - warn(code, message, data = {}) { - warnMethod(this, code, message, data); - } - [CONSUMEHEADER](chunk, position) { - if (this[SAW_VALID_ENTRY] === undefined) { - this[SAW_VALID_ENTRY] = false; - } - let header; - try { - header = new Header(chunk, position, this[EX], this[GEX]); - } - catch (er) { - return this.warn('TAR_ENTRY_INVALID', er); - } - if (header.nullBlock) { - if (this[SAW_NULL_BLOCK]) { - this[SAW_EOF] = true; - // ending an archive with no entries. pointless, but legal. - if (this[STATE] === 'begin') { - this[STATE] = 'header'; - } - this[EMIT]('eof'); - } - else { - this[SAW_NULL_BLOCK] = true; - this[EMIT]('nullBlock'); - } - } - else { - this[SAW_NULL_BLOCK] = false; - if (!header.cksumValid) { - this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }); - } - else if (!header.path) { - this.warn('TAR_ENTRY_INVALID', 'path is required', { header }); - } - else { - const type = header.type; - if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath required', { - header, - }); - } - else if (!/^(Symbolic)?Link$/.test(type) && - !/^(Global)?ExtendedHeader$/.test(type) && - header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { - header, - }); - } - else { - const entry = (this[WRITEENTRY] = new ReadEntry(header, this[EX], this[GEX])); - // we do this for meta & ignored entries as well, because they - // are still valid tar, or else we wouldn't know to ignore them - if (!this[SAW_VALID_ENTRY]) { - if (entry.remain) { - // this might be the one! - const onend = () => { - if (!entry.invalid) { - this[SAW_VALID_ENTRY] = true; - } - }; - entry.on('end', onend); - } - else { - this[SAW_VALID_ENTRY] = true; - } - } - if (entry.meta) { - if (entry.size > this.maxMetaEntrySize) { - entry.ignore = true; - this[EMIT]('ignoredEntry', entry); - this[STATE] = 'ignore'; - entry.resume(); - } - else if (entry.size > 0) { - this[META] = ''; - entry.on('data', c => (this[META] += c)); - this[STATE] = 'meta'; - } - } - else { - this[EX] = undefined; - entry.ignore = - entry.ignore || !this.filter(entry.path, entry); - if (entry.ignore) { - // probably valid, just not something we care about - this[EMIT]('ignoredEntry', entry); - this[STATE] = entry.remain ? 'ignore' : 'header'; - entry.resume(); - } - else { - if (entry.remain) { - this[STATE] = 'body'; - } - else { - this[STATE] = 'header'; - entry.end(); - } - if (!this[READENTRY]) { - this[QUEUE].push(entry); - this[NEXTENTRY](); - } - else { - this[QUEUE].push(entry); - } - } - } - } - } - } - } - [CLOSESTREAM]() { - queueMicrotask(() => this.emit('close')); - } - [PROCESSENTRY](entry) { - let go = true; - if (!entry) { - this[READENTRY] = undefined; - go = false; - } - else if (Array.isArray(entry)) { - const [ev, ...args] = entry; - this.emit(ev, ...args); - } - else { - this[READENTRY] = entry; - this.emit('entry', entry); - if (!entry.emittedEnd) { - entry.on('end', () => this[NEXTENTRY]()); - go = false; - } - } - return go; - } - [NEXTENTRY]() { - do { } while (this[PROCESSENTRY](this[QUEUE].shift())); - if (!this[QUEUE].length) { - // At this point, there's nothing in the queue, but we may have an - // entry which is being consumed (readEntry). - // If we don't, then we definitely can handle more data. - // If we do, and either it's flowing, or it has never had any data - // written to it, then it needs more. - // The only other possibility is that it has returned false from a - // write() call, so we wait for the next drain to continue. - const re = this[READENTRY]; - const drainNow = !re || re.flowing || re.size === re.remain; - if (drainNow) { - if (!this[WRITING]) { - this.emit('drain'); - } - } - else { - re.once('drain', () => this.emit('drain')); - } - } - } - [CONSUMEBODY](chunk, position) { - // write up to but no more than writeEntry.blockRemain - const entry = this[WRITEENTRY]; - /* c8 ignore start */ - if (!entry) { - throw new Error('attempt to consume body without entry??'); - } - const br = entry.blockRemain ?? 0; - /* c8 ignore stop */ - const c = br >= chunk.length && position === 0 ? - chunk - : chunk.subarray(position, position + br); - entry.write(c); - if (!entry.blockRemain) { - this[STATE] = 'header'; - this[WRITEENTRY] = undefined; - entry.end(); - } - return c.length; - } - [CONSUMEMETA](chunk, position) { - const entry = this[WRITEENTRY]; - const ret = this[CONSUMEBODY](chunk, position); - // if we finished, then the entry is reset - if (!this[WRITEENTRY] && entry) { - this[EMITMETA](entry); - } - return ret; - } - [EMIT](ev, data, extra) { - if (!this[QUEUE].length && !this[READENTRY]) { - this.emit(ev, data, extra); - } - else { - this[QUEUE].push([ev, data, extra]); - } - } - [EMITMETA](entry) { - this[EMIT]('meta', this[META]); - switch (entry.type) { - case 'ExtendedHeader': - case 'OldExtendedHeader': - this[EX] = Pax.parse(this[META], this[EX], false); - break; - case 'GlobalExtendedHeader': - this[GEX] = Pax.parse(this[META], this[GEX], true); - break; - case 'NextFileHasLongPath': - case 'OldGnuLongPath': { - const ex = this[EX] ?? Object.create(null); - this[EX] = ex; - ex.path = this[META].replace(/\0.*/, ''); - break; - } - case 'NextFileHasLongLinkpath': { - const ex = this[EX] || Object.create(null); - this[EX] = ex; - ex.linkpath = this[META].replace(/\0.*/, ''); - break; - } - /* c8 ignore start */ - default: - throw new Error('unknown meta: ' + entry.type); - /* c8 ignore stop */ - } - } - abort(error) { - this[ABORTED] = true; - this.emit('abort', error); - // always throws, even in non-strict mode - this.warn('TAR_ABORT', error, { recoverable: false }); - } - write(chunk, encoding, cb) { - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, - /* c8 ignore next */ - typeof encoding === 'string' ? encoding : 'utf8'); - } - if (this[ABORTED]) { - /* c8 ignore next */ - cb?.(); - return false; - } - // first write, might be gzipped - const needSniff = this[UNZIP] === undefined || - (this.brotli === undefined && this[UNZIP] === false); - if (needSniff && chunk) { - if (this[BUFFER]) { - chunk = Buffer.concat([this[BUFFER], chunk]); - this[BUFFER] = undefined; - } - if (chunk.length < gzipHeader.length) { - this[BUFFER] = chunk; - /* c8 ignore next */ - cb?.(); - return true; - } - // look for gzip header - for (let i = 0; this[UNZIP] === undefined && i < gzipHeader.length; i++) { - if (chunk[i] !== gzipHeader[i]) { - this[UNZIP] = false; - } - } - const maybeBrotli = this.brotli === undefined; - if (this[UNZIP] === false && maybeBrotli) { - // read the first header to see if it's a valid tar file. If so, - // we can safely assume that it's not actually brotli, despite the - // .tbr or .tar.br file extension. - // if we ended before getting a full chunk, yes, def brotli - if (chunk.length < 512) { - if (this[ENDED]) { - this.brotli = true; - } - else { - this[BUFFER] = chunk; - /* c8 ignore next */ - cb?.(); - return true; - } - } - else { - // if it's tar, it's pretty reliably not brotli, chances of - // that happening are astronomical. - try { - new Header(chunk.subarray(0, 512)); - this.brotli = false; - } - catch (_) { - this.brotli = true; - } - } - } - if (this[UNZIP] === undefined || - (this[UNZIP] === false && this.brotli)) { - const ended = this[ENDED]; - this[ENDED] = false; - this[UNZIP] = - this[UNZIP] === undefined ? - new Unzip({}) - : new BrotliDecompress({}); - this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); - this[UNZIP].on('error', er => this.abort(er)); - this[UNZIP].on('end', () => { - this[ENDED] = true; - this[CONSUMECHUNK](); - }); - this[WRITING] = true; - const ret = !!this[UNZIP][ended ? 'end' : 'write'](chunk); - this[WRITING] = false; - cb?.(); - return ret; - } - } - this[WRITING] = true; - if (this[UNZIP]) { - this[UNZIP].write(chunk); - } - else { - this[CONSUMECHUNK](chunk); - } - this[WRITING] = false; - // return false if there's a queue, or if the current entry isn't flowing - const ret = this[QUEUE].length ? false - : this[READENTRY] ? this[READENTRY].flowing - : true; - // if we have no queue, then that means a clogged READENTRY - if (!ret && !this[QUEUE].length) { - this[READENTRY]?.once('drain', () => this.emit('drain')); - } - /* c8 ignore next */ - cb?.(); - return ret; - } - [BUFFERCONCAT](c) { - if (c && !this[ABORTED]) { - this[BUFFER] = - this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c; - } - } - [MAYBEEND]() { - if (this[ENDED] && - !this[EMITTEDEND] && - !this[ABORTED] && - !this[CONSUMING]) { - this[EMITTEDEND] = true; - const entry = this[WRITEENTRY]; - if (entry && entry.blockRemain) { - // truncated, likely a damaged file - const have = this[BUFFER] ? this[BUFFER].length : 0; - this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${entry.blockRemain} more bytes, only ${have} available)`, { entry }); - if (this[BUFFER]) { - entry.write(this[BUFFER]); - } - entry.end(); - } - this[EMIT](DONE); - } - } - [CONSUMECHUNK](chunk) { - if (this[CONSUMING] && chunk) { - this[BUFFERCONCAT](chunk); - } - else if (!chunk && !this[BUFFER]) { - this[MAYBEEND](); - } - else if (chunk) { - this[CONSUMING] = true; - if (this[BUFFER]) { - this[BUFFERCONCAT](chunk); - const c = this[BUFFER]; - this[BUFFER] = undefined; - this[CONSUMECHUNKSUB](c); - } - else { - this[CONSUMECHUNKSUB](chunk); - } - while (this[BUFFER] && - this[BUFFER]?.length >= 512 && - !this[ABORTED] && - !this[SAW_EOF]) { - const c = this[BUFFER]; - this[BUFFER] = undefined; - this[CONSUMECHUNKSUB](c); - } - this[CONSUMING] = false; - } - if (!this[BUFFER] || this[ENDED]) { - this[MAYBEEND](); - } - } - [CONSUMECHUNKSUB](chunk) { - // we know that we are in CONSUMING mode, so anything written goes into - // the buffer. Advance the position and put any remainder in the buffer. - let position = 0; - const length = chunk.length; - while (position + 512 <= length && - !this[ABORTED] && - !this[SAW_EOF]) { - switch (this[STATE]) { - case 'begin': - case 'header': - this[CONSUMEHEADER](chunk, position); - position += 512; - break; - case 'ignore': - case 'body': - position += this[CONSUMEBODY](chunk, position); - break; - case 'meta': - position += this[CONSUMEMETA](chunk, position); - break; - /* c8 ignore start */ - default: - throw new Error('invalid state: ' + this[STATE]); - /* c8 ignore stop */ - } - } - if (position < length) { - if (this[BUFFER]) { - this[BUFFER] = Buffer.concat([ - chunk.subarray(position), - this[BUFFER], - ]); - } - else { - this[BUFFER] = chunk.subarray(position); - } - } - } - end(chunk, encoding, cb) { - if (typeof chunk === 'function') { - cb = chunk; - encoding = undefined; - chunk = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - if (cb) - this.once('finish', cb); - if (!this[ABORTED]) { - if (this[UNZIP]) { - /* c8 ignore start */ - if (chunk) - this[UNZIP].write(chunk); - /* c8 ignore stop */ - this[UNZIP].end(); - } - else { - this[ENDED] = true; - if (this.brotli === undefined) - chunk = chunk || Buffer.alloc(0); - if (chunk) - this.write(chunk); - this[MAYBEEND](); - } - } - return this; - } -} -//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/path-reservations.js b/node_modules/pacote/node_modules/tar/dist/esm/path-reservations.js deleted file mode 100644 index e63b9c91e9a80..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/path-reservations.js +++ /dev/null @@ -1,166 +0,0 @@ -// A path exclusive reservation system -// reserve([list, of, paths], fn) -// When the fn is first in line for all its paths, it -// is called with a cb that clears the reservation. -// -// Used by async unpack to avoid clobbering paths in use, -// while still allowing maximal safe parallelization. -import { join } from 'node:path'; -import { normalizeUnicode } from './normalize-unicode.js'; -import { stripTrailingSlashes } from './strip-trailing-slashes.js'; -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform; -const isWindows = platform === 'win32'; -// return a set of parent dirs for a given path -// '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] -const getDirs = (path) => { - const dirs = path - .split('/') - .slice(0, -1) - .reduce((set, path) => { - const s = set[set.length - 1]; - if (s !== undefined) { - path = join(s, path); - } - set.push(path || '/'); - return set; - }, []); - return dirs; -}; -export class PathReservations { - // path => [function or Set] - // A Set object means a directory reservation - // A fn is a direct reservation on that path - #queues = new Map(); - // fn => {paths:[path,...], dirs:[path, ...]} - #reservations = new Map(); - // functions currently running - #running = new Set(); - reserve(paths, fn) { - paths = - isWindows ? - ['win32 parallelization disabled'] - : paths.map(p => { - // don't need normPath, because we skip this entirely for windows - return stripTrailingSlashes(join(normalizeUnicode(p))).toLowerCase(); - }); - const dirs = new Set(paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))); - this.#reservations.set(fn, { dirs, paths }); - for (const p of paths) { - const q = this.#queues.get(p); - if (!q) { - this.#queues.set(p, [fn]); - } - else { - q.push(fn); - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - if (!q) { - this.#queues.set(dir, [new Set([fn])]); - } - else { - const l = q[q.length - 1]; - if (l instanceof Set) { - l.add(fn); - } - else { - q.push(new Set([fn])); - } - } - } - return this.#run(fn); - } - // return the queues for each path the function cares about - // fn => {paths, dirs} - #getQueues(fn) { - const res = this.#reservations.get(fn); - /* c8 ignore start */ - if (!res) { - throw new Error('function does not have any path reservations'); - } - /* c8 ignore stop */ - return { - paths: res.paths.map((path) => this.#queues.get(path)), - dirs: [...res.dirs].map(path => this.#queues.get(path)), - }; - } - // check if fn is first in line for all its paths, and is - // included in the first set for all its dir queues - check(fn) { - const { paths, dirs } = this.#getQueues(fn); - return (paths.every(q => q && q[0] === fn) && - dirs.every(q => q && q[0] instanceof Set && q[0].has(fn))); - } - // run the function if it's first in line and not already running - #run(fn) { - if (this.#running.has(fn) || !this.check(fn)) { - return false; - } - this.#running.add(fn); - fn(() => this.#clear(fn)); - return true; - } - #clear(fn) { - if (!this.#running.has(fn)) { - return false; - } - const res = this.#reservations.get(fn); - /* c8 ignore start */ - if (!res) { - throw new Error('invalid reservation'); - } - /* c8 ignore stop */ - const { paths, dirs } = res; - const next = new Set(); - for (const path of paths) { - const q = this.#queues.get(path); - /* c8 ignore start */ - if (!q || q?.[0] !== fn) { - continue; - } - /* c8 ignore stop */ - const q0 = q[1]; - if (!q0) { - this.#queues.delete(path); - continue; - } - q.shift(); - if (typeof q0 === 'function') { - next.add(q0); - } - else { - for (const f of q0) { - next.add(f); - } - } - } - for (const dir of dirs) { - const q = this.#queues.get(dir); - const q0 = q?.[0]; - /* c8 ignore next - type safety only */ - if (!q || !(q0 instanceof Set)) - continue; - if (q0.size === 1 && q.length === 1) { - this.#queues.delete(dir); - continue; - } - else if (q0.size === 1) { - q.shift(); - // next one must be a function, - // or else the Set would've been reused - const n = q[0]; - if (typeof n === 'function') { - next.add(n); - } - } - else { - q0.delete(fn); - } - } - this.#running.delete(fn); - next.forEach(fn => this.#run(fn)); - return true; - } -} -//# sourceMappingURL=path-reservations.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/pax.js b/node_modules/pacote/node_modules/tar/dist/esm/pax.js deleted file mode 100644 index 832808f344da5..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/pax.js +++ /dev/null @@ -1,154 +0,0 @@ -import { basename } from 'node:path'; -import { Header } from './header.js'; -export class Pax { - atime; - mtime; - ctime; - charset; - comment; - gid; - uid; - gname; - uname; - linkpath; - dev; - ino; - nlink; - path; - size; - mode; - global; - constructor(obj, global = false) { - this.atime = obj.atime; - this.charset = obj.charset; - this.comment = obj.comment; - this.ctime = obj.ctime; - this.dev = obj.dev; - this.gid = obj.gid; - this.global = global; - this.gname = obj.gname; - this.ino = obj.ino; - this.linkpath = obj.linkpath; - this.mtime = obj.mtime; - this.nlink = obj.nlink; - this.path = obj.path; - this.size = obj.size; - this.uid = obj.uid; - this.uname = obj.uname; - } - encode() { - const body = this.encodeBody(); - if (body === '') { - return Buffer.allocUnsafe(0); - } - const bodyLen = Buffer.byteLength(body); - // round up to 512 bytes - // add 512 for header - const bufLen = 512 * Math.ceil(1 + bodyLen / 512); - const buf = Buffer.allocUnsafe(bufLen); - // 0-fill the header section, it might not hit every field - for (let i = 0; i < 512; i++) { - buf[i] = 0; - } - new Header({ - // XXX split the path - // then the path should be PaxHeader + basename, but less than 99, - // prepend with the dirname - /* c8 ignore start */ - path: ('PaxHeader/' + basename(this.path ?? '')).slice(0, 99), - /* c8 ignore stop */ - mode: this.mode || 0o644, - uid: this.uid, - gid: this.gid, - size: bodyLen, - mtime: this.mtime, - type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', - linkpath: '', - uname: this.uname || '', - gname: this.gname || '', - devmaj: 0, - devmin: 0, - atime: this.atime, - ctime: this.ctime, - }).encode(buf); - buf.write(body, 512, bodyLen, 'utf8'); - // null pad after the body - for (let i = bodyLen + 512; i < buf.length; i++) { - buf[i] = 0; - } - return buf; - } - encodeBody() { - return (this.encodeField('path') + - this.encodeField('ctime') + - this.encodeField('atime') + - this.encodeField('dev') + - this.encodeField('ino') + - this.encodeField('nlink') + - this.encodeField('charset') + - this.encodeField('comment') + - this.encodeField('gid') + - this.encodeField('gname') + - this.encodeField('linkpath') + - this.encodeField('mtime') + - this.encodeField('size') + - this.encodeField('uid') + - this.encodeField('uname')); - } - encodeField(field) { - if (this[field] === undefined) { - return ''; - } - const r = this[field]; - const v = r instanceof Date ? r.getTime() / 1000 : r; - const s = ' ' + - (field === 'dev' || field === 'ino' || field === 'nlink' ? - 'SCHILY.' - : '') + - field + - '=' + - v + - '\n'; - const byteLen = Buffer.byteLength(s); - // the digits includes the length of the digits in ascii base-10 - // so if it's 9 characters, then adding 1 for the 9 makes it 10 - // which makes it 11 chars. - let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1; - if (byteLen + digits >= Math.pow(10, digits)) { - digits += 1; - } - const len = digits + byteLen; - return len + s; - } - static parse(str, ex, g = false) { - return new Pax(merge(parseKV(str), ex), g); - } -} -const merge = (a, b) => b ? Object.assign({}, b, a) : a; -const parseKV = (str) => str - .replace(/\n$/, '') - .split('\n') - .reduce(parseKVLine, Object.create(null)); -const parseKVLine = (set, line) => { - const n = parseInt(line, 10); - // XXX Values with \n in them will fail this. - // Refactor to not be a naive line-by-line parse. - if (n !== Buffer.byteLength(line) + 1) { - return set; - } - line = line.slice((n + ' ').length); - const kv = line.split('='); - const r = kv.shift(); - if (!r) { - return set; - } - const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1'); - const v = kv.join('='); - set[k] = - /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) ? - new Date(Number(v) * 1000) - : /^[0-9]+$/.test(v) ? +v - : v; - return set; -}; -//# sourceMappingURL=pax.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/read-entry.js b/node_modules/pacote/node_modules/tar/dist/esm/read-entry.js deleted file mode 100644 index 23cc673e61087..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/read-entry.js +++ /dev/null @@ -1,136 +0,0 @@ -import { Minipass } from 'minipass'; -import { normalizeWindowsPath } from './normalize-windows-path.js'; -export class ReadEntry extends Minipass { - extended; - globalExtended; - header; - startBlockSize; - blockRemain; - remain; - type; - meta = false; - ignore = false; - path; - mode; - uid; - gid; - uname; - gname; - size = 0; - mtime; - atime; - ctime; - linkpath; - dev; - ino; - nlink; - invalid = false; - absolute; - unsupported = false; - constructor(header, ex, gex) { - super({}); - // read entries always start life paused. this is to avoid the - // situation where Minipass's auto-ending empty streams results - // in an entry ending before we're ready for it. - this.pause(); - this.extended = ex; - this.globalExtended = gex; - this.header = header; - /* c8 ignore start */ - this.remain = header.size ?? 0; - /* c8 ignore stop */ - this.startBlockSize = 512 * Math.ceil(this.remain / 512); - this.blockRemain = this.startBlockSize; - this.type = header.type; - switch (this.type) { - case 'File': - case 'OldFile': - case 'Link': - case 'SymbolicLink': - case 'CharacterDevice': - case 'BlockDevice': - case 'Directory': - case 'FIFO': - case 'ContiguousFile': - case 'GNUDumpDir': - break; - case 'NextFileHasLongLinkpath': - case 'NextFileHasLongPath': - case 'OldGnuLongPath': - case 'GlobalExtendedHeader': - case 'ExtendedHeader': - case 'OldExtendedHeader': - this.meta = true; - break; - // NOTE: gnutar and bsdtar treat unrecognized types as 'File' - // it may be worth doing the same, but with a warning. - default: - this.ignore = true; - } - /* c8 ignore start */ - if (!header.path) { - throw new Error('no path provided for tar.ReadEntry'); - } - /* c8 ignore stop */ - this.path = normalizeWindowsPath(header.path); - this.mode = header.mode; - if (this.mode) { - this.mode = this.mode & 0o7777; - } - this.uid = header.uid; - this.gid = header.gid; - this.uname = header.uname; - this.gname = header.gname; - this.size = this.remain; - this.mtime = header.mtime; - this.atime = header.atime; - this.ctime = header.ctime; - /* c8 ignore start */ - this.linkpath = - header.linkpath ? - normalizeWindowsPath(header.linkpath) - : undefined; - /* c8 ignore stop */ - this.uname = header.uname; - this.gname = header.gname; - if (ex) { - this.#slurp(ex); - } - if (gex) { - this.#slurp(gex, true); - } - } - write(data) { - const writeLen = data.length; - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate'); - } - const r = this.remain; - const br = this.blockRemain; - this.remain = Math.max(0, r - writeLen); - this.blockRemain = Math.max(0, br - writeLen); - if (this.ignore) { - return true; - } - if (r >= writeLen) { - return super.write(data); - } - // r < writeLen - return super.write(data.subarray(0, r)); - } - #slurp(ex, gex = false) { - if (ex.path) - ex.path = normalizeWindowsPath(ex.path); - if (ex.linkpath) - ex.linkpath = normalizeWindowsPath(ex.linkpath); - Object.assign(this, Object.fromEntries(Object.entries(ex).filter(([k, v]) => { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. Also, any - // null/undefined values are ignored. - return !(v === null || - v === undefined || - (k === 'path' && gex)); - }))); - } -} -//# sourceMappingURL=read-entry.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/replace.js b/node_modules/pacote/node_modules/tar/dist/esm/replace.js deleted file mode 100644 index bab622bfdf1f1..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/replace.js +++ /dev/null @@ -1,225 +0,0 @@ -// tar -r -import { WriteStream, WriteStreamSync } from '@isaacs/fs-minipass'; -import fs from 'node:fs'; -import path from 'node:path'; -import { Header } from './header.js'; -import { list } from './list.js'; -import { makeCommand } from './make-command.js'; -import { isFile, } from './options.js'; -import { Pack, PackSync } from './pack.js'; -// starting at the head of the file, read a Header -// If the checksum is invalid, that's our position to start writing -// If it is, jump forward by the specified size (round up to 512) -// and try again. -// Write the new Pack stream starting there. -const replaceSync = (opt, files) => { - const p = new PackSync(opt); - let threw = true; - let fd; - let position; - try { - try { - fd = fs.openSync(opt.file, 'r+'); - } - catch (er) { - if (er?.code === 'ENOENT') { - fd = fs.openSync(opt.file, 'w+'); - } - else { - throw er; - } - } - const st = fs.fstatSync(fd); - const headBuf = Buffer.alloc(512); - POSITION: for (position = 0; position < st.size; position += 512) { - for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { - bytes = fs.readSync(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos); - if (position === 0 && - headBuf[0] === 0x1f && - headBuf[1] === 0x8b) { - throw new Error('cannot append to compressed archives'); - } - if (!bytes) { - break POSITION; - } - } - const h = new Header(headBuf); - if (!h.cksumValid) { - break; - } - const entryBlockSize = 512 * Math.ceil((h.size || 0) / 512); - if (position + entryBlockSize + 512 > st.size) { - break; - } - // the 512 for the header we just parsed will be added as well - // also jump ahead all the blocks for the body - position += entryBlockSize; - if (opt.mtimeCache && h.mtime) { - opt.mtimeCache.set(String(h.path), h.mtime); - } - } - threw = false; - streamSync(opt, p, position, fd, files); - } - finally { - if (threw) { - try { - fs.closeSync(fd); - } - catch (er) { } - } - } -}; -const streamSync = (opt, p, position, fd, files) => { - const stream = new WriteStreamSync(opt.file, { - fd: fd, - start: position, - }); - p.pipe(stream); - addFilesSync(p, files); -}; -const replaceAsync = (opt, files) => { - files = Array.from(files); - const p = new Pack(opt); - const getPos = (fd, size, cb_) => { - const cb = (er, pos) => { - if (er) { - fs.close(fd, _ => cb_(er)); - } - else { - cb_(null, pos); - } - }; - let position = 0; - if (size === 0) { - return cb(null, 0); - } - let bufPos = 0; - const headBuf = Buffer.alloc(512); - const onread = (er, bytes) => { - if (er || typeof bytes === 'undefined') { - return cb(er); - } - bufPos += bytes; - if (bufPos < 512 && bytes) { - return fs.read(fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos, onread); - } - if (position === 0 && - headBuf[0] === 0x1f && - headBuf[1] === 0x8b) { - return cb(new Error('cannot append to compressed archives')); - } - // truncated header - if (bufPos < 512) { - return cb(null, position); - } - const h = new Header(headBuf); - if (!h.cksumValid) { - return cb(null, position); - } - /* c8 ignore next */ - const entryBlockSize = 512 * Math.ceil((h.size ?? 0) / 512); - if (position + entryBlockSize + 512 > size) { - return cb(null, position); - } - position += entryBlockSize + 512; - if (position >= size) { - return cb(null, position); - } - if (opt.mtimeCache && h.mtime) { - opt.mtimeCache.set(String(h.path), h.mtime); - } - bufPos = 0; - fs.read(fd, headBuf, 0, 512, position, onread); - }; - fs.read(fd, headBuf, 0, 512, position, onread); - }; - const promise = new Promise((resolve, reject) => { - p.on('error', reject); - let flag = 'r+'; - const onopen = (er, fd) => { - if (er && er.code === 'ENOENT' && flag === 'r+') { - flag = 'w+'; - return fs.open(opt.file, flag, onopen); - } - if (er || !fd) { - return reject(er); - } - fs.fstat(fd, (er, st) => { - if (er) { - return fs.close(fd, () => reject(er)); - } - getPos(fd, st.size, (er, position) => { - if (er) { - return reject(er); - } - const stream = new WriteStream(opt.file, { - fd: fd, - start: position, - }); - p.pipe(stream); - stream.on('error', reject); - stream.on('close', resolve); - addFilesAsync(p, files); - }); - }); - }; - fs.open(opt.file, flag, onopen); - }); - return promise; -}; -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - list({ - file: path.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - }); - p.end(); -}; -const addFilesAsync = async (p, files) => { - for (let i = 0; i < files.length; i++) { - const file = String(files[i]); - if (file.charAt(0) === '@') { - await list({ - file: path.resolve(String(p.cwd), file.slice(1)), - noResume: true, - onReadEntry: entry => p.add(entry), - }); - } - else { - p.add(file); - } - } - p.end(); -}; -export const replace = makeCommand(replaceSync, replaceAsync, -/* c8 ignore start */ -() => { - throw new TypeError('file is required'); -}, () => { - throw new TypeError('file is required'); -}, -/* c8 ignore stop */ -(opt, entries) => { - if (!isFile(opt)) { - throw new TypeError('file is required'); - } - if (opt.gzip || - opt.brotli || - opt.file.endsWith('.br') || - opt.file.endsWith('.tbr')) { - throw new TypeError('cannot append to compressed archives'); - } - if (!entries?.length) { - throw new TypeError('no paths specified to add/replace'); - } -}); -//# sourceMappingURL=replace.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/strip-absolute-path.js b/node_modules/pacote/node_modules/tar/dist/esm/strip-absolute-path.js deleted file mode 100644 index cce5ff80b00db..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/strip-absolute-path.js +++ /dev/null @@ -1,25 +0,0 @@ -// unix absolute paths are also absolute on win32, so we use this for both -import { win32 } from 'node:path'; -const { isAbsolute, parse } = win32; -// returns [root, stripped] -// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in -// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / -// explicitly if it's the first character. -// drive-specific relative paths on Windows get their root stripped off even -// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] -export const stripAbsolutePath = (path) => { - let r = ''; - let parsed = parse(path); - while (isAbsolute(path) || parsed.root) { - // windows will think that //x/y/z has a "root" of //x/y/ - // but strip the //?/C:/ off of //?/C:/path - const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? - '/' - : parsed.root; - path = path.slice(root.length); - r += root; - parsed = parse(path); - } - return [r, path]; -}; -//# sourceMappingURL=strip-absolute-path.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/strip-trailing-slashes.js b/node_modules/pacote/node_modules/tar/dist/esm/strip-trailing-slashes.js deleted file mode 100644 index ace4218a7547b..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/strip-trailing-slashes.js +++ /dev/null @@ -1,14 +0,0 @@ -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -export const stripTrailingSlashes = (str) => { - let i = str.length - 1; - let slashesStart = -1; - while (i > -1 && str.charAt(i) === '/') { - slashesStart = i; - i--; - } - return slashesStart === -1 ? str : str.slice(0, slashesStart); -}; -//# sourceMappingURL=strip-trailing-slashes.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/symlink-error.js b/node_modules/pacote/node_modules/tar/dist/esm/symlink-error.js deleted file mode 100644 index d31766e2e0afa..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/symlink-error.js +++ /dev/null @@ -1,15 +0,0 @@ -export class SymlinkError extends Error { - path; - symlink; - syscall = 'symlink'; - code = 'TAR_SYMLINK_ERROR'; - constructor(symlink, path) { - super('TAR_SYMLINK_ERROR: Cannot extract through symbolic link'); - this.symlink = symlink; - this.path = path; - } - get name() { - return 'SymlinkError'; - } -} -//# sourceMappingURL=symlink-error.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/types.js b/node_modules/pacote/node_modules/tar/dist/esm/types.js deleted file mode 100644 index 27b982ae1e092..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/types.js +++ /dev/null @@ -1,45 +0,0 @@ -export const isCode = (c) => name.has(c); -export const isName = (c) => code.has(c); -// map types from key to human-friendly name -export const name = new Map([ - ['0', 'File'], - // same as File - ['', 'OldFile'], - ['1', 'Link'], - ['2', 'SymbolicLink'], - // Devices and FIFOs aren't fully supported - // they are parsed, but skipped when unpacking - ['3', 'CharacterDevice'], - ['4', 'BlockDevice'], - ['5', 'Directory'], - ['6', 'FIFO'], - // same as File - ['7', 'ContiguousFile'], - // pax headers - ['g', 'GlobalExtendedHeader'], - ['x', 'ExtendedHeader'], - // vendor-specific stuff - // skip - ['A', 'SolarisACL'], - // like 5, but with data, which should be skipped - ['D', 'GNUDumpDir'], - // metadata only, skip - ['I', 'Inode'], - // data = link path of next file - ['K', 'NextFileHasLongLinkpath'], - // data = path of next file - ['L', 'NextFileHasLongPath'], - // skip - ['M', 'ContinuationFile'], - // like L - ['N', 'OldGnuLongPath'], - // skip - ['S', 'SparseFile'], - // skip - ['V', 'TapeVolumeHeader'], - // like x - ['X', 'OldExtendedHeader'], -]); -// map the other direction -export const code = new Map(Array.from(name).map(kv => [kv[1], kv[0]])); -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/update.js b/node_modules/pacote/node_modules/tar/dist/esm/update.js deleted file mode 100644 index 21398e9766663..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/update.js +++ /dev/null @@ -1,30 +0,0 @@ -// tar -u -import { makeCommand } from './make-command.js'; -import { replace as r } from './replace.js'; -// just call tar.r with the filter and mtimeCache -export const update = makeCommand(r.syncFile, r.asyncFile, r.syncNoFile, r.asyncNoFile, (opt, entries = []) => { - r.validate?.(opt, entries); - mtimeFilter(opt); -}); -const mtimeFilter = (opt) => { - const filter = opt.filter; - if (!opt.mtimeCache) { - opt.mtimeCache = new Map(); - } - opt.filter = - filter ? - (path, stat) => filter(path, stat) && - !( - /* c8 ignore start */ - ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > - (stat.mtime ?? 0)) - /* c8 ignore stop */ - ) - : (path, stat) => !( - /* c8 ignore start */ - ((opt.mtimeCache?.get(path) ?? stat.mtime ?? 0) > - (stat.mtime ?? 0)) - /* c8 ignore stop */ - ); -}; -//# sourceMappingURL=update.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/warn-method.js b/node_modules/pacote/node_modules/tar/dist/esm/warn-method.js deleted file mode 100644 index 13e798afefc85..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/warn-method.js +++ /dev/null @@ -1,27 +0,0 @@ -export const warnMethod = (self, code, message, data = {}) => { - if (self.file) { - data.file = self.file; - } - if (self.cwd) { - data.cwd = self.cwd; - } - data.code = - (message instanceof Error && - message.code) || - code; - data.tarCode = code; - if (!self.strict && data.recoverable !== false) { - if (message instanceof Error) { - data = Object.assign(message, data); - message = message.message; - } - self.emit('warn', code, message, data); - } - else if (message instanceof Error) { - self.emit('error', Object.assign(message, data)); - } - else { - self.emit('error', Object.assign(new Error(`${code}: ${message}`), data)); - } -}; -//# sourceMappingURL=warn-method.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/winchars.js b/node_modules/pacote/node_modules/tar/dist/esm/winchars.js deleted file mode 100644 index c41eb86d69a4b..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/winchars.js +++ /dev/null @@ -1,9 +0,0 @@ -// When writing files on Windows, translate the characters to their -// 0xf000 higher-encoded versions. -const raw = ['|', '<', '>', '?', ':']; -const win = raw.map(char => String.fromCharCode(0xf000 + char.charCodeAt(0))); -const toWin = new Map(raw.map((char, i) => [char, win[i]])); -const toRaw = new Map(win.map((char, i) => [char, raw[i]])); -export const encode = (s) => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s); -export const decode = (s) => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s); -//# sourceMappingURL=winchars.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/dist/esm/write-entry.js b/node_modules/pacote/node_modules/tar/dist/esm/write-entry.js deleted file mode 100644 index 9028cd676b4cd..0000000000000 --- a/node_modules/pacote/node_modules/tar/dist/esm/write-entry.js +++ /dev/null @@ -1,657 +0,0 @@ -import fs from 'fs'; -import { Minipass } from 'minipass'; -import path from 'path'; -import { Header } from './header.js'; -import { modeFix } from './mode-fix.js'; -import { normalizeWindowsPath } from './normalize-windows-path.js'; -import { dealias, } from './options.js'; -import { Pax } from './pax.js'; -import { stripAbsolutePath } from './strip-absolute-path.js'; -import { stripTrailingSlashes } from './strip-trailing-slashes.js'; -import { warnMethod, } from './warn-method.js'; -import * as winchars from './winchars.js'; -const prefixPath = (path, prefix) => { - if (!prefix) { - return normalizeWindowsPath(path); - } - path = normalizeWindowsPath(path).replace(/^\.(\/|$)/, ''); - return stripTrailingSlashes(prefix) + '/' + path; -}; -const maxReadSize = 16 * 1024 * 1024; -const PROCESS = Symbol('process'); -const FILE = Symbol('file'); -const DIRECTORY = Symbol('directory'); -const SYMLINK = Symbol('symlink'); -const HARDLINK = Symbol('hardlink'); -const HEADER = Symbol('header'); -const READ = Symbol('read'); -const LSTAT = Symbol('lstat'); -const ONLSTAT = Symbol('onlstat'); -const ONREAD = Symbol('onread'); -const ONREADLINK = Symbol('onreadlink'); -const OPENFILE = Symbol('openfile'); -const ONOPENFILE = Symbol('onopenfile'); -const CLOSE = Symbol('close'); -const MODE = Symbol('mode'); -const AWAITDRAIN = Symbol('awaitDrain'); -const ONDRAIN = Symbol('ondrain'); -const PREFIX = Symbol('prefix'); -export class WriteEntry extends Minipass { - path; - portable; - myuid = (process.getuid && process.getuid()) || 0; - // until node has builtin pwnam functions, this'll have to do - myuser = process.env.USER || ''; - maxReadSize; - linkCache; - statCache; - preservePaths; - cwd; - strict; - mtime; - noPax; - noMtime; - prefix; - fd; - blockLen = 0; - blockRemain = 0; - buf; - pos = 0; - remain = 0; - length = 0; - offset = 0; - win32; - absolute; - header; - type; - linkpath; - stat; - onWriteEntry; - #hadError = false; - constructor(p, opt_ = {}) { - const opt = dealias(opt_); - super(); - this.path = normalizeWindowsPath(p); - // suppress atime, ctime, uid, gid, uname, gname - this.portable = !!opt.portable; - this.maxReadSize = opt.maxReadSize || maxReadSize; - this.linkCache = opt.linkCache || new Map(); - this.statCache = opt.statCache || new Map(); - this.preservePaths = !!opt.preservePaths; - this.cwd = normalizeWindowsPath(opt.cwd || process.cwd()); - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.mtime = opt.mtime; - this.prefix = - opt.prefix ? normalizeWindowsPath(opt.prefix) : undefined; - this.onWriteEntry = opt.onWriteEntry; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path); - if (root && typeof stripped === 'string') { - this.path = stripped; - pathWarn = root; - } - } - this.win32 = !!opt.win32 || process.platform === 'win32'; - if (this.win32) { - // force the \ to / normalization, since we might not *actually* - // be on windows, but want \ to be considered a path separator. - this.path = winchars.decode(this.path.replace(/\\/g, '/')); - p = p.replace(/\\/g, '/'); - } - this.absolute = normalizeWindowsPath(opt.absolute || path.resolve(this.cwd, p)); - if (this.path === '') { - this.path = './'; - } - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }); - } - const cs = this.statCache.get(this.absolute); - if (cs) { - this[ONLSTAT](cs); - } - else { - this[LSTAT](); - } - } - warn(code, message, data = {}) { - return warnMethod(this, code, message, data); - } - emit(ev, ...data) { - if (ev === 'error') { - this.#hadError = true; - } - return super.emit(ev, ...data); - } - [LSTAT]() { - fs.lstat(this.absolute, (er, stat) => { - if (er) { - return this.emit('error', er); - } - this[ONLSTAT](stat); - }); - } - [ONLSTAT](stat) { - this.statCache.set(this.absolute, stat); - this.stat = stat; - if (!stat.isFile()) { - stat.size = 0; - } - this.type = getType(stat); - this.emit('stat', stat); - this[PROCESS](); - } - [PROCESS]() { - switch (this.type) { - case 'File': - return this[FILE](); - case 'Directory': - return this[DIRECTORY](); - case 'SymbolicLink': - return this[SYMLINK](); - // unsupported types are ignored. - default: - return this.end(); - } - } - [MODE](mode) { - return modeFix(mode, this.type === 'Directory', this.portable); - } - [PREFIX](path) { - return prefixPath(path, this.prefix); - } - [HEADER]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot write header before stat'); - } - /* c8 ignore stop */ - if (this.type === 'Directory' && this.portable) { - this.noMtime = true; - } - this.onWriteEntry?.(this); - this.header = new Header({ - path: this[PREFIX](this.path), - // only apply the prefix to hard links. - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this[MODE](this.stat.mode), - uid: this.portable ? undefined : this.stat.uid, - gid: this.portable ? undefined : this.stat.gid, - size: this.stat.size, - mtime: this.noMtime ? undefined : this.mtime || this.stat.mtime, - /* c8 ignore next */ - type: this.type === 'Unsupported' ? undefined : this.type, - uname: this.portable ? undefined - : this.stat.uid === this.myuid ? this.myuser - : '', - atime: this.portable ? undefined : this.stat.atime, - ctime: this.portable ? undefined : this.stat.ctime, - }); - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? undefined : this.header.atime, - ctime: this.portable ? undefined : this.header.ctime, - gid: this.portable ? undefined : this.header.gid, - mtime: this.noMtime ? undefined : (this.mtime || this.header.mtime), - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - size: this.header.size, - uid: this.portable ? undefined : this.header.uid, - uname: this.portable ? undefined : this.header.uname, - dev: this.portable ? undefined : this.stat.dev, - ino: this.portable ? undefined : this.stat.ino, - nlink: this.portable ? undefined : this.stat.nlink, - }).encode()); - } - const block = this.header?.block; - /* c8 ignore start */ - if (!block) { - throw new Error('failed to encode header'); - } - /* c8 ignore stop */ - super.write(block); - } - [DIRECTORY]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create directory entry without stat'); - } - /* c8 ignore stop */ - if (this.path.slice(-1) !== '/') { - this.path += '/'; - } - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [SYMLINK]() { - fs.readlink(this.absolute, (er, linkpath) => { - if (er) { - return this.emit('error', er); - } - this[ONREADLINK](linkpath); - }); - } - [ONREADLINK](linkpath) { - this.linkpath = normalizeWindowsPath(linkpath); - this[HEADER](); - this.end(); - } - [HARDLINK](linkpath) { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create link entry without stat'); - } - /* c8 ignore stop */ - this.type = 'Link'; - this.linkpath = normalizeWindowsPath(path.relative(this.cwd, linkpath)); - this.stat.size = 0; - this[HEADER](); - this.end(); - } - [FILE]() { - /* c8 ignore start */ - if (!this.stat) { - throw new Error('cannot create file entry without stat'); - } - /* c8 ignore stop */ - if (this.stat.nlink > 1) { - const linkKey = `${this.stat.dev}:${this.stat.ino}`; - const linkpath = this.linkCache.get(linkKey); - if (linkpath?.indexOf(this.cwd) === 0) { - return this[HARDLINK](linkpath); - } - this.linkCache.set(linkKey, this.absolute); - } - this[HEADER](); - if (this.stat.size === 0) { - return this.end(); - } - this[OPENFILE](); - } - [OPENFILE]() { - fs.open(this.absolute, 'r', (er, fd) => { - if (er) { - return this.emit('error', er); - } - this[ONOPENFILE](fd); - }); - } - [ONOPENFILE](fd) { - this.fd = fd; - if (this.#hadError) { - return this[CLOSE](); - } - /* c8 ignore start */ - if (!this.stat) { - throw new Error('should stat before calling onopenfile'); - } - /* c8 ignore start */ - this.blockLen = 512 * Math.ceil(this.stat.size / 512); - this.blockRemain = this.blockLen; - const bufLen = Math.min(this.blockLen, this.maxReadSize); - this.buf = Buffer.allocUnsafe(bufLen); - this.offset = 0; - this.pos = 0; - this.remain = this.stat.size; - this.length = this.buf.length; - this[READ](); - } - [READ]() { - const { fd, buf, offset, length, pos } = this; - if (fd === undefined || buf === undefined) { - throw new Error('cannot read file without first opening'); - } - fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { - if (er) { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - return this[CLOSE](() => this.emit('error', er)); - } - this[ONREAD](bytesRead); - }); - } - /* c8 ignore start */ - [CLOSE](cb = () => { }) { - /* c8 ignore stop */ - if (this.fd !== undefined) - fs.close(this.fd, cb); - } - [ONREAD](bytesRead) { - if (bytesRead <= 0 && this.remain > 0) { - const er = Object.assign(new Error('encountered unexpected EOF'), { - path: this.absolute, - syscall: 'read', - code: 'EOF', - }); - return this[CLOSE](() => this.emit('error', er)); - } - if (bytesRead > this.remain) { - const er = Object.assign(new Error('did not encounter expected EOF'), { - path: this.absolute, - syscall: 'read', - code: 'EOF', - }); - return this[CLOSE](() => this.emit('error', er)); - } - /* c8 ignore start */ - if (!this.buf) { - throw new Error('should have created buffer prior to reading'); - } - /* c8 ignore stop */ - // null out the rest of the buffer, if we could fit the block padding - // at the end of this loop, we've incremented bytesRead and this.remain - // to be incremented up to the blockRemain level, as if we had expected - // to get a null-padded file, and read it until the end. then we will - // decrement both remain and blockRemain by bytesRead, and know that we - // reached the expected EOF, without any null buffer to append. - if (bytesRead === this.remain) { - for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { - this.buf[i + this.offset] = 0; - bytesRead++; - this.remain++; - } - } - const chunk = this.offset === 0 && bytesRead === this.buf.length ? - this.buf - : this.buf.subarray(this.offset, this.offset + bytesRead); - const flushed = this.write(chunk); - if (!flushed) { - this[AWAITDRAIN](() => this[ONDRAIN]()); - } - else { - this[ONDRAIN](); - } - } - [AWAITDRAIN](cb) { - this.once('drain', cb); - } - write(chunk, encoding, cb) { - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); - } - /* c8 ignore stop */ - if (this.blockRemain < chunk.length) { - const er = Object.assign(new Error('writing more data than expected'), { - path: this.absolute, - }); - return this.emit('error', er); - } - this.remain -= chunk.length; - this.blockRemain -= chunk.length; - this.pos += chunk.length; - this.offset += chunk.length; - return super.write(chunk, null, cb); - } - [ONDRAIN]() { - if (!this.remain) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - return this[CLOSE](er => er ? this.emit('error', er) : this.end()); - } - /* c8 ignore start */ - if (!this.buf) { - throw new Error('buffer lost somehow in ONDRAIN'); - } - /* c8 ignore stop */ - if (this.offset >= this.length) { - // if we only have a smaller bit left to read, alloc a smaller buffer - // otherwise, keep it the same length it was before. - this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)); - this.offset = 0; - } - this.length = this.buf.length - this.offset; - this[READ](); - } -} -export class WriteEntrySync extends WriteEntry { - sync = true; - [LSTAT]() { - this[ONLSTAT](fs.lstatSync(this.absolute)); - } - [SYMLINK]() { - this[ONREADLINK](fs.readlinkSync(this.absolute)); - } - [OPENFILE]() { - this[ONOPENFILE](fs.openSync(this.absolute, 'r')); - } - [READ]() { - let threw = true; - try { - const { fd, buf, offset, length, pos } = this; - /* c8 ignore start */ - if (fd === undefined || buf === undefined) { - throw new Error('fd and buf must be set in READ method'); - } - /* c8 ignore stop */ - const bytesRead = fs.readSync(fd, buf, offset, length, pos); - this[ONREAD](bytesRead); - threw = false; - } - finally { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - if (threw) { - try { - this[CLOSE](() => { }); - } - catch (er) { } - } - } - } - [AWAITDRAIN](cb) { - cb(); - } - /* c8 ignore start */ - [CLOSE](cb = () => { }) { - /* c8 ignore stop */ - if (this.fd !== undefined) - fs.closeSync(this.fd); - cb(); - } -} -export class WriteEntryTar extends Minipass { - blockLen = 0; - blockRemain = 0; - buf = 0; - pos = 0; - remain = 0; - length = 0; - preservePaths; - portable; - strict; - noPax; - noMtime; - readEntry; - type; - prefix; - path; - mode; - uid; - gid; - uname; - gname; - header; - mtime; - atime; - ctime; - linkpath; - size; - onWriteEntry; - warn(code, message, data = {}) { - return warnMethod(this, code, message, data); - } - constructor(readEntry, opt_ = {}) { - const opt = dealias(opt_); - super(); - this.preservePaths = !!opt.preservePaths; - this.portable = !!opt.portable; - this.strict = !!opt.strict; - this.noPax = !!opt.noPax; - this.noMtime = !!opt.noMtime; - this.onWriteEntry = opt.onWriteEntry; - this.readEntry = readEntry; - const { type } = readEntry; - /* c8 ignore start */ - if (type === 'Unsupported') { - throw new Error('writing entry that should be ignored'); - } - /* c8 ignore stop */ - this.type = type; - if (this.type === 'Directory' && this.portable) { - this.noMtime = true; - } - this.prefix = opt.prefix; - this.path = normalizeWindowsPath(readEntry.path); - this.mode = - readEntry.mode !== undefined ? - this[MODE](readEntry.mode) - : undefined; - this.uid = this.portable ? undefined : readEntry.uid; - this.gid = this.portable ? undefined : readEntry.gid; - this.uname = this.portable ? undefined : readEntry.uname; - this.gname = this.portable ? undefined : readEntry.gname; - this.size = readEntry.size; - this.mtime = - this.noMtime ? undefined : opt.mtime || readEntry.mtime; - this.atime = this.portable ? undefined : readEntry.atime; - this.ctime = this.portable ? undefined : readEntry.ctime; - this.linkpath = - readEntry.linkpath !== undefined ? - normalizeWindowsPath(readEntry.linkpath) - : undefined; - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn); - } - let pathWarn = false; - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path); - if (root && typeof stripped === 'string') { - this.path = stripped; - pathWarn = root; - } - } - this.remain = readEntry.size; - this.blockRemain = readEntry.startBlockSize; - this.onWriteEntry?.(this); - this.header = new Header({ - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this.mode, - uid: this.portable ? undefined : this.uid, - gid: this.portable ? undefined : this.gid, - size: this.size, - mtime: this.noMtime ? undefined : this.mtime, - type: this.type, - uname: this.portable ? undefined : this.uname, - atime: this.portable ? undefined : this.atime, - ctime: this.portable ? undefined : this.ctime, - }); - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }); - } - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? undefined : this.atime, - ctime: this.portable ? undefined : this.ctime, - gid: this.portable ? undefined : this.gid, - mtime: this.noMtime ? undefined : this.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' && this.linkpath !== undefined ? - this[PREFIX](this.linkpath) - : this.linkpath, - size: this.size, - uid: this.portable ? undefined : this.uid, - uname: this.portable ? undefined : this.uname, - dev: this.portable ? undefined : this.readEntry.dev, - ino: this.portable ? undefined : this.readEntry.ino, - nlink: this.portable ? undefined : this.readEntry.nlink, - }).encode()); - } - const b = this.header?.block; - /* c8 ignore start */ - if (!b) - throw new Error('failed to encode header'); - /* c8 ignore stop */ - super.write(b); - readEntry.pipe(this); - } - [PREFIX](path) { - return prefixPath(path, this.prefix); - } - [MODE](mode) { - return modeFix(mode, this.type === 'Directory', this.portable); - } - write(chunk, encoding, cb) { - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, typeof encoding === 'string' ? encoding : 'utf8'); - } - /* c8 ignore stop */ - const writeLen = chunk.length; - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate'); - } - this.blockRemain -= writeLen; - return super.write(chunk, cb); - } - end(chunk, encoding, cb) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)); - } - /* c8 ignore start - just junk to comply with NodeJS.WritableStream */ - if (typeof chunk === 'function') { - cb = chunk; - encoding = undefined; - chunk = undefined; - } - if (typeof encoding === 'function') { - cb = encoding; - encoding = undefined; - } - if (typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding ?? 'utf8'); - } - if (cb) - this.once('finish', cb); - chunk ? super.end(chunk, cb) : super.end(cb); - /* c8 ignore stop */ - return this; - } -} -const getType = (stat) => stat.isFile() ? 'File' - : stat.isDirectory() ? 'Directory' - : stat.isSymbolicLink() ? 'SymbolicLink' - : 'Unsupported'; -//# sourceMappingURL=write-entry.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/tar/package.json b/node_modules/pacote/node_modules/tar/package.json deleted file mode 100644 index 0283103ee9eaf..0000000000000 --- a/node_modules/pacote/node_modules/tar/package.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "author": "Isaac Z. Schlueter", - "name": "tar", - "description": "tar for node", - "version": "7.4.3", - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-tar.git" - }, - "scripts": { - "genparse": "node scripts/generate-parse-fixtures.js", - "snap": "tap", - "test": "tap", - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "prepare": "tshy", - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "format": "prettier --write . --log-level warn", - "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" - }, - "dependencies": { - "@isaacs/fs-minipass": "^4.0.0", - "chownr": "^3.0.0", - "minipass": "^7.1.2", - "minizlib": "^3.0.1", - "mkdirp": "^3.0.1", - "yallist": "^5.0.0" - }, - "devDependencies": { - "chmodr": "^1.2.0", - "end-of-stream": "^1.4.3", - "events-to-array": "^2.0.3", - "mutate-fs": "^2.1.1", - "nock": "^13.5.4", - "prettier": "^3.2.5", - "rimraf": "^5.0.5", - "tap": "^18.7.2", - "tshy": "^1.13.1", - "typedoc": "^0.25.13" - }, - "license": "ISC", - "engines": { - "node": ">=18" - }, - "files": [ - "dist" - ], - "tap": { - "coverage-map": "map.js", - "timeout": 0, - "typecheck": true - }, - "prettier": { - "experimentalTernaries": true, - "semi": false, - "printWidth": 70, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - }, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts", - "./c": "./src/create.ts", - "./create": "./src/create.ts", - "./replace": "./src/create.ts", - "./r": "./src/create.ts", - "./list": "./src/list.ts", - "./t": "./src/list.ts", - "./update": "./src/update.ts", - "./u": "./src/update.ts", - "./extract": "./src/extract.ts", - "./x": "./src/extract.ts", - "./pack": "./src/pack.ts", - "./unpack": "./src/unpack.ts", - "./parse": "./src/parse.ts", - "./read-entry": "./src/read-entry.ts", - "./write-entry": "./src/write-entry.ts", - "./header": "./src/header.ts", - "./pax": "./src/pax.ts", - "./types": "./src/types.ts" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "source": "./src/index.ts", - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "source": "./src/index.ts", - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./c": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./create": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./replace": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./r": { - "import": { - "source": "./src/create.ts", - "types": "./dist/esm/create.d.ts", - "default": "./dist/esm/create.js" - }, - "require": { - "source": "./src/create.ts", - "types": "./dist/commonjs/create.d.ts", - "default": "./dist/commonjs/create.js" - } - }, - "./list": { - "import": { - "source": "./src/list.ts", - "types": "./dist/esm/list.d.ts", - "default": "./dist/esm/list.js" - }, - "require": { - "source": "./src/list.ts", - "types": "./dist/commonjs/list.d.ts", - "default": "./dist/commonjs/list.js" - } - }, - "./t": { - "import": { - "source": "./src/list.ts", - "types": "./dist/esm/list.d.ts", - "default": "./dist/esm/list.js" - }, - "require": { - "source": "./src/list.ts", - "types": "./dist/commonjs/list.d.ts", - "default": "./dist/commonjs/list.js" - } - }, - "./update": { - "import": { - "source": "./src/update.ts", - "types": "./dist/esm/update.d.ts", - "default": "./dist/esm/update.js" - }, - "require": { - "source": "./src/update.ts", - "types": "./dist/commonjs/update.d.ts", - "default": "./dist/commonjs/update.js" - } - }, - "./u": { - "import": { - "source": "./src/update.ts", - "types": "./dist/esm/update.d.ts", - "default": "./dist/esm/update.js" - }, - "require": { - "source": "./src/update.ts", - "types": "./dist/commonjs/update.d.ts", - "default": "./dist/commonjs/update.js" - } - }, - "./extract": { - "import": { - "source": "./src/extract.ts", - "types": "./dist/esm/extract.d.ts", - "default": "./dist/esm/extract.js" - }, - "require": { - "source": "./src/extract.ts", - "types": "./dist/commonjs/extract.d.ts", - "default": "./dist/commonjs/extract.js" - } - }, - "./x": { - "import": { - "source": "./src/extract.ts", - "types": "./dist/esm/extract.d.ts", - "default": "./dist/esm/extract.js" - }, - "require": { - "source": "./src/extract.ts", - "types": "./dist/commonjs/extract.d.ts", - "default": "./dist/commonjs/extract.js" - } - }, - "./pack": { - "import": { - "source": "./src/pack.ts", - "types": "./dist/esm/pack.d.ts", - "default": "./dist/esm/pack.js" - }, - "require": { - "source": "./src/pack.ts", - "types": "./dist/commonjs/pack.d.ts", - "default": "./dist/commonjs/pack.js" - } - }, - "./unpack": { - "import": { - "source": "./src/unpack.ts", - "types": "./dist/esm/unpack.d.ts", - "default": "./dist/esm/unpack.js" - }, - "require": { - "source": "./src/unpack.ts", - "types": "./dist/commonjs/unpack.d.ts", - "default": "./dist/commonjs/unpack.js" - } - }, - "./parse": { - "import": { - "source": "./src/parse.ts", - "types": "./dist/esm/parse.d.ts", - "default": "./dist/esm/parse.js" - }, - "require": { - "source": "./src/parse.ts", - "types": "./dist/commonjs/parse.d.ts", - "default": "./dist/commonjs/parse.js" - } - }, - "./read-entry": { - "import": { - "source": "./src/read-entry.ts", - "types": "./dist/esm/read-entry.d.ts", - "default": "./dist/esm/read-entry.js" - }, - "require": { - "source": "./src/read-entry.ts", - "types": "./dist/commonjs/read-entry.d.ts", - "default": "./dist/commonjs/read-entry.js" - } - }, - "./write-entry": { - "import": { - "source": "./src/write-entry.ts", - "types": "./dist/esm/write-entry.d.ts", - "default": "./dist/esm/write-entry.js" - }, - "require": { - "source": "./src/write-entry.ts", - "types": "./dist/commonjs/write-entry.d.ts", - "default": "./dist/commonjs/write-entry.js" - } - }, - "./header": { - "import": { - "source": "./src/header.ts", - "types": "./dist/esm/header.d.ts", - "default": "./dist/esm/header.js" - }, - "require": { - "source": "./src/header.ts", - "types": "./dist/commonjs/header.d.ts", - "default": "./dist/commonjs/header.js" - } - }, - "./pax": { - "import": { - "source": "./src/pax.ts", - "types": "./dist/esm/pax.d.ts", - "default": "./dist/esm/pax.js" - }, - "require": { - "source": "./src/pax.ts", - "types": "./dist/commonjs/pax.d.ts", - "default": "./dist/commonjs/pax.js" - } - }, - "./types": { - "import": { - "source": "./src/types.ts", - "types": "./dist/esm/types.d.ts", - "default": "./dist/esm/types.js" - }, - "require": { - "source": "./src/types.ts", - "types": "./dist/commonjs/types.d.ts", - "default": "./dist/commonjs/types.js" - } - } - }, - "type": "module", - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts" -} diff --git a/node_modules/pacote/node_modules/yallist/LICENSE.md b/node_modules/pacote/node_modules/yallist/LICENSE.md deleted file mode 100644 index 881248b6d7f0c..0000000000000 --- a/node_modules/pacote/node_modules/yallist/LICENSE.md +++ /dev/null @@ -1,63 +0,0 @@ -All packages under `src/` are licensed according to the terms in -their respective `LICENSE` or `LICENSE.md` files. - -The remainder of this project is licensed under the Blue Oak -Model License, as follows: - ------ - -# Blue Oak Model License - -Version 1.0.0 - -## Purpose - -This license gives everyone as much permission to work with -this software as possible, while protecting contributors -from liability. - -## Acceptance - -In order to receive this license, you must agree to its -rules. The rules of this license are both obligations -under that agreement and conditions to your license. -You must not do anything with this software that triggers -a rule that you cannot or will not follow. - -## Copyright - -Each contributor licenses you to do everything with this -software that would otherwise infringe that contributor's -copyright in it. - -## Notices - -You must ensure that everyone who gets a copy of -any part of this software from you, with or without -changes, also gets the text of this license or a link to -. - -## Excuse - -If anyone notifies you in writing that you have not -complied with [Notices](#notices), you can keep your -license by taking all practical steps to comply within 30 -days after the notice. If you do not do so, your license -ends immediately. - -## Patent - -Each contributor licenses you to do everything with this -software that would otherwise infringe any patent claims -they can license or become able to license. - -## Reliability - -No contributor can revoke this license. - -## No Liability - -***As far as the law allows, this software comes as is, -without any warranty or condition, and no contributor -will be liable to anyone for any damages related to this -software or this license, under any kind of legal claim.*** diff --git a/node_modules/pacote/node_modules/yallist/dist/commonjs/index.js b/node_modules/pacote/node_modules/yallist/dist/commonjs/index.js deleted file mode 100644 index c1e1e4741689d..0000000000000 --- a/node_modules/pacote/node_modules/yallist/dist/commonjs/index.js +++ /dev/null @@ -1,384 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Node = exports.Yallist = void 0; -class Yallist { - tail; - head; - length = 0; - static create(list = []) { - return new Yallist(list); - } - constructor(list = []) { - for (const item of list) { - this.push(item); - } - } - *[Symbol.iterator]() { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value; - } - } - removeNode(node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list'); - } - const next = node.next; - const prev = node.prev; - if (next) { - next.prev = prev; - } - if (prev) { - prev.next = next; - } - if (node === this.head) { - this.head = next; - } - if (node === this.tail) { - this.tail = prev; - } - this.length--; - node.next = undefined; - node.prev = undefined; - node.list = undefined; - return next; - } - unshiftNode(node) { - if (node === this.head) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const head = this.head; - node.list = this; - node.next = head; - if (head) { - head.prev = node; - } - this.head = node; - if (!this.tail) { - this.tail = node; - } - this.length++; - } - pushNode(node) { - if (node === this.tail) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const tail = this.tail; - node.list = this; - node.prev = tail; - if (tail) { - tail.next = node; - } - this.tail = node; - if (!this.head) { - this.head = node; - } - this.length++; - } - push(...args) { - for (let i = 0, l = args.length; i < l; i++) { - push(this, args[i]); - } - return this.length; - } - unshift(...args) { - for (var i = 0, l = args.length; i < l; i++) { - unshift(this, args[i]); - } - return this.length; - } - pop() { - if (!this.tail) { - return undefined; - } - const res = this.tail.value; - const t = this.tail; - this.tail = this.tail.prev; - if (this.tail) { - this.tail.next = undefined; - } - else { - this.head = undefined; - } - t.list = undefined; - this.length--; - return res; - } - shift() { - if (!this.head) { - return undefined; - } - const res = this.head.value; - const h = this.head; - this.head = this.head.next; - if (this.head) { - this.head.prev = undefined; - } - else { - this.tail = undefined; - } - h.list = undefined; - this.length--; - return res; - } - forEach(fn, thisp) { - thisp = thisp || this; - for (let walker = this.head, i = 0; !!walker; i++) { - fn.call(thisp, walker.value, i, this); - walker = walker.next; - } - } - forEachReverse(fn, thisp) { - thisp = thisp || this; - for (let walker = this.tail, i = this.length - 1; !!walker; i--) { - fn.call(thisp, walker.value, i, this); - walker = walker.prev; - } - } - get(n) { - let i = 0; - let walker = this.head; - for (; !!walker && i < n; i++) { - walker = walker.next; - } - if (i === n && !!walker) { - return walker.value; - } - } - getReverse(n) { - let i = 0; - let walker = this.tail; - for (; !!walker && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev; - } - if (i === n && !!walker) { - return walker.value; - } - } - map(fn, thisp) { - thisp = thisp || this; - const res = new Yallist(); - for (let walker = this.head; !!walker;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.next; - } - return res; - } - mapReverse(fn, thisp) { - thisp = thisp || this; - var res = new Yallist(); - for (let walker = this.tail; !!walker;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.prev; - } - return res; - } - reduce(fn, initial) { - let acc; - let walker = this.head; - if (arguments.length > 1) { - acc = initial; - } - else if (this.head) { - walker = this.head.next; - acc = this.head.value; - } - else { - throw new TypeError('Reduce of empty list with no initial value'); - } - for (var i = 0; !!walker; i++) { - acc = fn(acc, walker.value, i); - walker = walker.next; - } - return acc; - } - reduceReverse(fn, initial) { - let acc; - let walker = this.tail; - if (arguments.length > 1) { - acc = initial; - } - else if (this.tail) { - walker = this.tail.prev; - acc = this.tail.value; - } - else { - throw new TypeError('Reduce of empty list with no initial value'); - } - for (let i = this.length - 1; !!walker; i--) { - acc = fn(acc, walker.value, i); - walker = walker.prev; - } - return acc; - } - toArray() { - const arr = new Array(this.length); - for (let i = 0, walker = this.head; !!walker; i++) { - arr[i] = walker.value; - walker = walker.next; - } - return arr; - } - toArrayReverse() { - const arr = new Array(this.length); - for (let i = 0, walker = this.tail; !!walker; i++) { - arr[i] = walker.value; - walker = walker.prev; - } - return arr; - } - slice(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let walker = this.head; - let i = 0; - for (i = 0; !!walker && i < from; i++) { - walker = walker.next; - } - for (; !!walker && i < to; i++, walker = walker.next) { - ret.push(walker.value); - } - return ret; - } - sliceReverse(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let i = this.length; - let walker = this.tail; - for (; !!walker && i > to; i--) { - walker = walker.prev; - } - for (; !!walker && i > from; i--, walker = walker.prev) { - ret.push(walker.value); - } - return ret; - } - splice(start, deleteCount = 0, ...nodes) { - if (start > this.length) { - start = this.length - 1; - } - if (start < 0) { - start = this.length + start; - } - let walker = this.head; - for (let i = 0; !!walker && i < start; i++) { - walker = walker.next; - } - const ret = []; - for (let i = 0; !!walker && i < deleteCount; i++) { - ret.push(walker.value); - walker = this.removeNode(walker); - } - if (!walker) { - walker = this.tail; - } - else if (walker !== this.tail) { - walker = walker.prev; - } - for (const v of nodes) { - walker = insertAfter(this, walker, v); - } - return ret; - } - reverse() { - const head = this.head; - const tail = this.tail; - for (let walker = head; !!walker; walker = walker.prev) { - const p = walker.prev; - walker.prev = walker.next; - walker.next = p; - } - this.head = tail; - this.tail = head; - return this; - } -} -exports.Yallist = Yallist; -// insertAfter undefined means "make the node the new head of list" -function insertAfter(self, node, value) { - const prev = node; - const next = node ? node.next : self.head; - const inserted = new Node(value, prev, next, self); - if (inserted.next === undefined) { - self.tail = inserted; - } - if (inserted.prev === undefined) { - self.head = inserted; - } - self.length++; - return inserted; -} -function push(self, item) { - self.tail = new Node(item, self.tail, undefined, self); - if (!self.head) { - self.head = self.tail; - } - self.length++; -} -function unshift(self, item) { - self.head = new Node(item, undefined, self.head, self); - if (!self.tail) { - self.tail = self.head; - } - self.length++; -} -class Node { - list; - next; - prev; - value; - constructor(value, prev, next, list) { - this.list = list; - this.value = value; - if (prev) { - prev.next = this; - this.prev = prev; - } - else { - this.prev = undefined; - } - if (next) { - next.prev = this; - this.next = next; - } - else { - this.next = undefined; - } - } -} -exports.Node = Node; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/yallist/dist/commonjs/package.json b/node_modules/pacote/node_modules/yallist/dist/commonjs/package.json deleted file mode 100644 index 5bbefffbabee3..0000000000000 --- a/node_modules/pacote/node_modules/yallist/dist/commonjs/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/pacote/node_modules/yallist/dist/esm/index.js b/node_modules/pacote/node_modules/yallist/dist/esm/index.js deleted file mode 100644 index 3d81c5113b93a..0000000000000 --- a/node_modules/pacote/node_modules/yallist/dist/esm/index.js +++ /dev/null @@ -1,379 +0,0 @@ -export class Yallist { - tail; - head; - length = 0; - static create(list = []) { - return new Yallist(list); - } - constructor(list = []) { - for (const item of list) { - this.push(item); - } - } - *[Symbol.iterator]() { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value; - } - } - removeNode(node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list'); - } - const next = node.next; - const prev = node.prev; - if (next) { - next.prev = prev; - } - if (prev) { - prev.next = next; - } - if (node === this.head) { - this.head = next; - } - if (node === this.tail) { - this.tail = prev; - } - this.length--; - node.next = undefined; - node.prev = undefined; - node.list = undefined; - return next; - } - unshiftNode(node) { - if (node === this.head) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const head = this.head; - node.list = this; - node.next = head; - if (head) { - head.prev = node; - } - this.head = node; - if (!this.tail) { - this.tail = node; - } - this.length++; - } - pushNode(node) { - if (node === this.tail) { - return; - } - if (node.list) { - node.list.removeNode(node); - } - const tail = this.tail; - node.list = this; - node.prev = tail; - if (tail) { - tail.next = node; - } - this.tail = node; - if (!this.head) { - this.head = node; - } - this.length++; - } - push(...args) { - for (let i = 0, l = args.length; i < l; i++) { - push(this, args[i]); - } - return this.length; - } - unshift(...args) { - for (var i = 0, l = args.length; i < l; i++) { - unshift(this, args[i]); - } - return this.length; - } - pop() { - if (!this.tail) { - return undefined; - } - const res = this.tail.value; - const t = this.tail; - this.tail = this.tail.prev; - if (this.tail) { - this.tail.next = undefined; - } - else { - this.head = undefined; - } - t.list = undefined; - this.length--; - return res; - } - shift() { - if (!this.head) { - return undefined; - } - const res = this.head.value; - const h = this.head; - this.head = this.head.next; - if (this.head) { - this.head.prev = undefined; - } - else { - this.tail = undefined; - } - h.list = undefined; - this.length--; - return res; - } - forEach(fn, thisp) { - thisp = thisp || this; - for (let walker = this.head, i = 0; !!walker; i++) { - fn.call(thisp, walker.value, i, this); - walker = walker.next; - } - } - forEachReverse(fn, thisp) { - thisp = thisp || this; - for (let walker = this.tail, i = this.length - 1; !!walker; i--) { - fn.call(thisp, walker.value, i, this); - walker = walker.prev; - } - } - get(n) { - let i = 0; - let walker = this.head; - for (; !!walker && i < n; i++) { - walker = walker.next; - } - if (i === n && !!walker) { - return walker.value; - } - } - getReverse(n) { - let i = 0; - let walker = this.tail; - for (; !!walker && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev; - } - if (i === n && !!walker) { - return walker.value; - } - } - map(fn, thisp) { - thisp = thisp || this; - const res = new Yallist(); - for (let walker = this.head; !!walker;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.next; - } - return res; - } - mapReverse(fn, thisp) { - thisp = thisp || this; - var res = new Yallist(); - for (let walker = this.tail; !!walker;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.prev; - } - return res; - } - reduce(fn, initial) { - let acc; - let walker = this.head; - if (arguments.length > 1) { - acc = initial; - } - else if (this.head) { - walker = this.head.next; - acc = this.head.value; - } - else { - throw new TypeError('Reduce of empty list with no initial value'); - } - for (var i = 0; !!walker; i++) { - acc = fn(acc, walker.value, i); - walker = walker.next; - } - return acc; - } - reduceReverse(fn, initial) { - let acc; - let walker = this.tail; - if (arguments.length > 1) { - acc = initial; - } - else if (this.tail) { - walker = this.tail.prev; - acc = this.tail.value; - } - else { - throw new TypeError('Reduce of empty list with no initial value'); - } - for (let i = this.length - 1; !!walker; i--) { - acc = fn(acc, walker.value, i); - walker = walker.prev; - } - return acc; - } - toArray() { - const arr = new Array(this.length); - for (let i = 0, walker = this.head; !!walker; i++) { - arr[i] = walker.value; - walker = walker.next; - } - return arr; - } - toArrayReverse() { - const arr = new Array(this.length); - for (let i = 0, walker = this.tail; !!walker; i++) { - arr[i] = walker.value; - walker = walker.prev; - } - return arr; - } - slice(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let walker = this.head; - let i = 0; - for (i = 0; !!walker && i < from; i++) { - walker = walker.next; - } - for (; !!walker && i < to; i++, walker = walker.next) { - ret.push(walker.value); - } - return ret; - } - sliceReverse(from = 0, to = this.length) { - if (to < 0) { - to += this.length; - } - if (from < 0) { - from += this.length; - } - const ret = new Yallist(); - if (to < from || to < 0) { - return ret; - } - if (from < 0) { - from = 0; - } - if (to > this.length) { - to = this.length; - } - let i = this.length; - let walker = this.tail; - for (; !!walker && i > to; i--) { - walker = walker.prev; - } - for (; !!walker && i > from; i--, walker = walker.prev) { - ret.push(walker.value); - } - return ret; - } - splice(start, deleteCount = 0, ...nodes) { - if (start > this.length) { - start = this.length - 1; - } - if (start < 0) { - start = this.length + start; - } - let walker = this.head; - for (let i = 0; !!walker && i < start; i++) { - walker = walker.next; - } - const ret = []; - for (let i = 0; !!walker && i < deleteCount; i++) { - ret.push(walker.value); - walker = this.removeNode(walker); - } - if (!walker) { - walker = this.tail; - } - else if (walker !== this.tail) { - walker = walker.prev; - } - for (const v of nodes) { - walker = insertAfter(this, walker, v); - } - return ret; - } - reverse() { - const head = this.head; - const tail = this.tail; - for (let walker = head; !!walker; walker = walker.prev) { - const p = walker.prev; - walker.prev = walker.next; - walker.next = p; - } - this.head = tail; - this.tail = head; - return this; - } -} -// insertAfter undefined means "make the node the new head of list" -function insertAfter(self, node, value) { - const prev = node; - const next = node ? node.next : self.head; - const inserted = new Node(value, prev, next, self); - if (inserted.next === undefined) { - self.tail = inserted; - } - if (inserted.prev === undefined) { - self.head = inserted; - } - self.length++; - return inserted; -} -function push(self, item) { - self.tail = new Node(item, self.tail, undefined, self); - if (!self.head) { - self.head = self.tail; - } - self.length++; -} -function unshift(self, item) { - self.head = new Node(item, undefined, self.head, self); - if (!self.tail) { - self.tail = self.head; - } - self.length++; -} -export class Node { - list; - next; - prev; - value; - constructor(value, prev, next, list) { - this.list = list; - this.value = value; - if (prev) { - prev.next = this; - this.prev = prev; - } - else { - this.prev = undefined; - } - if (next) { - next.prev = this; - this.next = next; - } - else { - this.next = undefined; - } - } -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/pacote/node_modules/yallist/dist/esm/package.json b/node_modules/pacote/node_modules/yallist/dist/esm/package.json deleted file mode 100644 index 3dbc1ca591c05..0000000000000 --- a/node_modules/pacote/node_modules/yallist/dist/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} diff --git a/node_modules/pacote/node_modules/yallist/package.json b/node_modules/pacote/node_modules/yallist/package.json deleted file mode 100644 index 2f5247808bbea..0000000000000 --- a/node_modules/pacote/node_modules/yallist/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "yallist", - "version": "5.0.0", - "description": "Yet Another Linked List", - "files": [ - "dist" - ], - "devDependencies": { - "prettier": "^3.2.5", - "tap": "^18.7.2", - "tshy": "^1.13.1", - "typedoc": "^0.25.13" - }, - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "prepare": "tshy", - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "test": "tap", - "snap": "tap", - "format": "prettier --write . --loglevel warn --ignore-path ../../.prettierignore --cache", - "typedoc": "typedoc" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "BlueOak-1.0.0", - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "type": "module", - "prettier": { - "semi": false, - "printWidth": 70, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - }, - "engines": { - "node": ">=18" - } -} diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js b/node_modules/tar/dist/commonjs/create.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/create.js rename to node_modules/tar/dist/commonjs/create.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js b/node_modules/tar/dist/commonjs/cwd-error.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/cwd-error.js rename to node_modules/tar/dist/commonjs/cwd-error.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js b/node_modules/tar/dist/commonjs/extract.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/extract.js rename to node_modules/tar/dist/commonjs/extract.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js b/node_modules/tar/dist/commonjs/get-write-flag.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/get-write-flag.js rename to node_modules/tar/dist/commonjs/get-write-flag.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js b/node_modules/tar/dist/commonjs/header.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/header.js rename to node_modules/tar/dist/commonjs/header.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js b/node_modules/tar/dist/commonjs/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/index.js rename to node_modules/tar/dist/commonjs/index.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js b/node_modules/tar/dist/commonjs/large-numbers.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/large-numbers.js rename to node_modules/tar/dist/commonjs/large-numbers.js diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/list.js b/node_modules/tar/dist/commonjs/list.js similarity index 94% rename from node_modules/pacote/node_modules/tar/dist/commonjs/list.js rename to node_modules/tar/dist/commonjs/list.js index 3cd34bb4bad48..3bc56453f5ed6 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/list.js +++ b/node_modules/tar/dist/commonjs/list.js @@ -77,15 +77,17 @@ const listFileSync = (opt) => { const file = opt.file; let fd; try { - const stat = node_fs_1.default.statSync(file); + fd = node_fs_1.default.openSync(file, 'r'); + const stat = node_fs_1.default.fstatSync(fd); const readSize = opt.maxReadSize || 16 * 1024 * 1024; if (stat.size < readSize) { - p.end(node_fs_1.default.readFileSync(file)); + const buf = Buffer.allocUnsafe(stat.size); + node_fs_1.default.readSync(fd, buf, 0, stat.size, 0); + p.end(buf); } else { let pos = 0; const buf = Buffer.allocUnsafe(readSize); - fd = node_fs_1.default.openSync(file, 'r'); while (pos < stat.size) { const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos); pos += bytesRead; diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js b/node_modules/tar/dist/commonjs/make-command.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/make-command.js rename to node_modules/tar/dist/commonjs/make-command.js diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/mkdir.js b/node_modules/tar/dist/commonjs/mkdir.js similarity index 71% rename from node_modules/pacote/node_modules/tar/dist/commonjs/mkdir.js rename to node_modules/tar/dist/commonjs/mkdir.js index 2b13ecbab6723..606619efbcde3 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/mkdir.js +++ b/node_modules/tar/dist/commonjs/mkdir.js @@ -5,16 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.mkdirSync = exports.mkdir = void 0; const chownr_1 = require("chownr"); -const fs_1 = __importDefault(require("fs")); -const mkdirp_1 = require("mkdirp"); +const node_fs_1 = __importDefault(require("node:fs")); +const promises_1 = __importDefault(require("node:fs/promises")); const node_path_1 = __importDefault(require("node:path")); const cwd_error_js_1 = require("./cwd-error.js"); const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); const symlink_error_js_1 = require("./symlink-error.js"); -const cGet = (cache, key) => cache.get((0, normalize_windows_path_js_1.normalizeWindowsPath)(key)); -const cSet = (cache, key, val) => cache.set((0, normalize_windows_path_js_1.normalizeWindowsPath)(key), val); const checkCwd = (dir, cb) => { - fs_1.default.stat(dir, (er, st) => { + node_fs_1.default.stat(dir, (er, st) => { if (er || !st.isDirectory()) { er = new cwd_error_js_1.CwdError(dir, er?.code || 'ENOTDIR'); } @@ -22,7 +20,7 @@ const checkCwd = (dir, cb) => { }); }; /** - * Wrapper around mkdirp for tar's needs. + * Wrapper around fs/promises.mkdir for tar's needs. * * The main purpose is to avoid creating directories if we know that * they already exist (and track which ones exist for this purpose), @@ -44,68 +42,60 @@ const mkdir = (dir, opt, cb) => { (uid !== opt.processUid || gid !== opt.processGid); const preserve = opt.preserve; const unlink = opt.unlink; - const cache = opt.cache; const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); const done = (er, created) => { if (er) { cb(er); } else { - cSet(cache, dir, true); if (created && doChown) { (0, chownr_1.chownr)(created, uid, gid, er => done(er)); } else if (needChmod) { - fs_1.default.chmod(dir, mode, cb); + node_fs_1.default.chmod(dir, mode, cb); } else { cb(); } } }; - if (cache && cGet(cache, dir) === true) { - return done(); - } if (dir === cwd) { return checkCwd(dir, done); } if (preserve) { - return (0, mkdirp_1.mkdirp)(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts + return promises_1.default.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts done); } const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); const parts = sub.split('/'); - mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); + mkdir_(cwd, parts, mode, unlink, cwd, undefined, done); }; exports.mkdir = mkdir; -const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { +const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => { if (!parts.length) { return cb(null, created); } const p = parts.shift(); const part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(base + '/' + p)); - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); }; -const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { +const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => { if (er) { - fs_1.default.lstat(part, (statEr, st) => { + node_fs_1.default.lstat(part, (statEr, st) => { if (statEr) { statEr.path = statEr.path && (0, normalize_windows_path_js_1.normalizeWindowsPath)(statEr.path); cb(statEr); } else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + mkdir_(part, parts, mode, unlink, cwd, created, cb); } else if (unlink) { - fs_1.default.unlink(part, er => { + node_fs_1.default.unlink(part, er => { if (er) { return cb(er); } - fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + node_fs_1.default.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); }); } else if (st.isSymbolicLink()) { @@ -118,14 +108,14 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => } else { created = created || part; - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + mkdir_(part, parts, mode, unlink, cwd, created, cb); } }; const checkCwdSync = (dir) => { let ok = false; let code = undefined; try { - ok = fs_1.default.statSync(dir).isDirectory(); + ok = node_fs_1.default.statSync(dir).isDirectory(); } catch (er) { code = er?.code; @@ -151,51 +141,40 @@ const mkdirSync = (dir, opt) => { (uid !== opt.processUid || gid !== opt.processGid); const preserve = opt.preserve; const unlink = opt.unlink; - const cache = opt.cache; const cwd = (0, normalize_windows_path_js_1.normalizeWindowsPath)(opt.cwd); const done = (created) => { - cSet(cache, dir, true); if (created && doChown) { (0, chownr_1.chownrSync)(created, uid, gid); } if (needChmod) { - fs_1.default.chmodSync(dir, mode); + node_fs_1.default.chmodSync(dir, mode); } }; - if (cache && cGet(cache, dir) === true) { - return done(); - } if (dir === cwd) { checkCwdSync(cwd); return done(); } if (preserve) { - return done((0, mkdirp_1.mkdirpSync)(dir, mode) ?? undefined); + return done(node_fs_1.default.mkdirSync(dir, { mode, recursive: true }) ?? undefined); } const sub = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.relative(cwd, dir)); const parts = sub.split('/'); let created = undefined; for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { part = (0, normalize_windows_path_js_1.normalizeWindowsPath)(node_path_1.default.resolve(part)); - if (cGet(cache, part)) { - continue; - } try { - fs_1.default.mkdirSync(part, mode); + node_fs_1.default.mkdirSync(part, mode); created = created || part; - cSet(cache, part, true); } catch (er) { - const st = fs_1.default.lstatSync(part); + const st = node_fs_1.default.lstatSync(part); if (st.isDirectory()) { - cSet(cache, part, true); continue; } else if (unlink) { - fs_1.default.unlinkSync(part); - fs_1.default.mkdirSync(part, mode); + node_fs_1.default.unlinkSync(part); + node_fs_1.default.mkdirSync(part, mode); created = created || part; - cSet(cache, part, true); continue; } else if (st.isSymbolicLink()) { diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js b/node_modules/tar/dist/commonjs/mode-fix.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/mode-fix.js rename to node_modules/tar/dist/commonjs/mode-fix.js diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/normalize-unicode.js b/node_modules/tar/dist/commonjs/normalize-unicode.js similarity index 50% rename from node_modules/pacote/node_modules/tar/dist/commonjs/normalize-unicode.js rename to node_modules/tar/dist/commonjs/normalize-unicode.js index 2f08ce46d98c4..6ce3342d43bcf 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/normalize-unicode.js +++ b/node_modules/tar/dist/commonjs/normalize-unicode.js @@ -6,12 +6,29 @@ exports.normalizeUnicode = void 0; // within npm install on large package trees. // Do not edit without careful benchmarking. const normalizeCache = Object.create(null); -const { hasOwnProperty } = Object.prototype; +// Limit the size of this. Very low-sophistication LRU cache +const MAX = 10000; +const cache = new Set(); const normalizeUnicode = (s) => { - if (!hasOwnProperty.call(normalizeCache, s)) { + if (!cache.has(s)) { normalizeCache[s] = s.normalize('NFD'); } - return normalizeCache[s]; + else { + cache.delete(s); + } + cache.add(s); + const ret = normalizeCache[s]; + let i = cache.size - MAX; + // only prune when we're 10% over the max + if (i > MAX / 10) { + for (const s of cache) { + cache.delete(s); + delete normalizeCache[s]; + if (--i <= 0) + break; + } + } + return ret; }; exports.normalizeUnicode = normalizeUnicode; //# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js b/node_modules/tar/dist/commonjs/normalize-windows-path.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/normalize-windows-path.js rename to node_modules/tar/dist/commonjs/normalize-windows-path.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js b/node_modules/tar/dist/commonjs/options.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/options.js rename to node_modules/tar/dist/commonjs/options.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js b/node_modules/tar/dist/commonjs/pack.js similarity index 93% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js rename to node_modules/tar/dist/commonjs/pack.js index 303e93063c2db..07e921ca959bf 100644 --- a/node_modules/node-gyp/node_modules/tar/dist/commonjs/pack.js +++ b/node_modules/tar/dist/commonjs/pack.js @@ -102,6 +102,14 @@ class Pack extends minipass_1.Minipass { jobs; [WRITEENTRYCLASS]; onWriteEntry; + // Note: we actually DO need a linked list here, because we + // shift() to update the head of the list where we start, but still + // while that happens, need to know what the next item in the queue + // will be. Since we do multiple jobs in parallel, it's not as simple + // as just an Array.shift(), since that would lose the information about + // the next job in the list. We could add a .next field on the PackJob + // class, but then we'd have to be tracking the tail of the queue the + // whole time, and Yallist just does that for us anyway. [QUEUE]; [JOBS] = 0; [PROCESSING] = false; @@ -126,9 +134,9 @@ class Pack extends minipass_1.Minipass { this.on('warn', opt.onwarn); } this.portable = !!opt.portable; - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError('gzip and brotli are mutually exclusive'); + if (opt.gzip || opt.brotli || opt.zstd) { + if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) > 1) { + throw new TypeError('gzip, brotli, zstd are mutually exclusive'); } if (opt.gzip) { if (typeof opt.gzip !== 'object') { @@ -145,6 +153,12 @@ class Pack extends minipass_1.Minipass { } this.zip = new zlib.BrotliCompress(opt.brotli); } + if (opt.zstd) { + if (typeof opt.zstd !== 'object') { + opt.zstd = {}; + } + this.zip = new zlib.ZstdCompress(opt.zstd); + } /* c8 ignore next */ if (!this.zip) throw new Error('impossible'); diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json b/node_modules/tar/dist/commonjs/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/package.json rename to node_modules/tar/dist/commonjs/package.json diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/parse.js b/node_modules/tar/dist/commonjs/parse.js similarity index 93% rename from node_modules/pacote/node_modules/tar/dist/commonjs/parse.js rename to node_modules/tar/dist/commonjs/parse.js index 9746a25899e6e..0222b5547439f 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/parse.js +++ b/node_modules/tar/dist/commonjs/parse.js @@ -3,7 +3,7 @@ // the full 512 bytes of a header to come in. We will Buffer.concat() // it to the next write(), which is a mem copy, but a small one. // -// this[QUEUE] is a Yallist of entries that haven't been emitted +// this[QUEUE] is a list of entries that haven't been emitted // yet this can only get filled up if the user keeps write()ing after // a write() returns false, or does a write() with more than one entry // @@ -22,13 +22,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Parser = void 0; const events_1 = require("events"); const minizlib_1 = require("minizlib"); -const yallist_1 = require("yallist"); const header_js_1 = require("./header.js"); const pax_js_1 = require("./pax.js"); const read_entry_js_1 = require("./read-entry.js"); const warn_method_js_1 = require("./warn-method.js"); const maxMetaEntrySize = 1024 * 1024; const gzipHeader = Buffer.from([0x1f, 0x8b]); +const zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd]); +const ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length); const STATE = Symbol('state'); const WRITEENTRY = Symbol('writeEntry'); const READENTRY = Symbol('readEntry'); @@ -66,9 +67,10 @@ class Parser extends events_1.EventEmitter { maxMetaEntrySize; filter; brotli; + zstd; writable = true; readable = false; - [QUEUE] = new yallist_1.Yallist(); + [QUEUE] = []; [BUFFER]; [READENTRY]; [WRITEENTRY]; @@ -118,9 +120,17 @@ class Parser extends events_1.EventEmitter { // if it's a tbr file it MIGHT be brotli, but we don't know until // we look at it and verify it's not a valid tar file. this.brotli = - !opt.gzip && opt.brotli !== undefined ? opt.brotli + !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli : isTBR ? undefined : false; + // zstd has magic bytes to identify it, but we also support explicit options + // and file extension detection + const isTZST = opt.file && + (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst')); + this.zstd = + !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd + : isTZST ? true + : undefined; // have to set this so that streams are ok piping into it this.on('end', () => this[CLOSESTREAM]()); if (typeof opt.onwarn === 'function') { @@ -374,7 +384,7 @@ class Parser extends events_1.EventEmitter { cb?.(); return false; } - // first write, might be gzipped + // first write, might be gzipped, zstd, or brotli compressed const needSniff = this[UNZIP] === undefined || (this.brotli === undefined && this[UNZIP] === false); if (needSniff && chunk) { @@ -382,7 +392,7 @@ class Parser extends events_1.EventEmitter { chunk = Buffer.concat([this[BUFFER], chunk]); this[BUFFER] = undefined; } - if (chunk.length < gzipHeader.length) { + if (chunk.length < ZIP_HEADER_LEN) { this[BUFFER] = chunk; /* c8 ignore next */ cb?.(); @@ -394,7 +404,18 @@ class Parser extends events_1.EventEmitter { this[UNZIP] = false; } } - const maybeBrotli = this.brotli === undefined; + // look for zstd header if gzip header not found + let isZstd = false; + if (this[UNZIP] === false && this.zstd !== false) { + isZstd = true; + for (let i = 0; i < zstdHeader.length; i++) { + if (chunk[i] !== zstdHeader[i]) { + isZstd = false; + break; + } + } + } + const maybeBrotli = this.brotli === undefined && !isZstd; if (this[UNZIP] === false && maybeBrotli) { // read the first header to see if it's a valid tar file. If so, // we can safely assume that it's not actually brotli, despite the @@ -424,13 +445,15 @@ class Parser extends events_1.EventEmitter { } } if (this[UNZIP] === undefined || - (this[UNZIP] === false && this.brotli)) { + (this[UNZIP] === false && (this.brotli || isZstd))) { const ended = this[ENDED]; this[ENDED] = false; this[UNZIP] = this[UNZIP] === undefined ? new minizlib_1.Unzip({}) - : new minizlib_1.BrotliDecompress({}); + : isZstd ? + new minizlib_1.ZstdDecompress({}) + : new minizlib_1.BrotliDecompress({}); this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); this[UNZIP].on('error', er => this.abort(er)); this[UNZIP].on('end', () => { @@ -585,7 +608,7 @@ class Parser extends events_1.EventEmitter { } else { this[ENDED] = true; - if (this.brotli === undefined) + if (this.brotli === undefined || this.zstd === undefined) chunk = chunk || Buffer.alloc(0); if (chunk) this.write(chunk); diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js b/node_modules/tar/dist/commonjs/path-reservations.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/path-reservations.js rename to node_modules/tar/dist/commonjs/path-reservations.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js b/node_modules/tar/dist/commonjs/pax.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/pax.js rename to node_modules/tar/dist/commonjs/pax.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js b/node_modules/tar/dist/commonjs/read-entry.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/read-entry.js rename to node_modules/tar/dist/commonjs/read-entry.js diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/replace.js b/node_modules/tar/dist/commonjs/replace.js similarity index 99% rename from node_modules/pacote/node_modules/tar/dist/commonjs/replace.js rename to node_modules/tar/dist/commonjs/replace.js index 262deecd12f9f..5442c2a5bde5e 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/replace.js +++ b/node_modules/tar/dist/commonjs/replace.js @@ -220,6 +220,7 @@ exports.replace = (0, make_command_js_1.makeCommand)(replaceSync, replaceAsync, } if (opt.gzip || opt.brotli || + opt.zstd || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { throw new TypeError('cannot append to compressed archives'); diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js b/node_modules/tar/dist/commonjs/strip-absolute-path.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-absolute-path.js rename to node_modules/tar/dist/commonjs/strip-absolute-path.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js b/node_modules/tar/dist/commonjs/strip-trailing-slashes.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/strip-trailing-slashes.js rename to node_modules/tar/dist/commonjs/strip-trailing-slashes.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js b/node_modules/tar/dist/commonjs/symlink-error.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/symlink-error.js rename to node_modules/tar/dist/commonjs/symlink-error.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js b/node_modules/tar/dist/commonjs/types.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/types.js rename to node_modules/tar/dist/commonjs/types.js diff --git a/node_modules/pacote/node_modules/tar/dist/commonjs/unpack.js b/node_modules/tar/dist/commonjs/unpack.js similarity index 92% rename from node_modules/pacote/node_modules/tar/dist/commonjs/unpack.js rename to node_modules/tar/dist/commonjs/unpack.js index edf8acbb18c40..23b1f81156dbd 100644 --- a/node_modules/pacote/node_modules/tar/dist/commonjs/unpack.js +++ b/node_modules/tar/dist/commonjs/unpack.js @@ -39,17 +39,14 @@ const node_fs_1 = __importDefault(require("node:fs")); const node_path_1 = __importDefault(require("node:path")); const get_write_flag_js_1 = require("./get-write-flag.js"); const mkdir_js_1 = require("./mkdir.js"); -const normalize_unicode_js_1 = require("./normalize-unicode.js"); const normalize_windows_path_js_1 = require("./normalize-windows-path.js"); const parse_js_1 = require("./parse.js"); const strip_absolute_path_js_1 = require("./strip-absolute-path.js"); -const strip_trailing_slashes_js_1 = require("./strip-trailing-slashes.js"); const wc = __importStar(require("./winchars.js")); const path_reservations_js_1 = require("./path-reservations.js"); const ONENTRY = Symbol('onEntry'); const CHECKFS = Symbol('checkFs'); const CHECKFS2 = Symbol('checkFs2'); -const PRUNECACHE = Symbol('pruneCache'); const ISREUSABLE = Symbol('isReusable'); const MAKEFS = Symbol('makeFs'); const FILE = Symbol('file'); @@ -117,31 +114,6 @@ const unlinkFileSync = (path) => { const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a : b !== undefined && b === b >>> 0 ? b : c; -// clear the cache if it's a case-insensitive unicode-squashing match. -// we can't know if the current file system is case-sensitive or supports -// unicode fully, so we check for similarity on the maximally compatible -// representation. Err on the side of pruning, since all it's doing is -// preventing lstats, and it's not the end of the world if we get a false -// positive. -// Note that on windows, we always drop the entire cache whenever a -// symbolic link is encountered, because 8.3 filenames are impossible -// to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = (path) => (0, strip_trailing_slashes_js_1.stripTrailingSlashes)((0, normalize_windows_path_js_1.normalizeWindowsPath)((0, normalize_unicode_js_1.normalizeUnicode)(path))).toLowerCase(); -// remove all cache entries matching ${abs}/** -const pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs); - for (const path of cache.keys()) { - const pnorm = cacheKeyNormalize(path); - if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { - cache.delete(path); - } - } -}; -const dropCache = (cache) => { - for (const key of cache.keys()) { - cache.delete(key); - } -}; class Unpack extends parse_js_1.Parser { [ENDED] = false; [CHECKED_CWD] = false; @@ -150,7 +122,6 @@ class Unpack extends parse_js_1.Parser { transform; writable = true; readable = false; - dirCache; uid; gid; setOwner; @@ -179,7 +150,6 @@ class Unpack extends parse_js_1.Parser { }; super(opt); this.transform = opt.transform; - this.dirCache = opt.dirCache || new Map(); this.chmod = !!opt.chmod; if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { // need both or neither @@ -404,7 +374,6 @@ class Unpack extends parse_js_1.Parser { umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, - cache: this.dirCache, cwd: this.cwd, mode: mode, }, cb); @@ -582,28 +551,8 @@ class Unpack extends parse_js_1.Parser { } this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); } - [PRUNECACHE](entry) { - // if we are not creating a directory, and the path is in the dirCache, - // then that means we are about to delete the directory we created - // previously, and it is no longer going to be a directory, and neither - // is any of its children. - // If a symbolic link is encountered, all bets are off. There is no - // reasonable way to sanitize the cache in such a way we will be able to - // avoid having filesystem collisions. If this happens with a non-symlink - // entry, it'll just fail to unpack, but a symlink to a directory, using an - // 8.3 shortname or certain unicode attacks, can evade detection and lead - // to arbitrary writes to anywhere on the system. - if (entry.type === 'SymbolicLink') { - dropCache(this.dirCache); - } - else if (entry.type !== 'Directory') { - pruneCache(this.dirCache, String(entry.absolute)); - } - } [CHECKFS2](entry, fullyDone) { - this[PRUNECACHE](entry); const done = (er) => { - this[PRUNECACHE](entry); fullyDone(er); }; const checkCwd = () => { @@ -732,7 +681,6 @@ class UnpackSync extends Unpack { return super[MAKEFS](er, entry, () => { }); } [CHECKFS](entry) { - this[PRUNECACHE](entry); if (!this[CHECKED_CWD]) { const er = this[MKDIR](this.cwd, this.dmode); if (er) { @@ -804,10 +752,15 @@ class UnpackSync extends Unpack { let fd; try { fd = node_fs_1.default.openSync(String(entry.absolute), (0, get_write_flag_js_1.getWriteFlag)(entry.size), mode); + /* c8 ignore start - This is only a problem if the file was successfully + * statted, BUT failed to open. Testing this is annoying, and we + * already have ample testint for other uses of oner() methods. + */ } catch (er) { return oner(er); } + /* c8 ignore stop */ const tx = this.transform ? this.transform(entry) || entry : entry; if (tx !== entry) { tx.on('error', (er) => this[ONERROR](er, entry)); @@ -894,7 +847,6 @@ class UnpackSync extends Unpack { umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, - cache: this.dirCache, cwd: this.cwd, mode: mode, }); diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js b/node_modules/tar/dist/commonjs/update.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/update.js rename to node_modules/tar/dist/commonjs/update.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js b/node_modules/tar/dist/commonjs/warn-method.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/warn-method.js rename to node_modules/tar/dist/commonjs/warn-method.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js b/node_modules/tar/dist/commonjs/winchars.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/winchars.js rename to node_modules/tar/dist/commonjs/winchars.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js b/node_modules/tar/dist/commonjs/write-entry.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/commonjs/write-entry.js rename to node_modules/tar/dist/commonjs/write-entry.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/create.js b/node_modules/tar/dist/esm/create.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/create.js rename to node_modules/tar/dist/esm/create.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js b/node_modules/tar/dist/esm/cwd-error.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/cwd-error.js rename to node_modules/tar/dist/esm/cwd-error.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/extract.js b/node_modules/tar/dist/esm/extract.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/extract.js rename to node_modules/tar/dist/esm/extract.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js b/node_modules/tar/dist/esm/get-write-flag.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/get-write-flag.js rename to node_modules/tar/dist/esm/get-write-flag.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/header.js b/node_modules/tar/dist/esm/header.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/header.js rename to node_modules/tar/dist/esm/header.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/index.js b/node_modules/tar/dist/esm/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/index.js rename to node_modules/tar/dist/esm/index.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js b/node_modules/tar/dist/esm/large-numbers.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/large-numbers.js rename to node_modules/tar/dist/esm/large-numbers.js diff --git a/node_modules/pacote/node_modules/tar/dist/esm/list.js b/node_modules/tar/dist/esm/list.js similarity index 93% rename from node_modules/pacote/node_modules/tar/dist/esm/list.js rename to node_modules/tar/dist/esm/list.js index f49068400b6c9..489ece51b9fa3 100644 --- a/node_modules/pacote/node_modules/tar/dist/esm/list.js +++ b/node_modules/tar/dist/esm/list.js @@ -47,15 +47,17 @@ const listFileSync = (opt) => { const file = opt.file; let fd; try { - const stat = fs.statSync(file); + fd = fs.openSync(file, 'r'); + const stat = fs.fstatSync(fd); const readSize = opt.maxReadSize || 16 * 1024 * 1024; if (stat.size < readSize) { - p.end(fs.readFileSync(file)); + const buf = Buffer.allocUnsafe(stat.size); + fs.readSync(fd, buf, 0, stat.size, 0); + p.end(buf); } else { let pos = 0; const buf = Buffer.allocUnsafe(readSize); - fd = fs.openSync(file, 'r'); while (pos < stat.size) { const bytesRead = fs.readSync(fd, buf, 0, readSize, pos); pos += bytesRead; diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js b/node_modules/tar/dist/esm/make-command.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/make-command.js rename to node_modules/tar/dist/esm/make-command.js diff --git a/node_modules/pacote/node_modules/tar/dist/esm/mkdir.js b/node_modules/tar/dist/esm/mkdir.js similarity index 77% rename from node_modules/pacote/node_modules/tar/dist/esm/mkdir.js rename to node_modules/tar/dist/esm/mkdir.js index 13498ef0082f0..9dba701f2973f 100644 --- a/node_modules/pacote/node_modules/tar/dist/esm/mkdir.js +++ b/node_modules/tar/dist/esm/mkdir.js @@ -1,12 +1,10 @@ import { chownr, chownrSync } from 'chownr'; -import fs from 'fs'; -import { mkdirp, mkdirpSync } from 'mkdirp'; +import fs from 'node:fs'; +import fsp from 'node:fs/promises'; import path from 'node:path'; import { CwdError } from './cwd-error.js'; import { normalizeWindowsPath } from './normalize-windows-path.js'; import { SymlinkError } from './symlink-error.js'; -const cGet = (cache, key) => cache.get(normalizeWindowsPath(key)); -const cSet = (cache, key, val) => cache.set(normalizeWindowsPath(key), val); const checkCwd = (dir, cb) => { fs.stat(dir, (er, st) => { if (er || !st.isDirectory()) { @@ -16,7 +14,7 @@ const checkCwd = (dir, cb) => { }); }; /** - * Wrapper around mkdirp for tar's needs. + * Wrapper around fs/promises.mkdir for tar's needs. * * The main purpose is to avoid creating directories if we know that * they already exist (and track which ones exist for this purpose), @@ -38,14 +36,12 @@ export const mkdir = (dir, opt, cb) => { (uid !== opt.processUid || gid !== opt.processGid); const preserve = opt.preserve; const unlink = opt.unlink; - const cache = opt.cache; const cwd = normalizeWindowsPath(opt.cwd); const done = (er, created) => { if (er) { cb(er); } else { - cSet(cache, dir, true); if (created && doChown) { chownr(created, uid, gid, er => done(er)); } @@ -57,32 +53,26 @@ export const mkdir = (dir, opt, cb) => { } } }; - if (cache && cGet(cache, dir) === true) { - return done(); - } if (dir === cwd) { return checkCwd(dir, done); } if (preserve) { - return mkdirp(dir, { mode }).then(made => done(null, made ?? undefined), // oh, ts + return fsp.mkdir(dir, { mode, recursive: true }).then(made => done(null, made ?? undefined), // oh, ts done); } const sub = normalizeWindowsPath(path.relative(cwd, dir)); const parts = sub.split('/'); - mkdir_(cwd, parts, mode, cache, unlink, cwd, undefined, done); + mkdir_(cwd, parts, mode, unlink, cwd, undefined, done); }; -const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { +const mkdir_ = (base, parts, mode, unlink, cwd, created, cb) => { if (!parts.length) { return cb(null, created); } const p = parts.shift(); const part = normalizeWindowsPath(path.resolve(base + '/' + p)); - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); - } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); }; -const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => { +const onmkdir = (part, parts, mode, unlink, cwd, created, cb) => (er) => { if (er) { fs.lstat(part, (statEr, st) => { if (statEr) { @@ -91,14 +81,14 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => cb(statEr); } else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + mkdir_(part, parts, mode, unlink, cwd, created, cb); } else if (unlink) { fs.unlink(part, er => { if (er) { return cb(er); } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)); + fs.mkdir(part, mode, onmkdir(part, parts, mode, unlink, cwd, created, cb)); }); } else if (st.isSymbolicLink()) { @@ -111,7 +101,7 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => (er) => } else { created = created || part; - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb); + mkdir_(part, parts, mode, unlink, cwd, created, cb); } }; const checkCwdSync = (dir) => { @@ -144,10 +134,8 @@ export const mkdirSync = (dir, opt) => { (uid !== opt.processUid || gid !== opt.processGid); const preserve = opt.preserve; const unlink = opt.unlink; - const cache = opt.cache; const cwd = normalizeWindowsPath(opt.cwd); const done = (created) => { - cSet(cache, dir, true); if (created && doChown) { chownrSync(created, uid, gid); } @@ -155,40 +143,31 @@ export const mkdirSync = (dir, opt) => { fs.chmodSync(dir, mode); } }; - if (cache && cGet(cache, dir) === true) { - return done(); - } if (dir === cwd) { checkCwdSync(cwd); return done(); } if (preserve) { - return done(mkdirpSync(dir, mode) ?? undefined); + return done(fs.mkdirSync(dir, { mode, recursive: true }) ?? undefined); } const sub = normalizeWindowsPath(path.relative(cwd, dir)); const parts = sub.split('/'); let created = undefined; for (let p = parts.shift(), part = cwd; p && (part += '/' + p); p = parts.shift()) { part = normalizeWindowsPath(path.resolve(part)); - if (cGet(cache, part)) { - continue; - } try { fs.mkdirSync(part, mode); created = created || part; - cSet(cache, part, true); } catch (er) { const st = fs.lstatSync(part); if (st.isDirectory()) { - cSet(cache, part, true); continue; } else if (unlink) { fs.unlinkSync(part); fs.mkdirSync(part, mode); created = created || part; - cSet(cache, part, true); continue; } else if (st.isSymbolicLink()) { diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js b/node_modules/tar/dist/esm/mode-fix.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/mode-fix.js rename to node_modules/tar/dist/esm/mode-fix.js diff --git a/node_modules/tar/dist/esm/normalize-unicode.js b/node_modules/tar/dist/esm/normalize-unicode.js new file mode 100644 index 0000000000000..e9b8f14b01347 --- /dev/null +++ b/node_modules/tar/dist/esm/normalize-unicode.js @@ -0,0 +1,30 @@ +// warning: extremely hot code path. +// This has been meticulously optimized for use +// within npm install on large package trees. +// Do not edit without careful benchmarking. +const normalizeCache = Object.create(null); +// Limit the size of this. Very low-sophistication LRU cache +const MAX = 10000; +const cache = new Set(); +export const normalizeUnicode = (s) => { + if (!cache.has(s)) { + normalizeCache[s] = s.normalize('NFD'); + } + else { + cache.delete(s); + } + cache.add(s); + const ret = normalizeCache[s]; + let i = cache.size - MAX; + // only prune when we're 10% over the max + if (i > MAX / 10) { + for (const s of cache) { + cache.delete(s); + delete normalizeCache[s]; + if (--i <= 0) + break; + } + } + return ret; +}; +//# sourceMappingURL=normalize-unicode.js.map \ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js b/node_modules/tar/dist/esm/normalize-windows-path.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/normalize-windows-path.js rename to node_modules/tar/dist/esm/normalize-windows-path.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/options.js b/node_modules/tar/dist/esm/options.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/options.js rename to node_modules/tar/dist/esm/options.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js b/node_modules/tar/dist/esm/pack.js similarity index 92% rename from node_modules/node-gyp/node_modules/tar/dist/esm/pack.js rename to node_modules/tar/dist/esm/pack.js index f59f32f94201f..14661783455d5 100644 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/pack.js +++ b/node_modules/tar/dist/esm/pack.js @@ -72,6 +72,14 @@ export class Pack extends Minipass { jobs; [WRITEENTRYCLASS]; onWriteEntry; + // Note: we actually DO need a linked list here, because we + // shift() to update the head of the list where we start, but still + // while that happens, need to know what the next item in the queue + // will be. Since we do multiple jobs in parallel, it's not as simple + // as just an Array.shift(), since that would lose the information about + // the next job in the list. We could add a .next field on the PackJob + // class, but then we'd have to be tracking the tail of the queue the + // whole time, and Yallist just does that for us anyway. [QUEUE]; [JOBS] = 0; [PROCESSING] = false; @@ -96,9 +104,9 @@ export class Pack extends Minipass { this.on('warn', opt.onwarn); } this.portable = !!opt.portable; - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError('gzip and brotli are mutually exclusive'); + if (opt.gzip || opt.brotli || opt.zstd) { + if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) > 1) { + throw new TypeError('gzip, brotli, zstd are mutually exclusive'); } if (opt.gzip) { if (typeof opt.gzip !== 'object') { @@ -115,6 +123,12 @@ export class Pack extends Minipass { } this.zip = new zlib.BrotliCompress(opt.brotli); } + if (opt.zstd) { + if (typeof opt.zstd !== 'object') { + opt.zstd = {}; + } + this.zip = new zlib.ZstdCompress(opt.zstd); + } /* c8 ignore next */ if (!this.zip) throw new Error('impossible'); diff --git a/node_modules/node-gyp/node_modules/chownr/dist/esm/package.json b/node_modules/tar/dist/esm/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/chownr/dist/esm/package.json rename to node_modules/tar/dist/esm/package.json diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js b/node_modules/tar/dist/esm/parse.js similarity index 92% rename from node_modules/node-gyp/node_modules/tar/dist/esm/parse.js rename to node_modules/tar/dist/esm/parse.js index cce430479cd0c..5b6bfe4bc4f15 100644 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/parse.js +++ b/node_modules/tar/dist/esm/parse.js @@ -2,7 +2,7 @@ // the full 512 bytes of a header to come in. We will Buffer.concat() // it to the next write(), which is a mem copy, but a small one. // -// this[QUEUE] is a Yallist of entries that haven't been emitted +// this[QUEUE] is a list of entries that haven't been emitted // yet this can only get filled up if the user keeps write()ing after // a write() returns false, or does a write() with more than one entry // @@ -18,14 +18,15 @@ // // ignored entries get .resume() called on them straight away import { EventEmitter as EE } from 'events'; -import { BrotliDecompress, Unzip } from 'minizlib'; -import { Yallist } from 'yallist'; +import { BrotliDecompress, Unzip, ZstdDecompress } from 'minizlib'; import { Header } from './header.js'; import { Pax } from './pax.js'; import { ReadEntry } from './read-entry.js'; import { warnMethod, } from './warn-method.js'; const maxMetaEntrySize = 1024 * 1024; const gzipHeader = Buffer.from([0x1f, 0x8b]); +const zstdHeader = Buffer.from([0x28, 0xb5, 0x2f, 0xfd]); +const ZIP_HEADER_LEN = Math.max(gzipHeader.length, zstdHeader.length); const STATE = Symbol('state'); const WRITEENTRY = Symbol('writeEntry'); const READENTRY = Symbol('readEntry'); @@ -63,9 +64,10 @@ export class Parser extends EE { maxMetaEntrySize; filter; brotli; + zstd; writable = true; readable = false; - [QUEUE] = new Yallist(); + [QUEUE] = []; [BUFFER]; [READENTRY]; [WRITEENTRY]; @@ -115,9 +117,17 @@ export class Parser extends EE { // if it's a tbr file it MIGHT be brotli, but we don't know until // we look at it and verify it's not a valid tar file. this.brotli = - !opt.gzip && opt.brotli !== undefined ? opt.brotli + !(opt.gzip || opt.zstd) && opt.brotli !== undefined ? opt.brotli : isTBR ? undefined : false; + // zstd has magic bytes to identify it, but we also support explicit options + // and file extension detection + const isTZST = opt.file && + (opt.file.endsWith('.tar.zst') || opt.file.endsWith('.tzst')); + this.zstd = + !(opt.gzip || opt.brotli) && opt.zstd !== undefined ? opt.zstd + : isTZST ? true + : undefined; // have to set this so that streams are ok piping into it this.on('end', () => this[CLOSESTREAM]()); if (typeof opt.onwarn === 'function') { @@ -371,7 +381,7 @@ export class Parser extends EE { cb?.(); return false; } - // first write, might be gzipped + // first write, might be gzipped, zstd, or brotli compressed const needSniff = this[UNZIP] === undefined || (this.brotli === undefined && this[UNZIP] === false); if (needSniff && chunk) { @@ -379,7 +389,7 @@ export class Parser extends EE { chunk = Buffer.concat([this[BUFFER], chunk]); this[BUFFER] = undefined; } - if (chunk.length < gzipHeader.length) { + if (chunk.length < ZIP_HEADER_LEN) { this[BUFFER] = chunk; /* c8 ignore next */ cb?.(); @@ -391,7 +401,18 @@ export class Parser extends EE { this[UNZIP] = false; } } - const maybeBrotli = this.brotli === undefined; + // look for zstd header if gzip header not found + let isZstd = false; + if (this[UNZIP] === false && this.zstd !== false) { + isZstd = true; + for (let i = 0; i < zstdHeader.length; i++) { + if (chunk[i] !== zstdHeader[i]) { + isZstd = false; + break; + } + } + } + const maybeBrotli = this.brotli === undefined && !isZstd; if (this[UNZIP] === false && maybeBrotli) { // read the first header to see if it's a valid tar file. If so, // we can safely assume that it's not actually brotli, despite the @@ -421,13 +442,15 @@ export class Parser extends EE { } } if (this[UNZIP] === undefined || - (this[UNZIP] === false && this.brotli)) { + (this[UNZIP] === false && (this.brotli || isZstd))) { const ended = this[ENDED]; this[ENDED] = false; this[UNZIP] = this[UNZIP] === undefined ? new Unzip({}) - : new BrotliDecompress({}); + : isZstd ? + new ZstdDecompress({}) + : new BrotliDecompress({}); this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)); this[UNZIP].on('error', er => this.abort(er)); this[UNZIP].on('end', () => { @@ -582,7 +605,7 @@ export class Parser extends EE { } else { this[ENDED] = true; - if (this.brotli === undefined) + if (this.brotli === undefined || this.zstd === undefined) chunk = chunk || Buffer.alloc(0); if (chunk) this.write(chunk); diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js b/node_modules/tar/dist/esm/path-reservations.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/path-reservations.js rename to node_modules/tar/dist/esm/path-reservations.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/pax.js b/node_modules/tar/dist/esm/pax.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/pax.js rename to node_modules/tar/dist/esm/pax.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js b/node_modules/tar/dist/esm/read-entry.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/read-entry.js rename to node_modules/tar/dist/esm/read-entry.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js b/node_modules/tar/dist/esm/replace.js similarity index 99% rename from node_modules/node-gyp/node_modules/tar/dist/esm/replace.js rename to node_modules/tar/dist/esm/replace.js index bab622bfdf1f1..214aa92446cc6 100644 --- a/node_modules/node-gyp/node_modules/tar/dist/esm/replace.js +++ b/node_modules/tar/dist/esm/replace.js @@ -214,6 +214,7 @@ export const replace = makeCommand(replaceSync, replaceAsync, } if (opt.gzip || opt.brotli || + opt.zstd || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { throw new TypeError('cannot append to compressed archives'); diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js b/node_modules/tar/dist/esm/strip-absolute-path.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/strip-absolute-path.js rename to node_modules/tar/dist/esm/strip-absolute-path.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js b/node_modules/tar/dist/esm/strip-trailing-slashes.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/strip-trailing-slashes.js rename to node_modules/tar/dist/esm/strip-trailing-slashes.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js b/node_modules/tar/dist/esm/symlink-error.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/symlink-error.js rename to node_modules/tar/dist/esm/symlink-error.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/types.js b/node_modules/tar/dist/esm/types.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/types.js rename to node_modules/tar/dist/esm/types.js diff --git a/node_modules/pacote/node_modules/tar/dist/esm/unpack.js b/node_modules/tar/dist/esm/unpack.js similarity index 92% rename from node_modules/pacote/node_modules/tar/dist/esm/unpack.js rename to node_modules/tar/dist/esm/unpack.js index 6e744cfc1a6f9..4e8fc5c117a05 100644 --- a/node_modules/pacote/node_modules/tar/dist/esm/unpack.js +++ b/node_modules/tar/dist/esm/unpack.js @@ -10,17 +10,14 @@ import fs from 'node:fs'; import path from 'node:path'; import { getWriteFlag } from './get-write-flag.js'; import { mkdir, mkdirSync } from './mkdir.js'; -import { normalizeUnicode } from './normalize-unicode.js'; import { normalizeWindowsPath } from './normalize-windows-path.js'; import { Parser } from './parse.js'; import { stripAbsolutePath } from './strip-absolute-path.js'; -import { stripTrailingSlashes } from './strip-trailing-slashes.js'; import * as wc from './winchars.js'; import { PathReservations } from './path-reservations.js'; const ONENTRY = Symbol('onEntry'); const CHECKFS = Symbol('checkFs'); const CHECKFS2 = Symbol('checkFs2'); -const PRUNECACHE = Symbol('pruneCache'); const ISREUSABLE = Symbol('isReusable'); const MAKEFS = Symbol('makeFs'); const FILE = Symbol('file'); @@ -88,31 +85,6 @@ const unlinkFileSync = (path) => { const uint32 = (a, b, c) => a !== undefined && a === a >>> 0 ? a : b !== undefined && b === b >>> 0 ? b : c; -// clear the cache if it's a case-insensitive unicode-squashing match. -// we can't know if the current file system is case-sensitive or supports -// unicode fully, so we check for similarity on the maximally compatible -// representation. Err on the side of pruning, since all it's doing is -// preventing lstats, and it's not the end of the world if we get a false -// positive. -// Note that on windows, we always drop the entire cache whenever a -// symbolic link is encountered, because 8.3 filenames are impossible -// to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = (path) => stripTrailingSlashes(normalizeWindowsPath(normalizeUnicode(path))).toLowerCase(); -// remove all cache entries matching ${abs}/** -const pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs); - for (const path of cache.keys()) { - const pnorm = cacheKeyNormalize(path); - if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { - cache.delete(path); - } - } -}; -const dropCache = (cache) => { - for (const key of cache.keys()) { - cache.delete(key); - } -}; export class Unpack extends Parser { [ENDED] = false; [CHECKED_CWD] = false; @@ -121,7 +93,6 @@ export class Unpack extends Parser { transform; writable = true; readable = false; - dirCache; uid; gid; setOwner; @@ -150,7 +121,6 @@ export class Unpack extends Parser { }; super(opt); this.transform = opt.transform; - this.dirCache = opt.dirCache || new Map(); this.chmod = !!opt.chmod; if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { // need both or neither @@ -375,7 +345,6 @@ export class Unpack extends Parser { umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, - cache: this.dirCache, cwd: this.cwd, mode: mode, }, cb); @@ -553,28 +522,8 @@ export class Unpack extends Parser { } this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)); } - [PRUNECACHE](entry) { - // if we are not creating a directory, and the path is in the dirCache, - // then that means we are about to delete the directory we created - // previously, and it is no longer going to be a directory, and neither - // is any of its children. - // If a symbolic link is encountered, all bets are off. There is no - // reasonable way to sanitize the cache in such a way we will be able to - // avoid having filesystem collisions. If this happens with a non-symlink - // entry, it'll just fail to unpack, but a symlink to a directory, using an - // 8.3 shortname or certain unicode attacks, can evade detection and lead - // to arbitrary writes to anywhere on the system. - if (entry.type === 'SymbolicLink') { - dropCache(this.dirCache); - } - else if (entry.type !== 'Directory') { - pruneCache(this.dirCache, String(entry.absolute)); - } - } [CHECKFS2](entry, fullyDone) { - this[PRUNECACHE](entry); const done = (er) => { - this[PRUNECACHE](entry); fullyDone(er); }; const checkCwd = () => { @@ -702,7 +651,6 @@ export class UnpackSync extends Unpack { return super[MAKEFS](er, entry, () => { }); } [CHECKFS](entry) { - this[PRUNECACHE](entry); if (!this[CHECKED_CWD]) { const er = this[MKDIR](this.cwd, this.dmode); if (er) { @@ -774,10 +722,15 @@ export class UnpackSync extends Unpack { let fd; try { fd = fs.openSync(String(entry.absolute), getWriteFlag(entry.size), mode); + /* c8 ignore start - This is only a problem if the file was successfully + * statted, BUT failed to open. Testing this is annoying, and we + * already have ample testint for other uses of oner() methods. + */ } catch (er) { return oner(er); } + /* c8 ignore stop */ const tx = this.transform ? this.transform(entry) || entry : entry; if (tx !== entry) { tx.on('error', (er) => this[ONERROR](er, entry)); @@ -864,7 +817,6 @@ export class UnpackSync extends Unpack { umask: this.processUmask, preserve: this.preservePaths, unlink: this.unlink, - cache: this.dirCache, cwd: this.cwd, mode: mode, }); diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/update.js b/node_modules/tar/dist/esm/update.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/update.js rename to node_modules/tar/dist/esm/update.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js b/node_modules/tar/dist/esm/warn-method.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/warn-method.js rename to node_modules/tar/dist/esm/warn-method.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js b/node_modules/tar/dist/esm/winchars.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/winchars.js rename to node_modules/tar/dist/esm/winchars.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js b/node_modules/tar/dist/esm/write-entry.js similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/write-entry.js rename to node_modules/tar/dist/esm/write-entry.js diff --git a/node_modules/tar/index.js b/node_modules/tar/index.js deleted file mode 100644 index c9ae06e7906c4..0000000000000 --- a/node_modules/tar/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict' - -// high-level commands -exports.c = exports.create = require('./lib/create.js') -exports.r = exports.replace = require('./lib/replace.js') -exports.t = exports.list = require('./lib/list.js') -exports.u = exports.update = require('./lib/update.js') -exports.x = exports.extract = require('./lib/extract.js') - -// classes -exports.Pack = require('./lib/pack.js') -exports.Unpack = require('./lib/unpack.js') -exports.Parse = require('./lib/parse.js') -exports.ReadEntry = require('./lib/read-entry.js') -exports.WriteEntry = require('./lib/write-entry.js') -exports.Header = require('./lib/header.js') -exports.Pax = require('./lib/pax.js') -exports.types = require('./lib/types.js') diff --git a/node_modules/tar/lib/create.js b/node_modules/tar/lib/create.js deleted file mode 100644 index 9c860d4e4a764..0000000000000 --- a/node_modules/tar/lib/create.js +++ /dev/null @@ -1,111 +0,0 @@ -'use strict' - -// tar -c -const hlo = require('./high-level-opt.js') - -const Pack = require('./pack.js') -const fsm = require('fs-minipass') -const t = require('./list.js') -const path = require('path') - -module.exports = (opt_, files, cb) => { - if (typeof files === 'function') { - cb = files - } - - if (Array.isArray(opt_)) { - files = opt_, opt_ = {} - } - - if (!files || !Array.isArray(files) || !files.length) { - throw new TypeError('no files or directories specified') - } - - files = Array.from(files) - - const opt = hlo(opt_) - - if (opt.sync && typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions') - } - - if (!opt.file && typeof cb === 'function') { - throw new TypeError('callback only supported with file option') - } - - return opt.file && opt.sync ? createFileSync(opt, files) - : opt.file ? createFile(opt, files, cb) - : opt.sync ? createSync(opt, files) - : create(opt, files) -} - -const createFileSync = (opt, files) => { - const p = new Pack.Sync(opt) - const stream = new fsm.WriteStreamSync(opt.file, { - mode: opt.mode || 0o666, - }) - p.pipe(stream) - addFilesSync(p, files) -} - -const createFile = (opt, files, cb) => { - const p = new Pack(opt) - const stream = new fsm.WriteStream(opt.file, { - mode: opt.mode || 0o666, - }) - p.pipe(stream) - - const promise = new Promise((res, rej) => { - stream.on('error', rej) - stream.on('close', res) - p.on('error', rej) - }) - - addFilesAsync(p, files) - - return cb ? promise.then(cb, cb) : promise -} - -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - t({ - file: path.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onentry: entry => p.add(entry), - }) - } else { - p.add(file) - } - }) - p.end() -} - -const addFilesAsync = (p, files) => { - while (files.length) { - const file = files.shift() - if (file.charAt(0) === '@') { - return t({ - file: path.resolve(p.cwd, file.slice(1)), - noResume: true, - onentry: entry => p.add(entry), - }).then(_ => addFilesAsync(p, files)) - } else { - p.add(file) - } - } - p.end() -} - -const createSync = (opt, files) => { - const p = new Pack.Sync(opt) - addFilesSync(p, files) - return p -} - -const create = (opt, files) => { - const p = new Pack(opt) - addFilesAsync(p, files) - return p -} diff --git a/node_modules/tar/lib/extract.js b/node_modules/tar/lib/extract.js deleted file mode 100644 index 54767982583f2..0000000000000 --- a/node_modules/tar/lib/extract.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict' - -// tar -x -const hlo = require('./high-level-opt.js') -const Unpack = require('./unpack.js') -const fs = require('fs') -const fsm = require('fs-minipass') -const path = require('path') -const stripSlash = require('./strip-trailing-slashes.js') - -module.exports = (opt_, files, cb) => { - if (typeof opt_ === 'function') { - cb = opt_, files = null, opt_ = {} - } else if (Array.isArray(opt_)) { - files = opt_, opt_ = {} - } - - if (typeof files === 'function') { - cb = files, files = null - } - - if (!files) { - files = [] - } else { - files = Array.from(files) - } - - const opt = hlo(opt_) - - if (opt.sync && typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions') - } - - if (!opt.file && typeof cb === 'function') { - throw new TypeError('callback only supported with file option') - } - - if (files.length) { - filesFilter(opt, files) - } - - return opt.file && opt.sync ? extractFileSync(opt) - : opt.file ? extractFile(opt, cb) - : opt.sync ? extractSync(opt) - : extract(opt) -} - -// construct a filter that limits the file entries listed -// include child entries if a dir is included -const filesFilter = (opt, files) => { - const map = new Map(files.map(f => [stripSlash(f), true])) - const filter = opt.filter - - const mapHas = (file, r) => { - const root = r || path.parse(file).root || '.' - const ret = file === root ? false - : map.has(file) ? map.get(file) - : mapHas(path.dirname(file), root) - - map.set(file, ret) - return ret - } - - opt.filter = filter - ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file)) - : file => mapHas(stripSlash(file)) -} - -const extractFileSync = opt => { - const u = new Unpack.Sync(opt) - - const file = opt.file - const stat = fs.statSync(file) - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - const readSize = opt.maxReadSize || 16 * 1024 * 1024 - const stream = new fsm.ReadStreamSync(file, { - readSize: readSize, - size: stat.size, - }) - stream.pipe(u) -} - -const extractFile = (opt, cb) => { - const u = new Unpack(opt) - const readSize = opt.maxReadSize || 16 * 1024 * 1024 - - const file = opt.file - const p = new Promise((resolve, reject) => { - u.on('error', reject) - u.on('close', resolve) - - // This trades a zero-byte read() syscall for a stat - // However, it will usually result in less memory allocation - fs.stat(file, (er, stat) => { - if (er) { - reject(er) - } else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }) - stream.on('error', reject) - stream.pipe(u) - } - }) - }) - return cb ? p.then(cb, cb) : p -} - -const extractSync = opt => new Unpack.Sync(opt) - -const extract = opt => new Unpack(opt) diff --git a/node_modules/tar/lib/get-write-flag.js b/node_modules/tar/lib/get-write-flag.js deleted file mode 100644 index e86959996623c..0000000000000 --- a/node_modules/tar/lib/get-write-flag.js +++ /dev/null @@ -1,20 +0,0 @@ -// Get the appropriate flag to use for creating files -// We use fmap on Windows platforms for files less than -// 512kb. This is a fairly low limit, but avoids making -// things slower in some cases. Since most of what this -// library is used for is extracting tarballs of many -// relatively small files in npm packages and the like, -// it can be a big boost on Windows platforms. -// Only supported in Node v12.9.0 and above. -const platform = process.env.__FAKE_PLATFORM__ || process.platform -const isWindows = platform === 'win32' -const fs = global.__FAKE_TESTING_FS__ || require('fs') - -/* istanbul ignore next */ -const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants - -const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP -const fMapLimit = 512 * 1024 -const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY -module.exports = !fMapEnabled ? () => 'w' - : size => size < fMapLimit ? fMapFlag : 'w' diff --git a/node_modules/tar/lib/header.js b/node_modules/tar/lib/header.js deleted file mode 100644 index 411d5e45e879a..0000000000000 --- a/node_modules/tar/lib/header.js +++ /dev/null @@ -1,304 +0,0 @@ -'use strict' -// parse a 512-byte header block to a data object, or vice-versa -// encode returns `true` if a pax extended header is needed, because -// the data could not be faithfully encoded in a simple header. -// (Also, check header.needPax to see if it needs a pax header.) - -const types = require('./types.js') -const pathModule = require('path').posix -const large = require('./large-numbers.js') - -const SLURP = Symbol('slurp') -const TYPE = Symbol('type') - -class Header { - constructor (data, off, ex, gex) { - this.cksumValid = false - this.needPax = false - this.nullBlock = false - - this.block = null - this.path = null - this.mode = null - this.uid = null - this.gid = null - this.size = null - this.mtime = null - this.cksum = null - this[TYPE] = '0' - this.linkpath = null - this.uname = null - this.gname = null - this.devmaj = 0 - this.devmin = 0 - this.atime = null - this.ctime = null - - if (Buffer.isBuffer(data)) { - this.decode(data, off || 0, ex, gex) - } else if (data) { - this.set(data) - } - } - - decode (buf, off, ex, gex) { - if (!off) { - off = 0 - } - - if (!buf || !(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header') - } - - this.path = decString(buf, off, 100) - this.mode = decNumber(buf, off + 100, 8) - this.uid = decNumber(buf, off + 108, 8) - this.gid = decNumber(buf, off + 116, 8) - this.size = decNumber(buf, off + 124, 12) - this.mtime = decDate(buf, off + 136, 12) - this.cksum = decNumber(buf, off + 148, 12) - - // if we have extended or global extended headers, apply them now - // See https://github.com/npm/node-tar/pull/187 - this[SLURP](ex) - this[SLURP](gex, true) - - // old tar versions marked dirs as a file with a trailing / - this[TYPE] = decString(buf, off + 156, 1) - if (this[TYPE] === '') { - this[TYPE] = '0' - } - if (this[TYPE] === '0' && this.path.slice(-1) === '/') { - this[TYPE] = '5' - } - - // tar implementations sometimes incorrectly put the stat(dir).size - // as the size in the tarball, even though Directory entries are - // not able to have any body at all. In the very rare chance that - // it actually DOES have a body, we weren't going to do anything with - // it anyway, and it'll just be a warning about an invalid header. - if (this[TYPE] === '5') { - this.size = 0 - } - - this.linkpath = decString(buf, off + 157, 100) - if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') { - this.uname = decString(buf, off + 265, 32) - this.gname = decString(buf, off + 297, 32) - this.devmaj = decNumber(buf, off + 329, 8) - this.devmin = decNumber(buf, off + 337, 8) - if (buf[off + 475] !== 0) { - // definitely a prefix, definitely >130 chars. - const prefix = decString(buf, off + 345, 155) - this.path = prefix + '/' + this.path - } else { - const prefix = decString(buf, off + 345, 130) - if (prefix) { - this.path = prefix + '/' + this.path - } - this.atime = decDate(buf, off + 476, 12) - this.ctime = decDate(buf, off + 488, 12) - } - } - - let sum = 8 * 0x20 - for (let i = off; i < off + 148; i++) { - sum += buf[i] - } - - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i] - } - - this.cksumValid = sum === this.cksum - if (this.cksum === null && sum === 8 * 0x20) { - this.nullBlock = true - } - } - - [SLURP] (ex, global) { - for (const k in ex) { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. - if (ex[k] !== null && ex[k] !== undefined && - !(global && k === 'path')) { - this[k] = ex[k] - } - } - } - - encode (buf, off) { - if (!buf) { - buf = this.block = Buffer.alloc(512) - off = 0 - } - - if (!off) { - off = 0 - } - - if (!(buf.length >= off + 512)) { - throw new Error('need 512 bytes for header') - } - - const prefixSize = this.ctime || this.atime ? 130 : 155 - const split = splitPrefix(this.path || '', prefixSize) - const path = split[0] - const prefix = split[1] - this.needPax = split[2] - - this.needPax = encString(buf, off, 100, path) || this.needPax - this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax - this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax - this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax - this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax - this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax - buf[off + 156] = this[TYPE].charCodeAt(0) - this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax - buf.write('ustar\u000000', off + 257, 8) - this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax - this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax - this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax - this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax - this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax - if (buf[off + 475] !== 0) { - this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax - } else { - this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax - this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax - this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax - } - - let sum = 8 * 0x20 - for (let i = off; i < off + 148; i++) { - sum += buf[i] - } - - for (let i = off + 156; i < off + 512; i++) { - sum += buf[i] - } - - this.cksum = sum - encNumber(buf, off + 148, 8, this.cksum) - this.cksumValid = true - - return this.needPax - } - - set (data) { - for (const i in data) { - if (data[i] !== null && data[i] !== undefined) { - this[i] = data[i] - } - } - } - - get type () { - return types.name.get(this[TYPE]) || this[TYPE] - } - - get typeKey () { - return this[TYPE] - } - - set type (type) { - if (types.code.has(type)) { - this[TYPE] = types.code.get(type) - } else { - this[TYPE] = type - } - } -} - -const splitPrefix = (p, prefixSize) => { - const pathSize = 100 - let pp = p - let prefix = '' - let ret - const root = pathModule.parse(p).root || '.' - - if (Buffer.byteLength(pp) < pathSize) { - ret = [pp, prefix, false] - } else { - // first set prefix to the dir, and path to the base - prefix = pathModule.dirname(pp) - pp = pathModule.basename(pp) - - do { - if (Buffer.byteLength(pp) <= pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // both fit! - ret = [pp, prefix, false] - } else if (Buffer.byteLength(pp) > pathSize && - Buffer.byteLength(prefix) <= prefixSize) { - // prefix fits in prefix, but path doesn't fit in path - ret = [pp.slice(0, pathSize - 1), prefix, true] - } else { - // make path take a bit from prefix - pp = pathModule.join(pathModule.basename(prefix), pp) - prefix = pathModule.dirname(prefix) - } - } while (prefix !== root && !ret) - - // at this point, found no resolution, just truncate - if (!ret) { - ret = [p.slice(0, pathSize - 1), '', true] - } - } - return ret -} - -const decString = (buf, off, size) => - buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '') - -const decDate = (buf, off, size) => - numToDate(decNumber(buf, off, size)) - -const numToDate = num => num === null ? null : new Date(num * 1000) - -const decNumber = (buf, off, size) => - buf[off] & 0x80 ? large.parse(buf.slice(off, off + size)) - : decSmallNumber(buf, off, size) - -const nanNull = value => isNaN(value) ? null : value - -const decSmallNumber = (buf, off, size) => - nanNull(parseInt( - buf.slice(off, off + size) - .toString('utf8').replace(/\0.*$/, '').trim(), 8)) - -// the maximum encodable as a null-terminated octal, by field size -const MAXNUM = { - 12: 0o77777777777, - 8: 0o7777777, -} - -const encNumber = (buf, off, size, number) => - number === null ? false : - number > MAXNUM[size] || number < 0 - ? (large.encode(number, buf.slice(off, off + size)), true) - : (encSmallNumber(buf, off, size, number), false) - -const encSmallNumber = (buf, off, size, number) => - buf.write(octalString(number, size), off, size, 'ascii') - -const octalString = (number, size) => - padOctal(Math.floor(number).toString(8), size) - -const padOctal = (string, size) => - (string.length === size - 1 ? string - : new Array(size - string.length - 1).join('0') + string + ' ') + '\0' - -const encDate = (buf, off, size, date) => - date === null ? false : - encNumber(buf, off, size, date.getTime() / 1000) - -// enough to fill the longest string we've got -const NULLS = new Array(156).join('\0') -// pad with nulls, return true if it's longer or non-ascii -const encString = (buf, off, size, string) => - string === null ? false : - (buf.write(string + NULLS, off, size, 'utf8'), - string.length !== Buffer.byteLength(string) || string.length > size) - -module.exports = Header diff --git a/node_modules/tar/lib/high-level-opt.js b/node_modules/tar/lib/high-level-opt.js deleted file mode 100644 index 40e44180e1669..0000000000000 --- a/node_modules/tar/lib/high-level-opt.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict' - -// turn tar(1) style args like `C` into the more verbose things like `cwd` - -const argmap = new Map([ - ['C', 'cwd'], - ['f', 'file'], - ['z', 'gzip'], - ['P', 'preservePaths'], - ['U', 'unlink'], - ['strip-components', 'strip'], - ['stripComponents', 'strip'], - ['keep-newer', 'newer'], - ['keepNewer', 'newer'], - ['keep-newer-files', 'newer'], - ['keepNewerFiles', 'newer'], - ['k', 'keep'], - ['keep-existing', 'keep'], - ['keepExisting', 'keep'], - ['m', 'noMtime'], - ['no-mtime', 'noMtime'], - ['p', 'preserveOwner'], - ['L', 'follow'], - ['h', 'follow'], -]) - -module.exports = opt => opt ? Object.keys(opt).map(k => [ - argmap.has(k) ? argmap.get(k) : k, opt[k], -]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {} diff --git a/node_modules/tar/lib/large-numbers.js b/node_modules/tar/lib/large-numbers.js deleted file mode 100644 index b11e72d996fde..0000000000000 --- a/node_modules/tar/lib/large-numbers.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict' -// Tar can encode large and negative numbers using a leading byte of -// 0xff for negative, and 0x80 for positive. - -const encode = (num, buf) => { - if (!Number.isSafeInteger(num)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('cannot encode number outside of javascript safe integer range') - } else if (num < 0) { - encodeNegative(num, buf) - } else { - encodePositive(num, buf) - } - return buf -} - -const encodePositive = (num, buf) => { - buf[0] = 0x80 - - for (var i = buf.length; i > 1; i--) { - buf[i - 1] = num & 0xff - num = Math.floor(num / 0x100) - } -} - -const encodeNegative = (num, buf) => { - buf[0] = 0xff - var flipped = false - num = num * -1 - for (var i = buf.length; i > 1; i--) { - var byte = num & 0xff - num = Math.floor(num / 0x100) - if (flipped) { - buf[i - 1] = onesComp(byte) - } else if (byte === 0) { - buf[i - 1] = 0 - } else { - flipped = true - buf[i - 1] = twosComp(byte) - } - } -} - -const parse = (buf) => { - const pre = buf[0] - const value = pre === 0x80 ? pos(buf.slice(1, buf.length)) - : pre === 0xff ? twos(buf) - : null - if (value === null) { - throw Error('invalid base256 encoding') - } - - if (!Number.isSafeInteger(value)) { - // The number is so large that javascript cannot represent it with integer - // precision. - throw Error('parsed number outside of javascript safe integer range') - } - - return value -} - -const twos = (buf) => { - var len = buf.length - var sum = 0 - var flipped = false - for (var i = len - 1; i > -1; i--) { - var byte = buf[i] - var f - if (flipped) { - f = onesComp(byte) - } else if (byte === 0) { - f = byte - } else { - flipped = true - f = twosComp(byte) - } - if (f !== 0) { - sum -= f * Math.pow(256, len - i - 1) - } - } - return sum -} - -const pos = (buf) => { - var len = buf.length - var sum = 0 - for (var i = len - 1; i > -1; i--) { - var byte = buf[i] - if (byte !== 0) { - sum += byte * Math.pow(256, len - i - 1) - } - } - return sum -} - -const onesComp = byte => (0xff ^ byte) & 0xff - -const twosComp = byte => ((0xff ^ byte) + 1) & 0xff - -module.exports = { - encode, - parse, -} diff --git a/node_modules/tar/lib/list.js b/node_modules/tar/lib/list.js deleted file mode 100644 index f2358c25410b5..0000000000000 --- a/node_modules/tar/lib/list.js +++ /dev/null @@ -1,139 +0,0 @@ -'use strict' - -// XXX: This shares a lot in common with extract.js -// maybe some DRY opportunity here? - -// tar -t -const hlo = require('./high-level-opt.js') -const Parser = require('./parse.js') -const fs = require('fs') -const fsm = require('fs-minipass') -const path = require('path') -const stripSlash = require('./strip-trailing-slashes.js') - -module.exports = (opt_, files, cb) => { - if (typeof opt_ === 'function') { - cb = opt_, files = null, opt_ = {} - } else if (Array.isArray(opt_)) { - files = opt_, opt_ = {} - } - - if (typeof files === 'function') { - cb = files, files = null - } - - if (!files) { - files = [] - } else { - files = Array.from(files) - } - - const opt = hlo(opt_) - - if (opt.sync && typeof cb === 'function') { - throw new TypeError('callback not supported for sync tar functions') - } - - if (!opt.file && typeof cb === 'function') { - throw new TypeError('callback only supported with file option') - } - - if (files.length) { - filesFilter(opt, files) - } - - if (!opt.noResume) { - onentryFunction(opt) - } - - return opt.file && opt.sync ? listFileSync(opt) - : opt.file ? listFile(opt, cb) - : list(opt) -} - -const onentryFunction = opt => { - const onentry = opt.onentry - opt.onentry = onentry ? e => { - onentry(e) - e.resume() - } : e => e.resume() -} - -// construct a filter that limits the file entries listed -// include child entries if a dir is included -const filesFilter = (opt, files) => { - const map = new Map(files.map(f => [stripSlash(f), true])) - const filter = opt.filter - - const mapHas = (file, r) => { - const root = r || path.parse(file).root || '.' - const ret = file === root ? false - : map.has(file) ? map.get(file) - : mapHas(path.dirname(file), root) - - map.set(file, ret) - return ret - } - - opt.filter = filter - ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file)) - : file => mapHas(stripSlash(file)) -} - -const listFileSync = opt => { - const p = list(opt) - const file = opt.file - let threw = true - let fd - try { - const stat = fs.statSync(file) - const readSize = opt.maxReadSize || 16 * 1024 * 1024 - if (stat.size < readSize) { - p.end(fs.readFileSync(file)) - } else { - let pos = 0 - const buf = Buffer.allocUnsafe(readSize) - fd = fs.openSync(file, 'r') - while (pos < stat.size) { - const bytesRead = fs.readSync(fd, buf, 0, readSize, pos) - pos += bytesRead - p.write(buf.slice(0, bytesRead)) - } - p.end() - } - threw = false - } finally { - if (threw && fd) { - try { - fs.closeSync(fd) - } catch (er) {} - } - } -} - -const listFile = (opt, cb) => { - const parse = new Parser(opt) - const readSize = opt.maxReadSize || 16 * 1024 * 1024 - - const file = opt.file - const p = new Promise((resolve, reject) => { - parse.on('error', reject) - parse.on('end', resolve) - - fs.stat(file, (er, stat) => { - if (er) { - reject(er) - } else { - const stream = new fsm.ReadStream(file, { - readSize: readSize, - size: stat.size, - }) - stream.on('error', reject) - stream.pipe(parse) - } - }) - }) - return cb ? p.then(cb, cb) : p -} - -const list = opt => new Parser(opt) diff --git a/node_modules/tar/lib/mkdir.js b/node_modules/tar/lib/mkdir.js deleted file mode 100644 index 8ee8de7852d12..0000000000000 --- a/node_modules/tar/lib/mkdir.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict' -// wrapper around mkdirp for tar's needs. - -// TODO: This should probably be a class, not functionally -// passing around state in a gazillion args. - -const mkdirp = require('mkdirp') -const fs = require('fs') -const path = require('path') -const chownr = require('chownr') -const normPath = require('./normalize-windows-path.js') - -class SymlinkError extends Error { - constructor (symlink, path) { - super('Cannot extract through symbolic link') - this.path = path - this.symlink = symlink - } - - get name () { - return 'SylinkError' - } -} - -class CwdError extends Error { - constructor (path, code) { - super(code + ': Cannot cd into \'' + path + '\'') - this.path = path - this.code = code - } - - get name () { - return 'CwdError' - } -} - -const cGet = (cache, key) => cache.get(normPath(key)) -const cSet = (cache, key, val) => cache.set(normPath(key), val) - -const checkCwd = (dir, cb) => { - fs.stat(dir, (er, st) => { - if (er || !st.isDirectory()) { - er = new CwdError(dir, er && er.code || 'ENOTDIR') - } - cb(er) - }) -} - -module.exports = (dir, opt, cb) => { - dir = normPath(dir) - - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - const umask = opt.umask - const mode = opt.mode | 0o0700 - const needChmod = (mode & umask) !== 0 - - const uid = opt.uid - const gid = opt.gid - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid) - - const preserve = opt.preserve - const unlink = opt.unlink - const cache = opt.cache - const cwd = normPath(opt.cwd) - - const done = (er, created) => { - if (er) { - cb(er) - } else { - cSet(cache, dir, true) - if (created && doChown) { - chownr(created, uid, gid, er => done(er)) - } else if (needChmod) { - fs.chmod(dir, mode, cb) - } else { - cb() - } - } - } - - if (cache && cGet(cache, dir) === true) { - return done() - } - - if (dir === cwd) { - return checkCwd(dir, done) - } - - if (preserve) { - return mkdirp(dir, { mode }).then(made => done(null, made), done) - } - - const sub = normPath(path.relative(cwd, dir)) - const parts = sub.split('/') - mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done) -} - -const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => { - if (!parts.length) { - return cb(null, created) - } - const p = parts.shift() - const part = normPath(path.resolve(base + '/' + p)) - if (cGet(cache, part)) { - return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) - } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) -} - -const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => { - if (er) { - fs.lstat(part, (statEr, st) => { - if (statEr) { - statEr.path = statEr.path && normPath(statEr.path) - cb(statEr) - } else if (st.isDirectory()) { - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) - } else if (unlink) { - fs.unlink(part, er => { - if (er) { - return cb(er) - } - fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb)) - }) - } else if (st.isSymbolicLink()) { - return cb(new SymlinkError(part, part + '/' + parts.join('/'))) - } else { - cb(er) - } - }) - } else { - created = created || part - mkdir_(part, parts, mode, cache, unlink, cwd, created, cb) - } -} - -const checkCwdSync = dir => { - let ok = false - let code = 'ENOTDIR' - try { - ok = fs.statSync(dir).isDirectory() - } catch (er) { - code = er.code - } finally { - if (!ok) { - throw new CwdError(dir, code) - } - } -} - -module.exports.sync = (dir, opt) => { - dir = normPath(dir) - // if there's any overlap between mask and mode, - // then we'll need an explicit chmod - const umask = opt.umask - const mode = opt.mode | 0o0700 - const needChmod = (mode & umask) !== 0 - - const uid = opt.uid - const gid = opt.gid - const doChown = typeof uid === 'number' && - typeof gid === 'number' && - (uid !== opt.processUid || gid !== opt.processGid) - - const preserve = opt.preserve - const unlink = opt.unlink - const cache = opt.cache - const cwd = normPath(opt.cwd) - - const done = (created) => { - cSet(cache, dir, true) - if (created && doChown) { - chownr.sync(created, uid, gid) - } - if (needChmod) { - fs.chmodSync(dir, mode) - } - } - - if (cache && cGet(cache, dir) === true) { - return done() - } - - if (dir === cwd) { - checkCwdSync(cwd) - return done() - } - - if (preserve) { - return done(mkdirp.sync(dir, mode)) - } - - const sub = normPath(path.relative(cwd, dir)) - const parts = sub.split('/') - let created = null - for (let p = parts.shift(), part = cwd; - p && (part += '/' + p); - p = parts.shift()) { - part = normPath(path.resolve(part)) - if (cGet(cache, part)) { - continue - } - - try { - fs.mkdirSync(part, mode) - created = created || part - cSet(cache, part, true) - } catch (er) { - const st = fs.lstatSync(part) - if (st.isDirectory()) { - cSet(cache, part, true) - continue - } else if (unlink) { - fs.unlinkSync(part) - fs.mkdirSync(part, mode) - created = created || part - cSet(cache, part, true) - continue - } else if (st.isSymbolicLink()) { - return new SymlinkError(part, part + '/' + parts.join('/')) - } - } - } - - return done(created) -} diff --git a/node_modules/tar/lib/mode-fix.js b/node_modules/tar/lib/mode-fix.js deleted file mode 100644 index 42f1d6e657b1a..0000000000000 --- a/node_modules/tar/lib/mode-fix.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' -module.exports = (mode, isDir, portable) => { - mode &= 0o7777 - - // in portable mode, use the minimum reasonable umask - // if this system creates files with 0o664 by default - // (as some linux distros do), then we'll write the - // archive with 0o644 instead. Also, don't ever create - // a file that is not readable/writable by the owner. - if (portable) { - mode = (mode | 0o600) & ~0o22 - } - - // if dirs are readable, then they should be listable - if (isDir) { - if (mode & 0o400) { - mode |= 0o100 - } - if (mode & 0o40) { - mode |= 0o10 - } - if (mode & 0o4) { - mode |= 0o1 - } - } - return mode -} diff --git a/node_modules/tar/lib/normalize-unicode.js b/node_modules/tar/lib/normalize-unicode.js deleted file mode 100644 index 79e285ab30d57..0000000000000 --- a/node_modules/tar/lib/normalize-unicode.js +++ /dev/null @@ -1,12 +0,0 @@ -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -const normalizeCache = Object.create(null) -const { hasOwnProperty } = Object.prototype -module.exports = s => { - if (!hasOwnProperty.call(normalizeCache, s)) { - normalizeCache[s] = s.normalize('NFD') - } - return normalizeCache[s] -} diff --git a/node_modules/tar/lib/normalize-windows-path.js b/node_modules/tar/lib/normalize-windows-path.js deleted file mode 100644 index eb13ba01b7b04..0000000000000 --- a/node_modules/tar/lib/normalize-windows-path.js +++ /dev/null @@ -1,8 +0,0 @@ -// on windows, either \ or / are valid directory separators. -// on unix, \ is a valid character in filenames. -// so, on windows, and only on windows, we replace all \ chars with /, -// so that we can use / as our one and only directory separator char. - -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform -module.exports = platform !== 'win32' ? p => p - : p => p && p.replace(/\\/g, '/') diff --git a/node_modules/tar/lib/pack.js b/node_modules/tar/lib/pack.js deleted file mode 100644 index d533a068f579f..0000000000000 --- a/node_modules/tar/lib/pack.js +++ /dev/null @@ -1,432 +0,0 @@ -'use strict' - -// A readable tar stream creator -// Technically, this is a transform stream that you write paths into, -// and tar format comes out of. -// The `add()` method is like `write()` but returns this, -// and end() return `this` as well, so you can -// do `new Pack(opt).add('files').add('dir').end().pipe(output) -// You could also do something like: -// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar')) - -class PackJob { - constructor (path, absolute) { - this.path = path || './' - this.absolute = absolute - this.entry = null - this.stat = null - this.readdir = null - this.pending = false - this.ignore = false - this.piped = false - } -} - -const { Minipass } = require('minipass') -const zlib = require('minizlib') -const ReadEntry = require('./read-entry.js') -const WriteEntry = require('./write-entry.js') -const WriteEntrySync = WriteEntry.Sync -const WriteEntryTar = WriteEntry.Tar -const Yallist = require('yallist') -const EOF = Buffer.alloc(1024) -const ONSTAT = Symbol('onStat') -const ENDED = Symbol('ended') -const QUEUE = Symbol('queue') -const CURRENT = Symbol('current') -const PROCESS = Symbol('process') -const PROCESSING = Symbol('processing') -const PROCESSJOB = Symbol('processJob') -const JOBS = Symbol('jobs') -const JOBDONE = Symbol('jobDone') -const ADDFSENTRY = Symbol('addFSEntry') -const ADDTARENTRY = Symbol('addTarEntry') -const STAT = Symbol('stat') -const READDIR = Symbol('readdir') -const ONREADDIR = Symbol('onreaddir') -const PIPE = Symbol('pipe') -const ENTRY = Symbol('entry') -const ENTRYOPT = Symbol('entryOpt') -const WRITEENTRYCLASS = Symbol('writeEntryClass') -const WRITE = Symbol('write') -const ONDRAIN = Symbol('ondrain') - -const fs = require('fs') -const path = require('path') -const warner = require('./warn-mixin.js') -const normPath = require('./normalize-windows-path.js') - -const Pack = warner(class Pack extends Minipass { - constructor (opt) { - super(opt) - opt = opt || Object.create(null) - this.opt = opt - this.file = opt.file || '' - this.cwd = opt.cwd || process.cwd() - this.maxReadSize = opt.maxReadSize - this.preservePaths = !!opt.preservePaths - this.strict = !!opt.strict - this.noPax = !!opt.noPax - this.prefix = normPath(opt.prefix || '') - this.linkCache = opt.linkCache || new Map() - this.statCache = opt.statCache || new Map() - this.readdirCache = opt.readdirCache || new Map() - - this[WRITEENTRYCLASS] = WriteEntry - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn) - } - - this.portable = !!opt.portable - this.zip = null - - if (opt.gzip || opt.brotli) { - if (opt.gzip && opt.brotli) { - throw new TypeError('gzip and brotli are mutually exclusive') - } - if (opt.gzip) { - if (typeof opt.gzip !== 'object') { - opt.gzip = {} - } - if (this.portable) { - opt.gzip.portable = true - } - this.zip = new zlib.Gzip(opt.gzip) - } - if (opt.brotli) { - if (typeof opt.brotli !== 'object') { - opt.brotli = {} - } - this.zip = new zlib.BrotliCompress(opt.brotli) - } - this.zip.on('data', chunk => super.write(chunk)) - this.zip.on('end', _ => super.end()) - this.zip.on('drain', _ => this[ONDRAIN]()) - this.on('resume', _ => this.zip.resume()) - } else { - this.on('drain', this[ONDRAIN]) - } - - this.noDirRecurse = !!opt.noDirRecurse - this.follow = !!opt.follow - this.noMtime = !!opt.noMtime - this.mtime = opt.mtime || null - - this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true - - this[QUEUE] = new Yallist() - this[JOBS] = 0 - this.jobs = +opt.jobs || 4 - this[PROCESSING] = false - this[ENDED] = false - } - - [WRITE] (chunk) { - return super.write(chunk) - } - - add (path) { - this.write(path) - return this - } - - end (path) { - if (path) { - this.write(path) - } - this[ENDED] = true - this[PROCESS]() - return this - } - - write (path) { - if (this[ENDED]) { - throw new Error('write after end') - } - - if (path instanceof ReadEntry) { - this[ADDTARENTRY](path) - } else { - this[ADDFSENTRY](path) - } - return this.flowing - } - - [ADDTARENTRY] (p) { - const absolute = normPath(path.resolve(this.cwd, p.path)) - // in this case, we don't have to wait for the stat - if (!this.filter(p.path, p)) { - p.resume() - } else { - const job = new PackJob(p.path, absolute, false) - job.entry = new WriteEntryTar(p, this[ENTRYOPT](job)) - job.entry.on('end', _ => this[JOBDONE](job)) - this[JOBS] += 1 - this[QUEUE].push(job) - } - - this[PROCESS]() - } - - [ADDFSENTRY] (p) { - const absolute = normPath(path.resolve(this.cwd, p)) - this[QUEUE].push(new PackJob(p, absolute)) - this[PROCESS]() - } - - [STAT] (job) { - job.pending = true - this[JOBS] += 1 - const stat = this.follow ? 'stat' : 'lstat' - fs[stat](job.absolute, (er, stat) => { - job.pending = false - this[JOBS] -= 1 - if (er) { - this.emit('error', er) - } else { - this[ONSTAT](job, stat) - } - }) - } - - [ONSTAT] (job, stat) { - this.statCache.set(job.absolute, stat) - job.stat = stat - - // now we have the stat, we can filter it. - if (!this.filter(job.path, stat)) { - job.ignore = true - } - - this[PROCESS]() - } - - [READDIR] (job) { - job.pending = true - this[JOBS] += 1 - fs.readdir(job.absolute, (er, entries) => { - job.pending = false - this[JOBS] -= 1 - if (er) { - return this.emit('error', er) - } - this[ONREADDIR](job, entries) - }) - } - - [ONREADDIR] (job, entries) { - this.readdirCache.set(job.absolute, entries) - job.readdir = entries - this[PROCESS]() - } - - [PROCESS] () { - if (this[PROCESSING]) { - return - } - - this[PROCESSING] = true - for (let w = this[QUEUE].head; - w !== null && this[JOBS] < this.jobs; - w = w.next) { - this[PROCESSJOB](w.value) - if (w.value.ignore) { - const p = w.next - this[QUEUE].removeNode(w) - w.next = p - } - } - - this[PROCESSING] = false - - if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) { - if (this.zip) { - this.zip.end(EOF) - } else { - super.write(EOF) - super.end() - } - } - } - - get [CURRENT] () { - return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value - } - - [JOBDONE] (job) { - this[QUEUE].shift() - this[JOBS] -= 1 - this[PROCESS]() - } - - [PROCESSJOB] (job) { - if (job.pending) { - return - } - - if (job.entry) { - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job) - } - return - } - - if (!job.stat) { - if (this.statCache.has(job.absolute)) { - this[ONSTAT](job, this.statCache.get(job.absolute)) - } else { - this[STAT](job) - } - } - if (!job.stat) { - return - } - - // filtered out! - if (job.ignore) { - return - } - - if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) { - if (this.readdirCache.has(job.absolute)) { - this[ONREADDIR](job, this.readdirCache.get(job.absolute)) - } else { - this[READDIR](job) - } - if (!job.readdir) { - return - } - } - - // we know it doesn't have an entry, because that got checked above - job.entry = this[ENTRY](job) - if (!job.entry) { - job.ignore = true - return - } - - if (job === this[CURRENT] && !job.piped) { - this[PIPE](job) - } - } - - [ENTRYOPT] (job) { - return { - onwarn: (code, msg, data) => this.warn(code, msg, data), - noPax: this.noPax, - cwd: this.cwd, - absolute: job.absolute, - preservePaths: this.preservePaths, - maxReadSize: this.maxReadSize, - strict: this.strict, - portable: this.portable, - linkCache: this.linkCache, - statCache: this.statCache, - noMtime: this.noMtime, - mtime: this.mtime, - prefix: this.prefix, - } - } - - [ENTRY] (job) { - this[JOBS] += 1 - try { - return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job)) - .on('end', () => this[JOBDONE](job)) - .on('error', er => this.emit('error', er)) - } catch (er) { - this.emit('error', er) - } - } - - [ONDRAIN] () { - if (this[CURRENT] && this[CURRENT].entry) { - this[CURRENT].entry.resume() - } - } - - // like .pipe() but using super, because our write() is special - [PIPE] (job) { - job.piped = true - - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path - const base = p === './' ? '' : p.replace(/\/*$/, '/') - this[ADDFSENTRY](base + entry) - }) - } - - const source = job.entry - const zip = this.zip - - if (zip) { - source.on('data', chunk => { - if (!zip.write(chunk)) { - source.pause() - } - }) - } else { - source.on('data', chunk => { - if (!super.write(chunk)) { - source.pause() - } - }) - } - } - - pause () { - if (this.zip) { - this.zip.pause() - } - return super.pause() - } -}) - -class PackSync extends Pack { - constructor (opt) { - super(opt) - this[WRITEENTRYCLASS] = WriteEntrySync - } - - // pause/resume are no-ops in sync streams. - pause () {} - resume () {} - - [STAT] (job) { - const stat = this.follow ? 'statSync' : 'lstatSync' - this[ONSTAT](job, fs[stat](job.absolute)) - } - - [READDIR] (job, stat) { - this[ONREADDIR](job, fs.readdirSync(job.absolute)) - } - - // gotta get it all in this tick - [PIPE] (job) { - const source = job.entry - const zip = this.zip - - if (job.readdir) { - job.readdir.forEach(entry => { - const p = job.path - const base = p === './' ? '' : p.replace(/\/*$/, '/') - this[ADDFSENTRY](base + entry) - }) - } - - if (zip) { - source.on('data', chunk => { - zip.write(chunk) - }) - } else { - source.on('data', chunk => { - super[WRITE](chunk) - }) - } - } -} - -Pack.Sync = PackSync - -module.exports = Pack diff --git a/node_modules/tar/lib/parse.js b/node_modules/tar/lib/parse.js deleted file mode 100644 index 94e53042fad56..0000000000000 --- a/node_modules/tar/lib/parse.js +++ /dev/null @@ -1,552 +0,0 @@ -'use strict' - -// this[BUFFER] is the remainder of a chunk if we're waiting for -// the full 512 bytes of a header to come in. We will Buffer.concat() -// it to the next write(), which is a mem copy, but a small one. -// -// this[QUEUE] is a Yallist of entries that haven't been emitted -// yet this can only get filled up if the user keeps write()ing after -// a write() returns false, or does a write() with more than one entry -// -// We don't buffer chunks, we always parse them and either create an -// entry, or push it into the active entry. The ReadEntry class knows -// to throw data away if .ignore=true -// -// Shift entry off the buffer when it emits 'end', and emit 'entry' for -// the next one in the list. -// -// At any time, we're pushing body chunks into the entry at WRITEENTRY, -// and waiting for 'end' on the entry at READENTRY -// -// ignored entries get .resume() called on them straight away - -const warner = require('./warn-mixin.js') -const Header = require('./header.js') -const EE = require('events') -const Yallist = require('yallist') -const maxMetaEntrySize = 1024 * 1024 -const Entry = require('./read-entry.js') -const Pax = require('./pax.js') -const zlib = require('minizlib') -const { nextTick } = require('process') - -const gzipHeader = Buffer.from([0x1f, 0x8b]) -const STATE = Symbol('state') -const WRITEENTRY = Symbol('writeEntry') -const READENTRY = Symbol('readEntry') -const NEXTENTRY = Symbol('nextEntry') -const PROCESSENTRY = Symbol('processEntry') -const EX = Symbol('extendedHeader') -const GEX = Symbol('globalExtendedHeader') -const META = Symbol('meta') -const EMITMETA = Symbol('emitMeta') -const BUFFER = Symbol('buffer') -const QUEUE = Symbol('queue') -const ENDED = Symbol('ended') -const EMITTEDEND = Symbol('emittedEnd') -const EMIT = Symbol('emit') -const UNZIP = Symbol('unzip') -const CONSUMECHUNK = Symbol('consumeChunk') -const CONSUMECHUNKSUB = Symbol('consumeChunkSub') -const CONSUMEBODY = Symbol('consumeBody') -const CONSUMEMETA = Symbol('consumeMeta') -const CONSUMEHEADER = Symbol('consumeHeader') -const CONSUMING = Symbol('consuming') -const BUFFERCONCAT = Symbol('bufferConcat') -const MAYBEEND = Symbol('maybeEnd') -const WRITING = Symbol('writing') -const ABORTED = Symbol('aborted') -const DONE = Symbol('onDone') -const SAW_VALID_ENTRY = Symbol('sawValidEntry') -const SAW_NULL_BLOCK = Symbol('sawNullBlock') -const SAW_EOF = Symbol('sawEOF') -const CLOSESTREAM = Symbol('closeStream') - -const noop = _ => true - -module.exports = warner(class Parser extends EE { - constructor (opt) { - opt = opt || {} - super(opt) - - this.file = opt.file || '' - - // set to boolean false when an entry starts. 1024 bytes of \0 - // is technically a valid tarball, albeit a boring one. - this[SAW_VALID_ENTRY] = null - - // these BADARCHIVE errors can't be detected early. listen on DONE. - this.on(DONE, _ => { - if (this[STATE] === 'begin' || this[SAW_VALID_ENTRY] === false) { - // either less than 1 block of data, or all entries were invalid. - // Either way, probably not even a tarball. - this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format') - } - }) - - if (opt.ondone) { - this.on(DONE, opt.ondone) - } else { - this.on(DONE, _ => { - this.emit('prefinish') - this.emit('finish') - this.emit('end') - }) - } - - this.strict = !!opt.strict - this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize - this.filter = typeof opt.filter === 'function' ? opt.filter : noop - // Unlike gzip, brotli doesn't have any magic bytes to identify it - // Users need to explicitly tell us they're extracting a brotli file - // Or we infer from the file extension - const isTBR = (opt.file && ( - opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr'))) - // if it's a tbr file it MIGHT be brotli, but we don't know until - // we look at it and verify it's not a valid tar file. - this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli - : isTBR ? undefined - : false - - // have to set this so that streams are ok piping into it - this.writable = true - this.readable = false - - this[QUEUE] = new Yallist() - this[BUFFER] = null - this[READENTRY] = null - this[WRITEENTRY] = null - this[STATE] = 'begin' - this[META] = '' - this[EX] = null - this[GEX] = null - this[ENDED] = false - this[UNZIP] = null - this[ABORTED] = false - this[SAW_NULL_BLOCK] = false - this[SAW_EOF] = false - - this.on('end', () => this[CLOSESTREAM]()) - - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn) - } - if (typeof opt.onentry === 'function') { - this.on('entry', opt.onentry) - } - } - - [CONSUMEHEADER] (chunk, position) { - if (this[SAW_VALID_ENTRY] === null) { - this[SAW_VALID_ENTRY] = false - } - let header - try { - header = new Header(chunk, position, this[EX], this[GEX]) - } catch (er) { - return this.warn('TAR_ENTRY_INVALID', er) - } - - if (header.nullBlock) { - if (this[SAW_NULL_BLOCK]) { - this[SAW_EOF] = true - // ending an archive with no entries. pointless, but legal. - if (this[STATE] === 'begin') { - this[STATE] = 'header' - } - this[EMIT]('eof') - } else { - this[SAW_NULL_BLOCK] = true - this[EMIT]('nullBlock') - } - } else { - this[SAW_NULL_BLOCK] = false - if (!header.cksumValid) { - this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header }) - } else if (!header.path) { - this.warn('TAR_ENTRY_INVALID', 'path is required', { header }) - } else { - const type = header.type - if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath required', { header }) - } else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath) { - this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { header }) - } else { - const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX]) - - // we do this for meta & ignored entries as well, because they - // are still valid tar, or else we wouldn't know to ignore them - if (!this[SAW_VALID_ENTRY]) { - if (entry.remain) { - // this might be the one! - const onend = () => { - if (!entry.invalid) { - this[SAW_VALID_ENTRY] = true - } - } - entry.on('end', onend) - } else { - this[SAW_VALID_ENTRY] = true - } - } - - if (entry.meta) { - if (entry.size > this.maxMetaEntrySize) { - entry.ignore = true - this[EMIT]('ignoredEntry', entry) - this[STATE] = 'ignore' - entry.resume() - } else if (entry.size > 0) { - this[META] = '' - entry.on('data', c => this[META] += c) - this[STATE] = 'meta' - } - } else { - this[EX] = null - entry.ignore = entry.ignore || !this.filter(entry.path, entry) - - if (entry.ignore) { - // probably valid, just not something we care about - this[EMIT]('ignoredEntry', entry) - this[STATE] = entry.remain ? 'ignore' : 'header' - entry.resume() - } else { - if (entry.remain) { - this[STATE] = 'body' - } else { - this[STATE] = 'header' - entry.end() - } - - if (!this[READENTRY]) { - this[QUEUE].push(entry) - this[NEXTENTRY]() - } else { - this[QUEUE].push(entry) - } - } - } - } - } - } - } - - [CLOSESTREAM] () { - nextTick(() => this.emit('close')) - } - - [PROCESSENTRY] (entry) { - let go = true - - if (!entry) { - this[READENTRY] = null - go = false - } else if (Array.isArray(entry)) { - this.emit.apply(this, entry) - } else { - this[READENTRY] = entry - this.emit('entry', entry) - if (!entry.emittedEnd) { - entry.on('end', _ => this[NEXTENTRY]()) - go = false - } - } - - return go - } - - [NEXTENTRY] () { - do {} while (this[PROCESSENTRY](this[QUEUE].shift())) - - if (!this[QUEUE].length) { - // At this point, there's nothing in the queue, but we may have an - // entry which is being consumed (readEntry). - // If we don't, then we definitely can handle more data. - // If we do, and either it's flowing, or it has never had any data - // written to it, then it needs more. - // The only other possibility is that it has returned false from a - // write() call, so we wait for the next drain to continue. - const re = this[READENTRY] - const drainNow = !re || re.flowing || re.size === re.remain - if (drainNow) { - if (!this[WRITING]) { - this.emit('drain') - } - } else { - re.once('drain', _ => this.emit('drain')) - } - } - } - - [CONSUMEBODY] (chunk, position) { - // write up to but no more than writeEntry.blockRemain - const entry = this[WRITEENTRY] - const br = entry.blockRemain - const c = (br >= chunk.length && position === 0) ? chunk - : chunk.slice(position, position + br) - - entry.write(c) - - if (!entry.blockRemain) { - this[STATE] = 'header' - this[WRITEENTRY] = null - entry.end() - } - - return c.length - } - - [CONSUMEMETA] (chunk, position) { - const entry = this[WRITEENTRY] - const ret = this[CONSUMEBODY](chunk, position) - - // if we finished, then the entry is reset - if (!this[WRITEENTRY]) { - this[EMITMETA](entry) - } - - return ret - } - - [EMIT] (ev, data, extra) { - if (!this[QUEUE].length && !this[READENTRY]) { - this.emit(ev, data, extra) - } else { - this[QUEUE].push([ev, data, extra]) - } - } - - [EMITMETA] (entry) { - this[EMIT]('meta', this[META]) - switch (entry.type) { - case 'ExtendedHeader': - case 'OldExtendedHeader': - this[EX] = Pax.parse(this[META], this[EX], false) - break - - case 'GlobalExtendedHeader': - this[GEX] = Pax.parse(this[META], this[GEX], true) - break - - case 'NextFileHasLongPath': - case 'OldGnuLongPath': - this[EX] = this[EX] || Object.create(null) - this[EX].path = this[META].replace(/\0.*/, '') - break - - case 'NextFileHasLongLinkpath': - this[EX] = this[EX] || Object.create(null) - this[EX].linkpath = this[META].replace(/\0.*/, '') - break - - /* istanbul ignore next */ - default: throw new Error('unknown meta: ' + entry.type) - } - } - - abort (error) { - this[ABORTED] = true - this.emit('abort', error) - // always throws, even in non-strict mode - this.warn('TAR_ABORT', error, { recoverable: false }) - } - - write (chunk) { - if (this[ABORTED]) { - return - } - - // first write, might be gzipped - const needSniff = this[UNZIP] === null || - this.brotli === undefined && this[UNZIP] === false - if (needSniff && chunk) { - if (this[BUFFER]) { - chunk = Buffer.concat([this[BUFFER], chunk]) - this[BUFFER] = null - } - if (chunk.length < gzipHeader.length) { - this[BUFFER] = chunk - return true - } - - // look for gzip header - for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) { - if (chunk[i] !== gzipHeader[i]) { - this[UNZIP] = false - } - } - - const maybeBrotli = this.brotli === undefined - if (this[UNZIP] === false && maybeBrotli) { - // read the first header to see if it's a valid tar file. If so, - // we can safely assume that it's not actually brotli, despite the - // .tbr or .tar.br file extension. - // if we ended before getting a full chunk, yes, def brotli - if (chunk.length < 512) { - if (this[ENDED]) { - this.brotli = true - } else { - this[BUFFER] = chunk - return true - } - } else { - // if it's tar, it's pretty reliably not brotli, chances of - // that happening are astronomical. - try { - new Header(chunk.slice(0, 512)) - this.brotli = false - } catch (_) { - this.brotli = true - } - } - } - - if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) { - const ended = this[ENDED] - this[ENDED] = false - this[UNZIP] = this[UNZIP] === null - ? new zlib.Unzip() - : new zlib.BrotliDecompress() - this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk)) - this[UNZIP].on('error', er => this.abort(er)) - this[UNZIP].on('end', _ => { - this[ENDED] = true - this[CONSUMECHUNK]() - }) - this[WRITING] = true - const ret = this[UNZIP][ended ? 'end' : 'write'](chunk) - this[WRITING] = false - return ret - } - } - - this[WRITING] = true - if (this[UNZIP]) { - this[UNZIP].write(chunk) - } else { - this[CONSUMECHUNK](chunk) - } - this[WRITING] = false - - // return false if there's a queue, or if the current entry isn't flowing - const ret = - this[QUEUE].length ? false : - this[READENTRY] ? this[READENTRY].flowing : - true - - // if we have no queue, then that means a clogged READENTRY - if (!ret && !this[QUEUE].length) { - this[READENTRY].once('drain', _ => this.emit('drain')) - } - - return ret - } - - [BUFFERCONCAT] (c) { - if (c && !this[ABORTED]) { - this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c - } - } - - [MAYBEEND] () { - if (this[ENDED] && - !this[EMITTEDEND] && - !this[ABORTED] && - !this[CONSUMING]) { - this[EMITTEDEND] = true - const entry = this[WRITEENTRY] - if (entry && entry.blockRemain) { - // truncated, likely a damaged file - const have = this[BUFFER] ? this[BUFFER].length : 0 - this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${ - entry.blockRemain} more bytes, only ${have} available)`, { entry }) - if (this[BUFFER]) { - entry.write(this[BUFFER]) - } - entry.end() - } - this[EMIT](DONE) - } - } - - [CONSUMECHUNK] (chunk) { - if (this[CONSUMING]) { - this[BUFFERCONCAT](chunk) - } else if (!chunk && !this[BUFFER]) { - this[MAYBEEND]() - } else { - this[CONSUMING] = true - if (this[BUFFER]) { - this[BUFFERCONCAT](chunk) - const c = this[BUFFER] - this[BUFFER] = null - this[CONSUMECHUNKSUB](c) - } else { - this[CONSUMECHUNKSUB](chunk) - } - - while (this[BUFFER] && - this[BUFFER].length >= 512 && - !this[ABORTED] && - !this[SAW_EOF]) { - const c = this[BUFFER] - this[BUFFER] = null - this[CONSUMECHUNKSUB](c) - } - this[CONSUMING] = false - } - - if (!this[BUFFER] || this[ENDED]) { - this[MAYBEEND]() - } - } - - [CONSUMECHUNKSUB] (chunk) { - // we know that we are in CONSUMING mode, so anything written goes into - // the buffer. Advance the position and put any remainder in the buffer. - let position = 0 - const length = chunk.length - while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) { - switch (this[STATE]) { - case 'begin': - case 'header': - this[CONSUMEHEADER](chunk, position) - position += 512 - break - - case 'ignore': - case 'body': - position += this[CONSUMEBODY](chunk, position) - break - - case 'meta': - position += this[CONSUMEMETA](chunk, position) - break - - /* istanbul ignore next */ - default: - throw new Error('invalid state: ' + this[STATE]) - } - } - - if (position < length) { - if (this[BUFFER]) { - this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]]) - } else { - this[BUFFER] = chunk.slice(position) - } - } - } - - end (chunk) { - if (!this[ABORTED]) { - if (this[UNZIP]) { - this[UNZIP].end(chunk) - } else { - this[ENDED] = true - if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0) - this.write(chunk) - } - } - } -}) diff --git a/node_modules/tar/lib/path-reservations.js b/node_modules/tar/lib/path-reservations.js deleted file mode 100644 index 8d349d584513f..0000000000000 --- a/node_modules/tar/lib/path-reservations.js +++ /dev/null @@ -1,156 +0,0 @@ -// A path exclusive reservation system -// reserve([list, of, paths], fn) -// When the fn is first in line for all its paths, it -// is called with a cb that clears the reservation. -// -// Used by async unpack to avoid clobbering paths in use, -// while still allowing maximal safe parallelization. - -const assert = require('assert') -const normalize = require('./normalize-unicode.js') -const stripSlashes = require('./strip-trailing-slashes.js') -const { join } = require('path') - -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform -const isWindows = platform === 'win32' - -module.exports = () => { - // path => [function or Set] - // A Set object means a directory reservation - // A fn is a direct reservation on that path - const queues = new Map() - - // fn => {paths:[path,...], dirs:[path, ...]} - const reservations = new Map() - - // return a set of parent dirs for a given path - // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d'] - const getDirs = path => { - const dirs = path.split('/').slice(0, -1).reduce((set, path) => { - if (set.length) { - path = join(set[set.length - 1], path) - } - set.push(path || '/') - return set - }, []) - return dirs - } - - // functions currently running - const running = new Set() - - // return the queues for each path the function cares about - // fn => {paths, dirs} - const getQueues = fn => { - const res = reservations.get(fn) - /* istanbul ignore if - unpossible */ - if (!res) { - throw new Error('function does not have any path reservations') - } - return { - paths: res.paths.map(path => queues.get(path)), - dirs: [...res.dirs].map(path => queues.get(path)), - } - } - - // check if fn is first in line for all its paths, and is - // included in the first set for all its dir queues - const check = fn => { - const { paths, dirs } = getQueues(fn) - return paths.every(q => q[0] === fn) && - dirs.every(q => q[0] instanceof Set && q[0].has(fn)) - } - - // run the function if it's first in line and not already running - const run = fn => { - if (running.has(fn) || !check(fn)) { - return false - } - running.add(fn) - fn(() => clear(fn)) - return true - } - - const clear = fn => { - if (!running.has(fn)) { - return false - } - - const { paths, dirs } = reservations.get(fn) - const next = new Set() - - paths.forEach(path => { - const q = queues.get(path) - assert.equal(q[0], fn) - if (q.length === 1) { - queues.delete(path) - } else { - q.shift() - if (typeof q[0] === 'function') { - next.add(q[0]) - } else { - q[0].forEach(fn => next.add(fn)) - } - } - }) - - dirs.forEach(dir => { - const q = queues.get(dir) - assert(q[0] instanceof Set) - if (q[0].size === 1 && q.length === 1) { - queues.delete(dir) - } else if (q[0].size === 1) { - q.shift() - - // must be a function or else the Set would've been reused - next.add(q[0]) - } else { - q[0].delete(fn) - } - }) - running.delete(fn) - - next.forEach(fn => run(fn)) - return true - } - - const reserve = (paths, fn) => { - // collide on matches across case and unicode normalization - // On windows, thanks to the magic of 8.3 shortnames, it is fundamentally - // impossible to determine whether two paths refer to the same thing on - // disk, without asking the kernel for a shortname. - // So, we just pretend that every path matches every other path here, - // effectively removing all parallelization on windows. - paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => { - // don't need normPath, because we skip this entirely for windows - return stripSlashes(join(normalize(p))).toLowerCase() - }) - - const dirs = new Set( - paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b)) - ) - reservations.set(fn, { dirs, paths }) - paths.forEach(path => { - const q = queues.get(path) - if (!q) { - queues.set(path, [fn]) - } else { - q.push(fn) - } - }) - dirs.forEach(dir => { - const q = queues.get(dir) - if (!q) { - queues.set(dir, [new Set([fn])]) - } else if (q[q.length - 1] instanceof Set) { - q[q.length - 1].add(fn) - } else { - q.push(new Set([fn])) - } - }) - - return run(fn) - } - - return { check, reserve } -} diff --git a/node_modules/tar/lib/pax.js b/node_modules/tar/lib/pax.js deleted file mode 100644 index 4a7ca85386e83..0000000000000 --- a/node_modules/tar/lib/pax.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict' -const Header = require('./header.js') -const path = require('path') - -class Pax { - constructor (obj, global) { - this.atime = obj.atime || null - this.charset = obj.charset || null - this.comment = obj.comment || null - this.ctime = obj.ctime || null - this.gid = obj.gid || null - this.gname = obj.gname || null - this.linkpath = obj.linkpath || null - this.mtime = obj.mtime || null - this.path = obj.path || null - this.size = obj.size || null - this.uid = obj.uid || null - this.uname = obj.uname || null - this.dev = obj.dev || null - this.ino = obj.ino || null - this.nlink = obj.nlink || null - this.global = global || false - } - - encode () { - const body = this.encodeBody() - if (body === '') { - return null - } - - const bodyLen = Buffer.byteLength(body) - // round up to 512 bytes - // add 512 for header - const bufLen = 512 * Math.ceil(1 + bodyLen / 512) - const buf = Buffer.allocUnsafe(bufLen) - - // 0-fill the header section, it might not hit every field - for (let i = 0; i < 512; i++) { - buf[i] = 0 - } - - new Header({ - // XXX split the path - // then the path should be PaxHeader + basename, but less than 99, - // prepend with the dirname - path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99), - mode: this.mode || 0o644, - uid: this.uid || null, - gid: this.gid || null, - size: bodyLen, - mtime: this.mtime || null, - type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader', - linkpath: '', - uname: this.uname || '', - gname: this.gname || '', - devmaj: 0, - devmin: 0, - atime: this.atime || null, - ctime: this.ctime || null, - }).encode(buf) - - buf.write(body, 512, bodyLen, 'utf8') - - // null pad after the body - for (let i = bodyLen + 512; i < buf.length; i++) { - buf[i] = 0 - } - - return buf - } - - encodeBody () { - return ( - this.encodeField('path') + - this.encodeField('ctime') + - this.encodeField('atime') + - this.encodeField('dev') + - this.encodeField('ino') + - this.encodeField('nlink') + - this.encodeField('charset') + - this.encodeField('comment') + - this.encodeField('gid') + - this.encodeField('gname') + - this.encodeField('linkpath') + - this.encodeField('mtime') + - this.encodeField('size') + - this.encodeField('uid') + - this.encodeField('uname') - ) - } - - encodeField (field) { - if (this[field] === null || this[field] === undefined) { - return '' - } - const v = this[field] instanceof Date ? this[field].getTime() / 1000 - : this[field] - const s = ' ' + - (field === 'dev' || field === 'ino' || field === 'nlink' - ? 'SCHILY.' : '') + - field + '=' + v + '\n' - const byteLen = Buffer.byteLength(s) - // the digits includes the length of the digits in ascii base-10 - // so if it's 9 characters, then adding 1 for the 9 makes it 10 - // which makes it 11 chars. - let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1 - if (byteLen + digits >= Math.pow(10, digits)) { - digits += 1 - } - const len = digits + byteLen - return len + s - } -} - -Pax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g) - -const merge = (a, b) => - b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a - -const parseKV = string => - string - .replace(/\n$/, '') - .split('\n') - .reduce(parseKVLine, Object.create(null)) - -const parseKVLine = (set, line) => { - const n = parseInt(line, 10) - - // XXX Values with \n in them will fail this. - // Refactor to not be a naive line-by-line parse. - if (n !== Buffer.byteLength(line) + 1) { - return set - } - - line = line.slice((n + ' ').length) - const kv = line.split('=') - const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1') - if (!k) { - return set - } - - const v = kv.join('=') - set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k) - ? new Date(v * 1000) - : /^[0-9]+$/.test(v) ? +v - : v - return set -} - -module.exports = Pax diff --git a/node_modules/tar/lib/read-entry.js b/node_modules/tar/lib/read-entry.js deleted file mode 100644 index 6186266e89c0a..0000000000000 --- a/node_modules/tar/lib/read-entry.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict' -const { Minipass } = require('minipass') -const normPath = require('./normalize-windows-path.js') - -const SLURP = Symbol('slurp') -module.exports = class ReadEntry extends Minipass { - constructor (header, ex, gex) { - super() - // read entries always start life paused. this is to avoid the - // situation where Minipass's auto-ending empty streams results - // in an entry ending before we're ready for it. - this.pause() - this.extended = ex - this.globalExtended = gex - this.header = header - this.startBlockSize = 512 * Math.ceil(header.size / 512) - this.blockRemain = this.startBlockSize - this.remain = header.size - this.type = header.type - this.meta = false - this.ignore = false - switch (this.type) { - case 'File': - case 'OldFile': - case 'Link': - case 'SymbolicLink': - case 'CharacterDevice': - case 'BlockDevice': - case 'Directory': - case 'FIFO': - case 'ContiguousFile': - case 'GNUDumpDir': - break - - case 'NextFileHasLongLinkpath': - case 'NextFileHasLongPath': - case 'OldGnuLongPath': - case 'GlobalExtendedHeader': - case 'ExtendedHeader': - case 'OldExtendedHeader': - this.meta = true - break - - // NOTE: gnutar and bsdtar treat unrecognized types as 'File' - // it may be worth doing the same, but with a warning. - default: - this.ignore = true - } - - this.path = normPath(header.path) - this.mode = header.mode - if (this.mode) { - this.mode = this.mode & 0o7777 - } - this.uid = header.uid - this.gid = header.gid - this.uname = header.uname - this.gname = header.gname - this.size = header.size - this.mtime = header.mtime - this.atime = header.atime - this.ctime = header.ctime - this.linkpath = normPath(header.linkpath) - this.uname = header.uname - this.gname = header.gname - - if (ex) { - this[SLURP](ex) - } - if (gex) { - this[SLURP](gex, true) - } - } - - write (data) { - const writeLen = data.length - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate') - } - - const r = this.remain - const br = this.blockRemain - this.remain = Math.max(0, r - writeLen) - this.blockRemain = Math.max(0, br - writeLen) - if (this.ignore) { - return true - } - - if (r >= writeLen) { - return super.write(data) - } - - // r < writeLen - return super.write(data.slice(0, r)) - } - - [SLURP] (ex, global) { - for (const k in ex) { - // we slurp in everything except for the path attribute in - // a global extended header, because that's weird. - if (ex[k] !== null && ex[k] !== undefined && - !(global && k === 'path')) { - this[k] = k === 'path' || k === 'linkpath' ? normPath(ex[k]) : ex[k] - } - } - } -} diff --git a/node_modules/tar/lib/replace.js b/node_modules/tar/lib/replace.js deleted file mode 100644 index 8db6800bdf464..0000000000000 --- a/node_modules/tar/lib/replace.js +++ /dev/null @@ -1,246 +0,0 @@ -'use strict' - -// tar -r -const hlo = require('./high-level-opt.js') -const Pack = require('./pack.js') -const fs = require('fs') -const fsm = require('fs-minipass') -const t = require('./list.js') -const path = require('path') - -// starting at the head of the file, read a Header -// If the checksum is invalid, that's our position to start writing -// If it is, jump forward by the specified size (round up to 512) -// and try again. -// Write the new Pack stream starting there. - -const Header = require('./header.js') - -module.exports = (opt_, files, cb) => { - const opt = hlo(opt_) - - if (!opt.file) { - throw new TypeError('file is required') - } - - if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { - throw new TypeError('cannot append to compressed archives') - } - - if (!files || !Array.isArray(files) || !files.length) { - throw new TypeError('no files or directories specified') - } - - files = Array.from(files) - - return opt.sync ? replaceSync(opt, files) - : replace(opt, files, cb) -} - -const replaceSync = (opt, files) => { - const p = new Pack.Sync(opt) - - let threw = true - let fd - let position - - try { - try { - fd = fs.openSync(opt.file, 'r+') - } catch (er) { - if (er.code === 'ENOENT') { - fd = fs.openSync(opt.file, 'w+') - } else { - throw er - } - } - - const st = fs.fstatSync(fd) - const headBuf = Buffer.alloc(512) - - POSITION: for (position = 0; position < st.size; position += 512) { - for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) { - bytes = fs.readSync( - fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos - ) - - if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) { - throw new Error('cannot append to compressed archives') - } - - if (!bytes) { - break POSITION - } - } - - const h = new Header(headBuf) - if (!h.cksumValid) { - break - } - const entryBlockSize = 512 * Math.ceil(h.size / 512) - if (position + entryBlockSize + 512 > st.size) { - break - } - // the 512 for the header we just parsed will be added as well - // also jump ahead all the blocks for the body - position += entryBlockSize - if (opt.mtimeCache) { - opt.mtimeCache.set(h.path, h.mtime) - } - } - threw = false - - streamSync(opt, p, position, fd, files) - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } - } -} - -const streamSync = (opt, p, position, fd, files) => { - const stream = new fsm.WriteStreamSync(opt.file, { - fd: fd, - start: position, - }) - p.pipe(stream) - addFilesSync(p, files) -} - -const replace = (opt, files, cb) => { - files = Array.from(files) - const p = new Pack(opt) - - const getPos = (fd, size, cb_) => { - const cb = (er, pos) => { - if (er) { - fs.close(fd, _ => cb_(er)) - } else { - cb_(null, pos) - } - } - - let position = 0 - if (size === 0) { - return cb(null, 0) - } - - let bufPos = 0 - const headBuf = Buffer.alloc(512) - const onread = (er, bytes) => { - if (er) { - return cb(er) - } - bufPos += bytes - if (bufPos < 512 && bytes) { - return fs.read( - fd, headBuf, bufPos, headBuf.length - bufPos, - position + bufPos, onread - ) - } - - if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) { - return cb(new Error('cannot append to compressed archives')) - } - - // truncated header - if (bufPos < 512) { - return cb(null, position) - } - - const h = new Header(headBuf) - if (!h.cksumValid) { - return cb(null, position) - } - - const entryBlockSize = 512 * Math.ceil(h.size / 512) - if (position + entryBlockSize + 512 > size) { - return cb(null, position) - } - - position += entryBlockSize + 512 - if (position >= size) { - return cb(null, position) - } - - if (opt.mtimeCache) { - opt.mtimeCache.set(h.path, h.mtime) - } - bufPos = 0 - fs.read(fd, headBuf, 0, 512, position, onread) - } - fs.read(fd, headBuf, 0, 512, position, onread) - } - - const promise = new Promise((resolve, reject) => { - p.on('error', reject) - let flag = 'r+' - const onopen = (er, fd) => { - if (er && er.code === 'ENOENT' && flag === 'r+') { - flag = 'w+' - return fs.open(opt.file, flag, onopen) - } - - if (er) { - return reject(er) - } - - fs.fstat(fd, (er, st) => { - if (er) { - return fs.close(fd, () => reject(er)) - } - - getPos(fd, st.size, (er, position) => { - if (er) { - return reject(er) - } - const stream = new fsm.WriteStream(opt.file, { - fd: fd, - start: position, - }) - p.pipe(stream) - stream.on('error', reject) - stream.on('close', resolve) - addFilesAsync(p, files) - }) - }) - } - fs.open(opt.file, flag, onopen) - }) - - return cb ? promise.then(cb, cb) : promise -} - -const addFilesSync = (p, files) => { - files.forEach(file => { - if (file.charAt(0) === '@') { - t({ - file: path.resolve(p.cwd, file.slice(1)), - sync: true, - noResume: true, - onentry: entry => p.add(entry), - }) - } else { - p.add(file) - } - }) - p.end() -} - -const addFilesAsync = (p, files) => { - while (files.length) { - const file = files.shift() - if (file.charAt(0) === '@') { - return t({ - file: path.resolve(p.cwd, file.slice(1)), - noResume: true, - onentry: entry => p.add(entry), - }).then(_ => addFilesAsync(p, files)) - } else { - p.add(file) - } - } - p.end() -} diff --git a/node_modules/tar/lib/strip-absolute-path.js b/node_modules/tar/lib/strip-absolute-path.js deleted file mode 100644 index 185e2dead3929..0000000000000 --- a/node_modules/tar/lib/strip-absolute-path.js +++ /dev/null @@ -1,24 +0,0 @@ -// unix absolute paths are also absolute on win32, so we use this for both -const { isAbsolute, parse } = require('path').win32 - -// returns [root, stripped] -// Note that windows will think that //x/y/z/a has a "root" of //x/y, and in -// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip / -// explicitly if it's the first character. -// drive-specific relative paths on Windows get their root stripped off even -// though they are not absolute, so `c:../foo` becomes ['c:', '../foo'] -module.exports = path => { - let r = '' - - let parsed = parse(path) - while (isAbsolute(path) || parsed.root) { - // windows will think that //x/y/z has a "root" of //x/y/ - // but strip the //?/C:/ off of //?/C:/path - const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? '/' - : parsed.root - path = path.slice(root.length) - r += root - parsed = parse(path) - } - return [r, path] -} diff --git a/node_modules/tar/lib/strip-trailing-slashes.js b/node_modules/tar/lib/strip-trailing-slashes.js deleted file mode 100644 index 3e3ecec5a402b..0000000000000 --- a/node_modules/tar/lib/strip-trailing-slashes.js +++ /dev/null @@ -1,13 +0,0 @@ -// warning: extremely hot code path. -// This has been meticulously optimized for use -// within npm install on large package trees. -// Do not edit without careful benchmarking. -module.exports = str => { - let i = str.length - 1 - let slashesStart = -1 - while (i > -1 && str.charAt(i) === '/') { - slashesStart = i - i-- - } - return slashesStart === -1 ? str : str.slice(0, slashesStart) -} diff --git a/node_modules/tar/lib/types.js b/node_modules/tar/lib/types.js deleted file mode 100644 index 7bfc254658f4e..0000000000000 --- a/node_modules/tar/lib/types.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict' -// map types from key to human-friendly name -exports.name = new Map([ - ['0', 'File'], - // same as File - ['', 'OldFile'], - ['1', 'Link'], - ['2', 'SymbolicLink'], - // Devices and FIFOs aren't fully supported - // they are parsed, but skipped when unpacking - ['3', 'CharacterDevice'], - ['4', 'BlockDevice'], - ['5', 'Directory'], - ['6', 'FIFO'], - // same as File - ['7', 'ContiguousFile'], - // pax headers - ['g', 'GlobalExtendedHeader'], - ['x', 'ExtendedHeader'], - // vendor-specific stuff - // skip - ['A', 'SolarisACL'], - // like 5, but with data, which should be skipped - ['D', 'GNUDumpDir'], - // metadata only, skip - ['I', 'Inode'], - // data = link path of next file - ['K', 'NextFileHasLongLinkpath'], - // data = path of next file - ['L', 'NextFileHasLongPath'], - // skip - ['M', 'ContinuationFile'], - // like L - ['N', 'OldGnuLongPath'], - // skip - ['S', 'SparseFile'], - // skip - ['V', 'TapeVolumeHeader'], - // like x - ['X', 'OldExtendedHeader'], -]) - -// map the other direction -exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]])) diff --git a/node_modules/tar/lib/unpack.js b/node_modules/tar/lib/unpack.js deleted file mode 100644 index 03172e2c95d97..0000000000000 --- a/node_modules/tar/lib/unpack.js +++ /dev/null @@ -1,923 +0,0 @@ -'use strict' - -// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet. -// but the path reservations are required to avoid race conditions where -// parallelized unpack ops may mess with one another, due to dependencies -// (like a Link depending on its target) or destructive operations (like -// clobbering an fs object to create one of a different type.) - -const assert = require('assert') -const Parser = require('./parse.js') -const fs = require('fs') -const fsm = require('fs-minipass') -const path = require('path') -const mkdir = require('./mkdir.js') -const wc = require('./winchars.js') -const pathReservations = require('./path-reservations.js') -const stripAbsolutePath = require('./strip-absolute-path.js') -const normPath = require('./normalize-windows-path.js') -const stripSlash = require('./strip-trailing-slashes.js') -const normalize = require('./normalize-unicode.js') - -const ONENTRY = Symbol('onEntry') -const CHECKFS = Symbol('checkFs') -const CHECKFS2 = Symbol('checkFs2') -const PRUNECACHE = Symbol('pruneCache') -const ISREUSABLE = Symbol('isReusable') -const MAKEFS = Symbol('makeFs') -const FILE = Symbol('file') -const DIRECTORY = Symbol('directory') -const LINK = Symbol('link') -const SYMLINK = Symbol('symlink') -const HARDLINK = Symbol('hardlink') -const UNSUPPORTED = Symbol('unsupported') -const CHECKPATH = Symbol('checkPath') -const MKDIR = Symbol('mkdir') -const ONERROR = Symbol('onError') -const PENDING = Symbol('pending') -const PEND = Symbol('pend') -const UNPEND = Symbol('unpend') -const ENDED = Symbol('ended') -const MAYBECLOSE = Symbol('maybeClose') -const SKIP = Symbol('skip') -const DOCHOWN = Symbol('doChown') -const UID = Symbol('uid') -const GID = Symbol('gid') -const CHECKED_CWD = Symbol('checkedCwd') -const crypto = require('crypto') -const getFlag = require('./get-write-flag.js') -const platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform -const isWindows = platform === 'win32' -const DEFAULT_MAX_DEPTH = 1024 - -// Unlinks on Windows are not atomic. -// -// This means that if you have a file entry, followed by another -// file entry with an identical name, and you cannot re-use the file -// (because it's a hardlink, or because unlink:true is set, or it's -// Windows, which does not have useful nlink values), then the unlink -// will be committed to the disk AFTER the new file has been written -// over the old one, deleting the new file. -// -// To work around this, on Windows systems, we rename the file and then -// delete the renamed file. It's a sloppy kludge, but frankly, I do not -// know of a better way to do this, given windows' non-atomic unlink -// semantics. -// -// See: https://github.com/npm/node-tar/issues/183 -/* istanbul ignore next */ -const unlinkFile = (path, cb) => { - if (!isWindows) { - return fs.unlink(path, cb) - } - - const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') - fs.rename(path, name, er => { - if (er) { - return cb(er) - } - fs.unlink(name, cb) - }) -} - -/* istanbul ignore next */ -const unlinkFileSync = path => { - if (!isWindows) { - return fs.unlinkSync(path) - } - - const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex') - fs.renameSync(path, name) - fs.unlinkSync(name) -} - -// this.gid, entry.gid, this.processUid -const uint32 = (a, b, c) => - a === a >>> 0 ? a - : b === b >>> 0 ? b - : c - -// clear the cache if it's a case-insensitive unicode-squashing match. -// we can't know if the current file system is case-sensitive or supports -// unicode fully, so we check for similarity on the maximally compatible -// representation. Err on the side of pruning, since all it's doing is -// preventing lstats, and it's not the end of the world if we get a false -// positive. -// Note that on windows, we always drop the entire cache whenever a -// symbolic link is encountered, because 8.3 filenames are impossible -// to reason about, and collisions are hazards rather than just failures. -const cacheKeyNormalize = path => stripSlash(normPath(normalize(path))) - .toLowerCase() - -const pruneCache = (cache, abs) => { - abs = cacheKeyNormalize(abs) - for (const path of cache.keys()) { - const pnorm = cacheKeyNormalize(path) - if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) { - cache.delete(path) - } - } -} - -const dropCache = cache => { - for (const key of cache.keys()) { - cache.delete(key) - } -} - -class Unpack extends Parser { - constructor (opt) { - if (!opt) { - opt = {} - } - - opt.ondone = _ => { - this[ENDED] = true - this[MAYBECLOSE]() - } - - super(opt) - - this[CHECKED_CWD] = false - - this.reservations = pathReservations() - - this.transform = typeof opt.transform === 'function' ? opt.transform : null - - this.writable = true - this.readable = false - - this[PENDING] = 0 - this[ENDED] = false - - this.dirCache = opt.dirCache || new Map() - - if (typeof opt.uid === 'number' || typeof opt.gid === 'number') { - // need both or neither - if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') { - throw new TypeError('cannot set owner without number uid and gid') - } - if (opt.preserveOwner) { - throw new TypeError( - 'cannot preserve owner in archive and also set owner explicitly') - } - this.uid = opt.uid - this.gid = opt.gid - this.setOwner = true - } else { - this.uid = null - this.gid = null - this.setOwner = false - } - - // default true for root - if (opt.preserveOwner === undefined && typeof opt.uid !== 'number') { - this.preserveOwner = process.getuid && process.getuid() === 0 - } else { - this.preserveOwner = !!opt.preserveOwner - } - - this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? - process.getuid() : null - this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? - process.getgid() : null - - // prevent excessively deep nesting of subfolders - // set to `Infinity` to remove this restriction - this.maxDepth = typeof opt.maxDepth === 'number' - ? opt.maxDepth - : DEFAULT_MAX_DEPTH - - // mostly just for testing, but useful in some cases. - // Forcibly trigger a chown on every entry, no matter what - this.forceChown = opt.forceChown === true - - // turn > this[ONENTRY](entry)) - } - - // a bad or damaged archive is a warning for Parser, but an error - // when extracting. Mark those errors as unrecoverable, because - // the Unpack contract cannot be met. - warn (code, msg, data = {}) { - if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') { - data.recoverable = false - } - return super.warn(code, msg, data) - } - - [MAYBECLOSE] () { - if (this[ENDED] && this[PENDING] === 0) { - this.emit('prefinish') - this.emit('finish') - this.emit('end') - } - } - - [CHECKPATH] (entry) { - const p = normPath(entry.path) - const parts = p.split('/') - - if (this.strip) { - if (parts.length < this.strip) { - return false - } - if (entry.type === 'Link') { - const linkparts = normPath(entry.linkpath).split('/') - if (linkparts.length >= this.strip) { - entry.linkpath = linkparts.slice(this.strip).join('/') - } else { - return false - } - } - parts.splice(0, this.strip) - entry.path = parts.join('/') - } - - if (isFinite(this.maxDepth) && parts.length > this.maxDepth) { - this.warn('TAR_ENTRY_ERROR', 'path excessively deep', { - entry, - path: p, - depth: parts.length, - maxDepth: this.maxDepth, - }) - return false - } - - if (!this.preservePaths) { - if (parts.includes('..') || isWindows && /^[a-z]:\.\.$/i.test(parts[0])) { - this.warn('TAR_ENTRY_ERROR', `path contains '..'`, { - entry, - path: p, - }) - return false - } - - // strip off the root - const [root, stripped] = stripAbsolutePath(p) - if (root) { - entry.path = stripped - this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, { - entry, - path: p, - }) - } - } - - if (path.isAbsolute(entry.path)) { - entry.absolute = normPath(path.resolve(entry.path)) - } else { - entry.absolute = normPath(path.resolve(this.cwd, entry.path)) - } - - // if we somehow ended up with a path that escapes the cwd, and we are - // not in preservePaths mode, then something is fishy! This should have - // been prevented above, so ignore this for coverage. - /* istanbul ignore if - defense in depth */ - if (!this.preservePaths && - entry.absolute.indexOf(this.cwd + '/') !== 0 && - entry.absolute !== this.cwd) { - this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', { - entry, - path: normPath(entry.path), - resolvedPath: entry.absolute, - cwd: this.cwd, - }) - return false - } - - // an archive can set properties on the extraction directory, but it - // may not replace the cwd with a different kind of thing entirely. - if (entry.absolute === this.cwd && - entry.type !== 'Directory' && - entry.type !== 'GNUDumpDir') { - return false - } - - // only encode : chars that aren't drive letter indicators - if (this.win32) { - const { root: aRoot } = path.win32.parse(entry.absolute) - entry.absolute = aRoot + wc.encode(entry.absolute.slice(aRoot.length)) - const { root: pRoot } = path.win32.parse(entry.path) - entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length)) - } - - return true - } - - [ONENTRY] (entry) { - if (!this[CHECKPATH](entry)) { - return entry.resume() - } - - assert.equal(typeof entry.absolute, 'string') - - switch (entry.type) { - case 'Directory': - case 'GNUDumpDir': - if (entry.mode) { - entry.mode = entry.mode | 0o700 - } - - // eslint-disable-next-line no-fallthrough - case 'File': - case 'OldFile': - case 'ContiguousFile': - case 'Link': - case 'SymbolicLink': - return this[CHECKFS](entry) - - case 'CharacterDevice': - case 'BlockDevice': - case 'FIFO': - default: - return this[UNSUPPORTED](entry) - } - } - - [ONERROR] (er, entry) { - // Cwd has to exist, or else nothing works. That's serious. - // Other errors are warnings, which raise the error in strict - // mode, but otherwise continue on. - if (er.name === 'CwdError') { - this.emit('error', er) - } else { - this.warn('TAR_ENTRY_ERROR', er, { entry }) - this[UNPEND]() - entry.resume() - } - } - - [MKDIR] (dir, mode, cb) { - mkdir(normPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - noChmod: this.noChmod, - }, cb) - } - - [DOCHOWN] (entry) { - // in preserve owner mode, chown if the entry doesn't match process - // in set owner mode, chown if setting doesn't match process - return this.forceChown || - this.preserveOwner && - (typeof entry.uid === 'number' && entry.uid !== this.processUid || - typeof entry.gid === 'number' && entry.gid !== this.processGid) - || - (typeof this.uid === 'number' && this.uid !== this.processUid || - typeof this.gid === 'number' && this.gid !== this.processGid) - } - - [UID] (entry) { - return uint32(this.uid, entry.uid, this.processUid) - } - - [GID] (entry) { - return uint32(this.gid, entry.gid, this.processGid) - } - - [FILE] (entry, fullyDone) { - const mode = entry.mode & 0o7777 || this.fmode - const stream = new fsm.WriteStream(entry.absolute, { - flags: getFlag(entry.size), - mode: mode, - autoClose: false, - }) - stream.on('error', er => { - if (stream.fd) { - fs.close(stream.fd, () => {}) - } - - // flush all the data out so that we aren't left hanging - // if the error wasn't actually fatal. otherwise the parse - // is blocked, and we never proceed. - stream.write = () => true - this[ONERROR](er, entry) - fullyDone() - }) - - let actions = 1 - const done = er => { - if (er) { - /* istanbul ignore else - we should always have a fd by now */ - if (stream.fd) { - fs.close(stream.fd, () => {}) - } - - this[ONERROR](er, entry) - fullyDone() - return - } - - if (--actions === 0) { - fs.close(stream.fd, er => { - if (er) { - this[ONERROR](er, entry) - } else { - this[UNPEND]() - } - fullyDone() - }) - } - } - - stream.on('finish', _ => { - // if futimes fails, try utimes - // if utimes fails, fail with the original error - // same for fchown/chown - const abs = entry.absolute - const fd = stream.fd - - if (entry.mtime && !this.noMtime) { - actions++ - const atime = entry.atime || new Date() - const mtime = entry.mtime - fs.futimes(fd, atime, mtime, er => - er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er)) - : done()) - } - - if (this[DOCHOWN](entry)) { - actions++ - const uid = this[UID](entry) - const gid = this[GID](entry) - fs.fchown(fd, uid, gid, er => - er ? fs.chown(abs, uid, gid, er2 => done(er2 && er)) - : done()) - } - - done() - }) - - const tx = this.transform ? this.transform(entry) || entry : entry - if (tx !== entry) { - tx.on('error', er => { - this[ONERROR](er, entry) - fullyDone() - }) - entry.pipe(tx) - } - tx.pipe(stream) - } - - [DIRECTORY] (entry, fullyDone) { - const mode = entry.mode & 0o7777 || this.dmode - this[MKDIR](entry.absolute, mode, er => { - if (er) { - this[ONERROR](er, entry) - fullyDone() - return - } - - let actions = 1 - const done = _ => { - if (--actions === 0) { - fullyDone() - this[UNPEND]() - entry.resume() - } - } - - if (entry.mtime && !this.noMtime) { - actions++ - fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done) - } - - if (this[DOCHOWN](entry)) { - actions++ - fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done) - } - - done() - }) - } - - [UNSUPPORTED] (entry) { - entry.unsupported = true - this.warn('TAR_ENTRY_UNSUPPORTED', - `unsupported entry type: ${entry.type}`, { entry }) - entry.resume() - } - - [SYMLINK] (entry, done) { - this[LINK](entry, entry.linkpath, 'symlink', done) - } - - [HARDLINK] (entry, done) { - const linkpath = normPath(path.resolve(this.cwd, entry.linkpath)) - this[LINK](entry, linkpath, 'link', done) - } - - [PEND] () { - this[PENDING]++ - } - - [UNPEND] () { - this[PENDING]-- - this[MAYBECLOSE]() - } - - [SKIP] (entry) { - this[UNPEND]() - entry.resume() - } - - // Check if we can reuse an existing filesystem entry safely and - // overwrite it, rather than unlinking and recreating - // Windows doesn't report a useful nlink, so we just never reuse entries - [ISREUSABLE] (entry, st) { - return entry.type === 'File' && - !this.unlink && - st.isFile() && - st.nlink <= 1 && - !isWindows - } - - // check if a thing is there, and if so, try to clobber it - [CHECKFS] (entry) { - this[PEND]() - const paths = [entry.path] - if (entry.linkpath) { - paths.push(entry.linkpath) - } - this.reservations.reserve(paths, done => this[CHECKFS2](entry, done)) - } - - [PRUNECACHE] (entry) { - // if we are not creating a directory, and the path is in the dirCache, - // then that means we are about to delete the directory we created - // previously, and it is no longer going to be a directory, and neither - // is any of its children. - // If a symbolic link is encountered, all bets are off. There is no - // reasonable way to sanitize the cache in such a way we will be able to - // avoid having filesystem collisions. If this happens with a non-symlink - // entry, it'll just fail to unpack, but a symlink to a directory, using an - // 8.3 shortname or certain unicode attacks, can evade detection and lead - // to arbitrary writes to anywhere on the system. - if (entry.type === 'SymbolicLink') { - dropCache(this.dirCache) - } else if (entry.type !== 'Directory') { - pruneCache(this.dirCache, entry.absolute) - } - } - - [CHECKFS2] (entry, fullyDone) { - this[PRUNECACHE](entry) - - const done = er => { - this[PRUNECACHE](entry) - fullyDone(er) - } - - const checkCwd = () => { - this[MKDIR](this.cwd, this.dmode, er => { - if (er) { - this[ONERROR](er, entry) - done() - return - } - this[CHECKED_CWD] = true - start() - }) - } - - const start = () => { - if (entry.absolute !== this.cwd) { - const parent = normPath(path.dirname(entry.absolute)) - if (parent !== this.cwd) { - return this[MKDIR](parent, this.dmode, er => { - if (er) { - this[ONERROR](er, entry) - done() - return - } - afterMakeParent() - }) - } - } - afterMakeParent() - } - - const afterMakeParent = () => { - fs.lstat(entry.absolute, (lstatEr, st) => { - if (st && (this.keep || this.newer && st.mtime > entry.mtime)) { - this[SKIP](entry) - done() - return - } - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry, done) - } - - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = !this.noChmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode - const afterChmod = er => this[MAKEFS](er, entry, done) - if (!needChmod) { - return afterChmod() - } - return fs.chmod(entry.absolute, entry.mode, afterChmod) - } - // Not a dir entry, have to remove it. - // NB: the only way to end up with an entry that is the cwd - // itself, in such a way that == does not detect, is a - // tricky windows absolute path with UNC or 8.3 parts (and - // preservePaths:true, or else it will have been stripped). - // In that case, the user has opted out of path protections - // explicitly, so if they blow away the cwd, c'est la vie. - if (entry.absolute !== this.cwd) { - return fs.rmdir(entry.absolute, er => - this[MAKEFS](er, entry, done)) - } - } - - // not a dir, and not reusable - // don't remove if the cwd, we want that error - if (entry.absolute === this.cwd) { - return this[MAKEFS](null, entry, done) - } - - unlinkFile(entry.absolute, er => - this[MAKEFS](er, entry, done)) - }) - } - - if (this[CHECKED_CWD]) { - start() - } else { - checkCwd() - } - } - - [MAKEFS] (er, entry, done) { - if (er) { - this[ONERROR](er, entry) - done() - return - } - - switch (entry.type) { - case 'File': - case 'OldFile': - case 'ContiguousFile': - return this[FILE](entry, done) - - case 'Link': - return this[HARDLINK](entry, done) - - case 'SymbolicLink': - return this[SYMLINK](entry, done) - - case 'Directory': - case 'GNUDumpDir': - return this[DIRECTORY](entry, done) - } - } - - [LINK] (entry, linkpath, link, done) { - // XXX: get the type ('symlink' or 'junction') for windows - fs[link](linkpath, entry.absolute, er => { - if (er) { - this[ONERROR](er, entry) - } else { - this[UNPEND]() - entry.resume() - } - done() - }) - } -} - -const callSync = fn => { - try { - return [null, fn()] - } catch (er) { - return [er, null] - } -} -class UnpackSync extends Unpack { - [MAKEFS] (er, entry) { - return super[MAKEFS](er, entry, () => {}) - } - - [CHECKFS] (entry) { - this[PRUNECACHE](entry) - - if (!this[CHECKED_CWD]) { - const er = this[MKDIR](this.cwd, this.dmode) - if (er) { - return this[ONERROR](er, entry) - } - this[CHECKED_CWD] = true - } - - // don't bother to make the parent if the current entry is the cwd, - // we've already checked it. - if (entry.absolute !== this.cwd) { - const parent = normPath(path.dirname(entry.absolute)) - if (parent !== this.cwd) { - const mkParent = this[MKDIR](parent, this.dmode) - if (mkParent) { - return this[ONERROR](mkParent, entry) - } - } - } - - const [lstatEr, st] = callSync(() => fs.lstatSync(entry.absolute)) - if (st && (this.keep || this.newer && st.mtime > entry.mtime)) { - return this[SKIP](entry) - } - - if (lstatEr || this[ISREUSABLE](entry, st)) { - return this[MAKEFS](null, entry) - } - - if (st.isDirectory()) { - if (entry.type === 'Directory') { - const needChmod = !this.noChmod && - entry.mode && - (st.mode & 0o7777) !== entry.mode - const [er] = needChmod ? callSync(() => { - fs.chmodSync(entry.absolute, entry.mode) - }) : [] - return this[MAKEFS](er, entry) - } - // not a dir entry, have to remove it - const [er] = callSync(() => fs.rmdirSync(entry.absolute)) - this[MAKEFS](er, entry) - } - - // not a dir, and not reusable. - // don't remove if it's the cwd, since we want that error. - const [er] = entry.absolute === this.cwd ? [] - : callSync(() => unlinkFileSync(entry.absolute)) - this[MAKEFS](er, entry) - } - - [FILE] (entry, done) { - const mode = entry.mode & 0o7777 || this.fmode - - const oner = er => { - let closeError - try { - fs.closeSync(fd) - } catch (e) { - closeError = e - } - if (er || closeError) { - this[ONERROR](er || closeError, entry) - } - done() - } - - let fd - try { - fd = fs.openSync(entry.absolute, getFlag(entry.size), mode) - } catch (er) { - return oner(er) - } - const tx = this.transform ? this.transform(entry) || entry : entry - if (tx !== entry) { - tx.on('error', er => this[ONERROR](er, entry)) - entry.pipe(tx) - } - - tx.on('data', chunk => { - try { - fs.writeSync(fd, chunk, 0, chunk.length) - } catch (er) { - oner(er) - } - }) - - tx.on('end', _ => { - let er = null - // try both, falling futimes back to utimes - // if either fails, handle the first error - if (entry.mtime && !this.noMtime) { - const atime = entry.atime || new Date() - const mtime = entry.mtime - try { - fs.futimesSync(fd, atime, mtime) - } catch (futimeser) { - try { - fs.utimesSync(entry.absolute, atime, mtime) - } catch (utimeser) { - er = futimeser - } - } - } - - if (this[DOCHOWN](entry)) { - const uid = this[UID](entry) - const gid = this[GID](entry) - - try { - fs.fchownSync(fd, uid, gid) - } catch (fchowner) { - try { - fs.chownSync(entry.absolute, uid, gid) - } catch (chowner) { - er = er || fchowner - } - } - } - - oner(er) - }) - } - - [DIRECTORY] (entry, done) { - const mode = entry.mode & 0o7777 || this.dmode - const er = this[MKDIR](entry.absolute, mode) - if (er) { - this[ONERROR](er, entry) - done() - return - } - if (entry.mtime && !this.noMtime) { - try { - fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime) - } catch (er) {} - } - if (this[DOCHOWN](entry)) { - try { - fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry)) - } catch (er) {} - } - done() - entry.resume() - } - - [MKDIR] (dir, mode) { - try { - return mkdir.sync(normPath(dir), { - uid: this.uid, - gid: this.gid, - processUid: this.processUid, - processGid: this.processGid, - umask: this.processUmask, - preserve: this.preservePaths, - unlink: this.unlink, - cache: this.dirCache, - cwd: this.cwd, - mode: mode, - }) - } catch (er) { - return er - } - } - - [LINK] (entry, linkpath, link, done) { - try { - fs[link + 'Sync'](linkpath, entry.absolute) - done() - entry.resume() - } catch (er) { - return this[ONERROR](er, entry) - } - } -} - -Unpack.Sync = UnpackSync -module.exports = Unpack diff --git a/node_modules/tar/lib/update.js b/node_modules/tar/lib/update.js deleted file mode 100644 index 4d328543b315e..0000000000000 --- a/node_modules/tar/lib/update.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' - -// tar -u - -const hlo = require('./high-level-opt.js') -const r = require('./replace.js') -// just call tar.r with the filter and mtimeCache - -module.exports = (opt_, files, cb) => { - const opt = hlo(opt_) - - if (!opt.file) { - throw new TypeError('file is required') - } - - if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) { - throw new TypeError('cannot append to compressed archives') - } - - if (!files || !Array.isArray(files) || !files.length) { - throw new TypeError('no files or directories specified') - } - - files = Array.from(files) - - mtimeFilter(opt) - return r(opt, files, cb) -} - -const mtimeFilter = opt => { - const filter = opt.filter - - if (!opt.mtimeCache) { - opt.mtimeCache = new Map() - } - - opt.filter = filter ? (path, stat) => - filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime) - : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime) -} diff --git a/node_modules/tar/lib/warn-mixin.js b/node_modules/tar/lib/warn-mixin.js deleted file mode 100644 index a940639636133..0000000000000 --- a/node_modules/tar/lib/warn-mixin.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' -module.exports = Base => class extends Base { - warn (code, message, data = {}) { - if (this.file) { - data.file = this.file - } - if (this.cwd) { - data.cwd = this.cwd - } - data.code = message instanceof Error && message.code || code - data.tarCode = code - if (!this.strict && data.recoverable !== false) { - if (message instanceof Error) { - data = Object.assign(message, data) - message = message.message - } - this.emit('warn', data.tarCode, message, data) - } else if (message instanceof Error) { - this.emit('error', Object.assign(message, data)) - } else { - this.emit('error', Object.assign(new Error(`${code}: ${message}`), data)) - } - } -} diff --git a/node_modules/tar/lib/winchars.js b/node_modules/tar/lib/winchars.js deleted file mode 100644 index ebcab4aed3e52..0000000000000 --- a/node_modules/tar/lib/winchars.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -// When writing files on Windows, translate the characters to their -// 0xf000 higher-encoded versions. - -const raw = [ - '|', - '<', - '>', - '?', - ':', -] - -const win = raw.map(char => - String.fromCharCode(0xf000 + char.charCodeAt(0))) - -const toWin = new Map(raw.map((char, i) => [char, win[i]])) -const toRaw = new Map(win.map((char, i) => [char, raw[i]])) - -module.exports = { - encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s), - decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s), -} diff --git a/node_modules/tar/lib/write-entry.js b/node_modules/tar/lib/write-entry.js deleted file mode 100644 index 7d2f3eb1acc8c..0000000000000 --- a/node_modules/tar/lib/write-entry.js +++ /dev/null @@ -1,546 +0,0 @@ -'use strict' -const { Minipass } = require('minipass') -const Pax = require('./pax.js') -const Header = require('./header.js') -const fs = require('fs') -const path = require('path') -const normPath = require('./normalize-windows-path.js') -const stripSlash = require('./strip-trailing-slashes.js') - -const prefixPath = (path, prefix) => { - if (!prefix) { - return normPath(path) - } - path = normPath(path).replace(/^\.(\/|$)/, '') - return stripSlash(prefix) + '/' + path -} - -const maxReadSize = 16 * 1024 * 1024 -const PROCESS = Symbol('process') -const FILE = Symbol('file') -const DIRECTORY = Symbol('directory') -const SYMLINK = Symbol('symlink') -const HARDLINK = Symbol('hardlink') -const HEADER = Symbol('header') -const READ = Symbol('read') -const LSTAT = Symbol('lstat') -const ONLSTAT = Symbol('onlstat') -const ONREAD = Symbol('onread') -const ONREADLINK = Symbol('onreadlink') -const OPENFILE = Symbol('openfile') -const ONOPENFILE = Symbol('onopenfile') -const CLOSE = Symbol('close') -const MODE = Symbol('mode') -const AWAITDRAIN = Symbol('awaitDrain') -const ONDRAIN = Symbol('ondrain') -const PREFIX = Symbol('prefix') -const HAD_ERROR = Symbol('hadError') -const warner = require('./warn-mixin.js') -const winchars = require('./winchars.js') -const stripAbsolutePath = require('./strip-absolute-path.js') - -const modeFix = require('./mode-fix.js') - -const WriteEntry = warner(class WriteEntry extends Minipass { - constructor (p, opt) { - opt = opt || {} - super(opt) - if (typeof p !== 'string') { - throw new TypeError('path is required') - } - this.path = normPath(p) - // suppress atime, ctime, uid, gid, uname, gname - this.portable = !!opt.portable - // until node has builtin pwnam functions, this'll have to do - this.myuid = process.getuid && process.getuid() || 0 - this.myuser = process.env.USER || '' - this.maxReadSize = opt.maxReadSize || maxReadSize - this.linkCache = opt.linkCache || new Map() - this.statCache = opt.statCache || new Map() - this.preservePaths = !!opt.preservePaths - this.cwd = normPath(opt.cwd || process.cwd()) - this.strict = !!opt.strict - this.noPax = !!opt.noPax - this.noMtime = !!opt.noMtime - this.mtime = opt.mtime || null - this.prefix = opt.prefix ? normPath(opt.prefix) : null - - this.fd = null - this.blockLen = null - this.blockRemain = null - this.buf = null - this.offset = null - this.length = null - this.pos = null - this.remain = null - - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn) - } - - let pathWarn = false - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path) - if (root) { - this.path = stripped - pathWarn = root - } - } - - this.win32 = !!opt.win32 || process.platform === 'win32' - if (this.win32) { - // force the \ to / normalization, since we might not *actually* - // be on windows, but want \ to be considered a path separator. - this.path = winchars.decode(this.path.replace(/\\/g, '/')) - p = p.replace(/\\/g, '/') - } - - this.absolute = normPath(opt.absolute || path.resolve(this.cwd, p)) - - if (this.path === '') { - this.path = './' - } - - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }) - } - - if (this.statCache.has(this.absolute)) { - this[ONLSTAT](this.statCache.get(this.absolute)) - } else { - this[LSTAT]() - } - } - - emit (ev, ...data) { - if (ev === 'error') { - this[HAD_ERROR] = true - } - return super.emit(ev, ...data) - } - - [LSTAT] () { - fs.lstat(this.absolute, (er, stat) => { - if (er) { - return this.emit('error', er) - } - this[ONLSTAT](stat) - }) - } - - [ONLSTAT] (stat) { - this.statCache.set(this.absolute, stat) - this.stat = stat - if (!stat.isFile()) { - stat.size = 0 - } - this.type = getType(stat) - this.emit('stat', stat) - this[PROCESS]() - } - - [PROCESS] () { - switch (this.type) { - case 'File': return this[FILE]() - case 'Directory': return this[DIRECTORY]() - case 'SymbolicLink': return this[SYMLINK]() - // unsupported types are ignored. - default: return this.end() - } - } - - [MODE] (mode) { - return modeFix(mode, this.type === 'Directory', this.portable) - } - - [PREFIX] (path) { - return prefixPath(path, this.prefix) - } - - [HEADER] () { - if (this.type === 'Directory' && this.portable) { - this.noMtime = true - } - - this.header = new Header({ - path: this[PREFIX](this.path), - // only apply the prefix to hard links. - linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this[MODE](this.stat.mode), - uid: this.portable ? null : this.stat.uid, - gid: this.portable ? null : this.stat.gid, - size: this.stat.size, - mtime: this.noMtime ? null : this.mtime || this.stat.mtime, - type: this.type, - uname: this.portable ? null : - this.stat.uid === this.myuid ? this.myuser : '', - atime: this.portable ? null : this.stat.atime, - ctime: this.portable ? null : this.stat.ctime, - }) - - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? null : this.header.atime, - ctime: this.portable ? null : this.header.ctime, - gid: this.portable ? null : this.header.gid, - mtime: this.noMtime ? null : this.mtime || this.header.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) - : this.linkpath, - size: this.header.size, - uid: this.portable ? null : this.header.uid, - uname: this.portable ? null : this.header.uname, - dev: this.portable ? null : this.stat.dev, - ino: this.portable ? null : this.stat.ino, - nlink: this.portable ? null : this.stat.nlink, - }).encode()) - } - super.write(this.header.block) - } - - [DIRECTORY] () { - if (this.path.slice(-1) !== '/') { - this.path += '/' - } - this.stat.size = 0 - this[HEADER]() - this.end() - } - - [SYMLINK] () { - fs.readlink(this.absolute, (er, linkpath) => { - if (er) { - return this.emit('error', er) - } - this[ONREADLINK](linkpath) - }) - } - - [ONREADLINK] (linkpath) { - this.linkpath = normPath(linkpath) - this[HEADER]() - this.end() - } - - [HARDLINK] (linkpath) { - this.type = 'Link' - this.linkpath = normPath(path.relative(this.cwd, linkpath)) - this.stat.size = 0 - this[HEADER]() - this.end() - } - - [FILE] () { - if (this.stat.nlink > 1) { - const linkKey = this.stat.dev + ':' + this.stat.ino - if (this.linkCache.has(linkKey)) { - const linkpath = this.linkCache.get(linkKey) - if (linkpath.indexOf(this.cwd) === 0) { - return this[HARDLINK](linkpath) - } - } - this.linkCache.set(linkKey, this.absolute) - } - - this[HEADER]() - if (this.stat.size === 0) { - return this.end() - } - - this[OPENFILE]() - } - - [OPENFILE] () { - fs.open(this.absolute, 'r', (er, fd) => { - if (er) { - return this.emit('error', er) - } - this[ONOPENFILE](fd) - }) - } - - [ONOPENFILE] (fd) { - this.fd = fd - if (this[HAD_ERROR]) { - return this[CLOSE]() - } - - this.blockLen = 512 * Math.ceil(this.stat.size / 512) - this.blockRemain = this.blockLen - const bufLen = Math.min(this.blockLen, this.maxReadSize) - this.buf = Buffer.allocUnsafe(bufLen) - this.offset = 0 - this.pos = 0 - this.remain = this.stat.size - this.length = this.buf.length - this[READ]() - } - - [READ] () { - const { fd, buf, offset, length, pos } = this - fs.read(fd, buf, offset, length, pos, (er, bytesRead) => { - if (er) { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - return this[CLOSE](() => this.emit('error', er)) - } - this[ONREAD](bytesRead) - }) - } - - [CLOSE] (cb) { - fs.close(this.fd, cb) - } - - [ONREAD] (bytesRead) { - if (bytesRead <= 0 && this.remain > 0) { - const er = new Error('encountered unexpected EOF') - er.path = this.absolute - er.syscall = 'read' - er.code = 'EOF' - return this[CLOSE](() => this.emit('error', er)) - } - - if (bytesRead > this.remain) { - const er = new Error('did not encounter expected EOF') - er.path = this.absolute - er.syscall = 'read' - er.code = 'EOF' - return this[CLOSE](() => this.emit('error', er)) - } - - // null out the rest of the buffer, if we could fit the block padding - // at the end of this loop, we've incremented bytesRead and this.remain - // to be incremented up to the blockRemain level, as if we had expected - // to get a null-padded file, and read it until the end. then we will - // decrement both remain and blockRemain by bytesRead, and know that we - // reached the expected EOF, without any null buffer to append. - if (bytesRead === this.remain) { - for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) { - this.buf[i + this.offset] = 0 - bytesRead++ - this.remain++ - } - } - - const writeBuf = this.offset === 0 && bytesRead === this.buf.length ? - this.buf : this.buf.slice(this.offset, this.offset + bytesRead) - - const flushed = this.write(writeBuf) - if (!flushed) { - this[AWAITDRAIN](() => this[ONDRAIN]()) - } else { - this[ONDRAIN]() - } - } - - [AWAITDRAIN] (cb) { - this.once('drain', cb) - } - - write (writeBuf) { - if (this.blockRemain < writeBuf.length) { - const er = new Error('writing more data than expected') - er.path = this.absolute - return this.emit('error', er) - } - this.remain -= writeBuf.length - this.blockRemain -= writeBuf.length - this.pos += writeBuf.length - this.offset += writeBuf.length - return super.write(writeBuf) - } - - [ONDRAIN] () { - if (!this.remain) { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)) - } - return this[CLOSE](er => er ? this.emit('error', er) : this.end()) - } - - if (this.offset >= this.length) { - // if we only have a smaller bit left to read, alloc a smaller buffer - // otherwise, keep it the same length it was before. - this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length)) - this.offset = 0 - } - this.length = this.buf.length - this.offset - this[READ]() - } -}) - -class WriteEntrySync extends WriteEntry { - [LSTAT] () { - this[ONLSTAT](fs.lstatSync(this.absolute)) - } - - [SYMLINK] () { - this[ONREADLINK](fs.readlinkSync(this.absolute)) - } - - [OPENFILE] () { - this[ONOPENFILE](fs.openSync(this.absolute, 'r')) - } - - [READ] () { - let threw = true - try { - const { fd, buf, offset, length, pos } = this - const bytesRead = fs.readSync(fd, buf, offset, length, pos) - this[ONREAD](bytesRead) - threw = false - } finally { - // ignoring the error from close(2) is a bad practice, but at - // this point we already have an error, don't need another one - if (threw) { - try { - this[CLOSE](() => {}) - } catch (er) {} - } - } - } - - [AWAITDRAIN] (cb) { - cb() - } - - [CLOSE] (cb) { - fs.closeSync(this.fd) - cb() - } -} - -const WriteEntryTar = warner(class WriteEntryTar extends Minipass { - constructor (readEntry, opt) { - opt = opt || {} - super(opt) - this.preservePaths = !!opt.preservePaths - this.portable = !!opt.portable - this.strict = !!opt.strict - this.noPax = !!opt.noPax - this.noMtime = !!opt.noMtime - - this.readEntry = readEntry - this.type = readEntry.type - if (this.type === 'Directory' && this.portable) { - this.noMtime = true - } - - this.prefix = opt.prefix || null - - this.path = normPath(readEntry.path) - this.mode = this[MODE](readEntry.mode) - this.uid = this.portable ? null : readEntry.uid - this.gid = this.portable ? null : readEntry.gid - this.uname = this.portable ? null : readEntry.uname - this.gname = this.portable ? null : readEntry.gname - this.size = readEntry.size - this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime - this.atime = this.portable ? null : readEntry.atime - this.ctime = this.portable ? null : readEntry.ctime - this.linkpath = normPath(readEntry.linkpath) - - if (typeof opt.onwarn === 'function') { - this.on('warn', opt.onwarn) - } - - let pathWarn = false - if (!this.preservePaths) { - const [root, stripped] = stripAbsolutePath(this.path) - if (root) { - this.path = stripped - pathWarn = root - } - } - - this.remain = readEntry.size - this.blockRemain = readEntry.startBlockSize - - this.header = new Header({ - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) - : this.linkpath, - // only the permissions and setuid/setgid/sticky bitflags - // not the higher-order bits that specify file type - mode: this.mode, - uid: this.portable ? null : this.uid, - gid: this.portable ? null : this.gid, - size: this.size, - mtime: this.noMtime ? null : this.mtime, - type: this.type, - uname: this.portable ? null : this.uname, - atime: this.portable ? null : this.atime, - ctime: this.portable ? null : this.ctime, - }) - - if (pathWarn) { - this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, { - entry: this, - path: pathWarn + this.path, - }) - } - - if (this.header.encode() && !this.noPax) { - super.write(new Pax({ - atime: this.portable ? null : this.atime, - ctime: this.portable ? null : this.ctime, - gid: this.portable ? null : this.gid, - mtime: this.noMtime ? null : this.mtime, - path: this[PREFIX](this.path), - linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath) - : this.linkpath, - size: this.size, - uid: this.portable ? null : this.uid, - uname: this.portable ? null : this.uname, - dev: this.portable ? null : this.readEntry.dev, - ino: this.portable ? null : this.readEntry.ino, - nlink: this.portable ? null : this.readEntry.nlink, - }).encode()) - } - - super.write(this.header.block) - readEntry.pipe(this) - } - - [PREFIX] (path) { - return prefixPath(path, this.prefix) - } - - [MODE] (mode) { - return modeFix(mode, this.type === 'Directory', this.portable) - } - - write (data) { - const writeLen = data.length - if (writeLen > this.blockRemain) { - throw new Error('writing more to entry than is appropriate') - } - this.blockRemain -= writeLen - return super.write(data) - } - - end () { - if (this.blockRemain) { - super.write(Buffer.alloc(this.blockRemain)) - } - return super.end() - } -}) - -WriteEntry.Sync = WriteEntrySync -WriteEntry.Tar = WriteEntryTar - -const getType = stat => - stat.isFile() ? 'File' - : stat.isDirectory() ? 'Directory' - : stat.isSymbolicLink() ? 'SymbolicLink' - : 'Unsupported' - -module.exports = WriteEntry diff --git a/node_modules/tar/node_modules/fs-minipass/LICENSE b/node_modules/tar/node_modules/fs-minipass/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/fs-minipass/index.js b/node_modules/tar/node_modules/fs-minipass/index.js deleted file mode 100644 index 9b0779c80c55e..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/index.js +++ /dev/null @@ -1,422 +0,0 @@ -'use strict' -const MiniPass = require('minipass') -const EE = require('events').EventEmitter -const fs = require('fs') - -let writev = fs.writev -/* istanbul ignore next */ -if (!writev) { - // This entire block can be removed if support for earlier than Node.js - // 12.9.0 is not needed. - const binding = process.binding('fs') - const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback - - writev = (fd, iovec, pos, cb) => { - const done = (er, bw) => cb(er, bw, iovec) - const req = new FSReqWrap() - req.oncomplete = done - binding.writeBuffers(fd, iovec, pos, req) - } -} - -const _autoClose = Symbol('_autoClose') -const _close = Symbol('_close') -const _ended = Symbol('_ended') -const _fd = Symbol('_fd') -const _finished = Symbol('_finished') -const _flags = Symbol('_flags') -const _flush = Symbol('_flush') -const _handleChunk = Symbol('_handleChunk') -const _makeBuf = Symbol('_makeBuf') -const _mode = Symbol('_mode') -const _needDrain = Symbol('_needDrain') -const _onerror = Symbol('_onerror') -const _onopen = Symbol('_onopen') -const _onread = Symbol('_onread') -const _onwrite = Symbol('_onwrite') -const _open = Symbol('_open') -const _path = Symbol('_path') -const _pos = Symbol('_pos') -const _queue = Symbol('_queue') -const _read = Symbol('_read') -const _readSize = Symbol('_readSize') -const _reading = Symbol('_reading') -const _remain = Symbol('_remain') -const _size = Symbol('_size') -const _write = Symbol('_write') -const _writing = Symbol('_writing') -const _defaultFlag = Symbol('_defaultFlag') -const _errored = Symbol('_errored') - -class ReadStream extends MiniPass { - constructor (path, opt) { - opt = opt || {} - super(opt) - - this.readable = true - this.writable = false - - if (typeof path !== 'string') - throw new TypeError('path must be a string') - - this[_errored] = false - this[_fd] = typeof opt.fd === 'number' ? opt.fd : null - this[_path] = path - this[_readSize] = opt.readSize || 16*1024*1024 - this[_reading] = false - this[_size] = typeof opt.size === 'number' ? opt.size : Infinity - this[_remain] = this[_size] - this[_autoClose] = typeof opt.autoClose === 'boolean' ? - opt.autoClose : true - - if (typeof this[_fd] === 'number') - this[_read]() - else - this[_open]() - } - - get fd () { return this[_fd] } - get path () { return this[_path] } - - write () { - throw new TypeError('this is a readable stream') - } - - end () { - throw new TypeError('this is a readable stream') - } - - [_open] () { - fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd)) - } - - [_onopen] (er, fd) { - if (er) - this[_onerror](er) - else { - this[_fd] = fd - this.emit('open', fd) - this[_read]() - } - } - - [_makeBuf] () { - return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain])) - } - - [_read] () { - if (!this[_reading]) { - this[_reading] = true - const buf = this[_makeBuf]() - /* istanbul ignore if */ - if (buf.length === 0) - return process.nextTick(() => this[_onread](null, 0, buf)) - fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) => - this[_onread](er, br, buf)) - } - } - - [_onread] (er, br, buf) { - this[_reading] = false - if (er) - this[_onerror](er) - else if (this[_handleChunk](br, buf)) - this[_read]() - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - const fd = this[_fd] - this[_fd] = null - fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) - } - } - - [_onerror] (er) { - this[_reading] = true - this[_close]() - this.emit('error', er) - } - - [_handleChunk] (br, buf) { - let ret = false - // no effect if infinite - this[_remain] -= br - if (br > 0) - ret = super.write(br < buf.length ? buf.slice(0, br) : buf) - - if (br === 0 || this[_remain] <= 0) { - ret = false - this[_close]() - super.end() - } - - return ret - } - - emit (ev, data) { - switch (ev) { - case 'prefinish': - case 'finish': - break - - case 'drain': - if (typeof this[_fd] === 'number') - this[_read]() - break - - case 'error': - if (this[_errored]) - return - this[_errored] = true - return super.emit(ev, data) - - default: - return super.emit(ev, data) - } - } -} - -class ReadStreamSync extends ReadStream { - [_open] () { - let threw = true - try { - this[_onopen](null, fs.openSync(this[_path], 'r')) - threw = false - } finally { - if (threw) - this[_close]() - } - } - - [_read] () { - let threw = true - try { - if (!this[_reading]) { - this[_reading] = true - do { - const buf = this[_makeBuf]() - /* istanbul ignore next */ - const br = buf.length === 0 ? 0 - : fs.readSync(this[_fd], buf, 0, buf.length, null) - if (!this[_handleChunk](br, buf)) - break - } while (true) - this[_reading] = false - } - threw = false - } finally { - if (threw) - this[_close]() - } - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - const fd = this[_fd] - this[_fd] = null - fs.closeSync(fd) - this.emit('close') - } - } -} - -class WriteStream extends EE { - constructor (path, opt) { - opt = opt || {} - super(opt) - this.readable = false - this.writable = true - this[_errored] = false - this[_writing] = false - this[_ended] = false - this[_needDrain] = false - this[_queue] = [] - this[_path] = path - this[_fd] = typeof opt.fd === 'number' ? opt.fd : null - this[_mode] = opt.mode === undefined ? 0o666 : opt.mode - this[_pos] = typeof opt.start === 'number' ? opt.start : null - this[_autoClose] = typeof opt.autoClose === 'boolean' ? - opt.autoClose : true - - // truncating makes no sense when writing into the middle - const defaultFlag = this[_pos] !== null ? 'r+' : 'w' - this[_defaultFlag] = opt.flags === undefined - this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags - - if (this[_fd] === null) - this[_open]() - } - - emit (ev, data) { - if (ev === 'error') { - if (this[_errored]) - return - this[_errored] = true - } - return super.emit(ev, data) - } - - - get fd () { return this[_fd] } - get path () { return this[_path] } - - [_onerror] (er) { - this[_close]() - this[_writing] = true - this.emit('error', er) - } - - [_open] () { - fs.open(this[_path], this[_flags], this[_mode], - (er, fd) => this[_onopen](er, fd)) - } - - [_onopen] (er, fd) { - if (this[_defaultFlag] && - this[_flags] === 'r+' && - er && er.code === 'ENOENT') { - this[_flags] = 'w' - this[_open]() - } else if (er) - this[_onerror](er) - else { - this[_fd] = fd - this.emit('open', fd) - this[_flush]() - } - } - - end (buf, enc) { - if (buf) - this.write(buf, enc) - - this[_ended] = true - - // synthetic after-write logic, where drain/finish live - if (!this[_writing] && !this[_queue].length && - typeof this[_fd] === 'number') - this[_onwrite](null, 0) - return this - } - - write (buf, enc) { - if (typeof buf === 'string') - buf = Buffer.from(buf, enc) - - if (this[_ended]) { - this.emit('error', new Error('write() after end()')) - return false - } - - if (this[_fd] === null || this[_writing] || this[_queue].length) { - this[_queue].push(buf) - this[_needDrain] = true - return false - } - - this[_writing] = true - this[_write](buf) - return true - } - - [_write] (buf) { - fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => - this[_onwrite](er, bw)) - } - - [_onwrite] (er, bw) { - if (er) - this[_onerror](er) - else { - if (this[_pos] !== null) - this[_pos] += bw - if (this[_queue].length) - this[_flush]() - else { - this[_writing] = false - - if (this[_ended] && !this[_finished]) { - this[_finished] = true - this[_close]() - this.emit('finish') - } else if (this[_needDrain]) { - this[_needDrain] = false - this.emit('drain') - } - } - } - } - - [_flush] () { - if (this[_queue].length === 0) { - if (this[_ended]) - this[_onwrite](null, 0) - } else if (this[_queue].length === 1) - this[_write](this[_queue].pop()) - else { - const iovec = this[_queue] - this[_queue] = [] - writev(this[_fd], iovec, this[_pos], - (er, bw) => this[_onwrite](er, bw)) - } - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - const fd = this[_fd] - this[_fd] = null - fs.close(fd, er => er ? this.emit('error', er) : this.emit('close')) - } - } -} - -class WriteStreamSync extends WriteStream { - [_open] () { - let fd - // only wrap in a try{} block if we know we'll retry, to avoid - // the rethrow obscuring the error's source frame in most cases. - if (this[_defaultFlag] && this[_flags] === 'r+') { - try { - fd = fs.openSync(this[_path], this[_flags], this[_mode]) - } catch (er) { - if (er.code === 'ENOENT') { - this[_flags] = 'w' - return this[_open]() - } else - throw er - } - } else - fd = fs.openSync(this[_path], this[_flags], this[_mode]) - - this[_onopen](null, fd) - } - - [_close] () { - if (this[_autoClose] && typeof this[_fd] === 'number') { - const fd = this[_fd] - this[_fd] = null - fs.closeSync(fd) - this.emit('close') - } - } - - [_write] (buf) { - // throw the original, but try to close if it fails - let threw = true - try { - this[_onwrite](null, - fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos])) - threw = false - } finally { - if (threw) - try { this[_close]() } catch (_) {} - } - } -} - -exports.ReadStream = ReadStream -exports.ReadStreamSync = ReadStreamSync - -exports.WriteStream = WriteStream -exports.WriteStreamSync = WriteStreamSync diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE b/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE deleted file mode 100644 index bf1dece2e1f12..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js b/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js deleted file mode 100644 index e8797aab6cc27..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/index.js +++ /dev/null @@ -1,649 +0,0 @@ -'use strict' -const proc = typeof process === 'object' && process ? process : { - stdout: null, - stderr: null, -} -const EE = require('events') -const Stream = require('stream') -const SD = require('string_decoder').StringDecoder - -const EOF = Symbol('EOF') -const MAYBE_EMIT_END = Symbol('maybeEmitEnd') -const EMITTED_END = Symbol('emittedEnd') -const EMITTING_END = Symbol('emittingEnd') -const EMITTED_ERROR = Symbol('emittedError') -const CLOSED = Symbol('closed') -const READ = Symbol('read') -const FLUSH = Symbol('flush') -const FLUSHCHUNK = Symbol('flushChunk') -const ENCODING = Symbol('encoding') -const DECODER = Symbol('decoder') -const FLOWING = Symbol('flowing') -const PAUSED = Symbol('paused') -const RESUME = Symbol('resume') -const BUFFERLENGTH = Symbol('bufferLength') -const BUFFERPUSH = Symbol('bufferPush') -const BUFFERSHIFT = Symbol('bufferShift') -const OBJECTMODE = Symbol('objectMode') -const DESTROYED = Symbol('destroyed') -const EMITDATA = Symbol('emitData') -const EMITEND = Symbol('emitEnd') -const EMITEND2 = Symbol('emitEnd2') -const ASYNC = Symbol('async') - -const defer = fn => Promise.resolve().then(fn) - -// TODO remove when Node v8 support drops -const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = doIter && Symbol.asyncIterator - || Symbol('asyncIterator not implemented') -const ITERATOR = doIter && Symbol.iterator - || Symbol('iterator not implemented') - -// events that mean 'the stream is over' -// these are treated specially, and re-emitted -// if they are listened for after emitting. -const isEndish = ev => - ev === 'end' || - ev === 'finish' || - ev === 'prefinish' - -const isArrayBuffer = b => b instanceof ArrayBuffer || - typeof b === 'object' && - b.constructor && - b.constructor.name === 'ArrayBuffer' && - b.byteLength >= 0 - -const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) - -class Pipe { - constructor (src, dest, opts) { - this.src = src - this.dest = dest - this.opts = opts - this.ondrain = () => src[RESUME]() - dest.on('drain', this.ondrain) - } - unpipe () { - this.dest.removeListener('drain', this.ondrain) - } - // istanbul ignore next - only here for the prototype - proxyErrors () {} - end () { - this.unpipe() - if (this.opts.end) - this.dest.end() - } -} - -class PipeProxyErrors extends Pipe { - unpipe () { - this.src.removeListener('error', this.proxyErrors) - super.unpipe() - } - constructor (src, dest, opts) { - super(src, dest, opts) - this.proxyErrors = er => dest.emit('error', er) - src.on('error', this.proxyErrors) - } -} - -module.exports = class Minipass extends Stream { - constructor (options) { - super() - this[FLOWING] = false - // whether we're explicitly paused - this[PAUSED] = false - this.pipes = [] - this.buffer = [] - this[OBJECTMODE] = options && options.objectMode || false - if (this[OBJECTMODE]) - this[ENCODING] = null - else - this[ENCODING] = options && options.encoding || null - if (this[ENCODING] === 'buffer') - this[ENCODING] = null - this[ASYNC] = options && !!options.async || false - this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null - this[EOF] = false - this[EMITTED_END] = false - this[EMITTING_END] = false - this[CLOSED] = false - this[EMITTED_ERROR] = null - this.writable = true - this.readable = true - this[BUFFERLENGTH] = 0 - this[DESTROYED] = false - } - - get bufferLength () { return this[BUFFERLENGTH] } - - get encoding () { return this[ENCODING] } - set encoding (enc) { - if (this[OBJECTMODE]) - throw new Error('cannot set encoding in objectMode') - - if (this[ENCODING] && enc !== this[ENCODING] && - (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) - throw new Error('cannot change encoding') - - if (this[ENCODING] !== enc) { - this[DECODER] = enc ? new SD(enc) : null - if (this.buffer.length) - this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) - } - - this[ENCODING] = enc - } - - setEncoding (enc) { - this.encoding = enc - } - - get objectMode () { return this[OBJECTMODE] } - set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om } - - get ['async'] () { return this[ASYNC] } - set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a } - - write (chunk, encoding, cb) { - if (this[EOF]) - throw new Error('write after end') - - if (this[DESTROYED]) { - this.emit('error', Object.assign( - new Error('Cannot call write after a stream was destroyed'), - { code: 'ERR_STREAM_DESTROYED' } - )) - return true - } - - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - - if (!encoding) - encoding = 'utf8' - - const fn = this[ASYNC] ? defer : f => f() - - // convert array buffers and typed array views into buffers - // at some point in the future, we may want to do the opposite! - // leave strings and buffers as-is - // anything else switches us into object mode - if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - else if (isArrayBuffer(chunk)) - chunk = Buffer.from(chunk) - else if (typeof chunk !== 'string') - // use the setter so we throw if we have encoding set - this.objectMode = true - } - - // handle object mode up front, since it's simpler - // this yields better performance, fewer checks later. - if (this[OBJECTMODE]) { - /* istanbul ignore if - maybe impossible? */ - if (this.flowing && this[BUFFERLENGTH] !== 0) - this[FLUSH](true) - - if (this.flowing) - this.emit('data', chunk) - else - this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - - if (cb) - fn(cb) - - return this.flowing - } - - // at this point the chunk is a buffer or string - // don't buffer it up or send it to the decoder - if (!chunk.length) { - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - if (cb) - fn(cb) - return this.flowing - } - - // fast-path writing strings of same encoding to a stream with - // an empty buffer, skipping the buffer/decoder dance - if (typeof chunk === 'string' && - // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { - chunk = Buffer.from(chunk, encoding) - } - - if (Buffer.isBuffer(chunk) && this[ENCODING]) - chunk = this[DECODER].write(chunk) - - // Note: flushing CAN potentially switch us into not-flowing mode - if (this.flowing && this[BUFFERLENGTH] !== 0) - this[FLUSH](true) - - if (this.flowing) - this.emit('data', chunk) - else - this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - - if (cb) - fn(cb) - - return this.flowing - } - - read (n) { - if (this[DESTROYED]) - return null - - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { - this[MAYBE_EMIT_END]() - return null - } - - if (this[OBJECTMODE]) - n = null - - if (this.buffer.length > 1 && !this[OBJECTMODE]) { - if (this.encoding) - this.buffer = [this.buffer.join('')] - else - this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])] - } - - const ret = this[READ](n || null, this.buffer[0]) - this[MAYBE_EMIT_END]() - return ret - } - - [READ] (n, chunk) { - if (n === chunk.length || n === null) - this[BUFFERSHIFT]() - else { - this.buffer[0] = chunk.slice(n) - chunk = chunk.slice(0, n) - this[BUFFERLENGTH] -= n - } - - this.emit('data', chunk) - - if (!this.buffer.length && !this[EOF]) - this.emit('drain') - - return chunk - } - - end (chunk, encoding, cb) { - if (typeof chunk === 'function') - cb = chunk, chunk = null - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - if (chunk) - this.write(chunk, encoding) - if (cb) - this.once('end', cb) - this[EOF] = true - this.writable = false - - // if we haven't written anything, then go ahead and emit, - // even if we're not reading. - // we'll re-emit if a new 'end' listener is added anyway. - // This makes MP more suitable to write-only use cases. - if (this.flowing || !this[PAUSED]) - this[MAYBE_EMIT_END]() - return this - } - - // don't let the internal resume be overwritten - [RESUME] () { - if (this[DESTROYED]) - return - - this[PAUSED] = false - this[FLOWING] = true - this.emit('resume') - if (this.buffer.length) - this[FLUSH]() - else if (this[EOF]) - this[MAYBE_EMIT_END]() - else - this.emit('drain') - } - - resume () { - return this[RESUME]() - } - - pause () { - this[FLOWING] = false - this[PAUSED] = true - } - - get destroyed () { - return this[DESTROYED] - } - - get flowing () { - return this[FLOWING] - } - - get paused () { - return this[PAUSED] - } - - [BUFFERPUSH] (chunk) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] += 1 - else - this[BUFFERLENGTH] += chunk.length - this.buffer.push(chunk) - } - - [BUFFERSHIFT] () { - if (this.buffer.length) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] -= 1 - else - this[BUFFERLENGTH] -= this.buffer[0].length - } - return this.buffer.shift() - } - - [FLUSH] (noDrain) { - do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) - - if (!noDrain && !this.buffer.length && !this[EOF]) - this.emit('drain') - } - - [FLUSHCHUNK] (chunk) { - return chunk ? (this.emit('data', chunk), this.flowing) : false - } - - pipe (dest, opts) { - if (this[DESTROYED]) - return - - const ended = this[EMITTED_END] - opts = opts || {} - if (dest === proc.stdout || dest === proc.stderr) - opts.end = false - else - opts.end = opts.end !== false - opts.proxyErrors = !!opts.proxyErrors - - // piping an ended stream ends immediately - if (ended) { - if (opts.end) - dest.end() - } else { - this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts) - : new PipeProxyErrors(this, dest, opts)) - if (this[ASYNC]) - defer(() => this[RESUME]()) - else - this[RESUME]() - } - - return dest - } - - unpipe (dest) { - const p = this.pipes.find(p => p.dest === dest) - if (p) { - this.pipes.splice(this.pipes.indexOf(p), 1) - p.unpipe() - } - } - - addListener (ev, fn) { - return this.on(ev, fn) - } - - on (ev, fn) { - const ret = super.on(ev, fn) - if (ev === 'data' && !this.pipes.length && !this.flowing) - this[RESUME]() - else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) - super.emit('readable') - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } else if (ev === 'error' && this[EMITTED_ERROR]) { - if (this[ASYNC]) - defer(() => fn.call(this, this[EMITTED_ERROR])) - else - fn.call(this, this[EMITTED_ERROR]) - } - return ret - } - - get emittedEnd () { - return this[EMITTED_END] - } - - [MAYBE_EMIT_END] () { - if (!this[EMITTING_END] && - !this[EMITTED_END] && - !this[DESTROYED] && - this.buffer.length === 0 && - this[EOF]) { - this[EMITTING_END] = true - this.emit('end') - this.emit('prefinish') - this.emit('finish') - if (this[CLOSED]) - this.emit('close') - this[EMITTING_END] = false - } - } - - emit (ev, data, ...extra) { - // error and close are only events allowed after calling destroy() - if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) - return - else if (ev === 'data') { - return !data ? false - : this[ASYNC] ? defer(() => this[EMITDATA](data)) - : this[EMITDATA](data) - } else if (ev === 'end') { - return this[EMITEND]() - } else if (ev === 'close') { - this[CLOSED] = true - // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END] && !this[DESTROYED]) - return - const ret = super.emit('close') - this.removeAllListeners('close') - return ret - } else if (ev === 'error') { - this[EMITTED_ERROR] = data - const ret = super.emit('error', data) - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'resume') { - const ret = super.emit('resume') - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'finish' || ev === 'prefinish') { - const ret = super.emit(ev) - this.removeAllListeners(ev) - return ret - } - - // Some other unknown event - const ret = super.emit(ev, data, ...extra) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITDATA] (data) { - for (const p of this.pipes) { - if (p.dest.write(data) === false) - this.pause() - } - const ret = super.emit('data', data) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITEND] () { - if (this[EMITTED_END]) - return - - this[EMITTED_END] = true - this.readable = false - if (this[ASYNC]) - defer(() => this[EMITEND2]()) - else - this[EMITEND2]() - } - - [EMITEND2] () { - if (this[DECODER]) { - const data = this[DECODER].end() - if (data) { - for (const p of this.pipes) { - p.dest.write(data) - } - super.emit('data', data) - } - } - - for (const p of this.pipes) { - p.end() - } - const ret = super.emit('end') - this.removeAllListeners('end') - return ret - } - - // const all = await stream.collect() - collect () { - const buf = [] - if (!this[OBJECTMODE]) - buf.dataLength = 0 - // set the promise first, in case an error is raised - // by triggering the flow here. - const p = this.promise() - this.on('data', c => { - buf.push(c) - if (!this[OBJECTMODE]) - buf.dataLength += c.length - }) - return p.then(() => buf) - } - - // const data = await stream.concat() - concat () { - return this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this.collect().then(buf => - this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength)) - } - - // stream.promise().then(() => done, er => emitted error) - promise () { - return new Promise((resolve, reject) => { - this.on(DESTROYED, () => reject(new Error('stream destroyed'))) - this.on('error', er => reject(er)) - this.on('end', () => resolve()) - }) - } - - // for await (let chunk of stream) - [ASYNCITERATOR] () { - const next = () => { - const res = this.read() - if (res !== null) - return Promise.resolve({ done: false, value: res }) - - if (this[EOF]) - return Promise.resolve({ done: true }) - - let resolve = null - let reject = null - const onerr = er => { - this.removeListener('data', ondata) - this.removeListener('end', onend) - reject(er) - } - const ondata = value => { - this.removeListener('error', onerr) - this.removeListener('end', onend) - this.pause() - resolve({ value: value, done: !!this[EOF] }) - } - const onend = () => { - this.removeListener('error', onerr) - this.removeListener('data', ondata) - resolve({ done: true }) - } - const ondestroy = () => onerr(new Error('stream destroyed')) - return new Promise((res, rej) => { - reject = rej - resolve = res - this.once(DESTROYED, ondestroy) - this.once('error', onerr) - this.once('end', onend) - this.once('data', ondata) - }) - } - - return { next } - } - - // for (let chunk of stream) - [ITERATOR] () { - const next = () => { - const value = this.read() - const done = value === null - return { value, done } - } - return { next } - } - - destroy (er) { - if (this[DESTROYED]) { - if (er) - this.emit('error', er) - else - this.emit(DESTROYED) - return this - } - - this[DESTROYED] = true - - // throw away all buffered data, it's never coming out - this.buffer.length = 0 - this[BUFFERLENGTH] = 0 - - if (typeof this.close === 'function' && !this[CLOSED]) - this.close() - - if (er) - this.emit('error', er) - else // if no error to emit, still reject pending promises - this.emit(DESTROYED) - - return this - } - - static isStream (s) { - return !!s && (s instanceof Minipass || s instanceof Stream || - s instanceof EE && ( - typeof s.pipe === 'function' || // readable - (typeof s.write === 'function' && typeof s.end === 'function') // writable - )) - } -} diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json b/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json deleted file mode 100644 index 548d03fa6d5d4..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/minipass/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "minipass", - "version": "3.3.6", - "description": "minimal implementation of a PassThrough stream", - "main": "index.js", - "types": "index.d.ts", - "dependencies": { - "yallist": "^4.0.0" - }, - "devDependencies": { - "@types/node": "^17.0.41", - "end-of-stream": "^1.4.0", - "prettier": "^2.6.2", - "tap": "^16.2.0", - "through2": "^2.0.3", - "ts-node": "^10.8.1", - "typescript": "^4.7.3" - }, - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minipass.git" - }, - "keywords": [ - "passthrough", - "stream" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "files": [ - "index.d.ts", - "index.js" - ], - "tap": { - "check-coverage": true - }, - "engines": { - "node": ">=8" - }, - "prettier": { - "semi": false, - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - } -} diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/LICENSE b/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/iterator.js b/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/iterator.js deleted file mode 100644 index d41c97a19f984..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/iterator.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } - } -} diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/package.json b/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/package.json deleted file mode 100644 index 8a083867d72e0..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "yallist", - "version": "4.0.0", - "description": "Yet Another Linked List", - "main": "yallist.js", - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "dependencies": {}, - "devDependencies": { - "tap": "^12.1.0" - }, - "scripts": { - "test": "tap test/*.js --100", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC" -} diff --git a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/yallist.js b/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/yallist.js deleted file mode 100644 index 4e83ab1c542a5..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/node_modules/yallist/yallist.js +++ /dev/null @@ -1,426 +0,0 @@ -'use strict' -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null - - return next -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.splice = function (start, deleteCount, ...nodes) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } - - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev - } - - for (var i = 0; i < nodes.length; i++) { - walker = insert(this, walker, nodes[i]) - } - return ret; -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) - - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } - - self.length++ - - return inserted -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support for Symbol.iterator is present - require('./iterator.js')(Yallist) -} catch (er) {} diff --git a/node_modules/tar/node_modules/fs-minipass/package.json b/node_modules/tar/node_modules/fs-minipass/package.json deleted file mode 100644 index 2f2436cb5c3b1..0000000000000 --- a/node_modules/tar/node_modules/fs-minipass/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "fs-minipass", - "version": "2.1.0", - "main": "index.js", - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "keywords": [], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "repository": { - "type": "git", - "url": "git+https://github.com/npm/fs-minipass.git" - }, - "bugs": { - "url": "https://github.com/npm/fs-minipass/issues" - }, - "homepage": "https://github.com/npm/fs-minipass#readme", - "description": "fs read and write streams based on minipass", - "dependencies": { - "minipass": "^3.0.0" - }, - "devDependencies": { - "mutate-fs": "^2.0.1", - "tap": "^14.6.4" - }, - "files": [ - "index.js" - ], - "tap": { - "check-coverage": true - }, - "engines": { - "node": ">= 8" - } -} diff --git a/node_modules/tar/node_modules/minipass/LICENSE b/node_modules/tar/node_modules/minipass/LICENSE deleted file mode 100644 index 97f8e32ed82e4..0000000000000 --- a/node_modules/tar/node_modules/minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/minipass/index.js b/node_modules/tar/node_modules/minipass/index.js deleted file mode 100644 index ed07c17acd97b..0000000000000 --- a/node_modules/tar/node_modules/minipass/index.js +++ /dev/null @@ -1,702 +0,0 @@ -'use strict' -const proc = - typeof process === 'object' && process - ? process - : { - stdout: null, - stderr: null, - } -const EE = require('events') -const Stream = require('stream') -const stringdecoder = require('string_decoder') -const SD = stringdecoder.StringDecoder - -const EOF = Symbol('EOF') -const MAYBE_EMIT_END = Symbol('maybeEmitEnd') -const EMITTED_END = Symbol('emittedEnd') -const EMITTING_END = Symbol('emittingEnd') -const EMITTED_ERROR = Symbol('emittedError') -const CLOSED = Symbol('closed') -const READ = Symbol('read') -const FLUSH = Symbol('flush') -const FLUSHCHUNK = Symbol('flushChunk') -const ENCODING = Symbol('encoding') -const DECODER = Symbol('decoder') -const FLOWING = Symbol('flowing') -const PAUSED = Symbol('paused') -const RESUME = Symbol('resume') -const BUFFER = Symbol('buffer') -const PIPES = Symbol('pipes') -const BUFFERLENGTH = Symbol('bufferLength') -const BUFFERPUSH = Symbol('bufferPush') -const BUFFERSHIFT = Symbol('bufferShift') -const OBJECTMODE = Symbol('objectMode') -// internal event when stream is destroyed -const DESTROYED = Symbol('destroyed') -// internal event when stream has an error -const ERROR = Symbol('error') -const EMITDATA = Symbol('emitData') -const EMITEND = Symbol('emitEnd') -const EMITEND2 = Symbol('emitEnd2') -const ASYNC = Symbol('async') -const ABORT = Symbol('abort') -const ABORTED = Symbol('aborted') -const SIGNAL = Symbol('signal') - -const defer = fn => Promise.resolve().then(fn) - -// TODO remove when Node v8 support drops -const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = - (doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented') -const ITERATOR = - (doIter && Symbol.iterator) || Symbol('iterator not implemented') - -// events that mean 'the stream is over' -// these are treated specially, and re-emitted -// if they are listened for after emitting. -const isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish' - -const isArrayBuffer = b => - b instanceof ArrayBuffer || - (typeof b === 'object' && - b.constructor && - b.constructor.name === 'ArrayBuffer' && - b.byteLength >= 0) - -const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) - -class Pipe { - constructor(src, dest, opts) { - this.src = src - this.dest = dest - this.opts = opts - this.ondrain = () => src[RESUME]() - dest.on('drain', this.ondrain) - } - unpipe() { - this.dest.removeListener('drain', this.ondrain) - } - // istanbul ignore next - only here for the prototype - proxyErrors() {} - end() { - this.unpipe() - if (this.opts.end) this.dest.end() - } -} - -class PipeProxyErrors extends Pipe { - unpipe() { - this.src.removeListener('error', this.proxyErrors) - super.unpipe() - } - constructor(src, dest, opts) { - super(src, dest, opts) - this.proxyErrors = er => dest.emit('error', er) - src.on('error', this.proxyErrors) - } -} - -class Minipass extends Stream { - constructor(options) { - super() - this[FLOWING] = false - // whether we're explicitly paused - this[PAUSED] = false - this[PIPES] = [] - this[BUFFER] = [] - this[OBJECTMODE] = (options && options.objectMode) || false - if (this[OBJECTMODE]) this[ENCODING] = null - else this[ENCODING] = (options && options.encoding) || null - if (this[ENCODING] === 'buffer') this[ENCODING] = null - this[ASYNC] = (options && !!options.async) || false - this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null - this[EOF] = false - this[EMITTED_END] = false - this[EMITTING_END] = false - this[CLOSED] = false - this[EMITTED_ERROR] = null - this.writable = true - this.readable = true - this[BUFFERLENGTH] = 0 - this[DESTROYED] = false - if (options && options.debugExposeBuffer === true) { - Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }) - } - if (options && options.debugExposePipes === true) { - Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }) - } - this[SIGNAL] = options && options.signal - this[ABORTED] = false - if (this[SIGNAL]) { - this[SIGNAL].addEventListener('abort', () => this[ABORT]()) - if (this[SIGNAL].aborted) { - this[ABORT]() - } - } - } - - get bufferLength() { - return this[BUFFERLENGTH] - } - - get encoding() { - return this[ENCODING] - } - set encoding(enc) { - if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode') - - if ( - this[ENCODING] && - enc !== this[ENCODING] && - ((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH]) - ) - throw new Error('cannot change encoding') - - if (this[ENCODING] !== enc) { - this[DECODER] = enc ? new SD(enc) : null - if (this[BUFFER].length) - this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk)) - } - - this[ENCODING] = enc - } - - setEncoding(enc) { - this.encoding = enc - } - - get objectMode() { - return this[OBJECTMODE] - } - set objectMode(om) { - this[OBJECTMODE] = this[OBJECTMODE] || !!om - } - - get ['async']() { - return this[ASYNC] - } - set ['async'](a) { - this[ASYNC] = this[ASYNC] || !!a - } - - // drop everything and get out of the flow completely - [ABORT]() { - this[ABORTED] = true - this.emit('abort', this[SIGNAL].reason) - this.destroy(this[SIGNAL].reason) - } - - get aborted() { - return this[ABORTED] - } - set aborted(_) {} - - write(chunk, encoding, cb) { - if (this[ABORTED]) return false - if (this[EOF]) throw new Error('write after end') - - if (this[DESTROYED]) { - this.emit( - 'error', - Object.assign( - new Error('Cannot call write after a stream was destroyed'), - { code: 'ERR_STREAM_DESTROYED' } - ) - ) - return true - } - - if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8') - - if (!encoding) encoding = 'utf8' - - const fn = this[ASYNC] ? defer : f => f() - - // convert array buffers and typed array views into buffers - // at some point in the future, we may want to do the opposite! - // leave strings and buffers as-is - // anything else switches us into object mode - if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk) - else if (typeof chunk !== 'string') - // use the setter so we throw if we have encoding set - this.objectMode = true - } - - // handle object mode up front, since it's simpler - // this yields better performance, fewer checks later. - if (this[OBJECTMODE]) { - /* istanbul ignore if - maybe impossible? */ - if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true) - - if (this.flowing) this.emit('data', chunk) - else this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - - if (cb) fn(cb) - - return this.flowing - } - - // at this point the chunk is a buffer or string - // don't buffer it up or send it to the decoder - if (!chunk.length) { - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - if (cb) fn(cb) - return this.flowing - } - - // fast-path writing strings of same encoding to a stream with - // an empty buffer, skipping the buffer/decoder dance - if ( - typeof chunk === 'string' && - // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER].lastNeed) - ) { - chunk = Buffer.from(chunk, encoding) - } - - if (Buffer.isBuffer(chunk) && this[ENCODING]) - chunk = this[DECODER].write(chunk) - - // Note: flushing CAN potentially switch us into not-flowing mode - if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true) - - if (this.flowing) this.emit('data', chunk) - else this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - - if (cb) fn(cb) - - return this.flowing - } - - read(n) { - if (this[DESTROYED]) return null - - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { - this[MAYBE_EMIT_END]() - return null - } - - if (this[OBJECTMODE]) n = null - - if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { - if (this.encoding) this[BUFFER] = [this[BUFFER].join('')] - else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])] - } - - const ret = this[READ](n || null, this[BUFFER][0]) - this[MAYBE_EMIT_END]() - return ret - } - - [READ](n, chunk) { - if (n === chunk.length || n === null) this[BUFFERSHIFT]() - else { - this[BUFFER][0] = chunk.slice(n) - chunk = chunk.slice(0, n) - this[BUFFERLENGTH] -= n - } - - this.emit('data', chunk) - - if (!this[BUFFER].length && !this[EOF]) this.emit('drain') - - return chunk - } - - end(chunk, encoding, cb) { - if (typeof chunk === 'function') (cb = chunk), (chunk = null) - if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8') - if (chunk) this.write(chunk, encoding) - if (cb) this.once('end', cb) - this[EOF] = true - this.writable = false - - // if we haven't written anything, then go ahead and emit, - // even if we're not reading. - // we'll re-emit if a new 'end' listener is added anyway. - // This makes MP more suitable to write-only use cases. - if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]() - return this - } - - // don't let the internal resume be overwritten - [RESUME]() { - if (this[DESTROYED]) return - - this[PAUSED] = false - this[FLOWING] = true - this.emit('resume') - if (this[BUFFER].length) this[FLUSH]() - else if (this[EOF]) this[MAYBE_EMIT_END]() - else this.emit('drain') - } - - resume() { - return this[RESUME]() - } - - pause() { - this[FLOWING] = false - this[PAUSED] = true - } - - get destroyed() { - return this[DESTROYED] - } - - get flowing() { - return this[FLOWING] - } - - get paused() { - return this[PAUSED] - } - - [BUFFERPUSH](chunk) { - if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1 - else this[BUFFERLENGTH] += chunk.length - this[BUFFER].push(chunk) - } - - [BUFFERSHIFT]() { - if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1 - else this[BUFFERLENGTH] -= this[BUFFER][0].length - return this[BUFFER].shift() - } - - [FLUSH](noDrain) { - do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length) - - if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain') - } - - [FLUSHCHUNK](chunk) { - this.emit('data', chunk) - return this.flowing - } - - pipe(dest, opts) { - if (this[DESTROYED]) return - - const ended = this[EMITTED_END] - opts = opts || {} - if (dest === proc.stdout || dest === proc.stderr) opts.end = false - else opts.end = opts.end !== false - opts.proxyErrors = !!opts.proxyErrors - - // piping an ended stream ends immediately - if (ended) { - if (opts.end) dest.end() - } else { - this[PIPES].push( - !opts.proxyErrors - ? new Pipe(this, dest, opts) - : new PipeProxyErrors(this, dest, opts) - ) - if (this[ASYNC]) defer(() => this[RESUME]()) - else this[RESUME]() - } - - return dest - } - - unpipe(dest) { - const p = this[PIPES].find(p => p.dest === dest) - if (p) { - this[PIPES].splice(this[PIPES].indexOf(p), 1) - p.unpipe() - } - } - - addListener(ev, fn) { - return this.on(ev, fn) - } - - on(ev, fn) { - const ret = super.on(ev, fn) - if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]() - else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) - super.emit('readable') - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } else if (ev === 'error' && this[EMITTED_ERROR]) { - if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR])) - else fn.call(this, this[EMITTED_ERROR]) - } - return ret - } - - get emittedEnd() { - return this[EMITTED_END] - } - - [MAYBE_EMIT_END]() { - if ( - !this[EMITTING_END] && - !this[EMITTED_END] && - !this[DESTROYED] && - this[BUFFER].length === 0 && - this[EOF] - ) { - this[EMITTING_END] = true - this.emit('end') - this.emit('prefinish') - this.emit('finish') - if (this[CLOSED]) this.emit('close') - this[EMITTING_END] = false - } - } - - emit(ev, data, ...extra) { - // error and close are only events allowed after calling destroy() - if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) - return - else if (ev === 'data') { - return !this[OBJECTMODE] && !data - ? false - : this[ASYNC] - ? defer(() => this[EMITDATA](data)) - : this[EMITDATA](data) - } else if (ev === 'end') { - return this[EMITEND]() - } else if (ev === 'close') { - this[CLOSED] = true - // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END] && !this[DESTROYED]) return - const ret = super.emit('close') - this.removeAllListeners('close') - return ret - } else if (ev === 'error') { - this[EMITTED_ERROR] = data - super.emit(ERROR, data) - const ret = - !this[SIGNAL] || this.listeners('error').length - ? super.emit('error', data) - : false - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'resume') { - const ret = super.emit('resume') - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'finish' || ev === 'prefinish') { - const ret = super.emit(ev) - this.removeAllListeners(ev) - return ret - } - - // Some other unknown event - const ret = super.emit(ev, data, ...extra) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITDATA](data) { - for (const p of this[PIPES]) { - if (p.dest.write(data) === false) this.pause() - } - const ret = super.emit('data', data) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITEND]() { - if (this[EMITTED_END]) return - - this[EMITTED_END] = true - this.readable = false - if (this[ASYNC]) defer(() => this[EMITEND2]()) - else this[EMITEND2]() - } - - [EMITEND2]() { - if (this[DECODER]) { - const data = this[DECODER].end() - if (data) { - for (const p of this[PIPES]) { - p.dest.write(data) - } - super.emit('data', data) - } - } - - for (const p of this[PIPES]) { - p.end() - } - const ret = super.emit('end') - this.removeAllListeners('end') - return ret - } - - // const all = await stream.collect() - collect() { - const buf = [] - if (!this[OBJECTMODE]) buf.dataLength = 0 - // set the promise first, in case an error is raised - // by triggering the flow here. - const p = this.promise() - this.on('data', c => { - buf.push(c) - if (!this[OBJECTMODE]) buf.dataLength += c.length - }) - return p.then(() => buf) - } - - // const data = await stream.concat() - concat() { - return this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this.collect().then(buf => - this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this[ENCODING] - ? buf.join('') - : Buffer.concat(buf, buf.dataLength) - ) - } - - // stream.promise().then(() => done, er => emitted error) - promise() { - return new Promise((resolve, reject) => { - this.on(DESTROYED, () => reject(new Error('stream destroyed'))) - this.on('error', er => reject(er)) - this.on('end', () => resolve()) - }) - } - - // for await (let chunk of stream) - [ASYNCITERATOR]() { - let stopped = false - const stop = () => { - this.pause() - stopped = true - return Promise.resolve({ done: true }) - } - const next = () => { - if (stopped) return stop() - const res = this.read() - if (res !== null) return Promise.resolve({ done: false, value: res }) - - if (this[EOF]) return stop() - - let resolve = null - let reject = null - const onerr = er => { - this.removeListener('data', ondata) - this.removeListener('end', onend) - this.removeListener(DESTROYED, ondestroy) - stop() - reject(er) - } - const ondata = value => { - this.removeListener('error', onerr) - this.removeListener('end', onend) - this.removeListener(DESTROYED, ondestroy) - this.pause() - resolve({ value: value, done: !!this[EOF] }) - } - const onend = () => { - this.removeListener('error', onerr) - this.removeListener('data', ondata) - this.removeListener(DESTROYED, ondestroy) - stop() - resolve({ done: true }) - } - const ondestroy = () => onerr(new Error('stream destroyed')) - return new Promise((res, rej) => { - reject = rej - resolve = res - this.once(DESTROYED, ondestroy) - this.once('error', onerr) - this.once('end', onend) - this.once('data', ondata) - }) - } - - return { - next, - throw: stop, - return: stop, - [ASYNCITERATOR]() { - return this - }, - } - } - - // for (let chunk of stream) - [ITERATOR]() { - let stopped = false - const stop = () => { - this.pause() - this.removeListener(ERROR, stop) - this.removeListener(DESTROYED, stop) - this.removeListener('end', stop) - stopped = true - return { done: true } - } - - const next = () => { - if (stopped) return stop() - const value = this.read() - return value === null ? stop() : { value } - } - this.once('end', stop) - this.once(ERROR, stop) - this.once(DESTROYED, stop) - - return { - next, - throw: stop, - return: stop, - [ITERATOR]() { - return this - }, - } - } - - destroy(er) { - if (this[DESTROYED]) { - if (er) this.emit('error', er) - else this.emit(DESTROYED) - return this - } - - this[DESTROYED] = true - - // throw away all buffered data, it's never coming out - this[BUFFER].length = 0 - this[BUFFERLENGTH] = 0 - - if (typeof this.close === 'function' && !this[CLOSED]) this.close() - - if (er) this.emit('error', er) - // if no error to emit, still reject pending promises - else this.emit(DESTROYED) - - return this - } - - static isStream(s) { - return ( - !!s && - (s instanceof Minipass || - s instanceof Stream || - (s instanceof EE && - // readable - (typeof s.pipe === 'function' || - // writable - (typeof s.write === 'function' && typeof s.end === 'function')))) - ) - } -} - -exports.Minipass = Minipass diff --git a/node_modules/tar/node_modules/minipass/index.mjs b/node_modules/tar/node_modules/minipass/index.mjs deleted file mode 100644 index 6ef6cd8cf0703..0000000000000 --- a/node_modules/tar/node_modules/minipass/index.mjs +++ /dev/null @@ -1,702 +0,0 @@ -'use strict' -const proc = - typeof process === 'object' && process - ? process - : { - stdout: null, - stderr: null, - } -import EE from 'events' -import Stream from 'stream' -import stringdecoder from 'string_decoder' -const SD = stringdecoder.StringDecoder - -const EOF = Symbol('EOF') -const MAYBE_EMIT_END = Symbol('maybeEmitEnd') -const EMITTED_END = Symbol('emittedEnd') -const EMITTING_END = Symbol('emittingEnd') -const EMITTED_ERROR = Symbol('emittedError') -const CLOSED = Symbol('closed') -const READ = Symbol('read') -const FLUSH = Symbol('flush') -const FLUSHCHUNK = Symbol('flushChunk') -const ENCODING = Symbol('encoding') -const DECODER = Symbol('decoder') -const FLOWING = Symbol('flowing') -const PAUSED = Symbol('paused') -const RESUME = Symbol('resume') -const BUFFER = Symbol('buffer') -const PIPES = Symbol('pipes') -const BUFFERLENGTH = Symbol('bufferLength') -const BUFFERPUSH = Symbol('bufferPush') -const BUFFERSHIFT = Symbol('bufferShift') -const OBJECTMODE = Symbol('objectMode') -// internal event when stream is destroyed -const DESTROYED = Symbol('destroyed') -// internal event when stream has an error -const ERROR = Symbol('error') -const EMITDATA = Symbol('emitData') -const EMITEND = Symbol('emitEnd') -const EMITEND2 = Symbol('emitEnd2') -const ASYNC = Symbol('async') -const ABORT = Symbol('abort') -const ABORTED = Symbol('aborted') -const SIGNAL = Symbol('signal') - -const defer = fn => Promise.resolve().then(fn) - -// TODO remove when Node v8 support drops -const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = - (doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented') -const ITERATOR = - (doIter && Symbol.iterator) || Symbol('iterator not implemented') - -// events that mean 'the stream is over' -// these are treated specially, and re-emitted -// if they are listened for after emitting. -const isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish' - -const isArrayBuffer = b => - b instanceof ArrayBuffer || - (typeof b === 'object' && - b.constructor && - b.constructor.name === 'ArrayBuffer' && - b.byteLength >= 0) - -const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) - -class Pipe { - constructor(src, dest, opts) { - this.src = src - this.dest = dest - this.opts = opts - this.ondrain = () => src[RESUME]() - dest.on('drain', this.ondrain) - } - unpipe() { - this.dest.removeListener('drain', this.ondrain) - } - // istanbul ignore next - only here for the prototype - proxyErrors() {} - end() { - this.unpipe() - if (this.opts.end) this.dest.end() - } -} - -class PipeProxyErrors extends Pipe { - unpipe() { - this.src.removeListener('error', this.proxyErrors) - super.unpipe() - } - constructor(src, dest, opts) { - super(src, dest, opts) - this.proxyErrors = er => dest.emit('error', er) - src.on('error', this.proxyErrors) - } -} - -export class Minipass extends Stream { - constructor(options) { - super() - this[FLOWING] = false - // whether we're explicitly paused - this[PAUSED] = false - this[PIPES] = [] - this[BUFFER] = [] - this[OBJECTMODE] = (options && options.objectMode) || false - if (this[OBJECTMODE]) this[ENCODING] = null - else this[ENCODING] = (options && options.encoding) || null - if (this[ENCODING] === 'buffer') this[ENCODING] = null - this[ASYNC] = (options && !!options.async) || false - this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null - this[EOF] = false - this[EMITTED_END] = false - this[EMITTING_END] = false - this[CLOSED] = false - this[EMITTED_ERROR] = null - this.writable = true - this.readable = true - this[BUFFERLENGTH] = 0 - this[DESTROYED] = false - if (options && options.debugExposeBuffer === true) { - Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }) - } - if (options && options.debugExposePipes === true) { - Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }) - } - this[SIGNAL] = options && options.signal - this[ABORTED] = false - if (this[SIGNAL]) { - this[SIGNAL].addEventListener('abort', () => this[ABORT]()) - if (this[SIGNAL].aborted) { - this[ABORT]() - } - } - } - - get bufferLength() { - return this[BUFFERLENGTH] - } - - get encoding() { - return this[ENCODING] - } - set encoding(enc) { - if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode') - - if ( - this[ENCODING] && - enc !== this[ENCODING] && - ((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH]) - ) - throw new Error('cannot change encoding') - - if (this[ENCODING] !== enc) { - this[DECODER] = enc ? new SD(enc) : null - if (this[BUFFER].length) - this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk)) - } - - this[ENCODING] = enc - } - - setEncoding(enc) { - this.encoding = enc - } - - get objectMode() { - return this[OBJECTMODE] - } - set objectMode(om) { - this[OBJECTMODE] = this[OBJECTMODE] || !!om - } - - get ['async']() { - return this[ASYNC] - } - set ['async'](a) { - this[ASYNC] = this[ASYNC] || !!a - } - - // drop everything and get out of the flow completely - [ABORT]() { - this[ABORTED] = true - this.emit('abort', this[SIGNAL].reason) - this.destroy(this[SIGNAL].reason) - } - - get aborted() { - return this[ABORTED] - } - set aborted(_) {} - - write(chunk, encoding, cb) { - if (this[ABORTED]) return false - if (this[EOF]) throw new Error('write after end') - - if (this[DESTROYED]) { - this.emit( - 'error', - Object.assign( - new Error('Cannot call write after a stream was destroyed'), - { code: 'ERR_STREAM_DESTROYED' } - ) - ) - return true - } - - if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8') - - if (!encoding) encoding = 'utf8' - - const fn = this[ASYNC] ? defer : f => f() - - // convert array buffers and typed array views into buffers - // at some point in the future, we may want to do the opposite! - // leave strings and buffers as-is - // anything else switches us into object mode - if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk) - else if (typeof chunk !== 'string') - // use the setter so we throw if we have encoding set - this.objectMode = true - } - - // handle object mode up front, since it's simpler - // this yields better performance, fewer checks later. - if (this[OBJECTMODE]) { - /* istanbul ignore if - maybe impossible? */ - if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true) - - if (this.flowing) this.emit('data', chunk) - else this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - - if (cb) fn(cb) - - return this.flowing - } - - // at this point the chunk is a buffer or string - // don't buffer it up or send it to the decoder - if (!chunk.length) { - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - if (cb) fn(cb) - return this.flowing - } - - // fast-path writing strings of same encoding to a stream with - // an empty buffer, skipping the buffer/decoder dance - if ( - typeof chunk === 'string' && - // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER].lastNeed) - ) { - chunk = Buffer.from(chunk, encoding) - } - - if (Buffer.isBuffer(chunk) && this[ENCODING]) - chunk = this[DECODER].write(chunk) - - // Note: flushing CAN potentially switch us into not-flowing mode - if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true) - - if (this.flowing) this.emit('data', chunk) - else this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) this.emit('readable') - - if (cb) fn(cb) - - return this.flowing - } - - read(n) { - if (this[DESTROYED]) return null - - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { - this[MAYBE_EMIT_END]() - return null - } - - if (this[OBJECTMODE]) n = null - - if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { - if (this.encoding) this[BUFFER] = [this[BUFFER].join('')] - else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])] - } - - const ret = this[READ](n || null, this[BUFFER][0]) - this[MAYBE_EMIT_END]() - return ret - } - - [READ](n, chunk) { - if (n === chunk.length || n === null) this[BUFFERSHIFT]() - else { - this[BUFFER][0] = chunk.slice(n) - chunk = chunk.slice(0, n) - this[BUFFERLENGTH] -= n - } - - this.emit('data', chunk) - - if (!this[BUFFER].length && !this[EOF]) this.emit('drain') - - return chunk - } - - end(chunk, encoding, cb) { - if (typeof chunk === 'function') (cb = chunk), (chunk = null) - if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8') - if (chunk) this.write(chunk, encoding) - if (cb) this.once('end', cb) - this[EOF] = true - this.writable = false - - // if we haven't written anything, then go ahead and emit, - // even if we're not reading. - // we'll re-emit if a new 'end' listener is added anyway. - // This makes MP more suitable to write-only use cases. - if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]() - return this - } - - // don't let the internal resume be overwritten - [RESUME]() { - if (this[DESTROYED]) return - - this[PAUSED] = false - this[FLOWING] = true - this.emit('resume') - if (this[BUFFER].length) this[FLUSH]() - else if (this[EOF]) this[MAYBE_EMIT_END]() - else this.emit('drain') - } - - resume() { - return this[RESUME]() - } - - pause() { - this[FLOWING] = false - this[PAUSED] = true - } - - get destroyed() { - return this[DESTROYED] - } - - get flowing() { - return this[FLOWING] - } - - get paused() { - return this[PAUSED] - } - - [BUFFERPUSH](chunk) { - if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1 - else this[BUFFERLENGTH] += chunk.length - this[BUFFER].push(chunk) - } - - [BUFFERSHIFT]() { - if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1 - else this[BUFFERLENGTH] -= this[BUFFER][0].length - return this[BUFFER].shift() - } - - [FLUSH](noDrain) { - do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length) - - if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain') - } - - [FLUSHCHUNK](chunk) { - this.emit('data', chunk) - return this.flowing - } - - pipe(dest, opts) { - if (this[DESTROYED]) return - - const ended = this[EMITTED_END] - opts = opts || {} - if (dest === proc.stdout || dest === proc.stderr) opts.end = false - else opts.end = opts.end !== false - opts.proxyErrors = !!opts.proxyErrors - - // piping an ended stream ends immediately - if (ended) { - if (opts.end) dest.end() - } else { - this[PIPES].push( - !opts.proxyErrors - ? new Pipe(this, dest, opts) - : new PipeProxyErrors(this, dest, opts) - ) - if (this[ASYNC]) defer(() => this[RESUME]()) - else this[RESUME]() - } - - return dest - } - - unpipe(dest) { - const p = this[PIPES].find(p => p.dest === dest) - if (p) { - this[PIPES].splice(this[PIPES].indexOf(p), 1) - p.unpipe() - } - } - - addListener(ev, fn) { - return this.on(ev, fn) - } - - on(ev, fn) { - const ret = super.on(ev, fn) - if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]() - else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) - super.emit('readable') - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } else if (ev === 'error' && this[EMITTED_ERROR]) { - if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR])) - else fn.call(this, this[EMITTED_ERROR]) - } - return ret - } - - get emittedEnd() { - return this[EMITTED_END] - } - - [MAYBE_EMIT_END]() { - if ( - !this[EMITTING_END] && - !this[EMITTED_END] && - !this[DESTROYED] && - this[BUFFER].length === 0 && - this[EOF] - ) { - this[EMITTING_END] = true - this.emit('end') - this.emit('prefinish') - this.emit('finish') - if (this[CLOSED]) this.emit('close') - this[EMITTING_END] = false - } - } - - emit(ev, data, ...extra) { - // error and close are only events allowed after calling destroy() - if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) - return - else if (ev === 'data') { - return !this[OBJECTMODE] && !data - ? false - : this[ASYNC] - ? defer(() => this[EMITDATA](data)) - : this[EMITDATA](data) - } else if (ev === 'end') { - return this[EMITEND]() - } else if (ev === 'close') { - this[CLOSED] = true - // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END] && !this[DESTROYED]) return - const ret = super.emit('close') - this.removeAllListeners('close') - return ret - } else if (ev === 'error') { - this[EMITTED_ERROR] = data - super.emit(ERROR, data) - const ret = - !this[SIGNAL] || this.listeners('error').length - ? super.emit('error', data) - : false - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'resume') { - const ret = super.emit('resume') - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'finish' || ev === 'prefinish') { - const ret = super.emit(ev) - this.removeAllListeners(ev) - return ret - } - - // Some other unknown event - const ret = super.emit(ev, data, ...extra) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITDATA](data) { - for (const p of this[PIPES]) { - if (p.dest.write(data) === false) this.pause() - } - const ret = super.emit('data', data) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITEND]() { - if (this[EMITTED_END]) return - - this[EMITTED_END] = true - this.readable = false - if (this[ASYNC]) defer(() => this[EMITEND2]()) - else this[EMITEND2]() - } - - [EMITEND2]() { - if (this[DECODER]) { - const data = this[DECODER].end() - if (data) { - for (const p of this[PIPES]) { - p.dest.write(data) - } - super.emit('data', data) - } - } - - for (const p of this[PIPES]) { - p.end() - } - const ret = super.emit('end') - this.removeAllListeners('end') - return ret - } - - // const all = await stream.collect() - collect() { - const buf = [] - if (!this[OBJECTMODE]) buf.dataLength = 0 - // set the promise first, in case an error is raised - // by triggering the flow here. - const p = this.promise() - this.on('data', c => { - buf.push(c) - if (!this[OBJECTMODE]) buf.dataLength += c.length - }) - return p.then(() => buf) - } - - // const data = await stream.concat() - concat() { - return this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this.collect().then(buf => - this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this[ENCODING] - ? buf.join('') - : Buffer.concat(buf, buf.dataLength) - ) - } - - // stream.promise().then(() => done, er => emitted error) - promise() { - return new Promise((resolve, reject) => { - this.on(DESTROYED, () => reject(new Error('stream destroyed'))) - this.on('error', er => reject(er)) - this.on('end', () => resolve()) - }) - } - - // for await (let chunk of stream) - [ASYNCITERATOR]() { - let stopped = false - const stop = () => { - this.pause() - stopped = true - return Promise.resolve({ done: true }) - } - const next = () => { - if (stopped) return stop() - const res = this.read() - if (res !== null) return Promise.resolve({ done: false, value: res }) - - if (this[EOF]) return stop() - - let resolve = null - let reject = null - const onerr = er => { - this.removeListener('data', ondata) - this.removeListener('end', onend) - this.removeListener(DESTROYED, ondestroy) - stop() - reject(er) - } - const ondata = value => { - this.removeListener('error', onerr) - this.removeListener('end', onend) - this.removeListener(DESTROYED, ondestroy) - this.pause() - resolve({ value: value, done: !!this[EOF] }) - } - const onend = () => { - this.removeListener('error', onerr) - this.removeListener('data', ondata) - this.removeListener(DESTROYED, ondestroy) - stop() - resolve({ done: true }) - } - const ondestroy = () => onerr(new Error('stream destroyed')) - return new Promise((res, rej) => { - reject = rej - resolve = res - this.once(DESTROYED, ondestroy) - this.once('error', onerr) - this.once('end', onend) - this.once('data', ondata) - }) - } - - return { - next, - throw: stop, - return: stop, - [ASYNCITERATOR]() { - return this - }, - } - } - - // for (let chunk of stream) - [ITERATOR]() { - let stopped = false - const stop = () => { - this.pause() - this.removeListener(ERROR, stop) - this.removeListener(DESTROYED, stop) - this.removeListener('end', stop) - stopped = true - return { done: true } - } - - const next = () => { - if (stopped) return stop() - const value = this.read() - return value === null ? stop() : { value } - } - this.once('end', stop) - this.once(ERROR, stop) - this.once(DESTROYED, stop) - - return { - next, - throw: stop, - return: stop, - [ITERATOR]() { - return this - }, - } - } - - destroy(er) { - if (this[DESTROYED]) { - if (er) this.emit('error', er) - else this.emit(DESTROYED) - return this - } - - this[DESTROYED] = true - - // throw away all buffered data, it's never coming out - this[BUFFER].length = 0 - this[BUFFERLENGTH] = 0 - - if (typeof this.close === 'function' && !this[CLOSED]) this.close() - - if (er) this.emit('error', er) - // if no error to emit, still reject pending promises - else this.emit(DESTROYED) - - return this - } - - static isStream(s) { - return ( - !!s && - (s instanceof Minipass || - s instanceof Stream || - (s instanceof EE && - // readable - (typeof s.pipe === 'function' || - // writable - (typeof s.write === 'function' && typeof s.end === 'function')))) - ) - } -} - - diff --git a/node_modules/tar/node_modules/minipass/package.json b/node_modules/tar/node_modules/minipass/package.json deleted file mode 100644 index 0e20e988047f2..0000000000000 --- a/node_modules/tar/node_modules/minipass/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "minipass", - "version": "5.0.0", - "description": "minimal implementation of a PassThrough stream", - "main": "./index.js", - "module": "./index.mjs", - "types": "./index.d.ts", - "exports": { - ".": { - "import": { - "types": "./index.d.ts", - "default": "./index.mjs" - }, - "require": { - "types": "./index.d.ts", - "default": "./index.js" - } - }, - "./package.json": "./package.json" - }, - "devDependencies": { - "@types/node": "^17.0.41", - "end-of-stream": "^1.4.0", - "node-abort-controller": "^3.1.1", - "prettier": "^2.6.2", - "tap": "^16.2.0", - "through2": "^2.0.3", - "ts-node": "^10.8.1", - "typedoc": "^0.23.24", - "typescript": "^4.7.3" - }, - "scripts": { - "pretest": "npm run prepare", - "presnap": "npm run prepare", - "prepare": "node ./scripts/transpile-to-esm.js", - "snap": "tap", - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags", - "typedoc": "typedoc ./index.d.ts", - "format": "prettier --write . --loglevel warn" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minipass.git" - }, - "keywords": [ - "passthrough", - "stream" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "files": [ - "index.d.ts", - "index.js", - "index.mjs" - ], - "tap": { - "check-coverage": true - }, - "engines": { - "node": ">=8" - }, - "prettier": { - "semi": false, - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - } -} diff --git a/node_modules/tar/node_modules/minizlib/LICENSE b/node_modules/tar/node_modules/minizlib/LICENSE deleted file mode 100644 index ffce7383f53e7..0000000000000 --- a/node_modules/tar/node_modules/minizlib/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Minizlib was created by Isaac Z. Schlueter. -It is a derivative work of the Node.js project. - -""" -Copyright Isaac Z. Schlueter and Contributors -Copyright Node.js contributors. All rights reserved. -Copyright Joyent, Inc. and other Node contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" diff --git a/node_modules/tar/node_modules/minizlib/constants.js b/node_modules/tar/node_modules/minizlib/constants.js deleted file mode 100644 index 641ebc73129bf..0000000000000 --- a/node_modules/tar/node_modules/minizlib/constants.js +++ /dev/null @@ -1,115 +0,0 @@ -// Update with any zlib constants that are added or changed in the future. -// Node v6 didn't export this, so we just hard code the version and rely -// on all the other hard-coded values from zlib v4736. When node v6 -// support drops, we can just export the realZlibConstants object. -const realZlibConstants = require('zlib').constants || - /* istanbul ignore next */ { ZLIB_VERNUM: 4736 } - -module.exports = Object.freeze(Object.assign(Object.create(null), { - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - Z_VERSION_ERROR: -6, - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - DEFLATE: 1, - INFLATE: 2, - GZIP: 3, - GUNZIP: 4, - DEFLATERAW: 5, - INFLATERAW: 6, - UNZIP: 7, - BROTLI_DECODE: 8, - BROTLI_ENCODE: 9, - Z_MIN_WINDOWBITS: 8, - Z_MAX_WINDOWBITS: 15, - Z_DEFAULT_WINDOWBITS: 15, - Z_MIN_CHUNK: 64, - Z_MAX_CHUNK: Infinity, - Z_DEFAULT_CHUNK: 16384, - Z_MIN_MEMLEVEL: 1, - Z_MAX_MEMLEVEL: 9, - Z_DEFAULT_MEMLEVEL: 8, - Z_MIN_LEVEL: -1, - Z_MAX_LEVEL: 9, - Z_DEFAULT_LEVEL: -1, - BROTLI_OPERATION_PROCESS: 0, - BROTLI_OPERATION_FLUSH: 1, - BROTLI_OPERATION_FINISH: 2, - BROTLI_OPERATION_EMIT_METADATA: 3, - BROTLI_MODE_GENERIC: 0, - BROTLI_MODE_TEXT: 1, - BROTLI_MODE_FONT: 2, - BROTLI_DEFAULT_MODE: 0, - BROTLI_MIN_QUALITY: 0, - BROTLI_MAX_QUALITY: 11, - BROTLI_DEFAULT_QUALITY: 11, - BROTLI_MIN_WINDOW_BITS: 10, - BROTLI_MAX_WINDOW_BITS: 24, - BROTLI_LARGE_MAX_WINDOW_BITS: 30, - BROTLI_DEFAULT_WINDOW: 22, - BROTLI_MIN_INPUT_BLOCK_BITS: 16, - BROTLI_MAX_INPUT_BLOCK_BITS: 24, - BROTLI_PARAM_MODE: 0, - BROTLI_PARAM_QUALITY: 1, - BROTLI_PARAM_LGWIN: 2, - BROTLI_PARAM_LGBLOCK: 3, - BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4, - BROTLI_PARAM_SIZE_HINT: 5, - BROTLI_PARAM_LARGE_WINDOW: 6, - BROTLI_PARAM_NPOSTFIX: 7, - BROTLI_PARAM_NDIRECT: 8, - BROTLI_DECODER_RESULT_ERROR: 0, - BROTLI_DECODER_RESULT_SUCCESS: 1, - BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0, - BROTLI_DECODER_PARAM_LARGE_WINDOW: 1, - BROTLI_DECODER_NO_ERROR: 0, - BROTLI_DECODER_SUCCESS: 1, - BROTLI_DECODER_NEEDS_MORE_INPUT: 2, - BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1, - BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2, - BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4, - BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5, - BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6, - BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7, - BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9, - BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10, - BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11, - BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12, - BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13, - BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14, - BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15, - BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16, - BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19, - BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21, - BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22, - BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26, - BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27, - BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30, - BROTLI_DECODER_ERROR_UNREACHABLE: -31, -}, realZlibConstants)) diff --git a/node_modules/tar/node_modules/minizlib/index.js b/node_modules/tar/node_modules/minizlib/index.js deleted file mode 100644 index fbaf69e19f209..0000000000000 --- a/node_modules/tar/node_modules/minizlib/index.js +++ /dev/null @@ -1,348 +0,0 @@ -'use strict' - -const assert = require('assert') -const Buffer = require('buffer').Buffer -const realZlib = require('zlib') - -const constants = exports.constants = require('./constants.js') -const Minipass = require('minipass') - -const OriginalBufferConcat = Buffer.concat - -const _superWrite = Symbol('_superWrite') -class ZlibError extends Error { - constructor (err) { - super('zlib: ' + err.message) - this.code = err.code - this.errno = err.errno - /* istanbul ignore if */ - if (!this.code) - this.code = 'ZLIB_ERROR' - - this.message = 'zlib: ' + err.message - Error.captureStackTrace(this, this.constructor) - } - - get name () { - return 'ZlibError' - } -} - -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. -const _opts = Symbol('opts') -const _flushFlag = Symbol('flushFlag') -const _finishFlushFlag = Symbol('finishFlushFlag') -const _fullFlushFlag = Symbol('fullFlushFlag') -const _handle = Symbol('handle') -const _onError = Symbol('onError') -const _sawError = Symbol('sawError') -const _level = Symbol('level') -const _strategy = Symbol('strategy') -const _ended = Symbol('ended') -const _defaultFullFlush = Symbol('_defaultFullFlush') - -class ZlibBase extends Minipass { - constructor (opts, mode) { - if (!opts || typeof opts !== 'object') - throw new TypeError('invalid options for ZlibBase constructor') - - super(opts) - this[_sawError] = false - this[_ended] = false - this[_opts] = opts - - this[_flushFlag] = opts.flush - this[_finishFlushFlag] = opts.finishFlush - // this will throw if any options are invalid for the class selected - try { - this[_handle] = new realZlib[mode](opts) - } catch (er) { - // make sure that all errors get decorated properly - throw new ZlibError(er) - } - - this[_onError] = (err) => { - // no sense raising multiple errors, since we abort on the first one. - if (this[_sawError]) - return - - this[_sawError] = true - - // there is no way to cleanly recover. - // continuing only obscures problems. - this.close() - this.emit('error', err) - } - - this[_handle].on('error', er => this[_onError](new ZlibError(er))) - this.once('end', () => this.close) - } - - close () { - if (this[_handle]) { - this[_handle].close() - this[_handle] = null - this.emit('close') - } - } - - reset () { - if (!this[_sawError]) { - assert(this[_handle], 'zlib binding closed') - return this[_handle].reset() - } - } - - flush (flushFlag) { - if (this.ended) - return - - if (typeof flushFlag !== 'number') - flushFlag = this[_fullFlushFlag] - this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag })) - } - - end (chunk, encoding, cb) { - if (chunk) - this.write(chunk, encoding) - this.flush(this[_finishFlushFlag]) - this[_ended] = true - return super.end(null, null, cb) - } - - get ended () { - return this[_ended] - } - - write (chunk, encoding, cb) { - // process the chunk using the sync process - // then super.write() all the outputted chunks - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - - if (typeof chunk === 'string') - chunk = Buffer.from(chunk, encoding) - - if (this[_sawError]) - return - assert(this[_handle], 'zlib binding closed') - - // _processChunk tries to .close() the native handle after it's done, so we - // intercept that by temporarily making it a no-op. - const nativeHandle = this[_handle]._handle - const originalNativeClose = nativeHandle.close - nativeHandle.close = () => {} - const originalClose = this[_handle].close - this[_handle].close = () => {} - // It also calls `Buffer.concat()` at the end, which may be convenient - // for some, but which we are not interested in as it slows us down. - Buffer.concat = (args) => args - let result - try { - const flushFlag = typeof chunk[_flushFlag] === 'number' - ? chunk[_flushFlag] : this[_flushFlag] - result = this[_handle]._processChunk(chunk, flushFlag) - // if we don't throw, reset it back how it was - Buffer.concat = OriginalBufferConcat - } catch (err) { - // or if we do, put Buffer.concat() back before we emit error - // Error events call into user code, which may call Buffer.concat() - Buffer.concat = OriginalBufferConcat - this[_onError](new ZlibError(err)) - } finally { - if (this[_handle]) { - // Core zlib resets `_handle` to null after attempting to close the - // native handle. Our no-op handler prevented actual closure, but we - // need to restore the `._handle` property. - this[_handle]._handle = nativeHandle - nativeHandle.close = originalNativeClose - this[_handle].close = originalClose - // `_processChunk()` adds an 'error' listener. If we don't remove it - // after each call, these handlers start piling up. - this[_handle].removeAllListeners('error') - // make sure OUR error listener is still attached tho - } - } - - if (this[_handle]) - this[_handle].on('error', er => this[_onError](new ZlibError(er))) - - let writeReturn - if (result) { - if (Array.isArray(result) && result.length > 0) { - // The first buffer is always `handle._outBuffer`, which would be - // re-used for later invocations; so, we always have to copy that one. - writeReturn = this[_superWrite](Buffer.from(result[0])) - for (let i = 1; i < result.length; i++) { - writeReturn = this[_superWrite](result[i]) - } - } else { - writeReturn = this[_superWrite](Buffer.from(result)) - } - } - - if (cb) - cb() - return writeReturn - } - - [_superWrite] (data) { - return super.write(data) - } -} - -class Zlib extends ZlibBase { - constructor (opts, mode) { - opts = opts || {} - - opts.flush = opts.flush || constants.Z_NO_FLUSH - opts.finishFlush = opts.finishFlush || constants.Z_FINISH - super(opts, mode) - - this[_fullFlushFlag] = constants.Z_FULL_FLUSH - this[_level] = opts.level - this[_strategy] = opts.strategy - } - - params (level, strategy) { - if (this[_sawError]) - return - - if (!this[_handle]) - throw new Error('cannot switch params when binding is closed') - - // no way to test this without also not supporting params at all - /* istanbul ignore if */ - if (!this[_handle].params) - throw new Error('not supported in this implementation') - - if (this[_level] !== level || this[_strategy] !== strategy) { - this.flush(constants.Z_SYNC_FLUSH) - assert(this[_handle], 'zlib binding closed') - // .params() calls .flush(), but the latter is always async in the - // core zlib. We override .flush() temporarily to intercept that and - // flush synchronously. - const origFlush = this[_handle].flush - this[_handle].flush = (flushFlag, cb) => { - this.flush(flushFlag) - cb() - } - try { - this[_handle].params(level, strategy) - } finally { - this[_handle].flush = origFlush - } - /* istanbul ignore else */ - if (this[_handle]) { - this[_level] = level - this[_strategy] = strategy - } - } - } -} - -// minimal 2-byte header -class Deflate extends Zlib { - constructor (opts) { - super(opts, 'Deflate') - } -} - -class Inflate extends Zlib { - constructor (opts) { - super(opts, 'Inflate') - } -} - -// gzip - bigger header, same deflate compression -const _portable = Symbol('_portable') -class Gzip extends Zlib { - constructor (opts) { - super(opts, 'Gzip') - this[_portable] = opts && !!opts.portable - } - - [_superWrite] (data) { - if (!this[_portable]) - return super[_superWrite](data) - - // we'll always get the header emitted in one first chunk - // overwrite the OS indicator byte with 0xFF - this[_portable] = false - data[9] = 255 - return super[_superWrite](data) - } -} - -class Gunzip extends Zlib { - constructor (opts) { - super(opts, 'Gunzip') - } -} - -// raw - no header -class DeflateRaw extends Zlib { - constructor (opts) { - super(opts, 'DeflateRaw') - } -} - -class InflateRaw extends Zlib { - constructor (opts) { - super(opts, 'InflateRaw') - } -} - -// auto-detect header. -class Unzip extends Zlib { - constructor (opts) { - super(opts, 'Unzip') - } -} - -class Brotli extends ZlibBase { - constructor (opts, mode) { - opts = opts || {} - - opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS - opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH - - super(opts, mode) - - this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH - } -} - -class BrotliCompress extends Brotli { - constructor (opts) { - super(opts, 'BrotliCompress') - } -} - -class BrotliDecompress extends Brotli { - constructor (opts) { - super(opts, 'BrotliDecompress') - } -} - -exports.Deflate = Deflate -exports.Inflate = Inflate -exports.Gzip = Gzip -exports.Gunzip = Gunzip -exports.DeflateRaw = DeflateRaw -exports.InflateRaw = InflateRaw -exports.Unzip = Unzip -/* istanbul ignore else */ -if (typeof realZlib.BrotliCompress === 'function') { - exports.BrotliCompress = BrotliCompress - exports.BrotliDecompress = BrotliDecompress -} else { - exports.BrotliCompress = exports.BrotliDecompress = class { - constructor () { - throw new Error('Brotli is not supported in this version of Node.js') - } - } -} diff --git a/node_modules/tar/node_modules/minizlib/node_modules/minipass/LICENSE b/node_modules/tar/node_modules/minizlib/node_modules/minipass/LICENSE deleted file mode 100644 index bf1dece2e1f12..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/minipass/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2017-2022 npm, Inc., Isaac Z. Schlueter, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/minizlib/node_modules/minipass/index.js b/node_modules/tar/node_modules/minizlib/node_modules/minipass/index.js deleted file mode 100644 index e8797aab6cc27..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/minipass/index.js +++ /dev/null @@ -1,649 +0,0 @@ -'use strict' -const proc = typeof process === 'object' && process ? process : { - stdout: null, - stderr: null, -} -const EE = require('events') -const Stream = require('stream') -const SD = require('string_decoder').StringDecoder - -const EOF = Symbol('EOF') -const MAYBE_EMIT_END = Symbol('maybeEmitEnd') -const EMITTED_END = Symbol('emittedEnd') -const EMITTING_END = Symbol('emittingEnd') -const EMITTED_ERROR = Symbol('emittedError') -const CLOSED = Symbol('closed') -const READ = Symbol('read') -const FLUSH = Symbol('flush') -const FLUSHCHUNK = Symbol('flushChunk') -const ENCODING = Symbol('encoding') -const DECODER = Symbol('decoder') -const FLOWING = Symbol('flowing') -const PAUSED = Symbol('paused') -const RESUME = Symbol('resume') -const BUFFERLENGTH = Symbol('bufferLength') -const BUFFERPUSH = Symbol('bufferPush') -const BUFFERSHIFT = Symbol('bufferShift') -const OBJECTMODE = Symbol('objectMode') -const DESTROYED = Symbol('destroyed') -const EMITDATA = Symbol('emitData') -const EMITEND = Symbol('emitEnd') -const EMITEND2 = Symbol('emitEnd2') -const ASYNC = Symbol('async') - -const defer = fn => Promise.resolve().then(fn) - -// TODO remove when Node v8 support drops -const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' -const ASYNCITERATOR = doIter && Symbol.asyncIterator - || Symbol('asyncIterator not implemented') -const ITERATOR = doIter && Symbol.iterator - || Symbol('iterator not implemented') - -// events that mean 'the stream is over' -// these are treated specially, and re-emitted -// if they are listened for after emitting. -const isEndish = ev => - ev === 'end' || - ev === 'finish' || - ev === 'prefinish' - -const isArrayBuffer = b => b instanceof ArrayBuffer || - typeof b === 'object' && - b.constructor && - b.constructor.name === 'ArrayBuffer' && - b.byteLength >= 0 - -const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) - -class Pipe { - constructor (src, dest, opts) { - this.src = src - this.dest = dest - this.opts = opts - this.ondrain = () => src[RESUME]() - dest.on('drain', this.ondrain) - } - unpipe () { - this.dest.removeListener('drain', this.ondrain) - } - // istanbul ignore next - only here for the prototype - proxyErrors () {} - end () { - this.unpipe() - if (this.opts.end) - this.dest.end() - } -} - -class PipeProxyErrors extends Pipe { - unpipe () { - this.src.removeListener('error', this.proxyErrors) - super.unpipe() - } - constructor (src, dest, opts) { - super(src, dest, opts) - this.proxyErrors = er => dest.emit('error', er) - src.on('error', this.proxyErrors) - } -} - -module.exports = class Minipass extends Stream { - constructor (options) { - super() - this[FLOWING] = false - // whether we're explicitly paused - this[PAUSED] = false - this.pipes = [] - this.buffer = [] - this[OBJECTMODE] = options && options.objectMode || false - if (this[OBJECTMODE]) - this[ENCODING] = null - else - this[ENCODING] = options && options.encoding || null - if (this[ENCODING] === 'buffer') - this[ENCODING] = null - this[ASYNC] = options && !!options.async || false - this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null - this[EOF] = false - this[EMITTED_END] = false - this[EMITTING_END] = false - this[CLOSED] = false - this[EMITTED_ERROR] = null - this.writable = true - this.readable = true - this[BUFFERLENGTH] = 0 - this[DESTROYED] = false - } - - get bufferLength () { return this[BUFFERLENGTH] } - - get encoding () { return this[ENCODING] } - set encoding (enc) { - if (this[OBJECTMODE]) - throw new Error('cannot set encoding in objectMode') - - if (this[ENCODING] && enc !== this[ENCODING] && - (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH])) - throw new Error('cannot change encoding') - - if (this[ENCODING] !== enc) { - this[DECODER] = enc ? new SD(enc) : null - if (this.buffer.length) - this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk)) - } - - this[ENCODING] = enc - } - - setEncoding (enc) { - this.encoding = enc - } - - get objectMode () { return this[OBJECTMODE] } - set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om } - - get ['async'] () { return this[ASYNC] } - set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a } - - write (chunk, encoding, cb) { - if (this[EOF]) - throw new Error('write after end') - - if (this[DESTROYED]) { - this.emit('error', Object.assign( - new Error('Cannot call write after a stream was destroyed'), - { code: 'ERR_STREAM_DESTROYED' } - )) - return true - } - - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - - if (!encoding) - encoding = 'utf8' - - const fn = this[ASYNC] ? defer : f => f() - - // convert array buffers and typed array views into buffers - // at some point in the future, we may want to do the opposite! - // leave strings and buffers as-is - // anything else switches us into object mode - if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) - else if (isArrayBuffer(chunk)) - chunk = Buffer.from(chunk) - else if (typeof chunk !== 'string') - // use the setter so we throw if we have encoding set - this.objectMode = true - } - - // handle object mode up front, since it's simpler - // this yields better performance, fewer checks later. - if (this[OBJECTMODE]) { - /* istanbul ignore if - maybe impossible? */ - if (this.flowing && this[BUFFERLENGTH] !== 0) - this[FLUSH](true) - - if (this.flowing) - this.emit('data', chunk) - else - this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - - if (cb) - fn(cb) - - return this.flowing - } - - // at this point the chunk is a buffer or string - // don't buffer it up or send it to the decoder - if (!chunk.length) { - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - if (cb) - fn(cb) - return this.flowing - } - - // fast-path writing strings of same encoding to a stream with - // an empty buffer, skipping the buffer/decoder dance - if (typeof chunk === 'string' && - // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { - chunk = Buffer.from(chunk, encoding) - } - - if (Buffer.isBuffer(chunk) && this[ENCODING]) - chunk = this[DECODER].write(chunk) - - // Note: flushing CAN potentially switch us into not-flowing mode - if (this.flowing && this[BUFFERLENGTH] !== 0) - this[FLUSH](true) - - if (this.flowing) - this.emit('data', chunk) - else - this[BUFFERPUSH](chunk) - - if (this[BUFFERLENGTH] !== 0) - this.emit('readable') - - if (cb) - fn(cb) - - return this.flowing - } - - read (n) { - if (this[DESTROYED]) - return null - - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { - this[MAYBE_EMIT_END]() - return null - } - - if (this[OBJECTMODE]) - n = null - - if (this.buffer.length > 1 && !this[OBJECTMODE]) { - if (this.encoding) - this.buffer = [this.buffer.join('')] - else - this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])] - } - - const ret = this[READ](n || null, this.buffer[0]) - this[MAYBE_EMIT_END]() - return ret - } - - [READ] (n, chunk) { - if (n === chunk.length || n === null) - this[BUFFERSHIFT]() - else { - this.buffer[0] = chunk.slice(n) - chunk = chunk.slice(0, n) - this[BUFFERLENGTH] -= n - } - - this.emit('data', chunk) - - if (!this.buffer.length && !this[EOF]) - this.emit('drain') - - return chunk - } - - end (chunk, encoding, cb) { - if (typeof chunk === 'function') - cb = chunk, chunk = null - if (typeof encoding === 'function') - cb = encoding, encoding = 'utf8' - if (chunk) - this.write(chunk, encoding) - if (cb) - this.once('end', cb) - this[EOF] = true - this.writable = false - - // if we haven't written anything, then go ahead and emit, - // even if we're not reading. - // we'll re-emit if a new 'end' listener is added anyway. - // This makes MP more suitable to write-only use cases. - if (this.flowing || !this[PAUSED]) - this[MAYBE_EMIT_END]() - return this - } - - // don't let the internal resume be overwritten - [RESUME] () { - if (this[DESTROYED]) - return - - this[PAUSED] = false - this[FLOWING] = true - this.emit('resume') - if (this.buffer.length) - this[FLUSH]() - else if (this[EOF]) - this[MAYBE_EMIT_END]() - else - this.emit('drain') - } - - resume () { - return this[RESUME]() - } - - pause () { - this[FLOWING] = false - this[PAUSED] = true - } - - get destroyed () { - return this[DESTROYED] - } - - get flowing () { - return this[FLOWING] - } - - get paused () { - return this[PAUSED] - } - - [BUFFERPUSH] (chunk) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] += 1 - else - this[BUFFERLENGTH] += chunk.length - this.buffer.push(chunk) - } - - [BUFFERSHIFT] () { - if (this.buffer.length) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] -= 1 - else - this[BUFFERLENGTH] -= this.buffer[0].length - } - return this.buffer.shift() - } - - [FLUSH] (noDrain) { - do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) - - if (!noDrain && !this.buffer.length && !this[EOF]) - this.emit('drain') - } - - [FLUSHCHUNK] (chunk) { - return chunk ? (this.emit('data', chunk), this.flowing) : false - } - - pipe (dest, opts) { - if (this[DESTROYED]) - return - - const ended = this[EMITTED_END] - opts = opts || {} - if (dest === proc.stdout || dest === proc.stderr) - opts.end = false - else - opts.end = opts.end !== false - opts.proxyErrors = !!opts.proxyErrors - - // piping an ended stream ends immediately - if (ended) { - if (opts.end) - dest.end() - } else { - this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts) - : new PipeProxyErrors(this, dest, opts)) - if (this[ASYNC]) - defer(() => this[RESUME]()) - else - this[RESUME]() - } - - return dest - } - - unpipe (dest) { - const p = this.pipes.find(p => p.dest === dest) - if (p) { - this.pipes.splice(this.pipes.indexOf(p), 1) - p.unpipe() - } - } - - addListener (ev, fn) { - return this.on(ev, fn) - } - - on (ev, fn) { - const ret = super.on(ev, fn) - if (ev === 'data' && !this.pipes.length && !this.flowing) - this[RESUME]() - else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) - super.emit('readable') - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } else if (ev === 'error' && this[EMITTED_ERROR]) { - if (this[ASYNC]) - defer(() => fn.call(this, this[EMITTED_ERROR])) - else - fn.call(this, this[EMITTED_ERROR]) - } - return ret - } - - get emittedEnd () { - return this[EMITTED_END] - } - - [MAYBE_EMIT_END] () { - if (!this[EMITTING_END] && - !this[EMITTED_END] && - !this[DESTROYED] && - this.buffer.length === 0 && - this[EOF]) { - this[EMITTING_END] = true - this.emit('end') - this.emit('prefinish') - this.emit('finish') - if (this[CLOSED]) - this.emit('close') - this[EMITTING_END] = false - } - } - - emit (ev, data, ...extra) { - // error and close are only events allowed after calling destroy() - if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) - return - else if (ev === 'data') { - return !data ? false - : this[ASYNC] ? defer(() => this[EMITDATA](data)) - : this[EMITDATA](data) - } else if (ev === 'end') { - return this[EMITEND]() - } else if (ev === 'close') { - this[CLOSED] = true - // don't emit close before 'end' and 'finish' - if (!this[EMITTED_END] && !this[DESTROYED]) - return - const ret = super.emit('close') - this.removeAllListeners('close') - return ret - } else if (ev === 'error') { - this[EMITTED_ERROR] = data - const ret = super.emit('error', data) - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'resume') { - const ret = super.emit('resume') - this[MAYBE_EMIT_END]() - return ret - } else if (ev === 'finish' || ev === 'prefinish') { - const ret = super.emit(ev) - this.removeAllListeners(ev) - return ret - } - - // Some other unknown event - const ret = super.emit(ev, data, ...extra) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITDATA] (data) { - for (const p of this.pipes) { - if (p.dest.write(data) === false) - this.pause() - } - const ret = super.emit('data', data) - this[MAYBE_EMIT_END]() - return ret - } - - [EMITEND] () { - if (this[EMITTED_END]) - return - - this[EMITTED_END] = true - this.readable = false - if (this[ASYNC]) - defer(() => this[EMITEND2]()) - else - this[EMITEND2]() - } - - [EMITEND2] () { - if (this[DECODER]) { - const data = this[DECODER].end() - if (data) { - for (const p of this.pipes) { - p.dest.write(data) - } - super.emit('data', data) - } - } - - for (const p of this.pipes) { - p.end() - } - const ret = super.emit('end') - this.removeAllListeners('end') - return ret - } - - // const all = await stream.collect() - collect () { - const buf = [] - if (!this[OBJECTMODE]) - buf.dataLength = 0 - // set the promise first, in case an error is raised - // by triggering the flow here. - const p = this.promise() - this.on('data', c => { - buf.push(c) - if (!this[OBJECTMODE]) - buf.dataLength += c.length - }) - return p.then(() => buf) - } - - // const data = await stream.concat() - concat () { - return this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this.collect().then(buf => - this[OBJECTMODE] - ? Promise.reject(new Error('cannot concat in objectMode')) - : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength)) - } - - // stream.promise().then(() => done, er => emitted error) - promise () { - return new Promise((resolve, reject) => { - this.on(DESTROYED, () => reject(new Error('stream destroyed'))) - this.on('error', er => reject(er)) - this.on('end', () => resolve()) - }) - } - - // for await (let chunk of stream) - [ASYNCITERATOR] () { - const next = () => { - const res = this.read() - if (res !== null) - return Promise.resolve({ done: false, value: res }) - - if (this[EOF]) - return Promise.resolve({ done: true }) - - let resolve = null - let reject = null - const onerr = er => { - this.removeListener('data', ondata) - this.removeListener('end', onend) - reject(er) - } - const ondata = value => { - this.removeListener('error', onerr) - this.removeListener('end', onend) - this.pause() - resolve({ value: value, done: !!this[EOF] }) - } - const onend = () => { - this.removeListener('error', onerr) - this.removeListener('data', ondata) - resolve({ done: true }) - } - const ondestroy = () => onerr(new Error('stream destroyed')) - return new Promise((res, rej) => { - reject = rej - resolve = res - this.once(DESTROYED, ondestroy) - this.once('error', onerr) - this.once('end', onend) - this.once('data', ondata) - }) - } - - return { next } - } - - // for (let chunk of stream) - [ITERATOR] () { - const next = () => { - const value = this.read() - const done = value === null - return { value, done } - } - return { next } - } - - destroy (er) { - if (this[DESTROYED]) { - if (er) - this.emit('error', er) - else - this.emit(DESTROYED) - return this - } - - this[DESTROYED] = true - - // throw away all buffered data, it's never coming out - this.buffer.length = 0 - this[BUFFERLENGTH] = 0 - - if (typeof this.close === 'function' && !this[CLOSED]) - this.close() - - if (er) - this.emit('error', er) - else // if no error to emit, still reject pending promises - this.emit(DESTROYED) - - return this - } - - static isStream (s) { - return !!s && (s instanceof Minipass || s instanceof Stream || - s instanceof EE && ( - typeof s.pipe === 'function' || // readable - (typeof s.write === 'function' && typeof s.end === 'function') // writable - )) - } -} diff --git a/node_modules/tar/node_modules/minizlib/node_modules/minipass/package.json b/node_modules/tar/node_modules/minizlib/node_modules/minipass/package.json deleted file mode 100644 index 548d03fa6d5d4..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/minipass/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "minipass", - "version": "3.3.6", - "description": "minimal implementation of a PassThrough stream", - "main": "index.js", - "types": "index.d.ts", - "dependencies": { - "yallist": "^4.0.0" - }, - "devDependencies": { - "@types/node": "^17.0.41", - "end-of-stream": "^1.4.0", - "prettier": "^2.6.2", - "tap": "^16.2.0", - "through2": "^2.0.3", - "ts-node": "^10.8.1", - "typescript": "^4.7.3" - }, - "scripts": { - "test": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minipass.git" - }, - "keywords": [ - "passthrough", - "stream" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC", - "files": [ - "index.d.ts", - "index.js" - ], - "tap": { - "check-coverage": true - }, - "engines": { - "node": ">=8" - }, - "prettier": { - "semi": false, - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "singleQuote": true, - "jsxSingleQuote": false, - "bracketSameLine": true, - "arrowParens": "avoid", - "endOfLine": "lf" - } -} diff --git a/node_modules/tar/node_modules/minizlib/node_modules/yallist/LICENSE b/node_modules/tar/node_modules/minizlib/node_modules/yallist/LICENSE deleted file mode 100644 index 19129e315fe59..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/yallist/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/tar/node_modules/minizlib/node_modules/yallist/iterator.js b/node_modules/tar/node_modules/minizlib/node_modules/yallist/iterator.js deleted file mode 100644 index d41c97a19f984..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/yallist/iterator.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value - } - } -} diff --git a/node_modules/tar/node_modules/minizlib/node_modules/yallist/package.json b/node_modules/tar/node_modules/minizlib/node_modules/yallist/package.json deleted file mode 100644 index 8a083867d72e0..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/yallist/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "yallist", - "version": "4.0.0", - "description": "Yet Another Linked List", - "main": "yallist.js", - "directories": { - "test": "test" - }, - "files": [ - "yallist.js", - "iterator.js" - ], - "dependencies": {}, - "devDependencies": { - "tap": "^12.1.0" - }, - "scripts": { - "test": "tap test/*.js --100", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/yallist.git" - }, - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "ISC" -} diff --git a/node_modules/tar/node_modules/minizlib/node_modules/yallist/yallist.js b/node_modules/tar/node_modules/minizlib/node_modules/yallist/yallist.js deleted file mode 100644 index 4e83ab1c542a5..0000000000000 --- a/node_modules/tar/node_modules/minizlib/node_modules/yallist/yallist.js +++ /dev/null @@ -1,426 +0,0 @@ -'use strict' -module.exports = Yallist - -Yallist.Node = Node -Yallist.create = Yallist - -function Yallist (list) { - var self = this - if (!(self instanceof Yallist)) { - self = new Yallist() - } - - self.tail = null - self.head = null - self.length = 0 - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item) - }) - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]) - } - } - - return self -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list') - } - - var next = node.next - var prev = node.prev - - if (next) { - next.prev = prev - } - - if (prev) { - prev.next = next - } - - if (node === this.head) { - this.head = next - } - if (node === this.tail) { - this.tail = prev - } - - node.list.length-- - node.next = null - node.prev = null - node.list = null - - return next -} - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var head = this.head - node.list = this - node.next = head - if (head) { - head.prev = node - } - - this.head = node - if (!this.tail) { - this.tail = node - } - this.length++ -} - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return - } - - if (node.list) { - node.list.removeNode(node) - } - - var tail = this.tail - node.list = this - node.prev = tail - if (tail) { - tail.next = node - } - - this.tail = node - if (!this.head) { - this.head = node - } - this.length++ -} - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]) - } - return this.length -} - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined - } - - var res = this.tail.value - this.tail = this.tail.prev - if (this.tail) { - this.tail.next = null - } else { - this.head = null - } - this.length-- - return res -} - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined - } - - var res = this.head.value - this.head = this.head.next - if (this.head) { - this.head.prev = null - } else { - this.tail = null - } - this.length-- - return res -} - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this) - walker = walker.next - } -} - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this) - walker = walker.prev - } -} - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev - } - if (i === n && walker !== null) { - return walker.value - } -} - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.next - } - return res -} - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this - var res = new Yallist() - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)) - walker = walker.prev - } - return res -} - -Yallist.prototype.reduce = function (fn, initial) { - var acc - var walker = this.head - if (arguments.length > 1) { - acc = initial - } else if (this.head) { - walker = this.head.next - acc = this.head.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i) - walker = walker.next - } - - return acc -} - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc - var walker = this.tail - if (arguments.length > 1) { - acc = initial - } else if (this.tail) { - walker = this.tail.prev - acc = this.tail.value - } else { - throw new TypeError('Reduce of empty list with no initial value') - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i) - walker = walker.prev - } - - return acc -} - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value - walker = walker.next - } - return arr -} - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length) - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value - walker = walker.prev - } - return arr -} - -Yallist.prototype.slice = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next - } - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length - if (to < 0) { - to += this.length - } - from = from || 0 - if (from < 0) { - from += this.length - } - var ret = new Yallist() - if (to < from || to < 0) { - return ret - } - if (from < 0) { - from = 0 - } - if (to > this.length) { - to = this.length - } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev - } - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value) - } - return ret -} - -Yallist.prototype.splice = function (start, deleteCount, ...nodes) { - if (start > this.length) { - start = this.length - 1 - } - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next - } - - var ret = [] - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value) - walker = this.removeNode(walker) - } - if (walker === null) { - walker = this.tail - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev - } - - for (var i = 0; i < nodes.length; i++) { - walker = insert(this, walker, nodes[i]) - } - return ret; -} - -Yallist.prototype.reverse = function () { - var head = this.head - var tail = this.tail - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev - walker.prev = walker.next - walker.next = p - } - this.head = tail - this.tail = head - return this -} - -function insert (self, node, value) { - var inserted = node === self.head ? - new Node(value, null, node, self) : - new Node(value, node, node.next, self) - - if (inserted.next === null) { - self.tail = inserted - } - if (inserted.prev === null) { - self.head = inserted - } - - self.length++ - - return inserted -} - -function push (self, item) { - self.tail = new Node(item, self.tail, null, self) - if (!self.head) { - self.head = self.tail - } - self.length++ -} - -function unshift (self, item) { - self.head = new Node(item, null, self.head, self) - if (!self.tail) { - self.tail = self.head - } - self.length++ -} - -function Node (value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list) - } - - this.list = list - this.value = value - - if (prev) { - prev.next = this - this.prev = prev - } else { - this.prev = null - } - - if (next) { - next.prev = this - this.next = next - } else { - this.next = null - } -} - -try { - // add if support for Symbol.iterator is present - require('./iterator.js')(Yallist) -} catch (er) {} diff --git a/node_modules/tar/node_modules/minizlib/package.json b/node_modules/tar/node_modules/minizlib/package.json deleted file mode 100644 index 98825a549f3fd..0000000000000 --- a/node_modules/tar/node_modules/minizlib/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "minizlib", - "version": "2.1.2", - "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.", - "main": "index.js", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "scripts": { - "test": "tap test/*.js --100 -J", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/isaacs/minizlib.git" - }, - "keywords": [ - "zlib", - "gzip", - "gunzip", - "deflate", - "inflate", - "compression", - "zip", - "unzip" - ], - "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "license": "MIT", - "devDependencies": { - "tap": "^14.6.9" - }, - "files": [ - "index.js", - "constants.js" - ], - "engines": { - "node": ">= 8" - } -} diff --git a/node_modules/tar/node_modules/mkdirp/LICENSE b/node_modules/tar/node_modules/mkdirp/LICENSE deleted file mode 100644 index 13fcd15f0e0be..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me) - -This project is free software released under the MIT license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/tar/node_modules/mkdirp/bin/cmd.js b/node_modules/tar/node_modules/mkdirp/bin/cmd.js deleted file mode 100755 index 6e0aa8dc4667b..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/bin/cmd.js +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env node - -const usage = () => ` -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories - that don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m If a directory needs to be created, set the mode as an octal - --mode= permission string. - - -v --version Print the mkdirp version number - - -h --help Print this helpful banner - - -p --print Print the first directories created for each path provided - - --manual Use manual implementation, even if native is available -` - -const dirs = [] -const opts = {} -let print = false -let dashdash = false -let manual = false -for (const arg of process.argv.slice(2)) { - if (dashdash) - dirs.push(arg) - else if (arg === '--') - dashdash = true - else if (arg === '--manual') - manual = true - else if (/^-h/.test(arg) || /^--help/.test(arg)) { - console.log(usage()) - process.exit(0) - } else if (arg === '-v' || arg === '--version') { - console.log(require('../package.json').version) - process.exit(0) - } else if (arg === '-p' || arg === '--print') { - print = true - } else if (/^-m/.test(arg) || /^--mode=/.test(arg)) { - const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8) - if (isNaN(mode)) { - console.error(`invalid mode argument: ${arg}\nMust be an octal number.`) - process.exit(1) - } - opts.mode = mode - } else - dirs.push(arg) -} - -const mkdirp = require('../') -const impl = manual ? mkdirp.manual : mkdirp -if (dirs.length === 0) - console.error(usage()) - -Promise.all(dirs.map(dir => impl(dir, opts))) - .then(made => print ? made.forEach(m => m && console.log(m)) : null) - .catch(er => { - console.error(er.message) - if (er.code) - console.error(' code: ' + er.code) - process.exit(1) - }) diff --git a/node_modules/tar/node_modules/mkdirp/index.js b/node_modules/tar/node_modules/mkdirp/index.js deleted file mode 100644 index ad7a16c9f45d9..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/index.js +++ /dev/null @@ -1,31 +0,0 @@ -const optsArg = require('./lib/opts-arg.js') -const pathArg = require('./lib/path-arg.js') - -const {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js') -const {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js') -const {useNative, useNativeSync} = require('./lib/use-native.js') - - -const mkdirp = (path, opts) => { - path = pathArg(path) - opts = optsArg(opts) - return useNative(opts) - ? mkdirpNative(path, opts) - : mkdirpManual(path, opts) -} - -const mkdirpSync = (path, opts) => { - path = pathArg(path) - opts = optsArg(opts) - return useNativeSync(opts) - ? mkdirpNativeSync(path, opts) - : mkdirpManualSync(path, opts) -} - -mkdirp.sync = mkdirpSync -mkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts)) -mkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts)) -mkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts)) -mkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts)) - -module.exports = mkdirp diff --git a/node_modules/tar/node_modules/mkdirp/lib/find-made.js b/node_modules/tar/node_modules/mkdirp/lib/find-made.js deleted file mode 100644 index 022e492c085da..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/find-made.js +++ /dev/null @@ -1,29 +0,0 @@ -const {dirname} = require('path') - -const findMade = (opts, parent, path = undefined) => { - // we never want the 'made' return value to be a root directory - if (path === parent) - return Promise.resolve() - - return opts.statAsync(parent).then( - st => st.isDirectory() ? path : undefined, // will fail later - er => er.code === 'ENOENT' - ? findMade(opts, dirname(parent), parent) - : undefined - ) -} - -const findMadeSync = (opts, parent, path = undefined) => { - if (path === parent) - return undefined - - try { - return opts.statSync(parent).isDirectory() ? path : undefined - } catch (er) { - return er.code === 'ENOENT' - ? findMadeSync(opts, dirname(parent), parent) - : undefined - } -} - -module.exports = {findMade, findMadeSync} diff --git a/node_modules/tar/node_modules/mkdirp/lib/mkdirp-manual.js b/node_modules/tar/node_modules/mkdirp/lib/mkdirp-manual.js deleted file mode 100644 index 2eb18cd64eb79..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/mkdirp-manual.js +++ /dev/null @@ -1,64 +0,0 @@ -const {dirname} = require('path') - -const mkdirpManual = (path, opts, made) => { - opts.recursive = false - const parent = dirname(path) - if (parent === path) { - return opts.mkdirAsync(path, opts).catch(er => { - // swallowed by recursive implementation on posix systems - // any other error is a failure - if (er.code !== 'EISDIR') - throw er - }) - } - - return opts.mkdirAsync(path, opts).then(() => made || path, er => { - if (er.code === 'ENOENT') - return mkdirpManual(parent, opts) - .then(made => mkdirpManual(path, opts, made)) - if (er.code !== 'EEXIST' && er.code !== 'EROFS') - throw er - return opts.statAsync(path).then(st => { - if (st.isDirectory()) - return made - else - throw er - }, () => { throw er }) - }) -} - -const mkdirpManualSync = (path, opts, made) => { - const parent = dirname(path) - opts.recursive = false - - if (parent === path) { - try { - return opts.mkdirSync(path, opts) - } catch (er) { - // swallowed by recursive implementation on posix systems - // any other error is a failure - if (er.code !== 'EISDIR') - throw er - else - return - } - } - - try { - opts.mkdirSync(path, opts) - return made || path - } catch (er) { - if (er.code === 'ENOENT') - return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made)) - if (er.code !== 'EEXIST' && er.code !== 'EROFS') - throw er - try { - if (!opts.statSync(path).isDirectory()) - throw er - } catch (_) { - throw er - } - } -} - -module.exports = {mkdirpManual, mkdirpManualSync} diff --git a/node_modules/tar/node_modules/mkdirp/lib/mkdirp-native.js b/node_modules/tar/node_modules/mkdirp/lib/mkdirp-native.js deleted file mode 100644 index c7a6b69800f62..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/mkdirp-native.js +++ /dev/null @@ -1,39 +0,0 @@ -const {dirname} = require('path') -const {findMade, findMadeSync} = require('./find-made.js') -const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js') - -const mkdirpNative = (path, opts) => { - opts.recursive = true - const parent = dirname(path) - if (parent === path) - return opts.mkdirAsync(path, opts) - - return findMade(opts, path).then(made => - opts.mkdirAsync(path, opts).then(() => made) - .catch(er => { - if (er.code === 'ENOENT') - return mkdirpManual(path, opts) - else - throw er - })) -} - -const mkdirpNativeSync = (path, opts) => { - opts.recursive = true - const parent = dirname(path) - if (parent === path) - return opts.mkdirSync(path, opts) - - const made = findMadeSync(opts, path) - try { - opts.mkdirSync(path, opts) - return made - } catch (er) { - if (er.code === 'ENOENT') - return mkdirpManualSync(path, opts) - else - throw er - } -} - -module.exports = {mkdirpNative, mkdirpNativeSync} diff --git a/node_modules/tar/node_modules/mkdirp/lib/opts-arg.js b/node_modules/tar/node_modules/mkdirp/lib/opts-arg.js deleted file mode 100644 index 2fa4833faacc7..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/opts-arg.js +++ /dev/null @@ -1,23 +0,0 @@ -const { promisify } = require('util') -const fs = require('fs') -const optsArg = opts => { - if (!opts) - opts = { mode: 0o777, fs } - else if (typeof opts === 'object') - opts = { mode: 0o777, fs, ...opts } - else if (typeof opts === 'number') - opts = { mode: opts, fs } - else if (typeof opts === 'string') - opts = { mode: parseInt(opts, 8), fs } - else - throw new TypeError('invalid options argument') - - opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir - opts.mkdirAsync = promisify(opts.mkdir) - opts.stat = opts.stat || opts.fs.stat || fs.stat - opts.statAsync = promisify(opts.stat) - opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync - opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync - return opts -} -module.exports = optsArg diff --git a/node_modules/tar/node_modules/mkdirp/lib/path-arg.js b/node_modules/tar/node_modules/mkdirp/lib/path-arg.js deleted file mode 100644 index cc07de5a6f992..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/path-arg.js +++ /dev/null @@ -1,29 +0,0 @@ -const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform -const { resolve, parse } = require('path') -const pathArg = path => { - if (/\0/.test(path)) { - // simulate same failure that node raises - throw Object.assign( - new TypeError('path must be a string without null bytes'), - { - path, - code: 'ERR_INVALID_ARG_VALUE', - } - ) - } - - path = resolve(path) - if (platform === 'win32') { - const badWinChars = /[*|"<>?:]/ - const {root} = parse(path) - if (badWinChars.test(path.substr(root.length))) { - throw Object.assign(new Error('Illegal characters in path.'), { - path, - code: 'EINVAL', - }) - } - } - - return path -} -module.exports = pathArg diff --git a/node_modules/tar/node_modules/mkdirp/lib/use-native.js b/node_modules/tar/node_modules/mkdirp/lib/use-native.js deleted file mode 100644 index 079361de19fd8..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/lib/use-native.js +++ /dev/null @@ -1,10 +0,0 @@ -const fs = require('fs') - -const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version -const versArr = version.replace(/^v/, '').split('.') -const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12 - -const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir -const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync - -module.exports = {useNative, useNativeSync} diff --git a/node_modules/tar/node_modules/mkdirp/package.json b/node_modules/tar/node_modules/mkdirp/package.json deleted file mode 100644 index 2913ed09bddd6..0000000000000 --- a/node_modules/tar/node_modules/mkdirp/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "1.0.4", - "main": "index.js", - "keywords": [ - "mkdir", - "directory", - "make dir", - "make", - "dir", - "recursive", - "native" - ], - "repository": { - "type": "git", - "url": "https://github.com/isaacs/node-mkdirp.git" - }, - "scripts": { - "test": "tap", - "snap": "tap", - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --follow-tags" - }, - "tap": { - "check-coverage": true, - "coverage-map": "map.js" - }, - "devDependencies": { - "require-inject": "^1.4.4", - "tap": "^14.10.7" - }, - "bin": "bin/cmd.js", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "files": [ - "bin", - "lib", - "index.js" - ] -} diff --git a/node_modules/node-gyp/node_modules/yallist/LICENSE.md b/node_modules/tar/node_modules/yallist/LICENSE.md similarity index 100% rename from node_modules/node-gyp/node_modules/yallist/LICENSE.md rename to node_modules/tar/node_modules/yallist/LICENSE.md diff --git a/node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js b/node_modules/tar/node_modules/yallist/dist/commonjs/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/yallist/dist/commonjs/index.js rename to node_modules/tar/node_modules/yallist/dist/commonjs/index.js diff --git a/node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json b/node_modules/tar/node_modules/yallist/dist/commonjs/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/yallist/dist/commonjs/package.json rename to node_modules/tar/node_modules/yallist/dist/commonjs/package.json diff --git a/node_modules/node-gyp/node_modules/yallist/dist/esm/index.js b/node_modules/tar/node_modules/yallist/dist/esm/index.js similarity index 100% rename from node_modules/node-gyp/node_modules/yallist/dist/esm/index.js rename to node_modules/tar/node_modules/yallist/dist/esm/index.js diff --git a/node_modules/node-gyp/node_modules/tar/dist/esm/package.json b/node_modules/tar/node_modules/yallist/dist/esm/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/tar/dist/esm/package.json rename to node_modules/tar/node_modules/yallist/dist/esm/package.json diff --git a/node_modules/node-gyp/node_modules/yallist/package.json b/node_modules/tar/node_modules/yallist/package.json similarity index 100% rename from node_modules/node-gyp/node_modules/yallist/package.json rename to node_modules/tar/node_modules/yallist/package.json diff --git a/node_modules/tar/package.json b/node_modules/tar/package.json index f84a41cca5af5..be0f1e8fd8000 100644 --- a/node_modules/tar/package.json +++ b/node_modules/tar/package.json @@ -1,8 +1,8 @@ { - "author": "GitHub Inc.", + "author": "Isaac Z. Schlueter", "name": "tar", "description": "tar for node", - "version": "6.2.1", + "version": "7.5.1", "repository": { "type": "git", "url": "https://github.com/isaacs/node-tar.git" @@ -10,61 +10,317 @@ "scripts": { "genparse": "node scripts/generate-parse-fixtures.js", "snap": "tap", - "test": "tap" + "test": "tap", + "pretest": "npm run prepare", + "presnap": "npm run prepare", + "prepare": "tshy", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "format": "prettier --write . --log-level warn", + "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts" }, "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" }, "devDependencies": { - "@npmcli/eslint-config": "^4.0.0", - "@npmcli/template-oss": "4.11.0", + "@types/node": "^22.15.29", "chmodr": "^1.2.0", "end-of-stream": "^1.4.3", "events-to-array": "^2.0.3", "mutate-fs": "^2.1.1", - "nock": "^13.2.9", - "rimraf": "^3.0.2", - "tap": "^16.0.1" + "nock": "^13.5.4", + "prettier": "^3.2.5", + "rimraf": "^5.0.5", + "tap": "^18.7.2", + "tshy": "^1.13.1", + "typedoc": "^0.25.13" }, "license": "ISC", "engines": { - "node": ">=10" + "node": ">=18" }, "files": [ - "bin/", - "lib/", - "index.js" + "dist" ], "tap": { "coverage-map": "map.js", "timeout": 0, - "nyc-arg": [ - "--exclude", - "tap-snapshots/**" - ] + "typecheck": true }, - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.11.0", - "content": "scripts/template-oss", - "engines": ">=10", - "distPaths": [ - "index.js" - ], - "allowPaths": [ - "/index.js" - ], - "ciVersions": [ - "10.x", - "12.x", - "14.x", - "16.x", - "18.x" - ] - } + "prettier": { + "experimentalTernaries": true, + "semi": false, + "printWidth": 70, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "jsxSingleQuote": false, + "bracketSameLine": true, + "arrowParens": "avoid", + "endOfLine": "lf" + }, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./c": "./src/create.ts", + "./create": "./src/create.ts", + "./replace": "./src/create.ts", + "./r": "./src/create.ts", + "./list": "./src/list.ts", + "./t": "./src/list.ts", + "./update": "./src/update.ts", + "./u": "./src/update.ts", + "./extract": "./src/extract.ts", + "./x": "./src/extract.ts", + "./pack": "./src/pack.ts", + "./unpack": "./src/unpack.ts", + "./parse": "./src/parse.ts", + "./read-entry": "./src/read-entry.ts", + "./write-entry": "./src/write-entry.ts", + "./header": "./src/header.ts", + "./pax": "./src/pax.ts", + "./types": "./src/types.ts" + } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "source": "./src/index.ts", + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "source": "./src/index.ts", + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./c": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./create": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./replace": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./r": { + "import": { + "source": "./src/create.ts", + "types": "./dist/esm/create.d.ts", + "default": "./dist/esm/create.js" + }, + "require": { + "source": "./src/create.ts", + "types": "./dist/commonjs/create.d.ts", + "default": "./dist/commonjs/create.js" + } + }, + "./list": { + "import": { + "source": "./src/list.ts", + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "source": "./src/list.ts", + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./t": { + "import": { + "source": "./src/list.ts", + "types": "./dist/esm/list.d.ts", + "default": "./dist/esm/list.js" + }, + "require": { + "source": "./src/list.ts", + "types": "./dist/commonjs/list.d.ts", + "default": "./dist/commonjs/list.js" + } + }, + "./update": { + "import": { + "source": "./src/update.ts", + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "source": "./src/update.ts", + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./u": { + "import": { + "source": "./src/update.ts", + "types": "./dist/esm/update.d.ts", + "default": "./dist/esm/update.js" + }, + "require": { + "source": "./src/update.ts", + "types": "./dist/commonjs/update.d.ts", + "default": "./dist/commonjs/update.js" + } + }, + "./extract": { + "import": { + "source": "./src/extract.ts", + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "source": "./src/extract.ts", + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./x": { + "import": { + "source": "./src/extract.ts", + "types": "./dist/esm/extract.d.ts", + "default": "./dist/esm/extract.js" + }, + "require": { + "source": "./src/extract.ts", + "types": "./dist/commonjs/extract.d.ts", + "default": "./dist/commonjs/extract.js" + } + }, + "./pack": { + "import": { + "source": "./src/pack.ts", + "types": "./dist/esm/pack.d.ts", + "default": "./dist/esm/pack.js" + }, + "require": { + "source": "./src/pack.ts", + "types": "./dist/commonjs/pack.d.ts", + "default": "./dist/commonjs/pack.js" + } + }, + "./unpack": { + "import": { + "source": "./src/unpack.ts", + "types": "./dist/esm/unpack.d.ts", + "default": "./dist/esm/unpack.js" + }, + "require": { + "source": "./src/unpack.ts", + "types": "./dist/commonjs/unpack.d.ts", + "default": "./dist/commonjs/unpack.js" + } + }, + "./parse": { + "import": { + "source": "./src/parse.ts", + "types": "./dist/esm/parse.d.ts", + "default": "./dist/esm/parse.js" + }, + "require": { + "source": "./src/parse.ts", + "types": "./dist/commonjs/parse.d.ts", + "default": "./dist/commonjs/parse.js" + } + }, + "./read-entry": { + "import": { + "source": "./src/read-entry.ts", + "types": "./dist/esm/read-entry.d.ts", + "default": "./dist/esm/read-entry.js" + }, + "require": { + "source": "./src/read-entry.ts", + "types": "./dist/commonjs/read-entry.d.ts", + "default": "./dist/commonjs/read-entry.js" + } + }, + "./write-entry": { + "import": { + "source": "./src/write-entry.ts", + "types": "./dist/esm/write-entry.d.ts", + "default": "./dist/esm/write-entry.js" + }, + "require": { + "source": "./src/write-entry.ts", + "types": "./dist/commonjs/write-entry.d.ts", + "default": "./dist/commonjs/write-entry.js" + } + }, + "./header": { + "import": { + "source": "./src/header.ts", + "types": "./dist/esm/header.d.ts", + "default": "./dist/esm/header.js" + }, + "require": { + "source": "./src/header.ts", + "types": "./dist/commonjs/header.d.ts", + "default": "./dist/commonjs/header.js" + } + }, + "./pax": { + "import": { + "source": "./src/pax.ts", + "types": "./dist/esm/pax.d.ts", + "default": "./dist/esm/pax.js" + }, + "require": { + "source": "./src/pax.ts", + "types": "./dist/commonjs/pax.d.ts", + "default": "./dist/commonjs/pax.js" + } + }, + "./types": { + "import": { + "source": "./src/types.ts", + "types": "./dist/esm/types.d.ts", + "default": "./dist/esm/types.js" + }, + "require": { + "source": "./src/types.ts", + "types": "./dist/commonjs/types.d.ts", + "default": "./dist/commonjs/types.js" + } + } + }, + "type": "module", + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/package-lock.json b/package-lock.json index 25b4d10c29f37..7eac7aabe2124 100644 --- a/package-lock.json +++ b/package-lock.json @@ -144,7 +144,7 @@ "spdx-expression-parse": "^4.0.0", "ssri": "^12.0.0", "supports-color": "^10.2.2", - "tar": "^6.2.1", + "tar": "^7.5.1", "text-table": "~0.2.0", "tiny-relative-date": "^2.0.2", "treeverse": "^3.0.0", @@ -3081,11 +3081,13 @@ } }, "node_modules/chownr": { - "version": "2.0.0", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", "inBundle": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/ci-info": { @@ -8060,7 +8062,9 @@ } }, "node_modules/minizlib": { - "version": "3.0.2", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", "inBundle": true, "license": "MIT", "dependencies": { @@ -8070,20 +8074,6 @@ "node": ">= 18" } }, - "node_modules/mkdirp": { - "version": "3.0.1", - "inBundle": true, - "license": "MIT", - "bin": { - "mkdirp": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/modify-values": { "version": "1.0.1", "dev": true, @@ -8249,14 +8239,6 @@ "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/node-gyp/node_modules/chownr": { - "version": "3.0.0", - "inBundle": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - } - }, "node_modules/node-gyp/node_modules/glob": { "version": "10.4.5", "inBundle": true, @@ -8345,30 +8327,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/node-gyp/node_modules/tar": { - "version": "7.4.3", - "inBundle": true, - "license": "ISC", - "dependencies": { - "@isaacs/fs-minipass": "^4.0.0", - "chownr": "^3.0.0", - "minipass": "^7.1.2", - "minizlib": "^3.0.1", - "mkdirp": "^3.0.1", - "yallist": "^5.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/node-gyp/node_modules/yallist": { - "version": "5.0.0", - "inBundle": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - } - }, "node_modules/node-html-parser": { "version": "6.1.13", "dev": true, @@ -9049,38 +9007,6 @@ "node": "^20.17.0 || >=22.9.0" } }, - "node_modules/pacote/node_modules/chownr": { - "version": "3.0.0", - "inBundle": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - } - }, - "node_modules/pacote/node_modules/tar": { - "version": "7.4.3", - "inBundle": true, - "license": "ISC", - "dependencies": { - "@isaacs/fs-minipass": "^4.0.0", - "chownr": "^3.0.0", - "minipass": "^7.1.2", - "minizlib": "^3.0.1", - "mkdirp": "^3.0.1", - "yallist": "^5.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/pacote/node_modules/yallist": { - "version": "5.0.0", - "inBundle": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=18" - } - }, "node_modules/parent-module": { "version": "1.0.1", "dev": true, @@ -13279,19 +13205,20 @@ } }, "node_modules/tar": { - "version": "6.2.1", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.1.tgz", + "integrity": "sha512-nlGpxf+hv0v7GkWBK2V9spgactGOp0qvfWRxUMjqHyzrt3SgwE48DIv/FhqPHJYLHpgW1opq3nERbz5Anq7n1g==", "inBundle": true, "license": "ISC", "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" }, "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/tar-stream": { @@ -13304,78 +13231,14 @@ "streamx": "^2.15.0" } }, - "node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "inBundle": true, - "license": "ISC", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tar/node_modules/fs-minipass/node_modules/yallist": { - "version": "4.0.0", - "inBundle": true, - "license": "ISC" - }, - "node_modules/tar/node_modules/minipass": { + "node_modules/tar/node_modules/yallist": { "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", "inBundle": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/tar/node_modules/minizlib": { - "version": "2.1.2", - "inBundle": true, - "license": "MIT", - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tar/node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "inBundle": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tar/node_modules/minizlib/node_modules/yallist": { - "version": "4.0.0", - "inBundle": true, - "license": "ISC" - }, - "node_modules/tar/node_modules/mkdirp": { - "version": "1.0.4", - "inBundle": true, - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, + "license": "BlueOak-1.0.0", "engines": { - "node": ">=10" + "node": ">=18" } }, "node_modules/tcompare": { @@ -14638,7 +14501,7 @@ "minimatch": "^10.0.3", "npm-package-arg": "^13.0.0", "pacote": "^21.0.2", - "tar": "^6.2.1" + "tar": "^7.5.1" }, "devDependencies": { "@npmcli/eslint-config": "^5.0.1", diff --git a/package.json b/package.json index e6f1a95c142a9..5576e5502207f 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "spdx-expression-parse": "^4.0.0", "ssri": "^12.0.0", "supports-color": "^10.2.2", - "tar": "^6.2.1", + "tar": "^7.5.1", "text-table": "~0.2.0", "tiny-relative-date": "^2.0.2", "treeverse": "^3.0.0", diff --git a/workspaces/libnpmdiff/lib/untar.js b/workspaces/libnpmdiff/lib/untar.js index 341ae27d1e826..6bbecd8a59ce0 100644 --- a/workspaces/libnpmdiff/lib/untar.js +++ b/workspaces/libnpmdiff/lib/untar.js @@ -37,7 +37,6 @@ const untar = ({ files, refs }, { filterFiles, item, prefix }) => { // should skip reading file when using --name-only option let content try { - entry.setEncoding('utf8') content = entry.concat() } catch (e) { /* istanbul ignore next */ @@ -80,11 +79,12 @@ const readTarballs = async (tarballs, opts = {}) => { } // await to read all content from included files + // TODO this feels like it could be one in one pass instead of three (values, map, forEach) const allRefs = [...refs.values()] const contents = await Promise.all(allRefs.map(async ref => ref.content)) contents.forEach((content, index) => { - allRefs[index].content = content + allRefs[index].content = content.toString('utf8') }) return { diff --git a/workspaces/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json index 605f1691d95b5..59c9b354229cf 100644 --- a/workspaces/libnpmdiff/package.json +++ b/workspaces/libnpmdiff/package.json @@ -54,7 +54,7 @@ "minimatch": "^10.0.3", "npm-package-arg": "^13.0.0", "pacote": "^21.0.2", - "tar": "^6.2.1" + "tar": "^7.5.1" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",