wrangler 2.4.3 → 2.5.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/bin/wrangler.js +20 -8
- package/miniflare-dist/index.mjs +8 -3
- package/package.json +1 -1
- package/src/__tests__/delete.test.ts +81 -48
- package/src/__tests__/dev.test.tsx +8 -8
- package/src/__tests__/helpers/mock-oauth-flow.ts +5 -1
- package/src/__tests__/helpers/msw/handlers/oauth.ts +13 -18
- package/src/__tests__/logout.test.ts +47 -0
- package/src/__tests__/queues.test.ts +155 -67
- package/src/__tests__/tail.test.ts +207 -108
- package/src/__tests__/user.test.ts +43 -69
- package/src/d1/backups.tsx +7 -2
- package/src/d1/delete.tsx +4 -4
- package/src/d1/index.ts +2 -0
- package/src/d1/migrations/apply.tsx +6 -5
- package/src/d1/migrations/helpers.ts +4 -2
- package/src/d1/migrations/list.tsx +2 -2
- package/src/d1/migrations/options.ts +18 -0
- package/src/dev/dev.tsx +46 -22
- package/src/dev/local.tsx +18 -14
- package/src/dev/start-server.ts +22 -21
- package/src/dev.tsx +10 -11
- package/src/miniflare-cli/assets.ts +7 -2
- package/src/miniflare-cli/index.ts +1 -1
- package/src/pages/dev.tsx +0 -2
- package/src/proxy.ts +5 -0
- package/wrangler-dist/cli.js +221 -178
package/wrangler-dist/cli.js
CHANGED
|
@@ -353,8 +353,8 @@ var require_util = __commonJS({
|
|
|
353
353
|
throw new InvalidArgumentError("invalid protocol");
|
|
354
354
|
}
|
|
355
355
|
if (!(url3 instanceof URL)) {
|
|
356
|
-
const
|
|
357
|
-
let origin = url3.origin != null ? url3.origin : `${url3.protocol}//${url3.hostname}:${
|
|
356
|
+
const port2 = url3.port != null ? url3.port : url3.protocol === "https:" ? 443 : 80;
|
|
357
|
+
let origin = url3.origin != null ? url3.origin : `${url3.protocol}//${url3.hostname}:${port2}`;
|
|
358
358
|
let path41 = url3.path != null ? url3.path : `${url3.pathname || ""}${url3.search || ""}`;
|
|
359
359
|
if (origin.endsWith("/")) {
|
|
360
360
|
origin = origin.substring(0, origin.length - 1);
|
|
@@ -6439,7 +6439,7 @@ var require_connect = __commonJS({
|
|
|
6439
6439
|
const sessionCache = /* @__PURE__ */ new Map();
|
|
6440
6440
|
timeout = timeout == null ? 1e4 : timeout;
|
|
6441
6441
|
maxCachedSessions = maxCachedSessions == null ? 100 : maxCachedSessions;
|
|
6442
|
-
return function connect2({ hostname, host, protocol, port, servername, httpSocket }, callback) {
|
|
6442
|
+
return function connect2({ hostname, host, protocol, port: port2, servername, httpSocket }, callback) {
|
|
6443
6443
|
let socket;
|
|
6444
6444
|
if (protocol === "https:") {
|
|
6445
6445
|
if (!tls) {
|
|
@@ -6455,7 +6455,7 @@ var require_connect = __commonJS({
|
|
|
6455
6455
|
servername,
|
|
6456
6456
|
session,
|
|
6457
6457
|
socket: httpSocket,
|
|
6458
|
-
port:
|
|
6458
|
+
port: port2 || 443,
|
|
6459
6459
|
host: hostname
|
|
6460
6460
|
});
|
|
6461
6461
|
socket.on("session", function(session2) {
|
|
@@ -6477,7 +6477,7 @@ var require_connect = __commonJS({
|
|
|
6477
6477
|
socket = net3.connect({
|
|
6478
6478
|
highWaterMark: 64 * 1024,
|
|
6479
6479
|
...options6,
|
|
6480
|
-
port:
|
|
6480
|
+
port: port2 || 80,
|
|
6481
6481
|
host: hostname
|
|
6482
6482
|
});
|
|
6483
6483
|
}
|
|
@@ -7813,13 +7813,13 @@ var require_client = __commonJS({
|
|
|
7813
7813
|
async function connect2(client) {
|
|
7814
7814
|
assert14(!client[kConnecting]);
|
|
7815
7815
|
assert14(!client[kSocket]);
|
|
7816
|
-
let { host, hostname, protocol, port } = client[kUrl];
|
|
7816
|
+
let { host, hostname, protocol, port: port2 } = client[kUrl];
|
|
7817
7817
|
if (hostname[0] === "[") {
|
|
7818
7818
|
const idx = hostname.indexOf("]");
|
|
7819
7819
|
assert14(idx !== -1);
|
|
7820
|
-
const
|
|
7821
|
-
assert14(net3.isIP(
|
|
7822
|
-
hostname =
|
|
7820
|
+
const ip2 = hostname.substr(1, idx - 1);
|
|
7821
|
+
assert14(net3.isIP(ip2));
|
|
7822
|
+
hostname = ip2;
|
|
7823
7823
|
}
|
|
7824
7824
|
client[kConnecting] = true;
|
|
7825
7825
|
if (channels.beforeConnect.hasSubscribers) {
|
|
@@ -7828,7 +7828,7 @@ var require_client = __commonJS({
|
|
|
7828
7828
|
host,
|
|
7829
7829
|
hostname,
|
|
7830
7830
|
protocol,
|
|
7831
|
-
port,
|
|
7831
|
+
port: port2,
|
|
7832
7832
|
servername: client[kServerName]
|
|
7833
7833
|
},
|
|
7834
7834
|
connector: client[kConnector]
|
|
@@ -7840,7 +7840,7 @@ var require_client = __commonJS({
|
|
|
7840
7840
|
host,
|
|
7841
7841
|
hostname,
|
|
7842
7842
|
protocol,
|
|
7843
|
-
port,
|
|
7843
|
+
port: port2,
|
|
7844
7844
|
servername: client[kServerName]
|
|
7845
7845
|
}, (err2, socket2) => {
|
|
7846
7846
|
if (err2) {
|
|
@@ -7873,7 +7873,7 @@ var require_client = __commonJS({
|
|
|
7873
7873
|
host,
|
|
7874
7874
|
hostname,
|
|
7875
7875
|
protocol,
|
|
7876
|
-
port,
|
|
7876
|
+
port: port2,
|
|
7877
7877
|
servername: client[kServerName]
|
|
7878
7878
|
},
|
|
7879
7879
|
connector: client[kConnector],
|
|
@@ -7889,7 +7889,7 @@ var require_client = __commonJS({
|
|
|
7889
7889
|
host,
|
|
7890
7890
|
hostname,
|
|
7891
7891
|
protocol,
|
|
7892
|
-
port,
|
|
7892
|
+
port: port2,
|
|
7893
7893
|
servername: client[kServerName]
|
|
7894
7894
|
},
|
|
7895
7895
|
connector: client[kConnector],
|
|
@@ -10776,7 +10776,7 @@ var require_proxy_agent = __commonJS({
|
|
|
10776
10776
|
this[kProxyHeaders]["proxy-authorization"] = `Basic ${opts.auth}`;
|
|
10777
10777
|
}
|
|
10778
10778
|
const resolvedUrl = new URL4(opts.uri);
|
|
10779
|
-
const { origin, port, host } = resolvedUrl;
|
|
10779
|
+
const { origin, port: port2, host } = resolvedUrl;
|
|
10780
10780
|
const connect2 = buildConnector({ ...opts.proxyTls });
|
|
10781
10781
|
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls });
|
|
10782
10782
|
this[kClient] = new Client(resolvedUrl, { connect: connect2 });
|
|
@@ -10790,7 +10790,7 @@ var require_proxy_agent = __commonJS({
|
|
|
10790
10790
|
try {
|
|
10791
10791
|
const { socket, statusCode } = await this[kClient].connect({
|
|
10792
10792
|
origin,
|
|
10793
|
-
port,
|
|
10793
|
+
port: port2,
|
|
10794
10794
|
path: requestedHost,
|
|
10795
10795
|
signal: opts2.signal,
|
|
10796
10796
|
headers: {
|
|
@@ -42209,7 +42209,7 @@ var require_nbind = __commonJS({
|
|
|
42209
42209
|
kp(a2);
|
|
42210
42210
|
return;
|
|
42211
42211
|
}
|
|
42212
|
-
function
|
|
42212
|
+
function ip2(a2) {
|
|
42213
42213
|
a2 = a2 | 0;
|
|
42214
42214
|
jp(a2 + 24 | 0);
|
|
42215
42215
|
return;
|
|
@@ -54334,7 +54334,7 @@ var require_nbind = __commonJS({
|
|
|
54334
54334
|
var kb = [iD, of];
|
|
54335
54335
|
var lb = [jD, Of, Pf, Qf, Rf, Sf, Tf, Uf, Wf, Xf, Zf, _f, $f, ag, bg, cg, dg, eg, fg, jD, jD, jD, jD, jD, jD, jD, jD, jD, jD, jD, jD, jD];
|
|
54336
54336
|
var mb = [kD];
|
|
54337
|
-
var nb = [lD, kC, Ki, Li, Mi, rn, sn, tn, Pu, Qu, Ru, Cw, Dw, Ew, DA, EA, FA, Rb, tf, yf, Vf, Yf, hh, ih, ri, Ui, kj, Jj, bk, zk, Wk, nl, Hl, bm, um, Nm, en, Nn, fo, yo, Ro,
|
|
54337
|
+
var nb = [lD, kC, Ki, Li, Mi, rn, sn, tn, Pu, Qu, Ru, Cw, Dw, Ew, DA, EA, FA, Rb, tf, yf, Vf, Yf, hh, ih, ri, Ui, kj, Jj, bk, zk, Wk, nl, Hl, bm, um, Nm, en, Nn, fo, yo, Ro, ip2, Bp, Xp, nq, Eq, Zq, lf, Hr, _r, us, Ps, ft, Ct, Ot, Rt, ju, mu, Eu, Uu, Xu, pv, Kv, Vi, $x, Ky, az, sz, Rz, hA, tA, wA, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD, lD];
|
|
54338
54338
|
var ob = [mD, zf, Af, Df, Ef, Ff, Gf, Hf, If, Lf, Mf, Nf, wg, zg, Ag, Bg, Cg, Dg, Eg, Jg, Ng, rh, $p, qq, Ts, cy2, Sv, xy, mD, mD, mD, mD];
|
|
54339
54339
|
var pb = [nD, rB, sf, jg, ng, og, pg, qg, rg, sg, ug, vg, Kg, Lg, jh, ar2, jt, sv, hy, jy, nD, nD, nD, nD, nD, nD, nD, nD, nD, nD, nD, nD];
|
|
54340
54340
|
var qb = [oD, kh];
|
|
@@ -73521,7 +73521,7 @@ var require_backend = __commonJS({
|
|
|
73521
73521
|
if (backend_hook == null) {
|
|
73522
73522
|
return;
|
|
73523
73523
|
}
|
|
73524
|
-
var _ref = options6 || {}, _ref$host = _ref.host, host = _ref$host === void 0 ? "localhost" : _ref$host, nativeStyleEditorValidAttributes = _ref.nativeStyleEditorValidAttributes, _ref$useHttps = _ref.useHttps, useHttps = _ref$useHttps === void 0 ? false : _ref$useHttps, _ref$port = _ref.port,
|
|
73524
|
+
var _ref = options6 || {}, _ref$host = _ref.host, host = _ref$host === void 0 ? "localhost" : _ref$host, nativeStyleEditorValidAttributes = _ref.nativeStyleEditorValidAttributes, _ref$useHttps = _ref.useHttps, useHttps = _ref$useHttps === void 0 ? false : _ref$useHttps, _ref$port = _ref.port, port2 = _ref$port === void 0 ? 8097 : _ref$port, websocket = _ref.websocket, _ref$resolveRNStyle = _ref.resolveRNStyle, resolveRNStyle = _ref$resolveRNStyle === void 0 ? null : _ref$resolveRNStyle, _ref$retryConnectionD = _ref.retryConnectionDelay, retryConnectionDelay = _ref$retryConnectionD === void 0 ? 2e3 : _ref$retryConnectionD, _ref$isAppActive = _ref.isAppActive, isAppActive = _ref$isAppActive === void 0 ? function() {
|
|
73525
73525
|
return true;
|
|
73526
73526
|
} : _ref$isAppActive;
|
|
73527
73527
|
var protocol = useHttps ? "wss" : "ws";
|
|
@@ -73539,7 +73539,7 @@ var require_backend = __commonJS({
|
|
|
73539
73539
|
}
|
|
73540
73540
|
var bridge = null;
|
|
73541
73541
|
var messageListeners = [];
|
|
73542
|
-
var uri = protocol + "://" + host + ":" +
|
|
73542
|
+
var uri = protocol + "://" + host + ":" + port2;
|
|
73543
73543
|
var ws = websocket ? websocket : new window.WebSocket(uri);
|
|
73544
73544
|
ws.onclose = handleClose;
|
|
73545
73545
|
ws.onerror = handleFailed;
|
|
@@ -105860,17 +105860,17 @@ var require_proxy_addr = __commonJS({
|
|
|
105860
105860
|
if (!isip(str)) {
|
|
105861
105861
|
throw new TypeError("invalid IP address: " + str);
|
|
105862
105862
|
}
|
|
105863
|
-
var
|
|
105864
|
-
if (pos === -1 &&
|
|
105865
|
-
|
|
105863
|
+
var ip2 = parseip(str);
|
|
105864
|
+
if (pos === -1 && ip2.kind() === "ipv6" && ip2.isIPv4MappedAddress()) {
|
|
105865
|
+
ip2 = ip2.toIPv4Address();
|
|
105866
105866
|
}
|
|
105867
|
-
var max =
|
|
105867
|
+
var max = ip2.kind() === "ipv6" ? 128 : 32;
|
|
105868
105868
|
var range = pos !== -1 ? note.substring(pos + 1, note.length) : null;
|
|
105869
105869
|
if (range === null) {
|
|
105870
105870
|
range = max;
|
|
105871
105871
|
} else if (DIGIT_REGEXP.test(range)) {
|
|
105872
105872
|
range = parseInt(range, 10);
|
|
105873
|
-
} else if (
|
|
105873
|
+
} else if (ip2.kind() === "ipv4" && isip(range)) {
|
|
105874
105874
|
range = parseNetmask(range);
|
|
105875
105875
|
} else {
|
|
105876
105876
|
range = null;
|
|
@@ -105878,12 +105878,12 @@ var require_proxy_addr = __commonJS({
|
|
|
105878
105878
|
if (range <= 0 || range > max) {
|
|
105879
105879
|
throw new TypeError("invalid range on address: " + note);
|
|
105880
105880
|
}
|
|
105881
|
-
return [
|
|
105881
|
+
return [ip2, range];
|
|
105882
105882
|
}
|
|
105883
105883
|
function parseNetmask(netmask) {
|
|
105884
|
-
var
|
|
105885
|
-
var kind =
|
|
105886
|
-
return kind === "ipv4" ?
|
|
105884
|
+
var ip2 = parseip(netmask);
|
|
105885
|
+
var kind = ip2.kind();
|
|
105886
|
+
return kind === "ipv4" ? ip2.prefixLengthFromSubnetMask() : null;
|
|
105887
105887
|
}
|
|
105888
105888
|
function proxyaddr(req, trust) {
|
|
105889
105889
|
if (!req) {
|
|
@@ -105903,21 +105903,21 @@ var require_proxy_addr = __commonJS({
|
|
|
105903
105903
|
return function trust(addr) {
|
|
105904
105904
|
if (!isip(addr))
|
|
105905
105905
|
return false;
|
|
105906
|
-
var
|
|
105906
|
+
var ip2 = parseip(addr);
|
|
105907
105907
|
var ipconv;
|
|
105908
|
-
var kind =
|
|
105908
|
+
var kind = ip2.kind();
|
|
105909
105909
|
for (var i2 = 0; i2 < subnets.length; i2++) {
|
|
105910
105910
|
var subnet = subnets[i2];
|
|
105911
105911
|
var subnetip = subnet[0];
|
|
105912
105912
|
var subnetkind = subnetip.kind();
|
|
105913
105913
|
var subnetrange = subnet[1];
|
|
105914
|
-
var trusted =
|
|
105914
|
+
var trusted = ip2;
|
|
105915
105915
|
if (kind !== subnetkind) {
|
|
105916
|
-
if (subnetkind === "ipv4" && !
|
|
105916
|
+
if (subnetkind === "ipv4" && !ip2.isIPv4MappedAddress()) {
|
|
105917
105917
|
continue;
|
|
105918
105918
|
}
|
|
105919
105919
|
if (!ipconv) {
|
|
105920
|
-
ipconv = subnetkind === "ipv4" ?
|
|
105920
|
+
ipconv = subnetkind === "ipv4" ? ip2.toIPv4Address() : ip2.toIPv4MappedAddress();
|
|
105921
105921
|
}
|
|
105922
105922
|
trusted = ipconv;
|
|
105923
105923
|
}
|
|
@@ -105936,15 +105936,15 @@ var require_proxy_addr = __commonJS({
|
|
|
105936
105936
|
return function trust(addr) {
|
|
105937
105937
|
if (!isip(addr))
|
|
105938
105938
|
return false;
|
|
105939
|
-
var
|
|
105940
|
-
var kind =
|
|
105939
|
+
var ip2 = parseip(addr);
|
|
105940
|
+
var kind = ip2.kind();
|
|
105941
105941
|
if (kind !== subnetkind) {
|
|
105942
|
-
if (subnetisipv4 && !
|
|
105942
|
+
if (subnetisipv4 && !ip2.isIPv4MappedAddress()) {
|
|
105943
105943
|
return false;
|
|
105944
105944
|
}
|
|
105945
|
-
|
|
105945
|
+
ip2 = subnetisipv4 ? ip2.toIPv4Address() : ip2.toIPv4MappedAddress();
|
|
105946
105946
|
}
|
|
105947
|
-
return
|
|
105947
|
+
return ip2.match(subnetip, subnetrange);
|
|
105948
105948
|
};
|
|
105949
105949
|
}
|
|
105950
105950
|
}
|
|
@@ -107064,7 +107064,7 @@ var require_request3 = __commonJS({
|
|
|
107064
107064
|
defineGetter(req, "secure", function secure() {
|
|
107065
107065
|
return this.protocol === "https";
|
|
107066
107066
|
});
|
|
107067
|
-
defineGetter(req, "ip", function
|
|
107067
|
+
defineGetter(req, "ip", function ip2() {
|
|
107068
107068
|
var trust = this.app.get("trust proxy fn");
|
|
107069
107069
|
return proxyaddr(this, trust);
|
|
107070
107070
|
});
|
|
@@ -136703,8 +136703,8 @@ init_import_meta_url();
|
|
|
136703
136703
|
var import_node_net = __toESM(require("node:net"), 1);
|
|
136704
136704
|
var import_node_os = __toESM(require("node:os"), 1);
|
|
136705
136705
|
var Locked = class extends Error {
|
|
136706
|
-
constructor(
|
|
136707
|
-
super(`${
|
|
136706
|
+
constructor(port2) {
|
|
136707
|
+
super(`${port2} is locked`);
|
|
136708
136708
|
}
|
|
136709
136709
|
};
|
|
136710
136710
|
var lockedPorts = {
|
|
@@ -136728,9 +136728,9 @@ var checkAvailablePort = (options6) => new Promise((resolve15, reject) => {
|
|
|
136728
136728
|
server2.unref();
|
|
136729
136729
|
server2.on("error", reject);
|
|
136730
136730
|
server2.listen(options6, () => {
|
|
136731
|
-
const { port } = server2.address();
|
|
136731
|
+
const { port: port2 } = server2.address();
|
|
136732
136732
|
server2.close(() => {
|
|
136733
|
-
resolve15(
|
|
136733
|
+
resolve15(port2);
|
|
136734
136734
|
});
|
|
136735
136735
|
});
|
|
136736
136736
|
});
|
|
@@ -136788,17 +136788,17 @@ async function getPorts(options6) {
|
|
|
136788
136788
|
}
|
|
136789
136789
|
}
|
|
136790
136790
|
const hosts = getLocalHosts();
|
|
136791
|
-
for (const
|
|
136791
|
+
for (const port2 of portCheckSequence(ports)) {
|
|
136792
136792
|
try {
|
|
136793
|
-
if (exclude.has(
|
|
136793
|
+
if (exclude.has(port2)) {
|
|
136794
136794
|
continue;
|
|
136795
136795
|
}
|
|
136796
|
-
let availablePort = await getAvailablePort({ ...options6, port }, hosts);
|
|
136796
|
+
let availablePort = await getAvailablePort({ ...options6, port: port2 }, hosts);
|
|
136797
136797
|
while (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {
|
|
136798
|
-
if (
|
|
136799
|
-
throw new Locked(
|
|
136798
|
+
if (port2 !== 0) {
|
|
136799
|
+
throw new Locked(port2);
|
|
136800
136800
|
}
|
|
136801
|
-
availablePort = await getAvailablePort({ ...options6, port }, hosts);
|
|
136801
|
+
availablePort = await getAvailablePort({ ...options6, port: port2 }, hosts);
|
|
136802
136802
|
}
|
|
136803
136803
|
lockedPorts.young.add(availablePort);
|
|
136804
136804
|
return availablePort;
|
|
@@ -137964,8 +137964,8 @@ function normalizeAndValidateMainField(configPath, rawMain, deprecatedUpload) {
|
|
|
137964
137964
|
}
|
|
137965
137965
|
function normalizeAndValidateDev(diagnostics, rawDev) {
|
|
137966
137966
|
const {
|
|
137967
|
-
ip = "0.0.0.0",
|
|
137968
|
-
port,
|
|
137967
|
+
ip: ip2 = "0.0.0.0",
|
|
137968
|
+
port: port2,
|
|
137969
137969
|
inspector_port,
|
|
137970
137970
|
local_protocol = "http",
|
|
137971
137971
|
upstream_protocol = "https",
|
|
@@ -137973,8 +137973,8 @@ function normalizeAndValidateDev(diagnostics, rawDev) {
|
|
|
137973
137973
|
...rest
|
|
137974
137974
|
} = rawDev;
|
|
137975
137975
|
validateAdditionalProperties(diagnostics, "dev", Object.keys(rest), []);
|
|
137976
|
-
validateOptionalProperty(diagnostics, "dev", "ip",
|
|
137977
|
-
validateOptionalProperty(diagnostics, "dev", "port",
|
|
137976
|
+
validateOptionalProperty(diagnostics, "dev", "ip", ip2, "string");
|
|
137977
|
+
validateOptionalProperty(diagnostics, "dev", "port", port2, "number");
|
|
137978
137978
|
validateOptionalProperty(
|
|
137979
137979
|
diagnostics,
|
|
137980
137980
|
"dev",
|
|
@@ -137999,7 +137999,7 @@ function normalizeAndValidateDev(diagnostics, rawDev) {
|
|
|
137999
137999
|
["http", "https"]
|
|
138000
138000
|
);
|
|
138001
138001
|
validateOptionalProperty(diagnostics, "dev", "host", host, "string");
|
|
138002
|
-
return { ip, port, inspector_port, local_protocol, upstream_protocol, host };
|
|
138002
|
+
return { ip: ip2, port: port2, inspector_port, local_protocol, upstream_protocol, host };
|
|
138003
138003
|
}
|
|
138004
138004
|
function normalizeAndValidateMigrations(diagnostics, rawMigrations, durableObjects) {
|
|
138005
138005
|
if (!Array.isArray(rawMigrations)) {
|
|
@@ -141160,7 +141160,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
|
|
|
141160
141160
|
var wrapper_default = import_websocket.default;
|
|
141161
141161
|
|
|
141162
141162
|
// package.json
|
|
141163
|
-
var version = "2.
|
|
141163
|
+
var version = "2.5.0";
|
|
141164
141164
|
var package_default = {
|
|
141165
141165
|
name: "wrangler",
|
|
141166
141166
|
version,
|
|
@@ -141476,7 +141476,7 @@ async function generateCertificate() {
|
|
|
141476
141476
|
name: "subjectAltName",
|
|
141477
141477
|
altNames: [
|
|
141478
141478
|
{ type: 2, value: "localhost" },
|
|
141479
|
-
...getAccessibleHosts().map((
|
|
141479
|
+
...getAccessibleHosts().map((ip2) => ({ type: 7, ip: ip2 }))
|
|
141480
141480
|
]
|
|
141481
141481
|
}
|
|
141482
141482
|
]
|
|
@@ -141602,8 +141602,8 @@ async function startPreviewServer({
|
|
|
141602
141602
|
previewToken,
|
|
141603
141603
|
assetDirectory,
|
|
141604
141604
|
localProtocol,
|
|
141605
|
-
localPort:
|
|
141606
|
-
ip,
|
|
141605
|
+
localPort: port2,
|
|
141606
|
+
ip: ip2,
|
|
141607
141607
|
onReady
|
|
141608
141608
|
}) {
|
|
141609
141609
|
try {
|
|
@@ -141628,25 +141628,25 @@ async function startPreviewServer({
|
|
|
141628
141628
|
},
|
|
141629
141629
|
assetDirectory,
|
|
141630
141630
|
localProtocol,
|
|
141631
|
-
port,
|
|
141631
|
+
port: port2,
|
|
141632
141632
|
accessTokenRef
|
|
141633
141633
|
});
|
|
141634
|
-
await waitForPortToBeAvailable(
|
|
141634
|
+
await waitForPortToBeAvailable(port2, {
|
|
141635
141635
|
retryPeriod: 200,
|
|
141636
141636
|
timeout: 2e3,
|
|
141637
141637
|
abortSignal: abortController.signal
|
|
141638
141638
|
});
|
|
141639
141639
|
proxy2.server.on("listening", () => {
|
|
141640
141640
|
const address = proxy2.server.address();
|
|
141641
|
-
const usedPort = address && typeof address === "object" ? address.port :
|
|
141642
|
-
logger.log(`\u2B23 Listening at ${localProtocol}://${
|
|
141643
|
-
const accessibleHosts =
|
|
141641
|
+
const usedPort = address && typeof address === "object" ? address.port : port2;
|
|
141642
|
+
logger.log(`\u2B23 Listening at ${localProtocol}://${ip2}:${usedPort}`);
|
|
141643
|
+
const accessibleHosts = ip2 !== "0.0.0.0" ? [ip2] : getAccessibleHosts2();
|
|
141644
141644
|
for (const accessibleHost of accessibleHosts) {
|
|
141645
141645
|
logger.log(`- ${localProtocol}://${accessibleHost}:${usedPort}`);
|
|
141646
141646
|
}
|
|
141647
|
-
onReady?.(
|
|
141647
|
+
onReady?.(ip2, usedPort);
|
|
141648
141648
|
});
|
|
141649
|
-
proxy2.server.listen(
|
|
141649
|
+
proxy2.server.listen(port2, ip2);
|
|
141650
141650
|
return {
|
|
141651
141651
|
stop: () => {
|
|
141652
141652
|
abortController.abort();
|
|
@@ -141664,8 +141664,8 @@ function usePreviewServer({
|
|
|
141664
141664
|
previewToken,
|
|
141665
141665
|
assetDirectory,
|
|
141666
141666
|
localProtocol,
|
|
141667
|
-
localPort:
|
|
141668
|
-
ip
|
|
141667
|
+
localPort: port2,
|
|
141668
|
+
ip: ip2
|
|
141669
141669
|
}) {
|
|
141670
141670
|
const [proxy2, setProxy] = (0, import_react.useState)();
|
|
141671
141671
|
(0, import_react.useEffect)(() => {
|
|
@@ -141699,7 +141699,7 @@ function usePreviewServer({
|
|
|
141699
141699
|
retryServerSetup,
|
|
141700
141700
|
assetDirectory,
|
|
141701
141701
|
localProtocol,
|
|
141702
|
-
port,
|
|
141702
|
+
port: port2,
|
|
141703
141703
|
accessTokenRef
|
|
141704
141704
|
});
|
|
141705
141705
|
return () => {
|
|
@@ -141708,7 +141708,7 @@ function usePreviewServer({
|
|
|
141708
141708
|
}, [
|
|
141709
141709
|
previewToken,
|
|
141710
141710
|
assetDirectory,
|
|
141711
|
-
|
|
141711
|
+
port2,
|
|
141712
141712
|
localProtocol,
|
|
141713
141713
|
proxy2,
|
|
141714
141714
|
retryServerSetupSigil
|
|
@@ -141718,21 +141718,21 @@ function usePreviewServer({
|
|
|
141718
141718
|
if (proxy2 === void 0) {
|
|
141719
141719
|
return;
|
|
141720
141720
|
}
|
|
141721
|
-
waitForPortToBeAvailable(
|
|
141721
|
+
waitForPortToBeAvailable(port2, {
|
|
141722
141722
|
retryPeriod: 200,
|
|
141723
141723
|
timeout: 2e3,
|
|
141724
141724
|
abortSignal: abortController.signal
|
|
141725
141725
|
}).then(() => {
|
|
141726
141726
|
proxy2.server.on("listening", () => {
|
|
141727
141727
|
const address = proxy2.server.address();
|
|
141728
|
-
const usedPort = address && typeof address === "object" ? address.port :
|
|
141729
|
-
logger.log(`\u2B23 Listening at ${localProtocol}://${
|
|
141730
|
-
const accessibleHosts =
|
|
141728
|
+
const usedPort = address && typeof address === "object" ? address.port : port2;
|
|
141729
|
+
logger.log(`\u2B23 Listening at ${localProtocol}://${ip2}:${usedPort}`);
|
|
141730
|
+
const accessibleHosts = ip2 !== "0.0.0.0" ? [ip2] : getAccessibleHosts2();
|
|
141731
141731
|
for (const accessibleHost of accessibleHosts) {
|
|
141732
141732
|
logger.log(`- ${localProtocol}://${accessibleHost}:${usedPort}`);
|
|
141733
141733
|
}
|
|
141734
141734
|
});
|
|
141735
|
-
proxy2.server.listen(
|
|
141735
|
+
proxy2.server.listen(port2, ip2);
|
|
141736
141736
|
}).catch((err2) => {
|
|
141737
141737
|
if (err2.code !== "ABORT_ERR") {
|
|
141738
141738
|
logger.error(`Failed to start server: ${err2}`);
|
|
@@ -141742,7 +141742,7 @@ function usePreviewServer({
|
|
|
141742
141742
|
abortController.abort();
|
|
141743
141743
|
proxy2.terminator.terminate().catch(() => logger.error("Failed to terminate the proxy server."));
|
|
141744
141744
|
};
|
|
141745
|
-
}, [
|
|
141745
|
+
}, [port2, ip2, proxy2, localProtocol]);
|
|
141746
141746
|
}
|
|
141747
141747
|
function configureProxyServer({
|
|
141748
141748
|
proxy: proxy2,
|
|
@@ -141750,7 +141750,7 @@ function configureProxyServer({
|
|
|
141750
141750
|
streamBufferRef,
|
|
141751
141751
|
requestResponseBufferRef,
|
|
141752
141752
|
retryServerSetup,
|
|
141753
|
-
port,
|
|
141753
|
+
port: port2,
|
|
141754
141754
|
localProtocol,
|
|
141755
141755
|
assetDirectory,
|
|
141756
141756
|
accessTokenRef
|
|
@@ -141783,7 +141783,7 @@ function configureProxyServer({
|
|
|
141783
141783
|
const handleStream = createStreamHandler(
|
|
141784
141784
|
previewToken,
|
|
141785
141785
|
remote,
|
|
141786
|
-
|
|
141786
|
+
port2,
|
|
141787
141787
|
localProtocol,
|
|
141788
141788
|
accessTokenRef
|
|
141789
141789
|
);
|
|
@@ -141824,7 +141824,7 @@ function configureProxyServer({
|
|
|
141824
141824
|
rewriteRemoteHostToLocalHostInHeaders(
|
|
141825
141825
|
responseHeaders,
|
|
141826
141826
|
previewToken.host,
|
|
141827
|
-
|
|
141827
|
+
port2,
|
|
141828
141828
|
localProtocol
|
|
141829
141829
|
);
|
|
141830
141830
|
for (const name of Object.keys(responseHeaders)) {
|
|
@@ -141938,7 +141938,7 @@ function createStreamHandler(previewToken, remote, localPort, localProtocol, acc
|
|
|
141938
141938
|
});
|
|
141939
141939
|
};
|
|
141940
141940
|
}
|
|
141941
|
-
async function waitForPortToBeAvailable(
|
|
141941
|
+
async function waitForPortToBeAvailable(port2, options6) {
|
|
141942
141942
|
return new Promise((resolve15, reject) => {
|
|
141943
141943
|
options6.abortSignal.addEventListener("abort", () => {
|
|
141944
141944
|
const abortError = new Error("waitForPortToBeAvailable() aborted");
|
|
@@ -141946,7 +141946,7 @@ async function waitForPortToBeAvailable(port, options6) {
|
|
|
141946
141946
|
doReject(abortError);
|
|
141947
141947
|
});
|
|
141948
141948
|
const timeout = setTimeout(() => {
|
|
141949
|
-
doReject(new Error(`Timed out waiting for port ${
|
|
141949
|
+
doReject(new Error(`Timed out waiting for port ${port2}`));
|
|
141950
141950
|
}, options6.timeout);
|
|
141951
141951
|
const interval2 = setInterval(checkPort, options6.retryPeriod);
|
|
141952
141952
|
checkPort();
|
|
@@ -141961,6 +141961,10 @@ async function waitForPortToBeAvailable(port, options6) {
|
|
|
141961
141961
|
reject(err2);
|
|
141962
141962
|
}
|
|
141963
141963
|
function checkPort() {
|
|
141964
|
+
if (port2 === 0) {
|
|
141965
|
+
doResolve();
|
|
141966
|
+
return;
|
|
141967
|
+
}
|
|
141964
141968
|
const server2 = (0, import_node_http.createServer)();
|
|
141965
141969
|
const terminator2 = (0, import_http_terminator2.createHttpTerminator)({
|
|
141966
141970
|
server: server2,
|
|
@@ -141972,7 +141976,7 @@ async function waitForPortToBeAvailable(port, options6) {
|
|
|
141972
141976
|
}
|
|
141973
141977
|
});
|
|
141974
141978
|
server2.listen(
|
|
141975
|
-
|
|
141979
|
+
port2,
|
|
141976
141980
|
() => terminator2.terminate().then(
|
|
141977
141981
|
doResolve,
|
|
141978
141982
|
() => logger.error("Failed to terminate the port checker.")
|
|
@@ -143981,12 +143985,12 @@ function useLocalWorker({
|
|
|
143981
143985
|
bindings,
|
|
143982
143986
|
workerDefinitions,
|
|
143983
143987
|
assetPaths,
|
|
143984
|
-
|
|
143988
|
+
initialPort,
|
|
143985
143989
|
inspectorPort,
|
|
143986
143990
|
rules,
|
|
143987
143991
|
localPersistencePath,
|
|
143988
143992
|
liveReload,
|
|
143989
|
-
|
|
143993
|
+
initialIp,
|
|
143990
143994
|
crons,
|
|
143991
143995
|
queueConsumers,
|
|
143992
143996
|
localProtocol,
|
|
@@ -144024,7 +144028,7 @@ function useLocalWorker({
|
|
|
144024
144028
|
async function startLocalWorker() {
|
|
144025
144029
|
if (!bundle || !format6)
|
|
144026
144030
|
return;
|
|
144027
|
-
await waitForPortToBeAvailable(
|
|
144031
|
+
await waitForPortToBeAvailable(initialPort, {
|
|
144028
144032
|
retryPeriod: 200,
|
|
144029
144033
|
timeout: 2e3,
|
|
144030
144034
|
abortSignal: abortController.signal
|
|
@@ -144053,10 +144057,10 @@ function useLocalWorker({
|
|
|
144053
144057
|
});
|
|
144054
144058
|
const { forkOptions, miniflareCLIPath, options: options6 } = setupMiniflareOptions({
|
|
144055
144059
|
workerName,
|
|
144056
|
-
port,
|
|
144060
|
+
port: initialPort,
|
|
144057
144061
|
scriptPath,
|
|
144058
144062
|
localProtocol,
|
|
144059
|
-
ip,
|
|
144063
|
+
ip: initialIp,
|
|
144060
144064
|
format: format6,
|
|
144061
144065
|
rules,
|
|
144062
144066
|
compatibilityDate,
|
|
@@ -144133,7 +144137,11 @@ function useLocalWorker({
|
|
|
144133
144137
|
}
|
|
144134
144138
|
return;
|
|
144135
144139
|
}
|
|
144136
|
-
const nodeOptions = setupNodeOptions({
|
|
144140
|
+
const nodeOptions = setupNodeOptions({
|
|
144141
|
+
inspect: inspect2,
|
|
144142
|
+
ip: initialIp,
|
|
144143
|
+
inspectorPort
|
|
144144
|
+
});
|
|
144137
144145
|
logger.log("\u2394 Starting a local server...");
|
|
144138
144146
|
const child = local.current = (0, import_node_child_process2.fork)(miniflareCLIPath, forkOptions, {
|
|
144139
144147
|
cwd: import_node_path15.default.dirname(scriptPath),
|
|
@@ -144151,19 +144159,19 @@ function useLocalWorker({
|
|
|
144151
144159
|
await registerWorker(workerName, {
|
|
144152
144160
|
protocol: localProtocol,
|
|
144153
144161
|
mode: "local",
|
|
144154
|
-
port,
|
|
144155
|
-
host:
|
|
144162
|
+
port: message.port,
|
|
144163
|
+
host: initialIp,
|
|
144156
144164
|
durableObjects: internalDurableObjects.map((binding) => ({
|
|
144157
144165
|
name: binding.name,
|
|
144158
144166
|
className: binding.class_name
|
|
144159
144167
|
})),
|
|
144160
144168
|
...message.durableObjectsPort ? {
|
|
144161
|
-
durableObjectsHost:
|
|
144169
|
+
durableObjectsHost: initialIp,
|
|
144162
144170
|
durableObjectsPort: message.durableObjectsPort
|
|
144163
144171
|
} : {}
|
|
144164
144172
|
});
|
|
144165
144173
|
}
|
|
144166
|
-
onReady?.(
|
|
144174
|
+
onReady?.(initialIp, message.port);
|
|
144167
144175
|
}
|
|
144168
144176
|
});
|
|
144169
144177
|
child.on("close", (code) => {
|
|
@@ -144221,9 +144229,9 @@ function useLocalWorker({
|
|
|
144221
144229
|
bundle,
|
|
144222
144230
|
workerName,
|
|
144223
144231
|
format6,
|
|
144224
|
-
|
|
144232
|
+
initialPort,
|
|
144225
144233
|
inspectorPort,
|
|
144226
|
-
|
|
144234
|
+
initialIp,
|
|
144227
144235
|
queueConsumers,
|
|
144228
144236
|
bindings.queues,
|
|
144229
144237
|
bindings.durable_objects,
|
|
@@ -144319,10 +144327,10 @@ function setupBindings({
|
|
|
144319
144327
|
}
|
|
144320
144328
|
function setupMiniflareOptions({
|
|
144321
144329
|
workerName,
|
|
144322
|
-
port,
|
|
144330
|
+
port: port2,
|
|
144323
144331
|
scriptPath,
|
|
144324
144332
|
localProtocol,
|
|
144325
|
-
ip,
|
|
144333
|
+
ip: ip2,
|
|
144326
144334
|
format: format6,
|
|
144327
144335
|
rules,
|
|
144328
144336
|
compatibilityDate,
|
|
@@ -144350,10 +144358,10 @@ function setupMiniflareOptions({
|
|
|
144350
144358
|
}) {
|
|
144351
144359
|
const options6 = {
|
|
144352
144360
|
name: workerName,
|
|
144353
|
-
port,
|
|
144361
|
+
port: port2,
|
|
144354
144362
|
scriptPath,
|
|
144355
144363
|
https: localProtocol === "https",
|
|
144356
|
-
host:
|
|
144364
|
+
host: ip2,
|
|
144357
144365
|
modules: format6 === "modules",
|
|
144358
144366
|
modulesRules: (rules || []).concat(DEFAULT_MODULE_RULES).map(({ type: type2, globs: include, fallthrough }) => ({
|
|
144359
144367
|
type: type2,
|
|
@@ -144446,7 +144454,7 @@ function setupMiniflareOptions({
|
|
|
144446
144454
|
}
|
|
144447
144455
|
function setupNodeOptions({
|
|
144448
144456
|
inspect: inspect2,
|
|
144449
|
-
ip,
|
|
144457
|
+
ip: ip2,
|
|
144450
144458
|
inspectorPort
|
|
144451
144459
|
}) {
|
|
144452
144460
|
const nodeOptions = [
|
|
@@ -144454,7 +144462,7 @@ function setupNodeOptions({
|
|
|
144454
144462
|
"--no-warnings"
|
|
144455
144463
|
];
|
|
144456
144464
|
if (inspect2) {
|
|
144457
|
-
nodeOptions.push(`--inspect=${
|
|
144465
|
+
nodeOptions.push(`--inspect=${ip2}:${inspectorPort}`);
|
|
144458
144466
|
}
|
|
144459
144467
|
return nodeOptions;
|
|
144460
144468
|
}
|
|
@@ -146507,23 +146515,35 @@ function DevImplementation(props) {
|
|
|
146507
146515
|
local: props.initialMode === "local"
|
|
146508
146516
|
});
|
|
146509
146517
|
}
|
|
146518
|
+
var ip;
|
|
146519
|
+
var port;
|
|
146510
146520
|
function InteractiveDevSession(props) {
|
|
146511
146521
|
const toggles = useHotkeys({
|
|
146512
146522
|
initial: {
|
|
146513
146523
|
local: props.initialMode === "local",
|
|
146514
146524
|
tunnel: false
|
|
146515
146525
|
},
|
|
146516
|
-
port: props.port,
|
|
146517
|
-
ip: props.ip,
|
|
146518
146526
|
inspectorPort: props.inspectorPort,
|
|
146519
146527
|
inspect: props.inspect,
|
|
146520
146528
|
localProtocol: props.localProtocol,
|
|
146521
146529
|
forceLocal: props.forceLocal
|
|
146522
146530
|
});
|
|
146531
|
+
ip = props.initialIp;
|
|
146532
|
+
port = props.initialPort;
|
|
146523
146533
|
useTunnel(toggles.tunnel);
|
|
146534
|
+
const onReady = (newIp, newPort) => {
|
|
146535
|
+
if (newIp !== props.initialIp || newPort !== props.initialPort) {
|
|
146536
|
+
ip = newIp;
|
|
146537
|
+
port = newPort;
|
|
146538
|
+
if (props.onReady) {
|
|
146539
|
+
props.onReady(newIp, newPort);
|
|
146540
|
+
}
|
|
146541
|
+
}
|
|
146542
|
+
};
|
|
146524
146543
|
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement(DevSession, {
|
|
146525
146544
|
...props,
|
|
146526
|
-
local: toggles.local
|
|
146545
|
+
local: toggles.local,
|
|
146546
|
+
onReady
|
|
146527
146547
|
}), /* @__PURE__ */ import_react8.default.createElement(import_ink4.Box, {
|
|
146528
146548
|
borderStyle: "round",
|
|
146529
146549
|
paddingLeft: 1,
|
|
@@ -146601,6 +146621,20 @@ function DevSession(props) {
|
|
|
146601
146621
|
"Queues are currently in Beta and are not supported in wrangler dev remote mode."
|
|
146602
146622
|
);
|
|
146603
146623
|
}
|
|
146624
|
+
const announceAndOnReady = (finalIp, finalPort) => {
|
|
146625
|
+
if (process.send) {
|
|
146626
|
+
process.send(
|
|
146627
|
+
JSON.stringify({
|
|
146628
|
+
event: "DEV_SERVER_READY",
|
|
146629
|
+
ip: finalIp,
|
|
146630
|
+
port: finalPort
|
|
146631
|
+
})
|
|
146632
|
+
);
|
|
146633
|
+
}
|
|
146634
|
+
if (props.onReady) {
|
|
146635
|
+
props.onReady(finalIp, finalPort);
|
|
146636
|
+
}
|
|
146637
|
+
};
|
|
146604
146638
|
return props.local ? /* @__PURE__ */ import_react8.default.createElement(Local, {
|
|
146605
146639
|
name: props.name,
|
|
146606
146640
|
bundle,
|
|
@@ -146611,8 +146645,8 @@ function DevSession(props) {
|
|
|
146611
146645
|
bindings: props.bindings,
|
|
146612
146646
|
workerDefinitions,
|
|
146613
146647
|
assetPaths: props.assetPaths,
|
|
146614
|
-
|
|
146615
|
-
|
|
146648
|
+
initialPort: props.initialPort,
|
|
146649
|
+
initialIp: props.initialIp,
|
|
146616
146650
|
rules: props.rules,
|
|
146617
146651
|
inspectorPort: props.inspectorPort,
|
|
146618
146652
|
localPersistencePath: props.localPersistencePath,
|
|
@@ -146623,7 +146657,7 @@ function DevSession(props) {
|
|
|
146623
146657
|
localUpstream: props.localUpstream,
|
|
146624
146658
|
logPrefix: props.logPrefix,
|
|
146625
146659
|
inspect: props.inspect,
|
|
146626
|
-
onReady:
|
|
146660
|
+
onReady: announceAndOnReady,
|
|
146627
146661
|
enablePagesAssetsServiceBinding: props.enablePagesAssetsServiceBinding,
|
|
146628
146662
|
experimentalLocal: props.experimentalLocal,
|
|
146629
146663
|
accountId: props.accountId,
|
|
@@ -146636,8 +146670,8 @@ function DevSession(props) {
|
|
|
146636
146670
|
bindings: props.bindings,
|
|
146637
146671
|
assetPaths: props.assetPaths,
|
|
146638
146672
|
isWorkersSite: props.isWorkersSite,
|
|
146639
|
-
port: props.
|
|
146640
|
-
ip: props.
|
|
146673
|
+
port: props.initialPort,
|
|
146674
|
+
ip: props.initialIp,
|
|
146641
146675
|
localProtocol: props.localProtocol,
|
|
146642
146676
|
inspectorPort: props.inspectorPort,
|
|
146643
146677
|
inspect: props.inspect,
|
|
@@ -146649,7 +146683,7 @@ function DevSession(props) {
|
|
|
146649
146683
|
zone: props.zone,
|
|
146650
146684
|
host: props.host,
|
|
146651
146685
|
routes: props.routes,
|
|
146652
|
-
onReady:
|
|
146686
|
+
onReady: announceAndOnReady,
|
|
146653
146687
|
sourceMapPath: bundle?.sourceMapPath,
|
|
146654
146688
|
sendMetrics: props.sendMetrics
|
|
146655
146689
|
});
|
|
@@ -146768,15 +146802,7 @@ function useTunnel(toggle) {
|
|
|
146768
146802
|
}, [toggle]);
|
|
146769
146803
|
}
|
|
146770
146804
|
function useHotkeys(props) {
|
|
146771
|
-
const {
|
|
146772
|
-
initial,
|
|
146773
|
-
port,
|
|
146774
|
-
ip,
|
|
146775
|
-
inspectorPort,
|
|
146776
|
-
inspect: inspect2,
|
|
146777
|
-
localProtocol,
|
|
146778
|
-
forceLocal
|
|
146779
|
-
} = props;
|
|
146805
|
+
const { initial, inspectorPort, inspect: inspect2, localProtocol, forceLocal } = props;
|
|
146780
146806
|
const [toggles, setToggles] = (0, import_react8.useState)(initial);
|
|
146781
146807
|
const { exit: exit2 } = (0, import_ink4.useApp)();
|
|
146782
146808
|
(0, import_ink4.useInput)(
|
|
@@ -146927,8 +146953,8 @@ async function startDevServer(props) {
|
|
|
146927
146953
|
compatibilityFlags: props.compatibilityFlags,
|
|
146928
146954
|
bindings: props.bindings,
|
|
146929
146955
|
assetPaths: props.assetPaths,
|
|
146930
|
-
|
|
146931
|
-
|
|
146956
|
+
initialPort: props.initialPort,
|
|
146957
|
+
initialIp: props.initialIp,
|
|
146932
146958
|
rules: props.rules,
|
|
146933
146959
|
inspectorPort: props.inspectorPort,
|
|
146934
146960
|
localPersistencePath: props.localPersistencePath,
|
|
@@ -146963,8 +146989,8 @@ async function startDevServer(props) {
|
|
|
146963
146989
|
bindings: props.bindings,
|
|
146964
146990
|
assetPaths: props.assetPaths,
|
|
146965
146991
|
isWorkersSite: props.isWorkersSite,
|
|
146966
|
-
port: props.
|
|
146967
|
-
ip: props.
|
|
146992
|
+
port: props.initialPort,
|
|
146993
|
+
ip: props.initialIp,
|
|
146968
146994
|
localProtocol: props.localProtocol,
|
|
146969
146995
|
inspectorPort: props.inspectorPort,
|
|
146970
146996
|
inspect: props.inspect,
|
|
@@ -147079,12 +147105,12 @@ async function startLocalServer({
|
|
|
147079
147105
|
bindings,
|
|
147080
147106
|
workerDefinitions,
|
|
147081
147107
|
assetPaths,
|
|
147082
|
-
|
|
147108
|
+
initialPort,
|
|
147083
147109
|
inspectorPort,
|
|
147084
147110
|
rules,
|
|
147085
147111
|
localPersistencePath,
|
|
147086
147112
|
liveReload,
|
|
147087
|
-
|
|
147113
|
+
initialIp,
|
|
147088
147114
|
crons,
|
|
147089
147115
|
queueConsumers,
|
|
147090
147116
|
localProtocol,
|
|
@@ -147108,13 +147134,11 @@ async function startLocalServer({
|
|
|
147108
147134
|
async function startLocalWorker() {
|
|
147109
147135
|
if (!bundle || !format6)
|
|
147110
147136
|
return;
|
|
147111
|
-
|
|
147112
|
-
|
|
147113
|
-
|
|
147114
|
-
|
|
147115
|
-
|
|
147116
|
-
});
|
|
147117
|
-
}
|
|
147137
|
+
await waitForPortToBeAvailable(initialPort, {
|
|
147138
|
+
retryPeriod: 200,
|
|
147139
|
+
timeout: 2e3,
|
|
147140
|
+
abortSignal: abortController.signal
|
|
147141
|
+
});
|
|
147118
147142
|
if (bindings.services && bindings.services.length > 0) {
|
|
147119
147143
|
logger.warn(
|
|
147120
147144
|
"\u2394 Support for service bindings in local mode is experimental and may change."
|
|
@@ -147144,10 +147168,10 @@ async function startLocalServer({
|
|
|
147144
147168
|
});
|
|
147145
147169
|
const { forkOptions, miniflareCLIPath, options: options6 } = setupMiniflareOptions({
|
|
147146
147170
|
workerName,
|
|
147147
|
-
port,
|
|
147171
|
+
port: initialPort,
|
|
147148
147172
|
scriptPath,
|
|
147149
147173
|
localProtocol,
|
|
147150
|
-
ip,
|
|
147174
|
+
ip: initialIp,
|
|
147151
147175
|
format: format6,
|
|
147152
147176
|
rules,
|
|
147153
147177
|
compatibilityDate,
|
|
@@ -147198,7 +147222,11 @@ async function startLocalServer({
|
|
|
147198
147222
|
onReady?.(runtimeURL.hostname, parseInt(runtimeURL.port ?? 8787));
|
|
147199
147223
|
return;
|
|
147200
147224
|
}
|
|
147201
|
-
const nodeOptions = setupNodeOptions({
|
|
147225
|
+
const nodeOptions = setupNodeOptions({
|
|
147226
|
+
inspect: inspect2,
|
|
147227
|
+
ip: initialIp,
|
|
147228
|
+
inspectorPort
|
|
147229
|
+
});
|
|
147202
147230
|
logger.log("\u2394 Starting a local server...");
|
|
147203
147231
|
const child = local = (0, import_node_child_process4.fork)(miniflareCLIPath, forkOptions, {
|
|
147204
147232
|
cwd: path22.dirname(scriptPath),
|
|
@@ -147212,19 +147240,19 @@ async function startLocalServer({
|
|
|
147212
147240
|
await registerWorker(workerName, {
|
|
147213
147241
|
protocol: localProtocol,
|
|
147214
147242
|
mode: "local",
|
|
147215
|
-
port: message.
|
|
147216
|
-
host:
|
|
147243
|
+
port: message.port,
|
|
147244
|
+
host: initialIp,
|
|
147217
147245
|
durableObjects: internalDurableObjects.map((binding) => ({
|
|
147218
147246
|
name: binding.name,
|
|
147219
147247
|
className: binding.class_name
|
|
147220
147248
|
})),
|
|
147221
147249
|
...message.durableObjectsPort ? {
|
|
147222
|
-
durableObjectsHost:
|
|
147250
|
+
durableObjectsHost: initialIp,
|
|
147223
147251
|
durableObjectsPort: message.durableObjectsPort
|
|
147224
147252
|
} : {}
|
|
147225
147253
|
});
|
|
147226
147254
|
}
|
|
147227
|
-
onReady?.(
|
|
147255
|
+
onReady?.(initialIp, message.port);
|
|
147228
147256
|
}
|
|
147229
147257
|
});
|
|
147230
147258
|
child.on("close", (code) => {
|
|
@@ -153851,9 +153879,9 @@ var RestoreHandler = withConfig(
|
|
|
153851
153879
|
accountId,
|
|
153852
153880
|
name
|
|
153853
153881
|
);
|
|
153854
|
-
|
|
153882
|
+
logger.log(`Restoring ${name} from backup ${backupId}....`);
|
|
153855
153883
|
await restoreBackup(accountId, db.uuid, backupId);
|
|
153856
|
-
|
|
153884
|
+
logger.log(`Done!`);
|
|
153857
153885
|
}
|
|
153858
153886
|
);
|
|
153859
153887
|
var restoreBackup = async (accountId, uuid, backupId) => {
|
|
@@ -153892,6 +153920,11 @@ var DownloadHandler = withConfig(
|
|
|
153892
153920
|
);
|
|
153893
153921
|
logger.log(`\u{1F300} Downloading backup ${backupId} from '${name}'`);
|
|
153894
153922
|
const response = await getBackupResponse(accountId, db.uuid, backupId);
|
|
153923
|
+
if (!response.ok) {
|
|
153924
|
+
throw new Error(
|
|
153925
|
+
`Failed to download backup ${backupId} from '${name}' - got ${response.status} from the API`
|
|
153926
|
+
);
|
|
153927
|
+
}
|
|
153895
153928
|
logger.log(`\u{1F300} Saving to ${filename}`);
|
|
153896
153929
|
const buffer2 = await response.arrayBuffer();
|
|
153897
153930
|
await import_promises7.default.writeFile(filename, new Buffer(buffer2));
|
|
@@ -153963,19 +153996,19 @@ var Handler3 = withConfig(
|
|
|
153963
153996
|
accountId,
|
|
153964
153997
|
name
|
|
153965
153998
|
);
|
|
153966
|
-
|
|
153999
|
+
logger.log(`About to delete DB '${name}' (${db.uuid}).`);
|
|
153967
154000
|
if (!skipConfirmation) {
|
|
153968
154001
|
const response = await confirm(`Ok to proceed?`);
|
|
153969
154002
|
if (!response) {
|
|
153970
|
-
|
|
154003
|
+
logger.log(`Not deleting.`);
|
|
153971
154004
|
return;
|
|
153972
154005
|
}
|
|
153973
154006
|
}
|
|
153974
|
-
|
|
154007
|
+
logger.log("Deleting...");
|
|
153975
154008
|
await fetchResult(`/accounts/${accountId}/d1/database/${db.uuid}`, {
|
|
153976
154009
|
method: "DELETE"
|
|
153977
154010
|
});
|
|
153978
|
-
|
|
154011
|
+
logger.log(`Deleted '${name}' successfully.`);
|
|
153979
154012
|
}
|
|
153980
154013
|
);
|
|
153981
154014
|
|
|
@@ -154258,7 +154291,7 @@ var listAppliedMigrations = async (migrationsTableName, local, config, name, per
|
|
|
154258
154291
|
local,
|
|
154259
154292
|
config,
|
|
154260
154293
|
name,
|
|
154261
|
-
|
|
154294
|
+
isInteractive() && !CI.isCI(),
|
|
154262
154295
|
persistTo,
|
|
154263
154296
|
void 0,
|
|
154264
154297
|
Query
|
|
@@ -154293,7 +154326,7 @@ var initMigrationsTable = async (migrationsTableName, local, config, name, persi
|
|
|
154293
154326
|
local,
|
|
154294
154327
|
config,
|
|
154295
154328
|
name,
|
|
154296
|
-
|
|
154329
|
+
isInteractive() && !CI.isCI(),
|
|
154297
154330
|
persistTo,
|
|
154298
154331
|
void 0,
|
|
154299
154332
|
`
|
|
@@ -154307,9 +154340,22 @@ var initMigrationsTable = async (migrationsTableName, local, config, name, persi
|
|
|
154307
154340
|
);
|
|
154308
154341
|
};
|
|
154309
154342
|
|
|
154343
|
+
// src/d1/migrations/options.ts
|
|
154344
|
+
init_import_meta_url();
|
|
154345
|
+
function DatabaseWithLocal(yargs) {
|
|
154346
|
+
return Database(yargs).option("local", {
|
|
154347
|
+
describe: "Execute commands/files against a local DB for use with wrangler dev --local",
|
|
154348
|
+
type: "boolean"
|
|
154349
|
+
}).option("persist-to", {
|
|
154350
|
+
describe: "Specify directory to use for local persistence (you must use --local with this flag)",
|
|
154351
|
+
type: "string",
|
|
154352
|
+
requiresArg: true
|
|
154353
|
+
}).implies("persist-to", "local");
|
|
154354
|
+
}
|
|
154355
|
+
|
|
154310
154356
|
// src/d1/migrations/apply.tsx
|
|
154311
154357
|
function ApplyOptions(yargs) {
|
|
154312
|
-
return
|
|
154358
|
+
return DatabaseWithLocal(yargs);
|
|
154313
154359
|
}
|
|
154314
154360
|
var ApplyHandler = withConfig(
|
|
154315
154361
|
async ({ config, database, local, persistTo }) => {
|
|
@@ -154363,8 +154409,7 @@ var ApplyHandler = withConfig(
|
|
|
154363
154409
|
(0, import_ink10.render)(/* @__PURE__ */ import_react14.default.createElement(import_ink10.Text, null, "\u2705 No migrations to apply!"));
|
|
154364
154410
|
return;
|
|
154365
154411
|
}
|
|
154366
|
-
|
|
154367
|
-
if (isInteractive2) {
|
|
154412
|
+
if (isInteractive() && !CI.isCI()) {
|
|
154368
154413
|
const ok = await confirm(
|
|
154369
154414
|
`About to apply ${unappliedMigrations.length} migration(s)
|
|
154370
154415
|
Your database may not be available to serve requests during the migration, continue?`,
|
|
@@ -154396,7 +154441,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
|
154396
154441
|
local,
|
|
154397
154442
|
config,
|
|
154398
154443
|
database,
|
|
154399
|
-
|
|
154444
|
+
isInteractive() && !CI.isCI(),
|
|
154400
154445
|
persistTo,
|
|
154401
154446
|
void 0,
|
|
154402
154447
|
query
|
|
@@ -154503,7 +154548,7 @@ var import_ink12 = __toESM(require_build2());
|
|
|
154503
154548
|
var import_ink_table6 = __toESM(require_dist2());
|
|
154504
154549
|
var import_react16 = __toESM(require_react());
|
|
154505
154550
|
function ListOptions2(yargs) {
|
|
154506
|
-
return
|
|
154551
|
+
return DatabaseWithLocal(yargs);
|
|
154507
154552
|
}
|
|
154508
154553
|
var ListHandler2 = withConfig(
|
|
154509
154554
|
async ({ config, database, local, persistTo }) => {
|
|
@@ -154573,7 +154618,7 @@ var d1 = (yargs) => {
|
|
|
154573
154618
|
).command(
|
|
154574
154619
|
"backup",
|
|
154575
154620
|
"Interact with D1 Backups",
|
|
154576
|
-
(yargs2) => yargs2.command(
|
|
154621
|
+
(yargs2) => yargs2.demandCommand().command(
|
|
154577
154622
|
"list <name>",
|
|
154578
154623
|
"List your D1 backups",
|
|
154579
154624
|
ListOptions,
|
|
@@ -154602,7 +154647,7 @@ var d1 = (yargs) => {
|
|
|
154602
154647
|
).command(
|
|
154603
154648
|
"migrations",
|
|
154604
154649
|
"Interact with D1 Migrations",
|
|
154605
|
-
(yargs2) => yargs2.command(
|
|
154650
|
+
(yargs2) => yargs2.demandCommand().command(
|
|
154606
154651
|
"list <database>",
|
|
154607
154652
|
"List your D1 migrations",
|
|
154608
154653
|
ListOptions2,
|
|
@@ -158355,8 +158400,8 @@ var Handler7 = async ({
|
|
|
158355
158400
|
directory,
|
|
158356
158401
|
"compatibility-date": compatibilityDate,
|
|
158357
158402
|
"compatibility-flags": compatibilityFlags,
|
|
158358
|
-
ip,
|
|
158359
|
-
port,
|
|
158403
|
+
ip: ip2,
|
|
158404
|
+
port: port2,
|
|
158360
158405
|
"inspector-port": inspectorPort,
|
|
158361
158406
|
proxy: requestedProxyPort,
|
|
158362
158407
|
"script-path": singleWorkerScriptPath,
|
|
@@ -158470,8 +158515,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
|
158470
158515
|
onEnd,
|
|
158471
158516
|
buildOutputDirectory: directory,
|
|
158472
158517
|
nodeCompat,
|
|
158473
|
-
local: true
|
|
158474
|
-
d1Databases: d1s.map((binding) => binding.toString())
|
|
158518
|
+
local: true
|
|
158475
158519
|
});
|
|
158476
158520
|
await sendMetricsEvent("build pages functions");
|
|
158477
158521
|
(0, import_chokidar3.watch)([functionsDirectory], {
|
|
@@ -158487,8 +158531,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
|
158487
158531
|
onEnd,
|
|
158488
158532
|
buildOutputDirectory: directory,
|
|
158489
158533
|
nodeCompat,
|
|
158490
|
-
local: true
|
|
158491
|
-
d1Databases: d1s.map((binding) => binding.toString())
|
|
158534
|
+
local: true
|
|
158492
158535
|
});
|
|
158493
158536
|
await sendMetricsEvent("build pages functions");
|
|
158494
158537
|
} catch (e2) {
|
|
@@ -158603,8 +158646,8 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
|
158603
158646
|
const { stop, waitUntilExit } = await unstable_dev(
|
|
158604
158647
|
entrypoint,
|
|
158605
158648
|
{
|
|
158606
|
-
ip,
|
|
158607
|
-
port,
|
|
158649
|
+
ip: ip2,
|
|
158650
|
+
port: port2,
|
|
158608
158651
|
inspectorPort,
|
|
158609
158652
|
watch: true,
|
|
158610
158653
|
localProtocol,
|
|
@@ -158711,12 +158754,12 @@ function getPort(pid) {
|
|
|
158711
158754
|
}
|
|
158712
158755
|
}
|
|
158713
158756
|
async function spawnProxyProcess({
|
|
158714
|
-
port,
|
|
158757
|
+
port: port2,
|
|
158715
158758
|
command: command2
|
|
158716
158759
|
}) {
|
|
158717
158760
|
if (command2.length === 0) {
|
|
158718
|
-
if (
|
|
158719
|
-
return
|
|
158761
|
+
if (port2 !== void 0) {
|
|
158762
|
+
return port2;
|
|
158720
158763
|
}
|
|
158721
158764
|
CLEANUP();
|
|
158722
158765
|
throw new FatalError(
|
|
@@ -158752,24 +158795,24 @@ async function spawnProxyProcess({
|
|
|
158752
158795
|
});
|
|
158753
158796
|
while (!proxy2.pid) {
|
|
158754
158797
|
}
|
|
158755
|
-
if (
|
|
158798
|
+
if (port2 === void 0) {
|
|
158756
158799
|
logger.log(
|
|
158757
158800
|
`Sleeping ${SECONDS_TO_WAIT_FOR_PROXY} seconds to allow proxy process to start before attempting to automatically determine port...`
|
|
158758
158801
|
);
|
|
158759
158802
|
logger.log("To skip, specify the proxy port with --proxy.");
|
|
158760
158803
|
await sleep2(SECONDS_TO_WAIT_FOR_PROXY * 1e3);
|
|
158761
|
-
|
|
158762
|
-
if (
|
|
158804
|
+
port2 = getPids(proxy2.pid).map(getPort).filter((nr) => nr !== void 0)[0];
|
|
158805
|
+
if (port2 === void 0) {
|
|
158763
158806
|
CLEANUP();
|
|
158764
158807
|
throw new FatalError(
|
|
158765
158808
|
"Could not automatically determine proxy port. Please specify the proxy port with --proxy.",
|
|
158766
158809
|
1
|
|
158767
158810
|
);
|
|
158768
158811
|
} else {
|
|
158769
|
-
logger.log(`Automatically determined the proxy port to be ${
|
|
158812
|
+
logger.log(`Automatically determined the proxy port to be ${port2}.`);
|
|
158770
158813
|
}
|
|
158771
158814
|
}
|
|
158772
|
-
return
|
|
158815
|
+
return port2;
|
|
158773
158816
|
}
|
|
158774
158817
|
var blockWorkerJsImports = {
|
|
158775
158818
|
name: "block-worker-js-imports",
|
|
@@ -163588,9 +163631,9 @@ Switch out --local for ${import_chalk8.default.bold(
|
|
|
163588
163631
|
accountId: configParam.account_id || getAccountFromCache()?.id,
|
|
163589
163632
|
assetPaths,
|
|
163590
163633
|
assetsConfig: configParam.assets,
|
|
163591
|
-
|
|
163592
|
-
|
|
163593
|
-
inspectorPort: args.inspectorPort
|
|
163634
|
+
initialPort: args.port ?? configParam.dev.port ?? await getLocalPort(),
|
|
163635
|
+
initialIp: args.ip || configParam.dev.ip,
|
|
163636
|
+
inspectorPort: args.inspectorPort ?? configParam.dev.inspector_port ?? await getInspectorPort(),
|
|
163594
163637
|
isWorkersSite: Boolean(args.site || configParam.site),
|
|
163595
163638
|
compatibilityDate: getDevCompatibilityDate(
|
|
163596
163639
|
configParam,
|
|
@@ -163684,9 +163727,9 @@ async function startApiDev(args) {
|
|
|
163684
163727
|
accountId: configParam.account_id || getAccountFromCache()?.id,
|
|
163685
163728
|
assetPaths,
|
|
163686
163729
|
assetsConfig: configParam.assets,
|
|
163687
|
-
|
|
163688
|
-
|
|
163689
|
-
inspectorPort: args["inspector-port"]
|
|
163730
|
+
initialPort: args.port ?? configParam.dev.port ?? await getLocalPort(),
|
|
163731
|
+
initialIp: args.ip || configParam.dev.ip,
|
|
163732
|
+
inspectorPort: args["inspector-port"] ?? configParam.dev.inspector_port ?? await getInspectorPort(),
|
|
163690
163733
|
isWorkersSite: Boolean(args.site || configParam.site),
|
|
163691
163734
|
compatibilityDate: getDevCompatibilityDate(
|
|
163692
163735
|
config,
|
|
@@ -163948,8 +163991,8 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
163948
163991
|
port: options6?.port ?? 0,
|
|
163949
163992
|
local: true,
|
|
163950
163993
|
...options6,
|
|
163951
|
-
onReady: (address,
|
|
163952
|
-
readyPort =
|
|
163994
|
+
onReady: (address, port2) => {
|
|
163995
|
+
readyPort = port2;
|
|
163953
163996
|
readyAddress = address;
|
|
163954
163997
|
ready(devServer);
|
|
163955
163998
|
}
|
|
@@ -163987,8 +164030,8 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
163987
164030
|
$0: "",
|
|
163988
164031
|
local: true,
|
|
163989
164032
|
...options6,
|
|
163990
|
-
onReady: (address,
|
|
163991
|
-
readyPort =
|
|
164033
|
+
onReady: (address, port2) => {
|
|
164034
|
+
readyPort = port2;
|
|
163992
164035
|
readyAddress = address;
|
|
163993
164036
|
ready(devServer);
|
|
163994
164037
|
}
|