wrangler 3.30.0 → 3.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrangler",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.0",
|
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wrangler",
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"selfsigned": "^2.0.1",
|
|
96
96
|
"source-map": "0.6.1",
|
|
97
97
|
"xxhash-wasm": "^1.0.1",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
98
|
+
"miniflare": "3.20240223.1",
|
|
99
|
+
"@cloudflare/kv-asset-handler": "0.3.1"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@cloudflare/ai": "^1.0.35",
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
"yargs": "^17.7.2",
|
|
188
188
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
|
189
189
|
"@cloudflare/cli": "1.1.1",
|
|
190
|
-
"@cloudflare/pages-shared": "^0.11.
|
|
190
|
+
"@cloudflare/pages-shared": "^0.11.16",
|
|
191
191
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
192
192
|
},
|
|
193
193
|
"optionalDependencies": {
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"test": "pnpm run assert-git-version && jest",
|
|
221
221
|
"test:ci": "pnpm run test --coverage",
|
|
222
222
|
"test:debug": "pnpm run test --silent=false --verbose=true",
|
|
223
|
-
"test:e2e": "vitest
|
|
223
|
+
"test:e2e": "vitest -c ./e2e/vitest.config.ts",
|
|
224
224
|
"test:watch": "pnpm run test --testTimeout=50000 --watch",
|
|
225
225
|
"type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
|
|
226
226
|
}
|
package/templates/gitignore
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Middleware } from "./common";
|
|
2
|
+
|
|
3
|
+
const drainBody: Middleware = async (request, env, _ctx, middlewareCtx) => {
|
|
4
|
+
try {
|
|
5
|
+
return await middlewareCtx.next(request, env);
|
|
6
|
+
} finally {
|
|
7
|
+
try {
|
|
8
|
+
if (request.body !== null && !request.bodyUsed) {
|
|
9
|
+
const reader = request.body.getReader();
|
|
10
|
+
while (!(await reader.read()).done) {}
|
|
11
|
+
}
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error("Failed to drain the unused request body.", e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default drainBody;
|
|
19
|
+
export const wrap = undefined;
|
package/wrangler-dist/cli.js
CHANGED
|
@@ -11370,7 +11370,7 @@ var require_headers = __commonJS({
|
|
|
11370
11370
|
}
|
|
11371
11371
|
};
|
|
11372
11372
|
__name(HeadersList, "HeadersList");
|
|
11373
|
-
var
|
|
11373
|
+
var Headers5 = class {
|
|
11374
11374
|
constructor(init2 = void 0) {
|
|
11375
11375
|
if (init2 === kConstruct) {
|
|
11376
11376
|
return;
|
|
@@ -11384,7 +11384,7 @@ var require_headers = __commonJS({
|
|
|
11384
11384
|
}
|
|
11385
11385
|
// https://fetch.spec.whatwg.org/#dom-headers-append
|
|
11386
11386
|
append(name, value) {
|
|
11387
|
-
webidl.brandCheck(this,
|
|
11387
|
+
webidl.brandCheck(this, Headers5);
|
|
11388
11388
|
webidl.argumentLengthCheck(arguments, 2, { header: "Headers.append" });
|
|
11389
11389
|
name = webidl.converters.ByteString(name);
|
|
11390
11390
|
value = webidl.converters.ByteString(value);
|
|
@@ -11392,7 +11392,7 @@ var require_headers = __commonJS({
|
|
|
11392
11392
|
}
|
|
11393
11393
|
// https://fetch.spec.whatwg.org/#dom-headers-delete
|
|
11394
11394
|
delete(name) {
|
|
11395
|
-
webidl.brandCheck(this,
|
|
11395
|
+
webidl.brandCheck(this, Headers5);
|
|
11396
11396
|
webidl.argumentLengthCheck(arguments, 1, { header: "Headers.delete" });
|
|
11397
11397
|
name = webidl.converters.ByteString(name);
|
|
11398
11398
|
if (!isValidHeaderName(name)) {
|
|
@@ -11413,7 +11413,7 @@ var require_headers = __commonJS({
|
|
|
11413
11413
|
}
|
|
11414
11414
|
// https://fetch.spec.whatwg.org/#dom-headers-get
|
|
11415
11415
|
get(name) {
|
|
11416
|
-
webidl.brandCheck(this,
|
|
11416
|
+
webidl.brandCheck(this, Headers5);
|
|
11417
11417
|
webidl.argumentLengthCheck(arguments, 1, { header: "Headers.get" });
|
|
11418
11418
|
name = webidl.converters.ByteString(name);
|
|
11419
11419
|
if (!isValidHeaderName(name)) {
|
|
@@ -11427,7 +11427,7 @@ var require_headers = __commonJS({
|
|
|
11427
11427
|
}
|
|
11428
11428
|
// https://fetch.spec.whatwg.org/#dom-headers-has
|
|
11429
11429
|
has(name) {
|
|
11430
|
-
webidl.brandCheck(this,
|
|
11430
|
+
webidl.brandCheck(this, Headers5);
|
|
11431
11431
|
webidl.argumentLengthCheck(arguments, 1, { header: "Headers.has" });
|
|
11432
11432
|
name = webidl.converters.ByteString(name);
|
|
11433
11433
|
if (!isValidHeaderName(name)) {
|
|
@@ -11441,7 +11441,7 @@ var require_headers = __commonJS({
|
|
|
11441
11441
|
}
|
|
11442
11442
|
// https://fetch.spec.whatwg.org/#dom-headers-set
|
|
11443
11443
|
set(name, value) {
|
|
11444
|
-
webidl.brandCheck(this,
|
|
11444
|
+
webidl.brandCheck(this, Headers5);
|
|
11445
11445
|
webidl.argumentLengthCheck(arguments, 2, { header: "Headers.set" });
|
|
11446
11446
|
name = webidl.converters.ByteString(name);
|
|
11447
11447
|
value = webidl.converters.ByteString(value);
|
|
@@ -11467,7 +11467,7 @@ var require_headers = __commonJS({
|
|
|
11467
11467
|
}
|
|
11468
11468
|
// https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
|
|
11469
11469
|
getSetCookie() {
|
|
11470
|
-
webidl.brandCheck(this,
|
|
11470
|
+
webidl.brandCheck(this, Headers5);
|
|
11471
11471
|
const list = this[kHeadersList].cookies;
|
|
11472
11472
|
if (list) {
|
|
11473
11473
|
return [...list];
|
|
@@ -11497,7 +11497,7 @@ var require_headers = __commonJS({
|
|
|
11497
11497
|
return headers;
|
|
11498
11498
|
}
|
|
11499
11499
|
keys() {
|
|
11500
|
-
webidl.brandCheck(this,
|
|
11500
|
+
webidl.brandCheck(this, Headers5);
|
|
11501
11501
|
if (this[kGuard] === "immutable") {
|
|
11502
11502
|
const value = this[kHeadersSortedMap];
|
|
11503
11503
|
return makeIterator(
|
|
@@ -11513,7 +11513,7 @@ var require_headers = __commonJS({
|
|
|
11513
11513
|
);
|
|
11514
11514
|
}
|
|
11515
11515
|
values() {
|
|
11516
|
-
webidl.brandCheck(this,
|
|
11516
|
+
webidl.brandCheck(this, Headers5);
|
|
11517
11517
|
if (this[kGuard] === "immutable") {
|
|
11518
11518
|
const value = this[kHeadersSortedMap];
|
|
11519
11519
|
return makeIterator(
|
|
@@ -11529,7 +11529,7 @@ var require_headers = __commonJS({
|
|
|
11529
11529
|
);
|
|
11530
11530
|
}
|
|
11531
11531
|
entries() {
|
|
11532
|
-
webidl.brandCheck(this,
|
|
11532
|
+
webidl.brandCheck(this, Headers5);
|
|
11533
11533
|
if (this[kGuard] === "immutable") {
|
|
11534
11534
|
const value = this[kHeadersSortedMap];
|
|
11535
11535
|
return makeIterator(
|
|
@@ -11549,7 +11549,7 @@ var require_headers = __commonJS({
|
|
|
11549
11549
|
* @param {unknown} thisArg
|
|
11550
11550
|
*/
|
|
11551
11551
|
forEach(callbackFn, thisArg = globalThis) {
|
|
11552
|
-
webidl.brandCheck(this,
|
|
11552
|
+
webidl.brandCheck(this, Headers5);
|
|
11553
11553
|
webidl.argumentLengthCheck(arguments, 1, { header: "Headers.forEach" });
|
|
11554
11554
|
if (typeof callbackFn !== "function") {
|
|
11555
11555
|
throw new TypeError(
|
|
@@ -11561,13 +11561,13 @@ var require_headers = __commonJS({
|
|
|
11561
11561
|
}
|
|
11562
11562
|
}
|
|
11563
11563
|
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
11564
|
-
webidl.brandCheck(this,
|
|
11564
|
+
webidl.brandCheck(this, Headers5);
|
|
11565
11565
|
return this[kHeadersList];
|
|
11566
11566
|
}
|
|
11567
11567
|
};
|
|
11568
|
-
__name(
|
|
11569
|
-
|
|
11570
|
-
Object.defineProperties(
|
|
11568
|
+
__name(Headers5, "Headers");
|
|
11569
|
+
Headers5.prototype[Symbol.iterator] = Headers5.prototype.entries;
|
|
11570
|
+
Object.defineProperties(Headers5.prototype, {
|
|
11571
11571
|
append: kEnumerableProperty,
|
|
11572
11572
|
delete: kEnumerableProperty,
|
|
11573
11573
|
get: kEnumerableProperty,
|
|
@@ -11599,7 +11599,7 @@ var require_headers = __commonJS({
|
|
|
11599
11599
|
};
|
|
11600
11600
|
module3.exports = {
|
|
11601
11601
|
fill: fill2,
|
|
11602
|
-
Headers:
|
|
11602
|
+
Headers: Headers5,
|
|
11603
11603
|
HeadersList
|
|
11604
11604
|
};
|
|
11605
11605
|
}
|
|
@@ -11610,7 +11610,7 @@ var require_response = __commonJS({
|
|
|
11610
11610
|
"../../node_modules/.pnpm/undici@5.28.3/node_modules/undici/lib/fetch/response.js"(exports2, module3) {
|
|
11611
11611
|
"use strict";
|
|
11612
11612
|
init_import_meta_url();
|
|
11613
|
-
var { Headers:
|
|
11613
|
+
var { Headers: Headers5, HeadersList, fill: fill2 } = require_headers();
|
|
11614
11614
|
var { extractBody, cloneBody, mixinBody } = require_body();
|
|
11615
11615
|
var util4 = require_util();
|
|
11616
11616
|
var { kEnumerableProperty } = util4;
|
|
@@ -11702,7 +11702,7 @@ var require_response = __commonJS({
|
|
|
11702
11702
|
init2 = webidl.converters.ResponseInit(init2);
|
|
11703
11703
|
this[kRealm] = { settingsObject: {} };
|
|
11704
11704
|
this[kState] = makeResponse({});
|
|
11705
|
-
this[kHeaders] = new
|
|
11705
|
+
this[kHeaders] = new Headers5(kConstruct);
|
|
11706
11706
|
this[kHeaders][kGuard] = "response";
|
|
11707
11707
|
this[kHeaders][kHeadersList] = this[kState].headersList;
|
|
11708
11708
|
this[kHeaders][kRealm] = this[kRealm];
|
|
@@ -11999,7 +11999,7 @@ var require_request2 = __commonJS({
|
|
|
11999
11999
|
"use strict";
|
|
12000
12000
|
init_import_meta_url();
|
|
12001
12001
|
var { extractBody, mixinBody, cloneBody } = require_body();
|
|
12002
|
-
var { Headers:
|
|
12002
|
+
var { Headers: Headers5, fill: fillHeaders, HeadersList } = require_headers();
|
|
12003
12003
|
var { FinalizationRegistry: FinalizationRegistry2 } = require_dispatcher_weakref()();
|
|
12004
12004
|
var util4 = require_util();
|
|
12005
12005
|
var {
|
|
@@ -12243,7 +12243,7 @@ var require_request2 = __commonJS({
|
|
|
12243
12243
|
requestFinalizer.register(ac, { signal, abort });
|
|
12244
12244
|
}
|
|
12245
12245
|
}
|
|
12246
|
-
this[kHeaders] = new
|
|
12246
|
+
this[kHeaders] = new Headers5(kConstruct);
|
|
12247
12247
|
this[kHeaders][kHeadersList] = request3.headersList;
|
|
12248
12248
|
this[kHeaders][kGuard] = "request";
|
|
12249
12249
|
this[kHeaders][kRealm] = this[kRealm];
|
|
@@ -12442,7 +12442,7 @@ var require_request2 = __commonJS({
|
|
|
12442
12442
|
const clonedRequestObject = new Request3(kConstruct);
|
|
12443
12443
|
clonedRequestObject[kState] = clonedRequest;
|
|
12444
12444
|
clonedRequestObject[kRealm] = this[kRealm];
|
|
12445
|
-
clonedRequestObject[kHeaders] = new
|
|
12445
|
+
clonedRequestObject[kHeaders] = new Headers5(kConstruct);
|
|
12446
12446
|
clonedRequestObject[kHeaders][kHeadersList] = clonedRequest.headersList;
|
|
12447
12447
|
clonedRequestObject[kHeaders][kGuard] = this[kHeaders][kGuard];
|
|
12448
12448
|
clonedRequestObject[kHeaders][kRealm] = this[kHeaders][kRealm];
|
|
@@ -12648,7 +12648,7 @@ var require_fetch = __commonJS({
|
|
|
12648
12648
|
filterResponse,
|
|
12649
12649
|
makeResponse
|
|
12650
12650
|
} = require_response();
|
|
12651
|
-
var { Headers:
|
|
12651
|
+
var { Headers: Headers5 } = require_headers();
|
|
12652
12652
|
var { Request: Request3, makeRequest } = require_request2();
|
|
12653
12653
|
var zlib = require("zlib");
|
|
12654
12654
|
var {
|
|
@@ -13575,7 +13575,7 @@ var require_fetch = __commonJS({
|
|
|
13575
13575
|
}
|
|
13576
13576
|
let codings = [];
|
|
13577
13577
|
let location = "";
|
|
13578
|
-
const headers = new
|
|
13578
|
+
const headers = new Headers5();
|
|
13579
13579
|
if (Array.isArray(headersList)) {
|
|
13580
13580
|
for (let n2 = 0; n2 < headersList.length; n2 += 2) {
|
|
13581
13581
|
const key = headersList[n2 + 0].toString("latin1");
|
|
@@ -13660,7 +13660,7 @@ var require_fetch = __commonJS({
|
|
|
13660
13660
|
if (status2 !== 101) {
|
|
13661
13661
|
return;
|
|
13662
13662
|
}
|
|
13663
|
-
const headers = new
|
|
13663
|
+
const headers = new Headers5();
|
|
13664
13664
|
for (let n2 = 0; n2 < headersList.length; n2 += 2) {
|
|
13665
13665
|
const key = headersList[n2 + 0].toString("latin1");
|
|
13666
13666
|
const val = headersList[n2 + 1].toString("latin1");
|
|
@@ -15542,10 +15542,10 @@ var require_cookies = __commonJS({
|
|
|
15542
15542
|
var { parseSetCookie } = require_parse();
|
|
15543
15543
|
var { stringify, getHeadersList } = require_util6();
|
|
15544
15544
|
var { webidl } = require_webidl();
|
|
15545
|
-
var { Headers:
|
|
15545
|
+
var { Headers: Headers5 } = require_headers();
|
|
15546
15546
|
function getCookies(headers) {
|
|
15547
15547
|
webidl.argumentLengthCheck(arguments, 1, { header: "getCookies" });
|
|
15548
|
-
webidl.brandCheck(headers,
|
|
15548
|
+
webidl.brandCheck(headers, Headers5, { strict: false });
|
|
15549
15549
|
const cookie = headers.get("cookie");
|
|
15550
15550
|
const out = {};
|
|
15551
15551
|
if (!cookie) {
|
|
@@ -15560,7 +15560,7 @@ var require_cookies = __commonJS({
|
|
|
15560
15560
|
__name(getCookies, "getCookies");
|
|
15561
15561
|
function deleteCookie(headers, name, attributes) {
|
|
15562
15562
|
webidl.argumentLengthCheck(arguments, 2, { header: "deleteCookie" });
|
|
15563
|
-
webidl.brandCheck(headers,
|
|
15563
|
+
webidl.brandCheck(headers, Headers5, { strict: false });
|
|
15564
15564
|
name = webidl.converters.DOMString(name);
|
|
15565
15565
|
attributes = webidl.converters.DeleteCookieAttributes(attributes);
|
|
15566
15566
|
setCookie(headers, {
|
|
@@ -15573,7 +15573,7 @@ var require_cookies = __commonJS({
|
|
|
15573
15573
|
__name(deleteCookie, "deleteCookie");
|
|
15574
15574
|
function getSetCookies(headers) {
|
|
15575
15575
|
webidl.argumentLengthCheck(arguments, 1, { header: "getSetCookies" });
|
|
15576
|
-
webidl.brandCheck(headers,
|
|
15576
|
+
webidl.brandCheck(headers, Headers5, { strict: false });
|
|
15577
15577
|
const cookies = getHeadersList(headers).cookies;
|
|
15578
15578
|
if (!cookies) {
|
|
15579
15579
|
return [];
|
|
@@ -15583,7 +15583,7 @@ var require_cookies = __commonJS({
|
|
|
15583
15583
|
__name(getSetCookies, "getSetCookies");
|
|
15584
15584
|
function setCookie(headers, cookie) {
|
|
15585
15585
|
webidl.argumentLengthCheck(arguments, 2, { header: "setCookie" });
|
|
15586
|
-
webidl.brandCheck(headers,
|
|
15586
|
+
webidl.brandCheck(headers, Headers5, { strict: false });
|
|
15587
15587
|
cookie = webidl.converters.Cookie(cookie);
|
|
15588
15588
|
const str = stringify(cookie);
|
|
15589
15589
|
if (str) {
|
|
@@ -16093,7 +16093,7 @@ var require_connection = __commonJS({
|
|
|
16093
16093
|
var { CloseEvent } = require_events();
|
|
16094
16094
|
var { makeRequest } = require_request2();
|
|
16095
16095
|
var { fetching } = require_fetch();
|
|
16096
|
-
var { Headers:
|
|
16096
|
+
var { Headers: Headers5 } = require_headers();
|
|
16097
16097
|
var { getGlobalDispatcher: getGlobalDispatcher2 } = require_global2();
|
|
16098
16098
|
var { kHeadersList } = require_symbols();
|
|
16099
16099
|
var channels = {};
|
|
@@ -16118,7 +16118,7 @@ var require_connection = __commonJS({
|
|
|
16118
16118
|
redirect: "error"
|
|
16119
16119
|
});
|
|
16120
16120
|
if (options25.headers) {
|
|
16121
|
-
const headersList = new
|
|
16121
|
+
const headersList = new Headers5(options25.headers)[kHeadersList];
|
|
16122
16122
|
request3.headersList = headersList;
|
|
16123
16123
|
}
|
|
16124
16124
|
const keyValue = crypto5.randomBytes(16).toString("base64");
|
|
@@ -118285,7 +118285,7 @@ __name(getEnvironmentVariableFactory, "getEnvironmentVariableFactory");
|
|
|
118285
118285
|
init_import_meta_url();
|
|
118286
118286
|
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
118287
118287
|
variableName: "WRANGLER_C3_COMMAND",
|
|
118288
|
-
defaultValue: () => "create cloudflare@2"
|
|
118288
|
+
defaultValue: () => "create cloudflare@2.5.0"
|
|
118289
118289
|
});
|
|
118290
118290
|
var getWranglerSendMetricsFromEnv = getEnvironmentVariableFactory({
|
|
118291
118291
|
variableName: "WRANGLER_SEND_METRICS"
|
|
@@ -119643,7 +119643,7 @@ var import_node_assert2 = __toESM(require("node:assert"));
|
|
|
119643
119643
|
var import_undici3 = __toESM(require_undici());
|
|
119644
119644
|
|
|
119645
119645
|
// package.json
|
|
119646
|
-
var version = "3.
|
|
119646
|
+
var version = "3.31.0";
|
|
119647
119647
|
var package_default = {
|
|
119648
119648
|
name: "wrangler",
|
|
119649
119649
|
version,
|
|
@@ -119709,7 +119709,7 @@ var package_default = {
|
|
|
119709
119709
|
test: "pnpm run assert-git-version && jest",
|
|
119710
119710
|
"test:ci": "pnpm run test --coverage",
|
|
119711
119711
|
"test:debug": "pnpm run test --silent=false --verbose=true",
|
|
119712
|
-
"test:e2e": "vitest
|
|
119712
|
+
"test:e2e": "vitest -c ./e2e/vitest.config.ts",
|
|
119713
119713
|
"test:watch": "pnpm run test --testTimeout=50000 --watch",
|
|
119714
119714
|
"type:tests": "tsc -p ./src/__tests__/tsconfig.json && tsc -p ./e2e/tsconfig.json"
|
|
119715
119715
|
},
|
|
@@ -125161,6 +125161,11 @@ async function* getFiles(root, relativeTo) {
|
|
|
125161
125161
|
}
|
|
125162
125162
|
}
|
|
125163
125163
|
__name(getFiles, "getFiles");
|
|
125164
|
+
function isValidPythonPackageName(name) {
|
|
125165
|
+
const regex2 = /^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$/i;
|
|
125166
|
+
return regex2.test(name);
|
|
125167
|
+
}
|
|
125168
|
+
__name(isValidPythonPackageName, "isValidPythonPackageName");
|
|
125164
125169
|
async function findAdditionalModules(entry, rules) {
|
|
125165
125170
|
const files = getFiles(entry.moduleRoot, entry.moduleRoot);
|
|
125166
125171
|
const relativeEntryPoint = import_node_path10.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
|
|
@@ -125172,27 +125177,32 @@ async function findAdditionalModules(entry, rules) {
|
|
|
125172
125177
|
}));
|
|
125173
125178
|
const isPythonEntrypoint = getBundleType(entry.format, entry.file) === "python";
|
|
125174
125179
|
if (isPythonEntrypoint) {
|
|
125180
|
+
let pythonRequirements = "";
|
|
125175
125181
|
try {
|
|
125176
|
-
|
|
125182
|
+
pythonRequirements = await (0, import_promises3.readFile)(
|
|
125177
125183
|
import_node_path10.default.resolve(entry.directory, "requirements.txt"),
|
|
125178
125184
|
"utf-8"
|
|
125179
125185
|
);
|
|
125180
|
-
for (const requirement of pythonRequirements.split("\n")) {
|
|
125181
|
-
const packageName = requirement.match(/^[^\d\W]\w*/);
|
|
125182
|
-
if (typeof packageName?.[0] === "string") {
|
|
125183
|
-
modules.push({
|
|
125184
|
-
type: "python-requirement",
|
|
125185
|
-
name: packageName?.[0],
|
|
125186
|
-
content: "",
|
|
125187
|
-
filePath: void 0
|
|
125188
|
-
});
|
|
125189
|
-
}
|
|
125190
|
-
}
|
|
125191
125186
|
} catch (e3) {
|
|
125192
125187
|
logger.debug(
|
|
125193
125188
|
"Python entrypoint detected, but no requirements.txt file found."
|
|
125194
125189
|
);
|
|
125195
125190
|
}
|
|
125191
|
+
for (const requirement of pythonRequirements.split("\n")) {
|
|
125192
|
+
if (requirement === "")
|
|
125193
|
+
continue;
|
|
125194
|
+
if (!isValidPythonPackageName(requirement)) {
|
|
125195
|
+
throw new UserError(
|
|
125196
|
+
`Invalid Python package name "${requirement}" found in requirements.txt. Note that requirements.txt should contain package names only, not version specifiers.`
|
|
125197
|
+
);
|
|
125198
|
+
}
|
|
125199
|
+
modules.push({
|
|
125200
|
+
type: "python-requirement",
|
|
125201
|
+
name: requirement,
|
|
125202
|
+
content: "",
|
|
125203
|
+
filePath: void 0
|
|
125204
|
+
});
|
|
125205
|
+
}
|
|
125196
125206
|
}
|
|
125197
125207
|
if (modules.length > 0) {
|
|
125198
125208
|
logger.info(`Attaching additional modules:`);
|
|
@@ -125320,6 +125330,13 @@ async function bundleWorker(entry, destination, {
|
|
|
125320
125330
|
const tmpDir = getWranglerTmpDir(projectRoot, "bundle");
|
|
125321
125331
|
const entryFile = entry.file;
|
|
125322
125332
|
const middlewareToLoad = [];
|
|
125333
|
+
if (targetConsumer === "dev" && !process.env.WRANGLER_DISABLE_REQUEST_BODY_DRAINING) {
|
|
125334
|
+
middlewareToLoad.push({
|
|
125335
|
+
name: "ensure-req-body-drained",
|
|
125336
|
+
path: "templates/middleware/middleware-ensure-req-body-drained.ts",
|
|
125337
|
+
supports: ["modules", "service-worker"]
|
|
125338
|
+
});
|
|
125339
|
+
}
|
|
125323
125340
|
if (targetConsumer === "dev" && !!testScheduled) {
|
|
125324
125341
|
middlewareToLoad.push({
|
|
125325
125342
|
name: "scheduled",
|
|
@@ -127776,7 +127793,10 @@ async function AIFetcher(request3) {
|
|
|
127776
127793
|
body: request3.body,
|
|
127777
127794
|
duplex: "half"
|
|
127778
127795
|
});
|
|
127779
|
-
|
|
127796
|
+
const respHeaders = new import_miniflare3.Headers(res.headers);
|
|
127797
|
+
respHeaders.delete("Host");
|
|
127798
|
+
respHeaders.delete("Content-Length");
|
|
127799
|
+
return new import_miniflare3.Response(res.body, { status: res.status, headers: respHeaders });
|
|
127780
127800
|
}
|
|
127781
127801
|
__name(AIFetcher, "AIFetcher");
|
|
127782
127802
|
|
|
@@ -127791,7 +127811,9 @@ function withSourceURL(source, sourcePath) {
|
|
|
127791
127811
|
__name(withSourceURL, "withSourceURL");
|
|
127792
127812
|
function withSourceURLs(entrypointPath, modules) {
|
|
127793
127813
|
let entrypointSource = import_node_fs10.default.readFileSync(entrypointPath, "utf8");
|
|
127794
|
-
|
|
127814
|
+
if (!entrypointPath.endsWith(".py")) {
|
|
127815
|
+
entrypointSource = withSourceURL(entrypointSource, entrypointPath);
|
|
127816
|
+
}
|
|
127795
127817
|
modules = modules.map((module3) => {
|
|
127796
127818
|
if (module3.filePath !== void 0 && (module3.type === "esm" || module3.type === "commonjs")) {
|
|
127797
127819
|
let newContent = module3.content.toString();
|
|
@@ -161305,6 +161327,21 @@ function getHostFromUrl(urlLike) {
|
|
|
161305
161327
|
}
|
|
161306
161328
|
}
|
|
161307
161329
|
__name(getHostFromUrl, "getHostFromUrl");
|
|
161330
|
+
async function getZoneIdForPreview(host, routes) {
|
|
161331
|
+
let zoneId;
|
|
161332
|
+
if (host) {
|
|
161333
|
+
zoneId = await getZoneIdFromHost(host);
|
|
161334
|
+
}
|
|
161335
|
+
if (!zoneId && routes) {
|
|
161336
|
+
const firstRoute = routes[0];
|
|
161337
|
+
const zone = await getZoneForRoute(firstRoute);
|
|
161338
|
+
if (zone) {
|
|
161339
|
+
zoneId = zone.id;
|
|
161340
|
+
}
|
|
161341
|
+
}
|
|
161342
|
+
return zoneId;
|
|
161343
|
+
}
|
|
161344
|
+
__name(getZoneIdForPreview, "getZoneIdForPreview");
|
|
161308
161345
|
async function getZoneIdFromHost(host) {
|
|
161309
161346
|
const hostPieces = host.split(".");
|
|
161310
161347
|
while (hostPieces.length > 1) {
|
|
@@ -161318,7 +161355,10 @@ async function getZoneIdFromHost(host) {
|
|
|
161318
161355
|
}
|
|
161319
161356
|
hostPieces.shift();
|
|
161320
161357
|
}
|
|
161321
|
-
throw new UserError(
|
|
161358
|
+
throw new UserError(
|
|
161359
|
+
`Could not find zone for \`${host}\`. Make sure the domain is set up to be proxied by Cloudflare.
|
|
161360
|
+
For more details, refer to https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route`
|
|
161361
|
+
);
|
|
161322
161362
|
}
|
|
161323
161363
|
__name(getZoneIdFromHost, "getZoneIdFromHost");
|
|
161324
161364
|
async function getRoutesForZone(zone) {
|
|
@@ -161766,8 +161806,8 @@ function writeDTSFile({
|
|
|
161766
161806
|
}
|
|
161767
161807
|
let combinedTypeStrings = "";
|
|
161768
161808
|
if (formatType === "modules") {
|
|
161769
|
-
combinedTypeStrings += `interface ${envInterface} {
|
|
161770
|
-
|
|
161809
|
+
combinedTypeStrings += `interface ${envInterface} {${envTypeStructure.map((value) => `
|
|
161810
|
+
${value}`).join("")}
|
|
161771
161811
|
}
|
|
161772
161812
|
${modulesTypeStructure.join("\n")}`;
|
|
161773
161813
|
} else {
|
|
@@ -161778,7 +161818,8 @@ ${envTypeStructure.map((value) => ` const ${value}`).join("\n")}
|
|
|
161778
161818
|
${modulesTypeStructure.join("\n")}`;
|
|
161779
161819
|
}
|
|
161780
161820
|
const wranglerCommandUsed = ["wrangler", ...process.argv.slice(2)].join(" ");
|
|
161781
|
-
|
|
161821
|
+
const typesHaveBeenFound = envTypeStructure.length || modulesTypeStructure.length;
|
|
161822
|
+
if (formatType === "modules" || typesHaveBeenFound) {
|
|
161782
161823
|
fs21.writeFileSync(
|
|
161783
161824
|
path58,
|
|
161784
161825
|
[
|
|
@@ -162440,7 +162481,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
162440
162481
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
|
162441
162482
|
accountId,
|
|
162442
162483
|
config,
|
|
162443
|
-
legacyEnv:
|
|
162484
|
+
legacyEnv: props.legacyEnv,
|
|
162444
162485
|
env: props.env
|
|
162445
162486
|
}) : void 0;
|
|
162446
162487
|
const bindings = {
|
|
@@ -162798,6 +162839,7 @@ async function versionsUploadHandler(args) {
|
|
|
162798
162839
|
name: getScriptName(args, config),
|
|
162799
162840
|
rules: getRules(config),
|
|
162800
162841
|
entry,
|
|
162842
|
+
legacyEnv: isLegacyEnv(config),
|
|
162801
162843
|
env: args.env,
|
|
162802
162844
|
compatibilityDate: args.latest ? (/* @__PURE__ */ new Date()).toISOString().substring(0, 10) : args.compatibilityDate,
|
|
162803
162845
|
compatibilityFlags: args.compatibilityFlags,
|
|
@@ -163550,8 +163592,6 @@ async function initHandler(args) {
|
|
|
163550
163592
|
...yesFlag && isNpm(packageManager) ? ["-y"] : [],
|
|
163551
163593
|
// --yes arg for npx
|
|
163552
163594
|
...isNpm(packageManager) ? ["--"] : [],
|
|
163553
|
-
"--type",
|
|
163554
|
-
"pre-existing",
|
|
163555
163595
|
"--existing-script",
|
|
163556
163596
|
fromDashWorkerName
|
|
163557
163597
|
];
|
|
@@ -165532,9 +165572,9 @@ function randomId() {
|
|
|
165532
165572
|
});
|
|
165533
165573
|
}
|
|
165534
165574
|
__name(randomId, "randomId");
|
|
165535
|
-
function switchHost(originalUrl, host) {
|
|
165575
|
+
function switchHost(originalUrl, host, zonePreview) {
|
|
165536
165576
|
const url4 = new import_node_url14.URL(originalUrl);
|
|
165537
|
-
url4.hostname = host ?? url4.hostname;
|
|
165577
|
+
url4.hostname = zonePreview ? host ?? url4.hostname : url4.hostname;
|
|
165538
165578
|
return url4;
|
|
165539
165579
|
}
|
|
165540
165580
|
__name(switchHost, "switchHost");
|
|
@@ -165547,7 +165587,11 @@ async function createPreviewSession(account, ctx, abortSignal) {
|
|
|
165547
165587
|
void 0,
|
|
165548
165588
|
abortSignal
|
|
165549
165589
|
);
|
|
165550
|
-
const switchedExchangeUrl = switchHost(
|
|
165590
|
+
const switchedExchangeUrl = switchHost(
|
|
165591
|
+
exchange_url,
|
|
165592
|
+
ctx.host,
|
|
165593
|
+
!!ctx.zone
|
|
165594
|
+
).toString();
|
|
165551
165595
|
logger.debugWithSanitization(
|
|
165552
165596
|
"-- START EXCHANGE API REQUEST:",
|
|
165553
165597
|
` GET ${switchedExchangeUrl}`
|
|
@@ -165565,16 +165609,26 @@ async function createPreviewSession(account, ctx, abortSignal) {
|
|
|
165565
165609
|
logger.debug("HEADERS:", JSON.stringify(exchangeResponse.headers, null, 2));
|
|
165566
165610
|
logger.debugWithSanitization("RESPONSE:", bodyText);
|
|
165567
165611
|
logger.debug("-- END EXCHANGE API RESPONSE");
|
|
165568
|
-
|
|
165569
|
-
|
|
165570
|
-
|
|
165571
|
-
|
|
165572
|
-
|
|
165573
|
-
|
|
165574
|
-
|
|
165575
|
-
|
|
165576
|
-
|
|
165577
|
-
|
|
165612
|
+
try {
|
|
165613
|
+
const { inspector_websocket, prewarm, token } = parseJSON(bodyText);
|
|
165614
|
+
const inspector = new import_node_url14.URL(inspector_websocket);
|
|
165615
|
+
inspector.searchParams.append("cf_workers_preview_token", token);
|
|
165616
|
+
return {
|
|
165617
|
+
id: randomId(),
|
|
165618
|
+
value: token,
|
|
165619
|
+
host: ctx.host ?? inspector.host,
|
|
165620
|
+
inspectorUrl: switchHost(inspector.href, ctx.host, !!ctx.zone),
|
|
165621
|
+
prewarmUrl: switchHost(prewarm, ctx.host, !!ctx.zone)
|
|
165622
|
+
};
|
|
165623
|
+
} catch (e3) {
|
|
165624
|
+
if (!(e3 instanceof ParseError)) {
|
|
165625
|
+
throw e3;
|
|
165626
|
+
} else {
|
|
165627
|
+
throw new UserError(
|
|
165628
|
+
`Could not create remote preview session on ${ctx.zone ? ` host \`${ctx.host}\` on zone \`${ctx.zone}\`` : `your account`}.`
|
|
165629
|
+
);
|
|
165630
|
+
}
|
|
165631
|
+
}
|
|
165578
165632
|
}
|
|
165579
165633
|
__name(createPreviewSession, "createPreviewSession");
|
|
165580
165634
|
async function createPreviewToken(account, worker, ctx, session, abortSignal) {
|
|
@@ -166063,7 +166117,6 @@ function Remote(props) {
|
|
|
166063
166117
|
usageModel: props.usageModel,
|
|
166064
166118
|
env: props.env,
|
|
166065
166119
|
legacyEnv: props.legacyEnv,
|
|
166066
|
-
zone: props.zone,
|
|
166067
166120
|
host: props.host,
|
|
166068
166121
|
routes: props.routes,
|
|
166069
166122
|
onReady: props.onReady,
|
|
@@ -166118,15 +166171,16 @@ function useWorker(props) {
|
|
|
166118
166171
|
if (props.accountId === void 0) {
|
|
166119
166172
|
return;
|
|
166120
166173
|
}
|
|
166121
|
-
const { workerAccount, workerContext } = getWorkerAccountAndContext(
|
|
166122
|
-
|
|
166123
|
-
|
|
166124
|
-
|
|
166125
|
-
|
|
166126
|
-
|
|
166127
|
-
|
|
166128
|
-
|
|
166129
|
-
|
|
166174
|
+
const { workerAccount, workerContext } = await getWorkerAccountAndContext(
|
|
166175
|
+
{
|
|
166176
|
+
accountId: props.accountId,
|
|
166177
|
+
env: props.env,
|
|
166178
|
+
legacyEnv: props.legacyEnv,
|
|
166179
|
+
host: props.host,
|
|
166180
|
+
routes: props.routes,
|
|
166181
|
+
sendMetrics: props.sendMetrics
|
|
166182
|
+
}
|
|
166183
|
+
);
|
|
166130
166184
|
setSession(
|
|
166131
166185
|
await createPreviewSession(
|
|
166132
166186
|
workerAccount,
|
|
@@ -166144,6 +166198,13 @@ function useWorker(props) {
|
|
|
166144
166198
|
logger.error(`${errorMessage}
|
|
166145
166199
|
${solutionMessage}
|
|
166146
166200
|
${onboardingLink}`);
|
|
166201
|
+
} else if (err.cause?.code === "ENOTFOUND") {
|
|
166202
|
+
logger.error(
|
|
166203
|
+
`Could not access \`${err.cause.hostname}\`. Make sure the domain is set up to be proxied by Cloudflare.
|
|
166204
|
+
For more details, refer to https://developers.cloudflare.com/workers/configuration/routing/routes/#set-up-a-route`
|
|
166205
|
+
);
|
|
166206
|
+
} else if (err instanceof UserError) {
|
|
166207
|
+
logger.error(err.message);
|
|
166147
166208
|
} else if (err.code !== "ABORT_ERR") {
|
|
166148
166209
|
logger.error("Error while creating remote dev session:", err);
|
|
166149
166210
|
}
|
|
@@ -166157,7 +166218,6 @@ ${onboardingLink}`);
|
|
|
166157
166218
|
props.host,
|
|
166158
166219
|
props.legacyEnv,
|
|
166159
166220
|
props.routes,
|
|
166160
|
-
props.zone,
|
|
166161
166221
|
props.sendMetrics,
|
|
166162
166222
|
restartCounter
|
|
166163
166223
|
]);
|
|
@@ -166193,15 +166253,16 @@ ${onboardingLink}`);
|
|
|
166193
166253
|
compatibilityFlags: props.compatibilityFlags,
|
|
166194
166254
|
usageModel: props.usageModel
|
|
166195
166255
|
});
|
|
166196
|
-
const { workerAccount, workerContext } = getWorkerAccountAndContext(
|
|
166197
|
-
|
|
166198
|
-
|
|
166199
|
-
|
|
166200
|
-
|
|
166201
|
-
|
|
166202
|
-
|
|
166203
|
-
|
|
166204
|
-
|
|
166256
|
+
const { workerAccount, workerContext } = await getWorkerAccountAndContext(
|
|
166257
|
+
{
|
|
166258
|
+
accountId: props.accountId,
|
|
166259
|
+
env: props.env,
|
|
166260
|
+
legacyEnv: props.legacyEnv,
|
|
166261
|
+
host: props.host,
|
|
166262
|
+
routes: props.routes,
|
|
166263
|
+
sendMetrics: props.sendMetrics
|
|
166264
|
+
}
|
|
166265
|
+
);
|
|
166205
166266
|
const workerPreviewToken = await createWorkerPreview(
|
|
166206
166267
|
init2,
|
|
166207
166268
|
workerAccount,
|
|
@@ -166224,7 +166285,7 @@ ${onboardingLink}`);
|
|
|
166224
166285
|
pathname: workerPreviewToken.inspectorUrl.pathname
|
|
166225
166286
|
},
|
|
166226
166287
|
userWorkerInnerUrlOverrides: {
|
|
166227
|
-
hostname: props.host,
|
|
166288
|
+
hostname: props.host ?? getInferredHost(props.routes),
|
|
166228
166289
|
port: props.port.toString()
|
|
166229
166290
|
},
|
|
166230
166291
|
headers: {
|
|
@@ -166235,7 +166296,11 @@ ${onboardingLink}`);
|
|
|
166235
166296
|
// liveReload currently disabled in remote-mode, but will be supported with startDevWorker
|
|
166236
166297
|
proxyLogsToController: true
|
|
166237
166298
|
};
|
|
166238
|
-
onReady?.(
|
|
166299
|
+
onReady?.(
|
|
166300
|
+
props.host ?? getInferredHost(props.routes) ?? "localhost",
|
|
166301
|
+
props.port,
|
|
166302
|
+
proxyData
|
|
166303
|
+
);
|
|
166239
166304
|
}
|
|
166240
166305
|
__name(start, "start");
|
|
166241
166306
|
start().catch((err) => {
|
|
@@ -166265,7 +166330,6 @@ ${onboardingLink}`);
|
|
|
166265
166330
|
props.modules,
|
|
166266
166331
|
props.env,
|
|
166267
166332
|
props.legacyEnv,
|
|
166268
|
-
props.zone,
|
|
166269
166333
|
props.host,
|
|
166270
166334
|
props.routes,
|
|
166271
166335
|
session,
|
|
@@ -166356,11 +166420,10 @@ async function getRemotePreviewToken(props) {
|
|
|
166356
166420
|
throw error2;
|
|
166357
166421
|
}
|
|
166358
166422
|
const abortController = new AbortController();
|
|
166359
|
-
const { workerAccount, workerContext } = getWorkerAccountAndContext({
|
|
166423
|
+
const { workerAccount, workerContext } = await getWorkerAccountAndContext({
|
|
166360
166424
|
accountId: props.accountId,
|
|
166361
166425
|
env: props.env,
|
|
166362
166426
|
legacyEnv: props.legacyEnv,
|
|
166363
|
-
zone: props.zone,
|
|
166364
166427
|
host: props.host,
|
|
166365
166428
|
routes: props.routes,
|
|
166366
166429
|
sendMetrics: props.sendMetrics
|
|
@@ -166448,7 +166511,7 @@ async function createRemoteWorkerInit(props) {
|
|
|
166448
166511
|
main: {
|
|
166449
166512
|
name: import_node_path50.default.basename(props.bundle.path),
|
|
166450
166513
|
filePath: props.bundle.path,
|
|
166451
|
-
type: getBundleType(props.format),
|
|
166514
|
+
type: getBundleType(props.format, import_node_path50.default.basename(props.bundle.path)),
|
|
166452
166515
|
content
|
|
166453
166516
|
},
|
|
166454
166517
|
modules,
|
|
@@ -166481,16 +166544,17 @@ async function createRemoteWorkerInit(props) {
|
|
|
166481
166544
|
return init2;
|
|
166482
166545
|
}
|
|
166483
166546
|
__name(createRemoteWorkerInit, "createRemoteWorkerInit");
|
|
166484
|
-
function getWorkerAccountAndContext(props) {
|
|
166547
|
+
async function getWorkerAccountAndContext(props) {
|
|
166485
166548
|
const workerAccount = {
|
|
166486
166549
|
accountId: props.accountId,
|
|
166487
166550
|
apiToken: requireApiToken()
|
|
166488
166551
|
};
|
|
166552
|
+
const zoneId = await getZoneIdForPreview(props.host, props.routes);
|
|
166489
166553
|
const workerContext = {
|
|
166490
166554
|
env: props.env,
|
|
166491
166555
|
legacyEnv: props.legacyEnv,
|
|
166492
|
-
zone:
|
|
166493
|
-
host: props.host,
|
|
166556
|
+
zone: zoneId,
|
|
166557
|
+
host: props.host ?? getInferredHost(props.routes),
|
|
166494
166558
|
routes: props.routes,
|
|
166495
166559
|
sendMetrics: props.sendMetrics
|
|
166496
166560
|
};
|
|
@@ -167074,7 +167138,6 @@ function DevSession(props) {
|
|
|
167074
167138
|
usageModel: props.usageModel,
|
|
167075
167139
|
env: props.env,
|
|
167076
167140
|
legacyEnv: props.legacyEnv,
|
|
167077
|
-
zone: props.zone,
|
|
167078
167141
|
host: props.host,
|
|
167079
167142
|
routes: props.routes,
|
|
167080
167143
|
onReady: announceAndOnReady,
|
|
@@ -167446,7 +167509,6 @@ async function startDevServer(props) {
|
|
|
167446
167509
|
usageModel: props.usageModel,
|
|
167447
167510
|
env: props.env,
|
|
167448
167511
|
legacyEnv: props.legacyEnv,
|
|
167449
|
-
zone: props.zone,
|
|
167450
167512
|
host: props.host,
|
|
167451
167513
|
routes: props.routes,
|
|
167452
167514
|
onReady: async (ip2, port2, proxyData) => {
|
|
@@ -167885,7 +167947,6 @@ async function startDev(args) {
|
|
|
167885
167947
|
legacyNodeCompat,
|
|
167886
167948
|
nodejsCompat,
|
|
167887
167949
|
upstreamProtocol,
|
|
167888
|
-
zoneId,
|
|
167889
167950
|
host,
|
|
167890
167951
|
routes,
|
|
167891
167952
|
getLocalPort,
|
|
@@ -167917,7 +167978,6 @@ async function startDev(args) {
|
|
|
167917
167978
|
findAdditionalModules: configParam.find_additional_modules,
|
|
167918
167979
|
entry,
|
|
167919
167980
|
env: args.env,
|
|
167920
|
-
zone: zoneId,
|
|
167921
167981
|
host,
|
|
167922
167982
|
routes,
|
|
167923
167983
|
processEntrypoint,
|
|
@@ -167937,7 +167997,7 @@ async function startDev(args) {
|
|
|
167937
167997
|
localProtocol: args.localProtocol || configParam.dev.local_protocol,
|
|
167938
167998
|
httpsKeyPath: args.httpsKeyPath,
|
|
167939
167999
|
httpsCertPath: args.httpsCertPath,
|
|
167940
|
-
localUpstream: args.localUpstream ?? host,
|
|
168000
|
+
localUpstream: args.localUpstream ?? host ?? getInferredHost(routes),
|
|
167941
168001
|
localPersistencePath,
|
|
167942
168002
|
liveReload: args.liveReload || false,
|
|
167943
168003
|
accountId: args.accountId ?? configParam.account_id ?? getAccountFromCache()?.id,
|
|
@@ -167999,7 +168059,6 @@ async function startApiDev(args) {
|
|
|
167999
168059
|
legacyNodeCompat,
|
|
168000
168060
|
nodejsCompat,
|
|
168001
168061
|
upstreamProtocol,
|
|
168002
|
-
zoneId,
|
|
168003
168062
|
host,
|
|
168004
168063
|
routes,
|
|
168005
168064
|
getLocalPort,
|
|
@@ -168027,7 +168086,6 @@ async function startApiDev(args) {
|
|
|
168027
168086
|
findAdditionalModules: configParam.find_additional_modules,
|
|
168028
168087
|
entry,
|
|
168029
168088
|
env: args.env,
|
|
168030
|
-
zone: zoneId,
|
|
168031
168089
|
host,
|
|
168032
168090
|
routes,
|
|
168033
168091
|
processEntrypoint,
|
|
@@ -168047,7 +168105,7 @@ async function startApiDev(args) {
|
|
|
168047
168105
|
localProtocol: args.localProtocol ?? configParam.dev.local_protocol,
|
|
168048
168106
|
httpsKeyPath: args.httpsKeyPath,
|
|
168049
168107
|
httpsCertPath: args.httpsCertPath,
|
|
168050
|
-
localUpstream: args.localUpstream ?? host,
|
|
168108
|
+
localUpstream: args.localUpstream ?? host ?? getInferredHost(routes),
|
|
168051
168109
|
localPersistencePath,
|
|
168052
168110
|
liveReload: args.liveReload ?? false,
|
|
168053
168111
|
accountId: args.accountId ?? configParam.account_id ?? getAccountFromCache()?.id,
|
|
@@ -168114,31 +168172,21 @@ function maskVars(bindings, configParam) {
|
|
|
168114
168172
|
return maskedVars;
|
|
168115
168173
|
}
|
|
168116
168174
|
__name(maskVars, "maskVars");
|
|
168117
|
-
async function
|
|
168118
|
-
|
|
168119
|
-
let zoneId;
|
|
168175
|
+
async function getHostAndRoutes(args, config) {
|
|
168176
|
+
const host = args.host || config.dev.host;
|
|
168120
168177
|
const routes = args.routes || config.route && [config.route] || config.routes;
|
|
168121
|
-
|
|
168122
|
-
|
|
168123
|
-
|
|
168124
|
-
|
|
168125
|
-
|
|
168126
|
-
|
|
168127
|
-
|
|
168128
|
-
|
|
168129
|
-
|
|
168130
|
-
host
|
|
168131
|
-
|
|
168132
|
-
|
|
168133
|
-
} else if (!host) {
|
|
168134
|
-
if (routes) {
|
|
168135
|
-
const firstRoute = routes[0];
|
|
168136
|
-
host = getHostFromRoute(firstRoute);
|
|
168137
|
-
if (host === void 0) {
|
|
168138
|
-
throw new UserError(
|
|
168139
|
-
`Cannot infer host from first route: ${JSON.stringify(
|
|
168140
|
-
firstRoute
|
|
168141
|
-
)}.
|
|
168178
|
+
return { host, routes };
|
|
168179
|
+
}
|
|
168180
|
+
__name(getHostAndRoutes, "getHostAndRoutes");
|
|
168181
|
+
function getInferredHost(routes) {
|
|
168182
|
+
if (routes) {
|
|
168183
|
+
const firstRoute = routes[0];
|
|
168184
|
+
const host = getHostFromRoute(firstRoute);
|
|
168185
|
+
if (host === void 0) {
|
|
168186
|
+
throw new UserError(
|
|
168187
|
+
`Cannot infer host from first route: ${JSON.stringify(
|
|
168188
|
+
firstRoute
|
|
168189
|
+
)}.
|
|
168142
168190
|
You can explicitly set the \`dev.host\` configuration in your wrangler.toml file, for example:
|
|
168143
168191
|
|
|
168144
168192
|
\`\`\`
|
|
@@ -168146,20 +168194,21 @@ You can explicitly set the \`dev.host\` configuration in your wrangler.toml file
|
|
|
168146
168194
|
host = "example.com"
|
|
168147
168195
|
\`\`\`
|
|
168148
168196
|
`
|
|
168149
|
-
|
|
168150
|
-
}
|
|
168197
|
+
);
|
|
168151
168198
|
}
|
|
168199
|
+
return host;
|
|
168152
168200
|
}
|
|
168153
|
-
return { host, routes, zoneId };
|
|
168154
168201
|
}
|
|
168155
|
-
__name(
|
|
168202
|
+
__name(getInferredHost, "getInferredHost");
|
|
168156
168203
|
async function validateDevServerSettings(args, config) {
|
|
168157
168204
|
const entry = await getEntry(
|
|
168158
168205
|
{ assets: args.assets, script: args.script, moduleRoot: args.moduleRoot },
|
|
168159
168206
|
config,
|
|
168160
168207
|
"dev"
|
|
168161
168208
|
);
|
|
168162
|
-
const {
|
|
168209
|
+
const { host, routes } = await getHostAndRoutes(args, config);
|
|
168210
|
+
if (args.remote)
|
|
168211
|
+
await getZoneIdForPreview(host, routes);
|
|
168163
168212
|
const initialIp = args.ip || config.dev.ip;
|
|
168164
168213
|
const initialIpListenCheck = initialIp === "*" ? "0.0.0.0" : initialIp;
|
|
168165
168214
|
const getLocalPort = memoizeGetPort(DEFAULT_LOCAL_PORT, initialIpListenCheck);
|
|
@@ -168234,7 +168283,6 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
|
168234
168283
|
getLocalPort,
|
|
168235
168284
|
getInspectorPort,
|
|
168236
168285
|
getRuntimeInspectorPort,
|
|
168237
|
-
zoneId,
|
|
168238
168286
|
host,
|
|
168239
168287
|
routes,
|
|
168240
168288
|
cliDefines,
|
|
@@ -168424,7 +168472,7 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
168424
168472
|
const readyPromise = new Promise((resolve19) => {
|
|
168425
168473
|
readyResolve = resolve19;
|
|
168426
168474
|
});
|
|
168427
|
-
const defaultLogLevel = testMode ? "
|
|
168475
|
+
const defaultLogLevel = testMode ? "warn" : "log";
|
|
168428
168476
|
const local = options25?.local ?? true;
|
|
168429
168477
|
const devOptions2 = {
|
|
168430
168478
|
script,
|