wrangler 3.58.0 → 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 +2 -1
- package/package.json +3 -3
- package/wrangler-dist/InspectorProxyWorker.js.map +1 -1
- package/wrangler-dist/cli.d.ts +250 -91
- package/wrangler-dist/cli.js +705 -386
- package/wrangler-dist/cli.js.map +0 -7
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,
|
@@ -155757,7 +155757,7 @@ ${message}`;
|
|
155757
155757
|
__name(deprecated, "deprecated");
|
155758
155758
|
function experimental(diagnostics, config, fieldPath) {
|
155759
155759
|
const result = unwindPropertyPath(config, fieldPath);
|
155760
|
-
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)) {
|
155761
155761
|
diagnostics.warnings.push(
|
155762
155762
|
`"${fieldPath}" fields are experimental and may change or break at any time.`
|
155763
155763
|
);
|
@@ -158813,7 +158813,7 @@ function printBindings(bindings) {
|
|
158813
158813
|
type: "Data Blobs",
|
158814
158814
|
entries: Object.entries(data_blobs).map(([key, value]) => ({
|
158815
158815
|
key,
|
158816
|
-
value: truncate4(value)
|
158816
|
+
value: typeof value === "string" ? truncate4(value) : "<Buffer>"
|
158817
158817
|
}))
|
158818
158818
|
});
|
158819
158819
|
}
|
@@ -159042,7 +159042,7 @@ function printBindings(bindings) {
|
|
159042
159042
|
type: "Wasm Modules",
|
159043
159043
|
entries: Object.entries(wasm_modules).map(([key, value]) => ({
|
159044
159044
|
key,
|
159045
|
-
value: truncate4(value)
|
159045
|
+
value: typeof value === "string" ? truncate4(value) : "<Wasm>"
|
159046
159046
|
}))
|
159047
159047
|
});
|
159048
159048
|
}
|
@@ -159663,7 +159663,8 @@ var RuleTypeToModuleType = {
|
|
159663
159663
|
Data: "buffer",
|
159664
159664
|
Text: "text",
|
159665
159665
|
PythonModule: "python",
|
159666
|
-
PythonRequirement: "python-requirement"
|
159666
|
+
PythonRequirement: "python-requirement",
|
159667
|
+
NodeJsCompatModule: "nodejs-compat-module"
|
159667
159668
|
};
|
159668
159669
|
var ModuleTypeToRuleType = flipObject(RuleTypeToModuleType);
|
159669
159670
|
var modulesWatchRegexp = /^wrangler:modules-watch$/;
|
@@ -161558,7 +161559,6 @@ var import_signal_exit4 = __toESM(require_signal_exit());
|
|
161558
161559
|
init_import_meta_url();
|
161559
161560
|
var import_node_assert8 = __toESM(require("node:assert"));
|
161560
161561
|
var import_node_crypto4 = require("node:crypto");
|
161561
|
-
var import_node_fs11 = require("node:fs");
|
161562
161562
|
var import_node_path19 = __toESM(require("node:path"));
|
161563
161563
|
|
161564
161564
|
// ../../node_modules/.pnpm/es-module-lexer@1.3.1/node_modules/es-module-lexer/dist/lexer.js
|
@@ -161647,15 +161647,13 @@ __name(AIFetcher, "AIFetcher");
|
|
161647
161647
|
|
161648
161648
|
// src/deployment-bundle/source-url.ts
|
161649
161649
|
init_import_meta_url();
|
161650
|
-
var import_node_fs10 = __toESM(require("node:fs"));
|
161651
161650
|
var import_url2 = require("url");
|
161652
161651
|
function withSourceURL(source, sourcePath) {
|
161653
161652
|
return `${source}
|
161654
161653
|
//# sourceURL=${(0, import_url2.pathToFileURL)(sourcePath)}`;
|
161655
161654
|
}
|
161656
161655
|
__name(withSourceURL, "withSourceURL");
|
161657
|
-
function withSourceURLs(entrypointPath, modules) {
|
161658
|
-
let entrypointSource = import_node_fs10.default.readFileSync(entrypointPath, "utf8");
|
161656
|
+
function withSourceURLs(entrypointPath, entrypointSource, modules) {
|
161659
161657
|
if (!entrypointPath.endsWith(".py")) {
|
161660
161658
|
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
|
161661
161659
|
}
|
@@ -161674,7 +161672,7 @@ __name(withSourceURLs, "withSourceURLs");
|
|
161674
161672
|
|
161675
161673
|
// src/https-options.ts
|
161676
161674
|
init_import_meta_url();
|
161677
|
-
var
|
161675
|
+
var fs10 = __toESM(require("node:fs"));
|
161678
161676
|
var path22 = __toESM(require("node:path"));
|
161679
161677
|
var import_miniflare4 = require("miniflare");
|
161680
161678
|
var CERT_EXPIRY_DAYS = 30;
|
@@ -161686,12 +161684,12 @@ function getHttpsOptions(customHttpsKeyPath, customHttpsCertPath) {
|
|
161686
161684
|
"Must specify both certificate path and key path to use a Custom Certificate."
|
161687
161685
|
);
|
161688
161686
|
}
|
161689
|
-
if (!
|
161687
|
+
if (!fs10.existsSync(customHttpsKeyPath)) {
|
161690
161688
|
throw new UserError(
|
161691
161689
|
"Missing Custom Certificate Key at " + customHttpsKeyPath
|
161692
161690
|
);
|
161693
161691
|
}
|
161694
|
-
if (!
|
161692
|
+
if (!fs10.existsSync(customHttpsCertPath)) {
|
161695
161693
|
throw new UserError(
|
161696
161694
|
"Missing Custom Certificate File at " + customHttpsCertPath
|
161697
161695
|
);
|
@@ -161701,21 +161699,21 @@ function getHttpsOptions(customHttpsKeyPath, customHttpsCertPath) {
|
|
161701
161699
|
}
|
161702
161700
|
logger.log("Using custom certificate at ", customHttpsKeyPath);
|
161703
161701
|
return {
|
161704
|
-
key:
|
161705
|
-
cert:
|
161702
|
+
key: fs10.readFileSync(customHttpsKeyPath, "utf8"),
|
161703
|
+
cert: fs10.readFileSync(customHttpsCertPath, "utf8")
|
161706
161704
|
};
|
161707
161705
|
}
|
161708
161706
|
const certDirectory = path22.join(getGlobalWranglerConfigPath(), "local-cert");
|
161709
161707
|
const keyPath = path22.join(certDirectory, "key.pem");
|
161710
161708
|
const certPath = path22.join(certDirectory, "cert.pem");
|
161711
|
-
const regenerate = !
|
161709
|
+
const regenerate = !fs10.existsSync(keyPath) || !fs10.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
|
161712
161710
|
if (regenerate) {
|
161713
161711
|
logger.log("Generating new self-signed certificate...");
|
161714
161712
|
const { key, cert } = generateCertificate();
|
161715
161713
|
try {
|
161716
|
-
|
161717
|
-
|
161718
|
-
|
161714
|
+
fs10.mkdirSync(certDirectory, { recursive: true });
|
161715
|
+
fs10.writeFileSync(keyPath, key, "utf8");
|
161716
|
+
fs10.writeFileSync(certPath, cert, "utf8");
|
161719
161717
|
} catch (e3) {
|
161720
161718
|
const message = e3 instanceof Error ? e3.message : `${e3}`;
|
161721
161719
|
logger.warn(
|
@@ -161729,15 +161727,15 @@ ${message}`
|
|
161729
161727
|
return { key, cert };
|
161730
161728
|
} else {
|
161731
161729
|
return {
|
161732
|
-
key:
|
161733
|
-
cert:
|
161730
|
+
key: fs10.readFileSync(keyPath, "utf8"),
|
161731
|
+
cert: fs10.readFileSync(certPath, "utf8")
|
161734
161732
|
};
|
161735
161733
|
}
|
161736
161734
|
}
|
161737
161735
|
__name(getHttpsOptions, "getHttpsOptions");
|
161738
161736
|
function hasCertificateExpired(keyPath, certPath) {
|
161739
|
-
const keyStat =
|
161740
|
-
const certStat =
|
161737
|
+
const keyStat = fs10.statSync(keyPath);
|
161738
|
+
const certStat = fs10.statSync(certPath);
|
161741
161739
|
const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
|
161742
161740
|
return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
|
161743
161741
|
}
|
@@ -161997,13 +161995,17 @@ async function getEntrypointNames(entrypointSource) {
|
|
161997
161995
|
}
|
161998
161996
|
__name(getEntrypointNames, "getEntrypointNames");
|
161999
161997
|
async function buildSourceOptions(config) {
|
162000
|
-
const scriptPath3 =
|
161998
|
+
const scriptPath3 = config.bundle.path;
|
162001
161999
|
if (config.format === "modules") {
|
162002
162000
|
const isPython = config.bundle.type === "python";
|
162003
162001
|
const { entrypointSource, modules } = isPython ? {
|
162004
|
-
entrypointSource:
|
162002
|
+
entrypointSource: config.bundle.entrypointSource,
|
162005
162003
|
modules: config.bundle.modules
|
162006
|
-
} : withSourceURLs(
|
162004
|
+
} : withSourceURLs(
|
162005
|
+
scriptPath3,
|
162006
|
+
config.bundle.entrypointSource,
|
162007
|
+
config.bundle.modules
|
162008
|
+
);
|
162007
162009
|
const entrypointNames = isPython ? [] : await getEntrypointNames(entrypointSource);
|
162008
162010
|
const modulesRoot = import_node_path19.default.dirname(scriptPath3);
|
162009
162011
|
const sourceOptions = {
|
@@ -162025,7 +162027,10 @@ async function buildSourceOptions(config) {
|
|
162025
162027
|
};
|
162026
162028
|
return { sourceOptions, entrypointNames };
|
162027
162029
|
} else {
|
162028
|
-
return {
|
162030
|
+
return {
|
162031
|
+
sourceOptions: { script: config.bundle.entrypointSource, scriptPath: scriptPath3 },
|
162032
|
+
entrypointNames: []
|
162033
|
+
};
|
162029
162034
|
}
|
162030
162035
|
}
|
162031
162036
|
__name(buildSourceOptions, "buildSourceOptions");
|
@@ -162073,7 +162078,7 @@ function buildMiniflareBindingOptions(config) {
|
|
162073
162078
|
const dataBlobBindings = { ...bindings.data_blobs };
|
162074
162079
|
const wasmBindings = { ...bindings.wasm_modules };
|
162075
162080
|
if (config.format === "service-worker" && config.bundle) {
|
162076
|
-
const scriptPath3 =
|
162081
|
+
const scriptPath3 = config.bundle.path;
|
162077
162082
|
const modulesRoot = import_node_path19.default.dirname(scriptPath3);
|
162078
162083
|
for (const { type, name } of config.bundle.modules) {
|
162079
162084
|
if (type === "text") {
|
@@ -162521,7 +162526,6 @@ async function localPropsToConfigBundle(props) {
|
|
162521
162526
|
compatibilityDate: props.compatibilityDate,
|
162522
162527
|
compatibilityFlags: props.compatibilityFlags,
|
162523
162528
|
inspectorPort: props.runtimeInspectorPort,
|
162524
|
-
usageModel: props.usageModel,
|
162525
162529
|
bindings: props.bindings,
|
162526
162530
|
workerDefinitions: props.workerDefinitions,
|
162527
162531
|
assetPaths: props.assetPaths,
|
@@ -162684,7 +162688,7 @@ var import_react16 = __toESM(require_react());
|
|
162684
162688
|
// src/deploy/deploy.ts
|
162685
162689
|
init_import_meta_url();
|
162686
162690
|
var import_node_assert17 = __toESM(require("node:assert"));
|
162687
|
-
var
|
162691
|
+
var import_node_fs32 = require("node:fs");
|
162688
162692
|
var import_node_path53 = __toESM(require("node:path"));
|
162689
162693
|
var import_node_url15 = require("node:url");
|
162690
162694
|
|
@@ -162741,19 +162745,19 @@ __name(printOffendingDependencies, "printOffendingDependencies");
|
|
162741
162745
|
// src/deployment-bundle/create-worker-upload-form.ts
|
162742
162746
|
init_import_meta_url();
|
162743
162747
|
var import_node_assert11 = __toESM(require("node:assert"));
|
162744
|
-
var
|
162748
|
+
var import_node_fs13 = require("node:fs");
|
162745
162749
|
var import_node_path24 = __toESM(require("node:path"));
|
162746
162750
|
var import_undici6 = __toESM(require_undici());
|
162747
162751
|
|
162748
162752
|
// src/deployment-bundle/capnp.ts
|
162749
162753
|
init_import_meta_url();
|
162750
162754
|
var import_node_child_process2 = require("node:child_process");
|
162751
|
-
var
|
162755
|
+
var import_node_fs12 = require("node:fs");
|
162752
162756
|
var import_node_path23 = require("node:path");
|
162753
162757
|
var import_command_exists = __toESM(require_command_exists2());
|
162754
162758
|
function handleUnsafeCapnp(capnp) {
|
162755
162759
|
if (capnp.compiled_schema) {
|
162756
|
-
return (0,
|
162760
|
+
return (0, import_node_fs12.readFileSync)((0, import_node_path23.resolve)(capnp.compiled_schema));
|
162757
162761
|
}
|
162758
162762
|
const { base_path, source_schemas } = capnp;
|
162759
162763
|
const capnpSchemas = (source_schemas ?? []).map(
|
@@ -162953,7 +162957,7 @@ function createWorkerUploadForm(worker) {
|
|
162953
162957
|
destination
|
162954
162958
|
});
|
162955
162959
|
});
|
162956
|
-
for (const [name,
|
162960
|
+
for (const [name, source] of Object.entries(bindings.wasm_modules || {})) {
|
162957
162961
|
metadataBindings.push({
|
162958
162962
|
name,
|
162959
162963
|
type: "wasm_module",
|
@@ -162961,9 +162965,13 @@ function createWorkerUploadForm(worker) {
|
|
162961
162965
|
});
|
162962
162966
|
formData.set(
|
162963
162967
|
name,
|
162964
|
-
new import_undici6.File(
|
162965
|
-
|
162966
|
-
|
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
|
+
)
|
162967
162975
|
);
|
162968
162976
|
}
|
162969
162977
|
if (bindings.browser !== void 0) {
|
@@ -162994,13 +163002,13 @@ function createWorkerUploadForm(worker) {
|
|
162994
163002
|
if (name !== "__STATIC_CONTENT_MANIFEST") {
|
162995
163003
|
formData.set(
|
162996
163004
|
name,
|
162997
|
-
new import_undici6.File([(0,
|
163005
|
+
new import_undici6.File([(0, import_node_fs13.readFileSync)(filePath)], filePath, {
|
162998
163006
|
type: "text/plain"
|
162999
163007
|
})
|
163000
163008
|
);
|
163001
163009
|
}
|
163002
163010
|
}
|
163003
|
-
for (const [name,
|
163011
|
+
for (const [name, source] of Object.entries(bindings.data_blobs || {})) {
|
163004
163012
|
metadataBindings.push({
|
163005
163013
|
name,
|
163006
163014
|
type: "data_blob",
|
@@ -163008,9 +163016,13 @@ function createWorkerUploadForm(worker) {
|
|
163008
163016
|
});
|
163009
163017
|
formData.set(
|
163010
163018
|
name,
|
163011
|
-
new import_undici6.File(
|
163012
|
-
|
163013
|
-
|
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
|
+
)
|
163014
163026
|
);
|
163015
163027
|
}
|
163016
163028
|
const manifestModuleName = "__STATIC_CONTENT_MANIFEST";
|
@@ -163132,7 +163144,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
163132
163144
|
|
163133
163145
|
// src/deployment-bundle/source-maps.ts
|
163134
163146
|
init_import_meta_url();
|
163135
|
-
var
|
163147
|
+
var import_node_fs14 = __toESM(require("node:fs"));
|
163136
163148
|
var import_node_path25 = __toESM(require("node:path"));
|
163137
163149
|
function loadSourceMaps(main2, modules, bundle) {
|
163138
163150
|
const { sourceMapPath, sourceMapMetadata } = bundle;
|
@@ -163148,7 +163160,7 @@ function loadSourceMap({ name, filePath }, sourceMapPath, { entryDirectory }) {
|
|
163148
163160
|
return [];
|
163149
163161
|
}
|
163150
163162
|
const map = JSON.parse(
|
163151
|
-
|
163163
|
+
import_node_fs14.default.readFileSync(import_node_path25.default.join(entryDirectory, sourceMapPath), "utf8")
|
163152
163164
|
);
|
163153
163165
|
map.file = name;
|
163154
163166
|
if (map.sourceRoot) {
|
@@ -163184,13 +163196,13 @@ function scanSourceMaps(modules) {
|
|
163184
163196
|
);
|
163185
163197
|
}
|
163186
163198
|
const wranglerPath = import_node_path25.default.join(import_node_path25.default.dirname(module3.filePath), commentPath);
|
163187
|
-
if (!
|
163199
|
+
if (!import_node_fs14.default.existsSync(wranglerPath)) {
|
163188
163200
|
throw new Error(
|
163189
163201
|
`Invalid source map path in ${module3.filePath}: ${wranglerPath} does not exist.`
|
163190
163202
|
);
|
163191
163203
|
}
|
163192
163204
|
const map = JSON.parse(
|
163193
|
-
|
163205
|
+
import_node_fs14.default.readFileSync(wranglerPath, "utf8")
|
163194
163206
|
);
|
163195
163207
|
map.file = module3.name;
|
163196
163208
|
if (map.sourceRoot) {
|
@@ -163230,7 +163242,7 @@ var import_undici23 = __toESM(require_undici());
|
|
163230
163242
|
|
163231
163243
|
// src/init.ts
|
163232
163244
|
init_import_meta_url();
|
163233
|
-
var
|
163245
|
+
var fs25 = __toESM(require("node:fs"));
|
163234
163246
|
var import_promises20 = require("node:fs/promises");
|
163235
163247
|
var import_node_path52 = __toESM(require("node:path"));
|
163236
163248
|
var import_toml7 = __toESM(require_toml());
|
@@ -163238,7 +163250,7 @@ init_execa();
|
|
163238
163250
|
|
163239
163251
|
// src/git-client.ts
|
163240
163252
|
init_import_meta_url();
|
163241
|
-
var
|
163253
|
+
var import_node_fs15 = __toESM(require("node:fs"));
|
163242
163254
|
var import_node_os7 = __toESM(require("node:os"));
|
163243
163255
|
var import_node_path26 = __toESM(require("node:path"));
|
163244
163256
|
init_execa();
|
@@ -163310,7 +163322,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163310
163322
|
args.push("-b", remote.substring(tagIndex + 1));
|
163311
163323
|
args.push(remote.substring(0, tagIndex));
|
163312
163324
|
}
|
163313
|
-
const tempDir =
|
163325
|
+
const tempDir = import_node_fs15.default.mkdtempSync(
|
163314
163326
|
import_node_path26.default.join(import_node_os7.default.tmpdir(), `wrangler-generate-repo-`)
|
163315
163327
|
);
|
163316
163328
|
args.push(tempDir);
|
@@ -163322,15 +163334,15 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163322
163334
|
}
|
163323
163335
|
const templatePath = subdirectory !== void 0 ? import_node_path26.default.join(tempDir, subdirectory) : tempDir;
|
163324
163336
|
try {
|
163325
|
-
|
163337
|
+
import_node_fs15.default.renameSync(templatePath, targetDirectory);
|
163326
163338
|
} catch (err) {
|
163327
163339
|
if (err.code !== "EXDEV") {
|
163328
163340
|
logger.debug(err);
|
163329
163341
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
163330
163342
|
}
|
163331
163343
|
try {
|
163332
|
-
|
163333
|
-
|
163344
|
+
import_node_fs15.default.cpSync(templatePath, targetDirectory, { recursive: true });
|
163345
|
+
import_node_fs15.default.rmSync(templatePath, {
|
163334
163346
|
recursive: true,
|
163335
163347
|
force: true
|
163336
163348
|
});
|
@@ -163339,7 +163351,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
163339
163351
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
163340
163352
|
}
|
163341
163353
|
}
|
163342
|
-
|
163354
|
+
import_node_fs15.default.rmSync(import_node_path26.default.join(targetDirectory, ".git"), {
|
163343
163355
|
recursive: true,
|
163344
163356
|
force: true
|
163345
163357
|
});
|
@@ -163348,7 +163360,7 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
|
|
163348
163360
|
|
163349
163361
|
// src/package-manager.ts
|
163350
163362
|
init_import_meta_url();
|
163351
|
-
var
|
163363
|
+
var import_node_fs16 = require("node:fs");
|
163352
163364
|
var import_node_path27 = require("node:path");
|
163353
163365
|
var import_node_process6 = require("node:process");
|
163354
163366
|
init_execa();
|
@@ -163358,9 +163370,9 @@ async function getPackageManager2(cwd2) {
|
|
163358
163370
|
supportsNpm(),
|
163359
163371
|
supportsPnpm()
|
163360
163372
|
]);
|
163361
|
-
const hasYarnLock = (0,
|
163362
|
-
const hasNpmLock = (0,
|
163363
|
-
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"));
|
163364
163376
|
const userAgent = sniffUserAgent();
|
163365
163377
|
if (hasNpmLock) {
|
163366
163378
|
if (hasNpm) {
|
@@ -172165,7 +172177,7 @@ var handler11 = withConfig(
|
|
172165
172177
|
|
172166
172178
|
// src/constellation/uploadModel.tsx
|
172167
172179
|
init_import_meta_url();
|
172168
|
-
var
|
172180
|
+
var import_node_fs17 = require("node:fs");
|
172169
172181
|
var import_undici9 = __toESM(require_undici());
|
172170
172182
|
function options11(yargs) {
|
172171
172183
|
return yargs.positional("projectName", {
|
@@ -172202,7 +172214,7 @@ var handler12 = withConfig(
|
|
172202
172214
|
const formData = new import_undici9.FormData();
|
172203
172215
|
formData.set(
|
172204
172216
|
"file",
|
172205
|
-
new import_undici9.File([(0,
|
172217
|
+
new import_undici9.File([(0, import_node_fs17.readFileSync)(modelFile)], modelFile, {
|
172206
172218
|
type: "application/octet-stream"
|
172207
172219
|
})
|
172208
172220
|
);
|
@@ -176604,7 +176616,7 @@ init_import_meta_url();
|
|
176604
176616
|
// src/d1/migrations/apply.tsx
|
176605
176617
|
init_import_meta_url();
|
176606
176618
|
var import_node_assert13 = __toESM(require("node:assert"));
|
176607
|
-
var
|
176619
|
+
var import_node_fs19 = __toESM(require("node:fs"));
|
176608
176620
|
var import_path9 = __toESM(require("path"));
|
176609
176621
|
var import_ink4 = __toESM(require_build2());
|
176610
176622
|
var import_ink_table5 = __toESM(require_dist4());
|
@@ -176612,7 +176624,7 @@ var import_react7 = __toESM(require_react());
|
|
176612
176624
|
|
176613
176625
|
// src/d1/migrations/helpers.ts
|
176614
176626
|
init_import_meta_url();
|
176615
|
-
var
|
176627
|
+
var import_node_fs18 = __toESM(require("node:fs"));
|
176616
176628
|
var import_path8 = __toESM(require("path"));
|
176617
176629
|
async function getMigrationsPath({
|
176618
176630
|
projectPath,
|
@@ -176620,13 +176632,13 @@ async function getMigrationsPath({
|
|
176620
176632
|
createIfMissing
|
176621
176633
|
}) {
|
176622
176634
|
const dir = import_path8.default.resolve(projectPath, migrationsFolderPath);
|
176623
|
-
if (
|
176635
|
+
if (import_node_fs18.default.existsSync(dir)) {
|
176624
176636
|
return dir;
|
176625
176637
|
}
|
176626
176638
|
const warning = `No migrations folder found.${migrationsFolderPath === DEFAULT_MIGRATION_PATH ? " Set `migrations_dir` in wrangler.toml to choose a different path." : ""}`;
|
176627
176639
|
if (createIfMissing && await confirm(`${warning}
|
176628
176640
|
Ok to create ${dir}?`)) {
|
176629
|
-
|
176641
|
+
import_node_fs18.default.mkdirSync(dir, { recursive: true });
|
176630
176642
|
return dir;
|
176631
176643
|
} else {
|
176632
176644
|
logger.warn(warning);
|
@@ -176695,7 +176707,7 @@ var listAppliedMigrations = /* @__PURE__ */ __name(async ({
|
|
176695
176707
|
}, "listAppliedMigrations");
|
176696
176708
|
function getMigrationNames(migrationsPath) {
|
176697
176709
|
const migrations = [];
|
176698
|
-
const dir =
|
176710
|
+
const dir = import_node_fs18.default.opendirSync(migrationsPath);
|
176699
176711
|
let dirent;
|
176700
176712
|
while ((dirent = dir.readSync()) !== null) {
|
176701
176713
|
if (dirent.name.endsWith(".sql")) {
|
@@ -176859,7 +176871,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
176859
176871
|
}
|
176860
176872
|
}
|
176861
176873
|
for (const migration of unappliedMigrations) {
|
176862
|
-
let query =
|
176874
|
+
let query = import_node_fs19.default.readFileSync(
|
176863
176875
|
`${migrationsPath}/${migration.name}`,
|
176864
176876
|
"utf8"
|
176865
176877
|
);
|
@@ -176925,7 +176937,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
176925
176937
|
|
176926
176938
|
// src/d1/migrations/create.tsx
|
176927
176939
|
init_import_meta_url();
|
176928
|
-
var
|
176940
|
+
var import_node_fs20 = __toESM(require("node:fs"));
|
176929
176941
|
var import_path10 = __toESM(require("path"));
|
176930
176942
|
var import_ink5 = __toESM(require_build2());
|
176931
176943
|
var import_react8 = __toESM(require_react());
|
@@ -176957,7 +176969,7 @@ var CreateHandler2 = withConfig(
|
|
176957
176969
|
const nextMigrationNumber = pad(getNextMigrationNumber(migrationsPath), 4);
|
176958
176970
|
const migrationName = message.replaceAll(" ", "_");
|
176959
176971
|
const newMigrationName = `${nextMigrationNumber}_${migrationName}.sql`;
|
176960
|
-
|
176972
|
+
import_node_fs20.default.writeFileSync(
|
176961
176973
|
`${migrationsPath}/${newMigrationName}`,
|
176962
176974
|
`-- Migration number: ${nextMigrationNumber} ${(/* @__PURE__ */ new Date()).toISOString()}
|
176963
176975
|
`
|
@@ -177613,7 +177625,7 @@ var import_undici13 = __toESM(require_undici());
|
|
177613
177625
|
// src/metrics/metrics-config.ts
|
177614
177626
|
init_import_meta_url();
|
177615
177627
|
var import_node_crypto5 = require("node:crypto");
|
177616
|
-
var
|
177628
|
+
var import_node_fs21 = require("node:fs");
|
177617
177629
|
var import_node_path30 = __toESM(require("node:path"));
|
177618
177630
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
177619
177631
|
var USER_ID_CACHE_PATH = "user-id.json";
|
@@ -177676,8 +177688,8 @@ async function getMetricsConfig({
|
|
177676
177688
|
}
|
177677
177689
|
__name(getMetricsConfig, "getMetricsConfig");
|
177678
177690
|
function writeMetricsConfig(config) {
|
177679
|
-
(0,
|
177680
|
-
(0,
|
177691
|
+
(0, import_node_fs21.mkdirSync)(import_node_path30.default.dirname(getMetricsConfigPath()), { recursive: true });
|
177692
|
+
(0, import_node_fs21.writeFileSync)(
|
177681
177693
|
getMetricsConfigPath(),
|
177682
177694
|
JSON.stringify(
|
177683
177695
|
config,
|
@@ -177689,7 +177701,7 @@ function writeMetricsConfig(config) {
|
|
177689
177701
|
__name(writeMetricsConfig, "writeMetricsConfig");
|
177690
177702
|
function readMetricsConfig() {
|
177691
177703
|
try {
|
177692
|
-
const config = (0,
|
177704
|
+
const config = (0, import_node_fs21.readFileSync)(getMetricsConfigPath(), "utf8");
|
177693
177705
|
return JSON.parse(
|
177694
177706
|
config,
|
177695
177707
|
(key, value) => key === "date" ? new Date(value) : value
|
@@ -178972,7 +178984,7 @@ __name(docsHandler, "docsHandler");
|
|
178972
178984
|
|
178973
178985
|
// src/generate/index.ts
|
178974
178986
|
init_import_meta_url();
|
178975
|
-
var
|
178987
|
+
var import_node_fs22 = __toESM(require("node:fs"));
|
178976
178988
|
var import_node_path32 = __toESM(require("node:path"));
|
178977
178989
|
function generateOptions(yargs) {
|
178978
178990
|
return yargs.positional("name", {
|
@@ -179055,7 +179067,7 @@ __name(generateHandler2, "generateHandler");
|
|
179055
179067
|
function generateWorkerDirectoryName(workerName) {
|
179056
179068
|
let workerDirectoryPath = import_node_path32.default.resolve(process.cwd(), workerName);
|
179057
179069
|
let i = 1;
|
179058
|
-
while (
|
179070
|
+
while (import_node_fs22.default.existsSync(workerDirectoryPath)) {
|
179059
179071
|
workerDirectoryPath = import_node_path32.default.resolve(process.cwd(), `${workerName}-${i}`);
|
179060
179072
|
i++;
|
179061
179073
|
}
|
@@ -180222,13 +180234,13 @@ init_import_meta_url();
|
|
180222
180234
|
// src/pages/build.ts
|
180223
180235
|
init_import_meta_url();
|
180224
180236
|
var import_node_crypto6 = require("node:crypto");
|
180225
|
-
var
|
180237
|
+
var import_node_fs25 = require("node:fs");
|
180226
180238
|
var import_promises13 = require("node:fs/promises");
|
180227
180239
|
var import_node_path41 = __toESM(require("node:path"));
|
180228
180240
|
|
180229
180241
|
// src/api/pages/create-worker-bundle-contents.ts
|
180230
180242
|
init_import_meta_url();
|
180231
|
-
var
|
180243
|
+
var import_node_fs23 = require("node:fs");
|
180232
180244
|
var import_node_path33 = __toESM(require("node:path"));
|
180233
180245
|
var import_undici15 = __toESM(require_undici());
|
180234
180246
|
async function createUploadWorkerBundleContents(workerBundle, config) {
|
@@ -180245,7 +180257,7 @@ function createWorkerBundleFormData(workerBundle, config) {
|
|
180245
180257
|
const mainModule = {
|
180246
180258
|
name: import_node_path33.default.basename(workerBundle.resolvedEntryPointPath),
|
180247
180259
|
filePath: workerBundle.resolvedEntryPointPath,
|
180248
|
-
content: (0,
|
180260
|
+
content: (0, import_node_fs23.readFileSync)(workerBundle.resolvedEntryPointPath, {
|
180249
180261
|
encoding: "utf-8"
|
180250
180262
|
}),
|
180251
180263
|
type: workerBundle.bundleType || "esm"
|
@@ -180300,7 +180312,7 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
|
|
180300
180312
|
|
180301
180313
|
// src/pages/buildFunctions.ts
|
180302
180314
|
init_import_meta_url();
|
180303
|
-
var
|
180315
|
+
var import_node_fs24 = require("node:fs");
|
180304
180316
|
var import_node_path40 = require("node:path");
|
180305
180317
|
|
180306
180318
|
// src/pages/functions/buildPlugin.ts
|
@@ -181285,10 +181297,10 @@ async function buildFunctions({
|
|
181285
181297
|
}
|
181286
181298
|
if (routesOutputPath) {
|
181287
181299
|
const routesJSON = convertRoutesToRoutesJSONSpec(config.routes);
|
181288
|
-
(0,
|
181300
|
+
(0, import_node_fs24.writeFileSync)(routesOutputPath, JSON.stringify(routesJSON, null, 2));
|
181289
181301
|
}
|
181290
181302
|
if (outputConfigPath) {
|
181291
|
-
(0,
|
181303
|
+
(0, import_node_fs24.writeFileSync)(
|
181292
181304
|
outputConfigPath,
|
181293
181305
|
JSON.stringify({ ...config, baseURL }, null, 2)
|
181294
181306
|
);
|
@@ -181486,7 +181498,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181486
181498
|
}
|
181487
181499
|
}
|
181488
181500
|
if (outfile && outfile !== bundle.resolvedEntryPointPath) {
|
181489
|
-
(0,
|
181501
|
+
(0, import_node_fs25.writeFileSync)(
|
181490
181502
|
outfile,
|
181491
181503
|
`export { default } from './${(0, import_node_path41.relative)(
|
181492
181504
|
(0, import_node_path41.dirname)(outfile),
|
@@ -181517,7 +181529,7 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181517
181529
|
external
|
181518
181530
|
} = validatedArgs;
|
181519
181531
|
if (workerScriptPath) {
|
181520
|
-
if ((0,
|
181532
|
+
if ((0, import_node_fs25.lstatSync)(workerScriptPath).isDirectory()) {
|
181521
181533
|
bundle = await produceWorkerBundleForWorkerJSDirectory({
|
181522
181534
|
workerJSDirectory: workerScriptPath,
|
181523
181535
|
bundle: true,
|
@@ -181576,14 +181588,14 @@ var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
181576
181588
|
bundle,
|
181577
181589
|
config
|
181578
181590
|
);
|
181579
|
-
(0,
|
181580
|
-
(0,
|
181591
|
+
(0, import_node_fs25.mkdirSync)((0, import_node_path41.dirname)(outfile), { recursive: true });
|
181592
|
+
(0, import_node_fs25.writeFileSync)(
|
181581
181593
|
outfile,
|
181582
181594
|
Buffer.from(await workerBundleContents.arrayBuffer())
|
181583
181595
|
);
|
181584
181596
|
}
|
181585
181597
|
if (buildMetadataPath && buildMetadata) {
|
181586
|
-
(0,
|
181598
|
+
(0, import_node_fs25.writeFileSync)(buildMetadataPath, JSON.stringify(buildMetadata));
|
181587
181599
|
}
|
181588
181600
|
}
|
181589
181601
|
await sendMetricsEvent("build pages functions");
|
@@ -181593,7 +181605,7 @@ async function maybeReadPagesConfig(args) {
|
|
181593
181605
|
return;
|
181594
181606
|
}
|
181595
181607
|
const configPath = import_node_path41.default.resolve(args.projectDirectory, "wrangler.toml");
|
181596
|
-
if (!(0,
|
181608
|
+
if (!(0, import_node_fs25.existsSync)(configPath)) {
|
181597
181609
|
return void 0;
|
181598
181610
|
}
|
181599
181611
|
try {
|
@@ -181686,10 +181698,10 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
181686
181698
|
args.buildOutputDirectory,
|
181687
181699
|
"_worker.js"
|
181688
181700
|
);
|
181689
|
-
const foundWorkerScript = (0,
|
181701
|
+
const foundWorkerScript = (0, import_node_fs25.existsSync)(prospectiveWorkerScriptPath);
|
181690
181702
|
if (foundWorkerScript) {
|
181691
181703
|
workerScriptPath = prospectiveWorkerScriptPath;
|
181692
|
-
} else if (!foundWorkerScript && !(0,
|
181704
|
+
} else if (!foundWorkerScript && !(0, import_node_fs25.existsSync)(args.directory)) {
|
181693
181705
|
throw new FatalError(
|
181694
181706
|
`Could not find anything to build.
|
181695
181707
|
We first looked inside the build output directory (${(0, import_node_path41.basename)(
|
@@ -181702,7 +181714,7 @@ We first looked inside the build output directory (${(0, import_node_path41.base
|
|
181702
181714
|
EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR
|
181703
181715
|
);
|
181704
181716
|
}
|
181705
|
-
} else if (!(0,
|
181717
|
+
} else if (!(0, import_node_fs25.existsSync)(args.directory)) {
|
181706
181718
|
throw new FatalError(
|
181707
181719
|
`Could not find anything to build.
|
181708
181720
|
We looked for the Functions directory (${(0, import_node_path41.basename)(
|
@@ -181731,7 +181743,7 @@ We looked for the Functions directory (${(0, import_node_path41.basename)(
|
|
181731
181743
|
|
181732
181744
|
// src/pages/build-env.ts
|
181733
181745
|
init_import_meta_url();
|
181734
|
-
var
|
181746
|
+
var import_node_fs26 = require("node:fs");
|
181735
181747
|
var import_node_path42 = __toESM(require("node:path"));
|
181736
181748
|
function Options9(yargs) {
|
181737
181749
|
return yargs.positional("projectDir", {
|
@@ -181756,7 +181768,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
181756
181768
|
"Checking for configuration in a wrangler.toml configuration file (BETA)\n"
|
181757
181769
|
);
|
181758
181770
|
const configPath = import_node_path42.default.resolve(args.projectDir, "wrangler.toml");
|
181759
|
-
if (!(0,
|
181771
|
+
if (!(0, import_node_fs26.existsSync)(configPath)) {
|
181760
181772
|
logger.debug("No wrangler.toml configuration file found. Exiting.");
|
181761
181773
|
process.exitCode = EXIT_CODE_NO_CONFIG_FOUND;
|
181762
181774
|
return;
|
@@ -181791,7 +181803,7 @@ var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
181791
181803
|
config.pages_build_output_dir
|
181792
181804
|
)
|
181793
181805
|
};
|
181794
|
-
(0,
|
181806
|
+
(0, import_node_fs26.writeFileSync)(args.outfile, JSON.stringify(buildConfiguration));
|
181795
181807
|
logger.debug(`Build configuration written to ${args.outfile}`);
|
181796
181808
|
logger.debug(JSON.stringify(buildConfiguration), null, 2);
|
181797
181809
|
const vars = Object.entries(buildConfiguration.vars);
|
@@ -181815,7 +181827,7 @@ var import_react13 = __toESM(require_react());
|
|
181815
181827
|
// src/api/pages/deploy.tsx
|
181816
181828
|
init_import_meta_url();
|
181817
181829
|
var import_node_crypto7 = require("node:crypto");
|
181818
|
-
var
|
181830
|
+
var import_node_fs27 = require("node:fs");
|
181819
181831
|
var import_promises16 = require("node:fs/promises");
|
181820
181832
|
var import_node_path45 = __toESM(require("node:path"));
|
181821
181833
|
var import_node_process11 = require("node:process");
|
@@ -182701,21 +182713,21 @@ async function deploy2({
|
|
182701
182713
|
bundle = bundle ?? true;
|
182702
182714
|
const _workerPath = (0, import_node_path45.resolve)(directory, "_worker.js");
|
182703
182715
|
try {
|
182704
|
-
_headers = (0,
|
182716
|
+
_headers = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_headers"), "utf-8");
|
182705
182717
|
} catch {
|
182706
182718
|
}
|
182707
182719
|
try {
|
182708
|
-
_redirects = (0,
|
182720
|
+
_redirects = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_redirects"), "utf-8");
|
182709
182721
|
} catch {
|
182710
182722
|
}
|
182711
182723
|
try {
|
182712
|
-
_routesCustom = (0,
|
182724
|
+
_routesCustom = (0, import_node_fs27.readFileSync)((0, import_node_path45.join)(directory, "_routes.json"), "utf-8");
|
182713
182725
|
} catch {
|
182714
182726
|
}
|
182715
182727
|
try {
|
182716
|
-
_workerJSIsDirectory = (0,
|
182728
|
+
_workerJSIsDirectory = (0, import_node_fs27.lstatSync)(_workerPath).isDirectory();
|
182717
182729
|
if (!_workerJSIsDirectory) {
|
182718
|
-
_workerJS = (0,
|
182730
|
+
_workerJS = (0, import_node_fs27.readFileSync)(_workerPath, "utf-8");
|
182719
182731
|
}
|
182720
182732
|
} catch {
|
182721
182733
|
}
|
@@ -182748,9 +182760,9 @@ async function deploy2({
|
|
182748
182760
|
let builtFunctions = void 0;
|
182749
182761
|
let workerBundle = void 0;
|
182750
182762
|
const functionsDirectory = customFunctionsDirectory || (0, import_node_path45.join)((0, import_node_process11.cwd)(), "functions");
|
182751
|
-
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;
|
182752
182764
|
let filepathRoutingConfig;
|
182753
|
-
if (!_workerJS && (0,
|
182765
|
+
if (!_workerJS && (0, import_node_fs27.existsSync)(functionsDirectory)) {
|
182754
182766
|
const outputConfigPath = (0, import_node_path45.join)(
|
182755
182767
|
getPagesTmpDir(),
|
182756
182768
|
`functions-filepath-routing-config-${Math.random()}.json`
|
@@ -182767,11 +182779,11 @@ async function deploy2({
|
|
182767
182779
|
nodejsCompat,
|
182768
182780
|
defineNavigatorUserAgent
|
182769
182781
|
});
|
182770
|
-
builtFunctions = (0,
|
182782
|
+
builtFunctions = (0, import_node_fs27.readFileSync)(
|
182771
182783
|
workerBundle.resolvedEntryPointPath,
|
182772
182784
|
"utf-8"
|
182773
182785
|
);
|
182774
|
-
filepathRoutingConfig = (0,
|
182786
|
+
filepathRoutingConfig = (0, import_node_fs27.readFileSync)(outputConfigPath, "utf-8");
|
182775
182787
|
} catch (e3) {
|
182776
182788
|
if (e3 instanceof FunctionsNoRoutesError) {
|
182777
182789
|
logger.warn(
|
@@ -182919,7 +182931,7 @@ async function deploy2({
|
|
182919
182931
|
}
|
182920
182932
|
} else if (routesOutputPath) {
|
182921
182933
|
try {
|
182922
|
-
_routesGenerated = (0,
|
182934
|
+
_routesGenerated = (0, import_node_fs27.readFileSync)(routesOutputPath, "utf-8");
|
182923
182935
|
if (_routesGenerated) {
|
182924
182936
|
formData.append(
|
182925
182937
|
"_routes.json",
|
@@ -184168,7 +184180,7 @@ __name(ListHandler4, "ListHandler");
|
|
184168
184180
|
// src/pages/dev.ts
|
184169
184181
|
init_import_meta_url();
|
184170
184182
|
var import_node_child_process5 = require("node:child_process");
|
184171
|
-
var
|
184183
|
+
var import_node_fs28 = require("node:fs");
|
184172
184184
|
var import_node_path46 = require("node:path");
|
184173
184185
|
var import_chokidar2 = require("chokidar");
|
184174
184186
|
var esbuild3 = __toESM(require("esbuild"));
|
@@ -184440,11 +184452,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184440
184452
|
);
|
184441
184453
|
const singleWorkerScriptPath = args.scriptPath ?? DEFAULT_SCRIPT_PATH;
|
184442
184454
|
const workerScriptPath = directory !== void 0 ? (0, import_node_path46.join)(directory, singleWorkerScriptPath) : (0, import_node_path46.resolve)(singleWorkerScriptPath);
|
184443
|
-
const usingWorkerDirectory = (0,
|
184444
|
-
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);
|
184445
184457
|
const enableBundling = args.bundle ?? !args.noBundle;
|
184446
184458
|
const functionsDirectory = "./functions";
|
184447
|
-
let usingFunctions = !usingWorkerScript && (0,
|
184459
|
+
let usingFunctions = !usingWorkerScript && (0, import_node_fs28.existsSync)(functionsDirectory);
|
184448
184460
|
let scriptPath3 = "";
|
184449
184461
|
const legacyNodeCompat = args.nodeCompat;
|
184450
184462
|
const nodejsCompat = compatibilityFlags?.includes("nodejs_compat") ?? false;
|
@@ -184608,7 +184620,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184608
184620
|
let scriptEntrypoint = scriptPath3;
|
184609
184621
|
if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
|
184610
184622
|
const routesJSONPath = (0, import_node_path46.join)(directory, "_routes.json");
|
184611
|
-
if ((0,
|
184623
|
+
if ((0, import_node_fs28.existsSync)(routesJSONPath)) {
|
184612
184624
|
let routesJSONContents;
|
184613
184625
|
const runBuild = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
|
184614
184626
|
await esbuild3.build({
|
@@ -184634,7 +184646,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184634
184646
|
});
|
184635
184647
|
}, "runBuild");
|
184636
184648
|
try {
|
184637
|
-
routesJSONContents = (0,
|
184649
|
+
routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
|
184638
184650
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
184639
184651
|
scriptEntrypoint = (0, import_node_path46.join)(
|
184640
184652
|
getPagesTmpDir(),
|
@@ -184659,7 +184671,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
184659
184671
|
if (event === "unlink") {
|
184660
184672
|
return;
|
184661
184673
|
}
|
184662
|
-
routesJSONContents = (0,
|
184674
|
+
routesJSONContents = (0, import_node_fs28.readFileSync)(routesJSONPath, "utf-8");
|
184663
184675
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
184664
184676
|
await runBuild(scriptPath3, scriptEntrypoint, routesJSONContents);
|
184665
184677
|
} catch (err) {
|
@@ -185153,7 +185165,7 @@ var Handler15 = /* @__PURE__ */ __name(async ({ projectName, force }) => {
|
|
185153
185165
|
|
185154
185166
|
// src/pages/functions.ts
|
185155
185167
|
init_import_meta_url();
|
185156
|
-
var
|
185168
|
+
var import_node_fs29 = require("node:fs");
|
185157
185169
|
var import_node_path47 = __toESM(require("node:path"));
|
185158
185170
|
function OptimizeRoutesOptions(yargs) {
|
185159
185171
|
return yargs.options({
|
@@ -185177,20 +185189,20 @@ async function OptimizeRoutesHandler({
|
|
185177
185189
|
}) {
|
185178
185190
|
let routesFileContents;
|
185179
185191
|
const routesOutputDirectory = import_node_path47.default.dirname(outputRoutesPath);
|
185180
|
-
if (!(0,
|
185192
|
+
if (!(0, import_node_fs29.existsSync)(routesPath)) {
|
185181
185193
|
throw new FatalError(
|
185182
185194
|
`Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
|
185183
185195
|
1
|
185184
185196
|
);
|
185185
185197
|
}
|
185186
|
-
if (!(0,
|
185198
|
+
if (!(0, import_node_fs29.existsSync)(routesOutputDirectory) || !(0, import_node_fs29.lstatSync)(routesOutputDirectory).isDirectory()) {
|
185187
185199
|
throw new FatalError(
|
185188
185200
|
`Oops! Folder ${routesOutputDirectory} does not exist. Please make sure --output-routes-path is a valid file path (for example "/public/_routes.json").`,
|
185189
185201
|
1
|
185190
185202
|
);
|
185191
185203
|
}
|
185192
185204
|
try {
|
185193
|
-
routesFileContents = (0,
|
185205
|
+
routesFileContents = (0, import_node_fs29.readFileSync)(routesPath, "utf-8");
|
185194
185206
|
} catch (err) {
|
185195
185207
|
throw new FatalError(`Error while reading ${routesPath} file: ${err}`);
|
185196
185208
|
}
|
@@ -185199,7 +185211,7 @@ async function OptimizeRoutesHandler({
|
|
185199
185211
|
const optimizedRoutes = optimizeRoutesJSONSpec(routes);
|
185200
185212
|
const optimizedRoutesContents = JSON.stringify(optimizedRoutes);
|
185201
185213
|
try {
|
185202
|
-
(0,
|
185214
|
+
(0, import_node_fs29.writeFileSync)(outputRoutesPath, optimizedRoutesContents);
|
185203
185215
|
} catch (err) {
|
185204
185216
|
throw new FatalError(
|
185205
185217
|
`Error writing to ${outputRoutesPath} file: ${err}`,
|
@@ -186857,7 +186869,7 @@ __name(queues, "queues");
|
|
186857
186869
|
// src/r2/index.ts
|
186858
186870
|
init_import_meta_url();
|
186859
186871
|
var import_node_buffer5 = require("node:buffer");
|
186860
|
-
var
|
186872
|
+
var fs23 = __toESM(require("node:fs"));
|
186861
186873
|
var path50 = __toESM(require("node:path"));
|
186862
186874
|
var stream = __toESM(require("node:stream"));
|
186863
186875
|
var import_web = require("node:stream/web");
|
@@ -187522,7 +187534,7 @@ __name(DisableHandler, "DisableHandler");
|
|
187522
187534
|
// src/r2/index.ts
|
187523
187535
|
var CHUNK_SIZE = 1024;
|
187524
187536
|
async function createFileReadableStream(filePath) {
|
187525
|
-
const handle = await
|
187537
|
+
const handle = await fs23.promises.open(filePath, "r");
|
187526
187538
|
let position = 0;
|
187527
187539
|
return new import_web.ReadableStream({
|
187528
187540
|
async pull(controller) {
|
@@ -187593,8 +187605,8 @@ function r22(r2Yargs) {
|
|
187593
187605
|
}
|
187594
187606
|
let output;
|
187595
187607
|
if (file) {
|
187596
|
-
|
187597
|
-
output =
|
187608
|
+
fs23.mkdirSync(path50.dirname(file), { recursive: true });
|
187609
|
+
output = fs23.createWriteStream(file);
|
187598
187610
|
} else {
|
187599
187611
|
output = process.stdout;
|
187600
187612
|
}
|
@@ -187717,7 +187729,7 @@ function r22(r2Yargs) {
|
|
187717
187729
|
let objectSize;
|
187718
187730
|
if (file) {
|
187719
187731
|
object = await createFileReadableStream(file);
|
187720
|
-
const stats =
|
187732
|
+
const stats = fs23.statSync(file);
|
187721
187733
|
objectSize = stats.size;
|
187722
187734
|
} else {
|
187723
187735
|
const buffer = await new Promise((resolve19, reject) => {
|
@@ -198227,7 +198239,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
198227
198239
|
|
198228
198240
|
// src/type-generation.ts
|
198229
198241
|
init_import_meta_url();
|
198230
|
-
var
|
198242
|
+
var fs24 = __toESM(require("node:fs"));
|
198231
198243
|
|
198232
198244
|
// src/dev/dev-vars.ts
|
198233
198245
|
init_import_meta_url();
|
@@ -198281,7 +198293,7 @@ async function typesHandler(args) {
|
|
198281
198293
|
}
|
198282
198294
|
await printWranglerBanner();
|
198283
198295
|
const configPath = args.config ?? findWranglerToml(process.cwd(), args.experimentalJsonConfig);
|
198284
|
-
if (!configPath || !
|
198296
|
+
if (!configPath || !fs24.existsSync(configPath) || fs24.statSync(configPath).isDirectory()) {
|
198285
198297
|
logger.warn(
|
198286
198298
|
`No config file detected${args.config ? ` (at ${args.config})` : ""}, aborting`
|
198287
198299
|
);
|
@@ -198523,7 +198535,7 @@ function writeDTSFile({
|
|
198523
198535
|
}) {
|
198524
198536
|
const wranglerOverrideDTSPath = findUpSync(path67);
|
198525
198537
|
try {
|
198526
|
-
if (wranglerOverrideDTSPath !== void 0 && !
|
198538
|
+
if (wranglerOverrideDTSPath !== void 0 && !fs24.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
198527
198539
|
throw new UserError(
|
198528
198540
|
`A non-wrangler ${path67} already exists, please rename and try again.`
|
198529
198541
|
);
|
@@ -198549,7 +198561,7 @@ ${modulesTypeStructure.join("\n")}`;
|
|
198549
198561
|
const wranglerCommandUsed = ["wrangler", ...process.argv.slice(2)].join(" ");
|
198550
198562
|
const typesHaveBeenFound = envTypeStructure.length || modulesTypeStructure.length;
|
198551
198563
|
if (formatType === "modules" || typesHaveBeenFound) {
|
198552
|
-
|
198564
|
+
fs24.writeFileSync(
|
198553
198565
|
path67,
|
198554
198566
|
[
|
198555
198567
|
`// Generated by Wrangler on ${/* @__PURE__ */ new Date()}`,
|
@@ -198798,7 +198810,7 @@ __name(handler27, "handler");
|
|
198798
198810
|
|
198799
198811
|
// src/vectorize/insert.ts
|
198800
198812
|
init_import_meta_url();
|
198801
|
-
var
|
198813
|
+
var import_node_fs30 = require("node:fs");
|
198802
198814
|
var import_node_readline4 = require("node:readline");
|
198803
198815
|
var import_undici21 = __toESM(require_undici());
|
198804
198816
|
var VECTORIZE_MAX_BATCH_SIZE = 1e3;
|
@@ -198830,7 +198842,7 @@ function options27(yargs) {
|
|
198830
198842
|
__name(options27, "options");
|
198831
198843
|
async function handler28(args) {
|
198832
198844
|
const config = readConfig(args.config, args);
|
198833
|
-
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) });
|
198834
198846
|
if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
|
198835
198847
|
logger.error(
|
198836
198848
|
`\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time.`
|
@@ -199636,7 +199648,7 @@ __name(formatTrigger, "formatTrigger");
|
|
199636
199648
|
|
199637
199649
|
// src/versions/upload.ts
|
199638
199650
|
init_import_meta_url();
|
199639
|
-
var
|
199651
|
+
var import_node_fs31 = require("node:fs");
|
199640
199652
|
var import_node_path50 = __toESM(require("node:path"));
|
199641
199653
|
var import_node_url14 = require("node:url");
|
199642
199654
|
|
@@ -199811,9 +199823,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199811
199823
|
);
|
199812
199824
|
}
|
199813
199825
|
if (props.outDir) {
|
199814
|
-
(0,
|
199826
|
+
(0, import_node_fs31.mkdirSync)(props.outDir, { recursive: true });
|
199815
199827
|
const readmePath = import_node_path50.default.join(props.outDir, "README.md");
|
199816
|
-
(0,
|
199828
|
+
(0, import_node_fs31.writeFileSync)(
|
199817
199829
|
readmePath,
|
199818
199830
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
199819
199831
|
);
|
@@ -199841,10 +199853,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199841
199853
|
try {
|
199842
199854
|
if (props.noBundle) {
|
199843
199855
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
199844
|
-
(0,
|
199845
|
-
(0,
|
199856
|
+
(0, import_node_fs31.mkdirSync)(destinationDir, { recursive: true });
|
199857
|
+
(0, import_node_fs31.writeFileSync)(
|
199846
199858
|
import_node_path50.default.join(destinationDir, import_node_path50.default.basename(props.entry.file)),
|
199847
|
-
(0,
|
199859
|
+
(0, import_node_fs31.readFileSync)(props.entry.file, "utf-8")
|
199848
199860
|
);
|
199849
199861
|
}
|
199850
199862
|
const entryDirectory = import_node_path50.default.dirname(props.entry.file);
|
@@ -199903,7 +199915,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
199903
199915
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
199904
199916
|
dependencies[modulePath] = { bytesInOutput };
|
199905
199917
|
}
|
199906
|
-
const content = (0,
|
199918
|
+
const content = (0, import_node_fs31.readFileSync)(resolvedEntryPointPath, {
|
199907
199919
|
encoding: "utf-8"
|
199908
199920
|
});
|
199909
199921
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
@@ -201464,7 +201476,7 @@ The \`init\` command will be removed in a future version.`
|
|
201464
201476
|
}
|
201465
201477
|
}
|
201466
201478
|
}
|
201467
|
-
if (
|
201479
|
+
if (fs25.existsSync(wranglerTomlDestination)) {
|
201468
201480
|
let shouldContinue = false;
|
201469
201481
|
logger.warn(
|
201470
201482
|
`${import_node_path52.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
@@ -201670,7 +201682,7 @@ ${err.message ?? err}`
|
|
201670
201682
|
compatibility_date: parsedWranglerToml.compatibility_date,
|
201671
201683
|
...extraToml
|
201672
201684
|
};
|
201673
|
-
|
201685
|
+
fs25.writeFileSync(wranglerTomlDestination, import_toml7.default.stringify(newToml));
|
201674
201686
|
}
|
201675
201687
|
const isNamedWorker = isCreatingWranglerToml && import_node_path52.default.dirname(packagePath) !== process.cwd();
|
201676
201688
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
@@ -201713,7 +201725,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
201713
201725
|
}
|
201714
201726
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
201715
201727
|
if (isTypescriptProject) {
|
201716
|
-
if (!
|
201728
|
+
if (!fs25.existsSync(import_node_path52.default.join(creationDirectory, "./src/index.ts"))) {
|
201717
201729
|
const newWorkerFilename = import_node_path52.default.relative(
|
201718
201730
|
process.cwd(),
|
201719
201731
|
import_node_path52.default.join(creationDirectory, "./src/index.ts")
|
@@ -201771,7 +201783,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
201771
201783
|
}
|
201772
201784
|
}
|
201773
201785
|
} else {
|
201774
|
-
if (!
|
201786
|
+
if (!fs25.existsSync(import_node_path52.default.join(creationDirectory, "./src/index.js"))) {
|
201775
201787
|
const newWorkerFilename = import_node_path52.default.relative(
|
201776
201788
|
process.cwd(),
|
201777
201789
|
import_node_path52.default.join(creationDirectory, "./src/index.js")
|
@@ -201956,7 +201968,7 @@ function getNewWorkerToml(workerType) {
|
|
201956
201968
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
201957
201969
|
async function findPath(isolatedInit, cwd2, basename4) {
|
201958
201970
|
if (isolatedInit) {
|
201959
|
-
return
|
201971
|
+
return fs25.existsSync(import_node_path52.default.resolve(cwd2, basename4)) ? import_node_path52.default.resolve(cwd2, basename4) : void 0;
|
201960
201972
|
} else {
|
201961
201973
|
return await findUp(basename4, {
|
201962
201974
|
cwd: cwd2
|
@@ -202718,9 +202730,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202718
202730
|
"A [site] definition requires a `bucket` field with a path to the site's assets directory."
|
202719
202731
|
);
|
202720
202732
|
if (props.outDir) {
|
202721
|
-
(0,
|
202733
|
+
(0, import_node_fs32.mkdirSync)(props.outDir, { recursive: true });
|
202722
202734
|
const readmePath = import_node_path53.default.join(props.outDir, "README.md");
|
202723
|
-
(0,
|
202735
|
+
(0, import_node_fs32.writeFileSync)(
|
202724
202736
|
readmePath,
|
202725
202737
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
202726
202738
|
);
|
@@ -202756,10 +202768,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202756
202768
|
try {
|
202757
202769
|
if (props.noBundle) {
|
202758
202770
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
202759
|
-
(0,
|
202760
|
-
(0,
|
202771
|
+
(0, import_node_fs32.mkdirSync)(destinationDir, { recursive: true });
|
202772
|
+
(0, import_node_fs32.writeFileSync)(
|
202761
202773
|
import_node_path53.default.join(destinationDir, import_node_path53.default.basename(props.entry.file)),
|
202762
|
-
(0,
|
202774
|
+
(0, import_node_fs32.readFileSync)(props.entry.file, "utf-8")
|
202763
202775
|
);
|
202764
202776
|
}
|
202765
202777
|
const entryDirectory = import_node_path53.default.dirname(props.entry.file);
|
@@ -202824,7 +202836,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
202824
202836
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
202825
202837
|
dependencies[modulePath] = { bytesInOutput };
|
202826
202838
|
}
|
202827
|
-
const content = (0,
|
202839
|
+
const content = (0, import_node_fs32.readFileSync)(resolvedEntryPointPath, {
|
202828
202840
|
encoding: "utf-8"
|
202829
202841
|
});
|
202830
202842
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
@@ -204187,10 +204199,14 @@ __name(getRemotePreviewToken, "getRemotePreviewToken");
|
|
204187
204199
|
async function createRemoteWorkerInit(props) {
|
204188
204200
|
const { entrypointSource: content, modules } = withSourceURLs(
|
204189
204201
|
props.bundle.path,
|
204202
|
+
props.bundle.entrypointSource,
|
204190
204203
|
props.modules
|
204191
204204
|
);
|
204192
204205
|
void printBundleSize(
|
204193
|
-
{
|
204206
|
+
{
|
204207
|
+
name: import_node_path54.default.basename(props.bundle.path),
|
204208
|
+
content
|
204209
|
+
},
|
204194
204210
|
props.modules
|
204195
204211
|
);
|
204196
204212
|
const assets = await syncAssets(
|
@@ -204322,6 +204338,7 @@ __name(handleUserFriendlyError, "handleUserFriendlyError");
|
|
204322
204338
|
// src/dev/use-esbuild.ts
|
204323
204339
|
init_import_meta_url();
|
204324
204340
|
var import_node_assert18 = __toESM(require("node:assert"));
|
204341
|
+
var import_node_fs33 = require("node:fs");
|
204325
204342
|
var import_node_path55 = __toESM(require("node:path"));
|
204326
204343
|
var import_chokidar3 = require("chokidar");
|
204327
204344
|
var import_ink11 = __toESM(require_build2());
|
@@ -204386,7 +204403,11 @@ function useEsbuild({
|
|
204386
204403
|
...moduleCollector?.modules ?? [],
|
204387
204404
|
...newAdditionalModules
|
204388
204405
|
]);
|
204389
|
-
return {
|
204406
|
+
return {
|
204407
|
+
...previousBundle,
|
204408
|
+
entrypointSource: (0, import_node_fs33.readFileSync)(previousBundle.path, "utf8"),
|
204409
|
+
id: previousBundle.id + 1
|
204410
|
+
};
|
204390
204411
|
});
|
204391
204412
|
}
|
204392
204413
|
__name(updateBundle, "updateBundle");
|
@@ -204465,15 +204486,19 @@ function useEsbuild({
|
|
204465
204486
|
void watcher.close();
|
204466
204487
|
}, "stopWatching");
|
204467
204488
|
}
|
204489
|
+
const entrypointPath = (0, import_node_fs33.realpathSync)(
|
204490
|
+
bundleResult?.resolvedEntryPointPath ?? entry.file
|
204491
|
+
);
|
204468
204492
|
setBundle({
|
204469
204493
|
id: 0,
|
204470
204494
|
entry,
|
204471
|
-
path:
|
204495
|
+
path: entrypointPath,
|
204472
204496
|
type: bundleResult?.bundleType ?? getBundleType(entry.format, entry.file),
|
204473
204497
|
modules: bundleResult ? bundleResult.modules : newAdditionalModules,
|
204474
204498
|
dependencies: bundleResult?.dependencies ?? {},
|
204475
204499
|
sourceMapPath: bundleResult?.sourceMapPath,
|
204476
|
-
sourceMapMetadata: bundleResult?.sourceMapMetadata
|
204500
|
+
sourceMapMetadata: bundleResult?.sourceMapMetadata,
|
204501
|
+
entrypointSource: (0, import_node_fs33.readFileSync)(entrypointPath, "utf8")
|
204477
204502
|
});
|
204478
204503
|
}
|
204479
204504
|
__name(build5, "build");
|
@@ -205071,6 +205096,7 @@ var dev_default = withErrorBoundary(DevImplementation, {
|
|
205071
205096
|
|
205072
205097
|
// src/dev/start-server.ts
|
205073
205098
|
init_import_meta_url();
|
205099
|
+
var import_promises21 = require("node:fs/promises");
|
205074
205100
|
var path62 = __toESM(require("node:path"));
|
205075
205101
|
var util3 = __toESM(require("node:util"));
|
205076
205102
|
var import_chalk20 = __toESM(require_chalk());
|
@@ -205349,15 +205375,17 @@ async function runEsbuild({
|
|
205349
205375
|
projectRoot,
|
205350
205376
|
defineNavigatorUserAgent
|
205351
205377
|
}) : void 0;
|
205378
|
+
const entrypointPath = bundleResult?.resolvedEntryPointPath ?? entry.file;
|
205352
205379
|
return {
|
205353
205380
|
id: 0,
|
205354
205381
|
entry,
|
205355
|
-
path:
|
205382
|
+
path: entrypointPath,
|
205356
205383
|
type: bundleResult?.bundleType ?? getBundleType(entry.format),
|
205357
205384
|
modules: bundleResult ? bundleResult.modules : additionalModules,
|
205358
205385
|
dependencies: bundleResult?.dependencies ?? {},
|
205359
205386
|
sourceMapPath: bundleResult?.sourceMapPath,
|
205360
|
-
sourceMapMetadata: bundleResult?.sourceMapMetadata
|
205387
|
+
sourceMapMetadata: bundleResult?.sourceMapMetadata,
|
205388
|
+
entrypointSource: await (0, import_promises21.readFile)(entrypointPath, "utf8")
|
205361
205389
|
};
|
205362
205390
|
}
|
205363
205391
|
__name(runEsbuild, "runEsbuild");
|
@@ -206392,7 +206420,7 @@ init_import_meta_url();
|
|
206392
206420
|
// src/api/startDevWorker/DevEnv.ts
|
206393
206421
|
init_import_meta_url();
|
206394
206422
|
var import_node_assert21 = __toESM(require("node:assert"));
|
206395
|
-
var
|
206423
|
+
var import_node_events3 = require("node:events");
|
206396
206424
|
|
206397
206425
|
// src/api/startDevWorker/BundlerController.ts
|
206398
206426
|
init_import_meta_url();
|
@@ -206400,12 +206428,14 @@ init_import_meta_url();
|
|
206400
206428
|
// src/api/startDevWorker/BaseController.ts
|
206401
206429
|
init_import_meta_url();
|
206402
206430
|
var import_node_events2 = require("node:events");
|
206403
|
-
var
|
206431
|
+
var TypedEventEmitterImpl = import_node_events2.EventEmitter;
|
206432
|
+
var Controller = class extends TypedEventEmitterImpl {
|
206433
|
+
emitErrorEvent(data) {
|
206434
|
+
this.emit("error", data);
|
206435
|
+
}
|
206404
206436
|
};
|
206405
206437
|
__name(Controller, "Controller");
|
206406
206438
|
var RuntimeController = class extends Controller {
|
206407
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206408
|
-
once;
|
206409
206439
|
};
|
206410
206440
|
__name(RuntimeController, "RuntimeController");
|
206411
206441
|
|
@@ -206449,15 +206479,12 @@ var BundlerController = class extends Controller {
|
|
206449
206479
|
emitBundleCompletetEvent(data) {
|
206450
206480
|
this.emit("bundleComplete", data);
|
206451
206481
|
}
|
206452
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206453
|
-
once;
|
206454
206482
|
};
|
206455
206483
|
__name(BundlerController, "BundlerController");
|
206456
206484
|
|
206457
206485
|
// src/api/startDevWorker/ConfigController.ts
|
206458
206486
|
init_import_meta_url();
|
206459
|
-
var
|
206460
|
-
var ConfigController = class extends import_node_events3.EventEmitter {
|
206487
|
+
var ConfigController = class extends Controller {
|
206461
206488
|
config;
|
206462
206489
|
setOptions(_3) {
|
206463
206490
|
notImplemented(this.setOptions.name, this.constructor.name);
|
@@ -206477,35 +206504,345 @@ var ConfigController = class extends import_node_events3.EventEmitter {
|
|
206477
206504
|
emitConfigUpdateEvent(data) {
|
206478
206505
|
this.emit("configUpdate", data);
|
206479
206506
|
}
|
206480
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206481
|
-
once;
|
206482
206507
|
};
|
206483
206508
|
__name(ConfigController, "ConfigController");
|
206484
206509
|
|
206485
206510
|
// src/api/startDevWorker/LocalRuntimeController.ts
|
206486
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");
|
206487
206741
|
var LocalRuntimeController = class extends RuntimeController {
|
206488
206742
|
// ******************
|
206489
206743
|
// Event Handlers
|
206490
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;
|
206491
206756
|
onBundleStart(_3) {
|
206492
|
-
notImplemented(this.onBundleStart.name, this.constructor.name);
|
206493
206757
|
}
|
206494
|
-
onBundleComplete(
|
206495
|
-
|
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));
|
206496
206829
|
}
|
206497
206830
|
onPreviewTokenExpired(_3) {
|
206498
206831
|
}
|
206832
|
+
#teardown = async () => {
|
206833
|
+
await this.#mf?.dispose();
|
206834
|
+
this.#mf = void 0;
|
206835
|
+
};
|
206499
206836
|
async teardown() {
|
206500
|
-
|
206837
|
+
return this.#mutex.runWith(this.#teardown);
|
206501
206838
|
}
|
206502
206839
|
// *********************
|
206503
206840
|
// Event Dispatchers
|
206504
206841
|
// *********************
|
206505
206842
|
emitReloadStartEvent(data) {
|
206506
|
-
this.emit("
|
206843
|
+
this.emit("reloadStart", data);
|
206507
206844
|
}
|
206508
|
-
|
206845
|
+
emitReloadCompleteEvent(data) {
|
206509
206846
|
this.emit("reloadComplete", data);
|
206510
206847
|
}
|
206511
206848
|
};
|
@@ -206514,10 +206851,9 @@ __name(LocalRuntimeController, "LocalRuntimeController");
|
|
206514
206851
|
// src/api/startDevWorker/ProxyController.ts
|
206515
206852
|
init_import_meta_url();
|
206516
206853
|
var import_node_assert20 = __toESM(require("node:assert"));
|
206517
|
-
var
|
206518
|
-
var import_node_events4 = require("node:events");
|
206854
|
+
var import_node_crypto9 = require("node:crypto");
|
206519
206855
|
var import_node_path59 = __toESM(require("node:path"));
|
206520
|
-
var
|
206856
|
+
var import_miniflare16 = require("miniflare");
|
206521
206857
|
|
206522
206858
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
206523
206859
|
init_import_meta_url();
|
@@ -206531,23 +206867,6 @@ var import_node_path58 = __toESM(require("node:path"));
|
|
206531
206867
|
var scriptPath2 = import_node_path58.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
206532
206868
|
var ProxyWorker_default = scriptPath2;
|
206533
206869
|
|
206534
|
-
// src/api/startDevWorker/events.ts
|
206535
|
-
init_import_meta_url();
|
206536
|
-
|
206537
|
-
// src/api/startDevWorker/devtools.ts
|
206538
|
-
init_import_meta_url();
|
206539
|
-
|
206540
|
-
// src/api/startDevWorker/events.ts
|
206541
|
-
function castErrorCause(cause) {
|
206542
|
-
if (cause instanceof Error) {
|
206543
|
-
return cause;
|
206544
|
-
}
|
206545
|
-
const error2 = new Error();
|
206546
|
-
error2.cause = cause;
|
206547
|
-
return error2;
|
206548
|
-
}
|
206549
|
-
__name(castErrorCause, "castErrorCause");
|
206550
|
-
|
206551
206870
|
// src/api/startDevWorker/utils.ts
|
206552
206871
|
init_import_meta_url();
|
206553
206872
|
var import_node_assert19 = __toESM(require("node:assert"));
|
@@ -206572,14 +206891,14 @@ function assertNever(_value) {
|
|
206572
206891
|
__name(assertNever, "assertNever");
|
206573
206892
|
|
206574
206893
|
// src/api/startDevWorker/ProxyController.ts
|
206575
|
-
var ProxyController = class extends
|
206894
|
+
var ProxyController = class extends Controller {
|
206576
206895
|
ready = createDeferred();
|
206577
206896
|
proxyWorker;
|
206578
206897
|
proxyWorkerOptions;
|
206579
206898
|
inspectorProxyWorkerWebSocket;
|
206580
206899
|
latestConfig;
|
206581
206900
|
latestBundle;
|
206582
|
-
secret = (0,
|
206901
|
+
secret = (0, import_node_crypto9.randomUUID)();
|
206583
206902
|
createProxyWorker() {
|
206584
206903
|
if (this._torndown) {
|
206585
206904
|
return;
|
@@ -206612,7 +206931,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206612
206931
|
PROXY_CONTROLLER: async (req) => {
|
206613
206932
|
const message = await req.json();
|
206614
206933
|
this.onProxyWorkerMessage(message);
|
206615
|
-
return new
|
206934
|
+
return new import_miniflare16.Response(null, { status: 204 });
|
206616
206935
|
}
|
206617
206936
|
},
|
206618
206937
|
bindings: {
|
@@ -206669,7 +206988,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206669
206988
|
proxyWorkerOptions
|
206670
206989
|
);
|
206671
206990
|
const willInstantiateMiniflareInstance = !this.proxyWorker || proxyWorkerOptionsChanged;
|
206672
|
-
this.proxyWorker ??= new
|
206991
|
+
this.proxyWorker ??= new import_miniflare16.Miniflare(proxyWorkerOptions);
|
206673
206992
|
this.proxyWorkerOptions = proxyWorkerOptions;
|
206674
206993
|
if (proxyWorkerOptionsChanged) {
|
206675
206994
|
logger.debug("ProxyWorker miniflare options changed, reinstantiating...");
|
@@ -206696,7 +207015,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206696
207015
|
return;
|
206697
207016
|
}
|
206698
207017
|
const existingWebSocket = await this.inspectorProxyWorkerWebSocket?.promise;
|
206699
|
-
if (existingWebSocket?.readyState ===
|
207018
|
+
if (existingWebSocket?.readyState === import_miniflare16.WebSocket.READY_STATE_OPEN) {
|
206700
207019
|
return existingWebSocket;
|
206701
207020
|
}
|
206702
207021
|
this.inspectorProxyWorkerWebSocket = createDeferred();
|
@@ -206741,7 +207060,7 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206741
207060
|
this.inspectorProxyWorkerWebSocket?.resolve(webSocket);
|
206742
207061
|
return webSocket;
|
206743
207062
|
}
|
206744
|
-
runtimeMessageMutex = new
|
207063
|
+
runtimeMessageMutex = new import_miniflare16.Mutex();
|
206745
207064
|
async sendMessageToProxyWorker(message, retries = 3) {
|
206746
207065
|
if (this._torndown) {
|
206747
207066
|
return;
|
@@ -206896,15 +207215,15 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206896
207215
|
);
|
206897
207216
|
}
|
206898
207217
|
if (maybeContents === void 0) {
|
206899
|
-
return new
|
207218
|
+
return new import_miniflare16.Response(null, { status: 404 });
|
206900
207219
|
}
|
206901
|
-
return new
|
207220
|
+
return new import_miniflare16.Response(maybeContents);
|
206902
207221
|
}
|
206903
207222
|
default:
|
206904
207223
|
assertNever(message);
|
206905
|
-
return new
|
207224
|
+
return new import_miniflare16.Response(null, { status: 404 });
|
206906
207225
|
}
|
206907
|
-
return new
|
207226
|
+
return new import_miniflare16.Response(null, { status: 204 });
|
206908
207227
|
}
|
206909
207228
|
_torndown = false;
|
206910
207229
|
async teardown() {
|
@@ -206935,26 +207254,26 @@ var ProxyController = class extends import_node_events4.EventEmitter {
|
|
206935
207254
|
proxyData
|
206936
207255
|
});
|
206937
207256
|
}
|
206938
|
-
emitErrorEvent(
|
206939
|
-
|
206940
|
-
|
206941
|
-
|
206942
|
-
|
206943
|
-
|
206944
|
-
|
206945
|
-
|
206946
|
-
|
206947
|
-
|
206948
|
-
|
206949
|
-
|
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);
|
206950
207271
|
}
|
206951
|
-
// @ts-expect-error Missing initialisation (only need the signature types, base implementation is fine)
|
206952
|
-
once;
|
206953
207272
|
};
|
206954
207273
|
__name(ProxyController, "ProxyController");
|
206955
207274
|
var ProxyControllerLogger = class extends WranglerLog {
|
206956
207275
|
log(message) {
|
206957
|
-
if (message.includes("/cdn-cgi/") && this.level <
|
207276
|
+
if (message.includes("/cdn-cgi/") && this.level < import_miniflare16.LogLevel.DEBUG) {
|
206958
207277
|
return;
|
206959
207278
|
}
|
206960
207279
|
super.log(message);
|
@@ -206995,16 +207314,16 @@ var RemoteRuntimeController = class extends RuntimeController {
|
|
206995
207314
|
// Event Dispatchers
|
206996
207315
|
// *********************
|
206997
207316
|
emitReloadStartEvent(data) {
|
206998
|
-
this.emit("
|
207317
|
+
this.emit("reloadStart", data);
|
206999
207318
|
}
|
207000
|
-
|
207319
|
+
emitReloadCompleteEvent(data) {
|
207001
207320
|
this.emit("reloadComplete", data);
|
207002
207321
|
}
|
207003
207322
|
};
|
207004
207323
|
__name(RemoteRuntimeController, "RemoteRuntimeController");
|
207005
207324
|
|
207006
207325
|
// src/api/startDevWorker/DevEnv.ts
|
207007
|
-
var DevEnv = class extends
|
207326
|
+
var DevEnv = class extends import_node_events3.EventEmitter {
|
207008
207327
|
config;
|
207009
207328
|
bundler;
|
207010
207329
|
runtimes;
|
@@ -207028,9 +207347,10 @@ var DevEnv = class extends import_node_events5.EventEmitter {
|
|
207028
207347
|
this.bundler = bundler;
|
207029
207348
|
this.runtimes = runtimes;
|
207030
207349
|
this.proxy = proxy2;
|
207031
|
-
[config, bundler, ...runtimes, proxy2]
|
207032
|
-
|
207033
|
-
|
207350
|
+
const controllers = [config, bundler, ...runtimes, proxy2];
|
207351
|
+
controllers.forEach((controller) => {
|
207352
|
+
controller.on("error", (event) => this.emitErrorEvent(event));
|
207353
|
+
});
|
207034
207354
|
this.on("error", (event) => {
|
207035
207355
|
logger.error(`Error in ${event.source}: ${event.reason}
|
207036
207356
|
`, event.cause);
|
@@ -207073,7 +207393,7 @@ var DevEnv = class extends import_node_events5.EventEmitter {
|
|
207073
207393
|
await Promise.all([
|
207074
207394
|
this.config.teardown(),
|
207075
207395
|
this.bundler.teardown(),
|
207076
|
-
this.runtimes.
|
207396
|
+
...this.runtimes.map((runtime) => runtime.teardown()),
|
207077
207397
|
this.proxy.teardown()
|
207078
207398
|
]);
|
207079
207399
|
}
|
@@ -207147,7 +207467,7 @@ init_import_meta_url();
|
|
207147
207467
|
|
207148
207468
|
// src/api/integrations/platform/index.ts
|
207149
207469
|
init_import_meta_url();
|
207150
|
-
var
|
207470
|
+
var import_miniflare19 = require("miniflare");
|
207151
207471
|
|
207152
207472
|
// src/api/integrations/platform/caches.ts
|
207153
207473
|
init_import_meta_url();
|
@@ -207202,7 +207522,7 @@ __name(ExecutionContext, "ExecutionContext");
|
|
207202
207522
|
|
207203
207523
|
// src/api/integrations/platform/services.ts
|
207204
207524
|
init_import_meta_url();
|
207205
|
-
var
|
207525
|
+
var import_miniflare18 = require("miniflare");
|
207206
207526
|
var import_undici27 = __toESM(require_undici());
|
207207
207527
|
async function getServiceBindings(services = []) {
|
207208
207528
|
if (services.length === 0) {
|
@@ -207254,9 +207574,9 @@ function getServiceBindingProxyFetch({
|
|
207254
207574
|
try {
|
207255
207575
|
const resp = await (0, import_undici27.fetch)(newUrl, request3);
|
207256
207576
|
const respBody = await resp.arrayBuffer();
|
207257
|
-
return new
|
207577
|
+
return new import_miniflare18.Response(respBody, resp);
|
207258
207578
|
} catch {
|
207259
|
-
return new
|
207579
|
+
return new import_miniflare18.Response(
|
207260
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\``,
|
207261
207581
|
{ status: 500 }
|
207262
207582
|
);
|
@@ -207285,7 +207605,7 @@ async function getPlatformProxy(options29 = {}) {
|
|
207285
207605
|
env5,
|
207286
207606
|
options29
|
207287
207607
|
);
|
207288
|
-
const mf = new
|
207608
|
+
const mf = new import_miniflare19.Miniflare({
|
207289
207609
|
script: "",
|
207290
207610
|
modules: true,
|
207291
207611
|
...miniflareOptions
|
@@ -207392,7 +207712,7 @@ function unstable_getMiniflareWorkerOptions(configPath, environment) {
|
|
207392
207712
|
if (bindings.services !== void 0) {
|
207393
207713
|
bindingOptions.serviceBindings = Object.fromEntries(
|
207394
207714
|
bindings.services.map((binding) => {
|
207395
|
-
const name = binding.service === config.name ?
|
207715
|
+
const name = binding.service === config.name ? import_miniflare19.kCurrentWorker : binding.service;
|
207396
207716
|
return [binding.binding, { name, entrypoint: binding.entrypoint }];
|
207397
207717
|
})
|
207398
207718
|
);
|
@@ -208075,4 +208395,3 @@ yargs-parser/build/lib/index.js:
|
|
208075
208395
|
* SPDX-License-Identifier: ISC
|
208076
208396
|
*)
|
208077
208397
|
*/
|
208078
|
-
//# sourceMappingURL=cli.js.map
|