@vercel/static-build 1.0.38 → 1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +138 -3
  2. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -187104,6 +187104,132 @@ module.exports = function(num) {
187104
187104
  };
187105
187105
 
187106
187106
 
187107
+ /***/ }),
187108
+
187109
+ /***/ 3255:
187110
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
187111
+
187112
+ "use strict";
187113
+
187114
+
187115
+ var childProcess = __webpack_require__(3129);
187116
+ var spawn = childProcess.spawn;
187117
+ var exec = childProcess.exec;
187118
+
187119
+ module.exports = function (pid, signal, callback) {
187120
+ if (typeof signal === 'function' && callback === undefined) {
187121
+ callback = signal;
187122
+ signal = undefined;
187123
+ }
187124
+
187125
+ pid = parseInt(pid);
187126
+ if (Number.isNaN(pid)) {
187127
+ if (callback) {
187128
+ return callback(new Error("pid must be a number"));
187129
+ } else {
187130
+ throw new Error("pid must be a number");
187131
+ }
187132
+ }
187133
+
187134
+ var tree = {};
187135
+ var pidsToProcess = {};
187136
+ tree[pid] = [];
187137
+ pidsToProcess[pid] = 1;
187138
+
187139
+ switch (process.platform) {
187140
+ case 'win32':
187141
+ exec('taskkill /pid ' + pid + ' /T /F', callback);
187142
+ break;
187143
+ case 'darwin':
187144
+ buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
187145
+ return spawn('pgrep', ['-P', parentPid]);
187146
+ }, function () {
187147
+ killAll(tree, signal, callback);
187148
+ });
187149
+ break;
187150
+ // case 'sunos':
187151
+ // buildProcessTreeSunOS(pid, tree, pidsToProcess, function () {
187152
+ // killAll(tree, signal, callback);
187153
+ // });
187154
+ // break;
187155
+ default: // Linux
187156
+ buildProcessTree(pid, tree, pidsToProcess, function (parentPid) {
187157
+ return spawn('ps', ['-o', 'pid', '--no-headers', '--ppid', parentPid]);
187158
+ }, function () {
187159
+ killAll(tree, signal, callback);
187160
+ });
187161
+ break;
187162
+ }
187163
+ };
187164
+
187165
+ function killAll (tree, signal, callback) {
187166
+ var killed = {};
187167
+ try {
187168
+ Object.keys(tree).forEach(function (pid) {
187169
+ tree[pid].forEach(function (pidpid) {
187170
+ if (!killed[pidpid]) {
187171
+ killPid(pidpid, signal);
187172
+ killed[pidpid] = 1;
187173
+ }
187174
+ });
187175
+ if (!killed[pid]) {
187176
+ killPid(pid, signal);
187177
+ killed[pid] = 1;
187178
+ }
187179
+ });
187180
+ } catch (err) {
187181
+ if (callback) {
187182
+ return callback(err);
187183
+ } else {
187184
+ throw err;
187185
+ }
187186
+ }
187187
+ if (callback) {
187188
+ return callback();
187189
+ }
187190
+ }
187191
+
187192
+ function killPid(pid, signal) {
187193
+ try {
187194
+ process.kill(parseInt(pid, 10), signal);
187195
+ }
187196
+ catch (err) {
187197
+ if (err.code !== 'ESRCH') throw err;
187198
+ }
187199
+ }
187200
+
187201
+ function buildProcessTree (parentPid, tree, pidsToProcess, spawnChildProcessesList, cb) {
187202
+ var ps = spawnChildProcessesList(parentPid);
187203
+ var allData = '';
187204
+ ps.stdout.on('data', function (data) {
187205
+ var data = data.toString('ascii');
187206
+ allData += data;
187207
+ });
187208
+
187209
+ var onClose = function (code) {
187210
+ delete pidsToProcess[parentPid];
187211
+
187212
+ if (code != 0) {
187213
+ // no more parent processes
187214
+ if (Object.keys(pidsToProcess).length == 0) {
187215
+ cb();
187216
+ }
187217
+ return;
187218
+ }
187219
+
187220
+ allData.match(/\d+/g).forEach(function (pid) {
187221
+ pid = parseInt(pid, 10);
187222
+ tree[parentPid].push(pid);
187223
+ tree[pid] = [];
187224
+ pidsToProcess[pid] = 1;
187225
+ buildProcessTree(pid, tree, pidsToProcess, spawnChildProcessesList, cb);
187226
+ });
187227
+ };
187228
+
187229
+ ps.on('close', onClose);
187230
+ }
187231
+
187232
+
187107
187233
  /***/ }),
