wrangler 3.114.12 → 3.114.13
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 +6 -6
- package/wrangler-dist/cli.js +609 -321
package/wrangler-dist/cli.js
CHANGED
@@ -17658,7 +17658,7 @@ var require_OSPaths = __commonJS({
|
|
17658
17658
|
}
|
17659
17659
|
__name(isEmpty, "isEmpty");
|
17660
17660
|
function Adapt(adapter_) {
|
17661
|
-
var env6 = adapter_.env,
|
17661
|
+
var env6 = adapter_.env, os13 = adapter_.os, path72 = adapter_.path;
|
17662
17662
|
var isWinOS = /^win/i.test(adapter_.process.platform);
|
17663
17663
|
function normalizePath2(path_) {
|
17664
17664
|
return path_ ? adapter_.path.normalize(adapter_.path.join(path_, ".")) : void 0;
|
@@ -17666,11 +17666,11 @@ var require_OSPaths = __commonJS({
|
|
17666
17666
|
__name(normalizePath2, "normalizePath");
|
17667
17667
|
function home() {
|
17668
17668
|
var posix2 = /* @__PURE__ */ __name(function() {
|
17669
|
-
return normalizePath2((typeof
|
17669
|
+
return normalizePath2((typeof os13.homedir === "function" ? os13.homedir() : void 0) || env6.get("HOME"));
|
17670
17670
|
}, "posix");
|
17671
17671
|
var windows = /* @__PURE__ */ __name(function() {
|
17672
17672
|
var priorityList = [
|
17673
|
-
typeof
|
17673
|
+
typeof os13.homedir === "function" ? os13.homedir() : void 0,
|
17674
17674
|
env6.get("USERPROFILE"),
|
17675
17675
|
env6.get("HOME"),
|
17676
17676
|
env6.get("HOMEDRIVE") || env6.get("HOMEPATH") ? path72.join(env6.get("HOMEDRIVE") || "", env6.get("HOMEPATH") || "") : void 0
|
@@ -17690,7 +17690,7 @@ var require_OSPaths = __commonJS({
|
|
17690
17690
|
function posix2() {
|
17691
17691
|
var fallback = "/tmp";
|
17692
17692
|
var priorityList = [
|
17693
|
-
typeof
|
17693
|
+
typeof os13.tmpdir === "function" ? os13.tmpdir() : void 0,
|
17694
17694
|
env6.get("TMPDIR"),
|
17695
17695
|
env6.get("TEMP"),
|
17696
17696
|
env6.get("TMP")
|
@@ -17703,7 +17703,7 @@ var require_OSPaths = __commonJS({
|
|
17703
17703
|
function windows() {
|
17704
17704
|
var fallback = "C:\\Temp";
|
17705
17705
|
var priorityListLazy = [
|
17706
|
-
typeof
|
17706
|
+
typeof os13.tmpdir === "function" ? os13.tmpdir : function() {
|
17707
17707
|
return void 0;
|
17708
17708
|
},
|
17709
17709
|
function() {
|
@@ -17795,7 +17795,7 @@ var require_node = __commonJS({
|
|
17795
17795
|
};
|
17796
17796
|
exports2.__esModule = true;
|
17797
17797
|
exports2.adapter = void 0;
|
17798
|
-
var
|
17798
|
+
var os13 = __importStar(require("os"));
|
17799
17799
|
var path72 = __importStar(require("path"));
|
17800
17800
|
exports2.adapter = {
|
17801
17801
|
atImportPermissions: { env: true },
|
@@ -17804,7 +17804,7 @@ var require_node = __commonJS({
|
|
17804
17804
|
return process.env[s5];
|
17805
17805
|
}
|
17806
17806
|
},
|
17807
|
-
os:
|
17807
|
+
os: os13,
|
17808
17808
|
path: path72,
|
17809
17809
|
process
|
17810
17810
|
};
|
@@ -18502,7 +18502,7 @@ var require_supports_colors = __commonJS({
|
|
18502
18502
|
"../../node_modules/.pnpm/@colors+colors@1.5.0/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module3) {
|
18503
18503
|
"use strict";
|
18504
18504
|
init_import_meta_url();
|
18505
|
-
var
|
18505
|
+
var os13 = require("os");
|
18506
18506
|
var hasFlag3 = require_has_flag();
|
18507
18507
|
var env6 = process.env;
|
18508
18508
|
var forceColor = void 0;
|
@@ -18541,7 +18541,7 @@ var require_supports_colors = __commonJS({
|
|
18541
18541
|
}
|
18542
18542
|
var min = forceColor ? 1 : 0;
|
18543
18543
|
if (process.platform === "win32") {
|
18544
|
-
var osRelease =
|
18544
|
+
var osRelease = os13.release().split(".");
|
18545
18545
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
18546
18546
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
18547
18547
|
}
|
@@ -22715,7 +22715,7 @@ var require_main2 = __commonJS({
|
|
22715
22715
|
init_import_meta_url();
|
22716
22716
|
var fs27 = require("fs");
|
22717
22717
|
var path72 = require("path");
|
22718
|
-
var
|
22718
|
+
var os13 = require("os");
|
22719
22719
|
var crypto8 = require("crypto");
|
22720
22720
|
var packageJson = require_package();
|
22721
22721
|
var version4 = packageJson.version;
|
@@ -22821,7 +22821,7 @@ var require_main2 = __commonJS({
|
|
22821
22821
|
}
|
22822
22822
|
__name(_vaultPath, "_vaultPath");
|
22823
22823
|
function _resolveHome(envPath) {
|
22824
|
-
return envPath[0] === "~" ? path72.join(
|
22824
|
+
return envPath[0] === "~" ? path72.join(os13.homedir(), envPath.slice(1)) : envPath;
|
22825
22825
|
}
|
22826
22826
|
__name(_resolveHome, "_resolveHome");
|
22827
22827
|
function _configVault(options32) {
|
@@ -28833,14 +28833,14 @@ var require_is_wsl = __commonJS({
|
|
28833
28833
|
"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module3) {
|
28834
28834
|
"use strict";
|
28835
28835
|
init_import_meta_url();
|
28836
|
-
var
|
28836
|
+
var os13 = require("os");
|
28837
28837
|
var fs27 = require("fs");
|
28838
28838
|
var isDocker = require_is_docker();
|
28839
28839
|
var isWsl = /* @__PURE__ */ __name(() => {
|
28840
28840
|
if (process.platform !== "linux") {
|
28841
28841
|
return false;
|
28842
28842
|
}
|
28843
|
-
if (
|
28843
|
+
if (os13.release().toLowerCase().includes("microsoft")) {
|
28844
28844
|
if (isDocker()) {
|
28845
28845
|
return false;
|
28846
28846
|
}
|
@@ -29224,8 +29224,8 @@ var require_homedir = __commonJS({
|
|
29224
29224
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/homedir.js"(exports2, module3) {
|
29225
29225
|
"use strict";
|
29226
29226
|
init_import_meta_url();
|
29227
|
-
var
|
29228
|
-
module3.exports =
|
29227
|
+
var os13 = require("os");
|
29228
|
+
module3.exports = os13.homedir || /* @__PURE__ */ __name(function homedir3() {
|
29229
29229
|
var home = process.env.HOME;
|
29230
29230
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
29231
29231
|
if (process.platform === "win32") {
|
@@ -53853,7 +53853,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
53853
53853
|
return min;
|
53854
53854
|
}
|
53855
53855
|
if (import_node_process7.default.platform === "win32") {
|
53856
|
-
const osRelease =
|
53856
|
+
const osRelease = import_node_os5.default.release().split(".");
|
53857
53857
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
53858
53858
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
53859
53859
|
}
|
@@ -53901,12 +53901,12 @@ function createSupportsColor2(stream2, options32 = {}) {
|
|
53901
53901
|
});
|
53902
53902
|
return translateLevel2(level);
|
53903
53903
|
}
|
53904
|
-
var import_node_process7,
|
53904
|
+
var import_node_process7, import_node_os5, import_node_tty3, env3, flagForceColor2, supportsColor2, supports_color_default2;
|
53905
53905
|
var init_supports_color = __esm({
|
53906
53906
|
"../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js"() {
|
53907
53907
|
init_import_meta_url();
|
53908
53908
|
import_node_process7 = __toESM(require("node:process"), 1);
|
53909
|
-
|
53909
|
+
import_node_os5 = __toESM(require("node:os"), 1);
|
53910
53910
|
import_node_tty3 = __toESM(require("node:tty"), 1);
|
53911
53911
|
__name(hasFlag2, "hasFlag");
|
53912
53912
|
({ env: env3 } = import_node_process7.default);
|
@@ -81432,7 +81432,7 @@ var source_default = chalk;
|
|
81432
81432
|
// src/api/startDevWorker/MultiworkerRuntimeController.ts
|
81433
81433
|
var import_miniflare10 = require("miniflare");
|
81434
81434
|
|
81435
|
-
// src/dev/miniflare.ts
|
81435
|
+
// src/dev/miniflare/index.ts
|
81436
81436
|
init_import_meta_url();
|
81437
81437
|
var import_node_assert5 = __toESM(require("node:assert"));
|
81438
81438
|
var import_node_crypto4 = require("node:crypto");
|
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81450
81450
|
|
81451
81451
|
// package.json
|
81452
81452
|
var name = "wrangler";
|
81453
|
-
var version = "3.114.
|
81453
|
+
var version = "3.114.13";
|
81454
81454
|
|
81455
81455
|
// src/environment-variables/misc-variables.ts
|
81456
81456
|
init_import_meta_url();
|
@@ -81637,6 +81637,30 @@ var import_node_path4 = __toESM(require("node:path"));
|
|
81637
81637
|
var import_miniflare = require("miniflare");
|
81638
81638
|
var import_signal_exit = __toESM(require_signal_exit());
|
81639
81639
|
|
81640
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
81641
|
+
init_import_meta_url();
|
81642
|
+
|
81643
|
+
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
81644
|
+
init_import_meta_url();
|
81645
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
81646
|
+
const pattern = [
|
81647
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
81648
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
81649
|
+
].join("|");
|
81650
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
81651
|
+
}
|
81652
|
+
__name(ansiRegex, "ansiRegex");
|
81653
|
+
|
81654
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
81655
|
+
var regex = ansiRegex();
|
81656
|
+
function stripAnsi2(string) {
|
81657
|
+
if (typeof string !== "string") {
|
81658
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
81659
|
+
}
|
81660
|
+
return string.replace(regex, "");
|
81661
|
+
}
|
81662
|
+
__name(stripAnsi2, "stripAnsi");
|
81663
|
+
|
81640
81664
|
// src/utils/filesystem.ts
|
81641
81665
|
init_import_meta_url();
|
81642
81666
|
var import_fs5 = require("fs");
|
@@ -81756,7 +81780,7 @@ var hasSeenErrorMessage = false;
|
|
81756
81780
|
async function appendToDebugLogFile(messageLevel, message) {
|
81757
81781
|
const entry = `
|
81758
81782
|
--- ${(/* @__PURE__ */ new Date()).toISOString()} ${messageLevel}
|
81759
|
-
${message}
|
81783
|
+
${stripAnsi2(message)}
|
81760
81784
|
---
|
81761
81785
|
`;
|
81762
81786
|
if (!hasLoggedLocation) {
|
@@ -83496,8 +83520,12 @@ function readFileSyncToBuffer(file) {
|
|
83496
83520
|
__name(readFileSyncToBuffer, "readFileSyncToBuffer");
|
83497
83521
|
function readFileSync6(file) {
|
83498
83522
|
try {
|
83499
|
-
|
83523
|
+
const buffer = fs2.readFileSync(file);
|
83524
|
+
return removeBOMAndValidate(buffer, file);
|
83500
83525
|
} catch (err) {
|
83526
|
+
if (err instanceof ParseError) {
|
83527
|
+
throw err;
|
83528
|
+
}
|
83501
83529
|
const { message } = err;
|
83502
83530
|
throw new ParseError({
|
83503
83531
|
text: `Could not read file: ${file}`,
|
@@ -83599,6 +83627,46 @@ function parseNonHyphenedUuid(uuid) {
|
|
83599
83627
|
return hyphenated.slice(0, 36);
|
83600
83628
|
}
|
83601
83629
|
__name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
|
83630
|
+
var UNSUPPORTED_BOMS = [
|
83631
|
+
{
|
83632
|
+
buffer: Buffer.from([0, 0, 254, 255]),
|
83633
|
+
encoding: "UTF-32 BE"
|
83634
|
+
},
|
83635
|
+
{
|
83636
|
+
buffer: Buffer.from([255, 254, 0, 0]),
|
83637
|
+
encoding: "UTF-32 LE"
|
83638
|
+
},
|
83639
|
+
{
|
83640
|
+
buffer: Buffer.from([254, 255]),
|
83641
|
+
encoding: "UTF-16 BE"
|
83642
|
+
},
|
83643
|
+
{
|
83644
|
+
buffer: Buffer.from([255, 254]),
|
83645
|
+
encoding: "UTF-16 LE"
|
83646
|
+
}
|
83647
|
+
];
|
83648
|
+
function removeBOMAndValidate(buffer, file) {
|
83649
|
+
for (const bom of UNSUPPORTED_BOMS) {
|
83650
|
+
if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) {
|
83651
|
+
throw new ParseError({
|
83652
|
+
text: `Configuration file contains ${bom.encoding} byte order marker`,
|
83653
|
+
notes: [
|
83654
|
+
{
|
83655
|
+
text: `The file "${file}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`
|
83656
|
+
}
|
83657
|
+
],
|
83658
|
+
location: { file, line: 1, column: 0 },
|
83659
|
+
telemetryMessage: `${bom.encoding} BOM detected`
|
83660
|
+
});
|
83661
|
+
}
|
83662
|
+
}
|
83663
|
+
const content = buffer.toString("utf-8");
|
83664
|
+
if (content.charCodeAt(0) === 65279) {
|
83665
|
+
return content.slice(1);
|
83666
|
+
}
|
83667
|
+
return content;
|
83668
|
+
}
|
83669
|
+
__name(removeBOMAndValidate, "removeBOMAndValidate");
|
83602
83670
|
|
83603
83671
|
// src/user/index.ts
|
83604
83672
|
init_import_meta_url();
|
@@ -88098,8 +88166,67 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name((diagnostics, field, v
|
|
88098
88166
|
]);
|
88099
88167
|
return isValid2;
|
88100
88168
|
}, "validateDurableObjectBinding");
|
88101
|
-
var validateWorkflowBinding = /* @__PURE__ */ __name((
|
88102
|
-
|
88169
|
+
var validateWorkflowBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
88170
|
+
if (typeof value !== "object" || value === null) {
|
88171
|
+
diagnostics.errors.push(
|
88172
|
+
`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`
|
88173
|
+
);
|
88174
|
+
return false;
|
88175
|
+
}
|
88176
|
+
let isValid2 = true;
|
88177
|
+
if (!isRequiredProperty(value, "binding", "string")) {
|
88178
|
+
diagnostics.errors.push(
|
88179
|
+
`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(
|
88180
|
+
value
|
88181
|
+
)}.`
|
88182
|
+
);
|
88183
|
+
isValid2 = false;
|
88184
|
+
}
|
88185
|
+
if (!isRequiredProperty(value, "name", "string")) {
|
88186
|
+
diagnostics.errors.push(
|
88187
|
+
`"${field}" bindings should have a string "name" field but got ${JSON.stringify(
|
88188
|
+
value
|
88189
|
+
)}.`
|
88190
|
+
);
|
88191
|
+
isValid2 = false;
|
88192
|
+
} else if (value.name.length > 64) {
|
88193
|
+
diagnostics.errors.push(
|
88194
|
+
`"${field}" binding "name" field must be 64 characters or less, but got ${value.name.length} characters.`
|
88195
|
+
);
|
88196
|
+
isValid2 = false;
|
88197
|
+
}
|
88198
|
+
if (!isRequiredProperty(value, "class_name", "string")) {
|
88199
|
+
diagnostics.errors.push(
|
88200
|
+
`"${field}" bindings should have a string "class_name" field but got ${JSON.stringify(
|
88201
|
+
value
|
88202
|
+
)}.`
|
88203
|
+
);
|
88204
|
+
isValid2 = false;
|
88205
|
+
}
|
88206
|
+
if (!isOptionalProperty(value, "script_name", "string")) {
|
88207
|
+
diagnostics.errors.push(
|
88208
|
+
`"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(
|
88209
|
+
value
|
88210
|
+
)}.`
|
88211
|
+
);
|
88212
|
+
isValid2 = false;
|
88213
|
+
}
|
88214
|
+
if (!isOptionalProperty(value, "experimental_remote", "boolean")) {
|
88215
|
+
diagnostics.errors.push(
|
88216
|
+
`"${field}" bindings should, optionally, have a boolean "experimental_remote" field but got ${JSON.stringify(
|
88217
|
+
value
|
88218
|
+
)}.`
|
88219
|
+
);
|
88220
|
+
isValid2 = false;
|
88221
|
+
}
|
88222
|
+
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
88223
|
+
"binding",
|
88224
|
+
"name",
|
88225
|
+
"class_name",
|
88226
|
+
"script_name",
|
88227
|
+
"experimental_remote"
|
88228
|
+
]);
|
88229
|
+
return isValid2;
|
88103
88230
|
}, "validateWorkflowBinding");
|
88104
88231
|
var validateCflogfwdrObject = /* @__PURE__ */ __name((envName) => (diagnostics, field, value, topLevelEnv) => {
|
88105
88232
|
const bindingsValidation = validateBindingsProperty(
|
@@ -90321,32 +90448,6 @@ init_import_meta_url();
|
|
90321
90448
|
|
90322
90449
|
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
|
90323
90450
|
init_import_meta_url();
|
90324
|
-
|
90325
|
-
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
90326
|
-
init_import_meta_url();
|
90327
|
-
|
90328
|
-
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
90329
|
-
init_import_meta_url();
|
90330
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
90331
|
-
const pattern = [
|
90332
|
-
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
90333
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
90334
|
-
].join("|");
|
90335
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
90336
|
-
}
|
90337
|
-
__name(ansiRegex, "ansiRegex");
|
90338
|
-
|
90339
|
-
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
90340
|
-
var regex = ansiRegex();
|
90341
|
-
function stripAnsi2(string) {
|
90342
|
-
if (typeof string !== "string") {
|
90343
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
90344
|
-
}
|
90345
|
-
return string.replace(regex, "");
|
90346
|
-
}
|
90347
|
-
__name(stripAnsi2, "stripAnsi");
|
90348
|
-
|
90349
|
-
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
|
90350
90451
|
var import_eastasianwidth = __toESM(require_eastasianwidth(), 1);
|
90351
90452
|
var import_emoji_regex = __toESM(require_emoji_regex2(), 1);
|
90352
90453
|
function stringWidth(string, options32 = {}) {
|
@@ -90991,6 +91092,78 @@ var stderr = process.stderr;
|
|
90991
91092
|
// ../cli/index.ts
|
90992
91093
|
init_import_meta_url();
|
90993
91094
|
var import_process = require("process");
|
91095
|
+
|
91096
|
+
// ../cli/check-macos-version.ts
|
91097
|
+
init_import_meta_url();
|
91098
|
+
var import_node_os3 = __toESM(require("node:os"));
|
91099
|
+
var MINIMUM_MACOS_VERSION = "13.5.0";
|
91100
|
+
function checkMacOSVersion(options32) {
|
91101
|
+
if (process.platform !== "darwin") {
|
91102
|
+
return;
|
91103
|
+
}
|
91104
|
+
if (process.env.CI) {
|
91105
|
+
return;
|
91106
|
+
}
|
91107
|
+
const release3 = import_node_os3.default.release();
|
91108
|
+
const macOSVersion = darwinVersionToMacOSVersion(release3);
|
91109
|
+
if (macOSVersion && isVersionLessThan(macOSVersion, MINIMUM_MACOS_VERSION)) {
|
91110
|
+
if (options32.shouldThrow) {
|
91111
|
+
throw new Error(
|
91112
|
+
`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).`
|
91113
|
+
);
|
91114
|
+
} else {
|
91115
|
+
console.warn(
|
91116
|
+
`\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).`
|
91117
|
+
);
|
91118
|
+
}
|
91119
|
+
}
|
91120
|
+
}
|
91121
|
+
__name(checkMacOSVersion, "checkMacOSVersion");
|
91122
|
+
function darwinVersionToMacOSVersion(darwinVersion) {
|
91123
|
+
const match2 = darwinVersion.match(/^(\d+)\.(\d+)\.(\d+)/);
|
91124
|
+
if (!match2) {
|
91125
|
+
return null;
|
91126
|
+
}
|
91127
|
+
const major = parseInt(match2[1], 10);
|
91128
|
+
if (major >= 20) {
|
91129
|
+
const macOSMajor = major - 9;
|
91130
|
+
const minor = parseInt(match2[2], 10);
|
91131
|
+
const patch = parseInt(match2[3], 10);
|
91132
|
+
return `${macOSMajor}.${minor}.${patch}`;
|
91133
|
+
}
|
91134
|
+
return null;
|
91135
|
+
}
|
91136
|
+
__name(darwinVersionToMacOSVersion, "darwinVersionToMacOSVersion");
|
91137
|
+
function isVersionLessThan(version1, version22) {
|
91138
|
+
const versionRegex = /^(\d+)\.(\d+)\.(\d+)$/;
|
91139
|
+
const match1 = version1.match(versionRegex);
|
91140
|
+
const match2 = version22.match(versionRegex);
|
91141
|
+
if (!match1 || !match2) {
|
91142
|
+
throw new Error(
|
91143
|
+
`Invalid version format. Expected M.m.p format, got: ${version1}, ${version22}`
|
91144
|
+
);
|
91145
|
+
}
|
91146
|
+
const [major1, minor1, patch1] = [
|
91147
|
+
parseInt(match1[1], 10),
|
91148
|
+
parseInt(match1[2], 10),
|
91149
|
+
parseInt(match1[3], 10)
|
91150
|
+
];
|
91151
|
+
const [major2, minor2, patch2] = [
|
91152
|
+
parseInt(match2[1], 10),
|
91153
|
+
parseInt(match2[2], 10),
|
91154
|
+
parseInt(match2[3], 10)
|
91155
|
+
];
|
91156
|
+
if (major1 !== major2) {
|
91157
|
+
return major1 < major2;
|
91158
|
+
}
|
91159
|
+
if (minor1 !== minor2) {
|
91160
|
+
return minor1 < minor2;
|
91161
|
+
}
|
91162
|
+
return patch1 < patch2;
|
91163
|
+
}
|
91164
|
+
__name(isVersionLessThan, "isVersionLessThan");
|
91165
|
+
|
91166
|
+
// ../cli/index.ts
|
90994
91167
|
var shapes = {
|
90995
91168
|
diamond: "\u25C7",
|
90996
91169
|
dash: "\u2500",
|
@@ -93925,11 +94098,132 @@ async function imagesRemoteFetcher(request4) {
|
|
93925
94098
|
}
|
93926
94099
|
__name(imagesRemoteFetcher, "imagesRemoteFetcher");
|
93927
94100
|
|
94101
|
+
// src/update-check.ts
|
94102
|
+
init_import_meta_url();
|
94103
|
+
var import_update_check = __toESM(require_update_check());
|
94104
|
+
async function doUpdateCheck() {
|
94105
|
+
let update = null;
|
94106
|
+
const pkg = { name, version };
|
94107
|
+
try {
|
94108
|
+
update = await (0, import_update_check.default)(pkg, {
|
94109
|
+
distTag: pkg.version.startsWith("0.0.0") ? "beta" : "latest"
|
94110
|
+
});
|
94111
|
+
} catch (err) {
|
94112
|
+
}
|
94113
|
+
return update?.latest;
|
94114
|
+
}
|
94115
|
+
__name(doUpdateCheck, "doUpdateCheck");
|
94116
|
+
var updateCheckPromise;
|
94117
|
+
function updateCheck() {
|
94118
|
+
return updateCheckPromise ??= doUpdateCheck();
|
94119
|
+
}
|
94120
|
+
__name(updateCheck, "updateCheck");
|
94121
|
+
|
94122
|
+
// src/vectorize/fetcher.ts
|
94123
|
+
init_import_meta_url();
|
94124
|
+
var import_miniflare6 = require("miniflare");
|
94125
|
+
var EXTERNAL_VECTORIZE_WORKER_NAME = "__WRANGLER_EXTERNAL_VECTORIZE_WORKER";
|
94126
|
+
var EXTERNAL_VECTORIZE_WORKER_SCRIPT = `
|
94127
|
+
import makeBinding from 'cloudflare-internal:vectorize-api'
|
94128
|
+
|
94129
|
+
export default function (env) {
|
94130
|
+
return makeBinding({
|
94131
|
+
fetcher: env.FETCHER,
|
94132
|
+
indexId: env.INDEX_ID,
|
94133
|
+
indexVersion: env.INDEX_VERSION,
|
94134
|
+
useNdJson: true,
|
94135
|
+
});
|
94136
|
+
}
|
94137
|
+
`;
|
94138
|
+
var URL_SUBSTITUTIONS = /* @__PURE__ */ new Map([
|
94139
|
+
["getByIds", "get_by_ids"],
|
94140
|
+
["deleteByIds", "delete_by_ids"]
|
94141
|
+
]);
|
94142
|
+
function MakeVectorizeFetcher(indexId) {
|
94143
|
+
return async function(request4) {
|
94144
|
+
const accountId = await getAccountId();
|
94145
|
+
request4.headers.delete("Host");
|
94146
|
+
request4.headers.delete("Content-Length");
|
94147
|
+
let op = request4.url.split("/").pop() || "";
|
94148
|
+
op = URL_SUBSTITUTIONS.get(op) || op;
|
94149
|
+
const base = `/accounts/${accountId}/vectorize/v2/indexes/${indexId}/`;
|
94150
|
+
const url4 = base + op;
|
94151
|
+
const res = await performApiFetch(url4, {
|
94152
|
+
method: request4.method,
|
94153
|
+
headers: Object.fromEntries(request4.headers.entries()),
|
94154
|
+
body: request4.body,
|
94155
|
+
duplex: "half"
|
94156
|
+
});
|
94157
|
+
const respHeaders = new import_miniflare6.Headers(res.headers);
|
94158
|
+
respHeaders.delete("Host");
|
94159
|
+
respHeaders.delete("Content-Length");
|
94160
|
+
const apiResponse = await res.json();
|
94161
|
+
const newResponse = apiResponse.success ? apiResponse.result : {
|
94162
|
+
error: apiResponse.errors[0].message,
|
94163
|
+
code: apiResponse.errors[0].code
|
94164
|
+
};
|
94165
|
+
return new import_miniflare6.Response(JSON.stringify(newResponse), {
|
94166
|
+
status: res.status,
|
94167
|
+
headers: respHeaders
|
94168
|
+
});
|
94169
|
+
};
|
94170
|
+
}
|
94171
|
+
__name(MakeVectorizeFetcher, "MakeVectorizeFetcher");
|
94172
|
+
|
94173
|
+
// src/dev/class-names-sqlite.ts
|
94174
|
+
init_import_meta_url();
|
94175
|
+
function getClassNamesWhichUseSQLite(migrations) {
|
94176
|
+
const classNamesWhichUseSQLite = /* @__PURE__ */ new Map();
|
94177
|
+
(migrations || []).forEach((migration) => {
|
94178
|
+
migration.deleted_classes?.forEach((deleted_class) => {
|
94179
|
+
if (!classNamesWhichUseSQLite.delete(deleted_class)) {
|
94180
|
+
throw new UserError(
|
94181
|
+
`Cannot apply deleted_classes migration to non-existent class ${deleted_class}`
|
94182
|
+
);
|
94183
|
+
}
|
94184
|
+
});
|
94185
|
+
migration.renamed_classes?.forEach(({ from, to }) => {
|
94186
|
+
const useSQLite = classNamesWhichUseSQLite.get(from);
|
94187
|
+
if (useSQLite === void 0) {
|
94188
|
+
throw new UserError(
|
94189
|
+
`Cannot apply renamed_classes migration to non-existent class ${from}`
|
94190
|
+
);
|
94191
|
+
} else {
|
94192
|
+
classNamesWhichUseSQLite.delete(from);
|
94193
|
+
classNamesWhichUseSQLite.set(to, useSQLite);
|
94194
|
+
}
|
94195
|
+
});
|
94196
|
+
migration.new_classes?.forEach((new_class) => {
|
94197
|
+
if (classNamesWhichUseSQLite.has(new_class)) {
|
94198
|
+
throw new UserError(
|
94199
|
+
`Cannot apply new_classes migration to existing class ${new_class}`
|
94200
|
+
);
|
94201
|
+
} else {
|
94202
|
+
classNamesWhichUseSQLite.set(new_class, false);
|
94203
|
+
}
|
94204
|
+
});
|
94205
|
+
migration.new_sqlite_classes?.forEach((new_class) => {
|
94206
|
+
if (classNamesWhichUseSQLite.has(new_class)) {
|
94207
|
+
throw new UserError(
|
94208
|
+
`Cannot apply new_sqlite_classes migration to existing class ${new_class}`
|
94209
|
+
);
|
94210
|
+
} else {
|
94211
|
+
classNamesWhichUseSQLite.set(new_class, true);
|
94212
|
+
}
|
94213
|
+
});
|
94214
|
+
});
|
94215
|
+
return classNamesWhichUseSQLite;
|
94216
|
+
}
|
94217
|
+
__name(getClassNamesWhichUseSQLite, "getClassNamesWhichUseSQLite");
|
94218
|
+
|
94219
|
+
// src/dev/miniflare/stdio.ts
|
94220
|
+
init_import_meta_url();
|
94221
|
+
|
93928
94222
|
// src/sourcemap.ts
|
93929
94223
|
init_import_meta_url();
|
93930
94224
|
var import_node_assert4 = __toESM(require("node:assert"));
|
93931
94225
|
var import_node_url6 = __toESM(require("node:url"));
|
93932
|
-
var
|
94226
|
+
var import_miniflare7 = require("miniflare");
|
93933
94227
|
function maybeRetrieveFileSourceMap(filePath) {
|
93934
94228
|
if (filePath === void 0) {
|
93935
94229
|
return null;
|
@@ -93966,7 +94260,7 @@ function getSourceMappingPrepareStackTrace(retrieveSourceMap) {
|
|
93966
94260
|
if (sourceMappingPrepareStackTrace !== void 0) {
|
93967
94261
|
return sourceMappingPrepareStackTrace;
|
93968
94262
|
}
|
93969
|
-
const support = (0,
|
94263
|
+
const support = (0, import_miniflare7.getFreshSourceMapSupport)();
|
93970
94264
|
const originalPrepareStackTrace = Error.prepareStackTrace;
|
93971
94265
|
support.install({
|
93972
94266
|
environment: "node",
|
@@ -94150,125 +94444,125 @@ var CallSite = class {
|
|
94150
94444
|
};
|
94151
94445
|
__name(CallSite, "CallSite");
|
94152
94446
|
|
94153
|
-
// src/
|
94154
|
-
|
94155
|
-
|
94156
|
-
|
94157
|
-
|
94158
|
-
|
94159
|
-
|
94160
|
-
|
94161
|
-
|
94162
|
-
}
|
94163
|
-
|
94164
|
-
|
94165
|
-
|
94166
|
-
|
94167
|
-
|
94168
|
-
|
94169
|
-
|
94170
|
-
|
94171
|
-
|
94172
|
-
|
94173
|
-
|
94174
|
-
|
94175
|
-
|
94176
|
-
|
94177
|
-
|
94178
|
-
|
94179
|
-
|
94180
|
-
|
94181
|
-
|
94182
|
-
return makeBinding({
|
94183
|
-
fetcher: env.FETCHER,
|
94184
|
-
indexId: env.INDEX_ID,
|
94185
|
-
indexVersion: env.INDEX_VERSION,
|
94186
|
-
useNdJson: true,
|
94187
|
-
});
|
94447
|
+
// src/dev/miniflare/stdio.ts
|
94448
|
+
function handleRuntimeStdioWithStructuredLogs(stdout2, stderr2) {
|
94449
|
+
stdout2.on("data", getProcessStreamDataListener("stdout"));
|
94450
|
+
stderr2.on("data", getProcessStreamDataListener("stderr"));
|
94451
|
+
}
|
94452
|
+
__name(handleRuntimeStdioWithStructuredLogs, "handleRuntimeStdioWithStructuredLogs");
|
94453
|
+
function getProcessStreamDataListener(processStream) {
|
94454
|
+
let streamAccumulator = "";
|
94455
|
+
return (chunk) => {
|
94456
|
+
const fullStreamOutput = `${streamAccumulator}${chunk}`;
|
94457
|
+
let currentLogsStr = "";
|
94458
|
+
const lastNewlineIdx = fullStreamOutput.lastIndexOf("\n");
|
94459
|
+
if (lastNewlineIdx > 0) {
|
94460
|
+
currentLogsStr = fullStreamOutput.slice(0, lastNewlineIdx);
|
94461
|
+
streamAccumulator = fullStreamOutput.slice(lastNewlineIdx + 1);
|
94462
|
+
} else {
|
94463
|
+
streamAccumulator = fullStreamOutput;
|
94464
|
+
}
|
94465
|
+
const lines = currentLogsStr.split("\n");
|
94466
|
+
for (const line of lines) {
|
94467
|
+
const structuredLog = parseStructuredLog(line);
|
94468
|
+
if (structuredLog) {
|
94469
|
+
logStructuredLog(structuredLog, processStream);
|
94470
|
+
} else {
|
94471
|
+
const level = processStream === "stdout" ? "log" : "error";
|
94472
|
+
logger[level](line);
|
94473
|
+
}
|
94474
|
+
}
|
94475
|
+
};
|
94188
94476
|
}
|
94189
|
-
|
94190
|
-
|
94191
|
-
|
94192
|
-
|
94193
|
-
|
94194
|
-
|
94195
|
-
|
94196
|
-
const
|
94197
|
-
|
94198
|
-
|
94199
|
-
|
94200
|
-
|
94201
|
-
|
94202
|
-
|
94203
|
-
|
94204
|
-
method: request4.method,
|
94205
|
-
headers: Object.fromEntries(request4.headers.entries()),
|
94206
|
-
body: request4.body,
|
94207
|
-
duplex: "half"
|
94208
|
-
});
|
94209
|
-
const respHeaders = new import_miniflare7.Headers(res.headers);
|
94210
|
-
respHeaders.delete("Host");
|
94211
|
-
respHeaders.delete("Content-Length");
|
94212
|
-
const apiResponse = await res.json();
|
94213
|
-
const newResponse = apiResponse.success ? apiResponse.result : {
|
94214
|
-
error: apiResponse.errors[0].message,
|
94215
|
-
code: apiResponse.errors[0].code
|
94477
|
+
__name(getProcessStreamDataListener, "getProcessStreamDataListener");
|
94478
|
+
function parseStructuredLog(str) {
|
94479
|
+
try {
|
94480
|
+
const maybeStructuredLog = JSON.parse(str);
|
94481
|
+
if (typeof maybeStructuredLog !== "object" || maybeStructuredLog === null) {
|
94482
|
+
return null;
|
94483
|
+
}
|
94484
|
+
const timestamp = parseInt(maybeStructuredLog.timestamp);
|
94485
|
+
if (isNaN(timestamp) || typeof maybeStructuredLog.level !== "string" || typeof maybeStructuredLog.message !== "string") {
|
94486
|
+
return null;
|
94487
|
+
}
|
94488
|
+
return {
|
94489
|
+
timestamp,
|
94490
|
+
level: maybeStructuredLog.level,
|
94491
|
+
message: maybeStructuredLog.message
|
94216
94492
|
};
|
94217
|
-
|
94218
|
-
|
94219
|
-
|
94220
|
-
});
|
94221
|
-
};
|
94493
|
+
} catch {
|
94494
|
+
return null;
|
94495
|
+
}
|
94222
94496
|
}
|
94223
|
-
__name(
|
94224
|
-
|
94225
|
-
|
94226
|
-
|
94227
|
-
|
94228
|
-
|
94229
|
-
|
94230
|
-
|
94231
|
-
|
94232
|
-
|
94233
|
-
|
94234
|
-
|
94235
|
-
|
94236
|
-
|
94237
|
-
|
94238
|
-
|
94239
|
-
if (useSQLite === void 0) {
|
94240
|
-
throw new UserError(
|
94241
|
-
`Cannot apply renamed_classes migration to non-existent class ${from}`
|
94242
|
-
);
|
94243
|
-
} else {
|
94244
|
-
classNamesWhichUseSQLite.delete(from);
|
94245
|
-
classNamesWhichUseSQLite.set(to, useSQLite);
|
94246
|
-
}
|
94247
|
-
});
|
94248
|
-
migration.new_classes?.forEach((new_class) => {
|
94249
|
-
if (classNamesWhichUseSQLite.has(new_class)) {
|
94250
|
-
throw new UserError(
|
94251
|
-
`Cannot apply new_classes migration to existing class ${new_class}`
|
94252
|
-
);
|
94253
|
-
} else {
|
94254
|
-
classNamesWhichUseSQLite.set(new_class, false);
|
94255
|
-
}
|
94256
|
-
});
|
94257
|
-
migration.new_sqlite_classes?.forEach((new_class) => {
|
94258
|
-
if (classNamesWhichUseSQLite.has(new_class)) {
|
94259
|
-
throw new UserError(
|
94260
|
-
`Cannot apply new_sqlite_classes migration to existing class ${new_class}`
|
94261
|
-
);
|
94262
|
-
} else {
|
94263
|
-
classNamesWhichUseSQLite.set(new_class, true);
|
94497
|
+
__name(parseStructuredLog, "parseStructuredLog");
|
94498
|
+
function logStructuredLog({ level, message }, processStream) {
|
94499
|
+
if (messageClassifiers.isBarf(message)) {
|
94500
|
+
if (messageClassifiers.isAddressInUse(message)) {
|
94501
|
+
const address = message.match(
|
94502
|
+
/Address already in use; toString\(\) = (.+)\n/
|
94503
|
+
)?.[1];
|
94504
|
+
logger.error(
|
94505
|
+
`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.`
|
94506
|
+
);
|
94507
|
+
return logger.debug(message);
|
94508
|
+
}
|
94509
|
+
if (messageClassifiers.isAccessViolation(message)) {
|
94510
|
+
let error2 = "There was an access violation in the runtime.";
|
94511
|
+
if (process.platform === "win32") {
|
94512
|
+
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.";
|
94264
94513
|
}
|
94265
|
-
|
94266
|
-
|
94267
|
-
|
94514
|
+
logger.error(error2);
|
94515
|
+
return logger.debug(message);
|
94516
|
+
}
|
94517
|
+
return logger.debug(message);
|
94518
|
+
}
|
94519
|
+
if ((level === "info" || level === "error") && messageClassifiers.isCodeMovedWarning(message)) {
|
94520
|
+
return;
|
94521
|
+
}
|
94522
|
+
if (level === "warn") {
|
94523
|
+
return logger.warn(message);
|
94524
|
+
}
|
94525
|
+
if (level === "info") {
|
94526
|
+
return logger.info(message);
|
94527
|
+
}
|
94528
|
+
if (level === "debug") {
|
94529
|
+
return logger.debug(message);
|
94530
|
+
}
|
94531
|
+
if (level === "error") {
|
94532
|
+
return logger.error(getSourceMappedString(message));
|
94533
|
+
}
|
94534
|
+
if (processStream === "stderr") {
|
94535
|
+
return logger.error(getSourceMappedString(message));
|
94536
|
+
} else {
|
94537
|
+
return logger.log(getSourceMappedString(message));
|
94538
|
+
}
|
94268
94539
|
}
|
94269
|
-
__name(
|
94540
|
+
__name(logStructuredLog, "logStructuredLog");
|
94541
|
+
var messageClassifiers = {
|
94542
|
+
// Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
|
94543
|
+
isBarf(chunk) {
|
94544
|
+
const containsLlvmSymbolizerWarning = chunk.includes(
|
94545
|
+
"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
|
94546
|
+
);
|
94547
|
+
const containsRecursiveIsolateLockWarning = chunk.includes(
|
94548
|
+
"took recursive isolate lock"
|
94549
|
+
);
|
94550
|
+
const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
|
94551
|
+
return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
|
94552
|
+
},
|
94553
|
+
// Is this chunk an Address In Use error?
|
94554
|
+
isAddressInUse(chunk) {
|
94555
|
+
return chunk.includes("Address already in use; toString() = ");
|
94556
|
+
},
|
94557
|
+
isCodeMovedWarning(chunk) {
|
94558
|
+
return /CODE_MOVED for unknown code block/.test(chunk);
|
94559
|
+
},
|
94560
|
+
isAccessViolation(chunk) {
|
94561
|
+
return chunk.includes("access violation;");
|
94562
|
+
}
|
94563
|
+
};
|
94270
94564
|
|
94271
|
-
// src/dev/miniflare.ts
|
94565
|
+
// src/dev/miniflare/index.ts
|
94272
94566
|
var EXTERNAL_SERVICE_WORKER_NAME = "__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER";
|
94273
94567
|
var EXTERNAL_SERVICE_WORKER_SCRIPT = `
|
94274
94568
|
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
@@ -94846,73 +95140,6 @@ function buildSitesOptions({
|
|
94846
95140
|
}
|
94847
95141
|
}
|
94848
95142
|
__name(buildSitesOptions, "buildSitesOptions");
|
94849
|
-
function handleRuntimeStdio(stdout2, stderr2) {
|
94850
|
-
const classifiers = {
|
94851
|
-
// Is this chunk a big chonky barf from workerd that we want to hijack to cleanup/ignore?
|
94852
|
-
isBarf(chunk) {
|
94853
|
-
const containsLlvmSymbolizerWarning = chunk.includes(
|
94854
|
-
"Not symbolizing stack traces because $LLVM_SYMBOLIZER is not set"
|
94855
|
-
);
|
94856
|
-
const containsRecursiveIsolateLockWarning = chunk.includes(
|
94857
|
-
"took recursive isolate lock"
|
94858
|
-
);
|
94859
|
-
const containsHexStack = /stack:( (0|[a-f\d]{4,})){3,}/.test(chunk);
|
94860
|
-
return containsLlvmSymbolizerWarning || containsRecursiveIsolateLockWarning || containsHexStack;
|
94861
|
-
},
|
94862
|
-
// Is this chunk an Address In Use error?
|
94863
|
-
isAddressInUse(chunk) {
|
94864
|
-
return chunk.includes("Address already in use; toString() = ");
|
94865
|
-
},
|
94866
|
-
isWarning(chunk) {
|
94867
|
-
return /\.c\+\+:\d+: warning:/.test(chunk);
|
94868
|
-
},
|
94869
|
-
isCodeMovedWarning(chunk) {
|
94870
|
-
return /CODE_MOVED for unknown code block/.test(chunk);
|
94871
|
-
},
|
94872
|
-
isAccessViolation(chunk) {
|
94873
|
-
return chunk.includes("access violation;");
|
94874
|
-
}
|
94875
|
-
};
|
94876
|
-
stdout2.on("data", (chunk) => {
|
94877
|
-
chunk = chunk.toString().trim();
|
94878
|
-
if (classifiers.isBarf(chunk)) {
|
94879
|
-
logger.debug(chunk);
|
94880
|
-
} else if (classifiers.isWarning(chunk)) {
|
94881
|
-
logger.warn(chunk);
|
94882
|
-
} else {
|
94883
|
-
logger.info(getSourceMappedString(chunk));
|
94884
|
-
}
|
94885
|
-
});
|
94886
|
-
stderr2.on("data", (chunk) => {
|
94887
|
-
chunk = chunk.toString().trim();
|
94888
|
-
if (classifiers.isBarf(chunk)) {
|
94889
|
-
if (classifiers.isAddressInUse(chunk)) {
|
94890
|
-
const address = chunk.match(
|
94891
|
-
/Address already in use; toString\(\) = (.+)\n/
|
94892
|
-
)?.[1];
|
94893
|
-
logger.error(
|
94894
|
-
`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.`
|
94895
|
-
);
|
94896
|
-
logger.debug(chunk);
|
94897
|
-
} else if (classifiers.isAccessViolation(chunk)) {
|
94898
|
-
let error2 = "There was an access violation in the runtime.";
|
94899
|
-
if (process.platform === "win32") {
|
94900
|
-
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.";
|
94901
|
-
}
|
94902
|
-
logger.error(error2);
|
94903
|
-
logger.debug(chunk);
|
94904
|
-
} else {
|
94905
|
-
logger.debug(chunk);
|
94906
|
-
}
|
94907
|
-
} else if (classifiers.isWarning(chunk)) {
|
94908
|
-
logger.warn(chunk);
|
94909
|
-
} else if (classifiers.isCodeMovedWarning(chunk)) {
|
94910
|
-
} else {
|
94911
|
-
logger.error(getSourceMappedString(chunk));
|
94912
|
-
}
|
94913
|
-
});
|
94914
|
-
}
|
94915
|
-
__name(handleRuntimeStdio, "handleRuntimeStdio");
|
94916
95143
|
var didWarnMiniflareCronSupport = false;
|
94917
95144
|
var didWarnMiniflareVectorizeSupport = false;
|
94918
95145
|
var didWarnAiAccountUsage = false;
|
@@ -94978,7 +95205,8 @@ async function buildMiniflareOptions(log2, config, proxyToUserWorkerAuthenticati
|
|
94978
95205
|
unsafeEnableAssetsRpc: getFlag("ASSETS_RPC"),
|
94979
95206
|
log: log2,
|
94980
95207
|
verbose: logger.loggerLevel === "debug",
|
94981
|
-
handleRuntimeStdio,
|
95208
|
+
handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
|
95209
|
+
structuredWorkerdLogs: true,
|
94982
95210
|
...persistOptions,
|
94983
95211
|
workers: [
|
94984
95212
|
{
|
@@ -95815,7 +96043,7 @@ var wrapper_default = import_websocket.default;
|
|
95815
96043
|
// src/dev/inspect.ts
|
95816
96044
|
init_import_meta_url();
|
95817
96045
|
var import_fs7 = require("fs");
|
95818
|
-
var
|
96046
|
+
var import_node_os4 = __toESM(require("node:os"));
|
95819
96047
|
var import_node_url8 = require("node:url");
|
95820
96048
|
var import_path6 = __toESM(require("path"));
|
95821
96049
|
var import_open2 = __toESM(require_open());
|
@@ -96067,7 +96295,7 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
|
|
96067
96295
|
const url4 = `https://devtools.devprod.cloudflare.dev/js_app?${query.toString()}`;
|
96068
96296
|
const errorMessage = "Failed to open inspector.\nInspector depends on having a Chromium-based browser installed, maybe you need to install one?";
|
96069
96297
|
let braveBrowser;
|
96070
|
-
switch (
|
96298
|
+
switch (import_node_os4.default.platform()) {
|
96071
96299
|
case "darwin":
|
96072
96300
|
case "win32":
|
96073
96301
|
braveBrowser = "Brave";
|
@@ -96307,7 +96535,8 @@ var ProxyController = class extends Controller {
|
|
96307
96535
|
logger.loggerLevel === "debug" ? "wrangler-ProxyWorker" : "wrangler"
|
96308
96536
|
)
|
96309
96537
|
}),
|
96310
|
-
handleRuntimeStdio,
|
96538
|
+
handleRuntimeStdio: handleRuntimeStdioWithStructuredLogs,
|
96539
|
+
structuredWorkerdLogs: true,
|
96311
96540
|
liveReload: false
|
96312
96541
|
};
|
96313
96542
|
const proxyWorkerOptionsChanged = didMiniflareOptionsChange(
|
@@ -102080,7 +102309,7 @@ var normalizeStdio = /* @__PURE__ */ __name((options32) => {
|
|
102080
102309
|
|
102081
102310
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
102082
102311
|
init_import_meta_url();
|
102083
|
-
var
|
102312
|
+
var import_node_os6 = __toESM(require("node:os"), 1);
|
102084
102313
|
var import_signal_exit4 = __toESM(require_signal_exit(), 1);
|
102085
102314
|
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
102086
102315
|
var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options32 = {}) => {
|
@@ -102101,7 +102330,7 @@ var setKillTimeout = /* @__PURE__ */ __name((kill, signal, options32, killResult
|
|
102101
102330
|
}
|
102102
102331
|
}, "setKillTimeout");
|
102103
102332
|
var shouldForceKill = /* @__PURE__ */ __name((signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult, "shouldForceKill");
|
102104
|
-
var isSigterm = /* @__PURE__ */ __name((signal) => signal ===
|
102333
|
+
var isSigterm = /* @__PURE__ */ __name((signal) => signal === import_node_os6.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM", "isSigterm");
|
102105
102334
|
var getForceKillAfterTimeout = /* @__PURE__ */ __name(({ forceKillAfterTimeout = true }) => {
|
102106
102335
|
if (forceKillAfterTimeout === true) {
|
102107
102336
|
return DEFAULT_FORCE_KILL_TIMEOUT;
|
@@ -102649,13 +102878,13 @@ __name(sniffUserAgent, "sniffUserAgent");
|
|
102649
102878
|
|
102650
102879
|
// src/metrics/helpers.ts
|
102651
102880
|
init_import_meta_url();
|
102652
|
-
var
|
102881
|
+
var import_node_os7 = __toESM(require("node:os"));
|
102653
102882
|
function getWranglerVersion() {
|
102654
102883
|
return version;
|
102655
102884
|
}
|
102656
102885
|
__name(getWranglerVersion, "getWranglerVersion");
|
102657
102886
|
function getPlatform() {
|
102658
|
-
const platform3 =
|
102887
|
+
const platform3 = import_node_os7.default.platform();
|
102659
102888
|
switch (platform3) {
|
102660
102889
|
case "win32":
|
102661
102890
|
return "Windows";
|
@@ -102673,7 +102902,7 @@ function getOS() {
|
|
102673
102902
|
}
|
102674
102903
|
__name(getOS, "getOS");
|
102675
102904
|
function getOSVersion() {
|
102676
|
-
return
|
102905
|
+
return import_node_os7.default.version();
|
102677
102906
|
}
|
102678
102907
|
__name(getOSVersion, "getOSVersion");
|
102679
102908
|
function getNodeVersion() {
|
@@ -104394,27 +104623,6 @@ async function printBundleSize(main2, modules) {
|
|
104394
104623
|
logger.log(`Total Upload: ${colorizedReport}`);
|
104395
104624
|
}
|
104396
104625
|
__name(printBundleSize, "printBundleSize");
|
104397
|
-
function printOffendingDependencies(dependencies) {
|
104398
|
-
const warning = [];
|
104399
|
-
const dependenciesSorted = Object.entries(dependencies);
|
104400
|
-
dependenciesSorted.sort(
|
104401
|
-
([_adep, aData], [_bdep, bData]) => bData.bytesInOutput - aData.bytesInOutput
|
104402
|
-
);
|
104403
|
-
const topLargest = dependenciesSorted.slice(0, 5);
|
104404
|
-
if (topLargest.length > 0) {
|
104405
|
-
warning.push(
|
104406
|
-
`Here are the ${topLargest.length} largest dependencies included in your script:`
|
104407
|
-
);
|
104408
|
-
for (const [dep, data] of topLargest) {
|
104409
|
-
warning.push(
|
104410
|
-
`- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES).toFixed(2)} KiB`
|
104411
|
-
);
|
104412
|
-
}
|
104413
|
-
warning.push("If these are unnecessary, consider removing them");
|
104414
|
-
logger.warn(warning.join("\n"));
|
104415
|
-
}
|
104416
|
-
}
|
104417
|
-
__name(printOffendingDependencies, "printOffendingDependencies");
|
104418
104626
|
|
104419
104627
|
// src/deployment-bundle/create-worker-upload-form.ts
|
104420
104628
|
init_import_meta_url();
|
@@ -106015,7 +106223,7 @@ var import_miniflare22 = require("miniflare");
|
|
106015
106223
|
|
106016
106224
|
// src/index.ts
|
106017
106225
|
init_import_meta_url();
|
106018
|
-
var
|
106226
|
+
var import_node_os9 = __toESM(require("node:os"));
|
106019
106227
|
var import_promises34 = require("node:timers/promises");
|
106020
106228
|
var import_undici20 = __toESM(require_undici());
|
106021
106229
|
|
@@ -119870,6 +120078,10 @@ function isUsedAsServiceBinding(references) {
|
|
119870
120078
|
return (references.services?.incoming.length || 0) > 0;
|
119871
120079
|
}
|
119872
120080
|
__name(isUsedAsServiceBinding, "isUsedAsServiceBinding");
|
120081
|
+
function isUsedByPagesFunction(references) {
|
120082
|
+
return references.services?.pages_function === true;
|
120083
|
+
}
|
120084
|
+
__name(isUsedByPagesFunction, "isUsedByPagesFunction");
|
119873
120085
|
function isUsedAsDurableObjectNamespace(references, scriptName) {
|
119874
120086
|
return (references.durable_objects?.filter((ref) => ref.service !== scriptName)?.length || 0) > 0;
|
119875
120087
|
}
|
@@ -119889,7 +120101,7 @@ async function checkAndConfirmForceDeleteIfNecessary(scriptName, accountId) {
|
|
119889
120101
|
const tailProducers = await fetchResult(
|
119890
120102
|
`/accounts/${accountId}/workers/tails/by-consumer/${scriptName}`
|
119891
120103
|
);
|
119892
|
-
const isDependentService = isUsedAsServiceBinding(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
|
120104
|
+
const isDependentService = isUsedAsServiceBinding(references) || isUsedByPagesFunction(references) || isUsedAsDurableObjectNamespace(references, scriptName) || isUsedAsDispatchOutbound(references) || isUsedAsTailConsumer(tailProducers);
|
119893
120105
|
if (!isDependentService) {
|
119894
120106
|
return false;
|
119895
120107
|
}
|
@@ -119900,6 +120112,11 @@ async function checkAndConfirmForceDeleteIfNecessary(scriptName, accountId) {
|
|
119900
120112
|
`- Worker ${dependentScript} uses this Worker as a Service Binding`
|
119901
120113
|
);
|
119902
120114
|
}
|
120115
|
+
if (isUsedByPagesFunction(references)) {
|
120116
|
+
dependentMessages.push(
|
120117
|
+
`- A Pages project has a Service Binding to this Worker`
|
120118
|
+
);
|
120119
|
+
}
|
119903
120120
|
for (const implementedDOBindingReference of references.durable_objects || []) {
|
119904
120121
|
if (implementedDOBindingReference.service === scriptName) {
|
119905
120122
|
continue;
|
@@ -121157,7 +121374,7 @@ var import_node_path38 = __toESM(require("node:path"));
|
|
121157
121374
|
// src/git-client.ts
|
121158
121375
|
init_import_meta_url();
|
121159
121376
|
var import_node_fs19 = __toESM(require("node:fs"));
|
121160
|
-
var
|
121377
|
+
var import_node_os8 = __toESM(require("node:os"));
|
121161
121378
|
var import_node_path36 = __toESM(require("node:path"));
|
121162
121379
|
|
121163
121380
|
// ../../node_modules/.pnpm/semiver@1.1.0/node_modules/semiver/dist/semiver.mjs
|
@@ -121228,7 +121445,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
121228
121445
|
args.push(remote.substring(0, tagIndex));
|
121229
121446
|
}
|
121230
121447
|
const tempDir = import_node_fs19.default.mkdtempSync(
|
121231
|
-
import_node_path36.default.join(
|
121448
|
+
import_node_path36.default.join(import_node_os8.default.tmpdir(), `wrangler-generate-repo-`)
|
121232
121449
|
);
|
121233
121450
|
args.push(tempDir);
|
121234
121451
|
await execa("git", args);
|
@@ -126708,10 +126925,18 @@ To silence this warning, pass in --commit-dirty=true`
|
|
126708
126925
|
);
|
126709
126926
|
const failureMessage = logs.data[logs.total - 1].line.replace("Error:", "").trim();
|
126710
126927
|
if (failureMessage.includes("Script startup exceeded CPU time limit")) {
|
126928
|
+
const startupError = new ParseError({ text: failureMessage });
|
126929
|
+
Object.assign(startupError, { code: 10021 });
|
126711
126930
|
const workerBundle = formData.get("_worker.bundle");
|
126712
126931
|
const filePath = import_node_path53.default.join(getPagesTmpDir(), "_worker.bundle");
|
126713
126932
|
await (0, import_promises22.writeFile)(filePath, workerBundle.stream());
|
126714
|
-
|
126933
|
+
throw new UserError(
|
126934
|
+
await diagnoseStartupError(
|
126935
|
+
startupError,
|
126936
|
+
filePath,
|
126937
|
+
getPagesProjectRoot()
|
126938
|
+
)
|
126939
|
+
);
|
126715
126940
|
}
|
126716
126941
|
throw new FatalError(
|
126717
126942
|
`Deployment failed!
|
@@ -144263,7 +144488,7 @@ __name(wrapResolver, "wrapResolver");
|
|
144263
144488
|
|
144264
144489
|
// ../../node_modules/.pnpm/@sentry+node@7.87.0_supports-color@9.2.2/node_modules/@sentry/node/esm/client.js
|
144265
144490
|
init_import_meta_url();
|
144266
|
-
var
|
144491
|
+
var os9 = __toESM(require("os"));
|
144267
144492
|
var import_util15 = require("util");
|
144268
144493
|
var NodeClient = class extends ServerRuntimeClient {
|
144269
144494
|
/**
|
@@ -144290,7 +144515,7 @@ var NodeClient = class extends ServerRuntimeClient {
|
|
144290
144515
|
...options32,
|
144291
144516
|
platform: "node",
|
144292
144517
|
runtime: { name: "node", version: global.process.version },
|
144293
|
-
serverName: options32.serverName || global.process.env.SENTRY_NAME ||
|
144518
|
+
serverName: options32.serverName || global.process.env.SENTRY_NAME || os9.hostname()
|
144294
144519
|
};
|
144295
144520
|
super(clientOptions);
|
144296
144521
|
}
|
@@ -145335,7 +145560,7 @@ __name(_readSourceFile, "_readSourceFile");
|
|
145335
145560
|
init_import_meta_url();
|
145336
145561
|
var import_child_process4 = require("child_process");
|
145337
145562
|
var import_fs21 = require("fs");
|
145338
|
-
var
|
145563
|
+
var os10 = __toESM(require("os"));
|
145339
145564
|
var import_path22 = require("path");
|
145340
145565
|
var import_util16 = require("util");
|
145341
145566
|
var readFileAsync = (0, import_util16.promisify)(import_fs21.readFile);
|
@@ -145396,7 +145621,7 @@ var Context = class {
|
|
145396
145621
|
contexts.app.app_memory = process.memoryUsage().rss;
|
145397
145622
|
}
|
145398
145623
|
if (_optionalChain([contexts, "optionalAccess", (_13) => _13.device, "optionalAccess", (_14) => _14.free_memory])) {
|
145399
|
-
contexts.device.free_memory =
|
145624
|
+
contexts.device.free_memory = os10.freemem();
|
145400
145625
|
}
|
145401
145626
|
return contexts;
|
145402
145627
|
}
|
@@ -145429,7 +145654,7 @@ var Context = class {
|
|
145429
145654
|
__name(Context, "Context");
|
145430
145655
|
Context.__initStatic();
|
145431
145656
|
async function getOsContext() {
|
145432
|
-
const platformId =
|
145657
|
+
const platformId = os10.platform();
|
145433
145658
|
switch (platformId) {
|
145434
145659
|
case "darwin":
|
145435
145660
|
return getDarwinInfo();
|
@@ -145438,7 +145663,7 @@ async function getOsContext() {
|
|
145438
145663
|
default:
|
145439
145664
|
return {
|
145440
145665
|
name: PLATFORM_NAMES[platformId] || platformId,
|
145441
|
-
version:
|
145666
|
+
version: os10.release()
|
145442
145667
|
};
|
145443
145668
|
}
|
145444
145669
|
}
|
@@ -145472,19 +145697,19 @@ function getDeviceContext(deviceOpt) {
|
|
145472
145697
|
const device = {};
|
145473
145698
|
let uptime3;
|
145474
145699
|
try {
|
145475
|
-
uptime3 =
|
145700
|
+
uptime3 = os10.uptime && os10.uptime();
|
145476
145701
|
} catch (e7) {
|
145477
145702
|
}
|
145478
145703
|
if (typeof uptime3 === "number") {
|
145479
145704
|
device.boot_time = new Date(Date.now() - uptime3 * 1e3).toISOString();
|
145480
145705
|
}
|
145481
|
-
device.arch =
|
145706
|
+
device.arch = os10.arch();
|
145482
145707
|
if (deviceOpt === true || deviceOpt.memory) {
|
145483
|
-
device.memory_size =
|
145484
|
-
device.free_memory =
|
145708
|
+
device.memory_size = os10.totalmem();
|
145709
|
+
device.free_memory = os10.freemem();
|
145485
145710
|
}
|
145486
145711
|
if (deviceOpt === true || deviceOpt.cpu) {
|
145487
|
-
const cpuInfo =
|
145712
|
+
const cpuInfo = os10.cpus();
|
145488
145713
|
if (cpuInfo && cpuInfo.length) {
|
145489
145714
|
const firstCpu = cpuInfo[0];
|
145490
145715
|
device.processor_count = cpuInfo.length;
|
@@ -145533,9 +145758,9 @@ function matchFirst(regex2, text) {
|
|
145533
145758
|
__name(matchFirst, "matchFirst");
|
145534
145759
|
async function getDarwinInfo() {
|
145535
145760
|
const darwinInfo = {
|
145536
|
-
kernel_version:
|
145761
|
+
kernel_version: os10.release(),
|
145537
145762
|
name: "Mac OS X",
|
145538
|
-
version: `10.${Number(
|
145763
|
+
version: `10.${Number(os10.release().split(".")[0]) - 4}`
|
145539
145764
|
};
|
145540
145765
|
try {
|
145541
145766
|
const output = await new Promise((resolve25, reject) => {
|
@@ -145561,7 +145786,7 @@ function getLinuxDistroId(name2) {
|
|
145561
145786
|
__name(getLinuxDistroId, "getLinuxDistroId");
|
145562
145787
|
async function getLinuxInfo() {
|
145563
145788
|
const linuxInfo = {
|
145564
|
-
kernel_version:
|
145789
|
+
kernel_version: os10.release(),
|
145565
145790
|
name: "Linux"
|
145566
145791
|
};
|
145567
145792
|
try {
|
@@ -151012,12 +151237,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
151012
151237
|
if (!bindingsPrinted) {
|
151013
151238
|
printBindings({ ...bindings, vars: maskedVars });
|
151014
151239
|
}
|
151015
|
-
await helpIfErrorIsSizeOrScriptStartup(
|
151240
|
+
const message = await helpIfErrorIsSizeOrScriptStartup(
|
151016
151241
|
err,
|
151017
151242
|
dependencies,
|
151018
151243
|
workerBundle,
|
151019
151244
|
props.projectRoot
|
151020
151245
|
);
|
151246
|
+
if (message) {
|
151247
|
+
logger.error(message);
|
151248
|
+
}
|
151021
151249
|
if (err instanceof ParseError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
151022
151250
|
const maybeNameToFilePath = /* @__PURE__ */ __name((moduleName) => {
|
151023
151251
|
if (bundleType === "commonjs") {
|
@@ -153376,6 +153604,7 @@ function createCLIParser(argv) {
|
|
153376
153604
|
__name(createCLIParser, "createCLIParser");
|
153377
153605
|
async function main(argv) {
|
153378
153606
|
setupSentry();
|
153607
|
+
checkMacOSVersion({ shouldThrow: false });
|
153379
153608
|
const startTime = Date.now();
|
153380
153609
|
const wrangler = createCLIParser(argv);
|
153381
153610
|
let command2;
|
@@ -153460,7 +153689,7 @@ async function main(argv) {
|
|
153460
153689
|
logger.log(e7.message);
|
153461
153690
|
} else if (e7 instanceof Error && e7.message.includes("Raw mode is not supported on")) {
|
153462
153691
|
mayReport = false;
|
153463
|
-
const currentPlatform =
|
153692
|
+
const currentPlatform = import_node_os9.default.platform();
|
153464
153693
|
const thisTerminalIsUnsupported = "This terminal doesn't support raw mode.";
|
153465
153694
|
const soWranglerWontWork = "Wrangler uses raw mode to read user input and write output to the terminal, and won't function correctly without it.";
|
153466
153695
|
const tryRunningItIn = "Try running your previous command in a terminal that supports raw mode";
|
@@ -153661,11 +153890,13 @@ function getModuleType(entry) {
|
|
153661
153890
|
__name(getModuleType, "getModuleType");
|
153662
153891
|
async function convertWorkerBundleToModules(workerBundle) {
|
153663
153892
|
return await Promise.all(
|
153664
|
-
[...workerBundle.entries()].map(
|
153665
|
-
|
153666
|
-
|
153667
|
-
|
153668
|
-
|
153893
|
+
[...workerBundle.entries()].map(
|
153894
|
+
async (m6) => ({
|
153895
|
+
type: getModuleType(m6[1]),
|
153896
|
+
path: m6[0],
|
153897
|
+
contents: await getEntryValue(m6[1])
|
153898
|
+
})
|
153899
|
+
)
|
153669
153900
|
);
|
153670
153901
|
}
|
153671
153902
|
__name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
|
@@ -153740,52 +153971,106 @@ async function analyseBundle(workerBundle) {
|
|
153740
153971
|
__name(analyseBundle, "analyseBundle");
|
153741
153972
|
|
153742
153973
|
// src/utils/friendly-validator-errors.ts
|
153974
|
+
async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
|
153975
|
+
if (errIsScriptSize(err)) {
|
153976
|
+
return await diagnoseScriptSizeError(err, dependencies);
|
153977
|
+
}
|
153978
|
+
if (errIsStartupErr(err)) {
|
153979
|
+
return await diagnoseStartupError(err, workerBundle, projectRoot);
|
153980
|
+
}
|
153981
|
+
return null;
|
153982
|
+
}
|
153983
|
+
__name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
|
153984
|
+
function diagnoseScriptSizeError(err, dependencies) {
|
153985
|
+
let message = esm_default2`
|
153986
|
+
Your Worker failed validation because it exceeded size limits.
|
153987
|
+
|
153988
|
+
${err.text}
|
153989
|
+
${err.notes.map((note) => ` - ${note.text}`).join("\n")}
|
153990
|
+
`;
|
153991
|
+
const dependenciesMessage = getOffendingDependenciesMessage(dependencies);
|
153992
|
+
if (dependenciesMessage) {
|
153993
|
+
message += dependenciesMessage;
|
153994
|
+
}
|
153995
|
+
return message;
|
153996
|
+
}
|
153997
|
+
__name(diagnoseScriptSizeError, "diagnoseScriptSizeError");
|
153998
|
+
async function diagnoseStartupError(err, workerBundle, projectRoot) {
|
153999
|
+
let errorMessage = esm_default2`
|
154000
|
+
Your Worker failed validation because it exceeded startup limits.
|
154001
|
+
|
154002
|
+
${err.text}
|
154003
|
+
${err.notes.map((note) => ` - ${note.text}`).join("\n")}
|
154004
|
+
|
154005
|
+
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.
|
154006
|
+
|
154007
|
+
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`;
|
154008
|
+
try {
|
154009
|
+
const cpuProfile = await analyseBundle(workerBundle);
|
154010
|
+
const tmpDir = await getWranglerTmpDir(
|
154011
|
+
projectRoot,
|
154012
|
+
"startup-profile",
|
154013
|
+
false
|
154014
|
+
);
|
154015
|
+
const profile = import_node_path60.default.relative(
|
154016
|
+
projectRoot ?? process.cwd(),
|
154017
|
+
import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
|
154018
|
+
);
|
154019
|
+
await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
|
154020
|
+
errorMessage += esm_default2`
|
154021
|
+
|
154022
|
+
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.`;
|
154023
|
+
} catch (profilingError) {
|
154024
|
+
logger.debug(
|
154025
|
+
`An error occurred while trying to locally profile the Worker: ${profilingError}`
|
154026
|
+
);
|
154027
|
+
}
|
154028
|
+
return errorMessage;
|
154029
|
+
}
|
154030
|
+
__name(diagnoseStartupError, "diagnoseStartupError");
|
154031
|
+
function getOffendingDependenciesMessage(dependencies) {
|
154032
|
+
const dependenciesSorted = Object.entries(dependencies);
|
154033
|
+
if (dependenciesSorted.length === 0) {
|
154034
|
+
return null;
|
154035
|
+
}
|
154036
|
+
dependenciesSorted.sort(
|
154037
|
+
([, aData], [, bData]) => bData.bytesInOutput - aData.bytesInOutput
|
154038
|
+
);
|
154039
|
+
const topLargest = dependenciesSorted.slice(0, 5);
|
154040
|
+
const ONE_KIB_BYTES2 = 1024;
|
154041
|
+
return [
|
154042
|
+
"",
|
154043
|
+
`Here are the ${topLargest.length} largest dependencies included in your script:`,
|
154044
|
+
"",
|
154045
|
+
...topLargest.map(
|
154046
|
+
([dep, data]) => `- ${dep} - ${(data.bytesInOutput / ONE_KIB_BYTES2).toFixed(2)} KiB`
|
154047
|
+
),
|
154048
|
+
"",
|
154049
|
+
"If these are unnecessary, consider removing them",
|
154050
|
+
""
|
154051
|
+
].join("\n");
|
154052
|
+
}
|
154053
|
+
__name(getOffendingDependenciesMessage, "getOffendingDependenciesMessage");
|
153743
154054
|
function errIsScriptSize(err) {
|
153744
|
-
if (!err) {
|
154055
|
+
if (!(err instanceof ParseError)) {
|
153745
154056
|
return false;
|
153746
154057
|
}
|
153747
|
-
if (err.code === 10027) {
|
154058
|
+
if ("code" in err && err.code === 10027) {
|
153748
154059
|
return true;
|
153749
154060
|
}
|
153750
154061
|
return false;
|
153751
154062
|
}
|
153752
154063
|
__name(errIsScriptSize, "errIsScriptSize");
|
153753
|
-
var scriptStartupErrorRegex = /startup/i;
|
153754
154064
|
function errIsStartupErr(err) {
|
153755
|
-
if (!err) {
|
154065
|
+
if (!(err instanceof ParseError)) {
|
153756
154066
|
return false;
|
153757
154067
|
}
|
153758
|
-
if (
|
154068
|
+
if ("code" in err && err.code === 10021 && /startup/i.test(err.notes[0]?.text)) {
|
153759
154069
|
return true;
|
153760
154070
|
}
|
153761
154071
|
return false;
|
153762
154072
|
}
|
153763
154073
|
__name(errIsStartupErr, "errIsStartupErr");
|
153764
|
-
async function handleStartupError(workerBundle, projectRoot) {
|
153765
|
-
const cpuProfile = await analyseBundle(workerBundle);
|
153766
|
-
const tmpDir = await getWranglerTmpDir(projectRoot, "startup-profile", false);
|
153767
|
-
const profile = import_node_path60.default.relative(
|
153768
|
-
projectRoot ?? process.cwd(),
|
153769
|
-
import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
|
153770
|
-
);
|
153771
|
-
await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
|
153772
|
-
throw new UserError(esm_default2`
|
153773
|
-
Your Worker failed validation because it exceeded startup limits.
|
153774
|
-
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.
|
153775
|
-
|
153776
|
-
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.
|
153777
|
-
|
153778
|
-
Refer to https://developers.cloudflare.com/workers/platform/limits/#worker-startup-time for more details`);
|
153779
|
-
}
|
153780
|
-
__name(handleStartupError, "handleStartupError");
|
153781
|
-
async function helpIfErrorIsSizeOrScriptStartup(err, dependencies, workerBundle, projectRoot) {
|
153782
|
-
if (errIsScriptSize(err)) {
|
153783
|
-
printOffendingDependencies(dependencies);
|
153784
|
-
} else if (errIsStartupErr(err)) {
|
153785
|
-
await handleStartupError(workerBundle, projectRoot);
|
153786
|
-
}
|
153787
|
-
}
|
153788
|
-
__name(helpIfErrorIsSizeOrScriptStartup, "helpIfErrorIsSizeOrScriptStartup");
|
153789
154074
|
|
153790
154075
|
// src/deploy/deploy.ts
|
153791
154076
|
var validateRoutes3 = /* @__PURE__ */ __name((routes, assets) => {
|
@@ -154340,12 +154625,15 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
154340
154625
|
if (!bindingsPrinted) {
|
154341
154626
|
printBindings({ ...withoutStaticAssets, vars: maskedVars });
|
154342
154627
|
}
|
154343
|
-
await helpIfErrorIsSizeOrScriptStartup(
|
154628
|
+
const message = await helpIfErrorIsSizeOrScriptStartup(
|
154344
154629
|
err,
|
154345
154630
|
dependencies,
|
154346
154631
|
workerBundle,
|
154347
154632
|
props.projectRoot
|
154348
154633
|
);
|
154634
|
+
if (message !== null) {
|
154635
|
+
logger.error(message);
|
154636
|
+
}
|
154349
154637
|
if (err instanceof APIError && "code" in err && err.code === 10021 && err.notes.length > 0) {
|
154350
154638
|
err.preventReport();
|
154351
154639
|
if (err.notes[0].text === "binding DB of type d1 must have a valid `id` specified [code: 10021]") {
|
@@ -156918,7 +157206,7 @@ init_import_meta_url();
|
|
156918
157206
|
// ../../node_modules/.pnpm/get-port@7.0.0/node_modules/get-port/index.js
|
156919
157207
|
init_import_meta_url();
|
156920
157208
|
var import_node_net = __toESM(require("node:net"), 1);
|
156921
|
-
var
|
157209
|
+
var import_node_os10 = __toESM(require("node:os"), 1);
|
156922
157210
|
var Locked = class extends Error {
|
156923
157211
|
constructor(port) {
|
156924
157212
|
super(`${port} is locked`);
|
@@ -156932,7 +157220,7 @@ var lockedPorts = {
|
|
156932
157220
|
var releaseOldLockedPortsIntervalMs = 1e3 * 15;
|
156933
157221
|
var timeout;
|
156934
157222
|
var getLocalHosts = /* @__PURE__ */ __name(() => {
|
156935
|
-
const interfaces =
|
157223
|
+
const interfaces = import_node_os10.default.networkInterfaces();
|
156936
157224
|
const results = /* @__PURE__ */ new Set([void 0, "0.0.0.0"]);
|
156937
157225
|
for (const _interface of Object.values(interfaces)) {
|
156938
157226
|
for (const config of _interface) {
|