@yao-pkg/pkg-fetch 3.5.14 → 3.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,7 +42,7 @@ This project deploys multiple defense measures to ensure that the safe binaries
42
42
  - GPG-signed hashes are available in [Releases](https://github.com/yao-pkg/pkg-fetch/releases)
43
43
  - Easy to spot a compromise.
44
44
  - `pkg-fetch` package on npm is strictly permission-controlled
45
- - Only authorized Vercel employees can push new revisions to npm.
45
+ - Only @robertsLando can push new revisions to npm.
46
46
 
47
47
  ## Contributing Updates to Patches
48
48
 
@@ -112,6 +112,10 @@ For example:
112
112
 
113
113
  `yarn start --node-range node18 --arch x64 --output dist`
114
114
 
115
+ ## Small ICU
116
+
117
+ Node.js binaries built by this project use the `small-icu` option to reduce the size of the binary. If you need a Node.js binary with full ICU support, you can build it yourself by setting the `--with-intl=full-icu` option. Small ICU is sufficient for most use cases, and it reduces the binary size by about 30 MB.
118
+
115
119
  ## Environment
116
120
 
117
121
  | Var | Description |
package/lib-es5/build.js CHANGED
@@ -62,7 +62,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  exports.prepBuildPath = exports.fetchExtractApply = void 0;
63
63
  var zlib_1 = require("zlib");
64
64
  var crypto_1 = __importDefault(require("crypto"));
65
- var fs_extra_1 = __importDefault(require("fs-extra"));
65
+ var fs_1 = require("fs");
66
+ var promises_1 = require("fs/promises");
66
67
  var os_1 = __importDefault(require("os"));
67
68
  var path_1 = __importDefault(require("path"));
68
69
  var stream_1 = require("stream");
@@ -125,38 +126,38 @@ function getConfigureArgs(major, targetPlatform) {
125
126
  }
126
127
  function tarFetch(nodeVersion) {
127
128
  return __awaiter(this, void 0, void 0, function () {
128
- var distUrl, tarName, archivePath, hashPath, _a, _b, _c;
129
- return __generator(this, function (_d) {
130
- switch (_d.label) {
129
+ var distUrl, tarName, archivePath, hashPath, _a, _b;
130
+ return __generator(this, function (_c) {
131
+ switch (_c.label) {
131
132
  case 0:
132
133
  log_1.log.info('Fetching Node.js source archive from nodejs.org...');
133
134
  distUrl = "".concat(nodeRepo, "/").concat(nodeVersion);
134
135
  tarName = "node-".concat(nodeVersion, ".tar.gz");
135
136
  archivePath = path_1.default.join(nodeArchivePath, tarName);
136
137
  hashPath = path_1.default.join(nodeArchivePath, "".concat(tarName, ".sha256sum"));
137
- if (fs_extra_1.default.existsSync(hashPath) && fs_extra_1.default.existsSync(archivePath)) {
138
+ if ((0, fs_1.existsSync)(hashPath) && (0, fs_1.existsSync)(archivePath)) {
138
139
  return [2 /*return*/];
139
140
  }
140
- return [4 /*yield*/, fs_extra_1.default.remove(hashPath).catch(function () { return undefined; })];
141
+ return [4 /*yield*/, (0, promises_1.rm)(hashPath, { recursive: true, force: true }).catch(function () { return undefined; })];
141
142
  case 1:
142
- _d.sent();
143
- return [4 /*yield*/, fs_extra_1.default.remove(archivePath).catch(function () { return undefined; })];
143
+ _c.sent();
144
+ return [4 /*yield*/, (0, promises_1.rm)(archivePath, { recursive: true, force: true }).catch(function () { return undefined; })];
144
145
  case 2:
145
- _d.sent();
146
+ _c.sent();
146
147
  return [4 /*yield*/, (0, utils_1.downloadUrl)("".concat(distUrl, "/SHASUMS256.txt"), hashPath)];
147
148
  case 3:
148
- _d.sent();
149
- _b = (_a = fs_extra_1.default).writeFile;
150
- _c = [hashPath];
151
- return [4 /*yield*/, fs_extra_1.default.readFile(hashPath, 'utf8')];
152
- case 4: return [4 /*yield*/, _b.apply(_a, _c.concat([(_d.sent())
149
+ _c.sent();
150
+ _a = promises_1.writeFile;
151
+ _b = [hashPath];
152
+ return [4 /*yield*/, (0, promises_1.readFile)(hashPath, 'utf8')];
153
+ case 4: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_c.sent())
153
154
  .split('\n')
154
155
  .filter(function (l) { return l.includes(tarName); })[0]]))];
155
156
  case 5:
156
- _d.sent();
157
+ _c.sent();
157
158
  return [4 /*yield*/, (0, utils_1.downloadUrl)("".concat(distUrl, "/").concat(tarName), archivePath)];
158
159
  case 6:
159
- _d.sent();
160
+ _c.sent();
160
161
  return [2 /*return*/];
161
162
  }
162
163
  });
@@ -170,23 +171,29 @@ function tarExtract(nodeVersion, suppressTarOutput) {
170
171
  case 0:
171
172
  log_1.log.info('Extracting Node.js source archive...');
172
173
  tarName = "node-".concat(nodeVersion, ".tar.gz");
173
- return [4 /*yield*/, fs_extra_1.default.readFile(path_1.default.join(nodeArchivePath, "".concat(tarName, ".sha256sum")), 'utf8')];
174
+ return [4 /*yield*/, (0, promises_1.readFile)(path_1.default.join(nodeArchivePath, "".concat(tarName, ".sha256sum")), 'utf8')];
174
175
  case 1:
175
176
  expectedHash = (_a.sent()).split(' ')[0];
176
177
  return [4 /*yield*/, (0, utils_1.hash)(path_1.default.join(nodeArchivePath, tarName))];
177
178
  case 2:
178
179
  actualHash = _a.sent();
179
180
  if (!(expectedHash !== actualHash)) return [3 /*break*/, 5];
180
- return [4 /*yield*/, fs_extra_1.default.remove(path_1.default.join(nodeArchivePath, tarName))];
181
+ return [4 /*yield*/, (0, promises_1.rm)(path_1.default.join(nodeArchivePath, tarName), {
182
+ recursive: true,
183
+ force: true,
184
+ })];
181
185
  case 3:
182
186
  _a.sent();
183
- return [4 /*yield*/, fs_extra_1.default.remove(path_1.default.join(nodeArchivePath, "".concat(tarName, ".sha256sum")))];
187
+ return [4 /*yield*/, (0, promises_1.rm)(path_1.default.join(nodeArchivePath, "".concat(tarName, ".sha256sum")), {
188
+ recursive: true,
189
+ force: true,
190
+ })];
184
191
  case 4:
185
192
  _a.sent();
186
193
  throw (0, log_1.wasReported)("Hash mismatch for ".concat(tarName));
187
194
  case 5:
188
195
  pipe = (0, util_1.promisify)(stream_1.pipeline);
189
- source = fs_extra_1.default.createReadStream(path_1.default.join(nodeArchivePath, tarName));
196
+ source = (0, fs_1.createReadStream)(path_1.default.join(nodeArchivePath, tarName));
190
197
  gunzip = (0, zlib_1.createGunzip)();
191
198
  extract = tar_fs_1.default.extract(nodePath, {
192
199
  strip: 1,
@@ -383,13 +390,13 @@ function prepBuildPath() {
383
390
  return __awaiter(this, void 0, void 0, function () {
384
391
  return __generator(this, function (_a) {
385
392
  switch (_a.label) {
386
- case 0: return [4 /*yield*/, fs_extra_1.default.remove(buildPath)];
393
+ case 0: return [4 /*yield*/, (0, promises_1.rm)(buildPath, { recursive: true, force: true })];
387
394
  case 1:
388
395
  _a.sent();
389
- return [4 /*yield*/, fs_extra_1.default.mkdirp(nodePath)];
396
+ return [4 /*yield*/, (0, promises_1.mkdir)(nodePath, { recursive: true })];
390
397
  case 2:
391
398
  _a.sent();
392
- return [4 /*yield*/, fs_extra_1.default.mkdirp(nodeArchivePath)];
399
+ return [4 /*yield*/, (0, promises_1.mkdir)(nodeArchivePath, { recursive: true })];
393
400
  case 3:
394
401
  _a.sent();
395
402
  return [2 /*return*/];
@@ -415,16 +422,16 @@ function build(nodeVersion, targetArch, targetPlatform, local) {
415
422
  return [4 /*yield*/, (0, utils_1.hash)(output)];
416
423
  case 4:
417
424
  outputHash = _a.sent();
418
- return [4 /*yield*/, fs_extra_1.default.mkdirp(path_1.default.dirname(local))];
425
+ return [4 /*yield*/, (0, promises_1.mkdir)(path_1.default.dirname(local), { recursive: true })];
419
426
  case 5:
420
427
  _a.sent();
421
- return [4 /*yield*/, fs_extra_1.default.copy(output, local)];
428
+ return [4 /*yield*/, (0, promises_1.cp)(output, local)];
422
429
  case 6:
423
430
  _a.sent();
424
- return [4 /*yield*/, fs_extra_1.default.promises.writeFile("".concat(local, ".sha256sum"), "".concat(outputHash, " ").concat(path_1.default.basename(local), "\n"))];
431
+ return [4 /*yield*/, (0, promises_1.writeFile)("".concat(local, ".sha256sum"), "".concat(outputHash, " ").concat(path_1.default.basename(local), "\n"))];
425
432
  case 7:
426
433
  _a.sent();
427
- return [4 /*yield*/, fs_extra_1.default.remove(buildPath)];
434
+ return [4 /*yield*/, (0, promises_1.rm)(buildPath, { recursive: true, force: true })];
428
435
  case 8:
429
436
  _a.sent();
430
437
  return [2 /*return*/];
@@ -32,26 +32,26 @@
32
32
  "node-v18.20.4-macos-x64": "8ebc5bd8c21632bc79b5469d0b7dbbee9209214d9deee9aa1d84d0990c7e8464",
33
33
  "node-v18.20.4-win-arm64": "01227a811847179a943392a41cc75084d08c21e049278190eebd98cdc6bcc4e0",
34
34
  "node-v18.20.4-win-x64": "53196be55b5c4f5362f04eb3a34692263df8e65d756506176269a967f5e9face",
35
- "node-v20.17.0-alpine-arm64": "764e4ed9b1fc68e9932a98b16ab9f2576de099ac7ad0d230353fe2698ab2d998",
36
- "node-v20.17.0-alpine-x64": "240ffbc13fa0cb9b1560bd87113ba035e70b9d1f7562e54c026df8c1f092cc3b",
37
- "node-v20.17.0-linux-arm64": "173d940455d7bd02d75be5aaaca1b313cf498257817b96300a3a7d7b6ca769a8",
38
- "node-v20.17.0-linux-x64": "f6b00290bbcd9f9a4cc35cc469ddf21e60ba7d58d3d01962fef7f6057ba7fa3c",
39
- "node-v20.17.0-linuxstatic-arm64": "35353d9fff4a884954fa1da9412dc2348a9d5432964cb7bdda8d397b034d7a4a",
40
- "node-v20.17.0-linuxstatic-armv7": "5c8a3d46c7b2362afc1f323f3f2ee9c101c4fd02fea4a4ae1ea426a8ab24f246",
41
- "node-v20.17.0-linuxstatic-x64": "bdabc37d146119e0697f7ce6a18fc3c51c3634241522f3e7bf62c082594c352b",
42
- "node-v20.17.0-macos-arm64": "2e59df5e88c90f1457fd89abcea47fa0f2b7c66cbf93116d0ab3e5b29c87bc5f",
43
- "node-v20.17.0-macos-x64": "cb37f44c3cdc12fe6e2e6b461cfdacba35177426bd8ab85f39e4c3d279fca11b",
44
- "node-v20.17.0-win-arm64": "9769ad72c8ab0f6b1705c9bffb03585044a917511a30d74c68205b7923ff9fa2",
45
- "node-v20.17.0-win-x64": "9c15a64b3babd2e7cd6c0cb1770495c331bea6df4544df92f734a23cc55bc1bf",
46
- "node-v22.9.0-alpine-arm64": "89c3d4143af78170083b4c0f0e458a3efefe7f62483ddf149aa0d42a31130fe1",
47
- "node-v22.9.0-alpine-x64": "e04f1127d7d4f5d288779f561d17de0c3f784325fc473aa5278263a711e97369",
48
- "node-v22.9.0-linux-arm64": "63584c21d102a4b4f015c145ede2bd9cc0dd64a36ee0c31a1c93a0ba907e5b19",
49
- "node-v22.9.0-linux-x64": "43a17431d84c2e86d44da21b8450c6750767a816ce35000f1afb4e2f2c0385ea",
50
- "node-v22.9.0-linuxstatic-arm64": "6a605ce05d247947b26008fffa333105aa5c8df619326dabf5bb8469b7578683",
51
- "node-v22.9.0-linuxstatic-armv7": "24039ad7df5ca6c809686f0bbc35322a6aba250c943fce7cc03042595c983c06",
52
- "node-v22.9.0-linuxstatic-x64": "ddeac8eb7de34ec82c29cdc61cee6f5cc782acf6dd7cfa0f0196165fe03dadba",
53
- "node-v22.9.0-macos-arm64": "d74c297b69ae697fd0ddba6dd69af059704357c7ab6c8ce5a9d1f9cd6e34e0d1",
54
- "node-v22.9.0-macos-x64": "495df5c07003d0695ba4ada2ea88c84a1fabb4e08061ac7ca81a76392e8c6a34",
55
- "node-v22.9.0-win-arm64": "039526a19a9ccebde669cfaa4668f0578fcba7fe69b94a796bd6002dfcdd95ea",
56
- "node-v22.9.0-win-x64": "d87659ec8165cbafd9772046f023bfa6bc2f76c46e2b85189c9fda6777dd2442"
35
+ "node-v20.18.0-alpine-arm64": "6f39cbe112f78a698e70efde60b34082e621dc2921ffb0df45d61bdb47ec2612",
36
+ "node-v20.18.0-alpine-x64": "1ca67baba661cc2dda4d04619e35a0e21ffe7bb62a84d282a7199f3f855ea8a1",
37
+ "node-v20.18.0-linux-arm64": "e4a455deef676631d49810526140510a6097e101c784292cf320da16b2aeea71",
38
+ "node-v20.18.0-linux-x64": "6c8c6e50f8d4999be9563644da61691a2c32e396c1bd0a32ada8bfe89f4ef26f",
39
+ "node-v20.18.0-linuxstatic-arm64": "1a2f0ac018460f3c526c7ac9fa64bcb6c7f5777a5e866d438c218316cb41bb5d",
40
+ "node-v20.18.0-linuxstatic-armv7": "6848b7620b0b75acdfed15c53c625d4b954917b8dbb9eb09af9f6f2686c0d6da",
41
+ "node-v20.18.0-linuxstatic-x64": "4a223abf1e64d664e09572dbe7fef80a3bfe2d09d253f87e31ad28ae44ee76f0",
42
+ "node-v20.18.0-macos-arm64": "144adae471b4ae359c24faf2eff67fcac819db081c331f888fe1ab5591438586",
43
+ "node-v20.18.0-macos-x64": "12a731ab4d3814af141277daf3055d87f37156bbf1155a8775f86f85338dc7da",
44
+ "node-v20.18.0-win-arm64": "b722673728baf55f0728b51f4e3565b9bd2bb6080f1047c8b7e09087eb99e5dc",
45
+ "node-v20.18.0-win-x64": "46ce4bf8ac9e8f9538aee255fcda92bc1105080ee3afff517d6bf77d0256d1dc",
46
+ "node-v22.10.0-alpine-arm64": "777f2893c0b76cb066f85abf30bd079590829c2115515afa4a58e7b4ebccbd36",
47
+ "node-v22.10.0-alpine-x64": "fc9bedbf415d5a4d0c977138b43d1bb5eae4c397868dc103187ffbfefffcc512",
48
+ "node-v22.10.0-linux-arm64": "5cea43a1badc4dd4121ed7e2aa13a77bbaf9e27ca2f08c773cb685763f0a0ed1",
49
+ "node-v22.10.0-linux-x64": "05d3150571b9e9df2ecfb551b8074035e2e8a03c116a037869436b2e9bd0b723",
50
+ "node-v22.10.0-linuxstatic-arm64": "1d4a58da87b7a4901e53cab3342b71bfbde8eaf58b2196aeafb09e28da2495ee",
51
+ "node-v22.10.0-linuxstatic-armv7": "0dcaa6f9e741d847eca4790b1c2ab2bcb50a30f9758d5ec1033e6eec77333727",
52
+ "node-v22.10.0-linuxstatic-x64": "fa01830873fd7b40cc7d81076a137d74790f50585df09bf5b918da0c241aea41",
53
+ "node-v22.10.0-macos-arm64": "1f4f117fa4c4fe84f92360536497d40e5978eb4f9016bdccbc1f32f6146a361d",
54
+ "node-v22.10.0-macos-x64": "f04994f8fce2ff8f4ce264dee116d6032c1316c5a1355d593487c26fde16afe8",
55
+ "node-v22.10.0-win-arm64": "7bb2efd7935c872888bc3d011edb806f45271be392651bca4a38f873c5c9a386",
56
+ "node-v22.10.0-win-x64": "09b6224d9966b4d2983c6b7b9a859af749c8028df7f663cbd16f2243cc281d69"
57
57
  }
package/lib-es5/index.js CHANGED
@@ -63,7 +63,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
65
  exports.system = exports.need = exports.getNodeVersion = exports.satisfyingNodeVersion = void 0;
66
- var fs_extra_1 = __importDefault(require("fs-extra"));
66
+ var fs_1 = require("fs");
67
+ var promises_1 = require("fs/promises");
67
68
  var path_1 = __importDefault(require("path"));
68
69
  var semver_1 = __importDefault(require("semver"));
69
70
  var expected_1 = require("./expected");
@@ -109,7 +110,7 @@ function exists(file) {
109
110
  switch (_a.label) {
110
111
  case 0:
111
112
  _a.trys.push([0, 2, , 3]);
112
- return [4 /*yield*/, fs_extra_1.default.stat(file)];
113
+ return [4 /*yield*/, (0, promises_1.stat)(file)];
113
114
  case 1:
114
115
  _a.sent();
115
116
  return [2 /*return*/, true];
@@ -197,7 +198,7 @@ function need(opts) {
197
198
  return [2 /*return*/, fetched];
198
199
  }
199
200
  log_1.log.info('Binary hash does NOT match. Re-fetching...');
200
- fs_extra_1.default.unlinkSync(fetched);
201
+ (0, fs_1.unlinkSync)(fetched);
201
202
  _d.label = 4;
202
203
  case 4:
203
204
  if (!!forceFetch) return [3 /*break*/, 6];
@@ -223,7 +224,7 @@ function need(opts) {
223
224
  if ((_d.sent()) === expected_1.EXPECTED_HASHES[remote.name]) {
224
225
  return [2 /*return*/, fetched];
225
226
  }
226
- fs_extra_1.default.unlinkSync(fetched);
227
+ (0, fs_1.unlinkSync)(fetched);
227
228
  throw (0, log_1.wasReported)('Binary hash does NOT match.');
228
229
  case 9:
229
230
  fetchFailed = true;
package/lib-es5/log.js CHANGED
@@ -22,7 +22,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.wasReported = exports.log = void 0;
23
23
  var progress_1 = __importDefault(require("progress"));
24
24
  var assert_1 = __importDefault(require("assert"));
25
- var chalk_1 = __importDefault(require("chalk"));
25
+ var picocolors_1 = __importDefault(require("picocolors"));
26
+ var tty_1 = require("tty");
27
+ // workaround until picocolors improves its color detection
28
+ // https://github.com/alexeyraspopov/picocolors/issues/85
29
+ var pc = picocolors_1.default.createColors(tty_1.WriteStream.prototype.hasColors());
26
30
  var Log = /** @class */ (function () {
27
31
  function Log() {
28
32
  this.debugMode = false;
@@ -44,7 +48,7 @@ var Log = /** @class */ (function () {
44
48
  if (!this.debugMode) {
45
49
  return;
46
50
  }
47
- console.log("> ".concat(chalk_1.default.green('[debug]'), " ").concat(text));
51
+ console.log("> ".concat(pc.green('[debug]'), " ").concat(text));
48
52
  this.lines(lines);
49
53
  };
50
54
  Log.prototype.info = function (text, lines) {
@@ -52,12 +56,12 @@ var Log = /** @class */ (function () {
52
56
  this.lines(lines);
53
57
  };
54
58
  Log.prototype.warn = function (text, lines) {
55
- console.log("> ".concat(chalk_1.default.blue('Warning'), " ").concat(text));
59
+ console.log("> ".concat(pc.blue('Warning'), " ").concat(text));
56
60
  this.lines(lines);
57
61
  };
58
62
  Log.prototype.error = function (text, lines) {
59
63
  var message = text instanceof Error ? text.stack : text;
60
- console.log("> ".concat(chalk_1.default.red('Error!'), " ").concat(message));
64
+ console.log("> ".concat(pc.red('Error!'), " ").concat(message));
61
65
  this.lines(lines);
62
66
  };
63
67
  Log.prototype.enableProgress = function (text) {
package/lib-es5/utils.js CHANGED
@@ -42,7 +42,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.nodeBinarySortFunction = exports.spawn = exports.plusx = exports.hash = exports.downloadUrl = void 0;
43
43
  var node_fetch_1 = __importDefault(require("node-fetch"));
44
44
  var crypto_1 = __importDefault(require("crypto"));
45
- var fs_extra_1 = __importDefault(require("fs-extra"));
45
+ var fs_1 = require("fs");
46
+ var promises_1 = require("fs/promises");
46
47
  var https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
47
48
  var path_1 = __importDefault(require("path"));
48
49
  var child_process_1 = require("child_process");
@@ -67,8 +68,8 @@ function downloadUrl(url, file) {
67
68
  throw (0, log_1.wasReported)("".concat(res.status, ": ").concat(res.statusText));
68
69
  }
69
70
  tempFile = "".concat(file, ".downloading");
70
- fs_extra_1.default.mkdirpSync(path_1.default.dirname(tempFile));
71
- ws = fs_extra_1.default.createWriteStream(tempFile);
71
+ (0, fs_1.mkdirSync)(path_1.default.dirname(tempFile), { recursive: true });
72
+ ws = (0, fs_1.createWriteStream)(tempFile);
72
73
  totalSize = Number(res.headers.get('content-length'));
73
74
  currentSize = 0;
74
75
  res.body.on('data', function (chunk) {
@@ -82,13 +83,13 @@ function downloadUrl(url, file) {
82
83
  stream_1.default.finished(ws, function (err) {
83
84
  if (err) {
84
85
  log_1.log.disableProgress();
85
- fs_extra_1.default.rmSync(tempFile);
86
+ (0, fs_1.rmSync)(tempFile);
86
87
  reject((0, log_1.wasReported)("".concat(err.name, ": ").concat(err.message)));
87
88
  }
88
89
  else {
89
90
  log_1.log.showProgress(100);
90
91
  log_1.log.disableProgress();
91
- fs_extra_1.default.moveSync(tempFile, file);
92
+ (0, fs_1.renameSync)(tempFile, file);
92
93
  resolve();
93
94
  }
94
95
  });
@@ -103,7 +104,7 @@ function hash(filePath) {
103
104
  return __generator(this, function (_a) {
104
105
  return [2 /*return*/, new Promise(function (resolve, reject) {
105
106
  var resultHash = crypto_1.default.createHash('sha256');
106
- var input = fs_extra_1.default.createReadStream(filePath);
107
+ var input = (0, fs_1.createReadStream)(filePath);
107
108
  input.on('error', function (e) {
108
109
  reject(e);
109
110
  });
@@ -126,14 +127,14 @@ function plusx(file) {
126
127
  var s, newMode, base8;
127
128
  return __generator(this, function (_a) {
128
129
  switch (_a.label) {
129
- case 0: return [4 /*yield*/, fs_extra_1.default.stat(file)];
130
+ case 0: return [4 /*yield*/, (0, promises_1.stat)(file)];
130
131
  case 1:
131
132
  s = _a.sent();
132
133
  newMode = s.mode | 64 | 8 | 1;
133
134
  if (s.mode === newMode)
134
135
  return [2 /*return*/];
135
136
  base8 = newMode.toString(8).slice(-3);
136
- return [4 /*yield*/, fs_extra_1.default.chmod(file, base8)];
137
+ return [4 /*yield*/, (0, promises_1.chmod)(file, base8)];
137
138
  case 2:
138
139
  _a.sent();
139
140
  return [2 /*return*/];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yao-pkg/pkg-fetch",
3
- "version": "3.5.14",
3
+ "version": "3.5.16",
4
4
  "description": "Compiles and stores base binaries for pkg",
5
5
  "main": "lib-es5/index.js",
6
6
  "license": "MIT",
@@ -18,10 +18,9 @@
18
18
  "patches/*"
19
19
  ],
20
20
  "dependencies": {
21
- "chalk": "^4.1.2",
22
- "fs-extra": "^9.1.0",
23
21
  "https-proxy-agent": "^5.0.0",
24
22
  "node-fetch": "^2.6.6",
23
+ "picocolors": "^1.1.0",
25
24
  "progress": "^2.0.3",
26
25
  "semver": "^7.3.5",
27
26
  "tar-fs": "^2.1.1",
@@ -29,8 +28,7 @@
29
28
  },
30
29
  "devDependencies": {
31
30
  "@release-it/conventional-changelog": "^7.0.2",
32
- "@types/fs-extra": "^9.0.13",
33
- "@types/node": "^14.17.32",
31
+ "@types/node": "^16.18.113",
34
32
  "@types/node-fetch": "^2.5.12",
35
33
  "@types/progress": "^2.0.5",
36
34
  "@types/semver": "^7.3.9",
@@ -1,16 +1,58 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index 7c0b4a0851..064e453130 100644
2
+ index 1ece4f5e49..5107053bec 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
5
  @@ -184,7 +184,7 @@
6
- 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
7
- }],
8
- ['llvm_version=="0.0"', {
6
+ ['clang==1', {
7
+ 'lto': ' -flto ', # Clang
8
+ }, {
9
9
  - 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ', # GCC
10
10
  + 'lto': ' -flto=4 -ffat-lto-objects ', # GCC
11
- }, {
12
- 'lto': ' -flto ', # Clang
13
11
  }],
12
+ ],
13
+ },
14
+ diff --git node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
15
+ index 5e7775f1a5..eeebf67796 100644
16
+ --- node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
17
+ +++ node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
18
+ @@ -33,16 +33,6 @@
19
+
20
+ #include "nghttp3_macro.h"
21
+
22
+ -#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64))
23
+ -unsigned int __popcnt(unsigned int x) {
24
+ - unsigned int c = 0;
25
+ - for (; x; ++c) {
26
+ - x &= x - 1;
27
+ - }
28
+ - return c;
29
+ -}
30
+ -#endif
31
+ -
32
+ int nghttp3_ringbuf_init(nghttp3_ringbuf *rb, size_t nmemb, size_t size,
33
+ const nghttp3_mem *mem) {
34
+ if (nmemb) {
35
+ diff --git node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
36
+ index 74e488bce7..36ca05e80e 100644
37
+ --- node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
38
+ +++ node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
39
+ @@ -31,16 +31,6 @@
40
+
41
+ #include "ngtcp2_macro.h"
42
+
43
+ -#if defined(_MSC_VER) && !defined(__clang__) && (defined(_M_ARM) || defined(_M_ARM64))
44
+ -unsigned int __popcnt(unsigned int x) {
45
+ - unsigned int c = 0;
46
+ - for (; x; ++c) {
47
+ - x &= x - 1;
48
+ - }
49
+ - return c;
50
+ -}
51
+ -#endif
52
+ -
53
+ int ngtcp2_ringbuf_init(ngtcp2_ringbuf *rb, size_t nmemb, size_t size,
54
+ const ngtcp2_mem *mem) {
55
+ uint8_t *buf = ngtcp2_mem_malloc(mem, nmemb * size);
14
56
  diff --git node/deps/v8/include/v8-initialization.h node/deps/v8/include/v8-initialization.h
15
57
  index d3e35d6ec5..6e9bbe3849 100644
16
58
  --- node/deps/v8/include/v8-initialization.h
@@ -246,7 +288,7 @@ index 88c079d10d..a7eaca0574 100644
246
288
  const permission = require('internal/process/permission');
247
289
  const { kEmptyObject } = require('internal/util');
248
290
  diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
249
- index 59308ab817..35583f830a 100644
291
+ index ea7afd52fa..ea70fecf5d 100644
250
292
  --- node/lib/internal/process/pre_execution.js
251
293
  +++ node/lib/internal/process/pre_execution.js
252
294
  @@ -51,7 +51,11 @@ const {
@@ -261,7 +303,7 @@ index 59308ab817..35583f830a 100644
261
303
  return prepareExecution({
262
304
  expandArgv1,
263
305
  initializeModules,
264
- @@ -243,7 +247,8 @@ function patchProcessObject(expandArgv1) {
306
+ @@ -245,7 +249,8 @@ function patchProcessObject(expandArgv1) {
265
307
  // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
266
308
  // the entry point.
267
309
  if (expandArgv1 && process.argv[1] &&
@@ -271,7 +313,7 @@ index 59308ab817..35583f830a 100644
271
313
  // Expand process.argv[1] into a full path.
272
314
  const path = require('path');
273
315
  try {
274
- @@ -722,6 +727,7 @@ function loadPreloadModules() {
316
+ @@ -741,6 +746,7 @@ function loadPreloadModules() {
275
317
  // For user code, we preload modules if `-r` is passed
276
318
  const preloadModules = getOptionValue('--require');
277
319
  if (preloadModules && preloadModules.length > 0) {
@@ -280,10 +322,10 @@ index 59308ab817..35583f830a 100644
280
322
  Module: {
281
323
  _preloadModules,
282
324
  diff --git node/lib/vm.js node/lib/vm.js
283
- index 34814c430d..db1f4779b6 100644
325
+ index cb64404ef0..71209f89d3 100644
284
326
  --- node/lib/vm.js
285
327
  +++ node/lib/vm.js
286
- @@ -97,6 +97,7 @@ class Script extends ContextifyScript {
328
+ @@ -98,6 +98,7 @@ class Script extends ContextifyScript {
287
329
  produceCachedData = false,
288
330
  importModuleDynamically,
289
331
  [kParsingContext]: parsingContext,
@@ -291,7 +333,7 @@ index 34814c430d..db1f4779b6 100644
291
333
  } = options;
292
334
 
293
335
  validateString(filename, 'options.filename');
294
- @@ -120,7 +121,8 @@ class Script extends ContextifyScript {
336
+ @@ -121,7 +122,8 @@ class Script extends ContextifyScript {
295
337
  cachedData,
296
338
  produceCachedData,
297
339
  parsingContext,
@@ -302,10 +344,10 @@ index 34814c430d..db1f4779b6 100644
302
344
  throw e; /* node-do-not-add-exception-line */
303
345
  }
304
346
  diff --git node/src/inspector_agent.cc node/src/inspector_agent.cc
305
- index 4cab7dea04..a1f0d51ab5 100644
347
+ index bb39a0cb42..5fa6cb65cc 100644
306
348
  --- node/src/inspector_agent.cc
307
349
  +++ node/src/inspector_agent.cc
308
- @@ -738,11 +738,6 @@ bool Agent::Start(const std::string& path,
350
+ @@ -766,11 +766,6 @@ bool Agent::Start(const std::string& path,
309
351
  StartIoThreadAsyncCallback));
310
352
  uv_unref(reinterpret_cast<uv_handle_t*>(&start_io_thread_async));
311
353
  start_io_thread_async.data = this;
@@ -346,7 +388,7 @@ index 9f6f8e53ab..ee8fa43f2f 100644
346
388
  }
347
389
 
348
390
  diff --git node/src/node_contextify.cc node/src/node_contextify.cc
349
- index d873792ab9..588e53377d 100644
391
+ index 8951cd378a..746fb9939a 100644
350
392
  --- node/src/node_contextify.cc
351
393
  +++ node/src/node_contextify.cc
352
394
  @@ -76,6 +76,7 @@ using v8::String;
@@ -357,7 +399,7 @@ index d873792ab9..588e53377d 100644
357
399
  using v8::Value;
358
400
  using v8::WeakCallbackInfo;
359
401
 
360
- @@ -789,13 +790,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
402
+ @@ -816,13 +817,14 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
361
403
  Local<ArrayBufferView> cached_data_buf;
362
404
  bool produce_cached_data = false;
363
405
  Local<Context> parsing_context = context;
@@ -374,7 +416,7 @@ index d873792ab9..588e53377d 100644
374
416
  CHECK(args[2]->IsNumber());
375
417
  line_offset = args[2].As<Int32>()->Value();
376
418
  CHECK(args[3]->IsNumber());
377
- @@ -816,6 +818,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
419
+ @@ -843,6 +845,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
378
420
  }
379
421
  CHECK(args[7]->IsSymbol());
380
422
  id_symbol = args[7].As<Symbol>();
@@ -385,7 +427,7 @@ index d873792ab9..588e53377d 100644
385
427
  }
386
428
 
387
429
  ContextifyScript* contextify_script =
388
- @@ -864,6 +870,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
430
+ @@ -891,6 +897,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
389
431
  ShouldNotAbortOnUncaughtScope no_abort_scope(env);
390
432
  Context::Scope scope(parsing_context);
391
433
 
@@ -396,7 +438,7 @@ index d873792ab9..588e53377d 100644
396
438
  MaybeLocal<UnboundScript> maybe_v8_script =
397
439
  ScriptCompiler::CompileUnboundScript(isolate, &source, compile_options);
398
440
 
399
- @@ -878,6 +888,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
441
+ @@ -905,6 +915,11 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
400
442
  return;
401
443
  }
402
444
 
@@ -408,7 +450,7 @@ index d873792ab9..588e53377d 100644
408
450
  contextify_script->script_.Reset(isolate, v8_script);
409
451
  contextify_script->script_.SetWeak();
410
452
  contextify_script->object()->SetInternalFieldForNodeCore(kUnboundScriptSlot,
411
- @@ -911,6 +926,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
453
+ @@ -938,6 +953,10 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
412
454
  .IsNothing())
413
455
  return;
414
456
 
@@ -530,7 +572,7 @@ index f66099a557..4048f6bd93 100644
530
572
  + return adjacent(c, nargv);
531
573
  +}
532
574
  diff --git node/src/node_options.cc node/src/node_options.cc
533
- index e94e4dbc95..097ba01185 100644
575
+ index dba59c5560..cb661fc7c4 100644
534
576
  --- node/src/node_options.cc
535
577
  +++ node/src/node_options.cc
536
578
  @@ -307,6 +307,7 @@ void Parse(
@@ -1,5 +1,5 @@
1
1
  diff --git node/common.gypi node/common.gypi
2
- index a97e77860e..09444e795f 100644
2
+ index de83a56672..840333d8eb 100644
3
3
  --- node/common.gypi
4
4
  +++ node/common.gypi
5
5
  @@ -187,7 +187,7 @@
@@ -12,14 +12,14 @@ index a97e77860e..09444e795f 100644
12
12
  ],
13
13
  },
14
14
  diff --git node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
15
- index 61a7d06cad..eeebf67796 100644
15
+ index 38b5460837..eeebf67796 100644
16
16
  --- node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
17
17
  +++ node/deps/ngtcp2/nghttp3/lib/nghttp3_ringbuf.c
18
18
  @@ -33,17 +33,6 @@
19
19
 
20
20
  #include "nghttp3_macro.h"
21
21
 
22
- -#if defined(_MSC_VER) && !defined(__clang__) && \
22
+ -#if defined(_MSC_VER) && _MSC_VER < 1941 && !defined(__clang__) && \
23
23
  - (defined(_M_ARM) || defined(_M_ARM64))
24
24
  -unsigned int __popcnt(unsigned int x) {
25
25
  - unsigned int c = 0;
@@ -34,14 +34,14 @@ index 61a7d06cad..eeebf67796 100644
34
34
  const nghttp3_mem *mem) {
35
35
  if (nmemb) {
36
36
  diff --git node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
37
- index c381c23127..6894bc2308 100644
37
+ index ecfdeb63b3..6894bc2308 100644
38
38
  --- node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
39
39
  +++ node/deps/ngtcp2/ngtcp2/lib/ngtcp2_ringbuf.c
40
40
  @@ -31,17 +31,6 @@
41
41
 
42
42
  #include "ngtcp2_macro.h"
43
43
 
44
- -#if defined(_MSC_VER) && !defined(__clang__) && \
44
+ -#if defined(_MSC_VER) && _MSC_VER < 1941 && !defined(__clang__) && \
45
45
  - (defined(_M_ARM) || defined(_M_ARM64))
46
46
  -static unsigned int __popcnt(unsigned int x) {
47
47
  - unsigned int c = 0;
@@ -259,7 +259,7 @@ index ec69ad5123..1894032344 100644
259
259
  GetHeaderValue(kReadOnlySnapshotChecksumOffset);
260
260
  if (ro_snapshot_checksum != expected_ro_snapshot_checksum) {
261
261
  diff --git node/lib/child_process.js node/lib/child_process.js
262
- index 580a441a80..bef63ab3e9 100644
262
+ index 51fc6fe995..ed019a4645 100644
263
263
  --- node/lib/child_process.js
264
264
  +++ node/lib/child_process.js
265
265
  @@ -168,7 +168,7 @@ function fork(modulePath, args = [], options) {
@@ -327,10 +327,10 @@ index 0000000000..a697294fdf
327
327
  + }());
328
328
  +}());
329
329
  diff --git node/lib/internal/modules/cjs/loader.js node/lib/internal/modules/cjs/loader.js
330
- index 451b7c2195..7733dfb3d6 100644
330
+ index b0210e4d96..fb1e265a1f 100644
331
331
  --- node/lib/internal/modules/cjs/loader.js
332
332
  +++ node/lib/internal/modules/cjs/loader.js
333
- @@ -229,12 +229,16 @@ function wrapModuleLoad(request, parent, isMain) {
333
+ @@ -230,12 +230,16 @@ function wrapModuleLoad(request, parent, isMain) {
334
334
  * @param {string} filename Absolute path to the file
335
335
  */
336
336
  function stat(filename) {
@@ -340,13 +340,13 @@ index 451b7c2195..7733dfb3d6 100644
340
340
  const result = statCache.get(filename);
341
341
  if (result !== undefined) { return result; }
342
342
  }
343
- - const result = internalFsBinding.internalModuleStat(filename);
343
+ - const result = internalFsBinding.internalModuleStat(internalFsBinding, filename);
344
344
  + const fs = require('fs');
345
345
  + const result = fs.existsSync(origFilename) ?
346
346
  + (fs.statSync(origFilename).isDirectory() ? 1 : 0) : -1;
347
347
  +
348
348
  if (statCache !== null && result >= 0) {
349
- // Only set cache when `internalModuleStat(filename)` succeeds.
349
+ // Only set cache when `internalModuleStat(internalFsBinding, filename)` succeeds.
350
350
  statCache.set(filename, result);
351
351
  diff --git node/lib/internal/modules/package_json_reader.js node/lib/internal/modules/package_json_reader.js
352
352
  index 9a9dcebb79..9f00ec6a85 100644
@@ -381,11 +381,11 @@ index 9a9dcebb79..9f00ec6a85 100644
381
381
 
382
382
  /**
383
383
  diff --git node/lib/internal/process/pre_execution.js node/lib/internal/process/pre_execution.js
384
- index cb96fd1bc4..e6c5b11c0a 100644
384
+ index 848ff7f142..9f8e125329 100644
385
385
  --- node/lib/internal/process/pre_execution.js
386
386
  +++ node/lib/internal/process/pre_execution.js
387
- @@ -49,7 +49,11 @@ const {
388
- },
387
+ @@ -51,7 +51,11 @@ const {
388
+ runDeserializeCallbacks,
389
389
  } = require('internal/v8/startup_snapshot');
390
390
 
391
391
  +let _alreadyPrepared = false;
@@ -396,7 +396,7 @@ index cb96fd1bc4..e6c5b11c0a 100644
396
396
  return prepareExecution({
397
397
  expandArgv1,
398
398
  initializeModules,
399
- @@ -241,7 +245,8 @@ function patchProcessObject(expandArgv1) {
399
+ @@ -243,7 +247,8 @@ function patchProcessObject(expandArgv1) {
400
400
  // If requested, update process.argv[1] to replace whatever the user provided with the resolved absolute file path of
401
401
  // the entry point.
402
402
  if (expandArgv1 && process.argv[1] &&
@@ -406,7 +406,7 @@ index cb96fd1bc4..e6c5b11c0a 100644
406
406
  // Expand process.argv[1] into a full path.
407
407
  const path = require('path');
408
408
  try {
409
- @@ -722,6 +727,7 @@ function loadPreloadModules() {
409
+ @@ -721,6 +726,7 @@ function loadPreloadModules() {
410
410
  // For user code, we preload modules if `-r` is passed
411
411
  const preloadModules = getOptionValue('--require');
412
412
  if (preloadModules && preloadModules.length > 0) {
@@ -453,7 +453,7 @@ index bb39a0cb42..5fa6cb65cc 100644
453
453
  parent_env_->AddCleanupHook([](void* data) {
454
454
  Environment* env = static_cast<Environment*>(data);
455
455
  diff --git node/src/node.cc node/src/node.cc
456
- index ccc1085a84..882ab5f0c9 100644
456
+ index 1a2a43bdd3..76fd756438 100644
457
457
  --- node/src/node.cc
458
458
  +++ node/src/node.cc
459
459
  @@ -394,6 +394,8 @@ MaybeLocal<Value> StartExecution(Environment* env, StartExecutionCallback cb) {
@@ -481,7 +481,7 @@ index ccc1085a84..882ab5f0c9 100644
481
481
  }
482
482
 
483
483
  diff --git node/src/node_contextify.cc node/src/node_contextify.cc
484
- index fc137486f5..81388a8812 100644
484
+ index 5f4529262a..4ecfaf0513 100644
485
485
  --- node/src/node_contextify.cc
486
486
  +++ node/src/node_contextify.cc
487
487
  @@ -85,6 +85,7 @@ using v8::Symbol;
@@ -666,7 +666,7 @@ index f66099a557..4048f6bd93 100644
666
666
  + return adjacent(c, nargv);
667
667
  +}
668
668
  diff --git node/src/node_options.cc node/src/node_options.cc
669
- index cfc599ec9a..f4c7a56850 100644
669
+ index d3b59690e9..23b52a6e00 100644
670
670
  --- node/src/node_options.cc
671
671
  +++ node/src/node_options.cc
672
672
  @@ -307,6 +307,7 @@ void Parse(
@@ -1,6 +1,6 @@
1
1
  {
2
- "v22.9.0": ["node.v22.9.0.cpp.patch"],
3
- "v20.17.0": ["node.v20.17.0.cpp.patch"],
2
+ "v22.10.0": ["node.v22.10.0.cpp.patch"],
3
+ "v20.18.0": ["node.v20.18.0.cpp.patch"],
4
4
  "v18.20.4": ["node.v18.20.4.cpp.patch"],
5
5
  "v16.20.2": ["node.v16.20.2.cpp.patch"],
6
6
  "v14.21.3": ["node.v14.21.3.cpp.patch"],