wrangler 3.57.2 → 3.59.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/config-schema.json +37 -29
- package/package.json +5 -5
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +251 -92
- package/wrangler-dist/cli.js +721 -403
package/wrangler-dist/cli.js
CHANGED
@@ -975,7 +975,7 @@ var require_sbmh = __commonJS({
|
|
975
975
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js"(exports2, module3) {
|
976
976
|
"use strict";
|
977
977
|
init_import_meta_url();
|
978
|
-
var
|
978
|
+
var EventEmitter5 = require("node:events").EventEmitter;
|
979
979
|
var inherits = require("node:util").inherits;
|
980
980
|
function SBMH(needle) {
|
981
981
|
if (typeof needle === "string") {
|
@@ -1003,7 +1003,7 @@ var require_sbmh = __commonJS({
|
|
1003
1003
|
}
|
1004
1004
|
}
|
1005
1005
|
__name(SBMH, "SBMH");
|
1006
|
-
inherits(SBMH,
|
1006
|
+
inherits(SBMH, EventEmitter5);
|
1007
1007
|
SBMH.prototype.reset = function() {
|
1008
1008
|
this._lookbehind_size = 0;
|
1009
1009
|
this.matches = 0;
|
@@ -1149,7 +1149,7 @@ var require_HeaderParser = __commonJS({
|
|
1149
1149
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js"(exports2, module3) {
|
1150
1150
|
"use strict";
|
1151
1151
|
init_import_meta_url();
|
1152
|
-
var
|
1152
|
+
var EventEmitter5 = require("node:events").EventEmitter;
|
1153
1153
|
var inherits = require("node:util").inherits;
|
1154
1154
|
var getLimit = require_getLimit();
|
1155
1155
|
var StreamSearch = require_sbmh();
|
@@ -1157,7 +1157,7 @@ var require_HeaderParser = __commonJS({
|
|
1157
1157
|
var RE_CRLF = /\r\n/g;
|
1158
1158
|
var RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/;
|
1159
1159
|
function HeaderParser(cfg) {
|
1160
|
-
|
1160
|
+
EventEmitter5.call(this);
|
1161
1161
|
cfg = cfg || {};
|
1162
1162
|
const self2 = this;
|
1163
1163
|
this.nread = 0;
|
@@ -1186,7 +1186,7 @@ var require_HeaderParser = __commonJS({
|
|
1186
1186
|
});
|
1187
1187
|
}
|
1188
1188
|
__name(HeaderParser, "HeaderParser");
|
1189
|
-
inherits(HeaderParser,
|
1189
|
+
inherits(HeaderParser, EventEmitter5);
|
1190
1190
|
HeaderParser.prototype.push = function(data) {
|
1191
1191
|
const r3 = this.ss.push(data);
|
1192
1192
|
if (this.finished) {
|
@@ -5693,8 +5693,8 @@ var require_dispatcher = __commonJS({
|
|
5693
5693
|
"../../node_modules/.pnpm/undici@5.28.4/node_modules/undici/lib/dispatcher.js"(exports2, module3) {
|
5694
5694
|
"use strict";
|
5695
5695
|
init_import_meta_url();
|
5696
|
-
var
|
5697
|
-
var Dispatcher2 = class extends
|
5696
|
+
var EventEmitter5 = require("events");
|
5697
|
+
var Dispatcher2 = class extends EventEmitter5 {
|
5698
5698
|
dispatch() {
|
5699
5699
|
throw new Error("not implemented");
|
5700
5700
|
}
|
@@ -29732,11 +29732,11 @@ var require_wasm_sync = __commonJS({
|
|
29732
29732
|
});
|
29733
29733
|
var ca = Object.assign({}, l2), da2 = "object" == typeof window, ea = "function" == typeof importScripts, q2 = "", fa, ha;
|
29734
29734
|
if ("object" == typeof process && "object" == typeof process.versions && "string" == typeof process.versions.node) {
|
29735
|
-
var
|
29735
|
+
var fs26 = require("fs"), ia = require("path");
|
29736
29736
|
q2 = ea ? ia.dirname(q2) + "/" : __dirname + "/";
|
29737
29737
|
fa = /* @__PURE__ */ __name((a, b2) => {
|
29738
29738
|
a = a.startsWith("file://") ? new URL(a) : ia.normalize(a);
|
29739
|
-
return
|
29739
|
+
return fs26.readFileSync(a, b2 ? void 0 : "utf8");
|
29740
29740
|
}, "fa");
|
29741
29741
|
ha = /* @__PURE__ */ __name((a) => {
|
29742
29742
|
a = fa(a, true);
|
@@ -35182,7 +35182,7 @@ var require_websocket2 = __commonJS({
|
|
35182
35182
|
"../../node_modules/.pnpm/ws@7.5.6/node_modules/ws/lib/websocket.js"(exports2, module3) {
|
35183
35183
|
"use strict";
|
35184
35184
|
init_import_meta_url();
|
35185
|
-
var
|
35185
|
+
var EventEmitter5 = require("events");
|
35186
35186
|
var https3 = require("https");
|
35187
35187
|
var http4 = require("http");
|
35188
35188
|
var net3 = require("net");
|
@@ -35207,7 +35207,7 @@ var require_websocket2 = __commonJS({
|
|
35207
35207
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
35208
35208
|
var protocolVersions = [8, 13];
|
35209
35209
|
var closeTimeout = 30 * 1e3;
|
35210
|
-
var WebSocket3 = class extends
|
35210
|
+
var WebSocket3 = class extends EventEmitter5 {
|
35211
35211
|
/**
|
35212
35212
|
* Create a new `WebSocket`.
|
35213
35213
|
*
|
@@ -36090,7 +36090,7 @@ var require_websocket_server = __commonJS({
|
|
36090
36090
|
"../../node_modules/.pnpm/ws@7.5.6/node_modules/ws/lib/websocket-server.js"(exports2, module3) {
|
36091
36091
|
"use strict";
|
36092
36092
|
init_import_meta_url();
|
36093
|
-
var
|
36093
|
+
var EventEmitter5 = require("events");
|
36094
36094
|
var http4 = require("http");
|
36095
36095
|
var https3 = require("https");
|
36096
36096
|
var net3 = require("net");
|
@@ -36104,7 +36104,7 @@ var require_websocket_server = __commonJS({
|
|
36104
36104
|
var RUNNING = 0;
|
36105
36105
|
var CLOSING = 1;
|
36106
36106
|
var CLOSED = 2;
|
36107
|
-
var WebSocketServer2 = class extends
|
36107
|
+
var WebSocketServer2 = class extends EventEmitter5 {
|
36108
36108
|
/**
|
36109
36109
|
* Create a `WebSocketServer` instance.
|
36110
36110
|
*
|
@@ -47805,13 +47805,13 @@ var require_backend = __commonJS({
|
|
47805
47805
|
return obj;
|
47806
47806
|
}
|
47807
47807
|
__name(_defineProperty11, "_defineProperty");
|
47808
|
-
var
|
47809
|
-
function
|
47810
|
-
_classCallCheck5(this,
|
47808
|
+
var EventEmitter5 = /* @__PURE__ */ function() {
|
47809
|
+
function EventEmitter6() {
|
47810
|
+
_classCallCheck5(this, EventEmitter6);
|
47811
47811
|
_defineProperty11(this, "listenersMap", /* @__PURE__ */ new Map());
|
47812
47812
|
}
|
47813
|
-
__name(
|
47814
|
-
_createClass5(
|
47813
|
+
__name(EventEmitter6, "EventEmitter");
|
47814
|
+
_createClass5(EventEmitter6, [{
|
47815
47815
|
key: "addListener",
|
47816
47816
|
value: /* @__PURE__ */ __name(function addListener(event, listener) {
|
47817
47817
|
var listeners = this.listenersMap.get(event);
|
@@ -47873,7 +47873,7 @@ var require_backend = __commonJS({
|
|
47873
47873
|
}
|
47874
47874
|
}, "removeListener")
|
47875
47875
|
}]);
|
47876
|
-
return
|
47876
|
+
return EventEmitter6;
|
47877
47877
|
}();
|
47878
47878
|
var lodash_throttle = __webpack_require__(15);
|
47879
47879
|
var lodash_throttle_default = /* @__PURE__ */ __webpack_require__.n(lodash_throttle);
|
@@ -48974,7 +48974,7 @@ var require_backend = __commonJS({
|
|
48974
48974
|
}, "get")
|
48975
48975
|
}]);
|
48976
48976
|
return Bridge2;
|
48977
|
-
}(
|
48977
|
+
}(EventEmitter5);
|
48978
48978
|
var src_bridge = Bridge;
|
48979
48979
|
var utils = __webpack_require__(4);
|
48980
48980
|
function agent_typeof(obj) {
|
@@ -49617,7 +49617,7 @@ var require_backend = __commonJS({
|
|
49617
49617
|
}, "get")
|
49618
49618
|
}]);
|
49619
49619
|
return Agent;
|
49620
|
-
}(
|
49620
|
+
}(EventEmitter5);
|
49621
49621
|
function installHook(target) {
|
49622
49622
|
if (target.hasOwnProperty("__REACT_DEVTOOLS_GLOBAL_HOOK__")) {
|
49623
49623
|
return null;
|
@@ -53329,7 +53329,7 @@ var require_ErrorOverview = __commonJS({
|
|
53329
53329
|
return mod && mod.__esModule ? mod : { "default": mod };
|
53330
53330
|
};
|
53331
53331
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
53332
|
-
var
|
53332
|
+
var fs26 = __importStar(require("fs"));
|
53333
53333
|
var react_1 = __importDefault(require_react());
|
53334
53334
|
var stack_utils_1 = __importDefault(require_stack_utils());
|
53335
53335
|
var code_excerpt_1 = __importDefault(require_code_excerpt());
|
@@ -53344,8 +53344,8 @@ var require_ErrorOverview = __commonJS({
|
|
53344
53344
|
const origin = stack ? stackUtils.parseLine(stack[0]) : void 0;
|
53345
53345
|
let excerpt;
|
53346
53346
|
let lineWidth = 0;
|
53347
|
-
if ((origin === null || origin === void 0 ? void 0 : origin.file) && (origin === null || origin === void 0 ? void 0 : origin.line) &&
|
53348
|
-
const sourceCode =
|
53347
|
+
if ((origin === null || origin === void 0 ? void 0 : origin.file) && (origin === null || origin === void 0 ? void 0 : origin.line) && fs26.existsSync(origin.file)) {
|
53348
|
+
const sourceCode = fs26.readFileSync(origin.file, "utf8");
|
53349
53349
|
excerpt = code_excerpt_1.default(sourceCode, origin.line);
|
53350
53350
|
if (excerpt) {
|
53351
53351
|
for (const { line } of excerpt) {
|
@@ -54439,7 +54439,7 @@ var require_build2 = __commonJS({
|
|
54439
54439
|
var require_main2 = __commonJS({
|
54440
54440
|
"../../node_modules/.pnpm/dotenv@16.0.0/node_modules/dotenv/lib/main.js"(exports2, module3) {
|
54441
54441
|
init_import_meta_url();
|
54442
|
-
var
|
54442
|
+
var fs26 = require("fs");
|
54443
54443
|
var path67 = require("path");
|
54444
54444
|
var os11 = require("os");
|
54445
54445
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
@@ -54485,7 +54485,7 @@ var require_main2 = __commonJS({
|
|
54485
54485
|
}
|
54486
54486
|
}
|
54487
54487
|
try {
|
54488
|
-
const parsed = DotenvModule.parse(
|
54488
|
+
const parsed = DotenvModule.parse(fs26.readFileSync(dotenvPath, { encoding }));
|
54489
54489
|
Object.keys(parsed).forEach(function(key) {
|
54490
54490
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
54491
54491
|
process.env[key] = parsed[key];
|
@@ -61318,12 +61318,12 @@ var require_prompt = __commonJS({
|
|
61318
61318
|
var readline3 = require("readline");
|
61319
61319
|
var _require = require_util9();
|
61320
61320
|
var action = _require.action;
|
61321
|
-
var
|
61321
|
+
var EventEmitter5 = require("events");
|
61322
61322
|
var _require2 = require_src();
|
61323
61323
|
var beep = _require2.beep;
|
61324
61324
|
var cursor = _require2.cursor;
|
61325
61325
|
var color = require_kleur();
|
61326
|
-
var Prompt = class extends
|
61326
|
+
var Prompt = class extends EventEmitter5 {
|
61327
61327
|
constructor(opts = {}) {
|
61328
61328
|
super();
|
61329
61329
|
this.firstRender = true;
|
@@ -63974,10 +63974,10 @@ var require_prompt2 = __commonJS({
|
|
63974
63974
|
init_import_meta_url();
|
63975
63975
|
var readline3 = require("readline");
|
63976
63976
|
var { action } = require_util10();
|
63977
|
-
var
|
63977
|
+
var EventEmitter5 = require("events");
|
63978
63978
|
var { beep, cursor } = require_src();
|
63979
63979
|
var color = require_kleur();
|
63980
|
-
var Prompt = class extends
|
63980
|
+
var Prompt = class extends EventEmitter5 {
|
63981
63981
|
constructor(opts = {}) {
|
63982
63982
|
super();
|
63983
63983
|
this.firstRender = true;
|
@@ -66043,11 +66043,11 @@ var require_is_docker = __commonJS({
|
|
66043
66043
|
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module3) {
|
66044
66044
|
"use strict";
|
66045
66045
|
init_import_meta_url();
|
66046
|
-
var
|
66046
|
+
var fs26 = require("fs");
|
66047
66047
|
var isDocker;
|
66048
66048
|
function hasDockerEnv() {
|
66049
66049
|
try {
|
66050
|
-
|
66050
|
+
fs26.statSync("/.dockerenv");
|
66051
66051
|
return true;
|
66052
66052
|
} catch (_3) {
|
66053
66053
|
return false;
|
@@ -66056,7 +66056,7 @@ var require_is_docker = __commonJS({
|
|
66056
66056
|
__name(hasDockerEnv, "hasDockerEnv");
|
66057
66057
|
function hasDockerCGroup() {
|
66058
66058
|
try {
|
66059
|
-
return
|
66059
|
+
return fs26.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
66060
66060
|
} catch (_3) {
|
66061
66061
|
return false;
|
66062
66062
|
}
|
@@ -66077,7 +66077,7 @@ var require_is_wsl = __commonJS({
|
|
66077
66077
|
"use strict";
|
66078
66078
|
init_import_meta_url();
|
66079
66079
|
var os11 = require("os");
|
66080
|
-
var
|
66080
|
+
var fs26 = require("fs");
|
66081
66081
|
var isDocker = require_is_docker();
|
66082
66082
|
var isWsl = /* @__PURE__ */ __name(() => {
|
66083
66083
|
if (process.platform !== "linux") {
|
@@ -66090,7 +66090,7 @@ var require_is_wsl = __commonJS({
|
|
66090
66090
|
return true;
|
66091
66091
|
}
|
66092
66092
|
try {
|
66093
|
-
return
|
66093
|
+
return fs26.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
66094
66094
|
} catch (_3) {
|
66095
66095
|
return false;
|
66096
66096
|
}
|
@@ -66133,7 +66133,7 @@ var require_open = __commonJS({
|
|
66133
66133
|
init_import_meta_url();
|
66134
66134
|
var path67 = require("path");
|
66135
66135
|
var childProcess2 = require("child_process");
|
66136
|
-
var { promises:
|
66136
|
+
var { promises: fs26, constants: fsConstants } = require("fs");
|
66137
66137
|
var isWsl = require_is_wsl();
|
66138
66138
|
var isDocker = require_is_docker();
|
66139
66139
|
var defineLazyProperty = require_define_lazy_prop();
|
@@ -66149,14 +66149,14 @@ var require_open = __commonJS({
|
|
66149
66149
|
const configFilePath = "/etc/wsl.conf";
|
66150
66150
|
let isConfigFileExists = false;
|
66151
66151
|
try {
|
66152
|
-
await
|
66152
|
+
await fs26.access(configFilePath, fsConstants.F_OK);
|
66153
66153
|
isConfigFileExists = true;
|
66154
66154
|
} catch {
|
66155
66155
|
}
|
66156
66156
|
if (!isConfigFileExists) {
|
66157
66157
|
return defaultMountPoint;
|
66158
66158
|
}
|
66159
|
-
const configContent = await
|
66159
|
+
const configContent = await fs26.readFile(configFilePath, { encoding: "utf8" });
|
66160
66160
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
66161
66161
|
if (!configMountPoint) {
|
66162
66162
|
return defaultMountPoint;
|
@@ -66256,7 +66256,7 @@ var require_open = __commonJS({
|
|
66256
66256
|
const isBundled = !__dirname || __dirname === "/";
|
66257
66257
|
let exeLocalXdgOpen = false;
|
66258
66258
|
try {
|
66259
|
-
await
|
66259
|
+
await fs26.access(localXdgOpenPath, fsConstants.X_OK);
|
66260
66260
|
exeLocalXdgOpen = true;
|
66261
66261
|
} catch {
|
66262
66262
|
}
|
@@ -66923,14 +66923,14 @@ var require_is_core_module = __commonJS({
|
|
66923
66923
|
var require_async = __commonJS({
|
66924
66924
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/async.js"(exports2, module3) {
|
66925
66925
|
init_import_meta_url();
|
66926
|
-
var
|
66926
|
+
var fs26 = require("fs");
|
66927
66927
|
var getHomedir = require_homedir();
|
66928
66928
|
var path67 = require("path");
|
66929
66929
|
var caller = require_caller();
|
66930
66930
|
var nodeModulesPaths = require_node_modules_paths();
|
66931
66931
|
var normalizeOptions = require_normalize_options();
|
66932
66932
|
var isCore = require_is_core_module();
|
66933
|
-
var realpathFS = process.platform !== "win32" &&
|
66933
|
+
var realpathFS = process.platform !== "win32" && fs26.realpath && typeof fs26.realpath.native === "function" ? fs26.realpath.native : fs26.realpath;
|
66934
66934
|
var homedir2 = getHomedir();
|
66935
66935
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
66936
66936
|
return [
|
@@ -66939,7 +66939,7 @@ var require_async = __commonJS({
|
|
66939
66939
|
];
|
66940
66940
|
}, "defaultPaths");
|
66941
66941
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb) {
|
66942
|
-
|
66942
|
+
fs26.stat(file, function(err, stat4) {
|
66943
66943
|
if (!err) {
|
66944
66944
|
return cb(null, stat4.isFile() || stat4.isFIFO());
|
66945
66945
|
}
|
@@ -66949,7 +66949,7 @@ var require_async = __commonJS({
|
|
66949
66949
|
});
|
66950
66950
|
}, "isFile");
|
66951
66951
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb) {
|
66952
|
-
|
66952
|
+
fs26.stat(dir, function(err, stat4) {
|
66953
66953
|
if (!err) {
|
66954
66954
|
return cb(null, stat4.isDirectory());
|
66955
66955
|
}
|
@@ -66973,8 +66973,8 @@ var require_async = __commonJS({
|
|
66973
66973
|
cb(null, x2);
|
66974
66974
|
}
|
66975
66975
|
}, "maybeRealpath");
|
66976
|
-
var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(
|
66977
|
-
|
66976
|
+
var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(readFile13, pkgfile, cb) {
|
66977
|
+
readFile13(pkgfile, function(readFileErr, body) {
|
66978
66978
|
if (readFileErr)
|
66979
66979
|
cb(readFileErr);
|
66980
66980
|
else {
|
@@ -67010,7 +67010,7 @@ var require_async = __commonJS({
|
|
67010
67010
|
opts = normalizeOptions(x2, opts);
|
67011
67011
|
var isFile = opts.isFile || defaultIsFile;
|
67012
67012
|
var isDirectory2 = opts.isDirectory || defaultIsDir;
|
67013
|
-
var
|
67013
|
+
var readFile13 = opts.readFile || fs26.readFile;
|
67014
67014
|
var realpath = opts.realpath || defaultRealpath;
|
67015
67015
|
var readPackage = opts.readPackage || defaultReadPackage;
|
67016
67016
|
if (opts.readFile && opts.readPackage) {
|
@@ -67157,7 +67157,7 @@ var require_async = __commonJS({
|
|
67157
67157
|
isFile(pkgfile, function(err2, ex) {
|
67158
67158
|
if (!ex)
|
67159
67159
|
return loadpkg(path67.dirname(dir), cb2);
|
67160
|
-
readPackage(
|
67160
|
+
readPackage(readFile13, pkgfile, function(err3, pkgParam) {
|
67161
67161
|
if (err3)
|
67162
67162
|
cb2(err3);
|
67163
67163
|
var pkg = pkgParam;
|
@@ -67186,7 +67186,7 @@ var require_async = __commonJS({
|
|
67186
67186
|
return cb2(err2);
|
67187
67187
|
if (!ex)
|
67188
67188
|
return loadAsFile(path67.join(x3, "index"), fpkg, cb2);
|
67189
|
-
readPackage(
|
67189
|
+
readPackage(readFile13, pkgfile, function(err3, pkgParam) {
|
67190
67190
|
if (err3)
|
67191
67191
|
return cb2(err3);
|
67192
67192
|
var pkg = pkgParam;
|
@@ -67469,13 +67469,13 @@ var require_sync = __commonJS({
|
|
67469
67469
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js"(exports2, module3) {
|
67470
67470
|
init_import_meta_url();
|
67471
67471
|
var isCore = require_is_core_module();
|
67472
|
-
var
|
67472
|
+
var fs26 = require("fs");
|
67473
67473
|
var path67 = require("path");
|
67474
67474
|
var getHomedir = require_homedir();
|
67475
67475
|
var caller = require_caller();
|
67476
67476
|
var nodeModulesPaths = require_node_modules_paths();
|
67477
67477
|
var normalizeOptions = require_normalize_options();
|
67478
|
-
var realpathFS = process.platform !== "win32" &&
|
67478
|
+
var realpathFS = process.platform !== "win32" && fs26.realpathSync && typeof fs26.realpathSync.native === "function" ? fs26.realpathSync.native : fs26.realpathSync;
|
67479
67479
|
var homedir2 = getHomedir();
|
67480
67480
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
67481
67481
|
return [
|
@@ -67485,7 +67485,7 @@ var require_sync = __commonJS({
|
|
67485
67485
|
}, "defaultPaths");
|
67486
67486
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
|
67487
67487
|
try {
|
67488
|
-
var stat4 =
|
67488
|
+
var stat4 = fs26.statSync(file, { throwIfNoEntry: false });
|
67489
67489
|
} catch (e3) {
|
67490
67490
|
if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
|
67491
67491
|
return false;
|
@@ -67495,7 +67495,7 @@ var require_sync = __commonJS({
|
|
67495
67495
|
}, "isFile");
|
67496
67496
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
|
67497
67497
|
try {
|
67498
|
-
var stat4 =
|
67498
|
+
var stat4 = fs26.statSync(dir, { throwIfNoEntry: false });
|
67499
67499
|
} catch (e3) {
|
67500
67500
|
if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
|
67501
67501
|
return false;
|
@@ -67540,7 +67540,7 @@ var require_sync = __commonJS({
|
|
67540
67540
|
}
|
67541
67541
|
var opts = normalizeOptions(x2, options29);
|
67542
67542
|
var isFile = opts.isFile || defaultIsFile;
|
67543
|
-
var readFileSync25 = opts.readFileSync ||
|
67543
|
+
var readFileSync25 = opts.readFileSync || fs26.readFileSync;
|
67544
67544
|
var isDirectory2 = opts.isDirectory || defaultIsDir;
|
67545
67545
|
var realpathSync3 = opts.realpathSync || defaultRealpathSync;
|
67546
67546
|
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
@@ -67691,7 +67691,7 @@ var require_windows = __commonJS({
|
|
67691
67691
|
init_import_meta_url();
|
67692
67692
|
module3.exports = isexe;
|
67693
67693
|
isexe.sync = sync;
|
67694
|
-
var
|
67694
|
+
var fs26 = require("fs");
|
67695
67695
|
function checkPathExt(path67, options29) {
|
67696
67696
|
var pathext = options29.pathExt !== void 0 ? options29.pathExt : process.env.PATHEXT;
|
67697
67697
|
if (!pathext) {
|
@@ -67718,13 +67718,13 @@ var require_windows = __commonJS({
|
|
67718
67718
|
}
|
67719
67719
|
__name(checkStat, "checkStat");
|
67720
67720
|
function isexe(path67, options29, cb) {
|
67721
|
-
|
67721
|
+
fs26.stat(path67, function(er, stat4) {
|
67722
67722
|
cb(er, er ? false : checkStat(stat4, path67, options29));
|
67723
67723
|
});
|
67724
67724
|
}
|
67725
67725
|
__name(isexe, "isexe");
|
67726
67726
|
function sync(path67, options29) {
|
67727
|
-
return checkStat(
|
67727
|
+
return checkStat(fs26.statSync(path67), path67, options29);
|
67728
67728
|
}
|
67729
67729
|
__name(sync, "sync");
|
67730
67730
|
}
|
@@ -67736,15 +67736,15 @@ var require_mode = __commonJS({
|
|
67736
67736
|
init_import_meta_url();
|
67737
67737
|
module3.exports = isexe;
|
67738
67738
|
isexe.sync = sync;
|
67739
|
-
var
|
67739
|
+
var fs26 = require("fs");
|
67740
67740
|
function isexe(path67, options29, cb) {
|
67741
|
-
|
67741
|
+
fs26.stat(path67, function(er, stat4) {
|
67742
67742
|
cb(er, er ? false : checkStat(stat4, options29));
|
67743
67743
|
});
|
67744
67744
|
}
|
67745
67745
|
__name(isexe, "isexe");
|
67746
67746
|
function sync(path67, options29) {
|
67747
|
-
return checkStat(
|
67747
|
+
return checkStat(fs26.statSync(path67), options29);
|
67748
67748
|
}
|
67749
67749
|
__name(sync, "sync");
|
67750
67750
|
function checkStat(stat4, options29) {
|
@@ -67772,7 +67772,7 @@ var require_mode = __commonJS({
|
|
67772
67772
|
var require_isexe = __commonJS({
|
67773
67773
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module3) {
|
67774
67774
|
init_import_meta_url();
|
67775
|
-
var
|
67775
|
+
var fs26 = require("fs");
|
67776
67776
|
var core;
|
67777
67777
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
67778
67778
|
core = require_windows();
|
@@ -68049,16 +68049,16 @@ var require_readShebang = __commonJS({
|
|
68049
68049
|
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module3) {
|
68050
68050
|
"use strict";
|
68051
68051
|
init_import_meta_url();
|
68052
|
-
var
|
68052
|
+
var fs26 = require("fs");
|
68053
68053
|
var shebangCommand = require_shebang_command();
|
68054
68054
|
function readShebang(command2) {
|
68055
68055
|
const size = 150;
|
68056
68056
|
const buffer = Buffer.alloc(size);
|
68057
68057
|
let fd;
|
68058
68058
|
try {
|
68059
|
-
fd =
|
68060
|
-
|
68061
|
-
|
68059
|
+
fd = fs26.openSync(command2, "r");
|
68060
|
+
fs26.readSync(fd, buffer, 0, size, 0);
|
68061
|
+
fs26.closeSync(fd);
|
68062
68062
|
} catch (e3) {
|
68063
68063
|
}
|
68064
68064
|
return shebangCommand(buffer.toString());
|
@@ -70558,7 +70558,7 @@ var require_arch = __commonJS({
|
|
70558
70558
|
"../../node_modules/.pnpm/arch@2.2.0/node_modules/arch/index.js"(exports2, module3) {
|
70559
70559
|
init_import_meta_url();
|
70560
70560
|
var cp2 = require("child_process");
|
70561
|
-
var
|
70561
|
+
var fs26 = require("fs");
|
70562
70562
|
var path67 = require("path");
|
70563
70563
|
module3.exports = /* @__PURE__ */ __name(function arch3() {
|
70564
70564
|
if (process.arch === "x64") {
|
@@ -70570,13 +70570,13 @@ var require_arch = __commonJS({
|
|
70570
70570
|
if (process.platform === "win32") {
|
70571
70571
|
var useEnv = false;
|
70572
70572
|
try {
|
70573
|
-
useEnv = !!(process.env.SYSTEMROOT &&
|
70573
|
+
useEnv = !!(process.env.SYSTEMROOT && fs26.statSync(process.env.SYSTEMROOT));
|
70574
70574
|
} catch (err) {
|
70575
70575
|
}
|
70576
70576
|
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
|
70577
70577
|
var isWOW64 = false;
|
70578
70578
|
try {
|
70579
|
-
isWOW64 = !!
|
70579
|
+
isWOW64 = !!fs26.statSync(path67.join(sysRoot, "sysnative"));
|
70580
70580
|
} catch (err) {
|
70581
70581
|
}
|
70582
70582
|
return isWOW64 ? "x64" : "x86";
|
@@ -70597,11 +70597,11 @@ var require_command_exists = __commonJS({
|
|
70597
70597
|
init_import_meta_url();
|
70598
70598
|
var exec2 = require("child_process").exec;
|
70599
70599
|
var execSync4 = require("child_process").execSync;
|
70600
|
-
var
|
70600
|
+
var fs26 = require("fs");
|
70601
70601
|
var path67 = require("path");
|
70602
|
-
var access3 =
|
70603
|
-
var accessSync =
|
70604
|
-
var constants3 =
|
70602
|
+
var access3 = fs26.access;
|
70603
|
+
var accessSync = fs26.accessSync;
|
70604
|
+
var constants3 = fs26.constants || fs26;
|
70605
70605
|
var isUsingWindows = process.platform == "win32";
|
70606
70606
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
70607
70607
|
access3(
|
@@ -72098,8 +72098,8 @@ var require_node4 = __commonJS({
|
|
72098
72098
|
}
|
72099
72099
|
break;
|
72100
72100
|
case "FILE":
|
72101
|
-
var
|
72102
|
-
stream3 = new
|
72101
|
+
var fs26 = require("fs");
|
72102
|
+
stream3 = new fs26.SyncWriteStream(fd2, { autoClose: false });
|
72103
72103
|
stream3._type = "fs";
|
72104
72104
|
break;
|
72105
72105
|
case "PIPE":
|
@@ -72154,7 +72154,7 @@ var require_destroy = __commonJS({
|
|
72154
72154
|
"../../node_modules/.pnpm/destroy@1.2.0/node_modules/destroy/index.js"(exports2, module3) {
|
72155
72155
|
"use strict";
|
72156
72156
|
init_import_meta_url();
|
72157
|
-
var
|
72157
|
+
var EventEmitter5 = require("events").EventEmitter;
|
72158
72158
|
var ReadStream = require("fs").ReadStream;
|
72159
72159
|
var Stream = require("stream");
|
72160
72160
|
var Zlib = require("zlib");
|
@@ -72221,7 +72221,7 @@ var require_destroy = __commonJS({
|
|
72221
72221
|
}
|
72222
72222
|
__name(hasDestroy, "hasDestroy");
|
72223
72223
|
function isEventEmitter(val) {
|
72224
|
-
return val instanceof
|
72224
|
+
return val instanceof EventEmitter5;
|
72225
72225
|
}
|
72226
72226
|
__name(isEventEmitter, "isEventEmitter");
|
72227
72227
|
function isFsReadStream(stream2) {
|
@@ -88704,7 +88704,7 @@ var require_view = __commonJS({
|
|
88704
88704
|
init_import_meta_url();
|
88705
88705
|
var debug = require_src3()("express:view");
|
88706
88706
|
var path67 = require("path");
|
88707
|
-
var
|
88707
|
+
var fs26 = require("fs");
|
88708
88708
|
var dirname13 = path67.dirname;
|
88709
88709
|
var basename4 = path67.basename;
|
88710
88710
|
var extname4 = path67.extname;
|
@@ -88771,7 +88771,7 @@ var require_view = __commonJS({
|
|
88771
88771
|
function tryStat(path68) {
|
88772
88772
|
debug('stat "%s"', path68);
|
88773
88773
|
try {
|
88774
|
-
return
|
88774
|
+
return fs26.statSync(path68);
|
88775
88775
|
} catch (e3) {
|
88776
88776
|
return void 0;
|
88777
88777
|
}
|
@@ -89152,7 +89152,7 @@ var require_mime = __commonJS({
|
|
89152
89152
|
"../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module3) {
|
89153
89153
|
init_import_meta_url();
|
89154
89154
|
var path67 = require("path");
|
89155
|
-
var
|
89155
|
+
var fs26 = require("fs");
|
89156
89156
|
function Mime() {
|
89157
89157
|
this.types = /* @__PURE__ */ Object.create(null);
|
89158
89158
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
@@ -89174,7 +89174,7 @@ var require_mime = __commonJS({
|
|
89174
89174
|
};
|
89175
89175
|
Mime.prototype.load = function(file) {
|
89176
89176
|
this._loading = file;
|
89177
|
-
var map = {}, content =
|
89177
|
+
var map = {}, content = fs26.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
89178
89178
|
lines.forEach(function(line) {
|
89179
89179
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
89180
89180
|
map[fields.shift()] = fields;
|
@@ -89425,7 +89425,7 @@ var require_send = __commonJS({
|
|
89425
89425
|
var escapeHtml = require_escape_html();
|
89426
89426
|
var etag = require_etag();
|
89427
89427
|
var fresh = require_fresh();
|
89428
|
-
var
|
89428
|
+
var fs26 = require("fs");
|
89429
89429
|
var mime = require_mime();
|
89430
89430
|
var ms = require_ms2();
|
89431
89431
|
var onFinished = require_on_finished();
|
@@ -89761,7 +89761,7 @@ var require_send = __commonJS({
|
|
89761
89761
|
var i = 0;
|
89762
89762
|
var self2 = this;
|
89763
89763
|
debug('stat "%s"', path68);
|
89764
|
-
|
89764
|
+
fs26.stat(path68, /* @__PURE__ */ __name(function onstat(err, stat4) {
|
89765
89765
|
if (err && err.code === "ENOENT" && !extname4(path68) && path68[path68.length - 1] !== sep3) {
|
89766
89766
|
return next(err);
|
89767
89767
|
}
|
@@ -89778,7 +89778,7 @@ var require_send = __commonJS({
|
|
89778
89778
|
}
|
89779
89779
|
var p2 = path68 + "." + self2._extensions[i++];
|
89780
89780
|
debug('stat "%s"', p2);
|
89781
|
-
|
89781
|
+
fs26.stat(p2, function(err2, stat4) {
|
89782
89782
|
if (err2)
|
89783
89783
|
return next(err2);
|
89784
89784
|
if (stat4.isDirectory())
|
@@ -89800,7 +89800,7 @@ var require_send = __commonJS({
|
|
89800
89800
|
}
|
89801
89801
|
var p2 = join15(path68, self2._index[i]);
|
89802
89802
|
debug('stat "%s"', p2);
|
89803
|
-
|
89803
|
+
fs26.stat(p2, function(err2, stat4) {
|
89804
89804
|
if (err2)
|
89805
89805
|
return next(err2);
|
89806
89806
|
if (stat4.isDirectory())
|
@@ -89815,7 +89815,7 @@ var require_send = __commonJS({
|
|
89815
89815
|
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream2(path68, options29) {
|
89816
89816
|
var self2 = this;
|
89817
89817
|
var res = this.res;
|
89818
|
-
var stream3 =
|
89818
|
+
var stream3 = fs26.createReadStream(path68, options29);
|
89819
89819
|
this.emit("stream", stream3);
|
89820
89820
|
stream3.pipe(res);
|
89821
89821
|
function cleanup() {
|
@@ -92990,7 +92990,7 @@ var require_express = __commonJS({
|
|
92990
92990
|
"use strict";
|
92991
92991
|
init_import_meta_url();
|
92992
92992
|
var bodyParser2 = require_body_parser();
|
92993
|
-
var
|
92993
|
+
var EventEmitter5 = require("events").EventEmitter;
|
92994
92994
|
var mixin3 = require_merge_descriptors();
|
92995
92995
|
var proto = require_application();
|
92996
92996
|
var Route = require_route3();
|
@@ -93002,7 +93002,7 @@ var require_express = __commonJS({
|
|
93002
93002
|
var app = /* @__PURE__ */ __name(function(req2, res2, next) {
|
93003
93003
|
app.handle(req2, res2, next);
|
93004
93004
|
}, "app");
|
93005
|
-
mixin3(app,
|
93005
|
+
mixin3(app, EventEmitter5.prototype, false);
|
93006
93006
|
mixin3(app, proto, false);
|
93007
93007
|
app.request = Object.create(req, {
|
93008
93008
|
app: { configurable: true, enumerable: true, writable: true, value: app }
|
@@ -105121,7 +105121,7 @@ var require_utils5 = __commonJS({
|
|
105121
105121
|
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports2) {
|
105122
105122
|
"use strict";
|
105123
105123
|
init_import_meta_url();
|
105124
|
-
var
|
105124
|
+
var fs26 = require("fs");
|
105125
105125
|
var ini = require_ini();
|
105126
105126
|
var path67 = require("path");
|
105127
105127
|
var stripJsonComments = require_strip_json_comments();
|
@@ -105140,7 +105140,7 @@ var require_utils5 = __commonJS({
|
|
105140
105140
|
var file2 = path67.join.apply(null, args);
|
105141
105141
|
var content;
|
105142
105142
|
try {
|
105143
|
-
return
|
105143
|
+
return fs26.readFileSync(file2, "utf-8");
|
105144
105144
|
} catch (err) {
|
105145
105145
|
return;
|
105146
105146
|
}
|
@@ -105179,7 +105179,7 @@ var require_utils5 = __commonJS({
|
|
105179
105179
|
function find2(start, rel2) {
|
105180
105180
|
var file2 = path67.join(start, rel2);
|
105181
105181
|
try {
|
105182
|
-
|
105182
|
+
fs26.statSync(file2);
|
105183
105183
|
return file2;
|
105184
105184
|
} catch (err) {
|
105185
105185
|
if (path67.dirname(start) !== start)
|
@@ -105688,19 +105688,19 @@ var require_update_check = __commonJS({
|
|
105688
105688
|
init_import_meta_url();
|
105689
105689
|
var { URL: URL7 } = require("url");
|
105690
105690
|
var { join: join15 } = require("path");
|
105691
|
-
var
|
105691
|
+
var fs26 = require("fs");
|
105692
105692
|
var { promisify: promisify2 } = require("util");
|
105693
105693
|
var { tmpdir } = require("os");
|
105694
105694
|
var registryUrl = require_registry_url();
|
105695
|
-
var writeFile6 = promisify2(
|
105696
|
-
var mkdir6 = promisify2(
|
105697
|
-
var
|
105695
|
+
var writeFile6 = promisify2(fs26.writeFile);
|
105696
|
+
var mkdir6 = promisify2(fs26.mkdir);
|
105697
|
+
var readFile13 = promisify2(fs26.readFile);
|
105698
105698
|
var compareVersions = /* @__PURE__ */ __name((a, b2) => a.localeCompare(b2, "en-US", { numeric: true }), "compareVersions");
|
105699
105699
|
var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
105700
105700
|
var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
|
105701
105701
|
const rootDir = tmpdir();
|
105702
105702
|
const subDir = join15(rootDir, "update-check");
|
105703
|
-
if (!
|
105703
|
+
if (!fs26.existsSync(subDir)) {
|
105704
105704
|
await mkdir6(subDir);
|
105705
105705
|
}
|
105706
105706
|
let name = `${details.name}-${distTag}.json`;
|
@@ -105710,8 +105710,8 @@ var require_update_check = __commonJS({
|
|
105710
105710
|
return join15(subDir, name);
|
105711
105711
|
}, "getFile");
|
105712
105712
|
var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval2) => {
|
105713
|
-
if (
|
105714
|
-
const content = await
|
105713
|
+
if (fs26.existsSync(file)) {
|
105714
|
+
const content = await readFile13(file, "utf8");
|
105715
105715
|
const { lastUpdate, latest } = JSON.parse(content);
|
105716
105716
|
const nextCheck = lastUpdate + interval2;
|
105717
105717
|
if (nextCheck > time) {
|
@@ -106418,15 +106418,15 @@ var require_mime2 = __commonJS({
|
|
106418
106418
|
});
|
106419
106419
|
|
106420
106420
|
// src/pages/hash.ts
|
106421
|
-
var
|
106421
|
+
var import_node_fs10, import_node_path20, import_blake3_wasm, hashFile;
|
106422
106422
|
var init_hash = __esm({
|
106423
106423
|
"src/pages/hash.ts"() {
|
106424
106424
|
init_import_meta_url();
|
106425
|
-
|
106425
|
+
import_node_fs10 = require("node:fs");
|
106426
106426
|
import_node_path20 = require("node:path");
|
106427
106427
|
import_blake3_wasm = require("blake3-wasm");
|
106428
106428
|
hashFile = /* @__PURE__ */ __name((filepath) => {
|
106429
|
-
const contents = (0,
|
106429
|
+
const contents = (0, import_node_fs10.readFileSync)(filepath);
|
106430
106430
|
const base64Contents = contents.toString("base64");
|
106431
106431
|
const extension = (0, import_node_path20.extname)(filepath).substring(1);
|
106432
106432
|
return (0, import_blake3_wasm.hash)(base64Contents + extension).toString("hex").slice(0, 32);
|
@@ -110986,7 +110986,7 @@ var require_src6 = __commonJS({
|
|
110986
110986
|
Log: () => Log2,
|
110987
110987
|
LogLevel: () => LogLevel3,
|
110988
110988
|
MiniflareError: () => MiniflareError,
|
110989
|
-
Mutex: () =>
|
110989
|
+
Mutex: () => Mutex5,
|
110990
110990
|
NoOpLog: () => NoOpLog,
|
110991
110991
|
Option: () => Option,
|
110992
110992
|
OptionType: () => OptionType,
|
@@ -111626,7 +111626,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
111626
111626
|
var import_assert32 = __toModule(require("assert"));
|
111627
111627
|
var import_async_hooks2 = __toModule(require("async_hooks"));
|
111628
111628
|
var import_timers = __toModule(require("timers"));
|
111629
|
-
var
|
111629
|
+
var import_promises23 = __toModule(require("timers/promises"));
|
111630
111630
|
var inputGateStorage = new import_async_hooks2.AsyncLocalStorage();
|
111631
111631
|
var outputGateStorage = new import_async_hooks2.AsyncLocalStorage();
|
111632
111632
|
function waitForOpenInputGate() {
|
@@ -111668,7 +111668,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
111668
111668
|
return inputGateStorage.run(this, closure);
|
111669
111669
|
}
|
111670
111670
|
async waitForOpen() {
|
111671
|
-
await (0,
|
111671
|
+
await (0, import_promises23.setImmediate)();
|
111672
111672
|
if (this.#lockCount === 0)
|
111673
111673
|
return;
|
111674
111674
|
return new Promise((resolve19) => this.#resolveQueue.push(resolve19));
|
@@ -111693,7 +111693,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
111693
111693
|
this.#lockCount--;
|
111694
111694
|
while (this.#lockCount === 0 && this.#resolveQueue.length) {
|
111695
111695
|
this.#resolveQueue.shift()();
|
111696
|
-
await (0,
|
111696
|
+
await (0, import_promises23.setImmediate)();
|
111697
111697
|
}
|
111698
111698
|
if (this.#parent)
|
111699
111699
|
return this.#parent.#unlock();
|
@@ -111725,7 +111725,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
111725
111725
|
}
|
111726
111726
|
}, "InputGatedEventTarget");
|
111727
111727
|
var import_assert42 = __toModule(require("assert"));
|
111728
|
-
var
|
111728
|
+
var Mutex5 = /* @__PURE__ */ __name(class {
|
111729
111729
|
locked = false;
|
111730
111730
|
resolveQueue = [];
|
111731
111731
|
lock() {
|
@@ -111780,7 +111780,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
111780
111780
|
var require_main4 = __commonJS({
|
111781
111781
|
"../../node_modules/.pnpm/dotenv@10.0.0/node_modules/dotenv/lib/main.js"(exports2, module3) {
|
111782
111782
|
init_import_meta_url();
|
111783
|
-
var
|
111783
|
+
var fs26 = require("fs");
|
111784
111784
|
var path67 = require("path");
|
111785
111785
|
var os11 = require("os");
|
111786
111786
|
function log2(message) {
|
@@ -111838,7 +111838,7 @@ var require_main4 = __commonJS({
|
|
111838
111838
|
}
|
111839
111839
|
}
|
111840
111840
|
try {
|
111841
|
-
const parsed = parse7(
|
111841
|
+
const parsed = parse7(fs26.readFileSync(dotenvPath, { encoding }), { debug });
|
111842
111842
|
Object.keys(parsed).forEach(function(key) {
|
111843
111843
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
111844
111844
|
process.env[key] = parsed[key];
|
@@ -115326,8 +115326,8 @@ var require_dispatcher2 = __commonJS({
|
|
115326
115326
|
"../../node_modules/.pnpm/undici@5.28.2/node_modules/undici/lib/dispatcher.js"(exports2, module3) {
|
115327
115327
|
"use strict";
|
115328
115328
|
init_import_meta_url();
|
115329
|
-
var
|
115330
|
-
var Dispatcher2 = class extends
|
115329
|
+
var EventEmitter5 = require("events");
|
115330
|
+
var Dispatcher2 = class extends EventEmitter5 {
|
115331
115331
|
dispatch() {
|
115332
115332
|
throw new Error("not implemented");
|
115333
115333
|
}
|
@@ -134686,7 +134686,7 @@ var require_src8 = __commonJS({
|
|
134686
134686
|
}
|
134687
134687
|
__name(formatSize, "formatSize");
|
134688
134688
|
var import_assert22 = __toModule(require("assert"));
|
134689
|
-
var
|
134689
|
+
var import_promises23 = __toModule(require("fs/promises"));
|
134690
134690
|
var import_path22 = __toModule(require("path"));
|
134691
134691
|
var import_shared8 = __toModule(require_src6());
|
134692
134692
|
var import_dotenv2 = __toModule(require_main4());
|
@@ -136423,7 +136423,7 @@ The \`binding\` key should be used to define binding names.`);
|
|
136423
136423
|
if (envPath) {
|
136424
136424
|
envPath = import_path22.default.resolve(this.ctx.rootPath, envPath);
|
136425
136425
|
try {
|
136426
|
-
Object.assign(bindings, import_dotenv2.default.parse(await
|
136426
|
+
Object.assign(bindings, import_dotenv2.default.parse(await import_promises23.default.readFile(envPath, "utf8")));
|
136427
136427
|
} catch (e3) {
|
136428
136428
|
if (!(e3.code === "ENOENT" && this.envPath === true))
|
136429
136429
|
throw e3;
|
@@ -136433,21 +136433,21 @@ The \`binding\` key should be used to define binding names.`);
|
|
136433
136433
|
if (this.wasmBindings) {
|
136434
136434
|
for (let [name, wasmPath] of Object.entries(this.wasmBindings)) {
|
136435
136435
|
wasmPath = import_path22.default.resolve(this.ctx.rootPath, wasmPath);
|
136436
|
-
bindings[name] = new WebAssembly.Module(await
|
136436
|
+
bindings[name] = new WebAssembly.Module(await import_promises23.default.readFile(wasmPath));
|
136437
136437
|
watch6.push(wasmPath);
|
136438
136438
|
}
|
136439
136439
|
}
|
136440
136440
|
if (this.textBlobBindings) {
|
136441
136441
|
for (let [name, textPath] of Object.entries(this.textBlobBindings)) {
|
136442
136442
|
textPath = import_path22.default.resolve(this.ctx.rootPath, textPath);
|
136443
|
-
bindings[name] = await
|
136443
|
+
bindings[name] = await import_promises23.default.readFile(textPath, "utf-8");
|
136444
136444
|
watch6.push(textPath);
|
136445
136445
|
}
|
136446
136446
|
}
|
136447
136447
|
if (this.dataBlobBindings) {
|
136448
136448
|
for (let [name, dataPath] of Object.entries(this.dataBlobBindings)) {
|
136449
136449
|
dataPath = import_path22.default.resolve(this.ctx.rootPath, dataPath);
|
136450
|
-
const fileContent = await
|
136450
|
+
const fileContent = await import_promises23.default.readFile(dataPath);
|
136451
136451
|
bindings[name] = (0, import_shared8.viewToBuffer)(fileContent);
|
136452
136452
|
watch6.push(dataPath);
|
136453
136453
|
}
|
@@ -136683,7 +136683,7 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
136683
136683
|
}
|
136684
136684
|
__name(_populateBuildConfig, "_populateBuildConfig");
|
136685
136685
|
var import_buffer = __toModule(require("buffer"));
|
136686
|
-
var
|
136686
|
+
var import_promises24 = __toModule(require("fs/promises"));
|
136687
136687
|
var import_path42 = __toModule(require("path"));
|
136688
136688
|
var import_web5 = __toModule(require("stream/web"));
|
136689
136689
|
var import_web6 = __toModule(require("stream/web"));
|
@@ -136766,7 +136766,7 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
136766
136766
|
};
|
136767
136767
|
var events_exports = {};
|
136768
136768
|
__export2(events_exports, {
|
136769
|
-
EventEmitter: () =>
|
136769
|
+
EventEmitter: () => EventEmitter5,
|
136770
136770
|
EventEmitterAsyncResource: () => EventEmitterAsyncResource,
|
136771
136771
|
captureRejectionSymbol: () => captureRejectionSymbol,
|
136772
136772
|
default: () => events_default,
|
@@ -136778,18 +136778,18 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
136778
136778
|
once: () => once,
|
136779
136779
|
setMaxListeners: () => setMaxListeners
|
136780
136780
|
});
|
136781
|
-
var
|
136782
|
-
var events_default =
|
136783
|
-
var
|
136784
|
-
var EventEmitterAsyncResource =
|
136785
|
-
var captureRejectionSymbol =
|
136786
|
-
var defaultMaxListeners =
|
136787
|
-
var errorMonitor =
|
136788
|
-
var getEventListeners =
|
136789
|
-
var listenerCount =
|
136790
|
-
var on =
|
136791
|
-
var once =
|
136792
|
-
var setMaxListeners =
|
136781
|
+
var import_node_events4 = __toModule(require("node:events"));
|
136782
|
+
var events_default = import_node_events4.default;
|
136783
|
+
var EventEmitter5 = import_node_events4.default.EventEmitter;
|
136784
|
+
var EventEmitterAsyncResource = import_node_events4.default.EventEmitterAsyncResource;
|
136785
|
+
var captureRejectionSymbol = import_node_events4.default.captureRejectionSymbol;
|
136786
|
+
var defaultMaxListeners = import_node_events4.default.defaultMaxListeners;
|
136787
|
+
var errorMonitor = import_node_events4.default.errorMonitor;
|
136788
|
+
var getEventListeners = import_node_events4.default.getEventListeners;
|
136789
|
+
var listenerCount = import_node_events4.default.listenerCount;
|
136790
|
+
var on = import_node_events4.default.on;
|
136791
|
+
var once = import_node_events4.default.once;
|
136792
|
+
var setMaxListeners = import_node_events4.default.setMaxListeners;
|
136793
136793
|
var util_exports = {};
|
136794
136794
|
__export2(util_exports, {
|
136795
136795
|
_extend: () => import_node_util3._extend,
|
@@ -137068,7 +137068,7 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
137068
137068
|
if (packagePath) {
|
137069
137069
|
packagePath = import_path42.default.resolve(this.ctx.rootPath, packagePath);
|
137070
137070
|
try {
|
137071
|
-
const pkg = JSON.parse(await
|
137071
|
+
const pkg = JSON.parse(await import_promises24.default.readFile(packagePath, "utf8"));
|
137072
137072
|
scriptPath3 = this.modules ? pkg.module : pkg.main;
|
137073
137073
|
scriptPath3 &&= import_path42.default.resolve(import_path42.default.dirname(packagePath), scriptPath3);
|
137074
137074
|
} catch (e3) {
|
@@ -137080,7 +137080,7 @@ Make sure "${service}" is mounted so Miniflare knows where to find it.`);
|
|
137080
137080
|
}
|
137081
137081
|
if (scriptPath3 !== void 0) {
|
137082
137082
|
scriptPath3 = import_path42.default.resolve(this.ctx.rootPath, scriptPath3);
|
137083
|
-
const code = await
|
137083
|
+
const code = await import_promises24.default.readFile(scriptPath3, "utf8");
|
137084
137084
|
watch6.push(scriptPath3);
|
137085
137085
|
return {
|
137086
137086
|
globals,
|
@@ -139990,13 +139990,13 @@ async function generateAssetsFetch(directory, log2) {
|
|
139990
139990
|
const workerFile = (0, import_node_path22.join)(directory, "_worker.js");
|
139991
139991
|
const ignoredFiles = [headersFile, redirectsFile, workerFile];
|
139992
139992
|
let redirects;
|
139993
|
-
if ((0,
|
139994
|
-
const contents = (0,
|
139993
|
+
if ((0, import_node_fs11.existsSync)(redirectsFile)) {
|
139994
|
+
const contents = (0, import_node_fs11.readFileSync)(redirectsFile, "utf-8");
|
139995
139995
|
redirects = parseRedirects(contents);
|
139996
139996
|
}
|
139997
139997
|
let headers;
|
139998
|
-
if ((0,
|
139999
|
-
const contents = (0,
|
139998
|
+
if ((0, import_node_fs11.existsSync)(headersFile)) {
|
139999
|
+
const contents = (0, import_node_fs11.readFileSync)(headersFile, "utf-8");
|
140000
140000
|
headers = parseHeaders(contents);
|
140001
140001
|
}
|
140002
140002
|
let metadata = createMetadataObject({
|
@@ -140010,13 +140010,13 @@ async function generateAssetsFetch(directory, log2) {
|
|
140010
140010
|
switch (path67) {
|
140011
140011
|
case headersFile: {
|
140012
140012
|
log2.log("_headers modified. Re-evaluating...");
|
140013
|
-
const contents = (0,
|
140013
|
+
const contents = (0, import_node_fs11.readFileSync)(headersFile).toString();
|
140014
140014
|
headers = parseHeaders(contents);
|
140015
140015
|
break;
|
140016
140016
|
}
|
140017
140017
|
case redirectsFile: {
|
140018
140018
|
log2.log("_redirects modified. Re-evaluating...");
|
140019
|
-
const contents = (0,
|
140019
|
+
const contents = (0, import_node_fs11.readFileSync)(redirectsFile).toString();
|
140020
140020
|
redirects = parseRedirects(contents);
|
140021
140021
|
break;
|
140022
140022
|
}
|
@@ -140040,7 +140040,7 @@ async function generateAssetsFetch(directory, log2) {
|
|
140040
140040
|
if (!filepath.startsWith(directory)) {
|
140041
140041
|
return null;
|
140042
140042
|
}
|
140043
|
-
if ((0,
|
140043
|
+
if ((0, import_node_fs11.existsSync)(filepath) && (0, import_node_fs11.lstatSync)(filepath).isFile() && !ignoredFiles.includes(filepath)) {
|
140044
140044
|
const hash = hashFile(filepath);
|
140045
140045
|
assetKeyEntryMap.set(hash, filepath);
|
140046
140046
|
return hash;
|
@@ -140070,7 +140070,7 @@ async function generateAssetsFetch(directory, log2) {
|
|
140070
140070
|
"Could not fetch asset. Please file an issue on GitHub (https://github.com/cloudflare/workers-sdk/issues/new/choose) with reproduction steps."
|
140071
140071
|
);
|
140072
140072
|
}
|
140073
|
-
const body = (0,
|
140073
|
+
const body = (0, import_node_fs11.readFileSync)(filepath);
|
140074
140074
|
let contentType = (0, import_mime.getType)(filepath) || "application/octet-stream";
|
140075
140075
|
if (contentType.startsWith("text/") && !contentType.includes("charset")) {
|
140076
140076
|
contentType = `${contentType}; charset=utf-8`;
|
@@ -140084,12 +140084,12 @@ async function generateAssetsFetch(directory, log2) {
|
|
140084
140084
|
return await generateResponse(request3);
|
140085
140085
|
};
|
140086
140086
|
}
|
140087
|
-
var import_node_assert9,
|
140087
|
+
var import_node_assert9, import_node_fs11, import_node_path22, import_chokidar, import_mime, import_miniflare6, import_undici5, ProxyDispatcher, invalidAssetsFetch;
|
140088
140088
|
var init_assets = __esm({
|
140089
140089
|
"src/miniflare-cli/assets.ts"() {
|
140090
140090
|
init_import_meta_url();
|
140091
140091
|
import_node_assert9 = __toESM(require("node:assert"));
|
140092
|
-
|
140092
|
+
import_node_fs11 = require("node:fs");
|
140093
140093
|
import_node_path22 = require("node:path");
|
140094
140094
|
init_createMetadataObject();
|
140095
140095
|
init_parseHeaders();
|
@@ -142200,20 +142200,20 @@ var require_md5_file = __commonJS({
|
|
142200
142200
|
"../../node_modules/.pnpm/md5-file@5.0.0/node_modules/md5-file/index.js"(exports2, module3) {
|
142201
142201
|
init_import_meta_url();
|
142202
142202
|
var crypto5 = require("crypto");
|
142203
|
-
var
|
142203
|
+
var fs26 = require("fs");
|
142204
142204
|
var BUFFER_SIZE = 8192;
|
142205
142205
|
function md5FileSync(path67) {
|
142206
|
-
const fd =
|
142206
|
+
const fd = fs26.openSync(path67, "r");
|
142207
142207
|
const hash = crypto5.createHash("md5");
|
142208
142208
|
const buffer = Buffer.alloc(BUFFER_SIZE);
|
142209
142209
|
try {
|
142210
142210
|
let bytesRead;
|
142211
142211
|
do {
|
142212
|
-
bytesRead =
|
142212
|
+
bytesRead = fs26.readSync(fd, buffer, 0, BUFFER_SIZE);
|
142213
142213
|
hash.update(buffer.slice(0, bytesRead));
|
142214
142214
|
} while (bytesRead === BUFFER_SIZE);
|
142215
142215
|
} finally {
|
142216
|
-
|
142216
|
+
fs26.closeSync(fd);
|
142217
142217
|
}
|
142218
142218
|
return hash.digest("hex");
|
142219
142219
|
}
|
@@ -142221,7 +142221,7 @@ var require_md5_file = __commonJS({
|
|
142221
142221
|
function md5File2(path67) {
|
142222
142222
|
return new Promise((resolve19, reject) => {
|
142223
142223
|
const output = crypto5.createHash("md5");
|
142224
|
-
const input =
|
142224
|
+
const input = fs26.createReadStream(path67);
|
142225
142225
|
input.on("error", (err) => {
|
142226
142226
|
reject(err);
|
142227
142227
|
});
|
@@ -144116,12 +144116,12 @@ var require_eventemitter3 = __commonJS({
|
|
144116
144116
|
delete emitter._events[evt];
|
144117
144117
|
}
|
144118
144118
|
__name(clearEvent, "clearEvent");
|
144119
|
-
function
|
144119
|
+
function EventEmitter5() {
|
144120
144120
|
this._events = new Events();
|
144121
144121
|
this._eventsCount = 0;
|
144122
144122
|
}
|
144123
|
-
__name(
|
144124
|
-
|
144123
|
+
__name(EventEmitter5, "EventEmitter");
|
144124
|
+
EventEmitter5.prototype.eventNames = /* @__PURE__ */ __name(function eventNames() {
|
144125
144125
|
var names = [], events2, name;
|
144126
144126
|
if (this._eventsCount === 0)
|
144127
144127
|
return names;
|
@@ -144134,7 +144134,7 @@ var require_eventemitter3 = __commonJS({
|
|
144134
144134
|
}
|
144135
144135
|
return names;
|
144136
144136
|
}, "eventNames");
|
144137
|
-
|
144137
|
+
EventEmitter5.prototype.listeners = /* @__PURE__ */ __name(function listeners(event) {
|
144138
144138
|
var evt = prefix ? prefix + event : event, handlers2 = this._events[evt];
|
144139
144139
|
if (!handlers2)
|
144140
144140
|
return [];
|
@@ -144145,7 +144145,7 @@ var require_eventemitter3 = __commonJS({
|
|
144145
144145
|
}
|
144146
144146
|
return ee;
|
144147
144147
|
}, "listeners");
|
144148
|
-
|
144148
|
+
EventEmitter5.prototype.listenerCount = /* @__PURE__ */ __name(function listenerCount(event) {
|
144149
144149
|
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
144150
144150
|
if (!listeners)
|
144151
144151
|
return 0;
|
@@ -144153,7 +144153,7 @@ var require_eventemitter3 = __commonJS({
|
|
144153
144153
|
return 1;
|
144154
144154
|
return listeners.length;
|
144155
144155
|
}, "listenerCount");
|
144156
|
-
|
144156
|
+
EventEmitter5.prototype.emit = /* @__PURE__ */ __name(function emit(event, a1, a2, a3, a4, a5) {
|
144157
144157
|
var evt = prefix ? prefix + event : event;
|
144158
144158
|
if (!this._events[evt])
|
144159
144159
|
return false;
|
@@ -144208,13 +144208,13 @@ var require_eventemitter3 = __commonJS({
|
|
144208
144208
|
}
|
144209
144209
|
return true;
|
144210
144210
|
}, "emit");
|
144211
|
-
|
144211
|
+
EventEmitter5.prototype.on = /* @__PURE__ */ __name(function on(event, fn2, context2) {
|
144212
144212
|
return addListener(this, event, fn2, context2, false);
|
144213
144213
|
}, "on");
|
144214
|
-
|
144214
|
+
EventEmitter5.prototype.once = /* @__PURE__ */ __name(function once(event, fn2, context2) {
|
144215
144215
|
return addListener(this, event, fn2, context2, true);
|
144216
144216
|
}, "once");
|
144217
|
-
|
144217
|
+
EventEmitter5.prototype.removeListener = /* @__PURE__ */ __name(function removeListener(event, fn2, context2, once) {
|
144218
144218
|
var evt = prefix ? prefix + event : event;
|
144219
144219
|
if (!this._events[evt])
|
144220
144220
|
return this;
|
@@ -144240,7 +144240,7 @@ var require_eventemitter3 = __commonJS({
|
|
144240
144240
|
}
|
144241
144241
|
return this;
|
144242
144242
|
}, "removeListener");
|
144243
|
-
|
144243
|
+
EventEmitter5.prototype.removeAllListeners = /* @__PURE__ */ __name(function removeAllListeners(event) {
|
144244
144244
|
var evt;
|
144245
144245
|
if (event) {
|
144246
144246
|
evt = prefix ? prefix + event : event;
|
@@ -144252,12 +144252,12 @@ var require_eventemitter3 = __commonJS({
|
|
144252
144252
|
}
|
144253
144253
|
return this;
|
144254
144254
|
}, "removeAllListeners");
|
144255
|
-
|
144256
|
-
|
144257
|
-
|
144258
|
-
|
144255
|
+
EventEmitter5.prototype.off = EventEmitter5.prototype.removeListener;
|
144256
|
+
EventEmitter5.prototype.addListener = EventEmitter5.prototype.on;
|
144257
|
+
EventEmitter5.prefixed = prefix;
|
144258
|
+
EventEmitter5.EventEmitter = EventEmitter5;
|
144259
144259
|
if ("undefined" !== typeof module3) {
|
144260
|
-
module3.exports =
|
144260
|
+
module3.exports = EventEmitter5;
|
144261
144261
|
}
|
144262
144262
|
}
|
144263
144263
|
});
|
@@ -148363,7 +148363,7 @@ var require_websocket4 = __commonJS({
|
|
148363
148363
|
"../../node_modules/.pnpm/ws@8.11.0/node_modules/ws/lib/websocket.js"(exports2, module3) {
|
148364
148364
|
"use strict";
|
148365
148365
|
init_import_meta_url();
|
148366
|
-
var
|
148366
|
+
var EventEmitter5 = require("events");
|
148367
148367
|
var https3 = require("https");
|
148368
148368
|
var http4 = require("http");
|
148369
148369
|
var net3 = require("net");
|
@@ -148394,7 +148394,7 @@ var require_websocket4 = __commonJS({
|
|
148394
148394
|
var protocolVersions = [8, 13];
|
148395
148395
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
148396
148396
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
148397
|
-
var WebSocket3 = class extends
|
148397
|
+
var WebSocket3 = class extends EventEmitter5 {
|
148398
148398
|
/**
|
148399
148399
|
* Create a new `WebSocket`.
|
148400
148400
|
*
|
@@ -149299,7 +149299,7 @@ var require_websocket_server2 = __commonJS({
|
|
149299
149299
|
"../../node_modules/.pnpm/ws@8.11.0/node_modules/ws/lib/websocket-server.js"(exports2, module3) {
|
149300
149300
|
"use strict";
|
149301
149301
|
init_import_meta_url();
|
149302
|
-
var
|
149302
|
+
var EventEmitter5 = require("events");
|
149303
149303
|
var http4 = require("http");
|
149304
149304
|
var https3 = require("https");
|
149305
149305
|
var net3 = require("net");
|
@@ -149314,7 +149314,7 @@ var require_websocket_server2 = __commonJS({
|
|
149314
149314
|
var RUNNING = 0;
|
149315
149315
|
var CLOSING = 1;
|
149316
149316
|
var CLOSED = 2;
|
149317
|
-
var WebSocketServer2 = class extends
|
149317
|
+
var WebSocketServer2 = class extends EventEmitter5 {
|
149318
149318
|
/**
|
149319
149319
|
* Create a `WebSocketServer` instance.
|
149320
149320
|
*
|
@@ -152654,7 +152654,7 @@ init_import_meta_url();
|
|
152654
152654
|
init_import_meta_url();
|
152655
152655
|
|
152656
152656
|
// package.json
|
152657
|
-
var version = "3.
|
152657
|
+
var version = "3.59.0";
|
152658
152658
|
var package_default = {
|
152659
152659
|
name: "wrangler",
|
152660
152660
|
version,
|
@@ -154591,7 +154591,7 @@ function getAuthFromEnv() {
|
|
154591
154591
|
}
|
154592
154592
|
}
|
154593
154593
|
__name(getAuthFromEnv, "getAuthFromEnv");
|
154594
|
-
var
|
154594
|
+
var USER_AUTH_CONFIG_PATH = "config";
|
154595
154595
|
var DefaultScopes = {
|
154596
154596
|
"account:read": "See your account info such as account details, analytics, and memberships.",
|
154597
154597
|
"user:read": "See your user info such as name, email address, and account memberships.",
|
@@ -154990,28 +154990,25 @@ async function generatePKCECodes() {
|
|
154990
154990
|
return { codeChallenge, codeVerifier };
|
154991
154991
|
}
|
154992
154992
|
__name(generatePKCECodes, "generatePKCECodes");
|
154993
|
+
function getAuthConfigFilePath() {
|
154994
|
+
const environment = getCloudflareApiEnvironmentFromEnv();
|
154995
|
+
const filePath = `${USER_AUTH_CONFIG_PATH}/${environment === "production" ? "default.toml" : `${environment}.toml`}`;
|
154996
|
+
return import_node_path6.default.join(getGlobalWranglerConfigPath(), filePath);
|
154997
|
+
}
|
154998
|
+
__name(getAuthConfigFilePath, "getAuthConfigFilePath");
|
154993
154999
|
function writeAuthConfigFile(config) {
|
154994
|
-
const
|
154995
|
-
|
154996
|
-
USER_AUTH_CONFIG_FILE
|
154997
|
-
);
|
154998
|
-
(0, import_node_fs3.mkdirSync)(import_node_path6.default.dirname(authConfigFilePath), {
|
155000
|
+
const configPath = getAuthConfigFilePath();
|
155001
|
+
(0, import_node_fs3.mkdirSync)(import_node_path6.default.dirname(configPath), {
|
154999
155002
|
recursive: true
|
155000
155003
|
});
|
155001
|
-
(0, import_node_fs3.writeFileSync)(
|
155002
|
-
|
155003
|
-
|
155004
|
-
{ encoding: "utf-8" }
|
155005
|
-
);
|
155004
|
+
(0, import_node_fs3.writeFileSync)(import_node_path6.default.join(configPath), import_toml2.default.stringify(config), {
|
155005
|
+
encoding: "utf-8"
|
155006
|
+
});
|
155006
155007
|
reinitialiseAuthTokens();
|
155007
155008
|
}
|
155008
155009
|
__name(writeAuthConfigFile, "writeAuthConfigFile");
|
155009
155010
|
function readAuthConfigFile() {
|
155010
|
-
const
|
155011
|
-
getGlobalWranglerConfigPath(),
|
155012
|
-
USER_AUTH_CONFIG_FILE
|
155013
|
-
);
|
155014
|
-
const toml = parseTOML(readFileSync5(authConfigFilePath));
|
155011
|
+
const toml = parseTOML(readFileSync5(getAuthConfigFilePath()));
|
155015
155012
|
return toml;
|
155016
155013
|
}
|
155017
155014
|
__name(readAuthConfigFile, "readAuthConfigFile");
|
@@ -155176,7 +155173,7 @@ async function logout() {
|
|
155176
155173
|
}
|
155177
155174
|
});
|
155178
155175
|
await response.text();
|
155179
|
-
(0, import_node_fs3.rmSync)(
|
155176
|
+
(0, import_node_fs3.rmSync)(getAuthConfigFilePath());
|
155180
155177
|
logger.log(`Successfully logged out.`);
|
155181
155178
|
}
|
155182
155179
|
__name(logout, "logout");
|
@@ -155760,7 +155757,7 @@ ${message}`;
|
|
155760
155757
|
__name(deprecated, "deprecated");
|
155761
155758
|
function experimental(diagnostics, config, fieldPath) {
|
155762
155759
|
const result = unwindPropertyPath(config, fieldPath);
|
155763
|
-
if (result !== void 0 && result.field in result.container) {
|
155760
|
+
if (result !== void 0 && result.field in result.container && !("WRANGLER_DISABLE_EXPERIMENTAL_WARNING" in process.env)) {
|
155764
155761
|
diagnostics.warnings.push(
|
155765
155762
|
`"${fieldPath}" fields are experimental and may change or break at any time.`
|
155766
155763
|
);
|
@@ -158816,7 +158813,7 @@ function printBindings(bindings) {
|
|
158816
158813
|
type: "Data Blobs",
|
158817
158814
|
entries: Object.entries(data_blobs).map(([key, value]) => ({
|
158818
158815
|
key,
|
158819
|
-
value: truncate4(value)
|
158816
|
+
value: typeof value === "string" ? truncate4(value) : "<Buffer>"
|
158820
158817
|
}))
|
158821
158818
|
});
|
158822
158819
|
}
|
@@ -159045,7 +159042,7 @@ function printBindings(bindings) {
|
|
159045
159042
|
type: "Wasm Modules",
|
159046
159043
|
entries: Object.entries(wasm_modules).map(([key, value]) => ({
|
159047
159044
|
key,
|
159048
|
-
value: truncate4(value)
|
159045
|
+
value: typeof value === "string" ? truncate4(value) : "<Wasm>"
|
159049
159046
|
}))
|
159050
159047
|
});
|
159051
159048
|
}
|
@@ -159666,7 +159663,8 @@ var RuleTypeToModuleType = {
|
|
159666
159663
|
Data: "buffer",
|
159667
159664
|
Text: "text",
|
159668
159665
|
PythonModule: "python",
|
159669
|
-
PythonRequirement: "python-requirement"
|
159666
|
+
PythonRequirement: "python-requirement",
|
159667
|
+
NodeJsCompatModule: "nodejs-compat-module"
|
159670
159668
|
};
|
159671
159669
|
var ModuleTypeToRuleType = flipObject(RuleTypeToModuleType);
|
159672
159670
|
var modulesWatchRegexp = /^wrangler:modules-watch$/;
|
@@ -161561,7 +161559,6 @@ var import_signal_exit4 = __toESM(require_signal_exit());
|
|
161561
161559
|
init_import_meta_url();
|
161562
161560
|
var import_node_assert8 = __toESM(require("node:assert"));
|
161563
161561
|
var import_node_crypto4 = require("node:crypto");
|
161564
|
-
var import_node_fs11 = require("node:fs");
|
161565
161562
|
var import_node_path19 = __toESM(require("node:path"));
|
161566
161563
|
|
161567
161564
|
// ../../node_modules/.pnpm/es-module-lexer@1.3.1/node_modules/es-module-lexer/dist/lexer.js
|
@@ -161650,15 +161647,13 @@ __name(AIFetcher, "AIFetcher");
|
|
161650
161647
|
|
161651
161648
|
// src/deployment-bundle/source-url.ts
|
161652
161649
|
init_import_meta_url();
|
161653
|
-
var import_node_fs10 = __toESM(require("node:fs"));
|
161654
161650
|
var import_url2 = require("url");
|
161655
161651
|
function withSourceURL(source, sourcePath) {
|
161656
161652
|
return `${source}
|
161657
161653
|
//# sourceURL=${(0, import_url2.pathToFileURL)(sourcePath)}`;
|
161658
161654
|
}
|
161659
161655
|
__name(withSourceURL, "withSourceURL");
|
161660
|
-
function withSourceURLs(entrypointPath, modules) {
|
161661
|
-
let entrypointSource = import_node_fs10.default.readFileSync(entrypointPath, "utf8");
|
161656
|
+
function withSourceURLs(entrypointPath, entrypointSource, modules) {
|
161662
161657
|
if (!entrypointPath.endsWith(".py")) {
|
161663
161658
|
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
|
161664
161659
|
}
|
@@ -161677,7 +161672,7 @@ __name(withSourceURLs, "withSourceURLs");
|
|
161677
161672
|
|
161678
161673
|
// src/https-options.ts
|
161679
161674
|
init_import_meta_url();
|
161680
|
-
var
|
161675
|
+
var fs10 = __toESM(require("node:fs"));
|
161681
161676
|
var path22 = __toESM(require("node:path"));
|
161682
161677
|
var import_miniflare4 = require("miniflare");
|
161683
161678
|
var CERT_EXPIRY_DAYS = 30;
|
@@ -161689,12 +161684,12 @@ function getHttpsOptions(customHttpsKeyPath, customHttpsCertPath) {
|
|
161689
161684
|
"Must specify both certificate path and key path to use a Custom Certificate."
|
161690
161685
|
);
|
161691
161686
|
}
|
161692
|
-
if (!
|
161687
|
+
if (!fs10.existsSync(customHttpsKeyPath)) {
|
161693
161688
|
throw new UserError(
|
161694
161689
|
"Missing Custom Certificate Key at " + customHttpsKeyPath
|
161695
161690
|
);
|
161696
161691
|
}
|
161697
|
-
if (!
|
161692
|
+
if (!fs10.existsSync(customHttpsCertPath)) {
|
161698
161693
|
throw new UserError(
|
161699
161694
|
"Missing Custom Certificate File at " + customHttpsCertPath
|
161700
161695
|
);
|
@@ -161704,21 +161699,21 @@ function getHttpsOptions(customHttpsKeyPath, customHttpsCertPath) {
|
|
161704
161699
|
}
|
161705
161700
|
logger.log("Using custom certificate at ", customHttpsKeyPath);
|
161706
161701
|
return {
|
161707
|
-
key:
|
161708
|
-
cert:
|
161702
|
+
key: fs10.readFileSync(customHttpsKeyPath, "utf8"),
|
161703
|
+
cert: fs10.readFileSync(customHttpsCertPath, "utf8")
|
161709
161704
|
};
|
161710
161705
|
}
|
161711
161706
|
const certDirectory = path22.join(getGlobalWranglerConfigPath(), "local-cert");
|
161712
161707
|
const keyPath = path22.join(certDirectory, "key.pem");
|
161713
161708
|
const certPath = path22.join(certDirectory, "cert.pem");
|
161714
|
-
const regenerate = !
|
161709
|
+
const regenerate = !fs10.existsSync(keyPath) || !fs10.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
|
161715
161710
|
if (regenerate) {
|
161716
161711
|
logger.log("Generating new self-signed certificate...");
|
161717
161712
|
const { key, cert } = generateCertificate();
|
161718
161713
|
try {
|
161719
|
-
|
161720
|
-
|
161721
|
-
|
161714
|
+
fs10.mkdirSync(certDirectory, { recursive: true });
|
161715
|
+
fs10.writeFileSync(keyPath, key, "utf8");
|
161716
|
+
fs10.writeFileSync(certPath, cert, "utf8");
|
161722
161717
|
} catch (e3) {
|
161723
161718
|
const message = e3 instanceof Error ? e3.message : `${e3}`;
|
161724
161719
|
logger.warn(
|
@@ -161732,15 +161727,15 @@ ${message}`
|
|
161732
161727
|
return { key, cert };
|
161733
161728
|
} else {
|
161734
161729
|
return {
|
161735
|
-
key:
|
161736
|
-
cert:
|
161730
|
+
key: fs10.readFileSync(keyPath, "utf8"),
|
161731
|
+
cert: fs10.readFileSync(certPath, "utf8")
|
161737
161732
|
};
|
161738
161733
|
}
|
161739
161734
|
}
|
161740
161735
|
__name(getHttpsOptions, "getHttpsOptions");
|
161741
161736
|
function hasCertificateExpired(keyPath, certPath) {
|
161742
|
-
const keyStat =
|
161743
|
-
const certStat =
|
161737
|
+
const keyStat = fs10.statSync(keyPath);
|
161738
|
+
const certStat = fs10.statSync(certPath);
|
161744
161739
|
const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
|
161745
161740
|
return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
|
161746
161741
|
}
|
@@ -162000,13 +161995,17 @@ async function getEntrypointNames(entrypointSource) {
|
|
162000
161995
|
}
|
162001
161996
|
__name(getEntrypointNames, "getEntrypointNames");
|
162002
161997
|
async function buildSourceOptions(config) {
|
162003
|
-
const scriptPath3 =
|
161998
|
+
const scriptPath3 = config.bundle.path;
|
162004
161999
|
if (config.format === "modules") {
|
162005
162000
|
const isPython = config.bundle.type === "python";
|
162006
162001
|
const { entrypointSource, modules } = isPython ? {
|
162007
|
-
entrypointSource:
|
162002
|
+
entrypointSource: config.bundle.entrypointSource,
|
162008
162003
|
modules: config.bundle.modules
|
162009
|
-
} : withSourceURLs(
|
162004
|
+
} : withSourceURLs(
|
162005
|
+
scriptPath3,
|
162006
|
+
config.bundle.entrypointSource,
|
162007
|
+
config.bundle.modules
|
162008
|
+
);
|
162010
162009
|
const entrypointNames = isPython ? [] : await getEntrypointNames(entrypointSource);
|
162011
162010
|
const modulesRoot = import_node_path19.default.dirname(scriptPath3);
|
162012
162011
|
const sourceOptions = {
|
@@ -162028,7 +162027,10 @@ async function buildSourceOptions(config) {
|
|
162028
162027
|
};
|
162029
162028
|
return { sourceOptions, entrypointNames };
|
162030
162029
|
} else {
|
162031
|
-
return {
|
162030
|
+
return {
|
162031
|
+
sourceOptions: { script: config.bundle.entrypointSource, scriptPath: scriptPath3 },
|
162032
|
+
entrypointNames: []
|
162033
|
+
};
|
162032
162034
|
}
|
162033
162035
|
}
|
162034
162036
|
__name(buildSourceOptions, "buildSourceOptions");
|
@@ -162076,7 +162078,7 @@ function buildMiniflareBindingOptions(config) {
|
|
162076
162078
|
const dataBlobBindings = { ...bindings.data_blobs };
|
162077
162079
|
const wasmBindings = { ...bindings.wasm_modules };
|
162078
162080
|
if (config.format === "service-worker" && config.bundle) {
|
162079
|
-
const scriptPath3 =
|
162081
|
+
const scriptPath3 = config.bundle.path;
|
162080
162082
|
const modulesRoot = import_node_path19.default.dirname(scriptPath3);
|
162081
162083
|
for (const { type, name } of config.bundle.modules) {
|
162082
162084
|
if (type === "text") {
|
@@ -162524,7 +162526,6 @@ async function localPropsToConfigBundle(props) {
|
|
162524
162526
|
compatibilityDate: props.compatibilityDate,
|
162525
162527
|
compatibilityFlags: props.compatibilityFlags,
|
162526
162528
|
inspectorPort: props.runtimeInspectorPort,
|
162527
|
-
usageModel: props.usageModel,
|
162528
162529
|
bindings: props.bindings,
|
162529
162530
|
workerDefinitions: props.workerDefinitions,
|
162530
162531
|
assetPaths: props.assetPaths,
|
@@ -162687,7 +162688,7 @@ var import_react16 = __toESM(require_react());
|
|
162687
162688
|
// src/deploy/deploy.ts
|
162688
162689
|
init_import_meta_url();
|
162689
162690
|
var import_node_assert17 = __toESM(require("node:assert"));
|
162690
|
-
var
|
162691
|
+
var import_node_fs32 = require("node:fs");
|
162691
162692
|
var import_node_path53 = __toESM(require("node:path"));
|
162692
162693
|
var import_node_url15 = require("node:url");
|
162693
162694
|
|
@@ -162744,19 +162745,19 @@ __name(printOffendingDependencies, "printOffendingDependencies");
|
|
162744
162745
|
// src/deployment-bundle/create-worker-upload-form.ts
|
162745
162746
|
init_import_meta_url();
|
162746
162747
|
var import_node_assert11 = __toESM(require("node:assert"));
|
162747
|
-
var
|
162748
|
+
var import_node_fs13 = require("node:fs");
|
162748
162749
|
var import_node_path24 = __toESM(require("node:path"));
|
162749
162750
|
var import_undici6 = __toESM(require_undici());
|
162750
162751
|
|
162751
162752
|
// src/deployment-bundle/capnp.ts
|
162752
162753
|
init_import_meta_url();
|
162753
162754
|
var import_node_child_process2 = require("node:child_process");
|
162754
|
-
var
|
162755
|
+
var import_node_fs12 = require("node:fs");
|
162755
162756
|
var import_node_path23 = require("node:path");
|
162756
162757
|
var import_command_exists = __toESM(require_command_exists2());
|
162757
162758
|
function handleUnsafeCapnp(capnp) {
|
162758
162759
|
if (capnp.compiled_schema) {
|
162759
|
-
return (0,
|
162760
|
+
return (0, import_node_fs12.readFileSync)((0, import_node_path23.resolve)(capnp.compiled_schema));
|
162760
162761
|
}
|
162761
162762
|
const { base_path, source_schemas } = capnp;
|
162762
162763
|
const capnpSchemas = (source_schemas ?? []).map(
|
@@ -162956,7 +162957,7 @@ function createWorkerUploadForm(worker) {
|
|
162956
162957
|
destination
|
162957
162958
|
});
|
162958
162959
|
});
|
162959
|
-
for (const [name,
|
162960
|
+
for (const [name, source] of Object.entries(bindings.wasm_modules || {})) {
|
162960
162961
|
metadataBindings.push({
|
162961
162962
|
name,
|
162962
162963
|
type: "wasm_module",
|
@@ -162964,9 +162965,13 @@ function createWorkerUploadForm(worker) {
|
|
162964
162965
|
});
|
162965
162966
|
formData.set(
|
162966
162967
|
name,
|
162967
|
-
new import_undici6.File(
|
162968
|
-
|
162969
|
-
|
162968
|
+
new import_undici6.File(
|
162969
|
+
[typeof source === "string" ? (0, import_node_fs13.readFileSync)(source) : source],
|
162970
|
+
typeof source === "string" ? source : name,
|
162971
|
+
{
|
162972
|
+
type: "application/wasm"
|
162973
|
+
}
|
162974
|
+
)
|
162970
162975
|
);
|
162971
162976
|
}
|
162972
162977
|
if (bindings.browser !== void 0) {
|
@@ -162997,13 +163002,13 @@ function createWorkerUploadForm(worker) {
|
|
162997
163002
|
if (name !== "__STATIC_CONTENT_MANIFEST") {
|
162998
163003
|
formData.set(
|
162999
163004
|
name,
|
163000
|
-
new import_undici6.File([(0,
|
163005
|
+
new import_undici6.File([(0, import_node_fs13.readFileSync)(filePath)], filePath, {
|
163001
163006
|
type: "text/plain"
|
163002
163007
|
})
|
163003
163008
|
);
|
163004
163009
|
}
|
163005
163010
|
}
|
163006
|
-
for (const [name,
|
163011
|
+
for (const [name, source] of Object.entries(bindings.data_blobs || {})) {
|
163007
163012
|
metadataBindings.push({
|
163008
163013
|
name,
|
163009
163014
|
type: "data_blob",
|
@@ -163011,9 +163016,13 @@ function createWorkerUploadForm(worker) {
|
|
163011
163016
|
});
|
163012
163017
|
formData.set(
|
163013
163018
|
name,
|
163014
|
-
new import_undici6.File(
|
163015
|
-
|
163016
|
-
|
163019
|
+
new import_undici6.File(
|
163020
|
+
[typeof source === "string" ? (0, import_node_fs13.readFileSync)(source) : source],
|
163021
|
+
typeof source === "string" ? source : name,
|
163022
|
+
{
|
163023
|
+
type: "application/octet-stream"
|
163024
|
+
}
|
163025
|
+
)
|
163017
163026
|
);
|
163018
163027
|
}
|
163019
163028
|
const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
|
@@ -163135,7 +163144,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
163135
163144
|
|
163136
163145
|
// src/deployment-bundle/source-maps.ts
|
163137
163146
|
init_import_meta_url();
|
163138
|
-
var
|
163147
|
+
var import_node_fs14 = __toESM(require("node:fs"));
|
163139
163148
|
var import_node_path25 = __toESM(require("node:path"));
|
163140
163149
|
function loadSourceMaps(main2, modules, bundle) {
|
163141
163150
|
const { sourceMapPath, sourceMapMetadata } = bundle;
|
@@ -163151,7 +163160,7 @@ function loadSourceMap({ name, filePath }, sourceMapPath, { entryDirectory }) {
|
|
163151
163160
|
return [];
|
163152
163161
|
}
|
163153
163162
|
const map = JSON.parse(
|
163154
|
-
|
163163
|
+
import_node_fs14.default.readFileSync(import_node_path25.default.join(entryDirectory, sourceMapPath), "utf8")
|
163155
163164
|
);
|
163156
163165
|
map.file = name;
|
163157
163166
|
if (map.sourceRoot) {
|
@@ -163187,13 +163196,13 @@ function scanSourceMaps(modules) {
|
|
163187
163196
|
);
|
163188
163197
|
}
|
163189
163198
|
const wranglerPath = import_node_path25.default.join(import_node_path25.default.dirname(module3.filePath), commentPath);
|
163190
|
-
if (!
|
163199
|
+
if (!import_node_fs14.default.existsSync(wranglerPath)) {
|
163191
163200
|
throw new Error(
|
163192
163201
|
`Invalid source map path in ${module3.filePath}: ${wranglerPath} does not exist.`
|
163193
163202
|
);
|
163194
163203
|
}
|
163195
163204
|
const map = JSON.parse(
|
163196
|
-
|
163205
|
+
import_node_fs14.default.readFileSync(wranglerPath, "utf8")
|
163197
163206
|
);
|
163198
163207
|
map.file = module3.name;
|
163199
163208
|
if (map.sourceRoot) {
|
@@ -163233,7 +163242,7 @@ var import_undici23 = __toESM(require_undici());
|
|
163233
163242
|
|
163234
163243
|
// src/init.ts
|
163235
163244
|
init_import_meta_url();
|
163236
|
-
var
|
163245
|
+
var fs25 = __toESM(require("node:fs"));
|
163237
163246
|
var import_promises20 = require("node:fs/promises");
|
163238
163247
|
var import_node_path52 = __toESM(require("node:path"));
|
163239
163248
|
var import_toml7 = __toESM(require_toml());
|
@@ -163241,7 +163250,7 @@ init_execa();
|
|
163241
163250
|
|
163242
163251
|
// src/git-client.ts
|
163243
163252
|
init_import_meta_url();
|
163244
|
-
var
|
163253
|
+
var import_node_fs15 = __toESM(require("node:fs"));
|
163245
163254
|
var import_node_os7 = __toESM(require("node:os"));
|
163246
163255
|
var import_node_path26 = __toESM(require("node:path"));
|
163247
163256
|
init_execa();
|
@@ -163313,7 +163322,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163313
163322
|
args.push("-b", remote.substring(tagIndex + 1));
|
163314
163323
|
args.push(remote.substring(0, tagIndex));
|
163315
163324
|
}
|
163316
|
-
const tempDir =
|
163325
|
+
const tempDir = import_node_fs15.default.mkdtempSync(
|
163317
163326
|
import_node_path26.default.join(import_node_os7.default.tmpdir(), `wrangler-generate-repo-`)
|
163318
163327
|
);
|
163319
163328
|
args.push(tempDir);
|
@@ -163325,15 +163334,15 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163325
163334
|
}
|
163326
163335
|
const templatePath = subdirectory !== void 0 ? import_node_path26.default.join(tempDir, subdirectory) : tempDir;
|
163327
163336
|
try {
|
163328
|
-
|
163337
|
+
import_node_fs15.default.renameSync(templatePath, targetDirectory);
|
163329
163338
|
} catch (err) {
|
163330
163339
|
if (err.code !== "EXDEV") {
|
163331
163340
|
logger.debug(err);
|
163332
163341
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
163333
163342
|
}
|
163334
163343
|
try {
|
163335
|
-
|
163336
|
-
|
163344
|
+
import_node_fs15.default.cpSync(templatePath, targetDirectory, { recursive: true });
|
163345
|
+
import_node_fs15.default.rmSync(templatePath, {
|
163337
163346
|
recursive: true,
|
163338
163347
|
force: true
|
163339
163348
|
});
|
@@ -163342,7 +163351,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163342
163351
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
163343
163352
|
}
|
163344
163353
|
}
|
163345
|
-
|
163354
|
+
import_node_fs15.default.rmSync(import_node_path26.default.join(targetDirectory, ".git"), {
|
163346
163355
|
recursive: true,
|
163347
163356
|
force: true
|
163348
163357
|
});
|
@@ -163351,7 +163360,7 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
|
|
163351
163360
|
|
163352
163361
|
// src/package-manager.ts
|
163353
163362
|
init_import_meta_url();
|
163354
|
-
var
|
163363
|
+
var import_node_fs16 = require("node:fs");
|
163355
163364
|
var import_node_path27 = require("node:path");
|
163356
163365
|
var import_node_process6 = require("node:process");
|
163357
163366
|
init_execa();
|
@@ -163361,9 +163370,9 @@ async function getPackageManager2(cwd2) {
|
|
163361
163370
|
supportsNpm(),
|
163362
163371
|
supportsPnpm()
|
163363
163372
|
]);
|
163364
|
-
const hasYarnLock = (0,
|
163365
|
-
const hasNpmLock = (0,
|
163366
|
-
const hasPnpmLock = (0,
|
163373
|
+
const hasYarnLock = (0, import_node_fs16.existsSync)((0, import_node_path27.join)(cwd2, "yarn.lock"));
|
163374
|
+
const hasNpmLock = (0, import_node_fs16.existsSync)((0, import_node_path27.join)(cwd2, "package-lock.json"));
|
163375
|
+
const hasPnpmLock = (0, import_node_fs16.existsSync)((0, import_node_path27.join)(cwd2, "pnpm-lock.yaml"));
|
163367
163376
|
const userAgent = sniffUserAgent();
|
163368
163377
|
if (hasNpmLock) {
|
163369
163378
|
if (hasNpm) {
|
@@ -172168,7 +172177,7 @@ var handler11 = withConfig(
|
|
172168
172177
|
|
172169
172178
|
// src/constellation/uploadModel.tsx
|
172170
172179
|
init_import_meta_url();
|
172171
|
-
var
|
172180
|
+
var import_node_fs17 = require("node:fs");
|
172172
172181
|
var import_undici9 = __toESM(require_undici());
|
172173
172182
|
function options11(yargs) {
|
172174
172183
|
return yargs.positional("projectName", {
|
@@ -172205,7 +172214,7 @@ var handler12 = withConfig(
|
|
172205
172214
|
const formData = new import_undici9.FormData();
|
172206
172215
|
formData.set(
|
172207
172216
|
"file",
|
172208
|
-
new import_undici9.File([(0,
|
172217
|
+
new import_undici9.File([(0, import_node_fs17.readFileSync)(modelFile)], modelFile, {
|
172209
172218
|
type: "application/octet-stream"
|
172210
172219
|
})
|
172211
172220
|
);
|
@@ -176607,7 +176616,7 @@ init_import_meta_url();
|
|
176607
176616
|
// src/d1/migrations/apply.tsx
|
176608
176617
|
init_import_meta_url();
|
176609
176618
|
var import_node_assert13 = __toESM(require("node:assert"));
|
176610
|
-
var
|
176619
|
+
var import_node_fs19 = __toESM(require("node:fs"));
|
176611
176620
|
var import_path9 = __toESM(require("path"));
|
176612
176621
|
var import_ink4 = __toESM(require_build2());
|
176613
176622
|
var import_ink_table5 = __toESM(require_dist4());
|
@@ -176615,7 +176624,7 @@ var import_react7 = __toESM(require_react());
|
|
176615
176624
|
|
176616
176625
|
// src/d1/migrations/helpers.ts
|
176617
176626
|
init_import_meta_url();
|
176618
|
-
var
|
176627
|
+
var import_node_fs18 = __toESM(require("node:fs"));
|
176619
176628
|
var import_path8 = __toESM(require("path"));
|
176620
176629
|
async function getMigrationsPath({
|
176621
176630
|
projectPath,
|
@@ -176623,13 +176632,13 @@ async function getMigrationsPath({
|
|
176623
176632
|
createIfMissing
|
176624
176633
|
}) {
|
176625
176634
|
const dir = import_path8.default.resolve(projectPath, migrationsFolderPath);
|
176626
|
-
if (
|
176635
|
+
if (import_node_fs18.default.existsSync(dir)) {
|
176627
176636
|
return dir;
|
176628
176637
|
}
|
176629
176638
|
const warning = `No migrations folder found.${migrationsFolderPath === DEFAULT_MIGRATION_PATH ? " Set `migrations_dir` in wrangler.toml to choose a different path." : ""}`;
|
176630
176639
|
if (createIfMissing && await confirm(`${warning}
|
176631
176640
|
Ok to create ${dir}?`)) {
|
176632
|
-
|
176641
|
+
import_node_fs18.default.mkdirSync(dir, { recursive: true });
|
176633
176642
|
return dir;
|
176634
176643
|
} else {
|
176635
176644
|
logger.warn(warning);
|
@@ -176698,7 +176707,7 @@ var listAppliedMigrations = /* @__PURE__ */ __name(async ({
|
|
176698
176707
|
}, "listAppliedMigrations");
|
176699
176708
|
function getMigrationNames(migrationsPath) {
|
176700
176709
|
const migrations = [];
|
176701
|
-
const dir =
|
176710
|
+
const dir = import_node_fs18.default.opendirSync(migrationsPath);
|
176702
176711
|
let dirent;
|
176703
176712
|
while ((dirent = dir.readSync()) !== null) {
|
176704
176713
|
if (dirent.name.endsWith(".sql")) {
|
@@ -176862,7 +176871,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
176862
176871
|
}
|
176863
176872
|
}
|
176864
176873
|
for (const migration of unappliedMigrations) {
|
176865
|
-
let query =
|
176874
|
+
let query = import_node_fs19.default.readFileSync(
|
176866
176875
|
`${migrationsPath}/${migration.name}`,
|
176867
176876
|
"utf8"
|
176868
176877
|
);
|
@@ -176928,7 +176937,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
176928
176937
|
|
176929
176938
|
// src/d1/migrations/create.tsx
|
176930
176939
|
init_import_meta_url();
|
176931
|
-
var
|
176940
|
+
var import_node_fs20 = __toESM(require("node:fs"));
|
176932
176941
|
var import_path10 = __toESM(require("path"));
|
176933
176942
|
var import_ink5 = __toESM(require_build2());
|
176934
176943
|
var import_react8 = __toESM(require_react());
|
@@ -176960,7 +176969,7 @@ var CreateHandler2 = withConfig(
|
|
176960
176969
|
const nextMigrationNumber = pad(getNextMigrationNumber(migrationsPath), 4);
|
176961
176970
|
const migrationName = message.replaceAll(" ", "_");
|
176962
176971
|
const newMigrationName = `${nextMigrationNumber}_${migrationName}.sql`;
|
176963
|
-
|
176972
|
+
import_node_fs20.default.writeFileSync(
|
176964
176973
|
`${migrationsPath}/${newMigrationName}`,
|
176965
176974
|
`-- Migration number: ${nextMigrationNumber} ${(/* @__PURE__ */ new Date()).toISOString()}
|
176966
176975
|
`
|
@@ -177616,7 +177625,7 @@ var import_undici13 = __toESM(require_undici());
|
|
177616
177625
|
// src/metrics/metrics-config.ts
|
177617
177626
|
init_import_meta_url();
|
177618
177627
|
var import_node_crypto5 = require("node:crypto");
|
177619
|
-
var
|
177628
|
+
var import_node_fs21 = require("node:fs");
|
177620
177629
|
var import_node_path30 = __toESM(require("node:path"));
|
177621
177630
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
177622
177631
|
var USER_ID_CACHE_PATH = "user-id.json";
|
@@ -177679,8 +177688,8 @@ async function getMetricsConfig({
|
|
177679
177688
|
}
|
177680
177689
|
__name(getMetricsConfig, "getMetricsConfig");
|
177681
177690
|
function writeMetricsConfig(config) {
|
177682
|
-
(0,
|
177683
|
-
(0,
|
177691
|
+
(0, import_node_fs21.mkdirSync)(import_node_path30.default.dirname(getMetricsConfigPath()), { recursive: true });
|
177692
|
+
(0, import_node_fs21.writeFileSync)(
|
177684
177693
|
getMetricsConfigPath(),
|
177685
177694
|
JSON.stringify(
|
177686
177695
|
config,
|
@@ -177692,7 +177701,7 @@ function writeMetricsConfig(config) {
|
|
177692
177701
|
__name(writeMetricsConfig, "writeMetricsConfig");
|
177693
177702
|
function readMetricsConfig() {
|
177694
177703
|
try {
|
177695
|
-
const config = (0,
|
177704
|
+
const config = (0, import_node_fs21.readFileSync)(getMetricsConfigPath(), "utf8");
|
177696
177705
|
return JSON.parse(
|
177697
177706
|
config,
|
177698
177707
|
(key, value) => key === "date" ? new Date(value) : value
|
@@ -178975,7 +178984,7 @@ __name(docsHandler, "docsHandler");
|
|
178975
178984
|
|
178976
178985
|
// src/generate/index.ts
|
178977
178986
|
init_import_meta_url();
|
178978
|
-
var
|
178987
|
+
var import_node_fs22 = __toESM(require("node:fs"));
|
178979
178988
|
var import_node_path32 = __toESM(require("node:path"));
|
178980
178989
|
function generateOptions(yargs) {
|
178981
178990
|
return yargs.positional("name", {
|
@@ -179058,7 +179067,7 @@ __name(generateHandler2, "generateHandler");
|
|
179058
179067
|
function generateWorkerDirectoryName(workerName) {
|
179059
179068
|
let workerDirectoryPath = import_node_path32.default.resolve(process.cwd(), workerName);
|
179060
179069
|
let i = 1;
|
179061
|
-
while (
|
179070
|
+
while (import_node_fs22.default.existsSync(workerDirectoryPath)) {
|
179062
179071
|
workerDirectoryPath = import_node_path32.default.resolve(process.cwd(), `${workerName}-${i}`);
|
179063
179072
|
i++;
|
179064
179073
|
}
|
@@ -180225,13 +180234,13 @@ init_import_meta_url();
|
|
180225
180234
|
// src/pages/build.ts
|
180226
180235
|
init_import_meta_url();
|
180227
180236
|
var import_node_crypto6 = require("node:crypto");
|
180228
|
-
var
|
180237
|
+
var import_node_fs25 = require("node:fs");
|
180229
180238
|
var import_promises13 = require("node:fs/promises");
|
180230
180239
|
var import_node_path41 = __toESM(require("node:path"));
|
180231
180240
|
|
180232
180241
|
// src/api/pages/create-worker-bundle-contents.ts
|
180233
180242
|
init_import_meta_url();
|
180234
|
-
var
|
180243
|
+
var import_node_fs23 = require("node:fs");
|
180235
180244
|
var import_node_path33 = __toESM(require("node:path"));
|
180236
180245
|
var import_undici15 = __toESM(require_undici());
|
180237
180246
|
async function createUploadWorkerBundleContents(workerBundle, config) {
|
@@ -180248,7 +180257,7 @@ function createWorkerBundleFormData(workerBundle, config) {
|
|
180248
180257
|
const mainModule = {
|
180249
180258
|
name: import_node_path33.default.basename(workerBundle.resolvedEntryPointPath),
|
180250
180259
|
filePath: workerBundle.resolvedEntryPointPath,
|
180251
|
-
content: (0,
|
180260
|
+
content: (0, import_node_fs23.readFileSync)(workerBundle.resolvedEntryPointPath, {
|
180252
180261
|
encoding: "utf-8"
|
180253
180262
|
}),
|
180254
180263
|
type: workerBundle.bundleType || "esm"
|
@@ -180303,7 +180312,7 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
|
|
180303
180312
|
|
180304
180313
|
// src/pages/buildFunctions.ts
|
180305
180314
|
init_import_meta_url();
|
180306
|
-
var
|
180315
|
+
var import_node_fs24 = require("node:fs");
|
180307
180316
|
var import_node_path40 = require("node:path");
|
180308
180317
|
|
180309
180318
|
// src/pages/functions/buildPlugin.ts
|
@@ -181288,10 +181297,10 @@ async function buildFunctions({
|
|
181288
181297
|
}
|
181289
181298
|
if (routesOutputPath) {
|
181290
181299
|
const routesJSON = convertRoutesToRoutesJSONSpec(config.routes);
|
181291
|
-
(0,
|
181300
|
+
(0, import_node_fs24.writeFileSync)(routesOutputPath, JSON.stringify(routesJSON, null, 2));
|
181292
181301
|
}
|
181293
181302
|
if (outputConfigPath) {
|
181294
|
-
(0,
|
181303
|
+
(0, import_node_fs24.writeFileSync)(
|
181295
181304
|
outputConfigPath,
|
181296
181305
|
JSON.stringify({ ...config, baseURL }, null, 2)
|
181297
181306
|
);
|
@@ -181489,7 +181498,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181489
181498
|
}
|
181490
181499
|
}
|
181491
181500
|
if (outfile && outfile !== bundle.resolvedEntryPointPath) {
|
181492
|
-
(0,
|
181501
|
+
(0, import_node_fs25.writeFileSync)(
|
181493
181502
|
outfile,
|
181494
181503
|
`export { default } from './${(0, import_node_path41.relative)(
|
181495
181504
|
(0, import_node_path41.dirname)(outfile),
|
@@ -181520,7 +181529,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181520
181529
|
external
|
181521
181530
|
} = validatedArgs;
|
181522
181531
|
if (workerScriptPath) {
|
181523
|
-
if ((0,
|
181532
|
+
if ((0, import_node_fs25.lstatSync)(workerScriptPath).isDirectory()) {
|
181524
181533
|
bundle = await produceWorkerBundleForWorkerJSDirectory({
|
181525
181534
|
workerJSDirectory: workerScriptPath,
|
181526
181535
|
bundle: true,
|
@@ -181579,14 +181588,14 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181579
181588
|
bundle,
|
181580
181589
|
config
|
181581
181590
|
);
|
181582
|
-
(0,
|
181583
|
-
(0,
|
181591
|
+
(0, import_node_fs25.mkdirSync)((0, import_node_path41.dirname)(outfile), { recursive: true });
|
181592
|
+
(0, import_node_fs25.writeFileSync)(
|
181584
181593
|
outfile,
|
181585
181594
|
Buffer.from(await workerBundleContents.arrayBuffer())
|
181586
181595
|
);
|
181587
181596
|
}
|
181588
181597
|
if (buildMetadataPath && buildMetadata) {
|
181589
|
-
(0,
|
181598
|
+
(0, import_node_fs25.writeFileSync)(buildMetadataPath, JSON.stringify(buildMetadata));
|
181590
181599
|
}
|
181591
181600
|
}
|
181592
181601
|
await sendMetricsEvent("build pages functions");
|
@@ -181596,7 +181605,7 @@ async function maybeReadPagesConfig(args) {
|
|
181596
181605
|
return;
|
181597
181606
|
}
|
181598
181607
|
const configPath = import_node_path41.default.resolve(args.projectDirectory, "wrangler.toml");
|
181599
|
-
if (!(0,
|
181608
|
+
if (!(0, import_node_fs25.existsSync)(configPath)) {
|
181600
181609
|
return void 0;
|
181601
181610
|
}
|
181602
181611
|
try {
|
@@ -181689,10 +181698,10 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
181689
181698
|
args.buildOutputDirectory,
|
181690
181699
|
"_worker.js"
|
181691
181700
|
);
|
181692
|
-
const foundWorkerScript = (0,
|
181701
|
+
const foundWorkerScript = (0, import_node_fs25.existsSync)(prospectiveWorkerScriptPath);
|
181693
181702
|
if (foundWorkerScript) {
|
181694
181703
|
workerScriptPath = prospectiveWorkerScriptPath;
|
181695
|
-
} else if (!foundWorkerScript && !(0,
|
181704
|
+
} else if (!foundWorkerScript && !(0, import_node_fs25.existsSync)(args.directory)) {
|
181696
181705
|
throw new FatalError(
|
181697
181706
|
`Could not find anything to build.
|
181698
181707
|
We first looked inside the build output directory (${(0, import_node_path41.basename)(
|
@@ -181705,7 +181714,7 @@ We first looked inside the build output directory (${(0, import_node_path41.base
|
|
181705
181714
|
EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR
|
181706
181715
|
);
|
181707
181716
|
}
|
181708
|
-
} else if (!(0,
|
181717
|
+
} else if (!(0, import_node_fs25.existsSync)(args.directory)) {
|
181709
181718
|
throw new FatalError(
|
181710
181719
|
`Could not find anything to build.
|
181711
181720
|
We looked for the Functions directory (${(0, import_node_path41.basename)(
|
@@ -181734,7 +181743,7 @@ We looked for the Functions directory (${(0, import_node_path41.basename)(
|
|
181734
181743
|
|
181735
181744
|
// src/pages/build-env.ts
|
181736
181745
|
init_import_meta_url();
|
181737
|
-
var
|
181746
|
+
var import_node_fs26 = require("node:fs");
|
181738
181747
|
var import_node_path42 = __toESM(require("node:path"));
|
181739
181748
|
function Options9(yargs) {
|
181740
181749
|
return yargs.positional("projectDir", {
|
@@ -181759,7 +181768,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
181759
181768
|
"Checking for configuration in a wrangler.toml configuration file (BETA)\n"
|
181760
181769
|
);
|
181761
181770
|
const configPath = import_node_path42.default.resolve(args.projectDir, "wrangler.toml");
|
181762
|
-
if (!(0,
|
181771
|
+
if (!(0, import_node_fs26.existsSync)(configPath)) {
|
181763
181772
|
logger.debug("No wrangler.toml configuration file found. Exiting.");
|
181764
181773
|
process.exitCode = EXIT_CODE_NO_CONFIG_FOUND;
|
181765
181774
|
return;
|
@@ -181794,7 +181803,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
181794
181803
|
config.pages_build_output_dir
|
181795
181804
|
)
|
181796
181805
|
};
|
181797
|
-
(0,
|
181806
|
+
(0, import_node_fs26.writeFileSync)(args.outfile, JSON.stringify(buildConfiguration));
|
181798
181807
|
logger.debug(`Build configuration written to ${args.outfile}`);
|
181799
181808
|
logger.debug(JSON.stringify(buildConfiguration), null, 2);
|
181800
181809
|
const vars = Object.entries(buildConfiguration.vars);
|
@@ -181818,7 +181827,7 @@ var import_react13 = __toESM(require_react());
|
|
181818
181827
|
// src/api/pages/deploy.tsx
|
181819
181828
|
init_import_meta_url();
|
181820
181829
|
var import_node_crypto7 = require("node:crypto");
|
181821
|
-
var
|
181830
|
+
var import_node_fs27 = require("node:fs");
|
181822
181831
|
var import_promises16 = require("node:fs/promises");
|
181823
181832
|
var import_node_path45 = __toESM(require("node:path"));
|
181824
181833
|
var import_node_process11 = require("node:process");
|
@@ -182704,21 +182713,21 @@ async function deploy2({
|
|
182704
182713
|
bundle = bundle ?? true;
|
182705
182714
|
const _workerPath = (0, import_node_path45.resolve)(directory, "_worker.js");
|
182706
182715
|
try {
|
182707
|
-
_headers = (0,
|
182716
|
+
_headers = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_headers"), "utf-8");
|
182708
182717
|
} catch {
|
182709
182718
|
}
|
182710
182719
|
try {
|
182711
|
-
_redirects = (0,
|
182720
|
+
_redirects = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_redirects"), "utf-8");
|
182712
182721
|
} catch {
|
182713
182722
|
}
|
182714
182723
|
try {
|
182715
|
-
_routesCustom = (0,
|
182724
|
+
_routesCustom = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_routes.json"), "utf-8");
|
182716
182725
|
} catch {
|
182717
182726
|
}
|
182718
182727
|
try {
|
182719
|
-
_workerJSIsDirectory = (0,
|
182728
|
+
_workerJSIsDirectory = (0, import_node_fs27.lstatSync)(_workerPath).isDirectory();
|
182720
182729
|
if (!_workerJSIsDirectory) {
|
182721
|
-
_workerJS = (0,
|
182730
|
+
_workerJS = (0, import_node_fs27.readFileSync)(_workerPath, "utf-8");
|
182722
182731
|
}
|
182723
182732
|
} catch {
|
182724
182733
|
}
|
@@ -182751,9 +182760,9 @@ async function deploy2({
|
|
182751
182760
|
let builtFunctions = void 0;
|
182752
182761
|
let workerBundle = void 0;
|
182753
182762
|
const functionsDirectory = customFunctionsDirectory || (0, import_node_path45.join)((0, import_node_process11.cwd)(), "functions");
|
182754
|
-
const routesOutputPath = !(0,
|
182763
|
+
const routesOutputPath = !(0, import_node_fs27.existsSync)((0, import_node_path45.join)(directory, "_routes.json")) ? (0, import_node_path45.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
|
182755
182764
|
let filepathRoutingConfig;
|
182756
|
-
if (!_workerJS && (0,
|
182765
|
+
if (!_workerJS && (0, import_node_fs27.existsSync)(functionsDirectory)) {
|
182757
182766
|
const outputConfigPath = (0, import_node_path45.join)(
|
182758
182767
|
getPagesTmpDir(),
|
182759
182768
|
`functions-filepath-routing-config-${Math.random()}.json`
|
@@ -182770,11 +182779,11 @@ async function deploy2({
|
|
182770
182779
|
nodejsCompat,
|
182771
182780
|
defineNavigatorUserAgent
|
182772
182781
|
});
|
182773
|
-
builtFunctions = (0,
|
182782
|
+
builtFunctions = (0, import_node_fs27.readFileSync)(
|
182774
182783
|
workerBundle.resolvedEntryPointPath,
|
182775
182784
|
"utf-8"
|
182776
182785
|
);
|
182777
|
-
filepathRoutingConfig = (0,
|
182786
|
+
filepathRoutingConfig = (0, import_node_fs27.readFileSync)(outputConfigPath, "utf-8");
|
182778
182787
|
} catch (e3) {
|
182779
182788
|
if (e3 instanceof FunctionsNoRoutesError) {
|
182780
182789
|
logger.warn(
|
@@ -182922,7 +182931,7 @@ async function deploy2({
|
|
182922
182931
|
}
|
182923
182932
|
} else if (routesOutputPath) {
|
182924
182933
|
try {
|
182925
|
-
_routesGenerated = (0,
|
182934
|
+
_routesGenerated = (0, import_node_fs27.readFileSync)(routesOutputPath, "utf-8");
|
182926
182935
|
if (_routesGenerated) {
|
182927
182936
|
formData.append(
|
182928
182937
|
"_routes.json",
|
@@ -184171,7 +184180,7 @@ __name(ListHandler4, "ListHandler");
|
|
184171
184180
|
// src/pages/dev.ts
|
184172
184181
|
init_import_meta_url();
|
184173
184182
|
var import_node_child_process5 = require("node:child_process");
|
184174
|
-
var
|
184183
|
+
var import_node_fs28 = require("node:fs");
|
184175
184184
|
var import_node_path46 = require("node:path");
|
184176
184185
|
var import_chokidar2 = require("chokidar");
|
184177
184186
|
var esbuild3 = __toESM(require("esbuild"));
|
@@ -184443,11 +184452,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184443
184452
|
);
|
184444
184453
|
const singleWorkerScriptPath = args.scriptPath ?? DEFAULT_SCRIPT_PATH;
|
184445
184454
|
const workerScriptPath = directory !== void 0 ? (0, import_node_path46.join)(directory, singleWorkerScriptPath) : (0, import_node_path46.resolve)(singleWorkerScriptPath);
|
184446
|
-
const usingWorkerDirectory = (0,
|
184447
|
-
const usingWorkerScript = (0,
|
184455
|
+
const usingWorkerDirectory = (0, import_node_fs28.existsSync)(workerScriptPath) && (0, import_node_fs28.lstatSync)(workerScriptPath).isDirectory();
|
184456
|
+
const usingWorkerScript = (0, import_node_fs28.existsSync)(workerScriptPath);
|
184448
184457
|
const enableBundling = args.bundle ?? !args.noBundle;
|
184449
184458
|
const functionsDirectory = "./functions";
|
184450
|
-
let usingFunctions = !usingWorkerScript && (0,
|
184459
|
+
let usingFunctions = !usingWorkerScript && (0, import_node_fs28.existsSync)(functionsDirectory);
|
184451
184460
|
let scriptPath3 = "";
|
184452
184461
|
const legacyNodeCompat = args.nodeCompat;
|
184453
184462
|
const nodejsCompat = compatibilityFlags?.includes("nodejs_compat") ?? false;
|
@@ -184611,7 +184620,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184611
184620
|
let scriptEntrypoint = scriptPath3;
|
184612
184621
|
if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
|
184613
184622
|
const routesJSONPath = (0, import_node_path46.join)(directory, "_routes.json");
|
184614
|
-
if ((0,
|
184623
|
+
if ((0, import_node_fs28.existsSync)(routesJSONPath)) {
|
184615
184624
|
let routesJSONContents;
|
184616
184625
|
const runBuild = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
|
184617
184626
|
await esbuild3.build({
|
@@ -184637,7 +184646,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184637
184646
|
});
|
184638
184647
|
}, "runBuild");
|
184639
184648
|
try {
|
184640
|
-
routesJSONContents = (0,
|
184649
|
+
routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
|
184641
184650
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
184642
184651
|
scriptEntrypoint = (0, import_node_path46.join)(
|
184643
184652
|
getPagesTmpDir(),
|
@@ -184662,7 +184671,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184662
184671
|
if (event === "unlink") {
|
184663
184672
|
return;
|
184664
184673
|
}
|
184665
|
-
routesJSONContents = (0,
|
184674
|
+
routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
|
184666
184675
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
184667
184676
|
await runBuild(scriptPath3, scriptEntrypoint, routesJSONContents);
|
184668
184677
|
} catch (err) {
|
@@ -185156,7 +185165,7 @@ var Handler15 = /* @__PURE__ */ __name(async ({ projectName, force }) => {
|
|
185156
185165
|
|
185157
185166
|
// src/pages/functions.ts
|
185158
185167
|
init_import_meta_url();
|
185159
|
-
var
|
185168
|
+
var import_node_fs29 = require("node:fs");
|
185160
185169
|
var import_node_path47 = __toESM(require("node:path"));
|
185161
185170
|
function OptimizeRoutesOptions(yargs) {
|
185162
185171
|
return yargs.options({
|
@@ -185180,20 +185189,20 @@ async function OptimizeRoutesHandler({
|
|
185180
185189
|
}) {
|
185181
185190
|
let routesFileContents;
|
185182
185191
|
const routesOutputDirectory = import_node_path47.default.dirname(outputRoutesPath);
|
185183
|
-
if (!(0,
|
185192
|
+
if (!(0, import_node_fs29.existsSync)(routesPath)) {
|
185184
185193
|
throw new FatalError(
|
185185
185194
|
`Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
|
185186
185195
|
1
|
185187
185196
|
);
|
185188
185197
|
}
|
185189
|
-
if (!(0,
|
185198
|
+
if (!(0, import_node_fs29.existsSync)(routesOutputDirectory) || !(0, import_node_fs29.lstatSync)(routesOutputDirectory).isDirectory()) {
|
185190
185199
|
throw new FatalError(
|
185191
185200
|
`Oops! Folder ${routesOutputDirectory} does not exist. Please make sure --output-routes-path is a valid file path (for example "/public/_routes.json").`,
|
185192
185201
|
1
|
185193
185202
|
);
|
185194
185203
|
}
|
185195
185204
|
try {
|
185196
|
-
routesFileContents = (0,
|
185205
|
+
routesFileContents = (0, import_node_fs29.readFileSync)(routesPath, "utf-8");
|
185197
185206
|
} catch (err) {
|
185198
185207
|
throw new FatalError(`Error while reading ${routesPath} file: ${err}`);
|
185199
185208
|
}
|
@@ -185202,7 +185211,7 @@ async function OptimizeRoutesHandler({
|
|
185202
185211
|
const optimizedRoutes = optimizeRoutesJSONSpec(routes);
|
185203
185212
|
const optimizedRoutesContents = JSON.stringify(optimizedRoutes);
|
185204
185213
|
try {
|
185205
|
-
(0,
|
185214
|
+
(0, import_node_fs29.writeFileSync)(outputRoutesPath, optimizedRoutesContents);
|
185206
185215
|
} catch (err) {
|
185207
185216
|
throw new FatalError(
|
185208
185217
|
`Error writing to ${outputRoutesPath} file: ${err}`,
|
@@ -186860,7 +186869,7 @@ __name(queues, "queues");
|
|
186860
186869
|
// src/r2/index.ts
|
186861
186870
|
init_import_meta_url();
|
186862
186871
|
var import_node_buffer5 = require("node:buffer");
|
186863
|
-
var
|
186872
|
+
var fs23 = __toESM(require("node:fs"));
|
186864
186873
|
var path50 = __toESM(require("node:path"));
|
186865
186874
|
var stream = __toESM(require("node:stream"));
|
186866
186875
|
var import_web = require("node:stream/web");
|
@@ -187525,7 +187534,7 @@ __name(DisableHandler, "DisableHandler");
|
|
187525
187534
|
// src/r2/index.ts
|
187526
187535
|
var CHUNK_SIZE = 1024;
|
187527
187536
|
async function createFileReadableStream(filePath) {
|
187528
|
-
const handle = await
|
187537
|
+
const handle = await fs23.promises.open(filePath, "r");
|
187529
187538
|
let position = 0;
|
187530
187539
|
return new import_web.ReadableStream({
|
187531
187540
|
async pull(controller) {
|
@@ -187596,8 +187605,8 @@ function r22(r2Yargs) {
|
|
187596
187605
|
}
|
187597
187606
|
let output;
|
187598
187607
|
if (file) {
|
187599
|
-
|
187600
|
-
output =
|
187608
|
+
fs23.mkdirSync(path50.dirname(file), { recursive: true });
|
187609
|
+
output = fs23.createWriteStream(file);
|
187601
187610
|
} else {
|
187602
187611
|
output = process.stdout;
|
187603
187612
|
}
|
@@ -187720,7 +187729,7 @@ function r22(r2Yargs) {
|
|
187720
187729
|
let objectSize;
|
187721
187730
|
if (file) {
|
187722
187731
|
object = await createFileReadableStream(file);
|
187723
|
-
const stats =
|
187732
|
+
const stats = fs23.statSync(file);
|
187724
187733
|
objectSize = stats.size;
|
187725
187734
|
} else {
|
187726
187735
|
const buffer = await new Promise((resolve19, reject) => {
|
@@ -198230,7 +198239,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
198230
198239
|
|
198231
198240
|
// src/type-generation.ts
|
198232
198241
|
init_import_meta_url();
|
198233
|
-
var
|
198242
|
+
var fs24 = __toESM(require("node:fs"));
|
198234
198243
|
|
198235
198244
|
// src/dev/dev-vars.ts
|
198236
198245
|
init_import_meta_url();
|
@@ -198284,7 +198293,7 @@ async function typesHandler(args) {
|
|
198284
198293
|
}
|
198285
198294
|
await printWranglerBanner();
|
198286
198295
|
const configPath = args.config ?? findWranglerToml(process.cwd(), args.experimentalJsonConfig);
|
198287
|
-
if (!configPath || !
|
198296
|
+
if (!configPath || !fs24.existsSync(configPath) || fs24.statSync(configPath).isDirectory()) {
|
198288
198297
|
logger.warn(
|
198289
198298
|
`No config file detected${args.config ? ` (at ${args.config})` : ""}, aborting`
|
198290
198299
|
);
|
@@ -198482,7 +198491,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
198482
198491
|
);
|
198483
198492
|
}
|
198484
198493
|
if (configToDTS.ai) {
|
198485
|
-
envTypeStructure.push(constructType(configToDTS.ai.binding, "
|
198494
|
+
envTypeStructure.push(constructType(configToDTS.ai.binding, "Ai"));
|
198486
198495
|
}
|
198487
198496
|
if (configToDTS.version_metadata) {
|
198488
198497
|
envTypeStructure.push(
|
@@ -198526,7 +198535,7 @@ function writeDTSFile({
|
|
198526
198535
|
}) {
|
198527
198536
|
const wranglerOverrideDTSPath = findUpSync(path67);
|
198528
198537
|
try {
|
198529
|
-
if (wranglerOverrideDTSPath !== void 0 && !
|
198538
|
+
if (wranglerOverrideDTSPath !== void 0 && !fs24.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
198530
198539
|
throw new UserError(
|
198531
198540
|
`A non-wrangler ${path67} already exists, please rename and try again.`
|
198532
198541
|
);
|
@@ -198552,7 +198561,7 @@ ${modulesTypeStructure.join("\n")}`;
|
|
198552
198561
|
const wranglerCommandUsed = ["wrangler", ...process.argv.slice(2)].join(" ");
|
198553
198562
|
const typesHaveBeenFound = envTypeStructure.length || modulesTypeStructure.length;
|
198554
198563
|
if (formatType === "modules" || typesHaveBeenFound) {
|
198555
|
-
|
198564
|
+
fs24.writeFileSync(
|
198556
198565
|
path67,
|
198557
198566
|
[
|
198558
198567
|
`// Generated by Wrangler on ${/* @__PURE__ */ new Date()}`,
|
@@ -198801,7 +198810,7 @@ __name(handler27, "handler");
|
|
198801
198810
|
|
198802
198811
|
// src/vectorize/insert.ts
|
198803
198812
|
init_import_meta_url();
|
198804
|
-
var
|
198813
|
+
var import_node_fs30 = require("node:fs");
|
198805
198814
|
var import_node_readline4 = require("node:readline");
|
198806
198815
|
var import_undici21 = __toESM(require_undici());
|
198807
198816
|
var VECTORIZE_MAX_BATCH_SIZE = 1e3;
|
@@ -198833,7 +198842,7 @@ function options27(yargs) {
|
|
198833
198842
|
__name(options27, "options");
|
198834
198843
|
async function handler28(args) {
|
198835
198844
|
const config = readConfig(args.config, args);
|
198836
|
-
const rl = (0, import_node_readline4.createInterface)({ input: (0,
|
198845
|
+
const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs30.createReadStream)(args.file) });
|
198837
198846
|
if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
|
198838
198847
|
logger.error(
|
198839
198848
|
`\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time.`
|
@@ -199639,7 +199648,7 @@ __name(formatTrigger, "formatTrigger");
|
|
199639
199648
|
|
199640
199649
|
// src/versions/upload.ts
|
199641
199650
|
init_import_meta_url();
|
199642
|
-
var
|
199651
|
+
var import_node_fs31 = require("node:fs");
|
199643
199652
|
var import_node_path50 = __toESM(require("node:path"));
|
199644
199653
|
var import_node_url14 = require("node:url");
|
199645
199654
|
|
@@ -199814,9 +199823,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199814
199823
|
);
|
199815
199824
|
}
|
199816
199825
|
if (props.outDir) {
|
199817
|
-
(0,
|
199826
|
+
(0, import_node_fs31.mkdirSync)(props.outDir, { recursive: true });
|
199818
199827
|
const readmePath = import_node_path50.default.join(props.outDir, "README.md");
|
199819
|
-
(0,
|
199828
|
+
(0, import_node_fs31.writeFileSync)(
|
199820
199829
|
readmePath,
|
199821
199830
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
199822
199831
|
);
|
@@ -199844,10 +199853,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199844
199853
|
try {
|
199845
199854
|
if (props.noBundle) {
|
199846
199855
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
199847
|
-
(0,
|
199848
|
-
(0,
|
199856
|
+
(0, import_node_fs31.mkdirSync)(destinationDir, { recursive: true });
|
199857
|
+
(0, import_node_fs31.writeFileSync)(
|
199849
199858
|
import_node_path50.default.join(destinationDir, import_node_path50.default.basename(props.entry.file)),
|
199850
|
-
(0,
|
199859
|
+
(0, import_node_fs31.readFileSync)(props.entry.file, "utf-8")
|
199851
199860
|
);
|
199852
199861
|
}
|
199853
199862
|
const entryDirectory = import_node_path50.default.dirname(props.entry.file);
|
@@ -199906,7 +199915,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199906
199915
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
199907
199916
|
dependencies[modulePath] = { bytesInOutput };
|
199908
199917
|
}
|
199909
|
-
const content = (0,
|
199918
|
+
const content = (0, import_node_fs31.readFileSync)(resolvedEntryPointPath, {
|
199910
199919
|
encoding: "utf-8"
|
199911
199920
|
});
|
199912
199921
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
@@ -201467,7 +201476,7 @@ The \`init\` command will be removed in a future version.`
|
|
201467
201476
|
}
|
201468
201477
|
}
|
201469
201478
|
}
|
201470
|
-
if (
|
201479
|
+
if (fs25.existsSync(wranglerTomlDestination)) {
|
201471
201480
|
let shouldContinue = false;
|
201472
201481
|
logger.warn(
|
201473
201482
|
`${import_node_path52.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
@@ -201673,7 +201682,7 @@ ${err.message ?? err}`
|
|
201673
201682
|
compatibility_date: parsedWranglerToml.compatibility_date,
|
201674
201683
|
...extraToml
|
201675
201684
|
};
|
201676
|
-
|
201685
|
+
fs25.writeFileSync(wranglerTomlDestination, import_toml7.default.stringify(newToml));
|
201677
201686
|
}
|
201678
201687
|
const isNamedWorker = isCreatingWranglerToml && import_node_path52.default.dirname(packagePath) !== process.cwd();
|
201679
201688
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
@@ -201716,7 +201725,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
201716
201725
|
}
|
201717
201726
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
201718
201727
|
if (isTypescriptProject) {
|
201719
|
-
if (!
|
201728
|
+
if (!fs25.existsSync(import_node_path52.default.join(creationDirectory, "./src/index.ts"))) {
|
201720
201729
|
const newWorkerFilename = import_node_path52.default.relative(
|
201721
201730
|
process.cwd(),
|
201722
201731
|
import_node_path52.default.join(creationDirectory, "./src/index.ts")
|
@@ -201774,7 +201783,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
201774
201783
|
}
|
201775
201784
|
}
|
201776
201785
|
} else {
|
201777
|
-
if (!
|
201786
|
+
if (!fs25.existsSync(import_node_path52.default.join(creationDirectory, "./src/index.js"))) {
|
201778
201787
|
const newWorkerFilename = import_node_path52.default.relative(
|
201779
201788
|
process.cwd(),
|
201780
201789
|
import_node_path52.default.join(creationDirectory, "./src/index.js")
|
@@ -201959,7 +201968,7 @@ function getNewWorkerToml(workerType) {
|
|
201959
201968
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
201960
201969
|
async function findPath(isolatedInit, cwd2, basename4) {
|
201961
201970
|
if (isolatedInit) {
|
201962
|
-
return
|
201971
|
+
return fs25.existsSync(import_node_path52.default.resolve(cwd2, basename4)) ? import_node_path52.default.resolve(cwd2, basename4) : void 0;
|
201963
201972
|
} else {
|
201964
201973
|
return await findUp(basename4, {
|
201965
201974
|
cwd: cwd2
|
@@ -202721,9 +202730,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202721
202730
|
"A [site] definition requires a `bucket` field with a path to the site's assets directory."
|
202722
202731
|
);
|
202723
202732
|
if (props.outDir) {
|
202724
|
-
(0,
|
202733
|
+
(0, import_node_fs32.mkdirSync)(props.outDir, { recursive: true });
|
202725
202734
|
const readmePath = import_node_path53.default.join(props.outDir, "README.md");
|
202726
|
-
(0,
|
202735
|
+
(0, import_node_fs32.writeFileSync)(
|
202727
202736
|
readmePath,
|
202728
202737
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
202729
202738
|
);
|
@@ -202759,10 +202768,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202759
202768
|
try {
|
202760
202769
|
if (props.noBundle) {
|
202761
202770
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
202762
|
-
(0,
|
202763
|
-
(0,
|
202771
|
+
(0, import_node_fs32.mkdirSync)(destinationDir, { recursive: true });
|
202772
|
+
(0, import_node_fs32.writeFileSync)(
|
202764
202773
|
import_node_path53.default.join(destinationDir, import_node_path53.default.basename(props.entry.file)),
|
202765
|
-
(0,
|
202774
|
+
(0, import_node_fs32.readFileSync)(props.entry.file, "utf-8")
|
202766
202775
|
);
|
202767
202776
|
}
|
202768
202777
|
const entryDirectory = import_node_path53.default.dirname(props.entry.file);
|
@@ -202827,7 +202836,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202827
202836
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
202828
202837
|
dependencies[modulePath] = { bytesInOutput };
|
202829
202838
|
}
|
202830
|
-
const content = (0,
|
202839
|
+
const content = (0, import_node_fs32.readFileSync)(resolvedEntryPointPath, {
|
202831
202840
|
encoding: "utf-8"
|
202832
202841
|
});
|
202833
202842
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
@@ -204190,10 +204199,14 @@ __name(getRemotePreviewToken, "getRemotePreviewToken");
|
|
204190
204199
|
async function createRemoteWorkerInit(props) {
|
204191
204200
|
const { entrypointSource: content, modules } = withSourceURLs(
|
204192
204201
|
props.bundle.path,
|
204202
|
+
props.bundle.entrypointSource,
|
204193
204203
|
props.modules
|
204194
204204
|
);
|
204195
204205
|
void printBundleSize(
|
204196
|
-
{
|
204206
|
+
{
|
204207
|
+
name: import_node_path54.default.basename(props.bundle.path),
|
204208
|
+
content
|
204209
|
+
},
|
204197
204210
|
props.modules
|
204198
204211
|
);
|
204199
204212
|
const assets = await syncAssets(
|
@@ -204325,6 +204338,7 @@ __name(handleUserFriendlyError, "handleUserFriendlyError");
|
|
204325
204338
|
// src/dev/use-esbuild.ts
|
204326
204339
|
init_import_meta_url();
|
204327
204340
|
var import_node_assert18 = __toESM(require("node:assert"));
|
204341
|
+
var import_node_fs33 = require("node:fs");
|
204328
204342
|
var import_node_path55 = __toESM(require("node:path"));
|
204329
204343
|
var import_chokidar3 = require("chokidar");
|
204330
204344
|
var import_ink11 = __toESM(require_build2());
|
@@ -204389,7 +204403,11 @@ function useEsbuild({
|
|
204389
204403
|
...moduleCollector?.modules ?? [],
|
204390
204404
|
...newAdditionalModules
|
204391
204405
|
]);
|
204392
|
-
return {
|
204406
|
+
return {
|
204407
|
+
...previousBundle,
|
204408
|
+
entrypointSource: (0, import_node_fs33.readFileSync)(previousBundle.path, "utf8"),
|
204409
|
+
id: previousBundle.id + 1
|
204410
|
+
};
|
204393
204411
|
});
|
204394
204412
|
}
|
204395
204413
|
__name(updateBundle, "updateBundle");
|
@@ -204468,15 +204486,19 @@ function useEsbuild({
|
|
204468
204486
|
void watcher.close();
|
204469
204487
|
}, "stopWatching");
|
204470
204488
|
}
|
204489
|
+
const entrypointPath = (0, import_node_fs33.realpathSync)(
|
204490
|
+
bundleResult?.resolvedEntryPointPath ?? entry.file
|
204491
|
+
);
|
204471
204492
|
setBundle({
|
204472
204493
|
id: 0,
|
204473
204494
|
entry,
|
204474
|
-
path:
|
204495
|
+
path: entrypointPath,
|
204475
204496
|
type: bundleResult?.bundleType ?? getBundleType(entry.format, entry.file),
|
204476
204497
|
modules: bundleResult ? bundleResult.modules : newAdditionalModules,
|
204477
204498
|
dependencies: bundleResult?.dependencies ?? {},
|
204478
204499
|
sourceMapPath: bundleResult?.sourceMapPath,
|
204479
|
-
sourceMapMetadata: bundleResult?.sourceMapMetadata
|
204500
|
+
sourceMapMetadata: bundleResult?.sourceMapMetadata,
|
204501
|
+
entrypointSource: (0, import_node_fs33.readFileSync)(entrypointPath, "utf8")
|
204480
204502
|
});
|
204481
204503
|
}
|
204482
204504
|
__name(build5, "build");
|
@@ -205074,6 +205096,7 @@ var dev_default = withErrorBoundary(DevImplementation, {
|
|
205074
205096
|
|
205075
205097
|
// src/dev/start-server.ts
|
205076
205098
|
init_import_meta_url();
|
205099
|
+
var import_promises21 = require("node:fs/promises");
|
205077
205100
|
var path62 = __toESM(require("node:path"));
|
205078
205101
|
var util3 = __toESM(require("node:util"));
|
205079
205102
|
var import_chalk20 = __toESM(require_chalk());
|
@@ -205352,15 +205375,17 @@ async function runEsbuild({
|
|
205352
205375
|
projectRoot,
|
205353
205376
|
defineNavigatorUserAgent
|
205354
205377
|
}) : void 0;
|
205378
|
+
const entrypointPath = bundleResult?.resolvedEntryPointPath ?? entry.file;
|
205355
205379
|
return {
|
205356
205380
|
id: 0,
|
205357
205381
|
entry,
|
205358
|
-
path:
|
205382
|
+
path: entrypointPath,
|
205359
205383
|
type: bundleResult?.bundleType ?? getBundleType(entry.format),
|
205360
205384
|
modules: bundleResult ? bundleResult.modules : additionalModules,
|
205361
205385
|
dependencies: bundleResult?.dependencies ?? {},
|
205362
205386
|
sourceMapPath: bundleResult?.sourceMapPath,
|
205363
|
-
sourceMapMetadata: bundleResult?.sourceMapMetadata
|
205387
|
+
sourceMapMetadata: bundleResult?.sourceMapMetadata,
|
205388
|
+
entrypointSource: await (0, import_promises21.readFile)(entrypointPath, "utf8")
|
205364
205389
|
};
|
205365
205390
|
}
|
205366
205391
|
__name(runEsbuild, "runEsbuild");
|
@@ -206395,7 +206420,7 @@ init_import_meta_url();
|
|
206395
206420
|
// src/api/startDevWorker/DevEnv.ts
|
206396
206421
|
init_import_meta_url();
|
206397
206422
|
var import_node_assert21 = __toESM(require("node:assert"));
|
206398
|
-
var
|
206423
|
+
var import_node_events3 = require("node:events");
|
206399
206424
|
|
206400
206425
|
// src/api/startDevWorker/BundlerController.ts
|
206401
206426
|
init_import_meta_url();
|
@@ -206403,12 +206428,14 @@ init_import_meta_url();
|
|
206403
206428
|
// src/api/startDevWorker/BaseController.ts
|
206404
206429
|
init_import_meta_url();
|
206405
206430
|
var import_node_events2 = require("node:events");
|
206406
|
-
var
|
206431
|
+
var TypedEventEmitterImpl = import_node_events2.EventEmitter;
|
206432
|
+
var Controller = class extends TypedEventEmitterImpl {
|
206433
|
+
emitErrorEvent(data) {
|
206434
|
+
this.emit("error", data);
|
206435
|
+
}
|
206407
206436
|
};
|
206408
206437
|
__name(Controller, "Controller");
|
206409
206438
|
var RuntimeController = class extends Controller {
|
206410
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206411
|
-
once;
|
206412
206439
|
};
|
206413
206440
|
__name(RuntimeController, "RuntimeController");
|
206414
206441
|
|
@@ -206452,15 +206479,12 @@ var BundlerController = class extends Controller {
|
|
206452
206479
|
emitBundleCompletetEvent(data) {
|
206453
206480
|
this.emit("bundleComplete", data);
|
206454
206481
|
}
|
206455
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206456
|
-
once;
|
206457
206482
|
};
|
206458
206483
|
__name(BundlerController, "BundlerController");
|
206459
206484
|
|
206460
206485
|
// src/api/startDevWorker/ConfigController.ts
|
206461
206486
|
init_import_meta_url();
|
206462
|
-
var
|
206463
|
-
var ConfigController = class extends import_node_events3.EventEmitter {
|
206487
|
+
var ConfigController = class extends Controller {
|
206464
206488
|
config;
|
206465
206489
|
setOptions(_3) {
|
206466
206490
|
notImplemented(this.setOptions.name, this.constructor.name);
|
@@ -206480,35 +206504,345 @@ var ConfigController = class extends import_node_events3.EventEmitter {
|
|
206480
206504
|
emitConfigUpdateEvent(data) {
|
206481
206505
|
this.emit("configUpdate", data);
|
206482
206506
|
}
|
206483
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206484
|
-
once;
|
206485
206507
|
};
|
206486
206508
|
__name(ConfigController, "ConfigController");
|
206487
206509
|
|
206488
206510
|
// src/api/startDevWorker/LocalRuntimeController.ts
|
206489
206511
|
init_import_meta_url();
|
206512
|
+
var import_node_crypto8 = require("node:crypto");
|
206513
|
+
var import_promises22 = require("node:fs/promises");
|
206514
|
+
var import_miniflare15 = require("miniflare");
|
206515
|
+
|
206516
|
+
// src/api/startDevWorker/events.ts
|
206517
|
+
init_import_meta_url();
|
206518
|
+
|
206519
|
+
// src/api/startDevWorker/devtools.ts
|
206520
|
+
init_import_meta_url();
|
206521
|
+
|
206522
|
+
// src/api/startDevWorker/events.ts
|
206523
|
+
function castErrorCause(cause) {
|
206524
|
+
if (cause instanceof Error) {
|
206525
|
+
return cause;
|
206526
|
+
}
|
206527
|
+
const error2 = new Error();
|
206528
|
+
error2.cause = cause;
|
206529
|
+
return error2;
|
206530
|
+
}
|
206531
|
+
__name(castErrorCause, "castErrorCause");
|
206532
|
+
|
206533
|
+
// src/api/startDevWorker/LocalRuntimeController.ts
|
206534
|
+
async function getBinaryFileContents(file) {
|
206535
|
+
if ("contents" in file) {
|
206536
|
+
if (file.contents instanceof Buffer) {
|
206537
|
+
return file.contents;
|
206538
|
+
}
|
206539
|
+
return Buffer.from(file.contents);
|
206540
|
+
}
|
206541
|
+
return (0, import_promises22.readFile)(file.path);
|
206542
|
+
}
|
206543
|
+
__name(getBinaryFileContents, "getBinaryFileContents");
|
206544
|
+
async function getTextFileContents(file) {
|
206545
|
+
if ("contents" in file) {
|
206546
|
+
if (typeof file.contents === "string") {
|
206547
|
+
return file.contents;
|
206548
|
+
}
|
206549
|
+
if (file.contents instanceof Buffer) {
|
206550
|
+
return file.contents.toString();
|
206551
|
+
}
|
206552
|
+
return Buffer.from(file.contents).toString();
|
206553
|
+
}
|
206554
|
+
return (0, import_promises22.readFile)(file.path, "utf8");
|
206555
|
+
}
|
206556
|
+
__name(getTextFileContents, "getTextFileContents");
|
206557
|
+
var DEFAULT_WORKER_NAME2 = "worker";
|
206558
|
+
function getName2(config) {
|
206559
|
+
return config.name ?? DEFAULT_WORKER_NAME2;
|
206560
|
+
}
|
206561
|
+
__name(getName2, "getName");
|
206562
|
+
async function convertToConfigBundle(event) {
|
206563
|
+
const bindings = {
|
206564
|
+
vars: void 0,
|
206565
|
+
kv_namespaces: void 0,
|
206566
|
+
send_email: void 0,
|
206567
|
+
wasm_modules: void 0,
|
206568
|
+
text_blobs: void 0,
|
206569
|
+
browser: void 0,
|
206570
|
+
ai: void 0,
|
206571
|
+
version_metadata: void 0,
|
206572
|
+
data_blobs: void 0,
|
206573
|
+
durable_objects: void 0,
|
206574
|
+
queues: void 0,
|
206575
|
+
r2_buckets: void 0,
|
206576
|
+
d1_databases: void 0,
|
206577
|
+
vectorize: void 0,
|
206578
|
+
constellation: void 0,
|
206579
|
+
hyperdrive: void 0,
|
206580
|
+
services: void 0,
|
206581
|
+
analytics_engine_datasets: void 0,
|
206582
|
+
dispatch_namespaces: void 0,
|
206583
|
+
mtls_certificates: void 0,
|
206584
|
+
logfwdr: void 0,
|
206585
|
+
unsafe: void 0
|
206586
|
+
};
|
206587
|
+
const fetchers = {};
|
206588
|
+
for (const [name, binding] of Object.entries(event.config.bindings ?? {})) {
|
206589
|
+
if (binding.type === "plain_text") {
|
206590
|
+
bindings.vars ??= {};
|
206591
|
+
bindings.vars[name] = binding.value;
|
206592
|
+
} else if (binding.type === "json") {
|
206593
|
+
bindings.vars ??= {};
|
206594
|
+
bindings.vars[name] = binding.value;
|
206595
|
+
} else if (binding.type === "kv_namespace") {
|
206596
|
+
bindings.kv_namespaces ??= [];
|
206597
|
+
bindings.kv_namespaces.push({ ...binding, binding: name });
|
206598
|
+
} else if (binding.type === "send_email") {
|
206599
|
+
bindings.send_email ??= [];
|
206600
|
+
bindings.send_email.push({ ...binding, name });
|
206601
|
+
} else if (binding.type === "wasm_module") {
|
206602
|
+
bindings.wasm_modules ??= {};
|
206603
|
+
bindings.wasm_modules[name] = await getBinaryFileContents(binding.source);
|
206604
|
+
} else if (binding.type === "text_blob") {
|
206605
|
+
bindings.text_blobs ??= {};
|
206606
|
+
bindings.text_blobs[name] = binding.source.path;
|
206607
|
+
} else if (binding.type === "data_blob") {
|
206608
|
+
bindings.data_blobs ??= {};
|
206609
|
+
bindings.data_blobs[name] = await getBinaryFileContents(binding.source);
|
206610
|
+
} else if (binding.type === "browser") {
|
206611
|
+
bindings.browser = { binding: name };
|
206612
|
+
} else if (binding.type === "ai") {
|
206613
|
+
bindings.ai = { binding: name };
|
206614
|
+
} else if (binding.type === "version_metadata") {
|
206615
|
+
bindings.version_metadata = { binding: name };
|
206616
|
+
} else if (binding.type === "durable_object_namespace") {
|
206617
|
+
bindings.durable_objects ??= { bindings: [] };
|
206618
|
+
bindings.durable_objects.bindings.push({ ...binding, name });
|
206619
|
+
} else if (binding.type === "queue") {
|
206620
|
+
bindings.queues ??= [];
|
206621
|
+
bindings.queues.push({ ...binding, binding: name });
|
206622
|
+
} else if (binding.type === "r2_bucket") {
|
206623
|
+
bindings.r2_buckets ??= [];
|
206624
|
+
bindings.r2_buckets.push({ ...binding, binding: name });
|
206625
|
+
} else if (binding.type === "d1") {
|
206626
|
+
bindings.d1_databases ??= [];
|
206627
|
+
bindings.d1_databases.push({ ...binding, binding: name });
|
206628
|
+
} else if (binding.type === "vectorize") {
|
206629
|
+
bindings.vectorize ??= [];
|
206630
|
+
bindings.vectorize.push({ ...binding, binding: name });
|
206631
|
+
} else if (binding.type === "constellation") {
|
206632
|
+
bindings.constellation ??= [];
|
206633
|
+
bindings.constellation.push({ ...binding, binding: name });
|
206634
|
+
} else if (binding.type === "hyperdrive") {
|
206635
|
+
bindings.hyperdrive ??= [];
|
206636
|
+
bindings.hyperdrive.push({ ...binding, binding: name });
|
206637
|
+
} else if (binding.type === "service") {
|
206638
|
+
bindings.services ??= [];
|
206639
|
+
bindings.services.push({ ...binding, binding: name });
|
206640
|
+
} else if (binding.type === "fetcher") {
|
206641
|
+
fetchers[name] = binding.fetcher;
|
206642
|
+
} else if (binding.type === "analytics_engine") {
|
206643
|
+
bindings.analytics_engine_datasets ??= [];
|
206644
|
+
bindings.analytics_engine_datasets.push({ ...binding, binding: name });
|
206645
|
+
} else if (binding.type === "dispatch_namespace") {
|
206646
|
+
bindings.dispatch_namespaces ??= [];
|
206647
|
+
bindings.dispatch_namespaces.push({ ...binding, binding: name });
|
206648
|
+
} else if (binding.type === "mtls_certificate") {
|
206649
|
+
bindings.mtls_certificates ??= [];
|
206650
|
+
bindings.mtls_certificates.push({ ...binding, binding: name });
|
206651
|
+
} else if (binding.type === "logfwdr") {
|
206652
|
+
bindings.logfwdr ??= { bindings: [] };
|
206653
|
+
bindings.logfwdr.bindings.push({ ...binding, name });
|
206654
|
+
} else if (binding.type.startsWith("unsafe_")) {
|
206655
|
+
bindings.unsafe ??= {
|
206656
|
+
bindings: [],
|
206657
|
+
metadata: void 0,
|
206658
|
+
capnp: void 0
|
206659
|
+
};
|
206660
|
+
bindings.unsafe.bindings?.push({
|
206661
|
+
type: binding.type.slice("unsafe_".length),
|
206662
|
+
name
|
206663
|
+
});
|
206664
|
+
}
|
206665
|
+
}
|
206666
|
+
const persistence = event.config.dev?.persist ? getLocalPersistencePath(
|
206667
|
+
typeof event.config.dev?.persist === "object" ? event.config.dev?.persist.path : void 0,
|
206668
|
+
event.config.config?.path
|
206669
|
+
) : null;
|
206670
|
+
const crons = [];
|
206671
|
+
const queueConsumers = [];
|
206672
|
+
for (const trigger of event.config.triggers ?? []) {
|
206673
|
+
if (trigger.type === "cron") {
|
206674
|
+
crons.push(trigger.cron);
|
206675
|
+
} else if (trigger.type === "queue-consumer") {
|
206676
|
+
queueConsumers.push(trigger);
|
206677
|
+
}
|
206678
|
+
}
|
206679
|
+
if (event.bundle.entry.format === "service-worker") {
|
206680
|
+
for (const module3 of event.bundle.modules ?? []) {
|
206681
|
+
const identifier = getIdentifier(module3.name);
|
206682
|
+
if (module3.type === "text") {
|
206683
|
+
bindings.vars ??= {};
|
206684
|
+
bindings.vars[identifier] = await getTextFileContents({
|
206685
|
+
contents: module3.content
|
206686
|
+
});
|
206687
|
+
} else if (module3.type === "buffer") {
|
206688
|
+
bindings.data_blobs ??= {};
|
206689
|
+
bindings.data_blobs[identifier] = await getBinaryFileContents({
|
206690
|
+
contents: module3.content
|
206691
|
+
});
|
206692
|
+
} else if (module3.type === "compiled-wasm") {
|
206693
|
+
bindings.wasm_modules ??= {};
|
206694
|
+
bindings.wasm_modules[identifier] = await getBinaryFileContents({
|
206695
|
+
contents: module3.content
|
206696
|
+
});
|
206697
|
+
}
|
206698
|
+
}
|
206699
|
+
event.bundle = { ...event.bundle, modules: [] };
|
206700
|
+
}
|
206701
|
+
return {
|
206702
|
+
name: event.config.name,
|
206703
|
+
bundle: event.bundle,
|
206704
|
+
format: event.bundle.entry.format,
|
206705
|
+
compatibilityDate: event.config.compatibilityDate,
|
206706
|
+
compatibilityFlags: event.config.compatibilityFlags,
|
206707
|
+
bindings,
|
206708
|
+
workerDefinitions: new Proxy(
|
206709
|
+
{},
|
206710
|
+
{
|
206711
|
+
get(_3, name) {
|
206712
|
+
return event.config.dev?.getRegisteredWorker?.(name);
|
206713
|
+
}
|
206714
|
+
}
|
206715
|
+
),
|
206716
|
+
assetPaths: event.config.site?.path ? {
|
206717
|
+
baseDirectory: event.config.site.path,
|
206718
|
+
assetDirectory: "",
|
206719
|
+
excludePatterns: event.config.site.exclude ?? [],
|
206720
|
+
includePatterns: event.config.site.include ?? []
|
206721
|
+
} : void 0,
|
206722
|
+
initialPort: void 0,
|
206723
|
+
initialIp: "127.0.0.1",
|
206724
|
+
rules: [],
|
206725
|
+
inspectorPort: event.config.dev?.inspector?.port ?? await getPorts({ port: DEFAULT_INSPECTOR_PORT }),
|
206726
|
+
localPersistencePath: persistence,
|
206727
|
+
liveReload: event.config.dev?.liveReload ?? false,
|
206728
|
+
crons,
|
206729
|
+
queueConsumers,
|
206730
|
+
localProtocol: event.config.dev?.server?.secure ? "https" : "http",
|
206731
|
+
httpsCertPath: event.config.dev?.server?.httpsCertPath,
|
206732
|
+
httpsKeyPath: event.config.dev?.server?.httpsKeyPath,
|
206733
|
+
localUpstream: event.config.dev?.urlOverrides?.hostname,
|
206734
|
+
upstreamProtocol: event.config.dev?.urlOverrides?.secure ? "https" : "http",
|
206735
|
+
inspect: true,
|
206736
|
+
services: bindings.services,
|
206737
|
+
serviceBindings: fetchers
|
206738
|
+
};
|
206739
|
+
}
|
206740
|
+
__name(convertToConfigBundle, "convertToConfigBundle");
|
206490
206741
|
var LocalRuntimeController = class extends RuntimeController {
|
206491
206742
|
// ******************
|
206492
206743
|
// Event Handlers
|
206493
206744
|
// ******************
|
206745
|
+
#log = buildLog();
|
206746
|
+
#currentBundleId = 0;
|
206747
|
+
// This is given as a shared secret to the Proxy and User workers
|
206748
|
+
// so that the User Worker can trust aspects of HTTP requests from the Proxy Worker
|
206749
|
+
// if it provides the secret in a `MF-Proxy-Shared-Secret` header.
|
206750
|
+
#proxyToUserWorkerAuthenticationSecret = (0, import_node_crypto8.randomUUID)();
|
206751
|
+
// `buildMiniflareOptions()` is asynchronous, meaning if multiple bundle
|
206752
|
+
// updates were submitted, the second may apply before the first. Therefore,
|
206753
|
+
// wrap updates in a mutex, so they're always applied in invocation order.
|
206754
|
+
#mutex = new import_miniflare15.Mutex();
|
206755
|
+
#mf;
|
206494
206756
|
onBundleStart(_3) {
|
206495
|
-
notImplemented(this.onBundleStart.name, this.constructor.name);
|
206496
206757
|
}
|
206497
|
-
onBundleComplete(
|
206498
|
-
|
206758
|
+
async #onBundleComplete(data, id) {
|
206759
|
+
try {
|
206760
|
+
const { options: options29, internalObjects, entrypointNames } = await buildMiniflareOptions(
|
206761
|
+
this.#log,
|
206762
|
+
await convertToConfigBundle(data),
|
206763
|
+
this.#proxyToUserWorkerAuthenticationSecret
|
206764
|
+
);
|
206765
|
+
if (this.#mf === void 0) {
|
206766
|
+
this.#mf = new import_miniflare15.Miniflare(options29);
|
206767
|
+
} else {
|
206768
|
+
await this.#mf.setOptions(options29);
|
206769
|
+
}
|
206770
|
+
const userWorkerUrl = await this.#mf.ready;
|
206771
|
+
const userWorkerInspectorUrl = await this.#mf.getInspectorURL();
|
206772
|
+
if (id !== this.#currentBundleId) {
|
206773
|
+
return;
|
206774
|
+
}
|
206775
|
+
const entrypointAddresses = {};
|
206776
|
+
for (const name of entrypointNames) {
|
206777
|
+
const directUrl = await this.#mf.unsafeGetDirectURL(void 0, name);
|
206778
|
+
const port2 = parseInt(directUrl.port);
|
206779
|
+
entrypointAddresses[name] = { host: directUrl.hostname, port: port2 };
|
206780
|
+
}
|
206781
|
+
this.emitReloadCompleteEvent({
|
206782
|
+
type: "reloadComplete",
|
206783
|
+
config: data.config,
|
206784
|
+
bundle: data.bundle,
|
206785
|
+
proxyData: {
|
206786
|
+
userWorkerUrl: {
|
206787
|
+
protocol: userWorkerUrl.protocol,
|
206788
|
+
hostname: userWorkerUrl.hostname,
|
206789
|
+
port: userWorkerUrl.port
|
206790
|
+
},
|
206791
|
+
userWorkerInspectorUrl: {
|
206792
|
+
protocol: userWorkerInspectorUrl.protocol,
|
206793
|
+
hostname: userWorkerInspectorUrl.hostname,
|
206794
|
+
port: userWorkerInspectorUrl.port,
|
206795
|
+
pathname: `/core:user:${getName2(data.config)}`
|
206796
|
+
},
|
206797
|
+
userWorkerInnerUrlOverrides: {
|
206798
|
+
protocol: data.config?.dev?.urlOverrides?.secure ? "https:" : "http:",
|
206799
|
+
hostname: data.config?.dev?.urlOverrides?.hostname
|
206800
|
+
},
|
206801
|
+
headers: {
|
206802
|
+
// Passing this signature from Proxy Worker allows the User Worker to trust the request.
|
206803
|
+
"MF-Proxy-Shared-Secret": this.#proxyToUserWorkerAuthenticationSecret
|
206804
|
+
},
|
206805
|
+
liveReload: data.config.dev?.liveReload,
|
206806
|
+
proxyLogsToController: data.bundle.entry.format === "service-worker",
|
206807
|
+
internalDurableObjects: internalObjects,
|
206808
|
+
entrypointAddresses
|
206809
|
+
}
|
206810
|
+
});
|
206811
|
+
} catch (error2) {
|
206812
|
+
this.emitErrorEvent({
|
206813
|
+
type: "error",
|
206814
|
+
reason: "Error reloading local server",
|
206815
|
+
cause: castErrorCause(error2),
|
206816
|
+
source: "LocalRuntimeController",
|
206817
|
+
data: void 0
|
206818
|
+
});
|
206819
|
+
}
|
206820
|
+
}
|
206821
|
+
onBundleComplete(data) {
|
206822
|
+
const id = ++this.#currentBundleId;
|
206823
|
+
this.emitReloadStartEvent({
|
206824
|
+
type: "reloadStart",
|
206825
|
+
config: data.config,
|
206826
|
+
bundle: data.bundle
|
206827
|
+
});
|
206828
|
+
void this.#mutex.runWith(() => this.#onBundleComplete(data, id));
|
206499
206829
|
}
|
206500
206830
|
onPreviewTokenExpired(_3) {
|
206501
206831
|
}
|
206832
|
+
#teardown = async () => {
|
206833
|
+
await this.#mf?.dispose();
|
206834
|
+
this.#mf = void 0;
|
206835
|
+
};
|
206502
206836
|
async teardown() {
|
206503
|
-
|
206837
|
+
return this.#mutex.runWith(this.#teardown);
|
206504
206838
|
}
|
206505
206839
|
// *********************
|
206506
206840
|
// Event Dispatchers
|
206507
206841
|
// *********************
|
206508
206842
|
emitReloadStartEvent(data) {
|
206509
|
-
this.emit("
|
206843
|
+
this.emit("reloadStart", data);
|
206510
206844
|
}
|
206511
|
-
|
206845
|
+
emitReloadCompleteEvent(data) {
|
206512
206846
|
this.emit("reloadComplete", data);
|
206513
206847
|
}
|
206514
206848
|
};
|
@@ -206517,10 +206851,9 @@ __name(LocalRuntimeController, "LocalRuntimeController");
|
|
206517
206851
|
// src/api/startDevWorker/ProxyController.ts
|
206518
206852
|
init_import_meta_url();
|
206519
206853
|
var import_node_assert20 = __toESM(require("node:assert"));
|
206520
|
-
var
|
206521
|
-
var import_node_events4 = require("node:events");
|
206854
|
+
var import_node_crypto9 = require("node:crypto");
|
206522
206855
|
var import_node_path59 = __toESM(require("node:path"));
|
206523
|
-
var
|
206856
|
+
var import_miniflare16 = require("miniflare");
|
206524
206857
|
|
206525
206858
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
206526
206859
|
init_import_meta_url();
|
@@ -206534,23 +206867,6 @@ var import_node_path58 = __toESM(require("node:path"));
|
|
206534
206867
|
var scriptPath2 = import_node_path58.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
206535
206868
|
var ProxyWorker_default = scriptPath2;
|
206536
206869
|
|
206537
|
-
// src/api/startDevWorker/events.ts
|
206538
|
-
init_import_meta_url();
|
206539
|
-
|
206540
|
-
// src/api/startDevWorker/devtools.ts
|
206541
|
-
init_import_meta_url();
|
206542
|
-
|
206543
|
-
// src/api/startDevWorker/events.ts
|
206544
|
-
function castErrorCause(cause) {
|
206545
|
-
if (cause instanceof Error) {
|
206546
|
-
return cause;
|
206547
|
-
}
|
206548
|
-
const error2 = new Error();
|
206549
|
-
error2.cause = cause;
|
206550
|
-
return error2;
|
206551
|
-
}
|
206552
|
-
__name(castErrorCause, "castErrorCause");
|
206553
|
-
|
206554
206870
|
// src/api/startDevWorker/utils.ts
|
206555
206871
|
init_import_meta_url();
|
206556
206872
|
var import_node_assert19 = __toESM(require("node:assert"));
|
@@ -206575,14 +206891,14 @@ function assertNever(_value) {
|
|
206575
206891
|
__name(assertNever, "assertNever");
|
206576
206892
|
|
206577
206893
|
// src/api/startDevWorker/ProxyController.ts
|
206578
|
-
var ProxyController = class extends
|
206894
|
+
var ProxyController = class extends Controller {
|
206579
206895
|
ready = createDeferred();
|
206580
206896
|
proxyWorker;
|
206581
206897
|
proxyWorkerOptions;
|
206582
206898
|
inspectorProxyWorkerWebSocket;
|
206583
206899
|
latestConfig;
|
206584
206900
|
latestBundle;
|
206585
|
-
secret = (0,
|
206901
|
+
secret = (0, import_node_crypto9.randomUUID)();
|
206586
206902
|
createProxyWorker() {
|
206587
206903
|
if (this._torndown) {
|
206588
206904
|
return;
|
@@ -206615,7 +206931,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206615
206931
|
PROXY_CONTROLLER: async (req) => {
|
206616
206932
|
const message = await req.json();
|
206617
206933
|
this.onProxyWorkerMessage(message);
|
206618
|
-
return new
|
206934
|
+
return new import_miniflare16.Response(null, { status: 204 });
|
206619
206935
|
}
|
206620
206936
|
},
|
206621
206937
|
bindings: {
|
@@ -206672,7 +206988,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206672
206988
|
proxyWorkerOptions
|
206673
206989
|
);
|
206674
206990
|
const willInstantiateMiniflareInstance = !this.proxyWorker || proxyWorkerOptionsChanged;
|
206675
|
-
this.proxyWorker ??= new
|
206991
|
+
this.proxyWorker ??= new import_miniflare16.Miniflare(proxyWorkerOptions);
|
206676
206992
|
this.proxyWorkerOptions = proxyWorkerOptions;
|
206677
206993
|
if (proxyWorkerOptionsChanged) {
|
206678
206994
|
logger.debug("ProxyWorker miniflare options changed, reinstantiating...");
|
@@ -206699,7 +207015,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206699
207015
|
return;
|
206700
207016
|
}
|
206701
207017
|
const existingWebSocket = await this.inspectorProxyWorkerWebSocket?.promise;
|
206702
|
-
if (existingWebSocket?.readyState ===
|
207018
|
+
if (existingWebSocket?.readyState === import_miniflare16.WebSocket.READY_STATE_OPEN) {
|
206703
207019
|
return existingWebSocket;
|
206704
207020
|
}
|
206705
207021
|
this.inspectorProxyWorkerWebSocket = createDeferred();
|
@@ -206744,7 +207060,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206744
207060
|
this.inspectorProxyWorkerWebSocket?.resolve(webSocket);
|
206745
207061
|
return webSocket;
|
206746
207062
|
}
|
206747
|
-
runtimeMessageMutex = new
|
207063
|
+
runtimeMessageMutex = new import_miniflare16.Mutex();
|
206748
207064
|
async sendMessageToProxyWorker(message, retries = 3) {
|
206749
207065
|
if (this._torndown) {
|
206750
207066
|
return;
|
@@ -206899,15 +207215,15 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206899
207215
|
);
|
206900
207216
|
}
|
206901
207217
|
if (maybeContents === void 0) {
|
206902
|
-
return new
|
207218
|
+
return new import_miniflare16.Response(null, { status: 404 });
|
206903
207219
|
}
|
206904
|
-
return new
|
207220
|
+
return new import_miniflare16.Response(maybeContents);
|
206905
207221
|
}
|
206906
207222
|
default:
|
206907
207223
|
assertNever(message);
|
206908
|
-
return new
|
207224
|
+
return new import_miniflare16.Response(null, { status: 404 });
|
206909
207225
|
}
|
206910
|
-
return new
|
207226
|
+
return new import_miniflare16.Response(null, { status: 204 });
|
206911
207227
|
}
|
206912
207228
|
_torndown = false;
|
206913
207229
|
async teardown() {
|
@@ -206938,26 +207254,26 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206938
207254
|
proxyData
|
206939
207255
|
});
|
206940
207256
|
}
|
206941
|
-
emitErrorEvent(
|
206942
|
-
|
206943
|
-
|
206944
|
-
|
206945
|
-
|
206946
|
-
|
206947
|
-
|
206948
|
-
|
206949
|
-
|
206950
|
-
|
206951
|
-
|
206952
|
-
|
207257
|
+
emitErrorEvent(data, cause) {
|
207258
|
+
if (typeof data === "string") {
|
207259
|
+
data = {
|
207260
|
+
type: "error",
|
207261
|
+
source: "ProxyController",
|
207262
|
+
cause: castErrorCause(cause),
|
207263
|
+
reason: data,
|
207264
|
+
data: {
|
207265
|
+
config: this.latestConfig,
|
207266
|
+
bundle: this.latestBundle
|
207267
|
+
}
|
207268
|
+
};
|
207269
|
+
}
|
207270
|
+
super.emitErrorEvent(data);
|
206953
207271
|
}
|
206954
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206955
|
-
once;
|
206956
207272
|
};
|
206957
207273
|
__name(ProxyController, "ProxyController");
|
206958
207274
|
var ProxyControllerLogger = class extends WranglerLog {
|
206959
207275
|
log(message) {
|
206960
|
-
if (message.includes("/cdn-cgi/") && this.level <
|
207276
|
+
if (message.includes("/cdn-cgi/") && this.level < import_miniflare16.LogLevel.DEBUG) {
|
206961
207277
|
return;
|
206962
207278
|
}
|
206963
207279
|
super.log(message);
|
@@ -206998,16 +207314,16 @@ var RemoteRuntimeController = class extends RuntimeController {
|
|
206998
207314
|
// Event Dispatchers
|
206999
207315
|
// *********************
|
207000
207316
|
emitReloadStartEvent(data) {
|
207001
|
-
this.emit("
|
207317
|
+
this.emit("reloadStart", data);
|
207002
207318
|
}
|
207003
|
-
|
207319
|
+
emitReloadCompleteEvent(data) {
|
207004
207320
|
this.emit("reloadComplete", data);
|
207005
207321
|
}
|
207006
207322
|
};
|
207007
207323
|
__name(RemoteRuntimeController, "RemoteRuntimeController");
|
207008
207324
|
|
207009
207325
|
// src/api/startDevWorker/DevEnv.ts
|
207010
|
-
var DevEnv = class extends
|
207326
|
+
var DevEnv = class extends import_node_events3.EventEmitter {
|
207011
207327
|
config;
|
207012
207328
|
bundler;
|
207013
207329
|
runtimes;
|
@@ -207031,9 +207347,10 @@ var DevEnv = class extends import_node_events5.EventEmitter {
|
|
207031
207347
|
this.bundler = bundler;
|
207032
207348
|
this.runtimes = runtimes;
|
207033
207349
|
this.proxy = proxy2;
|
207034
|
-
[config, bundler, ...runtimes, proxy2]
|
207035
|
-
|
207036
|
-
|
207350
|
+
const controllers = [config, bundler, ...runtimes, proxy2];
|
207351
|
+
controllers.forEach((controller) => {
|
207352
|
+
controller.on("error", (event) => this.emitErrorEvent(event));
|
207353
|
+
});
|
207037
207354
|
this.on("error", (event) => {
|
207038
207355
|
logger.error(`Error in ${event.source}: ${event.reason}
|
207039
207356
|
`, event.cause);
|
@@ -207076,7 +207393,7 @@ var DevEnv = class extends import_node_events5.EventEmitter {
|
|
207076
207393
|
await Promise.all([
|
207077
207394
|
this.config.teardown(),
|
207078
207395
|
this.bundler.teardown(),
|
207079
|
-
this.runtimes.
|
207396
|
+
...this.runtimes.map((runtime) => runtime.teardown()),
|
207080
207397
|
this.proxy.teardown()
|
207081
207398
|
]);
|
207082
207399
|
}
|
@@ -207150,7 +207467,7 @@ init_import_meta_url();
|
|
207150
207467
|
|
207151
207468
|
// src/api/integrations/platform/index.ts
|
207152
207469
|
init_import_meta_url();
|
207153
|
-
var
|
207470
|
+
var import_miniflare19 = require("miniflare");
|
207154
207471
|
|
207155
207472
|
// src/api/integrations/platform/caches.ts
|
207156
207473
|
init_import_meta_url();
|
@@ -207205,7 +207522,7 @@ __name(ExecutionContext, "ExecutionContext");
|
|
207205
207522
|
|
207206
207523
|
// src/api/integrations/platform/services.ts
|
207207
207524
|
init_import_meta_url();
|
207208
|
-
var
|
207525
|
+
var import_miniflare18 = require("miniflare");
|
207209
207526
|
var import_undici27 = __toESM(require_undici());
|
207210
207527
|
async function getServiceBindings(services = []) {
|
207211
207528
|
if (services.length === 0) {
|
@@ -207257,9 +207574,9 @@ function getServiceBindingProxyFetch({
|
|
207257
207574
|
try {
|
207258
207575
|
const resp = await (0, import_undici27.fetch)(newUrl, request3);
|
207259
207576
|
const respBody = await resp.arrayBuffer();
|
207260
|
-
return new
|
207577
|
+
return new import_miniflare18.Response(respBody, resp);
|
207261
207578
|
} catch {
|
207262
|
-
return new
|
207579
|
+
return new import_miniflare18.Response(
|
207263
207580
|
`Error: Unable to fetch from external service (${serviceName} bound with ${bindingName} binding), please make sure that the service is still running with \`wrangler dev\``,
|
207264
207581
|
{ status: 500 }
|
207265
207582
|
);
|
@@ -207288,7 +207605,7 @@ async function getPlatformProxy(options29 = {}) {
|
|
207288
207605
|
env5,
|
207289
207606
|
options29
|
207290
207607
|
);
|
207291
|
-
const mf = new
|
207608
|
+
const mf = new import_miniflare19.Miniflare({
|
207292
207609
|
script: "",
|
207293
207610
|
modules: true,
|
207294
207611
|
...miniflareOptions
|
@@ -207395,7 +207712,8 @@ function unstable_getMiniflareWorkerOptions(configPath, environment) {
|
|
207395
207712
|
if (bindings.services !== void 0) {
|
207396
207713
|
bindingOptions.serviceBindings = Object.fromEntries(
|
207397
207714
|
bindings.services.map((binding) => {
|
207398
|
-
|
207715
|
+
const name = binding.service === config.name ? import_miniflare19.kCurrentWorker : binding.service;
|
207716
|
+
return [binding.binding, { name, entrypoint: binding.entrypoint }];
|
207399
207717
|
})
|
207400
207718
|
);
|
207401
207719
|
}
|