wrangler 4.27.0 → 4.28.0
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/package.json +8 -8
- package/wrangler-dist/cli.d.ts +1 -1
- package/wrangler-dist/cli.js +2000 -1721
- package/wrangler-dist/metafile-cjs.json +1 -1
package/wrangler-dist/cli.js
CHANGED
@@ -26164,10 +26164,10 @@ function isDir(inputPath) {
|
|
26164
26164
|
const stats = (0, import_fs6.statSync)(inputPath);
|
26165
26165
|
return stats.isDirectory();
|
26166
26166
|
}
|
26167
|
-
|
26167
|
+
function getContainerIdsByImageTags(dockerPath, imageTags) {
|
26168
26168
|
const ids = /* @__PURE__ */ new Set();
|
26169
26169
|
for (const imageTag of imageTags) {
|
26170
|
-
const containerIdsFromImage =
|
26170
|
+
const containerIdsFromImage = getContainerIdsFromImage(
|
26171
26171
|
dockerPath,
|
26172
26172
|
imageTag
|
26173
26173
|
);
|
@@ -26328,27 +26328,20 @@ Other container tooling that is compatible with the Docker CLI and engine may wo
|
|
26328
26328
|
}
|
26329
26329
|
return false;
|
26330
26330
|
}, "isDockerfile");
|
26331
|
-
cleanupContainers = /* @__PURE__ */ __name(
|
26331
|
+
cleanupContainers = /* @__PURE__ */ __name((dockerPath, imageTags) => {
|
26332
26332
|
try {
|
26333
|
-
const containerIds =
|
26334
|
-
dockerPath,
|
26335
|
-
imageTags
|
26336
|
-
);
|
26333
|
+
const containerIds = getContainerIdsByImageTags(dockerPath, imageTags);
|
26337
26334
|
if (containerIds.length === 0) {
|
26338
26335
|
return true;
|
26339
26336
|
}
|
26340
|
-
|
26341
|
-
dockerPath,
|
26342
|
-
["rm", "--force", ...containerIds],
|
26343
|
-
["inherit", "pipe", "pipe"]
|
26344
|
-
);
|
26337
|
+
runDockerCmdWithOutput(dockerPath, ["rm", "--force", ...containerIds]);
|
26345
26338
|
return true;
|
26346
26339
|
} catch {
|
26347
26340
|
return false;
|
26348
26341
|
}
|
26349
26342
|
}, "cleanupContainers");
|
26350
26343
|
__name(getContainerIdsByImageTags, "getContainerIdsByImageTags");
|
26351
|
-
getContainerIdsFromImage = /* @__PURE__ */ __name(
|
26344
|
+
getContainerIdsFromImage = /* @__PURE__ */ __name((dockerPath, ancestorImage) => {
|
26352
26345
|
const output = runDockerCmdWithOutput(dockerPath, [
|
26353
26346
|
"ps",
|
26354
26347
|
"-a",
|
@@ -30835,7 +30828,7 @@ var require_supports_colors = __commonJS({
|
|
30835
30828
|
"../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module3) {
|
30836
30829
|
"use strict";
|
30837
30830
|
init_import_meta_url();
|
30838
|
-
var
|
30831
|
+
var os12 = require("os");
|
30839
30832
|
var hasFlag3 = require_has_flag();
|
30840
30833
|
var env6 = process.env;
|
30841
30834
|
var forceColor = void 0;
|
@@ -30874,7 +30867,7 @@ var require_supports_colors = __commonJS({
|
|
30874
30867
|
}
|
30875
30868
|
var min = forceColor ? 1 : 0;
|
30876
30869
|
if (process.platform === "win32") {
|
30877
|
-
var osRelease =
|
30870
|
+
var osRelease = os12.release().split(".");
|
30878
30871
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
30879
30872
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
30880
30873
|
}
|
@@ -32479,7 +32472,7 @@ var require_OSPaths = __commonJS({
|
|
32479
32472
|
}
|
32480
32473
|
__name(isEmpty, "isEmpty");
|
32481
32474
|
function Adapt(adapter_) {
|
32482
|
-
var env6 = adapter_.env,
|
32475
|
+
var env6 = adapter_.env, os12 = adapter_.os, path72 = adapter_.path;
|
32483
32476
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
32484
32477
|
function normalizePath2(path_) {
|
32485
32478
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
@@ -32487,11 +32480,11 @@ var require_OSPaths = __commonJS({
|
|
32487
32480
|
__name(normalizePath2, "normalizePath");
|
32488
32481
|
function home() {
|
32489
32482
|
var posix2 = /* @__PURE__ */ __name(function() {
|
32490
|
-
return normalizePath2((typeof
|
32483
|
+
return normalizePath2((typeof os12.homedir === "function" ? os12.homedir() : void 0) || env6.get("HOME"));
|
32491
32484
|
}, "posix");
|
32492
32485
|
var windows = /* @__PURE__ */ __name(function() {
|
32493
32486
|
var priorityList = [
|
32494
|
-
typeof
|
32487
|
+
typeof os12.homedir === "function" ? os12.homedir() : void 0,
|
32495
32488
|
env6.get("USERPROFILE"),
|
32496
32489
|
env6.get("HOME"),
|
32497
32490
|
env6.get("HOMEDRIVE") || env6.get("HOMEPATH") ? path72.join(env6.get("HOMEDRIVE") || "", env6.get("HOMEPATH") || "") : void 0
|
@@ -32511,7 +32504,7 @@ var require_OSPaths = __commonJS({
|
|
32511
32504
|
function posix2() {
|
32512
32505
|
var fallback = "/tmp";
|
32513
32506
|
var priorityList = [
|
32514
|
-
typeof
|
32507
|
+
typeof os12.tmpdir === "function" ? os12.tmpdir() : void 0,
|
32515
32508
|
env6.get("TMPDIR"),
|
32516
32509
|
env6.get("TEMP"),
|
32517
32510
|
env6.get("TMP")
|
@@ -32524,7 +32517,7 @@ var require_OSPaths = __commonJS({
|
|
32524
32517
|
function windows() {
|
32525
32518
|
var fallback = "C:\\Temp";
|
32526
32519
|
var priorityListLazy = [
|
32527
|
-
typeof
|
32520
|
+
typeof os12.tmpdir === "function" ? os12.tmpdir : function() {
|
32528
32521
|
return void 0;
|
32529
32522
|
},
|
32530
32523
|
function() {
|
@@ -32611,7 +32604,7 @@ var require_node = __commonJS({
|
|
32611
32604
|
};
|
32612
32605
|
exports2.__esModule = true;
|
32613
32606
|
exports2.adapter = void 0;
|
32614
|
-
var
|
32607
|
+
var os12 = __importStar(require("os"));
|
32615
32608
|
var path72 = __importStar(require("path"));
|
32616
32609
|
exports2.adapter = {
|
32617
32610
|
atImportPermissions: { env: true },
|
@@ -32620,7 +32613,7 @@ var require_node = __commonJS({
|
|
32620
32613
|
return process.env[s5];
|
32621
32614
|
}, "get")
|
32622
32615
|
},
|
32623
|
-
os:
|
32616
|
+
os: os12,
|
32624
32617
|
path: path72,
|
32625
32618
|
process
|
32626
32619
|
};
|
@@ -33483,8 +33476,12 @@ function readFileSyncToBuffer(file) {
|
|
33483
33476
|
}
|
33484
33477
|
function readFileSync6(file) {
|
33485
33478
|
try {
|
33486
|
-
|
33479
|
+
const buffer = fs2.readFileSync(file);
|
33480
|
+
return removeBOMAndValidate(buffer, file);
|
33487
33481
|
} catch (err) {
|
33482
|
+
if (err instanceof ParseError) {
|
33483
|
+
throw err;
|
33484
|
+
}
|
33488
33485
|
const { message } = err;
|
33489
33486
|
throw new ParseError({
|
33490
33487
|
text: `Could not read file: ${file}`,
|
@@ -33572,7 +33569,28 @@ function parseByteSize(s5, base = void 0) {
|
|
33572
33569
|
Number(size) * Math.pow(base ?? (binary ? 1024 : 1e3), pow)
|
33573
33570
|
);
|
33574
33571
|
}
|
33575
|
-
|
33572
|
+
function removeBOMAndValidate(buffer, file) {
|
33573
|
+
for (const bom of UNSUPPORTED_BOMS) {
|
33574
|
+
if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) {
|
33575
|
+
throw new ParseError({
|
33576
|
+
text: `Configuration file contains ${bom.encoding} byte order marker`,
|
33577
|
+
notes: [
|
33578
|
+
{
|
33579
|
+
text: `The file "${file}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`
|
33580
|
+
}
|
33581
|
+
],
|
33582
|
+
location: { file, line: 1, column: 0 },
|
33583
|
+
telemetryMessage: `${bom.encoding} BOM detected`
|
33584
|
+
});
|
33585
|
+
}
|
33586
|
+
}
|
33587
|
+
const content = buffer.toString("utf-8");
|
33588
|
+
if (content.charCodeAt(0) === 65279) {
|
33589
|
+
return content.slice(1);
|
33590
|
+
}
|
33591
|
+
return content;
|
33592
|
+
}
|
33593
|
+
var fs2, import_node_path4, import_toml, import_esbuild2, ParseError, APIError, TOML_ERROR_NAME, TOML_ERROR_SUFFIX, units, UNSUPPORTED_BOMS;
|
33576
33594
|
var init_parse = __esm({
|
33577
33595
|
"src/parse.ts"() {
|
33578
33596
|
init_import_meta_url();
|
@@ -33683,6 +33701,25 @@ var init_parse = __esm({
|
|
33683
33701
|
__name(parseHumanDuration, "parseHumanDuration");
|
33684
33702
|
__name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
|
33685
33703
|
__name(parseByteSize, "parseByteSize");
|
33704
|
+
UNSUPPORTED_BOMS = [
|
33705
|
+
{
|
33706
|
+
buffer: Buffer.from([0, 0, 254, 255]),
|
33707
|
+
encoding: "UTF-32 BE"
|
33708
|
+
},
|
33709
|
+
{
|
33710
|
+
buffer: Buffer.from([255, 254, 0, 0]),
|
33711
|
+
encoding: "UTF-32 LE"
|
33712
|
+
},
|
33713
|
+
{
|
33714
|
+
buffer: Buffer.from([254, 255]),
|
33715
|
+
encoding: "UTF-16 BE"
|
33716
|
+
},
|
33717
|
+
{
|
33718
|
+
buffer: Buffer.from([255, 254]),
|
33719
|
+
encoding: "UTF-16 LE"
|
33720
|
+
}
|
33721
|
+
];
|
33722
|
+
__name(removeBOMAndValidate, "removeBOMAndValidate");
|
33686
33723
|
}
|
33687
33724
|
});
|
33688
33725
|
|
@@ -33715,7 +33752,7 @@ var name, version;
|
|
33715
33752
|
var init_package = __esm({
|
33716
33753
|
"package.json"() {
|
33717
33754
|
name = "wrangler";
|
33718
|
-
version = "4.
|
33755
|
+
version = "4.28.0";
|
33719
33756
|
}
|
33720
33757
|
});
|
33721
33758
|
|
@@ -38419,8 +38456,67 @@ Please add a binding for each to "${fieldPath}.bindings":
|
|
38419
38456
|
]);
|
38420
38457
|
return isValid2;
|
38421
38458
|
}, "validateDurableObjectBinding");
|
38422
|
-
validateWorkflowBinding = /* @__PURE__ */ __name((
|
38423
|
-
|
38459
|
+
validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
38460
|
+
if (typeof value !== "object" || value === null) {
|
38461
|
+
diagnostics.errors.push(
|
38462
|
+
`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`
|
38463
|
+
);
|
38464
|
+
return false;
|
38465
|
+
}
|
38466
|
+
let isValid2 = true;
|
38467
|
+
if (!isRequiredProperty(value, "binding", "string")) {
|
38468
|
+
diagnostics.errors.push(
|
38469
|
+
`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(
|
38470
|
+
value
|
38471
|
+
)}.`
|
38472
|
+
);
|
38473
|
+
isValid2 = false;
|
38474
|
+
}
|
38475
|
+
if (!isRequiredProperty(value, "name", "string")) {
|
38476
|
+
diagnostics.errors.push(
|
38477
|
+
`"${field}" bindings should have a string "name" field but got ${JSON.stringify(
|
38478
|
+
value
|
38479
|
+
)}.`
|
38480
|
+
);
|
38481
|
+
isValid2 = false;
|
38482
|
+
} else if (value.name.length > 64) {
|
38483
|
+
diagnostics.errors.push(
|
38484
|
+
`"${field}" binding "name" field must be 64 characters or less, but got ${value.name.length} characters.`
|
38485
|
+
);
|
38486
|
+
isValid2 = false;
|
38487
|
+
}
|
38488
|
+
if (!isRequiredProperty(value, "class_name", "string")) {
|
38489
|
+
diagnostics.errors.push(
|
38490
|
+
`"${field}" bindings should have a string "class_name" field but got ${JSON.stringify(
|
38491
|
+
value
|
38492
|
+
)}.`
|
38493
|
+
);
|
38494
|
+
isValid2 = false;
|
38495
|
+
}
|
38496
|
+
if (!isOptionalProperty(value, "script_name", "string")) {
|
38497
|
+
diagnostics.errors.push(
|
38498
|
+
`"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(
|
38499
|
+
value
|
38500
|
+
)}.`
|
38501
|
+
);
|
38502
|
+
isValid2 = false;
|
38503
|
+
}
|
38504
|
+
if (!isOptionalProperty(value, "experimental_remote", "boolean")) {
|
38505
|
+
diagnostics.errors.push(
|
38506
|
+
`"${field}" bindings should, optionally, have a boolean "experimental_remote" field but got ${JSON.stringify(
|
38507
|
+
value
|
38508
|
+
)}.`
|
38509
|
+
);
|
38510
|
+
isValid2 = false;
|
38511
|
+
}
|
38512
|
+
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
38513
|
+
"binding",
|
38514
|
+
"name",
|
38515
|
+
"class_name",
|
38516
|
+
"script_name",
|
38517
|
+
"experimental_remote"
|
38518
|
+
]);
|
38519
|
+
return isValid2;
|
38424
38520
|
}, "validateWorkflowBinding");
|
38425
38521
|
validateCflogfwdrObject = /* @__PURE__ */ __name((envName) => (diagnostics, field, value, topLevelEnv) => {
|
38426
38522
|
const bindingsValidation = validateBindingsProperty(
|
@@ -41539,6 +41635,81 @@ var init_streams = __esm({
|
|
41539
41635
|
}
|
41540
41636
|
});
|
41541
41637
|
|
41638
|
+
// ../cli/check-macos-version.ts
|
41639
|
+
function checkMacOSVersion(options) {
|
41640
|
+
if (process.platform !== "darwin") {
|
41641
|
+
return;
|
41642
|
+
}
|
41643
|
+
if (process.env.CI) {
|
41644
|
+
return;
|
41645
|
+
}
|
41646
|
+
const release3 = import_node_os3.default.release();
|
41647
|
+
const macOSVersion = darwinVersionToMacOSVersion(release3);
|
41648
|
+
if (macOSVersion && isVersionLessThan(macOSVersion, MINIMUM_MACOS_VERSION)) {
|
41649
|
+
if (options.shouldThrow) {
|
41650
|
+
throw new Error(
|
41651
|
+
`Unsupported macOS version: The Cloudflare Workers runtime cannot run on the current version of macOS (${macOSVersion}). The minimum requirement is macOS ${MINIMUM_MACOS_VERSION}+. See https://github.com/cloudflare/workerd?tab=readme-ov-file#running-workerd If you cannot upgrade your version of macOS, you could try running in a DevContainer setup with a supported version of Linux (glibc 2.35+ required).`
|
41652
|
+
);
|
41653
|
+
} else {
|
41654
|
+
console.warn(
|
41655
|
+
`\u26A0\uFE0F Warning: Unsupported macOS version detected (${macOSVersion}). The Cloudflare Workers runtime may not work correctly on macOS versions below ${MINIMUM_MACOS_VERSION}. Consider upgrading to macOS ${MINIMUM_MACOS_VERSION}+ or using a DevContainer setup with a supported version of Linux (glibc 2.35+ required).`
|
41656
|
+
);
|
41657
|
+
}
|
41658
|
+
}
|
41659
|
+
}
|
41660
|
+
function darwinVersionToMacOSVersion(darwinVersion) {
|
41661
|
+
const match2 = darwinVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
|
41662
|
+
if (!match2) {
|
41663
|
+
return null;
|
41664
|
+
}
|
41665
|
+
const major = parseInt(match2[1], 10);
|
41666
|
+
if (major >= 20) {
|
41667
|
+
const macOSMajor = major - 9;
|
41668
|
+
const minor = parseInt(match2[2], 10);
|
41669
|
+
const patch = parseInt(match2[3], 10);
|
41670
|
+
return `${macOSMajor}.${minor}.${patch}`;
|
41671
|
+
}
|
41672
|
+
return null;
|
41673
|
+
}
|
41674
|
+
function isVersionLessThan(version1, version22) {
|
41675
|
+
const versionRegex = /^(\d+)\.(\d+)\.(\d+)$/;
|
41676
|
+
const match1 = version1.match(versionRegex);
|
41677
|
+
const match2 = version22.match(versionRegex);
|
41678
|
+
if (!match1 || !match2) {
|
41679
|
+
throw new Error(
|
41680
|
+
`Invalid version format. Expected M.m.p format, got: ${version1}, ${version22}`
|
41681
|
+
);
|
41682
|
+
}
|
41683
|
+
const [major1, minor1, patch1] = [
|
41684
|
+
parseInt(match1[1], 10),
|
41685
|
+
parseInt(match1[2], 10),
|
41686
|
+
parseInt(match1[3], 10)
|
41687
|
+
];
|
41688
|
+
const [major2, minor2, patch2] = [
|
41689
|
+
parseInt(match2[1], 10),
|
41690
|
+
parseInt(match2[2], 10),
|
41691
|
+
parseInt(match2[3], 10)
|
41692
|
+
];
|
41693
|
+
if (major1 !== major2) {
|
41694
|
+
return major1 < major2;
|
41695
|
+
}
|
41696
|
+
if (minor1 !== minor2) {
|
41697
|
+
return minor1 < minor2;
|
41698
|
+
}
|
41699
|
+
return patch1 < patch2;
|
41700
|
+
}
|
41701
|
+
var import_node_os3, MINIMUM_MACOS_VERSION;
|
41702
|
+
var init_check_macos_version = __esm({
|
41703
|
+
"../cli/check-macos-version.ts"() {
|
41704
|
+
init_import_meta_url();
|
41705
|
+
import_node_os3 = __toESM(require("os"));
|
41706
|
+
MINIMUM_MACOS_VERSION = "13.5.0";
|
41707
|
+
__name(checkMacOSVersion, "checkMacOSVersion");
|
41708
|
+
__name(darwinVersionToMacOSVersion, "darwinVersionToMacOSVersion");
|
41709
|
+
__name(isVersionLessThan, "isVersionLessThan");
|
41710
|
+
}
|
41711
|
+
});
|
41712
|
+
|
41542
41713
|
// ../cli/index.ts
|
41543
41714
|
var import_process, shapes, status, space, logRaw, log, newline, format6, updateStatus, startSection, endSection, cancel, warn, success, stripAnsi3, linkRegex, crash, error;
|
41544
41715
|
var init_cli = __esm({
|
@@ -41547,6 +41718,7 @@ var init_cli = __esm({
|
|
41547
41718
|
import_process = require("process");
|
41548
41719
|
init_colors();
|
41549
41720
|
init_streams();
|
41721
|
+
init_check_macos_version();
|
41550
41722
|
shapes = {
|
41551
41723
|
diamond: "\u25C7",
|
41552
41724
|
dash: "\u2500",
|
@@ -47920,14 +48092,14 @@ var require_is_wsl = __commonJS({
|
|
47920
48092
|
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module3) {
|
47921
48093
|
"use strict";
|
47922
48094
|
init_import_meta_url();
|
47923
|
-
var
|
48095
|
+
var os12 = require("os");
|
47924
48096
|
var fs24 = require("fs");
|
47925
48097
|
var isDocker = require_is_docker();
|
47926
48098
|
var isWsl = /* @__PURE__ */ __name(() => {
|
47927
48099
|
if (process.platform !== "linux") {
|
47928
48100
|
return false;
|
47929
48101
|
}
|
47930
|
-
if (
|
48102
|
+
if (os12.release().toLowerCase().includes("microsoft")) {
|
47931
48103
|
if (isDocker()) {
|
47932
48104
|
return false;
|
47933
48105
|
}
|
@@ -49786,8 +49958,8 @@ var require_homedir = __commonJS({
|
|
49786
49958
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js"(exports2, module3) {
|
49787
49959
|
"use strict";
|
49788
49960
|
init_import_meta_url();
|
49789
|
-
var
|
49790
|
-
module3.exports =
|
49961
|
+
var os12 = require("os");
|
49962
|
+
module3.exports = os12.homedir || /* @__PURE__ */ __name(function homedir3() {
|
49791
49963
|
var home = process.env.HOME;
|
49792
49964
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
49793
49965
|
if (process.platform === "win32") {
|
@@ -51840,6 +52012,1148 @@ export default function (env) {
|
|
51840
52012
|
}
|
51841
52013
|
});
|
51842
52014
|
|
52015
|
+
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
|
52016
|
+
var require_ini = __commonJS({
|
52017
|
+
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports2) {
|
52018
|
+
init_import_meta_url();
|
52019
|
+
exports2.parse = exports2.decode = decode;
|
52020
|
+
exports2.stringify = exports2.encode = encode;
|
52021
|
+
exports2.safe = safe;
|
52022
|
+
exports2.unsafe = unsafe;
|
52023
|
+
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
52024
|
+
function encode(obj, opt) {
|
52025
|
+
var children = [];
|
52026
|
+
var out = "";
|
52027
|
+
if (typeof opt === "string") {
|
52028
|
+
opt = {
|
52029
|
+
section: opt,
|
52030
|
+
whitespace: false
|
52031
|
+
};
|
52032
|
+
} else {
|
52033
|
+
opt = opt || {};
|
52034
|
+
opt.whitespace = opt.whitespace === true;
|
52035
|
+
}
|
52036
|
+
var separator = opt.whitespace ? " = " : "=";
|
52037
|
+
Object.keys(obj).forEach(function(k6, _4, __) {
|
52038
|
+
var val2 = obj[k6];
|
52039
|
+
if (val2 && Array.isArray(val2)) {
|
52040
|
+
val2.forEach(function(item) {
|
52041
|
+
out += safe(k6 + "[]") + separator + safe(item) + "\n";
|
52042
|
+
});
|
52043
|
+
} else if (val2 && typeof val2 === "object")
|
52044
|
+
children.push(k6);
|
52045
|
+
else
|
52046
|
+
out += safe(k6) + separator + safe(val2) + eol;
|
52047
|
+
});
|
52048
|
+
if (opt.section && out.length)
|
52049
|
+
out = "[" + safe(opt.section) + "]" + eol + out;
|
52050
|
+
children.forEach(function(k6, _4, __) {
|
52051
|
+
var nk = dotSplit(k6).join("\\.");
|
52052
|
+
var section = (opt.section ? opt.section + "." : "") + nk;
|
52053
|
+
var child = encode(obj[k6], {
|
52054
|
+
section,
|
52055
|
+
whitespace: opt.whitespace
|
52056
|
+
});
|
52057
|
+
if (out.length && child.length)
|
52058
|
+
out += eol;
|
52059
|
+
out += child;
|
52060
|
+
});
|
52061
|
+
return out;
|
52062
|
+
}
|
52063
|
+
__name(encode, "encode");
|
52064
|
+
function dotSplit(str) {
|
52065
|
+
return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
|
52066
|
+
return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
|
52067
|
+
});
|
52068
|
+
}
|
52069
|
+
__name(dotSplit, "dotSplit");
|
52070
|
+
function decode(str) {
|
52071
|
+
var out = {};
|
52072
|
+
var p6 = out;
|
52073
|
+
var section = null;
|
52074
|
+
var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
|
52075
|
+
var lines = str.split(/[\r\n]+/g);
|
52076
|
+
lines.forEach(function(line, _4, __) {
|
52077
|
+
if (!line || line.match(/^\s*[;#]/))
|
52078
|
+
return;
|
52079
|
+
var match2 = line.match(re);
|
52080
|
+
if (!match2)
|
52081
|
+
return;
|
52082
|
+
if (match2[1] !== void 0) {
|
52083
|
+
section = unsafe(match2[1]);
|
52084
|
+
if (section === "__proto__") {
|
52085
|
+
p6 = {};
|
52086
|
+
return;
|
52087
|
+
}
|
52088
|
+
p6 = out[section] = out[section] || {};
|
52089
|
+
return;
|
52090
|
+
}
|
52091
|
+
var key = unsafe(match2[2]);
|
52092
|
+
if (key === "__proto__")
|
52093
|
+
return;
|
52094
|
+
var value = match2[3] ? unsafe(match2[4]) : true;
|
52095
|
+
switch (value) {
|
52096
|
+
case "true":
|
52097
|
+
case "false":
|
52098
|
+
case "null":
|
52099
|
+
value = JSON.parse(value);
|
52100
|
+
}
|
52101
|
+
if (key.length > 2 && key.slice(-2) === "[]") {
|
52102
|
+
key = key.substring(0, key.length - 2);
|
52103
|
+
if (key === "__proto__")
|
52104
|
+
return;
|
52105
|
+
if (!p6[key])
|
52106
|
+
p6[key] = [];
|
52107
|
+
else if (!Array.isArray(p6[key]))
|
52108
|
+
p6[key] = [p6[key]];
|
52109
|
+
}
|
52110
|
+
if (Array.isArray(p6[key]))
|
52111
|
+
p6[key].push(value);
|
52112
|
+
else
|
52113
|
+
p6[key] = value;
|
52114
|
+
});
|
52115
|
+
Object.keys(out).filter(function(k6, _4, __) {
|
52116
|
+
if (!out[k6] || typeof out[k6] !== "object" || Array.isArray(out[k6]))
|
52117
|
+
return false;
|
52118
|
+
var parts = dotSplit(k6);
|
52119
|
+
var p7 = out;
|
52120
|
+
var l6 = parts.pop();
|
52121
|
+
var nl = l6.replace(/\\\./g, ".");
|
52122
|
+
parts.forEach(function(part, _5, __2) {
|
52123
|
+
if (part === "__proto__")
|
52124
|
+
return;
|
52125
|
+
if (!p7[part] || typeof p7[part] !== "object")
|
52126
|
+
p7[part] = {};
|
52127
|
+
p7 = p7[part];
|
52128
|
+
});
|
52129
|
+
if (p7 === out && nl === l6)
|
52130
|
+
return false;
|
52131
|
+
p7[nl] = out[k6];
|
52132
|
+
return true;
|
52133
|
+
}).forEach(function(del, _4, __) {
|
52134
|
+
delete out[del];
|
52135
|
+
});
|
52136
|
+
return out;
|
52137
|
+
}
|
52138
|
+
__name(decode, "decode");
|
52139
|
+
function isQuoted(val2) {
|
52140
|
+
return val2.charAt(0) === '"' && val2.slice(-1) === '"' || val2.charAt(0) === "'" && val2.slice(-1) === "'";
|
52141
|
+
}
|
52142
|
+
__name(isQuoted, "isQuoted");
|
52143
|
+
function safe(val2) {
|
52144
|
+
return typeof val2 !== "string" || val2.match(/[=\r\n]/) || val2.match(/^\[/) || val2.length > 1 && isQuoted(val2) || val2 !== val2.trim() ? JSON.stringify(val2) : val2.replace(/;/g, "\\;").replace(/#/g, "\\#");
|
52145
|
+
}
|
52146
|
+
__name(safe, "safe");
|
52147
|
+
function unsafe(val2, doUnesc) {
|
52148
|
+
val2 = (val2 || "").trim();
|
52149
|
+
if (isQuoted(val2)) {
|
52150
|
+
if (val2.charAt(0) === "'")
|
52151
|
+
val2 = val2.substr(1, val2.length - 2);
|
52152
|
+
try {
|
52153
|
+
val2 = JSON.parse(val2);
|
52154
|
+
} catch (_4) {
|
52155
|
+
}
|
52156
|
+
} else {
|
52157
|
+
var esc = false;
|
52158
|
+
var unesc = "";
|
52159
|
+
for (var i5 = 0, l6 = val2.length; i5 < l6; i5++) {
|
52160
|
+
var c6 = val2.charAt(i5);
|
52161
|
+
if (esc) {
|
52162
|
+
if ("\\;#".indexOf(c6) !== -1)
|
52163
|
+
unesc += c6;
|
52164
|
+
else
|
52165
|
+
unesc += "\\" + c6;
|
52166
|
+
esc = false;
|
52167
|
+
} else if (";#".indexOf(c6) !== -1)
|
52168
|
+
break;
|
52169
|
+
else if (c6 === "\\")
|
52170
|
+
esc = true;
|
52171
|
+
else
|
52172
|
+
unesc += c6;
|
52173
|
+
}
|
52174
|
+
if (esc)
|
52175
|
+
unesc += "\\";
|
52176
|
+
return unesc.trim();
|
52177
|
+
}
|
52178
|
+
return val2;
|
52179
|
+
}
|
52180
|
+
__name(unsafe, "unsafe");
|
52181
|
+
}
|
52182
|
+
});
|
52183
|
+
|
52184
|
+
// ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
|
52185
|
+
var require_strip_json_comments = __commonJS({
|
52186
|
+
"../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports2, module3) {
|
52187
|
+
"use strict";
|
52188
|
+
init_import_meta_url();
|
52189
|
+
var singleComment = 1;
|
52190
|
+
var multiComment = 2;
|
52191
|
+
function stripWithoutWhitespace() {
|
52192
|
+
return "";
|
52193
|
+
}
|
52194
|
+
__name(stripWithoutWhitespace, "stripWithoutWhitespace");
|
52195
|
+
function stripWithWhitespace(str, start, end) {
|
52196
|
+
return str.slice(start, end).replace(/\S/g, " ");
|
52197
|
+
}
|
52198
|
+
__name(stripWithWhitespace, "stripWithWhitespace");
|
52199
|
+
module3.exports = function(str, opts) {
|
52200
|
+
opts = opts || {};
|
52201
|
+
var currentChar;
|
52202
|
+
var nextChar;
|
52203
|
+
var insideString = false;
|
52204
|
+
var insideComment = false;
|
52205
|
+
var offset = 0;
|
52206
|
+
var ret = "";
|
52207
|
+
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
|
52208
|
+
for (var i5 = 0; i5 < str.length; i5++) {
|
52209
|
+
currentChar = str[i5];
|
52210
|
+
nextChar = str[i5 + 1];
|
52211
|
+
if (!insideComment && currentChar === '"') {
|
52212
|
+
var escaped = str[i5 - 1] === "\\" && str[i5 - 2] !== "\\";
|
52213
|
+
if (!escaped) {
|
52214
|
+
insideString = !insideString;
|
52215
|
+
}
|
52216
|
+
}
|
52217
|
+
if (insideString) {
|
52218
|
+
continue;
|
52219
|
+
}
|
52220
|
+
if (!insideComment && currentChar + nextChar === "//") {
|
52221
|
+
ret += str.slice(offset, i5);
|
52222
|
+
offset = i5;
|
52223
|
+
insideComment = singleComment;
|
52224
|
+
i5++;
|
52225
|
+
} else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
|
52226
|
+
i5++;
|
52227
|
+
insideComment = false;
|
52228
|
+
ret += strip(str, offset, i5);
|
52229
|
+
offset = i5;
|
52230
|
+
continue;
|
52231
|
+
} else if (insideComment === singleComment && currentChar === "\n") {
|
52232
|
+
insideComment = false;
|
52233
|
+
ret += strip(str, offset, i5);
|
52234
|
+
offset = i5;
|
52235
|
+
} else if (!insideComment && currentChar + nextChar === "/*") {
|
52236
|
+
ret += str.slice(offset, i5);
|
52237
|
+
offset = i5;
|
52238
|
+
insideComment = multiComment;
|
52239
|
+
i5++;
|
52240
|
+
continue;
|
52241
|
+
} else if (insideComment === multiComment && currentChar + nextChar === "*/") {
|
52242
|
+
i5++;
|
52243
|
+
insideComment = false;
|
52244
|
+
ret += strip(str, offset, i5 + 1);
|
52245
|
+
offset = i5 + 1;
|
52246
|
+
continue;
|
52247
|
+
}
|
52248
|
+
}
|
52249
|
+
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
52250
|
+
};
|
52251
|
+
}
|
52252
|
+
});
|
52253
|
+
|
52254
|
+
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
|
52255
|
+
var require_utils3 = __commonJS({
|
52256
|
+
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports2) {
|
52257
|
+
"use strict";
|
52258
|
+
init_import_meta_url();
|
52259
|
+
var fs24 = require("fs");
|
52260
|
+
var ini = require_ini();
|
52261
|
+
var path72 = require("path");
|
52262
|
+
var stripJsonComments = require_strip_json_comments();
|
52263
|
+
var parse7 = exports2.parse = function(content) {
|
52264
|
+
if (/^\s*{/.test(content))
|
52265
|
+
return JSON.parse(stripJsonComments(content));
|
52266
|
+
return ini.parse(content);
|
52267
|
+
};
|
52268
|
+
var file = exports2.file = function() {
|
52269
|
+
var args = [].slice.call(arguments).filter(function(arg) {
|
52270
|
+
return arg != null;
|
52271
|
+
});
|
52272
|
+
for (var i5 in args)
|
52273
|
+
if ("string" !== typeof args[i5])
|
52274
|
+
return;
|
52275
|
+
var file2 = path72.join.apply(null, args);
|
52276
|
+
var content;
|
52277
|
+
try {
|
52278
|
+
return fs24.readFileSync(file2, "utf-8");
|
52279
|
+
} catch (err) {
|
52280
|
+
return;
|
52281
|
+
}
|
52282
|
+
};
|
52283
|
+
var json = exports2.json = function() {
|
52284
|
+
var content = file.apply(null, arguments);
|
52285
|
+
return content ? parse7(content) : null;
|
52286
|
+
};
|
52287
|
+
var env6 = exports2.env = function(prefix, env7) {
|
52288
|
+
env7 = env7 || process.env;
|
52289
|
+
var obj = {};
|
52290
|
+
var l6 = prefix.length;
|
52291
|
+
for (var k6 in env7) {
|
52292
|
+
if (k6.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
52293
|
+
var keypath = k6.substring(l6).split("__");
|
52294
|
+
var _emptyStringIndex;
|
52295
|
+
while ((_emptyStringIndex = keypath.indexOf("")) > -1) {
|
52296
|
+
keypath.splice(_emptyStringIndex, 1);
|
52297
|
+
}
|
52298
|
+
var cursor = obj;
|
52299
|
+
keypath.forEach(/* @__PURE__ */ __name(function _buildSubObj(_subkey, i5) {
|
52300
|
+
if (!_subkey || typeof cursor !== "object")
|
52301
|
+
return;
|
52302
|
+
if (i5 === keypath.length - 1)
|
52303
|
+
cursor[_subkey] = env7[k6];
|
52304
|
+
if (cursor[_subkey] === void 0)
|
52305
|
+
cursor[_subkey] = {};
|
52306
|
+
cursor = cursor[_subkey];
|
52307
|
+
}, "_buildSubObj"));
|
52308
|
+
}
|
52309
|
+
}
|
52310
|
+
return obj;
|
52311
|
+
};
|
52312
|
+
var find = exports2.find = function() {
|
52313
|
+
var rel = path72.join.apply(null, [].slice.call(arguments));
|
52314
|
+
function find2(start, rel2) {
|
52315
|
+
var file2 = path72.join(start, rel2);
|
52316
|
+
try {
|
52317
|
+
fs24.statSync(file2);
|
52318
|
+
return file2;
|
52319
|
+
} catch (err) {
|
52320
|
+
if (path72.dirname(start) !== start)
|
52321
|
+
return find2(path72.dirname(start), rel2);
|
52322
|
+
}
|
52323
|
+
}
|
52324
|
+
__name(find2, "find");
|
52325
|
+
return find2(process.cwd(), rel);
|
52326
|
+
};
|
52327
|
+
}
|
52328
|
+
});
|
52329
|
+
|
52330
|
+
// ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
|
52331
|
+
var require_deep_extend = __commonJS({
|
52332
|
+
"../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports2, module3) {
|
52333
|
+
"use strict";
|
52334
|
+
init_import_meta_url();
|
52335
|
+
function isSpecificValue(val2) {
|
52336
|
+
return val2 instanceof Buffer || val2 instanceof Date || val2 instanceof RegExp ? true : false;
|
52337
|
+
}
|
52338
|
+
__name(isSpecificValue, "isSpecificValue");
|
52339
|
+
function cloneSpecificValue(val2) {
|
52340
|
+
if (val2 instanceof Buffer) {
|
52341
|
+
var x6 = Buffer.alloc ? Buffer.alloc(val2.length) : new Buffer(val2.length);
|
52342
|
+
val2.copy(x6);
|
52343
|
+
return x6;
|
52344
|
+
} else if (val2 instanceof Date) {
|
52345
|
+
return new Date(val2.getTime());
|
52346
|
+
} else if (val2 instanceof RegExp) {
|
52347
|
+
return new RegExp(val2);
|
52348
|
+
} else {
|
52349
|
+
throw new Error("Unexpected situation");
|
52350
|
+
}
|
52351
|
+
}
|
52352
|
+
__name(cloneSpecificValue, "cloneSpecificValue");
|
52353
|
+
function deepCloneArray(arr) {
|
52354
|
+
var clone = [];
|
52355
|
+
arr.forEach(function(item, index) {
|
52356
|
+
if (typeof item === "object" && item !== null) {
|
52357
|
+
if (Array.isArray(item)) {
|
52358
|
+
clone[index] = deepCloneArray(item);
|
52359
|
+
} else if (isSpecificValue(item)) {
|
52360
|
+
clone[index] = cloneSpecificValue(item);
|
52361
|
+
} else {
|
52362
|
+
clone[index] = deepExtend({}, item);
|
52363
|
+
}
|
52364
|
+
} else {
|
52365
|
+
clone[index] = item;
|
52366
|
+
}
|
52367
|
+
});
|
52368
|
+
return clone;
|
52369
|
+
}
|
52370
|
+
__name(deepCloneArray, "deepCloneArray");
|
52371
|
+
function safeGetProperty(object, property) {
|
52372
|
+
return property === "__proto__" ? void 0 : object[property];
|
52373
|
+
}
|
52374
|
+
__name(safeGetProperty, "safeGetProperty");
|
52375
|
+
var deepExtend = module3.exports = function() {
|
52376
|
+
if (arguments.length < 1 || typeof arguments[0] !== "object") {
|
52377
|
+
return false;
|
52378
|
+
}
|
52379
|
+
if (arguments.length < 2) {
|
52380
|
+
return arguments[0];
|
52381
|
+
}
|
52382
|
+
var target = arguments[0];
|
52383
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
52384
|
+
var val2, src, clone;
|
52385
|
+
args.forEach(function(obj) {
|
52386
|
+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
|
52387
|
+
return;
|
52388
|
+
}
|
52389
|
+
Object.keys(obj).forEach(function(key) {
|
52390
|
+
src = safeGetProperty(target, key);
|
52391
|
+
val2 = safeGetProperty(obj, key);
|
52392
|
+
if (val2 === target) {
|
52393
|
+
return;
|
52394
|
+
} else if (typeof val2 !== "object" || val2 === null) {
|
52395
|
+
target[key] = val2;
|
52396
|
+
return;
|
52397
|
+
} else if (Array.isArray(val2)) {
|
52398
|
+
target[key] = deepCloneArray(val2);
|
52399
|
+
return;
|
52400
|
+
} else if (isSpecificValue(val2)) {
|
52401
|
+
target[key] = cloneSpecificValue(val2);
|
52402
|
+
return;
|
52403
|
+
} else if (typeof src !== "object" || src === null || Array.isArray(src)) {
|
52404
|
+
target[key] = deepExtend({}, val2);
|
52405
|
+
return;
|
52406
|
+
} else {
|
52407
|
+
target[key] = deepExtend(src, val2);
|
52408
|
+
return;
|
52409
|
+
}
|
52410
|
+
});
|
52411
|
+
});
|
52412
|
+
return target;
|
52413
|
+
};
|
52414
|
+
}
|
52415
|
+
});
|
52416
|
+
|
52417
|
+
// ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
|
52418
|
+
var require_minimist = __commonJS({
|
52419
|
+
"../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports2, module3) {
|
52420
|
+
init_import_meta_url();
|
52421
|
+
module3.exports = function(args, opts) {
|
52422
|
+
if (!opts) opts = {};
|
52423
|
+
var flags2 = { bools: {}, strings: {}, unknownFn: null };
|
52424
|
+
if (typeof opts["unknown"] === "function") {
|
52425
|
+
flags2.unknownFn = opts["unknown"];
|
52426
|
+
}
|
52427
|
+
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
|
52428
|
+
flags2.allBools = true;
|
52429
|
+
} else {
|
52430
|
+
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
|
52431
|
+
flags2.bools[key2] = true;
|
52432
|
+
});
|
52433
|
+
}
|
52434
|
+
var aliases2 = {};
|
52435
|
+
Object.keys(opts.alias || {}).forEach(function(key2) {
|
52436
|
+
aliases2[key2] = [].concat(opts.alias[key2]);
|
52437
|
+
aliases2[key2].forEach(function(x6) {
|
52438
|
+
aliases2[x6] = [key2].concat(aliases2[key2].filter(function(y4) {
|
52439
|
+
return x6 !== y4;
|
52440
|
+
}));
|
52441
|
+
});
|
52442
|
+
});
|
52443
|
+
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
|
52444
|
+
flags2.strings[key2] = true;
|
52445
|
+
if (aliases2[key2]) {
|
52446
|
+
flags2.strings[aliases2[key2]] = true;
|
52447
|
+
}
|
52448
|
+
});
|
52449
|
+
var defaults = opts["default"] || {};
|
52450
|
+
var argv = { _: [] };
|
52451
|
+
Object.keys(flags2.bools).forEach(function(key2) {
|
52452
|
+
setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
|
52453
|
+
});
|
52454
|
+
var notFlags = [];
|
52455
|
+
if (args.indexOf("--") !== -1) {
|
52456
|
+
notFlags = args.slice(args.indexOf("--") + 1);
|
52457
|
+
args = args.slice(0, args.indexOf("--"));
|
52458
|
+
}
|
52459
|
+
function argDefined(key2, arg2) {
|
52460
|
+
return flags2.allBools && /^--[^=]+$/.test(arg2) || flags2.strings[key2] || flags2.bools[key2] || aliases2[key2];
|
52461
|
+
}
|
52462
|
+
__name(argDefined, "argDefined");
|
52463
|
+
function setArg(key2, val2, arg2) {
|
52464
|
+
if (arg2 && flags2.unknownFn && !argDefined(key2, arg2)) {
|
52465
|
+
if (flags2.unknownFn(arg2) === false) return;
|
52466
|
+
}
|
52467
|
+
var value2 = !flags2.strings[key2] && isNumber(val2) ? Number(val2) : val2;
|
52468
|
+
setKey(argv, key2.split("."), value2);
|
52469
|
+
(aliases2[key2] || []).forEach(function(x6) {
|
52470
|
+
setKey(argv, x6.split("."), value2);
|
52471
|
+
});
|
52472
|
+
}
|
52473
|
+
__name(setArg, "setArg");
|
52474
|
+
function setKey(obj, keys, value2) {
|
52475
|
+
var o5 = obj;
|
52476
|
+
for (var i6 = 0; i6 < keys.length - 1; i6++) {
|
52477
|
+
var key2 = keys[i6];
|
52478
|
+
if (isConstructorOrProto(o5, key2)) return;
|
52479
|
+
if (o5[key2] === void 0) o5[key2] = {};
|
52480
|
+
if (o5[key2] === Object.prototype || o5[key2] === Number.prototype || o5[key2] === String.prototype) o5[key2] = {};
|
52481
|
+
if (o5[key2] === Array.prototype) o5[key2] = [];
|
52482
|
+
o5 = o5[key2];
|
52483
|
+
}
|
52484
|
+
var key2 = keys[keys.length - 1];
|
52485
|
+
if (isConstructorOrProto(o5, key2)) return;
|
52486
|
+
if (o5 === Object.prototype || o5 === Number.prototype || o5 === String.prototype) o5 = {};
|
52487
|
+
if (o5 === Array.prototype) o5 = [];
|
52488
|
+
if (o5[key2] === void 0 || flags2.bools[key2] || typeof o5[key2] === "boolean") {
|
52489
|
+
o5[key2] = value2;
|
52490
|
+
} else if (Array.isArray(o5[key2])) {
|
52491
|
+
o5[key2].push(value2);
|
52492
|
+
} else {
|
52493
|
+
o5[key2] = [o5[key2], value2];
|
52494
|
+
}
|
52495
|
+
}
|
52496
|
+
__name(setKey, "setKey");
|
52497
|
+
function aliasIsBoolean(key2) {
|
52498
|
+
return aliases2[key2].some(function(x6) {
|
52499
|
+
return flags2.bools[x6];
|
52500
|
+
});
|
52501
|
+
}
|
52502
|
+
__name(aliasIsBoolean, "aliasIsBoolean");
|
52503
|
+
for (var i5 = 0; i5 < args.length; i5++) {
|
52504
|
+
var arg = args[i5];
|
52505
|
+
if (/^--.+=/.test(arg)) {
|
52506
|
+
var m6 = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
52507
|
+
var key = m6[1];
|
52508
|
+
var value = m6[2];
|
52509
|
+
if (flags2.bools[key]) {
|
52510
|
+
value = value !== "false";
|
52511
|
+
}
|
52512
|
+
setArg(key, value, arg);
|
52513
|
+
} else if (/^--no-.+/.test(arg)) {
|
52514
|
+
var key = arg.match(/^--no-(.+)/)[1];
|
52515
|
+
setArg(key, false, arg);
|
52516
|
+
} else if (/^--.+/.test(arg)) {
|
52517
|
+
var key = arg.match(/^--(.+)/)[1];
|
52518
|
+
var next = args[i5 + 1];
|
52519
|
+
if (next !== void 0 && !/^-/.test(next) && !flags2.bools[key] && !flags2.allBools && (aliases2[key] ? !aliasIsBoolean(key) : true)) {
|
52520
|
+
setArg(key, next, arg);
|
52521
|
+
i5++;
|
52522
|
+
} else if (/^(true|false)$/.test(next)) {
|
52523
|
+
setArg(key, next === "true", arg);
|
52524
|
+
i5++;
|
52525
|
+
} else {
|
52526
|
+
setArg(key, flags2.strings[key] ? "" : true, arg);
|
52527
|
+
}
|
52528
|
+
} else if (/^-[^-]+/.test(arg)) {
|
52529
|
+
var letters = arg.slice(1, -1).split("");
|
52530
|
+
var broken = false;
|
52531
|
+
for (var j6 = 0; j6 < letters.length; j6++) {
|
52532
|
+
var next = arg.slice(j6 + 2);
|
52533
|
+
if (next === "-") {
|
52534
|
+
setArg(letters[j6], next, arg);
|
52535
|
+
continue;
|
52536
|
+
}
|
52537
|
+
if (/[A-Za-z]/.test(letters[j6]) && /=/.test(next)) {
|
52538
|
+
setArg(letters[j6], next.split("=")[1], arg);
|
52539
|
+
broken = true;
|
52540
|
+
break;
|
52541
|
+
}
|
52542
|
+
if (/[A-Za-z]/.test(letters[j6]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
52543
|
+
setArg(letters[j6], next, arg);
|
52544
|
+
broken = true;
|
52545
|
+
break;
|
52546
|
+
}
|
52547
|
+
if (letters[j6 + 1] && letters[j6 + 1].match(/\W/)) {
|
52548
|
+
setArg(letters[j6], arg.slice(j6 + 2), arg);
|
52549
|
+
broken = true;
|
52550
|
+
break;
|
52551
|
+
} else {
|
52552
|
+
setArg(letters[j6], flags2.strings[letters[j6]] ? "" : true, arg);
|
52553
|
+
}
|
52554
|
+
}
|
52555
|
+
var key = arg.slice(-1)[0];
|
52556
|
+
if (!broken && key !== "-") {
|
52557
|
+
if (args[i5 + 1] && !/^(-|--)[^-]/.test(args[i5 + 1]) && !flags2.bools[key] && (aliases2[key] ? !aliasIsBoolean(key) : true)) {
|
52558
|
+
setArg(key, args[i5 + 1], arg);
|
52559
|
+
i5++;
|
52560
|
+
} else if (args[i5 + 1] && /^(true|false)$/.test(args[i5 + 1])) {
|
52561
|
+
setArg(key, args[i5 + 1] === "true", arg);
|
52562
|
+
i5++;
|
52563
|
+
} else {
|
52564
|
+
setArg(key, flags2.strings[key] ? "" : true, arg);
|
52565
|
+
}
|
52566
|
+
}
|
52567
|
+
} else {
|
52568
|
+
if (!flags2.unknownFn || flags2.unknownFn(arg) !== false) {
|
52569
|
+
argv._.push(
|
52570
|
+
flags2.strings["_"] || !isNumber(arg) ? arg : Number(arg)
|
52571
|
+
);
|
52572
|
+
}
|
52573
|
+
if (opts.stopEarly) {
|
52574
|
+
argv._.push.apply(argv._, args.slice(i5 + 1));
|
52575
|
+
break;
|
52576
|
+
}
|
52577
|
+
}
|
52578
|
+
}
|
52579
|
+
Object.keys(defaults).forEach(function(key2) {
|
52580
|
+
if (!hasKey2(argv, key2.split("."))) {
|
52581
|
+
setKey(argv, key2.split("."), defaults[key2]);
|
52582
|
+
(aliases2[key2] || []).forEach(function(x6) {
|
52583
|
+
setKey(argv, x6.split("."), defaults[key2]);
|
52584
|
+
});
|
52585
|
+
}
|
52586
|
+
});
|
52587
|
+
if (opts["--"]) {
|
52588
|
+
argv["--"] = new Array();
|
52589
|
+
notFlags.forEach(function(key2) {
|
52590
|
+
argv["--"].push(key2);
|
52591
|
+
});
|
52592
|
+
} else {
|
52593
|
+
notFlags.forEach(function(key2) {
|
52594
|
+
argv._.push(key2);
|
52595
|
+
});
|
52596
|
+
}
|
52597
|
+
return argv;
|
52598
|
+
};
|
52599
|
+
function hasKey2(obj, keys) {
|
52600
|
+
var o5 = obj;
|
52601
|
+
keys.slice(0, -1).forEach(function(key2) {
|
52602
|
+
o5 = o5[key2] || {};
|
52603
|
+
});
|
52604
|
+
var key = keys[keys.length - 1];
|
52605
|
+
return key in o5;
|
52606
|
+
}
|
52607
|
+
__name(hasKey2, "hasKey");
|
52608
|
+
function isNumber(x6) {
|
52609
|
+
if (typeof x6 === "number") return true;
|
52610
|
+
if (/^0x[0-9a-f]+$/i.test(x6)) return true;
|
52611
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x6);
|
52612
|
+
}
|
52613
|
+
__name(isNumber, "isNumber");
|
52614
|
+
function isConstructorOrProto(obj, key) {
|
52615
|
+
return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
|
52616
|
+
}
|
52617
|
+
__name(isConstructorOrProto, "isConstructorOrProto");
|
52618
|
+
}
|
52619
|
+
});
|
52620
|
+
|
52621
|
+
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js
|
52622
|
+
var require_rc = __commonJS({
|
52623
|
+
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/index.js"(exports2, module3) {
|
52624
|
+
init_import_meta_url();
|
52625
|
+
var cc2 = require_utils3();
|
52626
|
+
var join24 = require("path").join;
|
52627
|
+
var deepExtend = require_deep_extend();
|
52628
|
+
var etc = "/etc";
|
52629
|
+
var win = process.platform === "win32";
|
52630
|
+
var home = win ? process.env.USERPROFILE : process.env.HOME;
|
52631
|
+
module3.exports = function(name2, defaults, argv, parse7) {
|
52632
|
+
if ("string" !== typeof name2)
|
52633
|
+
throw new Error("rc(name): name *must* be string");
|
52634
|
+
if (!argv)
|
52635
|
+
argv = require_minimist()(process.argv.slice(2));
|
52636
|
+
defaults = ("string" === typeof defaults ? cc2.json(defaults) : defaults) || {};
|
52637
|
+
parse7 = parse7 || cc2.parse;
|
52638
|
+
var env6 = cc2.env(name2 + "_");
|
52639
|
+
var configs = [defaults];
|
52640
|
+
var configFiles = [];
|
52641
|
+
function addConfigFile(file) {
|
52642
|
+
if (configFiles.indexOf(file) >= 0) return;
|
52643
|
+
var fileConfig = cc2.file(file);
|
52644
|
+
if (fileConfig) {
|
52645
|
+
configs.push(parse7(fileConfig));
|
52646
|
+
configFiles.push(file);
|
52647
|
+
}
|
52648
|
+
}
|
52649
|
+
__name(addConfigFile, "addConfigFile");
|
52650
|
+
if (!win)
|
52651
|
+
[
|
52652
|
+
join24(etc, name2, "config"),
|
52653
|
+
join24(etc, name2 + "rc")
|
52654
|
+
].forEach(addConfigFile);
|
52655
|
+
if (home)
|
52656
|
+
[
|
52657
|
+
join24(home, ".config", name2, "config"),
|
52658
|
+
join24(home, ".config", name2),
|
52659
|
+
join24(home, "." + name2, "config"),
|
52660
|
+
join24(home, "." + name2 + "rc")
|
52661
|
+
].forEach(addConfigFile);
|
52662
|
+
addConfigFile(cc2.find("." + name2 + "rc"));
|
52663
|
+
if (env6.config) addConfigFile(env6.config);
|
52664
|
+
if (argv.config) addConfigFile(argv.config);
|
52665
|
+
return deepExtend.apply(null, configs.concat([
|
52666
|
+
env6,
|
52667
|
+
argv,
|
52668
|
+
configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
|
52669
|
+
]));
|
52670
|
+
};
|
52671
|
+
}
|
52672
|
+
});
|
52673
|
+
|
52674
|
+
// ../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js
|
52675
|
+
var require_registry_url = __commonJS({
|
52676
|
+
"../../node_modules/.pnpm/registry-url@3.1.0/node_modules/registry-url/index.js"(exports2, module3) {
|
52677
|
+
"use strict";
|
52678
|
+
init_import_meta_url();
|
52679
|
+
module3.exports = function(scope) {
|
52680
|
+
var rc = require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
52681
|
+
var url4 = rc[scope + ":registry"] || rc.registry;
|
52682
|
+
return url4.slice(-1) === "/" ? url4 : url4 + "/";
|
52683
|
+
};
|
52684
|
+
}
|
52685
|
+
});
|
52686
|
+
|
52687
|
+
// ../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js
|
52688
|
+
var require_safe_buffer = __commonJS({
|
52689
|
+
"../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js"(exports2, module3) {
|
52690
|
+
init_import_meta_url();
|
52691
|
+
var buffer = require("buffer");
|
52692
|
+
var Buffer7 = buffer.Buffer;
|
52693
|
+
function copyProps(src, dst) {
|
52694
|
+
for (var key in src) {
|
52695
|
+
dst[key] = src[key];
|
52696
|
+
}
|
52697
|
+
}
|
52698
|
+
__name(copyProps, "copyProps");
|
52699
|
+
if (Buffer7.from && Buffer7.alloc && Buffer7.allocUnsafe && Buffer7.allocUnsafeSlow) {
|
52700
|
+
module3.exports = buffer;
|
52701
|
+
} else {
|
52702
|
+
copyProps(buffer, exports2);
|
52703
|
+
exports2.Buffer = SafeBuffer;
|
52704
|
+
}
|
52705
|
+
function SafeBuffer(arg, encodingOrOffset, length) {
|
52706
|
+
return Buffer7(arg, encodingOrOffset, length);
|
52707
|
+
}
|
52708
|
+
__name(SafeBuffer, "SafeBuffer");
|
52709
|
+
SafeBuffer.prototype = Object.create(Buffer7.prototype);
|
52710
|
+
copyProps(Buffer7, SafeBuffer);
|
52711
|
+
SafeBuffer.from = function(arg, encodingOrOffset, length) {
|
52712
|
+
if (typeof arg === "number") {
|
52713
|
+
throw new TypeError("Argument must not be a number");
|
52714
|
+
}
|
52715
|
+
return Buffer7(arg, encodingOrOffset, length);
|
52716
|
+
};
|
52717
|
+
SafeBuffer.alloc = function(size, fill2, encoding) {
|
52718
|
+
if (typeof size !== "number") {
|
52719
|
+
throw new TypeError("Argument must be a number");
|
52720
|
+
}
|
52721
|
+
var buf = Buffer7(size);
|
52722
|
+
if (fill2 !== void 0) {
|
52723
|
+
if (typeof encoding === "string") {
|
52724
|
+
buf.fill(fill2, encoding);
|
52725
|
+
} else {
|
52726
|
+
buf.fill(fill2);
|
52727
|
+
}
|
52728
|
+
} else {
|
52729
|
+
buf.fill(0);
|
52730
|
+
}
|
52731
|
+
return buf;
|
52732
|
+
};
|
52733
|
+
SafeBuffer.allocUnsafe = function(size) {
|
52734
|
+
if (typeof size !== "number") {
|
52735
|
+
throw new TypeError("Argument must be a number");
|
52736
|
+
}
|
52737
|
+
return Buffer7(size);
|
52738
|
+
};
|
52739
|
+
SafeBuffer.allocUnsafeSlow = function(size) {
|
52740
|
+
if (typeof size !== "number") {
|
52741
|
+
throw new TypeError("Argument must be a number");
|
52742
|
+
}
|
52743
|
+
return buffer.SlowBuffer(size);
|
52744
|
+
};
|
52745
|
+
}
|
52746
|
+
});
|
52747
|
+
|
52748
|
+
// ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js
|
52749
|
+
var require_base64 = __commonJS({
|
52750
|
+
"../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/base64.js"(exports2, module3) {
|
52751
|
+
init_import_meta_url();
|
52752
|
+
var safeBuffer = require_safe_buffer().Buffer;
|
52753
|
+
function decodeBase64(base642) {
|
52754
|
+
return safeBuffer.from(base642, "base64").toString("utf8");
|
52755
|
+
}
|
52756
|
+
__name(decodeBase64, "decodeBase64");
|
52757
|
+
function encodeBase64(string) {
|
52758
|
+
return safeBuffer.from(string, "utf8").toString("base64");
|
52759
|
+
}
|
52760
|
+
__name(encodeBase64, "encodeBase64");
|
52761
|
+
module3.exports = {
|
52762
|
+
decodeBase64,
|
52763
|
+
encodeBase64
|
52764
|
+
};
|
52765
|
+
}
|
52766
|
+
});
|
52767
|
+
|
52768
|
+
// ../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js
|
52769
|
+
var require_registry_auth_token = __commonJS({
|
52770
|
+
"../../node_modules/.pnpm/registry-auth-token@3.3.2/node_modules/registry-auth-token/index.js"(exports2, module3) {
|
52771
|
+
init_import_meta_url();
|
52772
|
+
var url4 = require("url");
|
52773
|
+
var base642 = require_base64();
|
52774
|
+
var decodeBase64 = base642.decodeBase64;
|
52775
|
+
var encodeBase64 = base642.encodeBase64;
|
52776
|
+
var tokenKey = ":_authToken";
|
52777
|
+
var userKey = ":username";
|
52778
|
+
var passwordKey = ":_password";
|
52779
|
+
module3.exports = function() {
|
52780
|
+
var checkUrl2;
|
52781
|
+
var options;
|
52782
|
+
if (arguments.length >= 2) {
|
52783
|
+
checkUrl2 = arguments[0];
|
52784
|
+
options = arguments[1];
|
52785
|
+
} else if (typeof arguments[0] === "string") {
|
52786
|
+
checkUrl2 = arguments[0];
|
52787
|
+
} else {
|
52788
|
+
options = arguments[0];
|
52789
|
+
}
|
52790
|
+
options = options || {};
|
52791
|
+
options.npmrc = options.npmrc || require_rc()("npm", { registry: "https://registry.npmjs.org/" });
|
52792
|
+
checkUrl2 = checkUrl2 || options.npmrc.registry;
|
52793
|
+
return getRegistryAuthInfo(checkUrl2, options) || getLegacyAuthInfo(options.npmrc);
|
52794
|
+
};
|
52795
|
+
function getRegistryAuthInfo(checkUrl2, options) {
|
52796
|
+
var parsed = url4.parse(checkUrl2, false, true);
|
52797
|
+
var pathname;
|
52798
|
+
while (pathname !== "/" && parsed.pathname !== pathname) {
|
52799
|
+
pathname = parsed.pathname || "/";
|
52800
|
+
var regUrl = "//" + parsed.host + pathname.replace(/\/$/, "");
|
52801
|
+
var authInfo = getAuthInfoForUrl(regUrl, options.npmrc);
|
52802
|
+
if (authInfo) {
|
52803
|
+
return authInfo;
|
52804
|
+
}
|
52805
|
+
if (!options.recursive) {
|
52806
|
+
return /\/$/.test(checkUrl2) ? void 0 : getRegistryAuthInfo(url4.resolve(checkUrl2, "."), options);
|
52807
|
+
}
|
52808
|
+
parsed.pathname = url4.resolve(normalizePath2(pathname), "..") || "/";
|
52809
|
+
}
|
52810
|
+
return void 0;
|
52811
|
+
}
|
52812
|
+
__name(getRegistryAuthInfo, "getRegistryAuthInfo");
|
52813
|
+
function getLegacyAuthInfo(npmrc) {
|
52814
|
+
if (npmrc._auth) {
|
52815
|
+
return { token: npmrc._auth, type: "Basic" };
|
52816
|
+
}
|
52817
|
+
return void 0;
|
52818
|
+
}
|
52819
|
+
__name(getLegacyAuthInfo, "getLegacyAuthInfo");
|
52820
|
+
function normalizePath2(path72) {
|
52821
|
+
return path72[path72.length - 1] === "/" ? path72 : path72 + "/";
|
52822
|
+
}
|
52823
|
+
__name(normalizePath2, "normalizePath");
|
52824
|
+
function getAuthInfoForUrl(regUrl, npmrc) {
|
52825
|
+
var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
|
52826
|
+
if (bearerAuth) {
|
52827
|
+
return bearerAuth;
|
52828
|
+
}
|
52829
|
+
var username = npmrc[regUrl + userKey] || npmrc[regUrl + "/" + userKey];
|
52830
|
+
var password = npmrc[regUrl + passwordKey] || npmrc[regUrl + "/" + passwordKey];
|
52831
|
+
var basicAuth = getTokenForUsernameAndPassword(username, password);
|
52832
|
+
if (basicAuth) {
|
52833
|
+
return basicAuth;
|
52834
|
+
}
|
52835
|
+
return void 0;
|
52836
|
+
}
|
52837
|
+
__name(getAuthInfoForUrl, "getAuthInfoForUrl");
|
52838
|
+
function getBearerToken(tok) {
|
52839
|
+
if (!tok) {
|
52840
|
+
return void 0;
|
52841
|
+
}
|
52842
|
+
var token = tok.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
|
52843
|
+
return process.env[envVar];
|
52844
|
+
});
|
52845
|
+
return { token, type: "Bearer" };
|
52846
|
+
}
|
52847
|
+
__name(getBearerToken, "getBearerToken");
|
52848
|
+
function getTokenForUsernameAndPassword(username, password) {
|
52849
|
+
if (!username || !password) {
|
52850
|
+
return void 0;
|
52851
|
+
}
|
52852
|
+
var pass2 = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function(fullMatch, envVar) {
|
52853
|
+
return process.env[envVar];
|
52854
|
+
}));
|
52855
|
+
var token = encodeBase64(username + ":" + pass2);
|
52856
|
+
return {
|
52857
|
+
token,
|
52858
|
+
type: "Basic",
|
52859
|
+
password: pass2,
|
52860
|
+
username
|
52861
|
+
};
|
52862
|
+
}
|
52863
|
+
__name(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
52864
|
+
}
|
52865
|
+
});
|
52866
|
+
|
52867
|
+
// ../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js
|
52868
|
+
var require_update_check = __commonJS({
|
52869
|
+
"../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports2, module3) {
|
52870
|
+
init_import_meta_url();
|
52871
|
+
var { URL: URL7 } = require("url");
|
52872
|
+
var { join: join24 } = require("path");
|
52873
|
+
var fs24 = require("fs");
|
52874
|
+
var { promisify: promisify3 } = require("util");
|
52875
|
+
var { tmpdir } = require("os");
|
52876
|
+
var registryUrl = require_registry_url();
|
52877
|
+
var writeFile11 = promisify3(fs24.writeFile);
|
52878
|
+
var mkdir6 = promisify3(fs24.mkdir);
|
52879
|
+
var readFile18 = promisify3(fs24.readFile);
|
52880
|
+
var compareVersions = /* @__PURE__ */ __name((a5, b6) => a5.localeCompare(b6, "en-US", { numeric: true }), "compareVersions");
|
52881
|
+
var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
52882
|
+
var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
|
52883
|
+
const rootDir = tmpdir();
|
52884
|
+
const subDir = join24(rootDir, "update-check");
|
52885
|
+
if (!fs24.existsSync(subDir)) {
|
52886
|
+
await mkdir6(subDir);
|
52887
|
+
}
|
52888
|
+
let name2 = `${details.name}-${distTag}.json`;
|
52889
|
+
if (details.scope) {
|
52890
|
+
name2 = `${details.scope}-${name2}`;
|
52891
|
+
}
|
52892
|
+
return join24(subDir, name2);
|
52893
|
+
}, "getFile");
|
52894
|
+
var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
|
52895
|
+
if (fs24.existsSync(file)) {
|
52896
|
+
const content = await readFile18(file, "utf8");
|
52897
|
+
const { lastUpdate, latest } = JSON.parse(content);
|
52898
|
+
const nextCheck = lastUpdate + interval;
|
52899
|
+
if (nextCheck > time) {
|
52900
|
+
return {
|
52901
|
+
shouldCheck: false,
|
52902
|
+
latest
|
52903
|
+
};
|
52904
|
+
}
|
52905
|
+
}
|
52906
|
+
return {
|
52907
|
+
shouldCheck: true,
|
52908
|
+
latest: null
|
52909
|
+
};
|
52910
|
+
}, "evaluateCache");
|
52911
|
+
var updateCache = /* @__PURE__ */ __name(async (file, latest, lastUpdate) => {
|
52912
|
+
const content = JSON.stringify({
|
52913
|
+
latest,
|
52914
|
+
lastUpdate
|
52915
|
+
});
|
52916
|
+
await writeFile11(file, content, "utf8");
|
52917
|
+
}, "updateCache");
|
52918
|
+
var loadPackage = /* @__PURE__ */ __name((url4, authInfo) => new Promise((resolve25, reject) => {
|
52919
|
+
const options = {
|
52920
|
+
host: url4.hostname,
|
52921
|
+
path: url4.pathname,
|
52922
|
+
port: url4.port,
|
52923
|
+
headers: {
|
52924
|
+
accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
|
52925
|
+
},
|
52926
|
+
timeout: 2e3
|
52927
|
+
};
|
52928
|
+
if (authInfo) {
|
52929
|
+
options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
|
52930
|
+
}
|
52931
|
+
const { get: get2 } = url4.protocol === "https:" ? require("https") : require("http");
|
52932
|
+
get2(options, (response) => {
|
52933
|
+
const { statusCode } = response;
|
52934
|
+
if (statusCode !== 200) {
|
52935
|
+
const error2 = new Error(`Request failed with code ${statusCode}`);
|
52936
|
+
error2.code = statusCode;
|
52937
|
+
reject(error2);
|
52938
|
+
response.resume();
|
52939
|
+
return;
|
52940
|
+
}
|
52941
|
+
let rawData = "";
|
52942
|
+
response.setEncoding("utf8");
|
52943
|
+
response.on("data", (chunk) => {
|
52944
|
+
rawData += chunk;
|
52945
|
+
});
|
52946
|
+
response.on("end", () => {
|
52947
|
+
try {
|
52948
|
+
const parsedData = JSON.parse(rawData);
|
52949
|
+
resolve25(parsedData);
|
52950
|
+
} catch (e7) {
|
52951
|
+
reject(e7);
|
52952
|
+
}
|
52953
|
+
});
|
52954
|
+
}).on("error", reject).on("timeout", reject);
|
52955
|
+
}), "loadPackage");
|
52956
|
+
var getMostRecent = /* @__PURE__ */ __name(async ({ full, scope }, distTag) => {
|
52957
|
+
const regURL = registryUrl(scope);
|
52958
|
+
const url4 = new URL7(full, regURL);
|
52959
|
+
let spec = null;
|
52960
|
+
try {
|
52961
|
+
spec = await loadPackage(url4);
|
52962
|
+
} catch (err) {
|
52963
|
+
if (err.code && String(err.code).startsWith(4)) {
|
52964
|
+
const registryAuthToken = require_registry_auth_token();
|
52965
|
+
const authInfo = registryAuthToken(regURL, { recursive: true });
|
52966
|
+
spec = await loadPackage(url4, authInfo);
|
52967
|
+
} else {
|
52968
|
+
throw err;
|
52969
|
+
}
|
52970
|
+
}
|
52971
|
+
const version5 = spec["dist-tags"][distTag];
|
52972
|
+
if (!version5) {
|
52973
|
+
throw new Error(`Distribution tag ${distTag} is not available`);
|
52974
|
+
}
|
52975
|
+
return version5;
|
52976
|
+
}, "getMostRecent");
|
52977
|
+
var defaultConfig = {
|
52978
|
+
interval: 36e5,
|
52979
|
+
distTag: "latest"
|
52980
|
+
};
|
52981
|
+
var getDetails = /* @__PURE__ */ __name((name2) => {
|
52982
|
+
const spec = {
|
52983
|
+
full: encode(name2)
|
52984
|
+
};
|
52985
|
+
if (name2.includes("/")) {
|
52986
|
+
const parts = name2.split("/");
|
52987
|
+
spec.scope = parts[0];
|
52988
|
+
spec.name = parts[1];
|
52989
|
+
} else {
|
52990
|
+
spec.scope = null;
|
52991
|
+
spec.name = name2;
|
52992
|
+
}
|
52993
|
+
return spec;
|
52994
|
+
}, "getDetails");
|
52995
|
+
module3.exports = async (pkg, config) => {
|
52996
|
+
if (typeof pkg !== "object") {
|
52997
|
+
throw new Error("The first parameter should be your package.json file content");
|
52998
|
+
}
|
52999
|
+
const details = getDetails(pkg.name);
|
53000
|
+
const time = Date.now();
|
53001
|
+
const { distTag, interval } = Object.assign({}, defaultConfig, config);
|
53002
|
+
const file = await getFile(details, distTag);
|
53003
|
+
let latest = null;
|
53004
|
+
let shouldCheck = true;
|
53005
|
+
({ shouldCheck, latest } = await evaluateCache(file, time, interval));
|
53006
|
+
if (shouldCheck) {
|
53007
|
+
latest = await getMostRecent(details, distTag);
|
53008
|
+
await updateCache(file, latest, time);
|
53009
|
+
}
|
53010
|
+
const comparision = compareVersions(pkg.version, latest);
|
53011
|
+
if (comparision === -1) {
|
53012
|
+
return {
|
53013
|
+
latest,
|
53014
|
+
fromCache: !shouldCheck
|
53015
|
+
};
|
53016
|
+
}
|
53017
|
+
return null;
|
53018
|
+
};
|
53019
|
+
}
|
53020
|
+
});
|
53021
|
+
|
53022
|
+
// src/update-check.ts
|
53023
|
+
async function doUpdateCheck() {
|
53024
|
+
let update = null;
|
53025
|
+
const pkg = { name, version };
|
53026
|
+
try {
|
53027
|
+
update = await (0, import_update_check.default)(pkg, {
|
53028
|
+
distTag: pkg.version.startsWith("0.0.0") ? "beta" : "latest"
|
53029
|
+
});
|
53030
|
+
} catch {
|
53031
|
+
}
|
53032
|
+
return update?.latest;
|
53033
|
+
}
|
53034
|
+
function updateCheck() {
|
53035
|
+
return updateCheckPromise ??= doUpdateCheck();
|
53036
|
+
}
|
53037
|
+
var import_update_check, updateCheckPromise;
|
53038
|
+
var init_update_check = __esm({
|
53039
|
+
"src/update-check.ts"() {
|
53040
|
+
init_import_meta_url();
|
53041
|
+
import_update_check = __toESM(require_update_check());
|
53042
|
+
init_package();
|
53043
|
+
__name(doUpdateCheck, "doUpdateCheck");
|
53044
|
+
__name(updateCheck, "updateCheck");
|
53045
|
+
}
|
53046
|
+
});
|
53047
|
+
|
53048
|
+
// src/vectorize/fetcher.ts
|
53049
|
+
function MakeVectorizeFetcher(complianceConfig, indexId) {
|
53050
|
+
return async function(request4) {
|
53051
|
+
const accountId = await getAccountId(complianceConfig);
|
53052
|
+
request4.headers.delete("Host");
|
53053
|
+
request4.headers.delete("Content-Length");
|
53054
|
+
let op = request4.url.split("/").pop() || "";
|
53055
|
+
op = URL_SUBSTITUTIONS.get(op) || op;
|
53056
|
+
const base = `/accounts/${accountId}/vectorize/v2/indexes/${indexId}/`;
|
53057
|
+
const url4 = base + op;
|
53058
|
+
const res = await performApiFetch(complianceConfig, url4, {
|
53059
|
+
method: request4.method,
|
53060
|
+
headers: Object.fromEntries(request4.headers.entries()),
|
53061
|
+
body: request4.body,
|
53062
|
+
duplex: "half"
|
53063
|
+
});
|
53064
|
+
const respHeaders = new import_miniflare6.Headers(res.headers);
|
53065
|
+
respHeaders.delete("Host");
|
53066
|
+
respHeaders.delete("Content-Length");
|
53067
|
+
const apiResponse = await res.json();
|
53068
|
+
const newResponse = apiResponse.success ? apiResponse.result : {
|
53069
|
+
error: apiResponse.errors[0].message,
|
53070
|
+
code: apiResponse.errors[0].code
|
53071
|
+
};
|
53072
|
+
return new import_miniflare6.Response(JSON.stringify(newResponse), {
|
53073
|
+
status: res.status,
|
53074
|
+
headers: respHeaders
|
53075
|
+
});
|
53076
|
+
};
|
53077
|
+
}
|
53078
|
+
var import_miniflare6, EXTERNAL_VECTORIZE_WORKER_NAME, EXTERNAL_VECTORIZE_WORKER_SCRIPT, URL_SUBSTITUTIONS;
|
53079
|
+
var init_fetcher3 = __esm({
|
53080
|
+
"src/vectorize/fetcher.ts"() {
|
53081
|
+
init_import_meta_url();
|
53082
|
+
import_miniflare6 = require("miniflare");
|
53083
|
+
init_internal();
|
53084
|
+
init_user2();
|
53085
|
+
EXTERNAL_VECTORIZE_WORKER_NAME = "__WRANGLER_EXTERNAL_VECTORIZE_WORKER";
|
53086
|
+
EXTERNAL_VECTORIZE_WORKER_SCRIPT = `
|
53087
|
+
import makeBinding from 'cloudflare-internal:vectorize-api'
|
53088
|
+
|
53089
|
+
export default function (env) {
|
53090
|
+
return makeBinding({
|
53091
|
+
fetcher: env.FETCHER,
|
53092
|
+
indexId: env.INDEX_ID,
|
53093
|
+
indexVersion: env.INDEX_VERSION,
|
53094
|
+
useNdJson: true,
|
53095
|
+
});
|
53096
|
+
}
|
53097
|
+
`;
|
53098
|
+
URL_SUBSTITUTIONS = /* @__PURE__ */ new Map([
|
53099
|
+
["getByIds", "get_by_ids"],
|
53100
|
+
["deleteByIds", "delete_by_ids"]
|
53101
|
+
]);
|
53102
|
+
__name(MakeVectorizeFetcher, "MakeVectorizeFetcher");
|
53103
|
+
}
|
53104
|
+
});
|
53105
|
+
|
53106
|
+
// src/dev/class-names-sqlite.ts
|
53107
|
+
function getClassNamesWhichUseSQLite(migrations) {
|
53108
|
+
const classNamesWhichUseSQLite = /* @__PURE__ */ new Map();
|
53109
|
+
(migrations || []).forEach((migration) => {
|
53110
|
+
migration.deleted_classes?.forEach((deleted_class) => {
|
53111
|
+
if (!classNamesWhichUseSQLite.delete(deleted_class)) {
|
53112
|
+
throw new UserError(
|
53113
|
+
`Cannot apply deleted_classes migration to non-existent class ${deleted_class}`
|
53114
|
+
);
|
53115
|
+
}
|
53116
|
+
});
|
53117
|
+
migration.renamed_classes?.forEach(({ from, to }) => {
|
53118
|
+
const useSQLite = classNamesWhichUseSQLite.get(from);
|
53119
|
+
if (useSQLite === void 0) {
|
53120
|
+
throw new UserError(
|
53121
|
+
`Cannot apply renamed_classes migration to non-existent class ${from}`
|
53122
|
+
);
|
53123
|
+
} else {
|
53124
|
+
classNamesWhichUseSQLite.delete(from);
|
53125
|
+
classNamesWhichUseSQLite.set(to, useSQLite);
|
53126
|
+
}
|
53127
|
+
});
|
53128
|
+
migration.new_classes?.forEach((new_class) => {
|
53129
|
+
if (classNamesWhichUseSQLite.has(new_class)) {
|
53130
|
+
throw new UserError(
|
53131
|
+
`Cannot apply new_classes migration to existing class ${new_class}`
|
53132
|
+
);
|
53133
|
+
} else {
|
53134
|
+
classNamesWhichUseSQLite.set(new_class, false);
|
53135
|
+
}
|
53136
|
+
});
|
53137
|
+
migration.new_sqlite_classes?.forEach((new_class) => {
|
53138
|
+
if (classNamesWhichUseSQLite.has(new_class)) {
|
53139
|
+
throw new UserError(
|
53140
|
+
`Cannot apply new_sqlite_classes migration to existing class ${new_class}`
|
53141
|
+
);
|
53142
|
+
} else {
|
53143
|
+
classNamesWhichUseSQLite.set(new_class, true);
|
53144
|
+
}
|
53145
|
+
});
|
53146
|
+
});
|
53147
|
+
return classNamesWhichUseSQLite;
|
53148
|
+
}
|
53149
|
+
var init_class_names_sqlite = __esm({
|
53150
|
+
"src/dev/class-names-sqlite.ts"() {
|
53151
|
+
init_import_meta_url();
|
53152
|
+
init_errors();
|
53153
|
+
__name(getClassNamesWhichUseSQLite, "getClassNamesWhichUseSQLite");
|
53154
|
+
}
|
53155
|
+
});
|
53156
|
+
|
51843
53157
|
// ../workers-shared/utils/constants.ts
|
51844
53158
|
var PATH_HASH_SIZE, CONTENT_HASH_SIZE, TAIL_SIZE, ENTRY_SIZE, MAX_ASSET_COUNT2, MAX_ASSET_SIZE2, CF_ASSETS_IGNORE_FILENAME, REDIRECTS_FILENAME, HEADERS_FILENAME;
|
51845
53159
|
var init_constants2 = __esm({
|
@@ -56560,1530 +57874,514 @@ var init_parseHeaders = __esm({
|
|
56560
57874
|
function parseRedirects(input, {
|
56561
57875
|
maxStaticRules = MAX_STATIC_REDIRECT_RULES,
|
56562
57876
|
maxDynamicRules = MAX_DYNAMIC_REDIRECT_RULES,
|
56563
|
-
maxLineLength = MAX_LINE_LENGTH
|
56564
|
-
} = {}) {
|
56565
|
-
const lines = input.split("\n");
|
56566
|
-
const rules = [];
|
56567
|
-
const seen_paths = /* @__PURE__ */ new Set();
|
56568
|
-
const invalid = [];
|
56569
|
-
let staticRules = 0;
|
56570
|
-
let dynamicRules = 0;
|
56571
|
-
let canCreateStaticRule = true;
|
56572
|
-
for (let i5 = 0; i5 < lines.length; i5++) {
|
56573
|
-
const line = (lines[i5] || "").trim();
|
56574
|
-
if (line.length === 0 || line.startsWith("#")) {
|
56575
|
-
continue;
|
56576
|
-
}
|
56577
|
-
if (line.length > maxLineLength) {
|
56578
|
-
invalid.push({
|
56579
|
-
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
|
56580
|
-
});
|
56581
|
-
continue;
|
56582
|
-
}
|
56583
|
-
const tokens = line.split(/\s+/);
|
56584
|
-
if (tokens.length < 2 || tokens.length > 3) {
|
56585
|
-
invalid.push({
|
56586
|
-
line,
|
56587
|
-
lineNumber: i5 + 1,
|
56588
|
-
message: `Expected exactly 2 or 3 whitespace-separated tokens. Got ${tokens.length}.`
|
56589
|
-
});
|
56590
|
-
continue;
|
56591
|
-
}
|
56592
|
-
const [str_from, str_to, str_status = "302"] = tokens;
|
56593
|
-
const fromResult = validateUrl(str_from, true, true, false, false);
|
56594
|
-
if (fromResult[0] === void 0) {
|
56595
|
-
invalid.push({
|
56596
|
-
line,
|
56597
|
-
lineNumber: i5 + 1,
|
56598
|
-
message: fromResult[1]
|
56599
|
-
});
|
56600
|
-
continue;
|
56601
|
-
}
|
56602
|
-
const from = fromResult[0];
|
56603
|
-
if (canCreateStaticRule && !from.match(SPLAT_REGEX) && !from.match(PLACEHOLDER_REGEX)) {
|
56604
|
-
staticRules += 1;
|
56605
|
-
if (staticRules > maxStaticRules) {
|
56606
|
-
invalid.push({
|
56607
|
-
message: `Maximum number of static rules supported is ${maxStaticRules}. Skipping line.`
|
56608
|
-
});
|
56609
|
-
continue;
|
56610
|
-
}
|
56611
|
-
} else {
|
56612
|
-
dynamicRules += 1;
|
56613
|
-
canCreateStaticRule = false;
|
56614
|
-
if (dynamicRules > maxDynamicRules) {
|
56615
|
-
invalid.push({
|
56616
|
-
message: `Maximum number of dynamic rules supported is ${maxDynamicRules}. Skipping remaining ${lines.length - i5} lines of file.`
|
56617
|
-
});
|
56618
|
-
break;
|
56619
|
-
}
|
56620
|
-
}
|
56621
|
-
const toResult = validateUrl(str_to, false, false, true, true);
|
56622
|
-
if (toResult[0] === void 0) {
|
56623
|
-
invalid.push({
|
56624
|
-
line,
|
56625
|
-
lineNumber: i5 + 1,
|
56626
|
-
message: toResult[1]
|
56627
|
-
});
|
56628
|
-
continue;
|
56629
|
-
}
|
56630
|
-
const to = toResult[0];
|
56631
|
-
const status2 = Number(str_status);
|
56632
|
-
if (isNaN(status2) || !PERMITTED_STATUS_CODES.has(status2)) {
|
56633
|
-
invalid.push({
|
56634
|
-
line,
|
56635
|
-
lineNumber: i5 + 1,
|
56636
|
-
message: `Valid status codes are 200, 301, 302 (default), 303, 307, or 308. Got ${str_status}.`
|
56637
|
-
});
|
56638
|
-
continue;
|
56639
|
-
}
|
56640
|
-
if (/\/\*?$/.test(from) && /\/index(.html)?$/.test(to) && !urlHasHost(to)) {
|
56641
|
-
invalid.push({
|
56642
|
-
line,
|
56643
|
-
lineNumber: i5 + 1,
|
56644
|
-
message: "Infinite loop detected in this rule and has been ignored. This will cause a redirect to strip `.html` or `/index` and end up triggering this rule again. Please fix or remove this rule to silence this warning."
|
56645
|
-
});
|
56646
|
-
continue;
|
56647
|
-
}
|
56648
|
-
if (seen_paths.has(from)) {
|
56649
|
-
invalid.push({
|
56650
|
-
line,
|
56651
|
-
lineNumber: i5 + 1,
|
56652
|
-
message: `Ignoring duplicate rule for path ${from}.`
|
56653
|
-
});
|
56654
|
-
continue;
|
56655
|
-
}
|
56656
|
-
seen_paths.add(from);
|
56657
|
-
if (status2 === 200) {
|
56658
|
-
if (urlHasHost(to)) {
|
56659
|
-
invalid.push({
|
56660
|
-
line,
|
56661
|
-
lineNumber: i5 + 1,
|
56662
|
-
message: `Proxy (200) redirects can only point to relative paths. Got ${to}`
|
56663
|
-
});
|
56664
|
-
continue;
|
56665
|
-
}
|
56666
|
-
}
|
56667
|
-
rules.push({ from, to, status: status2, lineNumber: i5 + 1 });
|
56668
|
-
}
|
56669
|
-
return {
|
56670
|
-
rules,
|
56671
|
-
invalid
|
56672
|
-
};
|
56673
|
-
}
|
56674
|
-
var init_parseRedirects = __esm({
|
56675
|
-
"../workers-shared/utils/configuration/parseRedirects.ts"() {
|
56676
|
-
init_import_meta_url();
|
56677
|
-
init_constants3();
|
56678
|
-
init_validateURL();
|
56679
|
-
__name(parseRedirects, "parseRedirects");
|
56680
|
-
}
|
56681
|
-
});
|
56682
|
-
|
56683
|
-
// ../workers-shared/utils/configuration/types.ts
|
56684
|
-
var init_types3 = __esm({
|
56685
|
-
"../workers-shared/utils/configuration/types.ts"() {
|
56686
|
-
init_import_meta_url();
|
56687
|
-
}
|
56688
|
-
});
|
56689
|
-
|
56690
|
-
// ../workers-shared/index.ts
|
56691
|
-
var init_workers_shared = __esm({
|
56692
|
-
"../workers-shared/index.ts"() {
|
56693
|
-
init_import_meta_url();
|
56694
|
-
init_constants2();
|
56695
|
-
init_types2();
|
56696
|
-
init_helpers2();
|
56697
|
-
init_parseHeaders();
|
56698
|
-
init_parseRedirects();
|
56699
|
-
init_types3();
|
56700
|
-
}
|
56701
|
-
});
|
56702
|
-
|
56703
|
-
// src/sourcemap.ts
|
56704
|
-
function maybeRetrieveFileSourceMap(filePath) {
|
56705
|
-
if (filePath === void 0) {
|
56706
|
-
return null;
|
56707
|
-
}
|
56708
|
-
const contents = maybeGetFile(filePath);
|
56709
|
-
if (contents === void 0) {
|
56710
|
-
return null;
|
56711
|
-
}
|
56712
|
-
const mapRegexp = /# sourceMappingURL=(.+)/g;
|
56713
|
-
const matches = [...contents.matchAll(mapRegexp)];
|
56714
|
-
if (matches.length === 0) {
|
56715
|
-
return null;
|
56716
|
-
}
|
56717
|
-
const mapMatch = matches[matches.length - 1];
|
56718
|
-
const fileUrl = import_node_url6.default.pathToFileURL(filePath);
|
56719
|
-
const mapUrl = new URL(mapMatch[1], fileUrl);
|
56720
|
-
if (mapUrl.protocol === "data:" && mapUrl.pathname.startsWith("application/json;base64,")) {
|
56721
|
-
const base642 = mapUrl.href.substring(mapUrl.href.indexOf(",") + 1);
|
56722
|
-
const map2 = Buffer.from(base642, "base64").toString();
|
56723
|
-
return { map: map2, url: fileUrl.href };
|
56724
|
-
} else {
|
56725
|
-
const map2 = maybeGetFile(mapUrl);
|
56726
|
-
if (map2 === void 0) {
|
56727
|
-
return null;
|
56728
|
-
}
|
56729
|
-
return { map: map2, url: mapUrl.href };
|
56730
|
-
}
|
56731
|
-
}
|
56732
|
-
function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
|
56733
|
-
retrieveSourceMapOverride = retrieveSourceMap;
|
56734
|
-
if (sourceMappingPrepareStackTrace !== void 0) {
|
56735
|
-
return sourceMappingPrepareStackTrace;
|
56736
|
-
}
|
56737
|
-
const support = (0, import_miniflare6.getFreshSourceMapSupport)();
|
56738
|
-
const originalPrepareStackTrace = Error.prepareStackTrace;
|
56739
|
-
support.install({
|
56740
|
-
environment: "node",
|
56741
|
-
// Don't add Node `uncaughtException` handler
|
56742
|
-
handleUncaughtExceptions: false,
|
56743
|
-
// Don't hook Node `require` function
|
56744
|
-
hookRequire: false,
|
56745
|
-
redirectConflictingLibrary: false,
|
56746
|
-
// Make sure we're using fresh copies of files each time we source map
|
56747
|
-
emptyCacheBetweenOperations: true,
|
56748
|
-
// Allow retriever to be overridden at prepare stack trace time
|
56749
|
-
retrieveSourceMap(path72) {
|
56750
|
-
return retrieveSourceMapOverride?.(path72) ?? null;
|
56751
|
-
}
|
56752
|
-
});
|
56753
|
-
sourceMappingPrepareStackTrace = Error.prepareStackTrace;
|
56754
|
-
(0, import_node_assert4.default)(sourceMappingPrepareStackTrace !== void 0);
|
56755
|
-
Error.prepareStackTrace = originalPrepareStackTrace;
|
56756
|
-
return sourceMappingPrepareStackTrace;
|
56757
|
-
}
|
56758
|
-
function getSourceMappedStack(details) {
|
56759
|
-
const description = details.exception?.description ?? "";
|
56760
|
-
const callFrames = details.stackTrace?.callFrames;
|
56761
|
-
if (callFrames === void 0) {
|
56762
|
-
return description;
|
56763
|
-
}
|
56764
|
-
const nameMessage = details.exception?.description?.split("\n")[0] ?? "";
|
56765
|
-
const colonIndex = nameMessage.indexOf(":");
|
56766
|
-
const error2 = new Error(nameMessage.substring(colonIndex + 2));
|
56767
|
-
error2.name = nameMessage.substring(0, colonIndex);
|
56768
|
-
const callSites = callFrames.map(callFrameToCallSite);
|
56769
|
-
return getSourceMappingPrepareStackTrace()(error2, callSites);
|
56770
|
-
}
|
56771
|
-
function callFrameToCallSite(frame) {
|
56772
|
-
return new CallSite({
|
56773
|
-
typeName: null,
|
56774
|
-
functionName: frame.functionName,
|
56775
|
-
methodName: null,
|
56776
|
-
fileName: frame.url,
|
56777
|
-
lineNumber: frame.lineNumber + 1,
|
56778
|
-
columnNumber: frame.columnNumber + 1,
|
56779
|
-
native: false
|
56780
|
-
});
|
56781
|
-
}
|
56782
|
-
function getSourceMappedString(value, retrieveSourceMap) {
|
56783
|
-
const callSiteLines = Array.from(value.matchAll(CALL_SITE_REGEXP));
|
56784
|
-
const callSites = callSiteLines.map(lineMatchToCallSite);
|
56785
|
-
const prepareStack = getSourceMappingPrepareStackTrace(retrieveSourceMap);
|
56786
|
-
const sourceMappedStackTrace = prepareStack(
|
56787
|
-
placeholderError,
|
56788
|
-
callSites
|
56789
|
-
);
|
56790
|
-
const sourceMappedCallSiteLines = sourceMappedStackTrace.split("\n").slice(1);
|
56791
|
-
for (let i5 = 0; i5 < callSiteLines.length; i5++) {
|
56792
|
-
if (callSites[i5].getFileName() === void 0) {
|
56793
|
-
continue;
|
56794
|
-
}
|
56795
|
-
const callSiteLine = callSiteLines[i5][0];
|
56796
|
-
const callSiteAtIndex = callSiteLine.indexOf("at");
|
56797
|
-
(0, import_node_assert4.default)(callSiteAtIndex !== -1);
|
56798
|
-
const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
|
56799
|
-
value = value.replace(
|
56800
|
-
callSiteLine,
|
56801
|
-
callSiteLineLeftPad + sourceMappedCallSiteLines[i5].trimStart()
|
56802
|
-
);
|
56803
|
-
}
|
56804
|
-
return value;
|
56805
|
-
}
|
56806
|
-
function lineMatchToCallSite(lineMatch) {
|
56807
|
-
let object = null;
|
56808
|
-
let method = null;
|
56809
|
-
let functionName = null;
|
56810
|
-
let typeName = null;
|
56811
|
-
let methodName = null;
|
56812
|
-
const isNative = lineMatch[5] === "native";
|
56813
|
-
if (lineMatch[1]) {
|
56814
|
-
functionName = lineMatch[1];
|
56815
|
-
let methodStart = functionName.lastIndexOf(".");
|
56816
|
-
if (functionName[methodStart - 1] == ".") {
|
56817
|
-
methodStart--;
|
56818
|
-
}
|
56819
|
-
if (methodStart > 0) {
|
56820
|
-
object = functionName.substring(0, methodStart);
|
56821
|
-
method = functionName.substring(methodStart + 1);
|
56822
|
-
const objectEnd = object.indexOf(".Module");
|
56823
|
-
if (objectEnd > 0) {
|
56824
|
-
functionName = functionName.substring(objectEnd + 1);
|
56825
|
-
object = object.substring(0, objectEnd);
|
56826
|
-
}
|
56827
|
-
}
|
56828
|
-
}
|
56829
|
-
if (method) {
|
56830
|
-
typeName = object;
|
56831
|
-
methodName = method;
|
56832
|
-
}
|
56833
|
-
if (method === "<anonymous>") {
|
56834
|
-
methodName = null;
|
56835
|
-
functionName = null;
|
56836
|
-
}
|
56837
|
-
return new CallSite({
|
56838
|
-
typeName,
|
56839
|
-
functionName,
|
56840
|
-
methodName,
|
56841
|
-
fileName: lineMatch[2],
|
56842
|
-
lineNumber: parseInt(lineMatch[3]) || null,
|
56843
|
-
columnNumber: parseInt(lineMatch[4]) || null,
|
56844
|
-
native: isNative
|
56845
|
-
});
|
56846
|
-
}
|
56847
|
-
var import_node_assert4, import_node_url6, import_miniflare6, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite;
|
56848
|
-
var init_sourcemap = __esm({
|
56849
|
-
"src/sourcemap.ts"() {
|
56850
|
-
init_import_meta_url();
|
56851
|
-
import_node_assert4 = __toESM(require("assert"));
|
56852
|
-
import_node_url6 = __toESM(require("url"));
|
56853
|
-
init_workers_shared();
|
56854
|
-
import_miniflare6 = require("miniflare");
|
56855
|
-
__name(maybeRetrieveFileSourceMap, "maybeRetrieveFileSourceMap");
|
56856
|
-
__name(getSourceMappingPrepareStackTrace, "getSourceMappingPrepareStackTrace");
|
56857
|
-
__name(getSourceMappedStack, "getSourceMappedStack");
|
56858
|
-
__name(callFrameToCallSite, "callFrameToCallSite");
|
56859
|
-
placeholderError = new Error();
|
56860
|
-
__name(getSourceMappedString, "getSourceMappedString");
|
56861
|
-
CALL_SITE_REGEXP = // Validation errors from `wrangler deploy` have a 2 space indent, whereas
|
56862
|
-
// regular stack traces have a 4 space indent.
|
56863
|
-
// eslint-disable-next-line no-control-regex
|
56864
|
-
/^(?:\s+(?:\x1B\[\d+m)?'?)? {2,4}at (?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/gm;
|
56865
|
-
__name(lineMatchToCallSite, "lineMatchToCallSite");
|
56866
|
-
CallSite = class {
|
56867
|
-
constructor(opts) {
|
56868
|
-
this.opts = opts;
|
56869
|
-
}
|
56870
|
-
static {
|
56871
|
-
__name(this, "CallSite");
|
56872
|
-
}
|
56873
|
-
getScriptHash() {
|
56874
|
-
throw new Error("Method not implemented.");
|
56875
|
-
}
|
56876
|
-
getEnclosingColumnNumber() {
|
56877
|
-
throw new Error("Method not implemented.");
|
56878
|
-
}
|
56879
|
-
getEnclosingLineNumber() {
|
56880
|
-
throw new Error("Method not implemented.");
|
56881
|
-
}
|
56882
|
-
getPosition() {
|
56883
|
-
throw new Error("Method not implemented.");
|
56884
|
-
}
|
56885
|
-
getThis() {
|
56886
|
-
return null;
|
56887
|
-
}
|
56888
|
-
getTypeName() {
|
56889
|
-
return this.opts.typeName;
|
56890
|
-
}
|
56891
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
56892
|
-
getFunction() {
|
56893
|
-
return void 0;
|
56894
|
-
}
|
56895
|
-
getFunctionName() {
|
56896
|
-
return this.opts.functionName;
|
56897
|
-
}
|
56898
|
-
getMethodName() {
|
56899
|
-
return this.opts.methodName;
|
56900
|
-
}
|
56901
|
-
getFileName() {
|
56902
|
-
return this.opts.fileName ?? null;
|
56903
|
-
}
|
56904
|
-
getScriptNameOrSourceURL() {
|
56905
|
-
return this.opts.fileName;
|
56906
|
-
}
|
56907
|
-
getLineNumber() {
|
56908
|
-
return this.opts.lineNumber;
|
56909
|
-
}
|
56910
|
-
getColumnNumber() {
|
56911
|
-
return this.opts.columnNumber;
|
56912
|
-
}
|
56913
|
-
getEvalOrigin() {
|
56914
|
-
return void 0;
|
56915
|
-
}
|
56916
|
-
isToplevel() {
|
56917
|
-
return false;
|
56918
|
-
}
|
56919
|
-
isEval() {
|
56920
|
-
return false;
|
56921
|
-
}
|
56922
|
-
isNative() {
|
56923
|
-
return this.opts.native;
|
56924
|
-
}
|
56925
|
-
isConstructor() {
|
56926
|
-
return false;
|
56927
|
-
}
|
56928
|
-
isAsync() {
|
56929
|
-
return false;
|
56930
|
-
}
|
56931
|
-
isPromiseAll() {
|
56932
|
-
return false;
|
56933
|
-
}
|
56934
|
-
isPromiseAny() {
|
56935
|
-
return false;
|
56936
|
-
}
|
56937
|
-
getPromiseIndex() {
|
56938
|
-
return null;
|
56939
|
-
}
|
56940
|
-
};
|
56941
|
-
}
|
56942
|
-
});
|
56943
|
-
|
56944
|
-
// ../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js
|
56945
|
-
var require_ini = __commonJS({
|
56946
|
-
"../../node_modules/.pnpm/ini@1.3.8/node_modules/ini/ini.js"(exports2) {
|
56947
|
-
init_import_meta_url();
|
56948
|
-
exports2.parse = exports2.decode = decode;
|
56949
|
-
exports2.stringify = exports2.encode = encode;
|
56950
|
-
exports2.safe = safe;
|
56951
|
-
exports2.unsafe = unsafe;
|
56952
|
-
var eol = typeof process !== "undefined" && process.platform === "win32" ? "\r\n" : "\n";
|
56953
|
-
function encode(obj, opt) {
|
56954
|
-
var children = [];
|
56955
|
-
var out = "";
|
56956
|
-
if (typeof opt === "string") {
|
56957
|
-
opt = {
|
56958
|
-
section: opt,
|
56959
|
-
whitespace: false
|
56960
|
-
};
|
56961
|
-
} else {
|
56962
|
-
opt = opt || {};
|
56963
|
-
opt.whitespace = opt.whitespace === true;
|
56964
|
-
}
|
56965
|
-
var separator = opt.whitespace ? " = " : "=";
|
56966
|
-
Object.keys(obj).forEach(function(k6, _4, __) {
|
56967
|
-
var val2 = obj[k6];
|
56968
|
-
if (val2 && Array.isArray(val2)) {
|
56969
|
-
val2.forEach(function(item) {
|
56970
|
-
out += safe(k6 + "[]") + separator + safe(item) + "\n";
|
56971
|
-
});
|
56972
|
-
} else if (val2 && typeof val2 === "object")
|
56973
|
-
children.push(k6);
|
56974
|
-
else
|
56975
|
-
out += safe(k6) + separator + safe(val2) + eol;
|
56976
|
-
});
|
56977
|
-
if (opt.section && out.length)
|
56978
|
-
out = "[" + safe(opt.section) + "]" + eol + out;
|
56979
|
-
children.forEach(function(k6, _4, __) {
|
56980
|
-
var nk = dotSplit(k6).join("\\.");
|
56981
|
-
var section = (opt.section ? opt.section + "." : "") + nk;
|
56982
|
-
var child = encode(obj[k6], {
|
56983
|
-
section,
|
56984
|
-
whitespace: opt.whitespace
|
56985
|
-
});
|
56986
|
-
if (out.length && child.length)
|
56987
|
-
out += eol;
|
56988
|
-
out += child;
|
56989
|
-
});
|
56990
|
-
return out;
|
56991
|
-
}
|
56992
|
-
__name(encode, "encode");
|
56993
|
-
function dotSplit(str) {
|
56994
|
-
return str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map(function(part) {
|
56995
|
-
return part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, "");
|
56996
|
-
});
|
56997
|
-
}
|
56998
|
-
__name(dotSplit, "dotSplit");
|
56999
|
-
function decode(str) {
|
57000
|
-
var out = {};
|
57001
|
-
var p6 = out;
|
57002
|
-
var section = null;
|
57003
|
-
var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
|
57004
|
-
var lines = str.split(/[\r\n]+/g);
|
57005
|
-
lines.forEach(function(line, _4, __) {
|
57006
|
-
if (!line || line.match(/^\s*[;#]/))
|
57007
|
-
return;
|
57008
|
-
var match2 = line.match(re);
|
57009
|
-
if (!match2)
|
57010
|
-
return;
|
57011
|
-
if (match2[1] !== void 0) {
|
57012
|
-
section = unsafe(match2[1]);
|
57013
|
-
if (section === "__proto__") {
|
57014
|
-
p6 = {};
|
57015
|
-
return;
|
57016
|
-
}
|
57017
|
-
p6 = out[section] = out[section] || {};
|
57018
|
-
return;
|
57019
|
-
}
|
57020
|
-
var key = unsafe(match2[2]);
|
57021
|
-
if (key === "__proto__")
|
57022
|
-
return;
|
57023
|
-
var value = match2[3] ? unsafe(match2[4]) : true;
|
57024
|
-
switch (value) {
|
57025
|
-
case "true":
|
57026
|
-
case "false":
|
57027
|
-
case "null":
|
57028
|
-
value = JSON.parse(value);
|
57029
|
-
}
|
57030
|
-
if (key.length > 2 && key.slice(-2) === "[]") {
|
57031
|
-
key = key.substring(0, key.length - 2);
|
57032
|
-
if (key === "__proto__")
|
57033
|
-
return;
|
57034
|
-
if (!p6[key])
|
57035
|
-
p6[key] = [];
|
57036
|
-
else if (!Array.isArray(p6[key]))
|
57037
|
-
p6[key] = [p6[key]];
|
57038
|
-
}
|
57039
|
-
if (Array.isArray(p6[key]))
|
57040
|
-
p6[key].push(value);
|
57041
|
-
else
|
57042
|
-
p6[key] = value;
|
57043
|
-
});
|
57044
|
-
Object.keys(out).filter(function(k6, _4, __) {
|
57045
|
-
if (!out[k6] || typeof out[k6] !== "object" || Array.isArray(out[k6]))
|
57046
|
-
return false;
|
57047
|
-
var parts = dotSplit(k6);
|
57048
|
-
var p7 = out;
|
57049
|
-
var l6 = parts.pop();
|
57050
|
-
var nl = l6.replace(/\\\./g, ".");
|
57051
|
-
parts.forEach(function(part, _5, __2) {
|
57052
|
-
if (part === "__proto__")
|
57053
|
-
return;
|
57054
|
-
if (!p7[part] || typeof p7[part] !== "object")
|
57055
|
-
p7[part] = {};
|
57056
|
-
p7 = p7[part];
|
57057
|
-
});
|
57058
|
-
if (p7 === out && nl === l6)
|
57059
|
-
return false;
|
57060
|
-
p7[nl] = out[k6];
|
57061
|
-
return true;
|
57062
|
-
}).forEach(function(del, _4, __) {
|
57063
|
-
delete out[del];
|
57064
|
-
});
|
57065
|
-
return out;
|
57066
|
-
}
|
57067
|
-
__name(decode, "decode");
|
57068
|
-
function isQuoted(val2) {
|
57069
|
-
return val2.charAt(0) === '"' && val2.slice(-1) === '"' || val2.charAt(0) === "'" && val2.slice(-1) === "'";
|
57070
|
-
}
|
57071
|
-
__name(isQuoted, "isQuoted");
|
57072
|
-
function safe(val2) {
|
57073
|
-
return typeof val2 !== "string" || val2.match(/[=\r\n]/) || val2.match(/^\[/) || val2.length > 1 && isQuoted(val2) || val2 !== val2.trim() ? JSON.stringify(val2) : val2.replace(/;/g, "\\;").replace(/#/g, "\\#");
|
57074
|
-
}
|
57075
|
-
__name(safe, "safe");
|
57076
|
-
function unsafe(val2, doUnesc) {
|
57077
|
-
val2 = (val2 || "").trim();
|
57078
|
-
if (isQuoted(val2)) {
|
57079
|
-
if (val2.charAt(0) === "'")
|
57080
|
-
val2 = val2.substr(1, val2.length - 2);
|
57081
|
-
try {
|
57082
|
-
val2 = JSON.parse(val2);
|
57083
|
-
} catch (_4) {
|
57084
|
-
}
|
57085
|
-
} else {
|
57086
|
-
var esc = false;
|
57087
|
-
var unesc = "";
|
57088
|
-
for (var i5 = 0, l6 = val2.length; i5 < l6; i5++) {
|
57089
|
-
var c6 = val2.charAt(i5);
|
57090
|
-
if (esc) {
|
57091
|
-
if ("\\;#".indexOf(c6) !== -1)
|
57092
|
-
unesc += c6;
|
57093
|
-
else
|
57094
|
-
unesc += "\\" + c6;
|
57095
|
-
esc = false;
|
57096
|
-
} else if (";#".indexOf(c6) !== -1)
|
57097
|
-
break;
|
57098
|
-
else if (c6 === "\\")
|
57099
|
-
esc = true;
|
57100
|
-
else
|
57101
|
-
unesc += c6;
|
57102
|
-
}
|
57103
|
-
if (esc)
|
57104
|
-
unesc += "\\";
|
57105
|
-
return unesc.trim();
|
57106
|
-
}
|
57107
|
-
return val2;
|
57108
|
-
}
|
57109
|
-
__name(unsafe, "unsafe");
|
57110
|
-
}
|
57111
|
-
});
|
57112
|
-
|
57113
|
-
// ../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js
|
57114
|
-
var require_strip_json_comments = __commonJS({
|
57115
|
-
"../../node_modules/.pnpm/strip-json-comments@2.0.1/node_modules/strip-json-comments/index.js"(exports2, module3) {
|
57116
|
-
"use strict";
|
57117
|
-
init_import_meta_url();
|
57118
|
-
var singleComment = 1;
|
57119
|
-
var multiComment = 2;
|
57120
|
-
function stripWithoutWhitespace() {
|
57121
|
-
return "";
|
57122
|
-
}
|
57123
|
-
__name(stripWithoutWhitespace, "stripWithoutWhitespace");
|
57124
|
-
function stripWithWhitespace(str, start, end) {
|
57125
|
-
return str.slice(start, end).replace(/\S/g, " ");
|
57126
|
-
}
|
57127
|
-
__name(stripWithWhitespace, "stripWithWhitespace");
|
57128
|
-
module3.exports = function(str, opts) {
|
57129
|
-
opts = opts || {};
|
57130
|
-
var currentChar;
|
57131
|
-
var nextChar;
|
57132
|
-
var insideString = false;
|
57133
|
-
var insideComment = false;
|
57134
|
-
var offset = 0;
|
57135
|
-
var ret = "";
|
57136
|
-
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
|
57137
|
-
for (var i5 = 0; i5 < str.length; i5++) {
|
57138
|
-
currentChar = str[i5];
|
57139
|
-
nextChar = str[i5 + 1];
|
57140
|
-
if (!insideComment && currentChar === '"') {
|
57141
|
-
var escaped = str[i5 - 1] === "\\" && str[i5 - 2] !== "\\";
|
57142
|
-
if (!escaped) {
|
57143
|
-
insideString = !insideString;
|
57144
|
-
}
|
57145
|
-
}
|
57146
|
-
if (insideString) {
|
57147
|
-
continue;
|
57148
|
-
}
|
57149
|
-
if (!insideComment && currentChar + nextChar === "//") {
|
57150
|
-
ret += str.slice(offset, i5);
|
57151
|
-
offset = i5;
|
57152
|
-
insideComment = singleComment;
|
57153
|
-
i5++;
|
57154
|
-
} else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
|
57155
|
-
i5++;
|
57156
|
-
insideComment = false;
|
57157
|
-
ret += strip(str, offset, i5);
|
57158
|
-
offset = i5;
|
57159
|
-
continue;
|
57160
|
-
} else if (insideComment === singleComment && currentChar === "\n") {
|
57161
|
-
insideComment = false;
|
57162
|
-
ret += strip(str, offset, i5);
|
57163
|
-
offset = i5;
|
57164
|
-
} else if (!insideComment && currentChar + nextChar === "/*") {
|
57165
|
-
ret += str.slice(offset, i5);
|
57166
|
-
offset = i5;
|
57167
|
-
insideComment = multiComment;
|
57168
|
-
i5++;
|
57169
|
-
continue;
|
57170
|
-
} else if (insideComment === multiComment && currentChar + nextChar === "*/") {
|
57171
|
-
i5++;
|
57172
|
-
insideComment = false;
|
57173
|
-
ret += strip(str, offset, i5 + 1);
|
57174
|
-
offset = i5 + 1;
|
57175
|
-
continue;
|
57176
|
-
}
|
57177
|
-
}
|
57178
|
-
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
57179
|
-
};
|
57180
|
-
}
|
57181
|
-
});
|
57182
|
-
|
57183
|
-
// ../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js
|
57184
|
-
var require_utils3 = __commonJS({
|
57185
|
-
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports2) {
|
57186
|
-
"use strict";
|
57187
|
-
init_import_meta_url();
|
57188
|
-
var fs24 = require("fs");
|
57189
|
-
var ini = require_ini();
|
57190
|
-
var path72 = require("path");
|
57191
|
-
var stripJsonComments = require_strip_json_comments();
|
57192
|
-
var parse7 = exports2.parse = function(content) {
|
57193
|
-
if (/^\s*{/.test(content))
|
57194
|
-
return JSON.parse(stripJsonComments(content));
|
57195
|
-
return ini.parse(content);
|
57196
|
-
};
|
57197
|
-
var file = exports2.file = function() {
|
57198
|
-
var args = [].slice.call(arguments).filter(function(arg) {
|
57199
|
-
return arg != null;
|
57200
|
-
});
|
57201
|
-
for (var i5 in args)
|
57202
|
-
if ("string" !== typeof args[i5])
|
57203
|
-
return;
|
57204
|
-
var file2 = path72.join.apply(null, args);
|
57205
|
-
var content;
|
57206
|
-
try {
|
57207
|
-
return fs24.readFileSync(file2, "utf-8");
|
57208
|
-
} catch (err) {
|
57209
|
-
return;
|
57210
|
-
}
|
57211
|
-
};
|
57212
|
-
var json = exports2.json = function() {
|
57213
|
-
var content = file.apply(null, arguments);
|
57214
|
-
return content ? parse7(content) : null;
|
57215
|
-
};
|
57216
|
-
var env6 = exports2.env = function(prefix, env7) {
|
57217
|
-
env7 = env7 || process.env;
|
57218
|
-
var obj = {};
|
57219
|
-
var l6 = prefix.length;
|
57220
|
-
for (var k6 in env7) {
|
57221
|
-
if (k6.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
57222
|
-
var keypath = k6.substring(l6).split("__");
|
57223
|
-
var _emptyStringIndex;
|
57224
|
-
while ((_emptyStringIndex = keypath.indexOf("")) > -1) {
|
57225
|
-
keypath.splice(_emptyStringIndex, 1);
|
57226
|
-
}
|
57227
|
-
var cursor = obj;
|
57228
|
-
keypath.forEach(/* @__PURE__ */ __name(function _buildSubObj(_subkey, i5) {
|
57229
|
-
if (!_subkey || typeof cursor !== "object")
|
57230
|
-
return;
|
57231
|
-
if (i5 === keypath.length - 1)
|
57232
|
-
cursor[_subkey] = env7[k6];
|
57233
|
-
if (cursor[_subkey] === void 0)
|
57234
|
-
cursor[_subkey] = {};
|
57235
|
-
cursor = cursor[_subkey];
|
57236
|
-
}, "_buildSubObj"));
|
57237
|
-
}
|
57238
|
-
}
|
57239
|
-
return obj;
|
57240
|
-
};
|
57241
|
-
var find = exports2.find = function() {
|
57242
|
-
var rel = path72.join.apply(null, [].slice.call(arguments));
|
57243
|
-
function find2(start, rel2) {
|
57244
|
-
var file2 = path72.join(start, rel2);
|
57245
|
-
try {
|
57246
|
-
fs24.statSync(file2);
|
57247
|
-
return file2;
|
57248
|
-
} catch (err) {
|
57249
|
-
if (path72.dirname(start) !== start)
|
57250
|
-
return find2(path72.dirname(start), rel2);
|
57251
|
-
}
|
57252
|
-
}
|
57253
|
-
__name(find2, "find");
|
57254
|
-
return find2(process.cwd(), rel);
|
57255
|
-
};
|
57256
|
-
}
|
57257
|
-
});
|
57258
|
-
|
57259
|
-
// ../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js
|
57260
|
-
var require_deep_extend = __commonJS({
|
57261
|
-
"../../node_modules/.pnpm/deep-extend@0.6.0/node_modules/deep-extend/lib/deep-extend.js"(exports2, module3) {
|
57262
|
-
"use strict";
|
57263
|
-
init_import_meta_url();
|
57264
|
-
function isSpecificValue(val2) {
|
57265
|
-
return val2 instanceof Buffer || val2 instanceof Date || val2 instanceof RegExp ? true : false;
|
57266
|
-
}
|
57267
|
-
__name(isSpecificValue, "isSpecificValue");
|
57268
|
-
function cloneSpecificValue(val2) {
|
57269
|
-
if (val2 instanceof Buffer) {
|
57270
|
-
var x6 = Buffer.alloc ? Buffer.alloc(val2.length) : new Buffer(val2.length);
|
57271
|
-
val2.copy(x6);
|
57272
|
-
return x6;
|
57273
|
-
} else if (val2 instanceof Date) {
|
57274
|
-
return new Date(val2.getTime());
|
57275
|
-
} else if (val2 instanceof RegExp) {
|
57276
|
-
return new RegExp(val2);
|
57277
|
-
} else {
|
57278
|
-
throw new Error("Unexpected situation");
|
57279
|
-
}
|
57280
|
-
}
|
57281
|
-
__name(cloneSpecificValue, "cloneSpecificValue");
|
57282
|
-
function deepCloneArray(arr) {
|
57283
|
-
var clone = [];
|
57284
|
-
arr.forEach(function(item, index) {
|
57285
|
-
if (typeof item === "object" && item !== null) {
|
57286
|
-
if (Array.isArray(item)) {
|
57287
|
-
clone[index] = deepCloneArray(item);
|
57288
|
-
} else if (isSpecificValue(item)) {
|
57289
|
-
clone[index] = cloneSpecificValue(item);
|
57290
|
-
} else {
|
57291
|
-
clone[index] = deepExtend({}, item);
|
57292
|
-
}
|
57293
|
-
} else {
|
57294
|
-
clone[index] = item;
|
57295
|
-
}
|
57296
|
-
});
|
57297
|
-
return clone;
|
57298
|
-
}
|
57299
|
-
__name(deepCloneArray, "deepCloneArray");
|
57300
|
-
function safeGetProperty(object, property) {
|
57301
|
-
return property === "__proto__" ? void 0 : object[property];
|
57302
|
-
}
|
57303
|
-
__name(safeGetProperty, "safeGetProperty");
|
57304
|
-
var deepExtend = module3.exports = function() {
|
57305
|
-
if (arguments.length < 1 || typeof arguments[0] !== "object") {
|
57306
|
-
return false;
|
57307
|
-
}
|
57308
|
-
if (arguments.length < 2) {
|
57309
|
-
return arguments[0];
|
57310
|
-
}
|
57311
|
-
var target = arguments[0];
|
57312
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
57313
|
-
var val2, src, clone;
|
57314
|
-
args.forEach(function(obj) {
|
57315
|
-
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
|
57316
|
-
return;
|
57317
|
-
}
|
57318
|
-
Object.keys(obj).forEach(function(key) {
|
57319
|
-
src = safeGetProperty(target, key);
|
57320
|
-
val2 = safeGetProperty(obj, key);
|
57321
|
-
if (val2 === target) {
|
57322
|
-
return;
|
57323
|
-
} else if (typeof val2 !== "object" || val2 === null) {
|
57324
|
-
target[key] = val2;
|
57325
|
-
return;
|
57326
|
-
} else if (Array.isArray(val2)) {
|
57327
|
-
target[key] = deepCloneArray(val2);
|
57328
|
-
return;
|
57329
|
-
} else if (isSpecificValue(val2)) {
|
57330
|
-
target[key] = cloneSpecificValue(val2);
|
57331
|
-
return;
|
57332
|
-
} else if (typeof src !== "object" || src === null || Array.isArray(src)) {
|
57333
|
-
target[key] = deepExtend({}, val2);
|
57334
|
-
return;
|
57335
|
-
} else {
|
57336
|
-
target[key] = deepExtend(src, val2);
|
57337
|
-
return;
|
57338
|
-
}
|
57339
|
-
});
|
57340
|
-
});
|
57341
|
-
return target;
|
57342
|
-
};
|
57343
|
-
}
|
57344
|
-
});
|
57345
|
-
|
57346
|
-
// ../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js
|
57347
|
-
var require_minimist = __commonJS({
|
57348
|
-
"../../node_modules/.pnpm/minimist@1.2.6/node_modules/minimist/index.js"(exports2, module3) {
|
57349
|
-
init_import_meta_url();
|
57350
|
-
module3.exports = function(args, opts) {
|
57351
|
-
if (!opts) opts = {};
|
57352
|
-
var flags2 = { bools: {}, strings: {}, unknownFn: null };
|
57353
|
-
if (typeof opts["unknown"] === "function") {
|
57354
|
-
flags2.unknownFn = opts["unknown"];
|
57355
|
-
}
|
57356
|
-
if (typeof opts["boolean"] === "boolean" && opts["boolean"]) {
|
57357
|
-
flags2.allBools = true;
|
57358
|
-
} else {
|
57359
|
-
[].concat(opts["boolean"]).filter(Boolean).forEach(function(key2) {
|
57360
|
-
flags2.bools[key2] = true;
|
57361
|
-
});
|
57362
|
-
}
|
57363
|
-
var aliases2 = {};
|
57364
|
-
Object.keys(opts.alias || {}).forEach(function(key2) {
|
57365
|
-
aliases2[key2] = [].concat(opts.alias[key2]);
|
57366
|
-
aliases2[key2].forEach(function(x6) {
|
57367
|
-
aliases2[x6] = [key2].concat(aliases2[key2].filter(function(y4) {
|
57368
|
-
return x6 !== y4;
|
57369
|
-
}));
|
57370
|
-
});
|
57371
|
-
});
|
57372
|
-
[].concat(opts.string).filter(Boolean).forEach(function(key2) {
|
57373
|
-
flags2.strings[key2] = true;
|
57374
|
-
if (aliases2[key2]) {
|
57375
|
-
flags2.strings[aliases2[key2]] = true;
|
57376
|
-
}
|
57377
|
-
});
|
57378
|
-
var defaults = opts["default"] || {};
|
57379
|
-
var argv = { _: [] };
|
57380
|
-
Object.keys(flags2.bools).forEach(function(key2) {
|
57381
|
-
setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
|
57382
|
-
});
|
57383
|
-
var notFlags = [];
|
57384
|
-
if (args.indexOf("--") !== -1) {
|
57385
|
-
notFlags = args.slice(args.indexOf("--") + 1);
|
57386
|
-
args = args.slice(0, args.indexOf("--"));
|
57387
|
-
}
|
57388
|
-
function argDefined(key2, arg2) {
|
57389
|
-
return flags2.allBools && /^--[^=]+$/.test(arg2) || flags2.strings[key2] || flags2.bools[key2] || aliases2[key2];
|
57390
|
-
}
|
57391
|
-
__name(argDefined, "argDefined");
|
57392
|
-
function setArg(key2, val2, arg2) {
|
57393
|
-
if (arg2 && flags2.unknownFn && !argDefined(key2, arg2)) {
|
57394
|
-
if (flags2.unknownFn(arg2) === false) return;
|
57395
|
-
}
|
57396
|
-
var value2 = !flags2.strings[key2] && isNumber(val2) ? Number(val2) : val2;
|
57397
|
-
setKey(argv, key2.split("."), value2);
|
57398
|
-
(aliases2[key2] || []).forEach(function(x6) {
|
57399
|
-
setKey(argv, x6.split("."), value2);
|
57400
|
-
});
|
57401
|
-
}
|
57402
|
-
__name(setArg, "setArg");
|
57403
|
-
function setKey(obj, keys, value2) {
|
57404
|
-
var o5 = obj;
|
57405
|
-
for (var i6 = 0; i6 < keys.length - 1; i6++) {
|
57406
|
-
var key2 = keys[i6];
|
57407
|
-
if (isConstructorOrProto(o5, key2)) return;
|
57408
|
-
if (o5[key2] === void 0) o5[key2] = {};
|
57409
|
-
if (o5[key2] === Object.prototype || o5[key2] === Number.prototype || o5[key2] === String.prototype) o5[key2] = {};
|
57410
|
-
if (o5[key2] === Array.prototype) o5[key2] = [];
|
57411
|
-
o5 = o5[key2];
|
57412
|
-
}
|
57413
|
-
var key2 = keys[keys.length - 1];
|
57414
|
-
if (isConstructorOrProto(o5, key2)) return;
|
57415
|
-
if (o5 === Object.prototype || o5 === Number.prototype || o5 === String.prototype) o5 = {};
|
57416
|
-
if (o5 === Array.prototype) o5 = [];
|
57417
|
-
if (o5[key2] === void 0 || flags2.bools[key2] || typeof o5[key2] === "boolean") {
|
57418
|
-
o5[key2] = value2;
|
57419
|
-
} else if (Array.isArray(o5[key2])) {
|
57420
|
-
o5[key2].push(value2);
|
57421
|
-
} else {
|
57422
|
-
o5[key2] = [o5[key2], value2];
|
57423
|
-
}
|
57424
|
-
}
|
57425
|
-
__name(setKey, "setKey");
|
57426
|
-
function aliasIsBoolean(key2) {
|
57427
|
-
return aliases2[key2].some(function(x6) {
|
57428
|
-
return flags2.bools[x6];
|
57429
|
-
});
|
57430
|
-
}
|
57431
|
-
__name(aliasIsBoolean, "aliasIsBoolean");
|
57432
|
-
for (var i5 = 0; i5 < args.length; i5++) {
|
57433
|
-
var arg = args[i5];
|
57434
|
-
if (/^--.+=/.test(arg)) {
|
57435
|
-
var m6 = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
57436
|
-
var key = m6[1];
|
57437
|
-
var value = m6[2];
|
57438
|
-
if (flags2.bools[key]) {
|
57439
|
-
value = value !== "false";
|
57440
|
-
}
|
57441
|
-
setArg(key, value, arg);
|
57442
|
-
} else if (/^--no-.+/.test(arg)) {
|
57443
|
-
var key = arg.match(/^--no-(.+)/)[1];
|
57444
|
-
setArg(key, false, arg);
|
57445
|
-
} else if (/^--.+/.test(arg)) {
|
57446
|
-
var key = arg.match(/^--(.+)/)[1];
|
57447
|
-
var next = args[i5 + 1];
|
57448
|
-
if (next !== void 0 && !/^-/.test(next) && !flags2.bools[key] && !flags2.allBools && (aliases2[key] ? !aliasIsBoolean(key) : true)) {
|
57449
|
-
setArg(key, next, arg);
|
57450
|
-
i5++;
|
57451
|
-
} else if (/^(true|false)$/.test(next)) {
|
57452
|
-
setArg(key, next === "true", arg);
|
57453
|
-
i5++;
|
57454
|
-
} else {
|
57455
|
-
setArg(key, flags2.strings[key] ? "" : true, arg);
|
57456
|
-
}
|
57457
|
-
} else if (/^-[^-]+/.test(arg)) {
|
57458
|
-
var letters = arg.slice(1, -1).split("");
|
57459
|
-
var broken = false;
|
57460
|
-
for (var j6 = 0; j6 < letters.length; j6++) {
|
57461
|
-
var next = arg.slice(j6 + 2);
|
57462
|
-
if (next === "-") {
|
57463
|
-
setArg(letters[j6], next, arg);
|
57464
|
-
continue;
|
57465
|
-
}
|
57466
|
-
if (/[A-Za-z]/.test(letters[j6]) && /=/.test(next)) {
|
57467
|
-
setArg(letters[j6], next.split("=")[1], arg);
|
57468
|
-
broken = true;
|
57469
|
-
break;
|
57470
|
-
}
|
57471
|
-
if (/[A-Za-z]/.test(letters[j6]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
|
57472
|
-
setArg(letters[j6], next, arg);
|
57473
|
-
broken = true;
|
57474
|
-
break;
|
57475
|
-
}
|
57476
|
-
if (letters[j6 + 1] && letters[j6 + 1].match(/\W/)) {
|
57477
|
-
setArg(letters[j6], arg.slice(j6 + 2), arg);
|
57478
|
-
broken = true;
|
57479
|
-
break;
|
57480
|
-
} else {
|
57481
|
-
setArg(letters[j6], flags2.strings[letters[j6]] ? "" : true, arg);
|
57482
|
-
}
|
57483
|
-
}
|
57484
|
-
var key = arg.slice(-1)[0];
|
57485
|
-
if (!broken && key !== "-") {
|
57486
|
-
if (args[i5 + 1] && !/^(-|--)[^-]/.test(args[i5 + 1]) && !flags2.bools[key] && (aliases2[key] ? !aliasIsBoolean(key) : true)) {
|
57487
|
-
setArg(key, args[i5 + 1], arg);
|
57488
|
-
i5++;
|
57489
|
-
} else if (args[i5 + 1] && /^(true|false)$/.test(args[i5 + 1])) {
|
57490
|
-
setArg(key, args[i5 + 1] === "true", arg);
|
57491
|
-
i5++;
|
57492
|
-
} else {
|
57493
|
-
setArg(key, flags2.strings[key] ? "" : true, arg);
|
57494
|
-
}
|
57495
|
-
}
|
57496
|
-
} else {
|
57497
|
-
if (!flags2.unknownFn || flags2.unknownFn(arg) !== false) {
|
57498
|
-
argv._.push(
|
57499
|
-
flags2.strings["_"] || !isNumber(arg) ? arg : Number(arg)
|
57500
|
-
);
|
57501
|
-
}
|
57502
|
-
if (opts.stopEarly) {
|
57503
|
-
argv._.push.apply(argv._, args.slice(i5 + 1));
|
57504
|
-
break;
|
57505
|
-
}
|
57506
|
-
}
|
57507
|
-
}
|
57508
|
-
Object.keys(defaults).forEach(function(key2) {
|
57509
|
-
if (!hasKey2(argv, key2.split("."))) {
|
57510
|
-
setKey(argv, key2.split("."), defaults[key2]);
|
57511
|
-
(aliases2[key2] || []).forEach(function(x6) {
|
57512
|
-
setKey(argv, x6.split("."), defaults[key2]);
|
57513
|
-
});
|
57514
|
-
}
|
57877
|
+
maxLineLength = MAX_LINE_LENGTH
|
57878
|
+
} = {}) {
|
57879
|
+
const lines = input.split("\n");
|
57880
|
+
const rules = [];
|
57881
|
+
const seen_paths = /* @__PURE__ */ new Set();
|
57882
|
+
const invalid = [];
|
57883
|
+
let staticRules = 0;
|
57884
|
+
let dynamicRules = 0;
|
57885
|
+
let canCreateStaticRule = true;
|
57886
|
+
for (let i5 = 0; i5 < lines.length; i5++) {
|
57887
|
+
const line = (lines[i5] || "").trim();
|
57888
|
+
if (line.length === 0 || line.startsWith("#")) {
|
57889
|
+
continue;
|
57890
|
+
}
|
57891
|
+
if (line.length > maxLineLength) {
|
57892
|
+
invalid.push({
|
57893
|
+
message: `Ignoring line ${i5 + 1} as it exceeds the maximum allowed length of ${maxLineLength}.`
|
57515
57894
|
});
|
57516
|
-
|
57517
|
-
|
57518
|
-
|
57519
|
-
|
57895
|
+
continue;
|
57896
|
+
}
|
57897
|
+
const tokens = line.split(/\s+/);
|
57898
|
+
if (tokens.length < 2 || tokens.length > 3) {
|
57899
|
+
invalid.push({
|
57900
|
+
line,
|
57901
|
+
lineNumber: i5 + 1,
|
57902
|
+
message: `Expected exactly 2 or 3 whitespace-separated tokens. Got ${tokens.length}.`
|
57903
|
+
});
|
57904
|
+
continue;
|
57905
|
+
}
|
57906
|
+
const [str_from, str_to, str_status = "302"] = tokens;
|
57907
|
+
const fromResult = validateUrl(str_from, true, true, false, false);
|
57908
|
+
if (fromResult[0] === void 0) {
|
57909
|
+
invalid.push({
|
57910
|
+
line,
|
57911
|
+
lineNumber: i5 + 1,
|
57912
|
+
message: fromResult[1]
|
57913
|
+
});
|
57914
|
+
continue;
|
57915
|
+
}
|
57916
|
+
const from = fromResult[0];
|
57917
|
+
if (canCreateStaticRule && !from.match(SPLAT_REGEX) && !from.match(PLACEHOLDER_REGEX)) {
|
57918
|
+
staticRules += 1;
|
57919
|
+
if (staticRules > maxStaticRules) {
|
57920
|
+
invalid.push({
|
57921
|
+
message: `Maximum number of static rules supported is ${maxStaticRules}. Skipping line.`
|
57520
57922
|
});
|
57521
|
-
|
57522
|
-
|
57523
|
-
|
57923
|
+
continue;
|
57924
|
+
}
|
57925
|
+
} else {
|
57926
|
+
dynamicRules += 1;
|
57927
|
+
canCreateStaticRule = false;
|
57928
|
+
if (dynamicRules > maxDynamicRules) {
|
57929
|
+
invalid.push({
|
57930
|
+
message: `Maximum number of dynamic rules supported is ${maxDynamicRules}. Skipping remaining ${lines.length - i5} lines of file.`
|
57524
57931
|
});
|
57932
|
+
break;
|
57525
57933
|
}
|
57526
|
-
|
57527
|
-
|
57528
|
-
|
57529
|
-
|
57530
|
-
|
57531
|
-
|
57934
|
+
}
|
57935
|
+
const toResult = validateUrl(str_to, false, false, true, true);
|
57936
|
+
if (toResult[0] === void 0) {
|
57937
|
+
invalid.push({
|
57938
|
+
line,
|
57939
|
+
lineNumber: i5 + 1,
|
57940
|
+
message: toResult[1]
|
57532
57941
|
});
|
57533
|
-
|
57534
|
-
return key in o5;
|
57942
|
+
continue;
|
57535
57943
|
}
|
57536
|
-
|
57537
|
-
|
57538
|
-
|
57539
|
-
|
57540
|
-
|
57944
|
+
const to = toResult[0];
|
57945
|
+
const status2 = Number(str_status);
|
57946
|
+
if (isNaN(status2) || !PERMITTED_STATUS_CODES.has(status2)) {
|
57947
|
+
invalid.push({
|
57948
|
+
line,
|
57949
|
+
lineNumber: i5 + 1,
|
57950
|
+
message: `Valid status codes are 200, 301, 302 (default), 303, 307, or 308. Got ${str_status}.`
|
57951
|
+
});
|
57952
|
+
continue;
|
57541
57953
|
}
|
57542
|
-
|
57543
|
-
|
57544
|
-
|
57954
|
+
if (/\/\*?$/.test(from) && /\/index(.html)?$/.test(to) && !urlHasHost(to)) {
|
57955
|
+
invalid.push({
|
57956
|
+
line,
|
57957
|
+
lineNumber: i5 + 1,
|
57958
|
+
message: "Infinite loop detected in this rule and has been ignored. This will cause a redirect to strip `.html` or `/index` and end up triggering this rule again. Please fix or remove this rule to silence this warning."
|
57959
|
+
});
|
57960
|
+
continue;
|
57545
57961
|
}
|
57546
|
-
|
57962
|
+
if (seen_paths.has(from)) {
|
57963
|
+
invalid.push({
|
57964
|
+
line,
|
57965
|
+
lineNumber: i5 + 1,
|
57966
|
+
message: `Ignoring duplicate rule for path ${from}.`
|
57967
|
+
});
|
57968
|
+
continue;
|
57969
|
+
}
|
57970
|
+
seen_paths.add(from);
|
57971
|
+
if (status2 === 200) {
|
57972
|
+
if (urlHasHost(to)) {
|
57973
|
+
invalid.push({
|
57974
|
+
line,
|
57975
|
+
lineNumber: i5 + 1,
|
57976
|
+
message: `Proxy (200) redirects can only point to relative paths. Got ${to}`
|
57977
|
+
});
|
57978
|
+
continue;
|
57979
|
+
}
|
57980
|
+
}
|
57981
|
+
rules.push({ from, to, status: status2, lineNumber: i5 + 1 });
|
57982
|
+
}
|
57983
|
+
return {
|
57984
|
+
rules,
|
57985
|
+
invalid
|
57986
|
+
};
|
57987
|
+
}
|
57988
|
+
var init_parseRedirects = __esm({
|
57989
|
+
"../workers-shared/utils/configuration/parseRedirects.ts"() {
|
57990
|
+
init_import_meta_url();
|
57991
|
+
init_constants3();
|
57992
|
+
init_validateURL();
|
57993
|
+
__name(parseRedirects, "parseRedirects");
|
57547
57994
|
}
|
57548
57995
|
});
|
57549
57996
|
|
57550
|
-
//
|
57551
|
-
var
|
57552
|
-
"
|
57997
|
+
// ../workers-shared/utils/configuration/types.ts
|
57998
|
+
var init_types3 = __esm({
|
57999
|
+
"../workers-shared/utils/configuration/types.ts"() {
|
57553
58000
|
init_import_meta_url();
|
57554
|
-
var cc2 = require_utils3();
|
57555
|
-
var join24 = require("path").join;
|
57556
|
-
var deepExtend = require_deep_extend();
|
57557
|
-
var etc = "/etc";
|
57558
|
-
var win = process.platform === "win32";
|
57559
|
-
var home = win ? process.env.USERPROFILE : process.env.HOME;
|
57560
|
-
module3.exports = function(name2, defaults, argv, parse7) {
|
57561
|
-
if ("string" !== typeof name2)
|
57562
|
-
throw new Error("rc(name): name *must* be string");
|
57563
|
-
if (!argv)
|
57564
|
-
argv = require_minimist()(process.argv.slice(2));
|
57565
|
-
defaults = ("string" === typeof defaults ? cc2.json(defaults) : defaults) || {};
|
57566
|
-
parse7 = parse7 || cc2.parse;
|
57567
|
-
var env6 = cc2.env(name2 + "_");
|
57568
|
-
var configs = [defaults];
|
57569
|
-
var configFiles = [];
|
57570
|
-
function addConfigFile(file) {
|
57571
|
-
if (configFiles.indexOf(file) >= 0) return;
|
57572
|
-
var fileConfig = cc2.file(file);
|
57573
|
-
if (fileConfig) {
|
57574
|
-
configs.push(parse7(fileConfig));
|
57575
|
-
configFiles.push(file);
|
57576
|
-
}
|
57577
|
-
}
|
57578
|
-
__name(addConfigFile, "addConfigFile");
|
57579
|
-
if (!win)
|
57580
|
-
[
|
57581
|
-
join24(etc, name2, "config"),
|
57582
|
-
join24(etc, name2 + "rc")
|
57583
|
-
].forEach(addConfigFile);
|
57584
|
-
if (home)
|
57585
|
-
[
|
57586
|
-
join24(home, ".config", name2, "config"),
|
57587
|
-
join24(home, ".config", name2),
|
57588
|
-
join24(home, "." + name2, "config"),
|
57589
|
-
join24(home, "." + name2 + "rc")
|
57590
|
-
].forEach(addConfigFile);
|
57591
|
-
addConfigFile(cc2.find("." + name2 + "rc"));
|
57592
|
-
if (env6.config) addConfigFile(env6.config);
|
57593
|
-
if (argv.config) addConfigFile(argv.config);
|
57594
|
-
return deepExtend.apply(null, configs.concat([
|
57595
|
-
env6,
|
57596
|
-
argv,
|
57597
|
-
configFiles.length ? { configs: configFiles, config: configFiles[configFiles.length - 1] } : void 0
|
57598
|
-
]));
|
57599
|
-
};
|
57600
58001
|
}
|
57601
58002
|
});
|
57602
58003
|
|
57603
|
-
//
|
57604
|
-
var
|
57605
|
-
"
|
57606
|
-
"use strict";
|
58004
|
+
// ../workers-shared/index.ts
|
58005
|
+
var init_workers_shared = __esm({
|
58006
|
+
"../workers-shared/index.ts"() {
|
57607
58007
|
init_import_meta_url();
|
57608
|
-
|
57609
|
-
|
57610
|
-
|
57611
|
-
|
57612
|
-
|
58008
|
+
init_constants2();
|
58009
|
+
init_types2();
|
58010
|
+
init_helpers2();
|
58011
|
+
init_parseHeaders();
|
58012
|
+
init_parseRedirects();
|
58013
|
+
init_types3();
|
57613
58014
|
}
|
57614
58015
|
});
|
57615
58016
|
|
57616
|
-
//
|
57617
|
-
|
57618
|
-
|
57619
|
-
|
57620
|
-
|
57621
|
-
|
57622
|
-
|
57623
|
-
|
57624
|
-
|
57625
|
-
|
58017
|
+
// src/sourcemap.ts
|
58018
|
+
function maybeRetrieveFileSourceMap(filePath) {
|
58019
|
+
if (filePath === void 0) {
|
58020
|
+
return null;
|
58021
|
+
}
|
58022
|
+
const contents = maybeGetFile(filePath);
|
58023
|
+
if (contents === void 0) {
|
58024
|
+
return null;
|
58025
|
+
}
|
58026
|
+
const mapRegexp = /# sourceMappingURL=(.+)/g;
|
58027
|
+
const matches = [...contents.matchAll(mapRegexp)];
|
58028
|
+
if (matches.length === 0) {
|
58029
|
+
return null;
|
58030
|
+
}
|
58031
|
+
const mapMatch = matches[matches.length - 1];
|
58032
|
+
const fileUrl = import_node_url6.default.pathToFileURL(filePath);
|
58033
|
+
const mapUrl = new URL(mapMatch[1], fileUrl);
|
58034
|
+
if (mapUrl.protocol === "data:" && mapUrl.pathname.startsWith("application/json;base64,")) {
|
58035
|
+
const base642 = mapUrl.href.substring(mapUrl.href.indexOf(",") + 1);
|
58036
|
+
const map2 = Buffer.from(base642, "base64").toString();
|
58037
|
+
return { map: map2, url: fileUrl.href };
|
58038
|
+
} else {
|
58039
|
+
const map2 = maybeGetFile(mapUrl);
|
58040
|
+
if (map2 === void 0) {
|
58041
|
+
return null;
|
57626
58042
|
}
|
57627
|
-
|
57628
|
-
|
57629
|
-
|
57630
|
-
|
57631
|
-
|
57632
|
-
|
58043
|
+
return { map: map2, url: mapUrl.href };
|
58044
|
+
}
|
58045
|
+
}
|
58046
|
+
function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
|
58047
|
+
retrieveSourceMapOverride = retrieveSourceMap;
|
58048
|
+
if (sourceMappingPrepareStackTrace !== void 0) {
|
58049
|
+
return sourceMappingPrepareStackTrace;
|
58050
|
+
}
|
58051
|
+
const support = (0, import_miniflare7.getFreshSourceMapSupport)();
|
58052
|
+
const originalPrepareStackTrace = Error.prepareStackTrace;
|
58053
|
+
support.install({
|
58054
|
+
environment: "node",
|
58055
|
+
// Don't add Node `uncaughtException` handler
|
58056
|
+
handleUncaughtExceptions: false,
|
58057
|
+
// Don't hook Node `require` function
|
58058
|
+
hookRequire: false,
|
58059
|
+
redirectConflictingLibrary: false,
|
58060
|
+
// Make sure we're using fresh copies of files each time we source map
|
58061
|
+
emptyCacheBetweenOperations: true,
|
58062
|
+
// Allow retriever to be overridden at prepare stack trace time
|
58063
|
+
retrieveSourceMap(path72) {
|
58064
|
+
return retrieveSourceMapOverride?.(path72) ?? null;
|
57633
58065
|
}
|
57634
|
-
|
57635
|
-
|
58066
|
+
});
|
58067
|
+
sourceMappingPrepareStackTrace = Error.prepareStackTrace;
|
58068
|
+
(0, import_node_assert4.default)(sourceMappingPrepareStackTrace !== void 0);
|
58069
|
+
Error.prepareStackTrace = originalPrepareStackTrace;
|
58070
|
+
return sourceMappingPrepareStackTrace;
|
58071
|
+
}
|
58072
|
+
function getSourceMappedStack(details) {
|
58073
|
+
const description = details.exception?.description ?? "";
|
58074
|
+
const callFrames = details.stackTrace?.callFrames;
|
58075
|
+
if (callFrames === void 0) {
|
58076
|
+
return description;
|
58077
|
+
}
|
58078
|
+
const nameMessage = details.exception?.description?.split("\n")[0] ?? "";
|
58079
|
+
const colonIndex = nameMessage.indexOf(":");
|
58080
|
+
const error2 = new Error(nameMessage.substring(colonIndex + 2));
|
58081
|
+
error2.name = nameMessage.substring(0, colonIndex);
|
58082
|
+
const callSites = callFrames.map(callFrameToCallSite);
|
58083
|
+
return getSourceMappingPrepareStackTrace()(error2, callSites);
|
58084
|
+
}
|
58085
|
+
function callFrameToCallSite(frame) {
|
58086
|
+
return new CallSite({
|
58087
|
+
typeName: null,
|
58088
|
+
functionName: frame.functionName,
|
58089
|
+
methodName: null,
|
58090
|
+
fileName: frame.url,
|
58091
|
+
lineNumber: frame.lineNumber + 1,
|
58092
|
+
columnNumber: frame.columnNumber + 1,
|
58093
|
+
native: false
|
58094
|
+
});
|
58095
|
+
}
|
58096
|
+
function getSourceMappedString(value, retrieveSourceMap) {
|
58097
|
+
const callSiteLines = Array.from(value.matchAll(CALL_SITE_REGEXP));
|
58098
|
+
const callSites = callSiteLines.map(lineMatchToCallSite);
|
58099
|
+
const prepareStack = getSourceMappingPrepareStackTrace(retrieveSourceMap);
|
58100
|
+
const sourceMappedStackTrace = prepareStack(
|
58101
|
+
placeholderError,
|
58102
|
+
callSites
|
58103
|
+
);
|
58104
|
+
const sourceMappedCallSiteLines = sourceMappedStackTrace.split("\n").slice(1);
|
58105
|
+
for (let i5 = 0; i5 < callSiteLines.length; i5++) {
|
58106
|
+
if (callSites[i5].getFileName() === void 0) {
|
58107
|
+
continue;
|
57636
58108
|
}
|
57637
|
-
|
57638
|
-
|
57639
|
-
|
57640
|
-
|
57641
|
-
|
57642
|
-
|
57643
|
-
|
57644
|
-
|
57645
|
-
};
|
57646
|
-
SafeBuffer.alloc = function(size, fill2, encoding) {
|
57647
|
-
if (typeof size !== "number") {
|
57648
|
-
throw new TypeError("Argument must be a number");
|
57649
|
-
}
|
57650
|
-
var buf = Buffer7(size);
|
57651
|
-
if (fill2 !== void 0) {
|
57652
|
-
if (typeof encoding === "string") {
|
57653
|
-
buf.fill(fill2, encoding);
|
57654
|
-
} else {
|
57655
|
-
buf.fill(fill2);
|
57656
|
-
}
|
57657
|
-
} else {
|
57658
|
-
buf.fill(0);
|
57659
|
-
}
|
57660
|
-
return buf;
|
57661
|
-
};
|
57662
|
-
SafeBuffer.allocUnsafe = function(size) {
|
57663
|
-
if (typeof size !== "number") {
|
57664
|
-
throw new TypeError("Argument must be a number");
|
57665
|
-
}
|
57666
|
-
return Buffer7(size);
|
57667
|
-
};
|
57668
|
-
SafeBuffer.allocUnsafeSlow = function(size) {
|
57669
|
-
if (typeof size !== "number") {
|
57670
|
-
throw new TypeError("Argument must be a number");
|
57671
|
-
}
|
57672
|
-
return buffer.SlowBuffer(size);
|
57673
|
-
};
|
58109
|
+
const callSiteLine = callSiteLines[i5][0];
|
58110
|
+
const callSiteAtIndex = callSiteLine.indexOf("at");
|
58111
|
+
(0, import_node_assert4.default)(callSiteAtIndex !== -1);
|
58112
|
+
const callSiteLineLeftPad = callSiteLine.substring(0, callSiteAtIndex);
|
58113
|
+
value = value.replace(
|
58114
|
+
callSiteLine,
|
58115
|
+
callSiteLineLeftPad + sourceMappedCallSiteLines[i5].trimStart()
|
58116
|
+
);
|
57674
58117
|
}
|
57675
|
-
|
57676
|
-
|
57677
|
-
|
57678
|
-
|
57679
|
-
|
57680
|
-
|
57681
|
-
|
57682
|
-
|
57683
|
-
|
58118
|
+
return value;
|
58119
|
+
}
|
58120
|
+
function lineMatchToCallSite(lineMatch) {
|
58121
|
+
let object = null;
|
58122
|
+
let method = null;
|
58123
|
+
let functionName = null;
|
58124
|
+
let typeName = null;
|
58125
|
+
let methodName = null;
|
58126
|
+
const isNative = lineMatch[5] === "native";
|
58127
|
+
if (lineMatch[1]) {
|
58128
|
+
functionName = lineMatch[1];
|
58129
|
+
let methodStart = functionName.lastIndexOf(".");
|
58130
|
+
if (functionName[methodStart - 1] == ".") {
|
58131
|
+
methodStart--;
|
57684
58132
|
}
|
57685
|
-
|
57686
|
-
|
57687
|
-
|
58133
|
+
if (methodStart > 0) {
|
58134
|
+
object = functionName.substring(0, methodStart);
|
58135
|
+
method = functionName.substring(methodStart + 1);
|
58136
|
+
const objectEnd = object.indexOf(".Module");
|
58137
|
+
if (objectEnd > 0) {
|
58138
|
+
functionName = functionName.substring(objectEnd + 1);
|
58139
|
+
object = object.substring(0, objectEnd);
|
58140
|
+
}
|
57688
58141
|
}
|
57689
|
-
__name(encodeBase64, "encodeBase64");
|
57690
|
-
module3.exports = {
|
57691
|
-
decodeBase64,
|
57692
|
-
encodeBase64
|
57693
|
-
};
|
57694
58142
|
}
|
57695
|
-
|
57696
|
-
|
57697
|
-
|
57698
|
-
|
57699
|
-
"
|
58143
|
+
if (method) {
|
58144
|
+
typeName = object;
|
58145
|
+
methodName = method;
|
58146
|
+
}
|
58147
|
+
if (method === "<anonymous>") {
|
58148
|
+
methodName = null;
|
58149
|
+
functionName = null;
|
58150
|
+
}
|
58151
|
+
return new CallSite({
|
58152
|
+
typeName,
|
58153
|
+
functionName,
|
58154
|
+
methodName,
|
58155
|
+
fileName: lineMatch[2],
|
58156
|
+
lineNumber: parseInt(lineMatch[3]) || null,
|
58157
|
+
columnNumber: parseInt(lineMatch[4]) || null,
|
58158
|
+
native: isNative
|
58159
|
+
});
|
58160
|
+
}
|
58161
|
+
var import_node_assert4, import_node_url6, import_miniflare7, sourceMappingPrepareStackTrace, retrieveSourceMapOverride, placeholderError, CALL_SITE_REGEXP, CallSite;
|
58162
|
+
var init_sourcemap = __esm({
|
58163
|
+
"src/sourcemap.ts"() {
|
57700
58164
|
init_import_meta_url();
|
57701
|
-
|
57702
|
-
|
57703
|
-
|
57704
|
-
|
57705
|
-
|
57706
|
-
|
57707
|
-
|
57708
|
-
|
57709
|
-
|
57710
|
-
|
57711
|
-
|
57712
|
-
|
57713
|
-
|
57714
|
-
|
57715
|
-
|
57716
|
-
|
57717
|
-
|
58165
|
+
import_node_assert4 = __toESM(require("assert"));
|
58166
|
+
import_node_url6 = __toESM(require("url"));
|
58167
|
+
init_workers_shared();
|
58168
|
+
import_miniflare7 = require("miniflare");
|
58169
|
+
__name(maybeRetrieveFileSourceMap, "maybeRetrieveFileSourceMap");
|
58170
|
+
__name(getSourceMappingPrepareStackTrace, "getSourceMappingPrepareStackTrace");
|
58171
|
+
__name(getSourceMappedStack, "getSourceMappedStack");
|
58172
|
+
__name(callFrameToCallSite, "callFrameToCallSite");
|
58173
|
+
placeholderError = new Error();
|
58174
|
+
__name(getSourceMappedString, "getSourceMappedString");
|
58175
|
+
CALL_SITE_REGEXP = // Validation errors from `wrangler deploy` have a 2 space indent, whereas
|
58176
|
+
// regular stack traces have a 4 space indent.
|
58177
|
+
// eslint-disable-next-line no-control-regex
|
58178
|
+
/^(?:\s+(?:\x1B\[\d+m)?'?)? {2,4}at (?:(.+?)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/gm;
|
58179
|
+
__name(lineMatchToCallSite, "lineMatchToCallSite");
|
58180
|
+
CallSite = class {
|
58181
|
+
constructor(opts) {
|
58182
|
+
this.opts = opts;
|
57718
58183
|
}
|
57719
|
-
|
57720
|
-
|
57721
|
-
checkUrl2 = checkUrl2 || options.npmrc.registry;
|
57722
|
-
return getRegistryAuthInfo(checkUrl2, options) || getLegacyAuthInfo(options.npmrc);
|
57723
|
-
};
|
57724
|
-
function getRegistryAuthInfo(checkUrl2, options) {
|
57725
|
-
var parsed = url4.parse(checkUrl2, false, true);
|
57726
|
-
var pathname;
|
57727
|
-
while (pathname !== "/" && parsed.pathname !== pathname) {
|
57728
|
-
pathname = parsed.pathname || "/";
|
57729
|
-
var regUrl = "//" + parsed.host + pathname.replace(/\/$/, "");
|
57730
|
-
var authInfo = getAuthInfoForUrl(regUrl, options.npmrc);
|
57731
|
-
if (authInfo) {
|
57732
|
-
return authInfo;
|
57733
|
-
}
|
57734
|
-
if (!options.recursive) {
|
57735
|
-
return /\/$/.test(checkUrl2) ? void 0 : getRegistryAuthInfo(url4.resolve(checkUrl2, "."), options);
|
57736
|
-
}
|
57737
|
-
parsed.pathname = url4.resolve(normalizePath2(pathname), "..") || "/";
|
58184
|
+
static {
|
58185
|
+
__name(this, "CallSite");
|
57738
58186
|
}
|
57739
|
-
|
57740
|
-
|
57741
|
-
__name(getRegistryAuthInfo, "getRegistryAuthInfo");
|
57742
|
-
function getLegacyAuthInfo(npmrc) {
|
57743
|
-
if (npmrc._auth) {
|
57744
|
-
return { token: npmrc._auth, type: "Basic" };
|
58187
|
+
getScriptHash() {
|
58188
|
+
throw new Error("Method not implemented.");
|
57745
58189
|
}
|
57746
|
-
|
57747
|
-
|
57748
|
-
__name(getLegacyAuthInfo, "getLegacyAuthInfo");
|
57749
|
-
function normalizePath2(path72) {
|
57750
|
-
return path72[path72.length - 1] === "/" ? path72 : path72 + "/";
|
57751
|
-
}
|
57752
|
-
__name(normalizePath2, "normalizePath");
|
57753
|
-
function getAuthInfoForUrl(regUrl, npmrc) {
|
57754
|
-
var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + "/" + tokenKey]);
|
57755
|
-
if (bearerAuth) {
|
57756
|
-
return bearerAuth;
|
58190
|
+
getEnclosingColumnNumber() {
|
58191
|
+
throw new Error("Method not implemented.");
|
57757
58192
|
}
|
57758
|
-
|
57759
|
-
|
57760
|
-
var basicAuth = getTokenForUsernameAndPassword(username, password);
|
57761
|
-
if (basicAuth) {
|
57762
|
-
return basicAuth;
|
58193
|
+
getEnclosingLineNumber() {
|
58194
|
+
throw new Error("Method not implemented.");
|
57763
58195
|
}
|
57764
|
-
|
57765
|
-
|
57766
|
-
__name(getAuthInfoForUrl, "getAuthInfoForUrl");
|
57767
|
-
function getBearerToken(tok) {
|
57768
|
-
if (!tok) {
|
57769
|
-
return void 0;
|
58196
|
+
getPosition() {
|
58197
|
+
throw new Error("Method not implemented.");
|
57770
58198
|
}
|
57771
|
-
|
57772
|
-
return
|
57773
|
-
}
|
57774
|
-
|
57775
|
-
|
57776
|
-
|
57777
|
-
|
57778
|
-
|
58199
|
+
getThis() {
|
58200
|
+
return null;
|
58201
|
+
}
|
58202
|
+
getTypeName() {
|
58203
|
+
return this.opts.typeName;
|
58204
|
+
}
|
58205
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
58206
|
+
getFunction() {
|
57779
58207
|
return void 0;
|
57780
58208
|
}
|
57781
|
-
|
57782
|
-
return
|
57783
|
-
}));
|
57784
|
-
var token = encodeBase64(username + ":" + pass2);
|
57785
|
-
return {
|
57786
|
-
token,
|
57787
|
-
type: "Basic",
|
57788
|
-
password: pass2,
|
57789
|
-
username
|
57790
|
-
};
|
57791
|
-
}
|
57792
|
-
__name(getTokenForUsernameAndPassword, "getTokenForUsernameAndPassword");
|
57793
|
-
}
|
57794
|
-
});
|
57795
|
-
|
57796
|
-
// ../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js
|
57797
|
-
var require_update_check = __commonJS({
|
57798
|
-
"../../node_modules/.pnpm/update-check@1.5.4/node_modules/update-check/index.js"(exports2, module3) {
|
57799
|
-
init_import_meta_url();
|
57800
|
-
var { URL: URL7 } = require("url");
|
57801
|
-
var { join: join24 } = require("path");
|
57802
|
-
var fs24 = require("fs");
|
57803
|
-
var { promisify: promisify3 } = require("util");
|
57804
|
-
var { tmpdir } = require("os");
|
57805
|
-
var registryUrl = require_registry_url();
|
57806
|
-
var writeFile11 = promisify3(fs24.writeFile);
|
57807
|
-
var mkdir6 = promisify3(fs24.mkdir);
|
57808
|
-
var readFile18 = promisify3(fs24.readFile);
|
57809
|
-
var compareVersions = /* @__PURE__ */ __name((a5, b6) => a5.localeCompare(b6, "en-US", { numeric: true }), "compareVersions");
|
57810
|
-
var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
57811
|
-
var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
|
57812
|
-
const rootDir = tmpdir();
|
57813
|
-
const subDir = join24(rootDir, "update-check");
|
57814
|
-
if (!fs24.existsSync(subDir)) {
|
57815
|
-
await mkdir6(subDir);
|
58209
|
+
getFunctionName() {
|
58210
|
+
return this.opts.functionName;
|
57816
58211
|
}
|
57817
|
-
|
57818
|
-
|
57819
|
-
name2 = `${details.scope}-${name2}`;
|
58212
|
+
getMethodName() {
|
58213
|
+
return this.opts.methodName;
|
57820
58214
|
}
|
57821
|
-
|
57822
|
-
|
57823
|
-
var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval) => {
|
57824
|
-
if (fs24.existsSync(file)) {
|
57825
|
-
const content = await readFile18(file, "utf8");
|
57826
|
-
const { lastUpdate, latest } = JSON.parse(content);
|
57827
|
-
const nextCheck = lastUpdate + interval;
|
57828
|
-
if (nextCheck > time) {
|
57829
|
-
return {
|
57830
|
-
shouldCheck: false,
|
57831
|
-
latest
|
57832
|
-
};
|
57833
|
-
}
|
58215
|
+
getFileName() {
|
58216
|
+
return this.opts.fileName ?? null;
|
57834
58217
|
}
|
57835
|
-
|
57836
|
-
|
57837
|
-
latest: null
|
57838
|
-
};
|
57839
|
-
}, "evaluateCache");
|
57840
|
-
var updateCache = /* @__PURE__ */ __name(async (file, latest, lastUpdate) => {
|
57841
|
-
const content = JSON.stringify({
|
57842
|
-
latest,
|
57843
|
-
lastUpdate
|
57844
|
-
});
|
57845
|
-
await writeFile11(file, content, "utf8");
|
57846
|
-
}, "updateCache");
|
57847
|
-
var loadPackage = /* @__PURE__ */ __name((url4, authInfo) => new Promise((resolve25, reject) => {
|
57848
|
-
const options = {
|
57849
|
-
host: url4.hostname,
|
57850
|
-
path: url4.pathname,
|
57851
|
-
port: url4.port,
|
57852
|
-
headers: {
|
57853
|
-
accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"
|
57854
|
-
},
|
57855
|
-
timeout: 2e3
|
57856
|
-
};
|
57857
|
-
if (authInfo) {
|
57858
|
-
options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
|
58218
|
+
getScriptNameOrSourceURL() {
|
58219
|
+
return this.opts.fileName;
|
57859
58220
|
}
|
57860
|
-
|
57861
|
-
|
57862
|
-
const { statusCode } = response;
|
57863
|
-
if (statusCode !== 200) {
|
57864
|
-
const error2 = new Error(`Request failed with code ${statusCode}`);
|
57865
|
-
error2.code = statusCode;
|
57866
|
-
reject(error2);
|
57867
|
-
response.resume();
|
57868
|
-
return;
|
57869
|
-
}
|
57870
|
-
let rawData = "";
|
57871
|
-
response.setEncoding("utf8");
|
57872
|
-
response.on("data", (chunk) => {
|
57873
|
-
rawData += chunk;
|
57874
|
-
});
|
57875
|
-
response.on("end", () => {
|
57876
|
-
try {
|
57877
|
-
const parsedData = JSON.parse(rawData);
|
57878
|
-
resolve25(parsedData);
|
57879
|
-
} catch (e7) {
|
57880
|
-
reject(e7);
|
57881
|
-
}
|
57882
|
-
});
|
57883
|
-
}).on("error", reject).on("timeout", reject);
|
57884
|
-
}), "loadPackage");
|
57885
|
-
var getMostRecent = /* @__PURE__ */ __name(async ({ full, scope }, distTag) => {
|
57886
|
-
const regURL = registryUrl(scope);
|
57887
|
-
const url4 = new URL7(full, regURL);
|
57888
|
-
let spec = null;
|
57889
|
-
try {
|
57890
|
-
spec = await loadPackage(url4);
|
57891
|
-
} catch (err) {
|
57892
|
-
if (err.code && String(err.code).startsWith(4)) {
|
57893
|
-
const registryAuthToken = require_registry_auth_token();
|
57894
|
-
const authInfo = registryAuthToken(regURL, { recursive: true });
|
57895
|
-
spec = await loadPackage(url4, authInfo);
|
57896
|
-
} else {
|
57897
|
-
throw err;
|
57898
|
-
}
|
58221
|
+
getLineNumber() {
|
58222
|
+
return this.opts.lineNumber;
|
57899
58223
|
}
|
57900
|
-
|
57901
|
-
|
57902
|
-
throw new Error(`Distribution tag ${distTag} is not available`);
|
58224
|
+
getColumnNumber() {
|
58225
|
+
return this.opts.columnNumber;
|
57903
58226
|
}
|
57904
|
-
|
57905
|
-
|
57906
|
-
var defaultConfig = {
|
57907
|
-
interval: 36e5,
|
57908
|
-
distTag: "latest"
|
57909
|
-
};
|
57910
|
-
var getDetails = /* @__PURE__ */ __name((name2) => {
|
57911
|
-
const spec = {
|
57912
|
-
full: encode(name2)
|
57913
|
-
};
|
57914
|
-
if (name2.includes("/")) {
|
57915
|
-
const parts = name2.split("/");
|
57916
|
-
spec.scope = parts[0];
|
57917
|
-
spec.name = parts[1];
|
57918
|
-
} else {
|
57919
|
-
spec.scope = null;
|
57920
|
-
spec.name = name2;
|
58227
|
+
getEvalOrigin() {
|
58228
|
+
return void 0;
|
57921
58229
|
}
|
57922
|
-
|
57923
|
-
|
57924
|
-
module3.exports = async (pkg, config) => {
|
57925
|
-
if (typeof pkg !== "object") {
|
57926
|
-
throw new Error("The first parameter should be your package.json file content");
|
58230
|
+
isToplevel() {
|
58231
|
+
return false;
|
57927
58232
|
}
|
57928
|
-
|
57929
|
-
|
57930
|
-
const { distTag, interval } = Object.assign({}, defaultConfig, config);
|
57931
|
-
const file = await getFile(details, distTag);
|
57932
|
-
let latest = null;
|
57933
|
-
let shouldCheck = true;
|
57934
|
-
({ shouldCheck, latest } = await evaluateCache(file, time, interval));
|
57935
|
-
if (shouldCheck) {
|
57936
|
-
latest = await getMostRecent(details, distTag);
|
57937
|
-
await updateCache(file, latest, time);
|
58233
|
+
isEval() {
|
58234
|
+
return false;
|
57938
58235
|
}
|
57939
|
-
|
57940
|
-
|
57941
|
-
|
57942
|
-
|
57943
|
-
|
57944
|
-
|
58236
|
+
isNative() {
|
58237
|
+
return this.opts.native;
|
58238
|
+
}
|
58239
|
+
isConstructor() {
|
58240
|
+
return false;
|
58241
|
+
}
|
58242
|
+
isAsync() {
|
58243
|
+
return false;
|
58244
|
+
}
|
58245
|
+
isPromiseAll() {
|
58246
|
+
return false;
|
58247
|
+
}
|
58248
|
+
isPromiseAny() {
|
58249
|
+
return false;
|
58250
|
+
}
|
58251
|
+
getPromiseIndex() {
|
58252
|
+
return null;
|
57945
58253
|
}
|
57946
|
-
return null;
|
57947
58254
|
};
|
57948
58255
|
}
|
57949
58256
|
});
|
57950
58257
|
|
57951
|
-
// src/
|
57952
|
-
|
57953
|
-
|
57954
|
-
|
58258
|
+
// src/dev/miniflare/stdio.ts
|
58259
|
+
function handleRuntimeStdioWithStructuredLogs(stdout2, stderr2) {
|
58260
|
+
stdout2.on("data", getProcessStreamDataListener("stdout"));
|
58261
|
+
stderr2.on("data", getProcessStreamDataListener("stderr"));
|
58262
|
+
}
|
58263
|
+
function getProcessStreamDataListener(processStream) {
|
58264
|
+
let streamAccumulator = "";
|
58265
|
+
return (chunk) => {
|
58266
|
+
const fullStreamOutput = `${streamAccumulator}${chunk}`;
|
58267
|
+
let currentLogsStr = "";
|
58268
|
+
const lastNewlineIdx = fullStreamOutput.lastIndexOf("\n");
|
58269
|
+
if (lastNewlineIdx > 0) {
|
58270
|
+
currentLogsStr = fullStreamOutput.slice(0, lastNewlineIdx);
|
58271
|
+
streamAccumulator = fullStreamOutput.slice(lastNewlineIdx + 1);
|
58272
|
+
} else {
|
58273
|
+
streamAccumulator = fullStreamOutput;
|
58274
|
+
}
|
58275
|
+
const lines = currentLogsStr.split("\n");
|
58276
|
+
for (const line of lines) {
|
58277
|
+
const structuredLog = parseStructuredLog(line);
|
58278
|
+
if (structuredLog) {
|
58279
|
+
logStructuredLog(structuredLog, processStream);
|
58280
|
+
} else {
|
58281
|
+
const level = processStream === "stdout" ? "log" : "error";
|
58282
|
+
logger[level](line);
|
58283
|
+
}
|
58284
|
+
}
|
58285
|
+
};
|
58286
|
+
}
|
58287
|
+
function parseStructuredLog(str) {
|
57955
58288
|
try {
|
57956
|
-
|
57957
|
-
|
57958
|
-
|
58289
|
+
const maybeStructuredLog = JSON.parse(str);
|
58290
|
+
if (typeof maybeStructuredLog !== "object" || maybeStructuredLog === null) {
|
58291
|
+
return null;
|
58292
|
+
}
|
58293
|
+
const timestamp = parseInt(maybeStructuredLog.timestamp);
|
58294
|
+
if (isNaN(timestamp) || typeof maybeStructuredLog.level !== "string" || typeof maybeStructuredLog.message !== "string") {
|
58295
|
+
return null;
|
58296
|
+
}
|
58297
|
+
return {
|
58298
|
+
timestamp,
|
58299
|
+
level: maybeStructuredLog.level,
|
58300
|
+
message: maybeStructuredLog.message
|
58301
|
+
};
|
57959
58302
|
} catch {
|
58303
|
+
return null;
|
57960
58304
|
}
|
57961
|
-
return update?.latest;
|
57962
58305
|
}
|
57963
|
-
function
|
57964
|
-
|
57965
|
-
|
57966
|
-
|
57967
|
-
|
57968
|
-
|
57969
|
-
|
57970
|
-
|
57971
|
-
|
57972
|
-
|
57973
|
-
|
58306
|
+
function logStructuredLog({ level, message }, processStream) {
|
58307
|
+
if (messageClassifiers.isBarf(message)) {
|
58308
|
+
if (messageClassifiers.isAddressInUse(message)) {
|
58309
|
+
const address = message.match(
|
58310
|
+
/Address already in use; toString\(\) = (.+)\n/
|
58311
|
+
)?.[1];
|
58312
|
+
logger.error(
|
58313
|
+
`Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`
|
58314
|
+
);
|
58315
|
+
return logger.debug(message);
|
58316
|
+
}
|
58317
|
+
if (messageClassifiers.isAccessViolation(message)) {
|
58318
|
+
let error2 = "There was an access violation in the runtime.";
|
58319
|
+
if (process.platform === "win32") {
|
58320
|
+
error2 += "\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\nCheck that you have the latest version installed.\nSee https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.";
|
58321
|
+
}
|
58322
|
+
logger.error(error2);
|
58323
|
+
return logger.debug(message);
|
58324
|
+
}
|
58325
|
+
return logger.debug(message);
|
58326
|
+
}
|
58327
|
+
if ((level === "info" || level === "error") && messageClassifiers.isCodeMovedWarning(message)) {
|
58328
|
+
return;
|
58329
|
+
}
|
58330
|
+
if (level === "warn") {
|
58331
|
+
return logger.warn(message);
|
58332
|
+
}
|
58333
|
+
if (level === "info") {
|
58334
|
+
return logger.info(message);
|
58335
|
+
}
|
58336
|
+
if (level === "debug") {
|
58337
|
+
return logger.debug(message);
|
58338
|
+
}
|
58339
|
+
if (level === "error") {
|
58340
|
+
return logger.error(getSourceMappedString(message));
|
58341
|
+
}
|
58342
|
+
if (processStream === "stderr") {
|
58343
|
+
return logger.error(getSourceMappedString(message));
|
58344
|
+
} else {
|
58345
|
+
return logger.log(getSourceMappedString(message));
|
57974
58346
|
}
|
57975
|
-
});
|
57976
|
-
|
57977
|
-
// src/vectorize/fetcher.ts
|
57978
|
-
function MakeVectorizeFetcher(complianceConfig, indexId) {
|
57979
|
-
return async function(request4) {
|
57980
|
-
const accountId = await getAccountId(complianceConfig);
|
57981
|
-
request4.headers.delete("Host");
|
57982
|
-
request4.headers.delete("Content-Length");
|
57983
|
-
let op = request4.url.split("/").pop() || "";
|
57984
|
-
op = URL_SUBSTITUTIONS.get(op) || op;
|
57985
|
-
const base = `/accounts/${accountId}/vectorize/v2/indexes/${indexId}/`;
|
57986
|
-
const url4 = base + op;
|
57987
|
-
const res = await performApiFetch(complianceConfig, url4, {
|
57988
|
-
method: request4.method,
|
57989
|
-
headers: Object.fromEntries(request4.headers.entries()),
|
57990
|
-
body: request4.body,
|
57991
|
-
duplex: "half"
|
57992
|
-
});
|
57993
|
-
const respHeaders = new import_miniflare7.Headers(res.headers);
|
57994
|
-
respHeaders.delete("Host");
|
57995
|
-
respHeaders.delete("Content-Length");
|
57996
|
-
const apiResponse = await res.json();
|
57997
|
-
const newResponse = apiResponse.success ? apiResponse.result : {
|
57998
|
-
error: apiResponse.errors[0].message,
|
57999
|
-
code: apiResponse.errors[0].code
|
58000
|
-
};
|
58001
|
-
return new import_miniflare7.Response(JSON.stringify(newResponse), {
|
58002
|
-
status: res.status,
|
58003
|
-
headers: respHeaders
|
58004
|
-
});
|
58005
|
-
};
|
58006
58347
|
}
|
58007
|
-
var
|
58008
|
-
var
|
58009
|
-
"src/
|
58348
|
+
var messageClassifiers;
|
58349
|
+
var init_stdio = __esm({
|
58350
|
+
"src/dev/miniflare/stdio.ts"() {
|
58010
58351
|
init_import_meta_url();
|
58011
|
-
|
58012
|
-
|
58013
|
-
|
58014
|
-
|
58015
|
-
|
58016
|
-
|
58017
|
-
|
58018
|
-
|
58019
|
-
|
58020
|
-
|
58021
|
-
|
58022
|
-
indexVersion: env.INDEX_VERSION,
|
58023
|
-
useNdJson: true,
|
58024
|
-
});
|
58025
|
-
}
|
58026
|
-
`;
|
58027
|
-
URL_SUBSTITUTIONS = /* @__PURE__ */ new Map([
|
58028
|
-
["getByIds", "get_by_ids"],
|
58029
|
-
["deleteByIds", "delete_by_ids"]
|
58030
|
-
]);
|
58031
|
-
__name(MakeVectorizeFetcher, "MakeVectorizeFetcher");
|
58032
|
-
}
|
58033
|
-
});
|
58034
|
-
|
58035
|
-
// src/dev/class-names-sqlite.ts
|
58036
|
-
function getClassNamesWhichUseSQLite(migrations) {
|
58037
|
-
const classNamesWhichUseSQLite = /* @__PURE__ */ new Map();
|
58038
|
-
(migrations || []).forEach((migration) => {
|
58039
|
-
migration.deleted_classes?.forEach((deleted_class) => {
|
58040
|
-
if (!classNamesWhichUseSQLite.delete(deleted_class)) {
|
58041
|
-
throw new UserError(
|
58042
|
-
`Cannot apply deleted_classes migration to non-existent class ${deleted_class}`
|
58043
|
-
);
|
58044
|
-
}
|
58045
|
-
});
|
58046
|
-
migration.renamed_classes?.forEach(({ from, to }) => {
|
58047
|
-
const useSQLite = classNamesWhichUseSQLite.get(from);
|
58048
|
-
if (useSQLite === void 0) {
|
58049
|
-
throw new UserError(
|
58050
|
-
`Cannot apply renamed_classes migration to non-existent class ${from}`
|
58051
|
-
);
|
58052
|
-
} else {
|
58053
|
-
classNamesWhichUseSQLite.delete(from);
|
58054
|
-
classNamesWhichUseSQLite.set(to, useSQLite);
|
58055
|
-
}
|
58056
|
-
});
|
58057
|
-
migration.new_classes?.forEach((new_class) => {
|
58058
|
-
if (classNamesWhichUseSQLite.has(new_class)) {
|
58059
|
-
throw new UserError(
|
58060
|
-
`Cannot apply new_classes migration to existing class ${new_class}`
|
58352
|
+
init_logger();
|
58353
|
+
init_sourcemap();
|
58354
|
+
__name(handleRuntimeStdioWithStructuredLogs, "handleRuntimeStdioWithStructuredLogs");
|
58355
|
+
__name(getProcessStreamDataListener, "getProcessStreamDataListener");
|
58356
|
+
__name(parseStructuredLog, "parseStructuredLog");
|
58357
|
+
__name(logStructuredLog, "logStructuredLog");
|
58358
|
+
messageClassifiers = {
|
58359
|
+
// Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
|
58360
|
+
isBarf(chunk) {
|
58361
|
+
const containsLlvmSymbolizerWarning = chunk.includes(
|
58362
|
+
"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
|
58061
58363
|
);
|
58062
|
-
|
58063
|
-
|
58064
|
-
}
|
58065
|
-
});
|
58066
|
-
migration.new_sqlite_classes?.forEach((new_class) => {
|
58067
|
-
if (classNamesWhichUseSQLite.has(new_class)) {
|
58068
|
-
throw new UserError(
|
58069
|
-
`Cannot apply new_sqlite_classes migration to existing class ${new_class}`
|
58364
|
+
const containsRecursiveIsolateLockWarning = chunk.includes(
|
58365
|
+
"took recursive isolate lock"
|
58070
58366
|
);
|
58071
|
-
|
58072
|
-
|
58367
|
+
const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
|
58368
|
+
return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
|
58369
|
+
},
|
58370
|
+
// Is this chunk an Address In Use error?
|
58371
|
+
isAddressInUse(chunk) {
|
58372
|
+
return chunk.includes("Address already in use; toString() = ");
|
58373
|
+
},
|
58374
|
+
isCodeMovedWarning(chunk) {
|
58375
|
+
return /CODE_MOVED for unknown code block/.test(chunk);
|
58376
|
+
},
|
58377
|
+
isAccessViolation(chunk) {
|
58378
|
+
return chunk.includes("access violation;");
|
58073
58379
|
}
|
58074
|
-
}
|
58075
|
-
});
|
58076
|
-
return classNamesWhichUseSQLite;
|
58077
|
-
}
|
58078
|
-
var init_class_names_sqlite = __esm({
|
58079
|
-
"src/dev/class-names-sqlite.ts"() {
|
58080
|
-
init_import_meta_url();
|
58081
|
-
init_errors();
|
58082
|
-
__name(getClassNamesWhichUseSQLite, "getClassNamesWhichUseSQLite");
|
58380
|
+
};
|
58083
58381
|
}
|
58084
58382
|
});
|
58085
58383
|
|
58086
|
-
// src/dev/miniflare.ts
|
58384
|
+
// src/dev/miniflare/index.ts
|
58087
58385
|
function getName(config) {
|
58088
58386
|
return config.name ?? DEFAULT_WORKER_NAME;
|
58089
58387
|
}
|
@@ -58708,72 +59006,6 @@ function buildSitesOptions({
|
|
58708
59006
|
};
|
58709
59007
|
}
|
58710
59008
|
}
|
58711
|
-
function handleRuntimeStdio(stdout2, stderr2) {
|
58712
|
-
const classifiers = {
|
58713
|
-
// Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
|
58714
|
-
isBarf(chunk) {
|
58715
|
-
const containsLlvmSymbolizerWarning = chunk.includes(
|
58716
|
-
"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
|
58717
|
-
);
|
58718
|
-
const containsRecursiveIsolateLockWarning = chunk.includes(
|
58719
|
-
"took recursive isolate lock"
|
58720
|
-
);
|
58721
|
-
const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
|
58722
|
-
return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
|
58723
|
-
},
|
58724
|
-
// Is this chunk an Address In Use error?
|
58725
|
-
isAddressInUse(chunk) {
|
58726
|
-
return chunk.includes("Address already in use; toString() = ");
|
58727
|
-
},
|
58728
|
-
isWarning(chunk) {
|
58729
|
-
return /\.c\+\+:\d+: warning:/.test(chunk);
|
58730
|
-
},
|
58731
|
-
isCodeMovedWarning(chunk) {
|
58732
|
-
return /CODE_MOVED for unknown code block/.test(chunk);
|
58733
|
-
},
|
58734
|
-
isAccessViolation(chunk) {
|
58735
|
-
return chunk.includes("access violation;");
|
58736
|
-
}
|
58737
|
-
};
|
58738
|
-
stdout2.on("data", (chunk) => {
|
58739
|
-
chunk = chunk.toString().trim();
|
58740
|
-
if (classifiers.isBarf(chunk)) {
|
58741
|
-
logger.debug(chunk);
|
58742
|
-
} else if (classifiers.isWarning(chunk)) {
|
58743
|
-
logger.warn(chunk);
|
58744
|
-
} else {
|
58745
|
-
logger.info(getSourceMappedString(chunk));
|
58746
|
-
}
|
58747
|
-
});
|
58748
|
-
stderr2.on("data", (chunk) => {
|
58749
|
-
chunk = chunk.toString().trim();
|
58750
|
-
if (classifiers.isBarf(chunk)) {
|
58751
|
-
if (classifiers.isAddressInUse(chunk)) {
|
58752
|
-
const address = chunk.match(
|
58753
|
-
/Address already in use; toString\(\) = (.+)\n/
|
58754
|
-
)?.[1];
|
58755
|
-
logger.error(
|
58756
|
-
`Address already in use (${address}). Please check that you are not already running a server on this address or specify a different port with --port.`
|
58757
|
-
);
|
58758
|
-
logger.debug(chunk);
|
58759
|
-
} else if (classifiers.isAccessViolation(chunk)) {
|
58760
|
-
let error2 = "There was an access violation in the runtime.";
|
58761
|
-
if (process.platform === "win32") {
|
58762
|
-
error2 += "\nOn Windows, this may be caused by an outdated Microsoft Visual C++ Redistributable library.\nCheck that you have the latest version installed.\nSee https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.";
|
58763
|
-
}
|
58764
|
-
logger.error(error2);
|
58765
|
-
logger.debug(chunk);
|
58766
|
-
} else {
|
58767
|
-
logger.debug(chunk);
|
58768
|
-
}
|
58769
|
-
} else if (classifiers.isWarning(chunk)) {
|
58770
|
-
logger.warn(chunk);
|
58771
|
-
} else if (classifiers.isCodeMovedWarning(chunk)) {
|
58772
|
-
} else {
|
58773
|
-
logger.error(getSourceMappedString(chunk));
|
58774
|
-
}
|
58775
|
-
});
|
58776
|
-
}
|
58777
59009
|
async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticationSecret, remoteProxyConnectionString, remoteBindingsEnabled) {
|
58778
59010
|
if (config.crons?.length && !config.testScheduled) {
|
58779
59011
|
if (!didWarnMiniflareCronSupport) {
|
@@ -58802,7 +59034,7 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
58802
59034
|
if (!didWarnMiniflareVectorizeSupport) {
|
58803
59035
|
didWarnMiniflareVectorizeSupport = true;
|
58804
59036
|
logger.warn(
|
58805
|
-
"You are using a
|
59037
|
+
"You are using Vectorize as a remote binding (through `--experimental-vectorize-bind-to-prod`). It may incur usage charges and modify your databases even in local development. "
|
58806
59038
|
);
|
58807
59039
|
}
|
58808
59040
|
}
|
@@ -58834,7 +59066,8 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
58834
59066
|
logRequests: false,
|
58835
59067
|
log: log2,
|
58836
59068
|
verbose: logger.loggerLevel === "debug",
|
58837
|
-
handleRuntimeStdio,
|
59069
|
+
handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
|
59070
|
+
structuredWorkerdLogs: true,
|
58838
59071
|
defaultPersistRoot,
|
58839
59072
|
workers: [
|
58840
59073
|
{
|
@@ -58878,7 +59111,7 @@ function getImageNameFromDOClassName(options) {
|
|
58878
59111
|
}
|
58879
59112
|
var import_node_assert5, import_node_crypto4, import_node_path16, import_miniflare8, EXTERNAL_SERVICE_WORKER_NAME, EXTERNAL_SERVICE_WORKER_SCRIPT, WranglerLog, DEFAULT_WORKER_NAME, IDENTIFIER_UNSAFE_REGEXP, didWarnMiniflareCronSupport, didWarnMiniflareVectorizeSupport, didWarnAiAccountUsage;
|
58880
59113
|
var init_miniflare = __esm({
|
58881
|
-
"src/dev/miniflare.ts"() {
|
59114
|
+
"src/dev/miniflare/index.ts"() {
|
58882
59115
|
init_import_meta_url();
|
58883
59116
|
import_node_assert5 = __toESM(require("assert"));
|
58884
59117
|
import_node_crypto4 = require("crypto");
|
@@ -58891,11 +59124,11 @@ var init_miniflare = __esm({
|
|
58891
59124
|
init_errors();
|
58892
59125
|
init_fetcher2();
|
58893
59126
|
init_logger();
|
58894
|
-
init_sourcemap();
|
58895
59127
|
init_update_check();
|
58896
59128
|
init_print_bindings();
|
58897
59129
|
init_fetcher3();
|
58898
59130
|
init_class_names_sqlite();
|
59131
|
+
init_stdio();
|
58899
59132
|
EXTERNAL_SERVICE_WORKER_NAME = "__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER";
|
58900
59133
|
EXTERNAL_SERVICE_WORKER_SCRIPT = `
|
58901
59134
|
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
@@ -59053,7 +59286,6 @@ export default {
|
|
59053
59286
|
__name(getDefaultPersistRoot, "getDefaultPersistRoot");
|
59054
59287
|
__name(buildAssetOptions, "buildAssetOptions");
|
59055
59288
|
__name(buildSitesOptions, "buildSitesOptions");
|
59056
|
-
__name(handleRuntimeStdio, "handleRuntimeStdio");
|
59057
59289
|
didWarnMiniflareCronSupport = false;
|
59058
59290
|
didWarnMiniflareVectorizeSupport = false;
|
59059
59291
|
didWarnAiAccountUsage = false;
|
@@ -59546,12 +59778,12 @@ async function getPorts(options) {
|
|
59546
59778
|
}
|
59547
59779
|
throw new Error("No available ports found");
|
59548
59780
|
}
|
59549
|
-
var import_node_net,
|
59781
|
+
var import_node_net, import_node_os4, Locked, lockedPorts, releaseOldLockedPortsIntervalMs, timeout, getLocalHosts, checkAvailablePort, getAvailablePort, portCheckSequence;
|
59550
59782
|
var init_get_port = __esm({
|
59551
59783
|
"../../node_modules/.pnpm/get-port@7.0.0/node_modules/get-port/index.js"() {
|
59552
59784
|
init_import_meta_url();
|
59553
59785
|
import_node_net = __toESM(require("net"), 1);
|
59554
|
-
|
59786
|
+
import_node_os4 = __toESM(require("os"), 1);
|
59555
59787
|
Locked = class extends Error {
|
59556
59788
|
static {
|
59557
59789
|
__name(this, "Locked");
|
@@ -59566,7 +59798,7 @@ var init_get_port = __esm({
|
|
59566
59798
|
};
|
59567
59799
|
releaseOldLockedPortsIntervalMs = 1e3 * 15;
|
59568
59800
|
getLocalHosts = /* @__PURE__ */ __name(() => {
|
59569
|
-
const interfaces =
|
59801
|
+
const interfaces = import_node_os4.default.networkInterfaces();
|
59570
59802
|
const results = /* @__PURE__ */ new Set([void 0, "0.0.0.0"]);
|
59571
59803
|
for (const _interface of Object.values(interfaces)) {
|
59572
59804
|
for (const config of _interface) {
|
@@ -63476,7 +63708,7 @@ ${error2.message}` : execaMessage;
|
|
63476
63708
|
|
63477
63709
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stdio.js
|
63478
63710
|
var aliases, hasAlias, normalizeStdio;
|
63479
|
-
var
|
63711
|
+
var init_stdio2 = __esm({
|
63480
63712
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/stdio.js"() {
|
63481
63713
|
init_import_meta_url();
|
63482
63714
|
aliases = ["stdin", "stdout", "stderr"];
|
@@ -63505,11 +63737,11 @@ var init_stdio = __esm({
|
|
63505
63737
|
});
|
63506
63738
|
|
63507
63739
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
63508
|
-
var
|
63740
|
+
var import_node_os5, import_signal_exit4, DEFAULT_FORCE_KILL_TIMEOUT, spawnedKill, setKillTimeout, shouldForceKill, isSigterm, getForceKillAfterTimeout, spawnedCancel, timeoutKill, setupTimeout, validateTimeout, setExitHandler;
|
63509
63741
|
var init_kill = __esm({
|
63510
63742
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js"() {
|
63511
63743
|
init_import_meta_url();
|
63512
|
-
|
63744
|
+
import_node_os5 = __toESM(require("os"), 1);
|
63513
63745
|
import_signal_exit4 = __toESM(require_signal_exit(), 1);
|
63514
63746
|
DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
63515
63747
|
spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options = {}) => {
|
@@ -63530,7 +63762,7 @@ var init_kill = __esm({
|
|
63530
63762
|
}
|
63531
63763
|
}, "setKillTimeout");
|
63532
63764
|
shouldForceKill = /* @__PURE__ */ __name((signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult, "shouldForceKill");
|
63533
|
-
isSigterm = /* @__PURE__ */ __name((signal) => signal ===
|
63765
|
+
isSigterm = /* @__PURE__ */ __name((signal) => signal === import_node_os5.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
|
63534
63766
|
getForceKillAfterTimeout = /* @__PURE__ */ __name(({ forceKillAfterTimeout = true }) => {
|
63535
63767
|
if (forceKillAfterTimeout === true) {
|
63536
63768
|
return DEFAULT_FORCE_KILL_TIMEOUT;
|
@@ -64040,7 +64272,7 @@ var init_execa = __esm({
|
|
64040
64272
|
init_npm_run_path();
|
64041
64273
|
init_onetime();
|
64042
64274
|
init_error2();
|
64043
|
-
|
64275
|
+
init_stdio2();
|
64044
64276
|
init_kill();
|
64045
64277
|
init_stream();
|
64046
64278
|
init_promise();
|
@@ -66308,7 +66540,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
66308
66540
|
return min;
|
66309
66541
|
}
|
66310
66542
|
if (import_node_process9.default.platform === "win32") {
|
66311
|
-
const osRelease =
|
66543
|
+
const osRelease = import_node_os6.default.release().split(".");
|
66312
66544
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
66313
66545
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
66314
66546
|
}
|
@@ -66356,12 +66588,12 @@ function createSupportsColor2(stream2, options = {}) {
|
|
66356
66588
|
});
|
66357
66589
|
return translateLevel2(level);
|
66358
66590
|
}
|
66359
|
-
var import_node_process9,
|
66591
|
+
var import_node_process9, import_node_os6, import_node_tty3, env3, flagForceColor2, supportsColor2, supports_color_default2;
|
66360
66592
|
var init_supports_color2 = __esm({
|
66361
66593
|
"../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js"() {
|
66362
66594
|
init_import_meta_url();
|
66363
66595
|
import_node_process9 = __toESM(require("process"), 1);
|
66364
|
-
|
66596
|
+
import_node_os6 = __toESM(require("os"), 1);
|
66365
66597
|
import_node_tty3 = __toESM(require("tty"), 1);
|
66366
66598
|
__name(hasFlag2, "hasFlag");
|
66367
66599
|
({ env: env3 } = import_node_process9.default);
|
@@ -66952,20 +67184,19 @@ async function handleDeleteImageCommand(args, config) {
|
|
66952
67184
|
async function handleListImagesCommand(args, config) {
|
66953
67185
|
const responses = await promiseSpinner(
|
66954
67186
|
getCreds().then(async (creds) => {
|
66955
|
-
const repos = await
|
66956
|
-
const
|
67187
|
+
const repos = await listReposWithTags(creds);
|
67188
|
+
const processed = [];
|
66957
67189
|
const accountId = config.account_id || await getAccountId(config);
|
66958
67190
|
const accountIdPrefix = new RegExp(`^${accountId}/`);
|
66959
67191
|
const filter = new RegExp(args.filter ?? "");
|
66960
|
-
for (const repo of repos) {
|
67192
|
+
for (const [repo, tags] of Object.entries(repos)) {
|
66961
67193
|
const stripped = repo.replace(/^\/+/, "");
|
66962
67194
|
if (filter.test(stripped)) {
|
66963
|
-
const tags = await listTags(stripped, creds);
|
66964
67195
|
const name2 = stripped.replace(accountIdPrefix, "");
|
66965
|
-
|
67196
|
+
processed.push({ name: name2, tags });
|
66966
67197
|
}
|
66967
67198
|
}
|
66968
|
-
return
|
67199
|
+
return processed;
|
66969
67200
|
}),
|
66970
67201
|
{ message: "Listing" }
|
66971
67202
|
);
|
@@ -66998,22 +67229,9 @@ async function listImages(responses, digests = false, json = false) {
|
|
66998
67229
|
}
|
66999
67230
|
}
|
67000
67231
|
}
|
67001
|
-
async function
|
67002
|
-
const url4 = new URL(`https://${getCloudflareContainerRegistry()}`);
|
67003
|
-
const baseUrl = `${url4.protocol}//${url4.host}`;
|
67004
|
-
const tagsUrl = `${baseUrl}/v2/${repo}/tags/list`;
|
67005
|
-
const tagsResponse = await fetch(tagsUrl, {
|
67006
|
-
method: "GET",
|
67007
|
-
headers: {
|
67008
|
-
Authorization: `Basic ${creds}`
|
67009
|
-
}
|
67010
|
-
});
|
67011
|
-
const tagsData = await tagsResponse.json();
|
67012
|
-
return tagsData.tags || [];
|
67013
|
-
}
|
67014
|
-
async function listRepos(creds) {
|
67232
|
+
async function listReposWithTags(creds) {
|
67015
67233
|
const url4 = new URL(`https://${getCloudflareContainerRegistry()}`);
|
67016
|
-
const catalogUrl = `${url4.protocol}//${url4.host}/v2/_catalog`;
|
67234
|
+
const catalogUrl = `${url4.protocol}//${url4.host}/v2/_catalog?tags=true`;
|
67017
67235
|
const response = await fetch(catalogUrl, {
|
67018
67236
|
method: "GET",
|
67019
67237
|
headers: {
|
@@ -67027,7 +67245,7 @@ async function listRepos(creds) {
|
|
67027
67245
|
);
|
67028
67246
|
}
|
67029
67247
|
const data = await response.json();
|
67030
|
-
return data.repositories
|
67248
|
+
return data.repositories ?? {};
|
67031
67249
|
}
|
67032
67250
|
async function deleteTag(baseUrl, accountId, image, tag, creds) {
|
67033
67251
|
const manifestAcceptHeader = "application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.v2+json";
|
@@ -67111,8 +67329,7 @@ var init_images2 = __esm({
|
|
67111
67329
|
__name(handleDeleteImageCommand, "handleDeleteImageCommand");
|
67112
67330
|
__name(handleListImagesCommand, "handleListImagesCommand");
|
67113
67331
|
__name(listImages, "listImages");
|
67114
|
-
__name(
|
67115
|
-
__name(listRepos, "listRepos");
|
67332
|
+
__name(listReposWithTags, "listReposWithTags");
|
67116
67333
|
__name(deleteTag, "deleteTag");
|
67117
67334
|
__name(getCreds, "getCreds");
|
67118
67335
|
}
|
@@ -69027,7 +69244,7 @@ function getWranglerVersion() {
|
|
69027
69244
|
return version;
|
69028
69245
|
}
|
69029
69246
|
function getPlatform() {
|
69030
|
-
const platform3 =
|
69247
|
+
const platform3 = import_node_os7.default.platform();
|
69031
69248
|
switch (platform3) {
|
69032
69249
|
case "win32":
|
69033
69250
|
return "Windows";
|
@@ -69043,17 +69260,17 @@ function getOS() {
|
|
69043
69260
|
return process.platform + ":" + process.arch;
|
69044
69261
|
}
|
69045
69262
|
function getOSVersion() {
|
69046
|
-
return
|
69263
|
+
return import_node_os7.default.version();
|
69047
69264
|
}
|
69048
69265
|
function getNodeVersion() {
|
69049
69266
|
const nodeVersion2 = process.versions.node;
|
69050
69267
|
return parseInt(nodeVersion2.split(".")[0]);
|
69051
69268
|
}
|
69052
|
-
var
|
69269
|
+
var import_node_os7;
|
69053
69270
|
var init_helpers5 = __esm({
|
69054
69271
|
"src/metrics/helpers.ts"() {
|
69055
69272
|
init_import_meta_url();
|
69056
|
-
|
69273
|
+
import_node_os7 = __toESM(require("os"));
|
69057
69274
|
init_package();
|
69058
69275
|
__name(getWranglerVersion, "getWranglerVersion");
|
69059
69276
|
__name(getPlatform, "getPlatform");
|
@@ -69926,26 +70143,6 @@ async function printBundleSize(main2, modules) {
|
|
69926
70143
|
const colorizedReport = percentage > 90 ? source_default.red(bundleReport) : percentage > 70 ? source_default.yellow(bundleReport) : source_default.green(bundleReport);
|
69927
70144
|
logger.log(`Total Upload: ${colorizedReport}`);
|
69928
70145
|
}
|
69929
|
-
function printOffendingDependencies(dependencies) {
|
69930
|
-
const warning = [];
|
69931
|
-
const dependenciesSorted = Object.entries(dependencies);
|
69932
|
-
dependenciesSorted.sort(
|
69933
|
-
([_adep, aData], [_bdep, bData]) => bData.bytesInOutput - aData.bytesInOutput
|
69934
|
-
);
|
69935
|
-
const topLargest = dependenciesSorted.slice(0, 5);
|
69936
|
-
if (topLargest.length > 0) {
|
69937
|
-
warning.push(
|
69938
|
-
`Here are the ${topLargest.length} largest dependencies included in your script:`
|
69939
|
-
);
|
69940
|
-
for (const [dep, data] of topLargest) {
|
69941
|
-
warning.push(
|
69942
|
-
`- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES).toFixed(2)} KiB`
|
69943
|
-
);
|
69944
|
-
}
|
69945
|
-
warning.push("If these are unnecessary, consider removing them");
|
69946
|
-
logger.warn(warning.join("\n"));
|
69947
|
-
}
|
69948
|
-
}
|
69949
70146
|
var import_node_buffer3, import_node_zlib, ONE_KIB_BYTES, MAX_GZIP_SIZE_BYTES;
|
69950
70147
|
var init_bundle_reporter = __esm({
|
69951
70148
|
"src/deployment-bundle/bundle-reporter.ts"() {
|
@@ -69958,7 +70155,6 @@ var init_bundle_reporter = __esm({
|
|
69958
70155
|
MAX_GZIP_SIZE_BYTES = 3 * ONE_KIB_BYTES * ONE_KIB_BYTES;
|
69959
70156
|
__name(getSize, "getSize");
|
69960
70157
|
__name(printBundleSize, "printBundleSize");
|
69961
|
-
__name(printOffendingDependencies, "printOffendingDependencies");
|
69962
70158
|
}
|
69963
70159
|
});
|
69964
70160
|
|
@@ -82210,7 +82406,7 @@ var require_main = __commonJS({
|
|
82210
82406
|
init_import_meta_url();
|
82211
82407
|
var fs24 = require("fs");
|
82212
82408
|
var path72 = require("path");
|
82213
|
-
var
|
82409
|
+
var os12 = require("os");
|
82214
82410
|
var crypto8 = require("crypto");
|
82215
82411
|
var packageJson = require_package();
|
82216
82412
|
var version5 = packageJson.version;
|
@@ -82316,7 +82512,7 @@ var require_main = __commonJS({
|
|
82316
82512
|
}
|
82317
82513
|
__name(_vaultPath, "_vaultPath");
|
82318
82514
|
function _resolveHome(envPath) {
|
82319
|
-
return envPath[0] === "~" ? path72.join(
|
82515
|
+
return envPath[0] === "~" ? path72.join(os12.homedir(), envPath.slice(1)) : envPath;
|
82320
82516
|
}
|
82321
82517
|
__name(_resolveHome, "_resolveHome");
|
82322
82518
|
function _configVault(options) {
|
@@ -84927,6 +85123,9 @@ function renderScriptName(details) {
|
|
84927
85123
|
function isUsedAsServiceBinding(references) {
|
84928
85124
|
return (references.services?.incoming.length || 0) > 0;
|
84929
85125
|
}
|
85126
|
+
function isUsedByPagesFunction(references) {
|
85127
|
+
return references.services?.pages_function === true;
|
85128
|
+
}
|
84930
85129
|
function isUsedAsDurableObjectNamespace(references, scriptName) {
|
84931
85130
|
return (references.durable_objects?.filter((ref) => ref.service !== scriptName)?.length || 0) > 0;
|
84932
85131
|
}
|
@@ -84945,7 +85144,7 @@ async function checkAndConfirmForceDeleteIfNecessary(complianceConfig, scriptNam
|
|
84945
85144
|
complianceConfig,
|
84946
85145
|
`/accounts/${accountId}/workers/tails/by-consumer/${scriptName}`
|
84947
85146
|
);
|
84948
|
-
const isDependentService = isUsedAsServiceBinding(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
|
85147
|
+
const isDependentService = isUsedAsServiceBinding(references) || isUsedByPagesFunction(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
|
84949
85148
|
if (!isDependentService) {
|
84950
85149
|
return false;
|
84951
85150
|
}
|
@@ -84956,6 +85155,11 @@ async function checkAndConfirmForceDeleteIfNecessary(complianceConfig, scriptNam
|
|
84956
85155
|
`- Worker ${dependentScript} uses this Worker as a Service Binding`
|
84957
85156
|
);
|
84958
85157
|
}
|
85158
|
+
if (isUsedByPagesFunction(references)) {
|
85159
|
+
dependentMessages.push(
|
85160
|
+
`- A Pages project has a Service Binding to this Worker`
|
85161
|
+
);
|
85162
|
+
}
|
84959
85163
|
for (const implementedDOBindingReference of references.durable_objects || []) {
|
84960
85164
|
if (implementedDOBindingReference.service === scriptName) {
|
84961
85165
|
continue;
|
@@ -85087,6 +85291,7 @@ var init_delete3 = __esm({
|
|
85087
85291
|
__name(deleteSiteNamespaceIfExisting, "deleteSiteNamespaceIfExisting");
|
85088
85292
|
__name(renderScriptName, "renderScriptName");
|
85089
85293
|
__name(isUsedAsServiceBinding, "isUsedAsServiceBinding");
|
85294
|
+
__name(isUsedByPagesFunction, "isUsedByPagesFunction");
|
85090
85295
|
__name(isUsedAsDurableObjectNamespace, "isUsedAsDurableObjectNamespace");
|
85091
85296
|
__name(isUsedAsDispatchOutbound, "isUsedAsDispatchOutbound");
|
85092
85297
|
__name(isUsedAsTailConsumer, "isUsedAsTailConsumer");
|
@@ -93054,6 +93259,7 @@ var init_deploy6 = __esm({
|
|
93054
93259
|
init_logger();
|
93055
93260
|
init_metrics();
|
93056
93261
|
init_output();
|
93262
|
+
init_parse();
|
93057
93263
|
init_user2();
|
93058
93264
|
init_friendly_validator_errors();
|
93059
93265
|
init_constants();
|
@@ -93382,10 +93588,18 @@ To silence this warning, pass in --commit-dirty=true`
|
|
93382
93588
|
);
|
93383
93589
|
const failureMessage = logs.data[logs.total - 1].line.replace("Error:", "").trim();
|
93384
93590
|
if (failureMessage.includes("Script startup exceeded CPU time limit")) {
|
93591
|
+
const startupError = new ParseError({ text: failureMessage });
|
93592
|
+
Object.assign(startupError, { code: 10021 });
|
93385
93593
|
const workerBundle = formData.get("_worker.bundle");
|
93386
93594
|
const filePath = import_node_path47.default.join(getPagesTmpDir(), "_worker.bundle");
|
93387
93595
|
await (0, import_promises22.writeFile)(filePath, workerBundle.stream());
|
93388
|
-
|
93596
|
+
throw new UserError(
|
93597
|
+
await diagnoseStartupError(
|
93598
|
+
startupError,
|
93599
|
+
filePath,
|
93600
|
+
getPagesProjectRoot()
|
93601
|
+
)
|
93602
|
+
);
|
93389
93603
|
}
|
93390
93604
|
throw new FatalError(
|
93391
93605
|
`Deployment failed!
|
@@ -132786,7 +133000,7 @@ var init_bucket = __esm({
|
|
132786
133000
|
positionalArgs: ["bucket"],
|
132787
133001
|
args: {
|
132788
133002
|
bucket: {
|
132789
|
-
describe: "The name of the bucket to
|
133003
|
+
describe: "The name of the bucket to retrieve info for",
|
132790
133004
|
type: "string",
|
132791
133005
|
demandOption: true
|
132792
133006
|
},
|
@@ -132795,11 +133009,21 @@ var init_bucket = __esm({
|
|
132795
133009
|
alias: "J",
|
132796
133010
|
requiresArg: true,
|
132797
133011
|
type: "string"
|
133012
|
+
},
|
133013
|
+
json: {
|
133014
|
+
describe: "Return the bucket information as JSON",
|
133015
|
+
type: "boolean",
|
133016
|
+
default: false
|
132798
133017
|
}
|
132799
133018
|
},
|
133019
|
+
behaviour: {
|
133020
|
+
printBanner: /* @__PURE__ */ __name((args) => !args.json, "printBanner")
|
133021
|
+
},
|
132800
133022
|
async handler(args, { config }) {
|
132801
133023
|
const accountId = await requireAuth(config);
|
132802
|
-
|
133024
|
+
if (!args.json) {
|
133025
|
+
logger.log(`Getting info for '${args.bucket}'...`);
|
133026
|
+
}
|
132803
133027
|
const bucketInfo = await getR2Bucket(
|
132804
133028
|
config,
|
132805
133029
|
accountId,
|
@@ -132820,7 +133044,11 @@ var init_bucket = __esm({
|
|
132820
133044
|
object_count: bucketMetrics.objectCount.toLocaleString(),
|
132821
133045
|
bucket_size: bucketMetrics.totalSize
|
132822
133046
|
};
|
132823
|
-
|
133047
|
+
if (args.json) {
|
133048
|
+
logger.json(output);
|
133049
|
+
} else {
|
133050
|
+
logger.log(formatLabelledValues(output));
|
133051
|
+
}
|
132824
133052
|
}
|
132825
133053
|
});
|
132826
133054
|
r2BucketDeleteCommand = createCommand({
|
@@ -143490,11 +143718,11 @@ var init_esm8 = __esm({
|
|
143490
143718
|
});
|
143491
143719
|
|
143492
143720
|
// ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js
|
143493
|
-
var
|
143721
|
+
var os8, import_util15, NodeClient;
|
143494
143722
|
var init_client9 = __esm({
|
143495
143723
|
"../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js"() {
|
143496
143724
|
init_import_meta_url();
|
143497
|
-
|
143725
|
+
os8 = __toESM(require("os"));
|
143498
143726
|
import_util15 = require("util");
|
143499
143727
|
init_esm7();
|
143500
143728
|
NodeClient = class extends ServerRuntimeClient {
|
@@ -143525,7 +143753,7 @@ var init_client9 = __esm({
|
|
143525
143753
|
...options,
|
143526
143754
|
platform: "node",
|
143527
143755
|
runtime: { name: "node", version: global.process.version },
|
143528
|
-
serverName: options.serverName || global.process.env.SENTRY_NAME ||
|
143756
|
+
serverName: options.serverName || global.process.env.SENTRY_NAME || os8.hostname()
|
143529
143757
|
};
|
143530
143758
|
super(clientOptions);
|
143531
143759
|
}
|
@@ -145158,7 +145386,7 @@ var init_contextlines = __esm({
|
|
145158
145386
|
|
145159
145387
|
// ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/integrations/context.js
|
145160
145388
|
async function getOsContext() {
|
145161
|
-
const platformId =
|
145389
|
+
const platformId = os9.platform();
|
145162
145390
|
switch (platformId) {
|
145163
145391
|
case "darwin":
|
145164
145392
|
return getDarwinInfo();
|
@@ -145167,7 +145395,7 @@ async function getOsContext() {
|
|
145167
145395
|
default:
|
145168
145396
|
return {
|
145169
145397
|
name: PLATFORM_NAMES[platformId] || platformId,
|
145170
|
-
version:
|
145398
|
+
version: os9.release()
|
145171
145399
|
};
|
145172
145400
|
}
|
145173
145401
|
}
|
@@ -145198,19 +145426,19 @@ function getDeviceContext(deviceOpt) {
|
|
145198
145426
|
const device = {};
|
145199
145427
|
let uptime3;
|
145200
145428
|
try {
|
145201
|
-
uptime3 =
|
145429
|
+
uptime3 = os9.uptime && os9.uptime();
|
145202
145430
|
} catch (e7) {
|
145203
145431
|
}
|
145204
145432
|
if (typeof uptime3 === "number") {
|
145205
145433
|
device.boot_time = new Date(Date.now() - uptime3 * 1e3).toISOString();
|
145206
145434
|
}
|
145207
|
-
device.arch =
|
145435
|
+
device.arch = os9.arch();
|
145208
145436
|
if (deviceOpt === true || deviceOpt.memory) {
|
145209
|
-
device.memory_size =
|
145210
|
-
device.free_memory =
|
145437
|
+
device.memory_size = os9.totalmem();
|
145438
|
+
device.free_memory = os9.freemem();
|
145211
145439
|
}
|
145212
145440
|
if (deviceOpt === true || deviceOpt.cpu) {
|
145213
|
-
const cpuInfo =
|
145441
|
+
const cpuInfo = os9.cpus();
|
145214
145442
|
if (cpuInfo && cpuInfo.length) {
|
145215
145443
|
const firstCpu = cpuInfo[0];
|
145216
145444
|
device.processor_count = cpuInfo.length;
|
@@ -145226,9 +145454,9 @@ function matchFirst(regex2, text) {
|
|
145226
145454
|
}
|
145227
145455
|
async function getDarwinInfo() {
|
145228
145456
|
const darwinInfo = {
|
145229
|
-
kernel_version:
|
145457
|
+
kernel_version: os9.release(),
|
145230
145458
|
name: "Mac OS X",
|
145231
|
-
version: `10.${Number(
|
145459
|
+
version: `10.${Number(os9.release().split(".")[0]) - 4}`
|
145232
145460
|
};
|
145233
145461
|
try {
|
145234
145462
|
const output = await new Promise((resolve25, reject) => {
|
@@ -145252,7 +145480,7 @@ function getLinuxDistroId(name2) {
|
|
145252
145480
|
}
|
145253
145481
|
async function getLinuxInfo() {
|
145254
145482
|
const linuxInfo = {
|
145255
|
-
kernel_version:
|
145483
|
+
kernel_version: os9.release(),
|
145256
145484
|
name: "Linux"
|
145257
145485
|
};
|
145258
145486
|
try {
|
@@ -145326,14 +145554,14 @@ function getCloudResourceContext() {
|
|
145326
145554
|
return void 0;
|
145327
145555
|
}
|
145328
145556
|
}
|
145329
|
-
var import_child_process6, import_fs24,
|
145557
|
+
var import_child_process6, import_fs24, os9, import_path25, import_util16, readFileAsync, readDirAsync, Context, PLATFORM_NAMES, LINUX_DISTROS, LINUX_VERSIONS;
|
145330
145558
|
var init_context = __esm({
|
145331
145559
|
"../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/integrations/context.js"() {
|
145332
145560
|
init_import_meta_url();
|
145333
145561
|
init_esm6();
|
145334
145562
|
import_child_process6 = require("child_process");
|
145335
145563
|
import_fs24 = require("fs");
|
145336
|
-
|
145564
|
+
os9 = __toESM(require("os"));
|
145337
145565
|
import_path25 = require("path");
|
145338
145566
|
import_util16 = require("util");
|
145339
145567
|
readFileAsync = (0, import_util16.promisify)(import_fs24.readFile);
|
@@ -145397,7 +145625,7 @@ var init_context = __esm({
|
|
145397
145625
|
contexts.app.app_memory = process.memoryUsage().rss;
|
145398
145626
|
}
|
145399
145627
|
if (_optionalChain([contexts, "optionalAccess", (_13) => _13.device, "optionalAccess", (_14) => _14.free_memory])) {
|
145400
|
-
contexts.device.free_memory =
|
145628
|
+
contexts.device.free_memory = os9.freemem();
|
145401
145629
|
}
|
145402
145630
|
return contexts;
|
145403
145631
|
}
|
@@ -151326,12 +151554,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
151326
151554
|
config.tail_consumers
|
151327
151555
|
);
|
151328
151556
|
}
|
151329
|
-
await helpIfErrorIsSizeOrScriptStartup(
|
151557
|
+
const message = await helpIfErrorIsSizeOrScriptStartup(
|
151330
151558
|
err,
|
151331
151559
|
dependencies,
|
151332
151560
|
workerBundle,
|
151333
151561
|
props.projectRoot
|
151334
151562
|
);
|
151563
|
+
if (message) {
|
151564
|
+
logger.error(message);
|
151565
|
+
}
|
151335
151566
|
if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
151336
151567
|
const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
|
151337
151568
|
if (bundleType === "commonjs") {
|
@@ -156647,6 +156878,7 @@ function createCLIParser(argv) {
|
|
156647
156878
|
}
|
156648
156879
|
async function main(argv) {
|
156649
156880
|
setupSentry();
|
156881
|
+
checkMacOSVersion({ shouldThrow: false });
|
156650
156882
|
const startTime = Date.now();
|
156651
156883
|
const wrangler = createCLIParser(argv);
|
156652
156884
|
let command2;
|
@@ -156746,7 +156978,7 @@ async function main(argv) {
|
|
156746
156978
|
logger.log(e7.message);
|
156747
156979
|
} else if (e7 instanceof Error && e7.message.includes("Raw mode is not supported on")) {
|
156748
156980
|
mayReport = false;
|
156749
|
-
const currentPlatform =
|
156981
|
+
const currentPlatform = import_node_os8.default.platform();
|
156750
156982
|
const thisTerminalIsUnsupported = "This terminal doesn't support raw mode.";
|
156751
156983
|
const soWranglerWontWork = "Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it.";
|
156752
156984
|
const tryRunningItIn = "Try running your previous command in a terminal that supports raw mode";
|
@@ -156824,14 +157056,15 @@ ${tryRunningItIn}${oneOfThese}`
|
|
156824
157056
|
}
|
156825
157057
|
}
|
156826
157058
|
}
|
156827
|
-
var import_node_assert25,
|
157059
|
+
var import_node_assert25, import_node_os8, import_node_path55, import_promises31, import_undici20;
|
156828
157060
|
var init_src = __esm({
|
156829
157061
|
"src/index.ts"() {
|
156830
157062
|
init_import_meta_url();
|
156831
157063
|
import_node_assert25 = __toESM(require("assert"));
|
156832
|
-
|
157064
|
+
import_node_os8 = __toESM(require("os"));
|
156833
157065
|
import_node_path55 = require("path");
|
156834
157066
|
import_promises31 = require("timers/promises");
|
157067
|
+
init_cli();
|
156835
157068
|
init_containers_shared();
|
156836
157069
|
init_source();
|
156837
157070
|
import_undici20 = __toESM(require_undici());
|
@@ -157071,11 +157304,13 @@ function getModuleType(entry) {
|
|
157071
157304
|
}
|
157072
157305
|
async function convertWorkerBundleToModules(workerBundle) {
|
157073
157306
|
return await Promise.all(
|
157074
|
-
[...workerBundle.entries()].map(
|
157075
|
-
|
157076
|
-
|
157077
|
-
|
157078
|
-
|
157307
|
+
[...workerBundle.entries()].map(
|
157308
|
+
async (m6) => ({
|
157309
|
+
type: getModuleType(m6[1]),
|
157310
|
+
path: m6[0],
|
157311
|
+
contents: await getEntryValue(m6[1])
|
157312
|
+
})
|
157313
|
+
)
|
157079
157314
|
);
|
157080
157315
|
}
|
157081
157316
|
async function parseFormDataFromFile(file) {
|
@@ -157225,48 +157460,101 @@ var init_commands9 = __esm({
|
|
157225
157460
|
});
|
157226
157461
|
|
157227
157462
|
// src/utils/friendly-validator-errors.ts
|
157463
|
+
async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
|
157464
|
+
if (errIsScriptSize(err)) {
|
157465
|
+
return await diagnoseScriptSizeError(err, dependencies);
|
157466
|
+
}
|
157467
|
+
if (errIsStartupErr(err)) {
|
157468
|
+
return await diagnoseStartupError(err, workerBundle, projectRoot);
|
157469
|
+
}
|
157470
|
+
return null;
|
157471
|
+
}
|
157472
|
+
function diagnoseScriptSizeError(err, dependencies) {
|
157473
|
+
let message = esm_default2`
|
157474
|
+
Your Worker failed validation because it exceeded size limits.
|
157475
|
+
|
157476
|
+
${err.text}
|
157477
|
+
${err.notes.map((note) => ` - ${note.text}`).join("\n")}
|
157478
|
+
`;
|
157479
|
+
const dependenciesMessage = getOffendingDependenciesMessage(dependencies);
|
157480
|
+
if (dependenciesMessage) {
|
157481
|
+
message += dependenciesMessage;
|
157482
|
+
}
|
157483
|
+
return message;
|
157484
|
+
}
|
157485
|
+
async function diagnoseStartupError(err, workerBundle, projectRoot) {
|
157486
|
+
let errorMessage = esm_default2`
|
157487
|
+
Your Worker failed validation because it exceeded startup limits.
|
157488
|
+
|
157489
|
+
${err.text}
|
157490
|
+
${err.notes.map((note) => ` - ${note.text}`).join("\n")}
|
157491
|
+
|
157492
|
+
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
|
157493
|
+
|
157494
|
+
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`;
|
157495
|
+
try {
|
157496
|
+
const cpuProfile = await analyseBundle(workerBundle);
|
157497
|
+
const tmpDir = await getWranglerTmpDir(
|
157498
|
+
projectRoot,
|
157499
|
+
"startup-profile",
|
157500
|
+
false
|
157501
|
+
);
|
157502
|
+
const profile = import_node_path56.default.relative(
|
157503
|
+
projectRoot ?? process.cwd(),
|
157504
|
+
import_node_path56.default.join(tmpDir.path, `worker.cpuprofile`)
|
157505
|
+
);
|
157506
|
+
await (0, import_promises34.writeFile)(profile, JSON.stringify(cpuProfile));
|
157507
|
+
errorMessage += esm_default2`
|
157508
|
+
|
157509
|
+
A CPU Profile of your Worker's startup phase has been written to ${profile} - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`;
|
157510
|
+
} catch (profilingError) {
|
157511
|
+
logger.debug(
|
157512
|
+
`An error occurred while trying to locally profile the Worker: ${profilingError}`
|
157513
|
+
);
|
157514
|
+
}
|
157515
|
+
return errorMessage;
|
157516
|
+
}
|
157517
|
+
function getOffendingDependenciesMessage(dependencies) {
|
157518
|
+
const dependenciesSorted = Object.entries(dependencies);
|
157519
|
+
if (dependenciesSorted.length === 0) {
|
157520
|
+
return null;
|
157521
|
+
}
|
157522
|
+
dependenciesSorted.sort(
|
157523
|
+
([, aData], [, bData]) => bData.bytesInOutput - aData.bytesInOutput
|
157524
|
+
);
|
157525
|
+
const topLargest = dependenciesSorted.slice(0, 5);
|
157526
|
+
const ONE_KIB_BYTES2 = 1024;
|
157527
|
+
return [
|
157528
|
+
"",
|
157529
|
+
`Here are the ${topLargest.length} largest dependencies included in your script:`,
|
157530
|
+
"",
|
157531
|
+
...topLargest.map(
|
157532
|
+
([dep, data]) => `- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES2).toFixed(2)} KiB`
|
157533
|
+
),
|
157534
|
+
"",
|
157535
|
+
"If these are unnecessary, consider removing them",
|
157536
|
+
""
|
157537
|
+
].join("\n");
|
157538
|
+
}
|
157228
157539
|
function errIsScriptSize(err) {
|
157229
|
-
if (!err) {
|
157540
|
+
if (!(err instanceof ParseError)) {
|
157230
157541
|
return false;
|
157231
157542
|
}
|
157232
|
-
if (err.code === 10027) {
|
157543
|
+
if ("code" in err && err.code === 10027) {
|
157233
157544
|
return true;
|
157234
157545
|
}
|
157235
157546
|
return false;
|
157236
157547
|
}
|
157237
157548
|
function errIsStartupErr(err) {
|
157238
|
-
if (!err) {
|
157549
|
+
if (!(err instanceof ParseError)) {
|
157239
157550
|
return false;
|
157240
157551
|
}
|
157241
|
-
if (
|
157552
|
+
if ("code" in err && err.code === 10021 && /startup/i.test(err.notes[0]?.text)) {
|
157242
157553
|
return true;
|
157243
157554
|
}
|
157244
157555
|
return false;
|
157245
157556
|
}
|
157246
|
-
|
157247
|
-
const cpuProfile = await analyseBundle(workerBundle);
|
157248
|
-
const tmpDir = await getWranglerTmpDir(projectRoot, "startup-profile", false);
|
157249
|
-
const profile = import_node_path56.default.relative(
|
157250
|
-
projectRoot ?? process.cwd(),
|
157251
|
-
import_node_path56.default.join(tmpDir.path, `worker.cpuprofile`)
|
157252
|
-
);
|
157253
|
-
await (0, import_promises34.writeFile)(profile, JSON.stringify(cpuProfile));
|
157254
|
-
throw new UserError(esm_default2`
|
157255
|
-
Your Worker failed validation because it exceeded startup limits.
|
157256
|
-
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
|
157257
|
-
|
157258
|
-
A CPU Profile of your Worker's startup phase has been written to ${profile} - load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.
|
157259
|
-
|
157260
|
-
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`);
|
157261
|
-
}
|
157262
|
-
async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
|
157263
|
-
if (errIsScriptSize(err)) {
|
157264
|
-
printOffendingDependencies(dependencies);
|
157265
|
-
} else if (errIsStartupErr(err)) {
|
157266
|
-
await handleStartupError(workerBundle, projectRoot);
|
157267
|
-
}
|
157268
|
-
}
|
157269
|
-
var import_promises34, import_node_path56, scriptStartupErrorRegex;
|
157557
|
+
var import_promises34, import_node_path56;
|
157270
157558
|
var init_friendly_validator_errors = __esm({
|
157271
157559
|
"src/utils/friendly-validator-errors.ts"() {
|
157272
157560
|
init_import_meta_url();
|
@@ -157274,15 +157562,15 @@ var init_friendly_validator_errors = __esm({
|
|
157274
157562
|
import_node_path56 = __toESM(require("path"));
|
157275
157563
|
init_esm2();
|
157276
157564
|
init_commands9();
|
157277
|
-
|
157278
|
-
init_errors();
|
157565
|
+
init_logger();
|
157279
157566
|
init_parse();
|
157280
157567
|
init_paths();
|
157568
|
+
__name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
|
157569
|
+
__name(diagnoseScriptSizeError, "diagnoseScriptSizeError");
|
157570
|
+
__name(diagnoseStartupError, "diagnoseStartupError");
|
157571
|
+
__name(getOffendingDependenciesMessage, "getOffendingDependenciesMessage");
|
157281
157572
|
__name(errIsScriptSize, "errIsScriptSize");
|
157282
|
-
scriptStartupErrorRegex = /startup/i;
|
157283
157573
|
__name(errIsStartupErr, "errIsStartupErr");
|
157284
|
-
__name(handleStartupError, "handleStartupError");
|
157285
|
-
__name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
|
157286
157574
|
}
|
157287
157575
|
});
|
157288
157576
|
|
@@ -157835,12 +158123,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
157835
158123
|
config.tail_consumers
|
157836
158124
|
);
|
157837
158125
|
}
|
157838
|
-
await helpIfErrorIsSizeOrScriptStartup(
|
158126
|
+
const message = await helpIfErrorIsSizeOrScriptStartup(
|
157839
158127
|
err,
|
157840
158128
|
dependencies,
|
157841
158129
|
workerBundle,
|
157842
158130
|
props.projectRoot
|
157843
158131
|
);
|
158132
|
+
if (message !== null) {
|
158133
|
+
logger.error(message);
|
158134
|
+
}
|
157844
158135
|
if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
157845
158136
|
err.preventReport();
|
157846
158137
|
if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
|
@@ -159416,12 +159707,12 @@ function maybeHandleNetworkLoadResource(url4, bundle, tmpDir) {
|
|
159416
159707
|
return (0, import_fs27.readFileSync)(filePath, "utf-8");
|
159417
159708
|
}
|
159418
159709
|
}
|
159419
|
-
var import_fs27,
|
159710
|
+
var import_fs27, import_node_os9, import_node_url11, import_path27, import_open2, mapConsoleAPIMessageTypeToConsoleMethod, openInspector;
|
159420
159711
|
var init_inspect2 = __esm({
|
159421
159712
|
"src/dev/inspect.ts"() {
|
159422
159713
|
init_import_meta_url();
|
159423
159714
|
import_fs27 = require("fs");
|
159424
|
-
|
159715
|
+
import_node_os9 = __toESM(require("os"));
|
159425
159716
|
import_node_url11 = require("url");
|
159426
159717
|
import_path27 = __toESM(require("path"));
|
159427
159718
|
import_open2 = __toESM(require_open());
|
@@ -159461,7 +159752,7 @@ var init_inspect2 = __esm({
|
|
159461
159752
|
const url4 = `https://devtools.devprod.cloudflare.dev/js_app?${query.toString()}`;
|
159462
159753
|
const errorMessage = "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
|
159463
159754
|
let braveBrowser;
|
159464
|
-
switch (
|
159755
|
+
switch (import_node_os9.default.platform()) {
|
159465
159756
|
case "darwin":
|
159466
159757
|
case "win32":
|
159467
159758
|
braveBrowser = "Brave";
|
@@ -177828,6 +178119,7 @@ var init_ProxyController = __esm({
|
|
177828
178119
|
init_wrapper();
|
177829
178120
|
init_inspect2();
|
177830
178121
|
init_miniflare();
|
178122
|
+
init_stdio();
|
177831
178123
|
init_https_options();
|
177832
178124
|
init_logger();
|
177833
178125
|
init_sourcemap();
|
@@ -177906,7 +178198,8 @@ var init_ProxyController = __esm({
|
|
177906
178198
|
},
|
177907
178199
|
this.localServerReady.promise
|
177908
178200
|
),
|
177909
|
-
handleRuntimeStdio,
|
178201
|
+
handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
|
178202
|
+
structuredWorkerdLogs: true,
|
177910
178203
|
liveReload: false
|
177911
178204
|
};
|
177912
178205
|
if (this.latestConfig.dev.inspector !== false && !inVscodeJsDebugTerminal) {
|
@@ -179462,6 +179755,9 @@ var init_LocalRuntimeController = __esm({
|
|
179462
179755
|
// current container that is being built
|
179463
179756
|
containerBeingBuilt;
|
179464
179757
|
onBundleStart(_4) {
|
179758
|
+
process.on("exit", () => {
|
179759
|
+
this.cleanupContainers();
|
179760
|
+
});
|
179465
179761
|
}
|
179466
179762
|
async #onBundleComplete(data, id) {
|
179467
179763
|
try {
|
@@ -179598,12 +179894,15 @@ var init_LocalRuntimeController = __esm({
|
|
179598
179894
|
}
|
179599
179895
|
onPreviewTokenExpired(_4) {
|
179600
179896
|
}
|
179601
|
-
cleanupContainers = /* @__PURE__ */ __name(
|
179897
|
+
cleanupContainers = /* @__PURE__ */ __name(() => {
|
179898
|
+
if (!this.containerImageTagsSeen.size) {
|
179899
|
+
return;
|
179900
|
+
}
|
179602
179901
|
(0, import_node_assert34.default)(
|
179603
179902
|
this.dockerPath,
|
179604
179903
|
"Docker path should have been set if containers are enabled"
|
179605
179904
|
);
|
179606
|
-
|
179905
|
+
cleanupContainers(this.dockerPath, this.containerImageTagsSeen);
|
179607
179906
|
}, "cleanupContainers");
|
179608
179907
|
#teardown = /* @__PURE__ */ __name(async () => {
|
179609
179908
|
logger.debug("LocalRuntimeController teardown beginning...");
|
@@ -179612,15 +179911,6 @@ var init_LocalRuntimeController = __esm({
|
|
179612
179911
|
}
|
179613
179912
|
await this.#mf?.dispose();
|
179614
179913
|
this.#mf = void 0;
|
179615
|
-
if (this.containerImageTagsSeen.size > 0) {
|
179616
|
-
try {
|
179617
|
-
await this.cleanupContainers();
|
179618
|
-
} catch {
|
179619
|
-
logger.warn(
|
179620
|
-
`Failed to clean up containers. You may have to stop and remove them up manually.`
|
179621
|
-
);
|
179622
|
-
}
|
179623
|
-
}
|
179624
179914
|
if (this.#remoteProxySessionData) {
|
179625
179915
|
logger.log(source_default.dim("\u2394 Shutting down remote connection..."));
|
179626
179916
|
}
|
@@ -179879,15 +180169,6 @@ var init_MultiworkerRuntimeController = __esm({
|
|
179879
180169
|
}
|
179880
180170
|
await this.#mf?.dispose();
|
179881
180171
|
this.#mf = void 0;
|
179882
|
-
if (this.containerImageTagsSeen.size > 0) {
|
179883
|
-
try {
|
179884
|
-
await this.cleanupContainers();
|
179885
|
-
} catch {
|
179886
|
-
logger.warn(
|
179887
|
-
`Failed to clean up containers. You may have to stop and remove them up manually.`
|
179888
|
-
);
|
179889
|
-
}
|
179890
|
-
}
|
179891
180172
|
if (this.#remoteProxySessionsData.size > 0) {
|
179892
180173
|
logger.log(source_default.dim("\u2394 Shutting down remote connections..."));
|
179893
180174
|
}
|
@@ -180279,13 +180560,11 @@ function registerDevHotKeys(devEnvs, args) {
|
|
180279
180560
|
}
|
180280
180561
|
}
|
180281
180562
|
});
|
180282
|
-
|
180283
|
-
|
180284
|
-
|
180285
|
-
|
180286
|
-
|
180287
|
-
})
|
180288
|
-
);
|
180563
|
+
devEnv.runtimes.map((runtime) => {
|
180564
|
+
if (runtime instanceof LocalRuntimeController) {
|
180565
|
+
runtime.cleanupContainers();
|
180566
|
+
}
|
180567
|
+
});
|
180289
180568
|
const newContainerBuildId = generateContainerBuildId();
|
180290
180569
|
await devEnv.config.patch({
|
180291
180570
|
dev: {
|