187108
187234
 
187109
187235
  /***/ 4490:
@@ -224025,6 +224151,7 @@ const BuildOutputV2 = __importStar(__webpack_require__(5154));
224025
224151
  const BuildOutputV3 = __importStar(__webpack_require__(8939));
224026
224152
  const GatsbyUtils = __importStar(__webpack_require__(8573));
224027
224153
  const NuxtUtils = __importStar(__webpack_require__(431));
224154
+ const tree_kill_1 = __importDefault(__webpack_require__(3255));
224028
224155
  const sleep = (n) => new Promise(resolve => setTimeout(resolve, n));
224029
224156
  const DEV_SERVER_PORT_BIND_TIMEOUT = ms_1.default('5m');
224030
224157
  async function checkForPort(port, timeout) {
@@ -224117,10 +224244,10 @@ exports.version = 2;
224117
224244
  const nowDevScriptPorts = new Map();
224118
224245
  const nowDevChildProcesses = new Set();
224119
224246
  ['SIGINT', 'SIGTERM'].forEach(signal => {
224120
- process.once(signal, () => {
224247
+ process.once(signal, async () => {
224121
224248
  for (const child of nowDevChildProcesses) {
224122
224249
  build_utils_1.debug(`Got ${signal}, killing dev server child process (pid=${child.pid})`);
224123
- process.kill(child.pid, signal);
224250
+ await new Promise(resolve => tree_kill_1.default(child.pid, signal, resolve));
224124
224251
  }
224125
224252
  process.exit(0);
224126
224253
  });
@@ -224418,7 +224545,7 @@ const build = async ({ files, entrypoint, workPath, config, meta = {}, }) => {
224418
224545
  };
224419
224546
  const cmd = devCommand || `yarn run ${devScript}`;
224420
224547
  const child = build_utils_1.spawnCommand(cmd, opts);
224421
- child.on('exit', () => nowDevScriptPorts.delete(entrypoint));
224548
+ child.on('close', () => nowDevScriptPorts.delete(entrypoint));
224422
224549
  nowDevChildProcesses.add(child);
224423
224550
  // Wait for the server to have listened on `$PORT`, after which we
224424
224551
  // will ProxyPass any requests to that development server that come in
@@ -225345,6 +225472,14 @@ module.exports = require("buffer");
225345
225472
 
225346
225473
  /***/ }),
225347
225474
 
225475
+ /***/ 3129:
225476
+ /***/ ((module) => {
225477
+
225478
+ "use strict";
225479
+ module.exports = require("child_process");
225480
+
225481
+ /***/ }),
225482
+
225348
225483
  /***/ 7619:
225349
225484
  /***/ ((module) => {
225350
225485
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/static-build",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/build-step",
@@ -36,7 +36,7 @@
36
36
  "@types/ms": "0.7.31",
37
37
  "@types/node-fetch": "2.5.4",
38
38
  "@types/promise-timeout": "1.3.0",
39
- "@vercel/build-utils": "5.5.8",
39
+ "@vercel/build-utils": "5.5.9",
40
40
  "@vercel/frameworks": "1.1.12",
41
41
  "@vercel/ncc": "0.24.0",
42
42
  "@vercel/routing-utils": "2.1.3",
@@ -47,7 +47,8 @@
47
47
  "ms": "2.1.2",
48
48
  "node-fetch": "2.6.7",
49
49
  "rc9": "1.2.0",
50
+ "tree-kill": "1.2.2",
50
51
  "typescript": "4.3.4"
51
52
  },
52
- "gitHead": "4159b498b93cc340ee483beb5dd1ef18dc762408"
53
+ "gitHead": "7003531d5db7895fc3b2fa940c2d83b6e75bbd9e"
53
54
  }