@nightintelligence/cloudflare-workers-utils 0.35.0-patch1 → 0.35.0-patch2
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/dist/index.mjs +2 -158
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -25,6 +25,7 @@ import chalk from 'chalk';
|
|
|
25
25
|
import { execFileSync, spawn } from 'node:child_process';
|
|
26
26
|
import { createHash, randomBytes } from 'node:crypto';
|
|
27
27
|
import { arch } from 'node:os';
|
|
28
|
+
import { sync } from 'command-exists';
|
|
28
29
|
import { fetch, Headers, FormData, Response } from 'undici';
|
|
29
30
|
import { URLSearchParams } from 'node:url';
|
|
30
31
|
import * as timersPromises from 'node:timers/promises';
|
|
@@ -482,160 +483,6 @@ var require_ci_info = __commonJS({
|
|
|
482
483
|
}
|
|
483
484
|
});
|
|
484
485
|
|
|
485
|
-
// ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js
|
|
486
|
-
var require_command_exists = __commonJS({
|
|
487
|
-
"../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/lib/command-exists.js"(exports$1, module) {
|
|
488
|
-
var exec = __require("child_process").exec;
|
|
489
|
-
var execSync = __require("child_process").execSync;
|
|
490
|
-
var fs3 = __require("fs");
|
|
491
|
-
var path5 = __require("path");
|
|
492
|
-
var access = fs3.access;
|
|
493
|
-
var accessSync2 = fs3.accessSync;
|
|
494
|
-
var constants2 = fs3.constants || fs3;
|
|
495
|
-
var isUsingWindows = process.platform == "win32";
|
|
496
|
-
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
497
|
-
access(
|
|
498
|
-
commandName,
|
|
499
|
-
constants2.F_OK,
|
|
500
|
-
function(err) {
|
|
501
|
-
callback(!err);
|
|
502
|
-
}
|
|
503
|
-
);
|
|
504
|
-
}, "fileNotExists");
|
|
505
|
-
var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
|
|
506
|
-
try {
|
|
507
|
-
accessSync2(commandName, constants2.F_OK);
|
|
508
|
-
return false;
|
|
509
|
-
} catch (e2) {
|
|
510
|
-
return true;
|
|
511
|
-
}
|
|
512
|
-
}, "fileNotExistsSync");
|
|
513
|
-
var localExecutable = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
514
|
-
access(
|
|
515
|
-
commandName,
|
|
516
|
-
constants2.F_OK | constants2.X_OK,
|
|
517
|
-
function(err) {
|
|
518
|
-
callback(null, !err);
|
|
519
|
-
}
|
|
520
|
-
);
|
|
521
|
-
}, "localExecutable");
|
|
522
|
-
var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
|
|
523
|
-
try {
|
|
524
|
-
accessSync2(commandName, constants2.F_OK | constants2.X_OK);
|
|
525
|
-
return true;
|
|
526
|
-
} catch (e2) {
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
}, "localExecutableSync");
|
|
530
|
-
var commandExistsUnix = /* @__PURE__ */ __name(function(commandName, cleanedCommandName, callback) {
|
|
531
|
-
fileNotExists(commandName, function(isFile) {
|
|
532
|
-
if (!isFile) {
|
|
533
|
-
exec(
|
|
534
|
-
"command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }",
|
|
535
|
-
function(error51, stdout, stderr) {
|
|
536
|
-
callback(null, !!stdout);
|
|
537
|
-
}
|
|
538
|
-
);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
localExecutable(commandName, callback);
|
|
542
|
-
});
|
|
543
|
-
}, "commandExistsUnix");
|
|
544
|
-
var commandExistsWindows = /* @__PURE__ */ __name(function(commandName, cleanedCommandName, callback) {
|
|
545
|
-
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) {
|
|
546
|
-
callback(null, false);
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
exec(
|
|
550
|
-
"where " + cleanedCommandName,
|
|
551
|
-
function(error51) {
|
|
552
|
-
if (error51 !== null) {
|
|
553
|
-
callback(null, false);
|
|
554
|
-
} else {
|
|
555
|
-
callback(null, true);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
}, "commandExistsWindows");
|
|
560
|
-
var commandExistsUnixSync = /* @__PURE__ */ __name(function(commandName, cleanedCommandName) {
|
|
561
|
-
if (fileNotExistsSync(commandName)) {
|
|
562
|
-
try {
|
|
563
|
-
var stdout = execSync(
|
|
564
|
-
"command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }"
|
|
565
|
-
);
|
|
566
|
-
return !!stdout;
|
|
567
|
-
} catch (error51) {
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
return localExecutableSync(commandName);
|
|
572
|
-
}, "commandExistsUnixSync");
|
|
573
|
-
var commandExistsWindowsSync = /* @__PURE__ */ __name(function(commandName, cleanedCommandName, callback) {
|
|
574
|
-
if (!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName)) {
|
|
575
|
-
return false;
|
|
576
|
-
}
|
|
577
|
-
try {
|
|
578
|
-
var stdout = execSync("where " + cleanedCommandName, { stdio: [] });
|
|
579
|
-
return !!stdout;
|
|
580
|
-
} catch (error51) {
|
|
581
|
-
return false;
|
|
582
|
-
}
|
|
583
|
-
}, "commandExistsWindowsSync");
|
|
584
|
-
var cleanInput = /* @__PURE__ */ __name(function(s) {
|
|
585
|
-
if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
|
|
586
|
-
s = "'" + s.replace(/'/g, "'\\''") + "'";
|
|
587
|
-
s = s.replace(/^(?:'')+/g, "").replace(/\\'''/g, "\\'");
|
|
588
|
-
}
|
|
589
|
-
return s;
|
|
590
|
-
}, "cleanInput");
|
|
591
|
-
if (isUsingWindows) {
|
|
592
|
-
cleanInput = /* @__PURE__ */ __name(function(s) {
|
|
593
|
-
var isPathName = /[\\]/.test(s);
|
|
594
|
-
if (isPathName) {
|
|
595
|
-
var dirname4 = '"' + path5.dirname(s) + '"';
|
|
596
|
-
var basename2 = '"' + path5.basename(s) + '"';
|
|
597
|
-
return dirname4 + ":" + basename2;
|
|
598
|
-
}
|
|
599
|
-
return '"' + s + '"';
|
|
600
|
-
}, "cleanInput");
|
|
601
|
-
}
|
|
602
|
-
module.exports = /* @__PURE__ */ __name(function commandExists(commandName, callback) {
|
|
603
|
-
var cleanedCommandName = cleanInput(commandName);
|
|
604
|
-
if (!callback && typeof Promise !== "undefined") {
|
|
605
|
-
return new Promise(function(resolve3, reject) {
|
|
606
|
-
commandExists(commandName, function(error51, output) {
|
|
607
|
-
if (output) {
|
|
608
|
-
resolve3(commandName);
|
|
609
|
-
} else {
|
|
610
|
-
reject(error51);
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
if (isUsingWindows) {
|
|
616
|
-
commandExistsWindows(commandName, cleanedCommandName, callback);
|
|
617
|
-
} else {
|
|
618
|
-
commandExistsUnix(commandName, cleanedCommandName, callback);
|
|
619
|
-
}
|
|
620
|
-
}, "commandExists");
|
|
621
|
-
module.exports.sync = function(commandName) {
|
|
622
|
-
var cleanedCommandName = cleanInput(commandName);
|
|
623
|
-
if (isUsingWindows) {
|
|
624
|
-
return commandExistsWindowsSync(commandName, cleanedCommandName);
|
|
625
|
-
} else {
|
|
626
|
-
return commandExistsUnixSync(commandName, cleanedCommandName);
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
// ../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js
|
|
633
|
-
var require_command_exists2 = __commonJS({
|
|
634
|
-
"../../node_modules/.pnpm/command-exists@1.2.9/node_modules/command-exists/index.js"(exports$1, module) {
|
|
635
|
-
module.exports = require_command_exists();
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
|
|
639
486
|
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
|
|
640
487
|
var require_ini = __commonJS({
|
|
641
488
|
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports$1) {
|
|
@@ -24782,9 +24629,6 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
|
|
24782
24629
|
};
|
|
24783
24630
|
}
|
|
24784
24631
|
__name(getWranglerTmpDir, "getWranglerTmpDir");
|
|
24785
|
-
|
|
24786
|
-
// src/cloudflared.ts
|
|
24787
|
-
var import_command_exists = __toESM(require_command_exists2());
|
|
24788
24632
|
var UPDATE_SERVICE_URL = "https://update.argotunnel.com";
|
|
24789
24633
|
var CLOUDFLARED_VERSION_PATTERN = /^\d{4}\.\d+\.\d+$/;
|
|
24790
24634
|
function sha256Hex(buffer) {
|
|
@@ -25007,7 +24851,7 @@ function redactCloudflaredArgsForLogging(args) {
|
|
|
25007
24851
|
__name(redactCloudflaredArgsForLogging, "redactCloudflaredArgsForLogging");
|
|
25008
24852
|
function tryGetCloudflaredFromPath(options) {
|
|
25009
24853
|
const { logger } = options ?? {};
|
|
25010
|
-
if (!
|
|
24854
|
+
if (!sync("cloudflared")) {
|
|
25011
24855
|
return null;
|
|
25012
24856
|
}
|
|
25013
24857
|
try {
|