wrangler 2.0.5 → 2.0.6
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 +1 -1
- package/src/__tests__/configuration.test.ts +204 -27
- package/src/__tests__/dev.test.tsx +60 -7
- package/src/__tests__/index.test.ts +5 -6
- package/src/__tests__/kv.test.ts +85 -85
- package/src/__tests__/pages.test.ts +28 -5
- package/src/__tests__/publish.test.ts +306 -7
- package/src/__tests__/r2.test.ts +47 -24
- package/src/__tests__/secret.test.ts +35 -0
- package/src/bundle.ts +32 -1
- package/src/config/environment.ts +40 -14
- package/src/config/validation.ts +102 -35
- package/src/create-worker-upload-form.ts +22 -8
- package/src/dev/local.tsx +6 -0
- package/src/index.tsx +45 -20
- package/src/kv.ts +18 -3
- package/src/pages.tsx +3 -4
- package/src/publish.ts +210 -21
- package/src/sites.tsx +3 -1
- package/src/worker.ts +8 -0
- package/wrangler-dist/cli.js +432 -234
package/wrangler-dist/cli.js
CHANGED
|
@@ -4284,7 +4284,7 @@ var require_signal_exit = __commonJS({
|
|
|
4284
4284
|
};
|
|
4285
4285
|
};
|
|
4286
4286
|
} else {
|
|
4287
|
-
|
|
4287
|
+
assert11 = require("assert");
|
|
4288
4288
|
signals = require_signals();
|
|
4289
4289
|
isWin = /^win/i.test(process8.platform);
|
|
4290
4290
|
EE = require("events");
|
|
@@ -4307,7 +4307,7 @@ var require_signal_exit = __commonJS({
|
|
|
4307
4307
|
return function() {
|
|
4308
4308
|
};
|
|
4309
4309
|
}
|
|
4310
|
-
|
|
4310
|
+
assert11.equal(typeof cb2, "function", "a callback must be provided for exit handler");
|
|
4311
4311
|
if (loaded === false) {
|
|
4312
4312
|
load();
|
|
4313
4313
|
}
|
|
@@ -4412,7 +4412,7 @@ var require_signal_exit = __commonJS({
|
|
|
4412
4412
|
}
|
|
4413
4413
|
};
|
|
4414
4414
|
}
|
|
4415
|
-
var
|
|
4415
|
+
var assert11;
|
|
4416
4416
|
var signals;
|
|
4417
4417
|
var isWin;
|
|
4418
4418
|
var EE;
|
|
@@ -66627,7 +66627,7 @@ var require_util2 = __commonJS({
|
|
|
66627
66627
|
"node_modules/undici/lib/core/util.js"(exports2, module2) {
|
|
66628
66628
|
"use strict";
|
|
66629
66629
|
init_import_meta_url();
|
|
66630
|
-
var
|
|
66630
|
+
var assert11 = require("assert");
|
|
66631
66631
|
var { kDestroyed, kBodyUsed } = require_symbols();
|
|
66632
66632
|
var { IncomingMessage } = require("http");
|
|
66633
66633
|
var stream = require("stream");
|
|
@@ -66686,7 +66686,7 @@ var require_util2 = __commonJS({
|
|
|
66686
66686
|
function getHostname(host) {
|
|
66687
66687
|
if (host[0] === "[") {
|
|
66688
66688
|
const idx2 = host.indexOf("]");
|
|
66689
|
-
|
|
66689
|
+
assert11(idx2 !== -1);
|
|
66690
66690
|
return host.substr(1, idx2 - 1);
|
|
66691
66691
|
}
|
|
66692
66692
|
const idx = host.indexOf(":");
|
|
@@ -66698,7 +66698,7 @@ var require_util2 = __commonJS({
|
|
|
66698
66698
|
if (!host) {
|
|
66699
66699
|
return null;
|
|
66700
66700
|
}
|
|
66701
|
-
|
|
66701
|
+
assert11.strictEqual(typeof host, "string");
|
|
66702
66702
|
const servername = getHostname(host);
|
|
66703
66703
|
if (net2.isIP(servername)) {
|
|
66704
66704
|
return "";
|
|
@@ -66901,7 +66901,7 @@ var require_request = __commonJS({
|
|
|
66901
66901
|
NotSupportedError
|
|
66902
66902
|
} = require_errors();
|
|
66903
66903
|
var util = require_util2();
|
|
66904
|
-
var
|
|
66904
|
+
var assert11 = require("assert");
|
|
66905
66905
|
var kHandler = Symbol("handler");
|
|
66906
66906
|
var channels = {};
|
|
66907
66907
|
try {
|
|
@@ -67021,30 +67021,30 @@ var require_request = __commonJS({
|
|
|
67021
67021
|
}
|
|
67022
67022
|
}
|
|
67023
67023
|
onConnect(abort2) {
|
|
67024
|
-
|
|
67025
|
-
|
|
67024
|
+
assert11(!this.aborted);
|
|
67025
|
+
assert11(!this.completed);
|
|
67026
67026
|
return this[kHandler].onConnect(abort2);
|
|
67027
67027
|
}
|
|
67028
67028
|
onHeaders(statusCode, headers, resume, statusText) {
|
|
67029
|
-
|
|
67030
|
-
|
|
67029
|
+
assert11(!this.aborted);
|
|
67030
|
+
assert11(!this.completed);
|
|
67031
67031
|
if (channels.headers.hasSubscribers) {
|
|
67032
67032
|
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } });
|
|
67033
67033
|
}
|
|
67034
67034
|
return this[kHandler].onHeaders(statusCode, headers, resume, statusText);
|
|
67035
67035
|
}
|
|
67036
67036
|
onData(chunk) {
|
|
67037
|
-
|
|
67038
|
-
|
|
67037
|
+
assert11(!this.aborted);
|
|
67038
|
+
assert11(!this.completed);
|
|
67039
67039
|
return this[kHandler].onData(chunk);
|
|
67040
67040
|
}
|
|
67041
67041
|
onUpgrade(statusCode, headers, socket) {
|
|
67042
|
-
|
|
67043
|
-
|
|
67042
|
+
assert11(!this.aborted);
|
|
67043
|
+
assert11(!this.completed);
|
|
67044
67044
|
return this[kHandler].onUpgrade(statusCode, headers, socket);
|
|
67045
67045
|
}
|
|
67046
67046
|
onComplete(trailers) {
|
|
67047
|
-
|
|
67047
|
+
assert11(!this.aborted);
|
|
67048
67048
|
this.completed = true;
|
|
67049
67049
|
if (channels.trailers.hasSubscribers) {
|
|
67050
67050
|
channels.trailers.publish({ request: this, trailers });
|
|
@@ -67130,7 +67130,7 @@ var require_redirect = __commonJS({
|
|
|
67130
67130
|
init_import_meta_url();
|
|
67131
67131
|
var util = require_util2();
|
|
67132
67132
|
var { kBodyUsed } = require_symbols();
|
|
67133
|
-
var
|
|
67133
|
+
var assert11 = require("assert");
|
|
67134
67134
|
var { InvalidArgumentError } = require_errors();
|
|
67135
67135
|
var EE = require("events");
|
|
67136
67136
|
var redirectableStatusCodes = [300, 301, 302, 303, 307, 308];
|
|
@@ -67141,7 +67141,7 @@ var require_redirect = __commonJS({
|
|
|
67141
67141
|
this[kBodyUsed] = false;
|
|
67142
67142
|
}
|
|
67143
67143
|
async *[Symbol.asyncIterator]() {
|
|
67144
|
-
|
|
67144
|
+
assert11(!this[kBodyUsed], "disturbed");
|
|
67145
67145
|
this[kBodyUsed] = true;
|
|
67146
67146
|
yield* this[kBody];
|
|
67147
67147
|
}
|
|
@@ -67162,7 +67162,7 @@ var require_redirect = __commonJS({
|
|
|
67162
67162
|
if (util.isStream(this.opts.body)) {
|
|
67163
67163
|
if (util.bodyLength(this.opts.body) === 0) {
|
|
67164
67164
|
this.opts.body.on("data", function() {
|
|
67165
|
-
|
|
67165
|
+
assert11(false);
|
|
67166
67166
|
});
|
|
67167
67167
|
}
|
|
67168
67168
|
if (typeof this.opts.body.readableDidRead !== "boolean") {
|
|
@@ -67255,7 +67255,7 @@ var require_redirect = __commonJS({
|
|
|
67255
67255
|
}
|
|
67256
67256
|
}
|
|
67257
67257
|
} else {
|
|
67258
|
-
|
|
67258
|
+
assert11(headers == null, "headers must be an object or an array");
|
|
67259
67259
|
}
|
|
67260
67260
|
return ret;
|
|
67261
67261
|
}
|
|
@@ -67269,7 +67269,7 @@ var require_connect = __commonJS({
|
|
|
67269
67269
|
"use strict";
|
|
67270
67270
|
init_import_meta_url();
|
|
67271
67271
|
var net2 = require("net");
|
|
67272
|
-
var
|
|
67272
|
+
var assert11 = require("assert");
|
|
67273
67273
|
var util = require_util2();
|
|
67274
67274
|
var { InvalidArgumentError, ConnectTimeoutError } = require_errors();
|
|
67275
67275
|
var tls;
|
|
@@ -67290,7 +67290,7 @@ var require_connect = __commonJS({
|
|
|
67290
67290
|
servername = servername || options.servername || util.getServerName(host) || null;
|
|
67291
67291
|
const sessionKey = servername || hostname;
|
|
67292
67292
|
const session = sessionCache.get(sessionKey) || null;
|
|
67293
|
-
|
|
67293
|
+
assert11(sessionKey);
|
|
67294
67294
|
socket = tls.connect({
|
|
67295
67295
|
highWaterMark: 16384,
|
|
67296
67296
|
...options,
|
|
@@ -67709,7 +67709,7 @@ var require_client = __commonJS({
|
|
|
67709
67709
|
"node_modules/undici/lib/client.js"(exports2, module2) {
|
|
67710
67710
|
"use strict";
|
|
67711
67711
|
init_import_meta_url();
|
|
67712
|
-
var
|
|
67712
|
+
var assert11 = require("assert");
|
|
67713
67713
|
var net2 = require("net");
|
|
67714
67714
|
var util = require_util2();
|
|
67715
67715
|
var Request = require_request();
|
|
@@ -68051,39 +68051,39 @@ var require_client = __commonJS({
|
|
|
68051
68051
|
return 0;
|
|
68052
68052
|
},
|
|
68053
68053
|
wasm_on_status: (p, at, len) => {
|
|
68054
|
-
|
|
68054
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68055
68055
|
const start = at - currentBufferPtr;
|
|
68056
68056
|
const end = start + len;
|
|
68057
68057
|
return currentParser.onStatus(currentBufferRef.slice(start, end)) || 0;
|
|
68058
68058
|
},
|
|
68059
68059
|
wasm_on_message_begin: (p) => {
|
|
68060
|
-
|
|
68060
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68061
68061
|
return currentParser.onMessageBegin() || 0;
|
|
68062
68062
|
},
|
|
68063
68063
|
wasm_on_header_field: (p, at, len) => {
|
|
68064
|
-
|
|
68064
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68065
68065
|
const start = at - currentBufferPtr;
|
|
68066
68066
|
const end = start + len;
|
|
68067
68067
|
return currentParser.onHeaderField(currentBufferRef.slice(start, end)) || 0;
|
|
68068
68068
|
},
|
|
68069
68069
|
wasm_on_header_value: (p, at, len) => {
|
|
68070
|
-
|
|
68070
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68071
68071
|
const start = at - currentBufferPtr;
|
|
68072
68072
|
const end = start + len;
|
|
68073
68073
|
return currentParser.onHeaderValue(currentBufferRef.slice(start, end)) || 0;
|
|
68074
68074
|
},
|
|
68075
68075
|
wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
|
|
68076
|
-
|
|
68076
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68077
68077
|
return currentParser.onHeadersComplete(statusCode, Boolean(upgrade), Boolean(shouldKeepAlive)) || 0;
|
|
68078
68078
|
},
|
|
68079
68079
|
wasm_on_body: (p, at, len) => {
|
|
68080
|
-
|
|
68080
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68081
68081
|
const start = at - currentBufferPtr;
|
|
68082
68082
|
const end = start + len;
|
|
68083
68083
|
return currentParser.onBody(currentBufferRef.slice(start, end)) || 0;
|
|
68084
68084
|
},
|
|
68085
68085
|
wasm_on_message_complete: (p) => {
|
|
68086
|
-
|
|
68086
|
+
assert11.strictEqual(currentParser.ptr, p);
|
|
68087
68087
|
return currentParser.onMessageComplete() || 0;
|
|
68088
68088
|
}
|
|
68089
68089
|
}
|
|
@@ -68101,7 +68101,7 @@ var require_client = __commonJS({
|
|
|
68101
68101
|
var TIMEOUT_IDLE = 3;
|
|
68102
68102
|
var Parser2 = class {
|
|
68103
68103
|
constructor(client, socket, { exports: exports3 }) {
|
|
68104
|
-
|
|
68104
|
+
assert11(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
|
|
68105
68105
|
this.llhttp = exports3;
|
|
68106
68106
|
this.ptr = this.llhttp.llhttp_alloc(constants3.TYPE.RESPONSE);
|
|
68107
68107
|
this.client = client;
|
|
@@ -68146,10 +68146,10 @@ var require_client = __commonJS({
|
|
|
68146
68146
|
if (this.socket.destroyed || !this.paused) {
|
|
68147
68147
|
return;
|
|
68148
68148
|
}
|
|
68149
|
-
|
|
68150
|
-
|
|
68149
|
+
assert11(this.ptr != null);
|
|
68150
|
+
assert11(currentParser == null);
|
|
68151
68151
|
this.llhttp.llhttp_resume(this.ptr);
|
|
68152
|
-
|
|
68152
|
+
assert11(this.timeoutType === TIMEOUT_BODY);
|
|
68153
68153
|
if (this.timeout) {
|
|
68154
68154
|
if (this.timeout.refresh) {
|
|
68155
68155
|
this.timeout.refresh();
|
|
@@ -68169,9 +68169,9 @@ var require_client = __commonJS({
|
|
|
68169
68169
|
}
|
|
68170
68170
|
}
|
|
68171
68171
|
execute(data) {
|
|
68172
|
-
|
|
68173
|
-
|
|
68174
|
-
|
|
68172
|
+
assert11(this.ptr != null);
|
|
68173
|
+
assert11(currentParser == null);
|
|
68174
|
+
assert11(!this.paused);
|
|
68175
68175
|
const { socket, llhttp } = this;
|
|
68176
68176
|
if (data.length > currentBufferSize) {
|
|
68177
68177
|
if (currentBufferPtr) {
|
|
@@ -68225,8 +68225,8 @@ var require_client = __commonJS({
|
|
|
68225
68225
|
}
|
|
68226
68226
|
}
|
|
68227
68227
|
destroy() {
|
|
68228
|
-
|
|
68229
|
-
|
|
68228
|
+
assert11(this.ptr != null);
|
|
68229
|
+
assert11(currentParser == null);
|
|
68230
68230
|
this.llhttp.llhttp_free(this.ptr);
|
|
68231
68231
|
this.ptr = null;
|
|
68232
68232
|
clearTimeout(this.timeout);
|
|
@@ -68283,17 +68283,17 @@ var require_client = __commonJS({
|
|
|
68283
68283
|
}
|
|
68284
68284
|
onUpgrade(head) {
|
|
68285
68285
|
const { upgrade, client, socket, headers, statusCode } = this;
|
|
68286
|
-
|
|
68286
|
+
assert11(upgrade);
|
|
68287
68287
|
const request = client[kQueue][client[kRunningIdx]];
|
|
68288
|
-
|
|
68289
|
-
|
|
68290
|
-
|
|
68291
|
-
|
|
68292
|
-
|
|
68288
|
+
assert11(request);
|
|
68289
|
+
assert11(!socket.destroyed);
|
|
68290
|
+
assert11(socket === client[kSocket]);
|
|
68291
|
+
assert11(!this.paused);
|
|
68292
|
+
assert11(request.upgrade || request.method === "CONNECT");
|
|
68293
68293
|
this.statusCode = null;
|
|
68294
68294
|
this.statusText = "";
|
|
68295
68295
|
this.shouldKeepAlive = null;
|
|
68296
|
-
|
|
68296
|
+
assert11(this.headers.length % 2 === 0);
|
|
68297
68297
|
this.headers = [];
|
|
68298
68298
|
this.headersSize = 0;
|
|
68299
68299
|
socket.unshift(head);
|
|
@@ -68321,8 +68321,8 @@ var require_client = __commonJS({
|
|
|
68321
68321
|
if (!request) {
|
|
68322
68322
|
return -1;
|
|
68323
68323
|
}
|
|
68324
|
-
|
|
68325
|
-
|
|
68324
|
+
assert11(!this.upgrade);
|
|
68325
|
+
assert11(this.statusCode < 200);
|
|
68326
68326
|
if (statusCode === 100) {
|
|
68327
68327
|
util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket)));
|
|
68328
68328
|
return -1;
|
|
@@ -68331,7 +68331,7 @@ var require_client = __commonJS({
|
|
|
68331
68331
|
util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket)));
|
|
68332
68332
|
return -1;
|
|
68333
68333
|
}
|
|
68334
|
-
|
|
68334
|
+
assert11.strictEqual(this.timeoutType, TIMEOUT_HEADERS);
|
|
68335
68335
|
this.statusCode = statusCode;
|
|
68336
68336
|
this.shouldKeepAlive = shouldKeepAlive;
|
|
68337
68337
|
if (this.statusCode >= 200) {
|
|
@@ -68343,16 +68343,16 @@ var require_client = __commonJS({
|
|
|
68343
68343
|
}
|
|
68344
68344
|
}
|
|
68345
68345
|
if (request.method === "CONNECT" && statusCode >= 200 && statusCode < 300) {
|
|
68346
|
-
|
|
68346
|
+
assert11(client[kRunning] === 1);
|
|
68347
68347
|
this.upgrade = true;
|
|
68348
68348
|
return 2;
|
|
68349
68349
|
}
|
|
68350
68350
|
if (upgrade) {
|
|
68351
|
-
|
|
68351
|
+
assert11(client[kRunning] === 1);
|
|
68352
68352
|
this.upgrade = true;
|
|
68353
68353
|
return 2;
|
|
68354
68354
|
}
|
|
68355
|
-
|
|
68355
|
+
assert11(this.headers.length % 2 === 0);
|
|
68356
68356
|
this.headers = [];
|
|
68357
68357
|
this.headersSize = 0;
|
|
68358
68358
|
if (shouldKeepAlive && client[kPipelining]) {
|
|
@@ -68378,7 +68378,7 @@ var require_client = __commonJS({
|
|
|
68378
68378
|
return -1;
|
|
68379
68379
|
}
|
|
68380
68380
|
if (request.method === "HEAD") {
|
|
68381
|
-
|
|
68381
|
+
assert11(socket[kReset2]);
|
|
68382
68382
|
return 1;
|
|
68383
68383
|
}
|
|
68384
68384
|
if (statusCode < 200) {
|
|
@@ -68396,14 +68396,14 @@ var require_client = __commonJS({
|
|
|
68396
68396
|
return -1;
|
|
68397
68397
|
}
|
|
68398
68398
|
const request = client[kQueue][client[kRunningIdx]];
|
|
68399
|
-
|
|
68400
|
-
|
|
68399
|
+
assert11(request);
|
|
68400
|
+
assert11.strictEqual(this.timeoutType, TIMEOUT_BODY);
|
|
68401
68401
|
if (this.timeout) {
|
|
68402
68402
|
if (this.timeout.refresh) {
|
|
68403
68403
|
this.timeout.refresh();
|
|
68404
68404
|
}
|
|
68405
68405
|
}
|
|
68406
|
-
|
|
68406
|
+
assert11(statusCode >= 200);
|
|
68407
68407
|
this.bytesRead += buf.length;
|
|
68408
68408
|
try {
|
|
68409
68409
|
if (request.onData(buf) === false) {
|
|
@@ -68423,15 +68423,15 @@ var require_client = __commonJS({
|
|
|
68423
68423
|
return;
|
|
68424
68424
|
}
|
|
68425
68425
|
const request = client[kQueue][client[kRunningIdx]];
|
|
68426
|
-
|
|
68427
|
-
|
|
68426
|
+
assert11(request);
|
|
68427
|
+
assert11(statusCode >= 100);
|
|
68428
68428
|
this.statusCode = null;
|
|
68429
68429
|
this.statusText = "";
|
|
68430
68430
|
this.bytesRead = 0;
|
|
68431
68431
|
this.contentLength = "";
|
|
68432
68432
|
this.trailer = "";
|
|
68433
68433
|
this.keepAlive = "";
|
|
68434
|
-
|
|
68434
|
+
assert11(this.headers.length % 2 === 0);
|
|
68435
68435
|
this.headers = [];
|
|
68436
68436
|
this.headersSize = 0;
|
|
68437
68437
|
if (statusCode < 200) {
|
|
@@ -68464,7 +68464,7 @@ var require_client = __commonJS({
|
|
|
68464
68464
|
}
|
|
68465
68465
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
68466
68466
|
if (socket[kWriting]) {
|
|
68467
|
-
|
|
68467
|
+
assert11.strictEqual(client[kRunning], 0);
|
|
68468
68468
|
util.destroy(socket, new InformationalError("reset"));
|
|
68469
68469
|
return constants3.ERROR.PAUSED;
|
|
68470
68470
|
} else if (!shouldKeepAlive) {
|
|
@@ -68482,7 +68482,7 @@ var require_client = __commonJS({
|
|
|
68482
68482
|
const { socket, timeoutType, client } = parser2;
|
|
68483
68483
|
if (timeoutType === TIMEOUT_HEADERS) {
|
|
68484
68484
|
if (!socket[kWriting]) {
|
|
68485
|
-
|
|
68485
|
+
assert11(!parser2.paused, "cannot be paused while waiting for headers");
|
|
68486
68486
|
util.destroy(socket, new HeadersTimeoutError());
|
|
68487
68487
|
}
|
|
68488
68488
|
} else if (timeoutType === TIMEOUT_BODY) {
|
|
@@ -68490,7 +68490,7 @@ var require_client = __commonJS({
|
|
|
68490
68490
|
util.destroy(socket, new BodyTimeoutError());
|
|
68491
68491
|
}
|
|
68492
68492
|
} else if (timeoutType === TIMEOUT_IDLE) {
|
|
68493
|
-
|
|
68493
|
+
assert11(client[kRunning] === 0 && client[kKeepAliveTimeoutValue]);
|
|
68494
68494
|
util.destroy(socket, new InformationalError("socket idle timeout"));
|
|
68495
68495
|
}
|
|
68496
68496
|
}
|
|
@@ -68500,7 +68500,7 @@ var require_client = __commonJS({
|
|
|
68500
68500
|
}
|
|
68501
68501
|
function onSocketError(err2) {
|
|
68502
68502
|
const { [kParser]: parser2 } = this;
|
|
68503
|
-
|
|
68503
|
+
assert11(err2.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
68504
68504
|
if (err2.code === "ECONNRESET" && parser2.statusCode && !parser2.shouldKeepAlive) {
|
|
68505
68505
|
parser2.finish();
|
|
68506
68506
|
return;
|
|
@@ -68510,13 +68510,13 @@ var require_client = __commonJS({
|
|
|
68510
68510
|
}
|
|
68511
68511
|
function onError(client, err2) {
|
|
68512
68512
|
if (client[kRunning] === 0 && err2.code !== "UND_ERR_INFO" && err2.code !== "UND_ERR_SOCKET") {
|
|
68513
|
-
|
|
68513
|
+
assert11(client[kPendingIdx] === client[kRunningIdx]);
|
|
68514
68514
|
const requests = client[kQueue].splice(client[kRunningIdx]);
|
|
68515
68515
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
68516
68516
|
const request = requests[i2];
|
|
68517
68517
|
errorRequest(client, request, err2);
|
|
68518
68518
|
}
|
|
68519
|
-
|
|
68519
|
+
assert11(client[kSize] === 0);
|
|
68520
68520
|
}
|
|
68521
68521
|
}
|
|
68522
68522
|
function onSocketEnd() {
|
|
@@ -68534,7 +68534,7 @@ var require_client = __commonJS({
|
|
|
68534
68534
|
const err2 = this[kError] || new SocketError("closed", util.getSocketInfo(this));
|
|
68535
68535
|
client[kSocket] = null;
|
|
68536
68536
|
if (client[kDestroyed]) {
|
|
68537
|
-
|
|
68537
|
+
assert11(client[kPending] === 0);
|
|
68538
68538
|
const requests = client[kQueue].splice(client[kRunningIdx]);
|
|
68539
68539
|
for (let i2 = 0; i2 < requests.length; i2++) {
|
|
68540
68540
|
const request = requests[i2];
|
|
@@ -68546,19 +68546,19 @@ var require_client = __commonJS({
|
|
|
68546
68546
|
errorRequest(client, request, err2);
|
|
68547
68547
|
}
|
|
68548
68548
|
client[kPendingIdx] = client[kRunningIdx];
|
|
68549
|
-
|
|
68549
|
+
assert11(client[kRunning] === 0);
|
|
68550
68550
|
client.emit("disconnect", client[kUrl], [client], err2);
|
|
68551
68551
|
resume(client);
|
|
68552
68552
|
}
|
|
68553
68553
|
async function connect2(client) {
|
|
68554
|
-
|
|
68555
|
-
|
|
68554
|
+
assert11(!client[kConnecting]);
|
|
68555
|
+
assert11(!client[kSocket]);
|
|
68556
68556
|
let { host, hostname, protocol, port } = client[kUrl];
|
|
68557
68557
|
if (hostname[0] === "[") {
|
|
68558
68558
|
const idx = hostname.indexOf("]");
|
|
68559
|
-
|
|
68559
|
+
assert11(idx !== -1);
|
|
68560
68560
|
const ip = hostname.substr(1, idx - 1);
|
|
68561
|
-
|
|
68561
|
+
assert11(net2.isIP(ip));
|
|
68562
68562
|
hostname = ip;
|
|
68563
68563
|
}
|
|
68564
68564
|
client[kConnecting] = true;
|
|
@@ -68595,7 +68595,7 @@ var require_client = __commonJS({
|
|
|
68595
68595
|
llhttpPromise = null;
|
|
68596
68596
|
}
|
|
68597
68597
|
client[kConnecting] = false;
|
|
68598
|
-
|
|
68598
|
+
assert11(socket);
|
|
68599
68599
|
client[kSocket] = socket;
|
|
68600
68600
|
socket[kNoRef] = false;
|
|
68601
68601
|
socket[kWriting] = false;
|
|
@@ -68637,7 +68637,7 @@ var require_client = __commonJS({
|
|
|
68637
68637
|
});
|
|
68638
68638
|
}
|
|
68639
68639
|
if (err2.code === "ERR_TLS_CERT_ALTNAME_INVALID") {
|
|
68640
|
-
|
|
68640
|
+
assert11(client[kRunning] === 0);
|
|
68641
68641
|
while (client[kPending] > 0 && client[kQueue][client[kPendingIdx]].servername === client[kServerName]) {
|
|
68642
68642
|
const request = client[kQueue][client[kPendingIdx]++];
|
|
68643
68643
|
errorRequest(client, request, err2);
|
|
@@ -68669,7 +68669,7 @@ var require_client = __commonJS({
|
|
|
68669
68669
|
function _resume(client, sync) {
|
|
68670
68670
|
while (true) {
|
|
68671
68671
|
if (client[kDestroyed]) {
|
|
68672
|
-
|
|
68672
|
+
assert11(client[kPending] === 0);
|
|
68673
68673
|
return;
|
|
68674
68674
|
}
|
|
68675
68675
|
if (client[kClosed] && !client[kSize]) {
|
|
@@ -68745,7 +68745,7 @@ var require_client = __commonJS({
|
|
|
68745
68745
|
}
|
|
68746
68746
|
if (util.isStream(request.body) && util.bodyLength(request.body) === 0) {
|
|
68747
68747
|
request.body.on("data", function() {
|
|
68748
|
-
|
|
68748
|
+
assert11(false);
|
|
68749
68749
|
}).on("error", function(err2) {
|
|
68750
68750
|
errorRequest(client, request, err2);
|
|
68751
68751
|
}).on("end", function() {
|
|
@@ -68839,13 +68839,13 @@ upgrade: ${upgrade}\r
|
|
|
68839
68839
|
\r
|
|
68840
68840
|
`, "ascii");
|
|
68841
68841
|
} else {
|
|
68842
|
-
|
|
68842
|
+
assert11(contentLength === null, "no body must not have content length");
|
|
68843
68843
|
socket.write(`${header}\r
|
|
68844
68844
|
`, "ascii");
|
|
68845
68845
|
}
|
|
68846
68846
|
request.onRequestSent();
|
|
68847
68847
|
} else if (util.isBuffer(body)) {
|
|
68848
|
-
|
|
68848
|
+
assert11(contentLength === body.byteLength, "buffer body must have content length");
|
|
68849
68849
|
socket.cork();
|
|
68850
68850
|
socket.write(`${header}content-length: ${contentLength}\r
|
|
68851
68851
|
\r
|
|
@@ -68868,17 +68868,17 @@ upgrade: ${upgrade}\r
|
|
|
68868
68868
|
} else if (util.isIterable(body)) {
|
|
68869
68869
|
writeIterable({ body, client, request, socket, contentLength, header, expectsPayload });
|
|
68870
68870
|
} else {
|
|
68871
|
-
|
|
68871
|
+
assert11(false);
|
|
68872
68872
|
}
|
|
68873
68873
|
return true;
|
|
68874
68874
|
}
|
|
68875
68875
|
function writeStream({ body, client, request, socket, contentLength, header, expectsPayload }) {
|
|
68876
|
-
|
|
68876
|
+
assert11(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
68877
68877
|
let finished = false;
|
|
68878
68878
|
const writer = new AsyncWriter({ socket, request, contentLength, client, expectsPayload, header });
|
|
68879
68879
|
const onData = function(chunk) {
|
|
68880
68880
|
try {
|
|
68881
|
-
|
|
68881
|
+
assert11(!finished);
|
|
68882
68882
|
if (!writer.write(chunk) && this.pause) {
|
|
68883
68883
|
this.pause();
|
|
68884
68884
|
}
|
|
@@ -68887,7 +68887,7 @@ upgrade: ${upgrade}\r
|
|
|
68887
68887
|
}
|
|
68888
68888
|
};
|
|
68889
68889
|
const onDrain = function() {
|
|
68890
|
-
|
|
68890
|
+
assert11(!finished);
|
|
68891
68891
|
if (body.resume) {
|
|
68892
68892
|
body.resume();
|
|
68893
68893
|
}
|
|
@@ -68900,7 +68900,7 @@ upgrade: ${upgrade}\r
|
|
|
68900
68900
|
return;
|
|
68901
68901
|
}
|
|
68902
68902
|
finished = true;
|
|
68903
|
-
|
|
68903
|
+
assert11(socket.destroyed || socket[kWriting] && client[kRunning] <= 1);
|
|
68904
68904
|
socket.off("drain", onDrain).off("error", onFinished);
|
|
68905
68905
|
body.removeListener("data", onData).removeListener("end", onFinished).removeListener("error", onFinished).removeListener("close", onAbort);
|
|
68906
68906
|
if (!err2) {
|
|
@@ -68924,7 +68924,7 @@ upgrade: ${upgrade}\r
|
|
|
68924
68924
|
socket.on("drain", onDrain).on("error", onFinished);
|
|
68925
68925
|
}
|
|
68926
68926
|
async function writeBlob({ body, client, request, socket, contentLength, header, expectsPayload }) {
|
|
68927
|
-
|
|
68927
|
+
assert11(contentLength === body.size, "blob body must have content length");
|
|
68928
68928
|
try {
|
|
68929
68929
|
if (contentLength != null && contentLength !== body.size) {
|
|
68930
68930
|
throw new RequestContentLengthMismatchError();
|
|
@@ -68947,7 +68947,7 @@ upgrade: ${upgrade}\r
|
|
|
68947
68947
|
}
|
|
68948
68948
|
}
|
|
68949
68949
|
async function writeIterable({ body, client, request, socket, contentLength, header, expectsPayload }) {
|
|
68950
|
-
|
|
68950
|
+
assert11(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined");
|
|
68951
68951
|
let callback = null;
|
|
68952
68952
|
function onDrain() {
|
|
68953
68953
|
if (callback) {
|
|
@@ -68957,7 +68957,7 @@ upgrade: ${upgrade}\r
|
|
|
68957
68957
|
}
|
|
68958
68958
|
}
|
|
68959
68959
|
const waitForDrain = () => new Promise((resolve11, reject) => {
|
|
68960
|
-
|
|
68960
|
+
assert11(callback === null);
|
|
68961
68961
|
if (socket[kError]) {
|
|
68962
68962
|
reject(socket[kError]);
|
|
68963
68963
|
} else {
|
|
@@ -69074,7 +69074,7 @@ ${len.toString(16)}\r
|
|
|
69074
69074
|
const { socket, client } = this;
|
|
69075
69075
|
socket[kWriting] = false;
|
|
69076
69076
|
if (err2) {
|
|
69077
|
-
|
|
69077
|
+
assert11(client[kRunning] <= 1, "pipeline should only contain this request");
|
|
69078
69078
|
util.destroy(socket, err2);
|
|
69079
69079
|
}
|
|
69080
69080
|
}
|
|
@@ -69082,7 +69082,7 @@ ${len.toString(16)}\r
|
|
|
69082
69082
|
function errorRequest(client, request, err2) {
|
|
69083
69083
|
try {
|
|
69084
69084
|
request.onError(err2);
|
|
69085
|
-
|
|
69085
|
+
assert11(request.aborted);
|
|
69086
69086
|
} catch (err3) {
|
|
69087
69087
|
client.emit("error", err3);
|
|
69088
69088
|
}
|
|
@@ -69768,7 +69768,7 @@ var require_readable = __commonJS({
|
|
|
69768
69768
|
"node_modules/undici/lib/api/readable.js"(exports2, module2) {
|
|
69769
69769
|
"use strict";
|
|
69770
69770
|
init_import_meta_url();
|
|
69771
|
-
var
|
|
69771
|
+
var assert11 = require("assert");
|
|
69772
69772
|
var { Readable } = require("stream");
|
|
69773
69773
|
var { RequestAbortedError, NotSupportedError } = require_errors();
|
|
69774
69774
|
var util = require_util2();
|
|
@@ -69862,7 +69862,7 @@ var require_readable = __commonJS({
|
|
|
69862
69862
|
this[kBody] = ReadableStreamFrom(this);
|
|
69863
69863
|
if (this[kConsume]) {
|
|
69864
69864
|
this[kBody].getReader();
|
|
69865
|
-
|
|
69865
|
+
assert11(this[kBody].locked);
|
|
69866
69866
|
}
|
|
69867
69867
|
}
|
|
69868
69868
|
return this[kBody];
|
|
@@ -69890,7 +69890,7 @@ var require_readable = __commonJS({
|
|
|
69890
69890
|
if (isUnusable(stream)) {
|
|
69891
69891
|
throw new TypeError("unusable");
|
|
69892
69892
|
}
|
|
69893
|
-
|
|
69893
|
+
assert11(!stream[kConsume]);
|
|
69894
69894
|
return new Promise((resolve11, reject) => {
|
|
69895
69895
|
stream[kConsume] = {
|
|
69896
69896
|
type: type2,
|
|
@@ -70342,7 +70342,7 @@ var require_api_pipeline = __commonJS({
|
|
|
70342
70342
|
var util = require_util2();
|
|
70343
70343
|
var { AsyncResource } = require("async_hooks");
|
|
70344
70344
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
70345
|
-
var
|
|
70345
|
+
var assert11 = require("assert");
|
|
70346
70346
|
var kResume = Symbol("resume");
|
|
70347
70347
|
var PipelineRequest = class extends Readable {
|
|
70348
70348
|
constructor() {
|
|
@@ -70442,7 +70442,7 @@ var require_api_pipeline = __commonJS({
|
|
|
70442
70442
|
}
|
|
70443
70443
|
onConnect(abort2, context) {
|
|
70444
70444
|
const { ret, res } = this;
|
|
70445
|
-
|
|
70445
|
+
assert11(!res, "pipeline cannot be retried");
|
|
70446
70446
|
if (ret.destroyed) {
|
|
70447
70447
|
throw new RequestAbortedError();
|
|
70448
70448
|
}
|
|
@@ -70532,7 +70532,7 @@ var require_api_upgrade = __commonJS({
|
|
|
70532
70532
|
var { AsyncResource } = require("async_hooks");
|
|
70533
70533
|
var util = require_util2();
|
|
70534
70534
|
var { addSignal, removeSignal } = require_abort_signal();
|
|
70535
|
-
var
|
|
70535
|
+
var assert11 = require("assert");
|
|
70536
70536
|
var UpgradeHandler = class extends AsyncResource {
|
|
70537
70537
|
constructor(opts, callback) {
|
|
70538
70538
|
if (!opts || typeof opts !== "object") {
|
|
@@ -70565,7 +70565,7 @@ var require_api_upgrade = __commonJS({
|
|
|
70565
70565
|
}
|
|
70566
70566
|
onUpgrade(statusCode, rawHeaders, socket) {
|
|
70567
70567
|
const { callback, opaque, context } = this;
|
|
70568
|
-
|
|
70568
|
+
assert11.strictEqual(statusCode, 101);
|
|
70569
70569
|
removeSignal(this);
|
|
70570
70570
|
this.callback = null;
|
|
70571
70571
|
const headers = this.responseHeaders === "raw" ? util.parseRawHeaders(rawHeaders) : util.parseHeaders(rawHeaders);
|
|
@@ -72307,7 +72307,7 @@ var require_body = __commonJS({
|
|
|
72307
72307
|
var { kState } = require_symbols2();
|
|
72308
72308
|
var { Blob: Blob2 } = require("buffer");
|
|
72309
72309
|
var { kBodyUsed } = require_symbols();
|
|
72310
|
-
var
|
|
72310
|
+
var assert11 = require("assert");
|
|
72311
72311
|
var { NotSupportedError } = require_errors();
|
|
72312
72312
|
var { isErrored } = require_util2();
|
|
72313
72313
|
var { isUint8Array } = require("util/types");
|
|
@@ -72427,8 +72427,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
72427
72427
|
ReadableStream = require("stream/web").ReadableStream;
|
|
72428
72428
|
}
|
|
72429
72429
|
if (object instanceof ReadableStream) {
|
|
72430
|
-
|
|
72431
|
-
|
|
72430
|
+
assert11(!util.isDisturbed(object), "disturbed");
|
|
72431
|
+
assert11(!object.locked, "locked");
|
|
72432
72432
|
}
|
|
72433
72433
|
return extractBody(object, keepalive);
|
|
72434
72434
|
}
|
|
@@ -72539,7 +72539,7 @@ var require_response = __commonJS({
|
|
|
72539
72539
|
} = require_constants3();
|
|
72540
72540
|
var { kState, kHeaders, kGuard, kRealm } = require_symbols2();
|
|
72541
72541
|
var { kHeadersList } = require_symbols();
|
|
72542
|
-
var
|
|
72542
|
+
var assert11 = require("assert");
|
|
72543
72543
|
var Response = class {
|
|
72544
72544
|
static error() {
|
|
72545
72545
|
const relevantRealm = { settingsObject: {} };
|
|
@@ -72782,7 +72782,7 @@ var require_response = __commonJS({
|
|
|
72782
72782
|
body: null
|
|
72783
72783
|
});
|
|
72784
72784
|
} else {
|
|
72785
|
-
|
|
72785
|
+
assert11(false);
|
|
72786
72786
|
}
|
|
72787
72787
|
}
|
|
72788
72788
|
module2.exports = { makeNetworkError, makeResponse, filterResponse, Response };
|
|
@@ -72814,7 +72814,7 @@ var require_request2 = __commonJS({
|
|
|
72814
72814
|
var { kEnumerableProperty } = util;
|
|
72815
72815
|
var { kHeaders, kSignal, kState, kGuard, kRealm } = require_symbols2();
|
|
72816
72816
|
var { kHeadersList } = require_symbols();
|
|
72817
|
-
var
|
|
72817
|
+
var assert11 = require("assert");
|
|
72818
72818
|
var TransformStream;
|
|
72819
72819
|
var kInit = Symbol("init");
|
|
72820
72820
|
var requestFinalizer = new FinalizationRegistry(({ signal, abort: abort2 }) => {
|
|
@@ -72853,7 +72853,7 @@ var require_request2 = __commonJS({
|
|
|
72853
72853
|
request = makeRequest({ urlList: [parsedURL] });
|
|
72854
72854
|
fallbackMode = "cors";
|
|
72855
72855
|
} else {
|
|
72856
|
-
|
|
72856
|
+
assert11(input instanceof Request);
|
|
72857
72857
|
request = input[kState];
|
|
72858
72858
|
signal = input[kSignal];
|
|
72859
72859
|
}
|
|
@@ -73248,11 +73248,11 @@ var require_request2 = __commonJS({
|
|
|
73248
73248
|
var require_dataURL = __commonJS({
|
|
73249
73249
|
"node_modules/undici/lib/fetch/dataURL.js"(exports2, module2) {
|
|
73250
73250
|
init_import_meta_url();
|
|
73251
|
-
var
|
|
73251
|
+
var assert11 = require("assert");
|
|
73252
73252
|
var { atob } = require("buffer");
|
|
73253
73253
|
var encoder = new TextEncoder();
|
|
73254
73254
|
function dataURLProcessor(dataURL) {
|
|
73255
|
-
|
|
73255
|
+
assert11(dataURL.protocol === "data:");
|
|
73256
73256
|
let input = URLSerializer(dataURL, true);
|
|
73257
73257
|
input = input.slice(5);
|
|
73258
73258
|
const position = { position: 0 };
|
|
@@ -73414,7 +73414,7 @@ var require_dataURL = __commonJS({
|
|
|
73414
73414
|
function collectAnHTTPQuotedString(input, position, extractValue) {
|
|
73415
73415
|
const positionStart = position.position;
|
|
73416
73416
|
let value = "";
|
|
73417
|
-
|
|
73417
|
+
assert11(input[position.position] === '"');
|
|
73418
73418
|
position.position++;
|
|
73419
73419
|
while (true) {
|
|
73420
73420
|
value += collectASequenceOfCodePoints((char) => char !== '"' && char !== "\\", input, position);
|
|
@@ -73431,7 +73431,7 @@ var require_dataURL = __commonJS({
|
|
|
73431
73431
|
value += input[position.position];
|
|
73432
73432
|
position.position++;
|
|
73433
73433
|
} else {
|
|
73434
|
-
|
|
73434
|
+
assert11(quoteOrBackslash === '"');
|
|
73435
73435
|
break;
|
|
73436
73436
|
}
|
|
73437
73437
|
}
|
|
@@ -73491,7 +73491,7 @@ var require_fetch = __commonJS({
|
|
|
73491
73491
|
} = require_util3();
|
|
73492
73492
|
var { kState, kHeaders, kGuard, kRealm } = require_symbols2();
|
|
73493
73493
|
var { AbortError } = require_errors();
|
|
73494
|
-
var
|
|
73494
|
+
var assert11 = require("assert");
|
|
73495
73495
|
var { safelyExtractBody, extractBody } = require_body();
|
|
73496
73496
|
var {
|
|
73497
73497
|
redirectStatus,
|
|
@@ -73666,7 +73666,7 @@ var require_fetch = __commonJS({
|
|
|
73666
73666
|
taskDestination,
|
|
73667
73667
|
crossOriginIsolatedCapability
|
|
73668
73668
|
};
|
|
73669
|
-
|
|
73669
|
+
assert11(!request.body || request.body.stream);
|
|
73670
73670
|
if (request.window === "client") {
|
|
73671
73671
|
request.window = request.client?.globalObject instanceof Window ? request.client : "no-window";
|
|
73672
73672
|
}
|
|
@@ -73751,7 +73751,7 @@ var require_fetch = __commonJS({
|
|
|
73751
73751
|
} else if (request.responseTainting === "opaque") {
|
|
73752
73752
|
response = filterResponse(response, "opaque");
|
|
73753
73753
|
} else {
|
|
73754
|
-
|
|
73754
|
+
assert11(false);
|
|
73755
73755
|
}
|
|
73756
73756
|
}
|
|
73757
73757
|
let internalResponse = response.status === 0 ? response : response.internalResponse;
|
|
@@ -73932,7 +73932,7 @@ var require_fetch = __commonJS({
|
|
|
73932
73932
|
} else if (request.redirect === "follow") {
|
|
73933
73933
|
response = await httpRedirectFetch.call(this, fetchParams, response);
|
|
73934
73934
|
} else {
|
|
73935
|
-
|
|
73935
|
+
assert11(false);
|
|
73936
73936
|
}
|
|
73937
73937
|
}
|
|
73938
73938
|
response.timingInfo = timingInfo;
|
|
@@ -73974,7 +73974,7 @@ var require_fetch = __commonJS({
|
|
|
73974
73974
|
}
|
|
73975
73975
|
}
|
|
73976
73976
|
if (request.body != null) {
|
|
73977
|
-
|
|
73977
|
+
assert11(request.body.source);
|
|
73978
73978
|
request.body = safelyExtractBody(request.body.source)[0];
|
|
73979
73979
|
}
|
|
73980
73980
|
const timingInfo = fetchParams.timingInfo;
|
|
@@ -74103,7 +74103,7 @@ var require_fetch = __commonJS({
|
|
|
74103
74103
|
function httpNetworkFetch(fetchParams, includeCredentials = false, forceNewConnection = false) {
|
|
74104
74104
|
const context = this;
|
|
74105
74105
|
return new Promise((resolve11) => {
|
|
74106
|
-
|
|
74106
|
+
assert11(!context.connection || context.connection.destroyed);
|
|
74107
74107
|
context.connection = {
|
|
74108
74108
|
abort: null,
|
|
74109
74109
|
destroyed: false,
|
|
@@ -78038,9 +78038,9 @@ var require_readdirp = __commonJS({
|
|
|
78038
78038
|
async _formatEntry(dirent, path22) {
|
|
78039
78039
|
let entry;
|
|
78040
78040
|
try {
|
|
78041
|
-
const
|
|
78042
|
-
const fullPath = sysPath.resolve(sysPath.join(path22,
|
|
78043
|
-
entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename:
|
|
78041
|
+
const basename5 = this._isDirent ? dirent.name : dirent;
|
|
78042
|
+
const fullPath = sysPath.resolve(sysPath.join(path22, basename5));
|
|
78043
|
+
entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename: basename5 };
|
|
78044
78044
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
78045
78045
|
} catch (err2) {
|
|
78046
78046
|
this._onError(err2);
|
|
@@ -79997,16 +79997,16 @@ var require_nodefs_handler = __commonJS({
|
|
|
79997
79997
|
_watchWithNodeFs(path22, listener) {
|
|
79998
79998
|
const opts = this.fsw.options;
|
|
79999
79999
|
const directory = sysPath.dirname(path22);
|
|
80000
|
-
const
|
|
80000
|
+
const basename5 = sysPath.basename(path22);
|
|
80001
80001
|
const parent = this.fsw._getWatchedDir(directory);
|
|
80002
|
-
parent.add(
|
|
80002
|
+
parent.add(basename5);
|
|
80003
80003
|
const absolutePath = sysPath.resolve(path22);
|
|
80004
80004
|
const options = { persistent: opts.persistent };
|
|
80005
80005
|
if (!listener)
|
|
80006
80006
|
listener = EMPTY_FN;
|
|
80007
80007
|
let closer;
|
|
80008
80008
|
if (opts.usePolling) {
|
|
80009
|
-
options.interval = opts.enableBinaryInterval && isBinaryPath(
|
|
80009
|
+
options.interval = opts.enableBinaryInterval && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
|
|
80010
80010
|
closer = setFsWatchFileListener(path22, absolutePath, options, {
|
|
80011
80011
|
listener,
|
|
80012
80012
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -80025,10 +80025,10 @@ var require_nodefs_handler = __commonJS({
|
|
|
80025
80025
|
return;
|
|
80026
80026
|
}
|
|
80027
80027
|
const dirname9 = sysPath.dirname(file);
|
|
80028
|
-
const
|
|
80028
|
+
const basename5 = sysPath.basename(file);
|
|
80029
80029
|
const parent = this.fsw._getWatchedDir(dirname9);
|
|
80030
80030
|
let prevStats = stats;
|
|
80031
|
-
if (parent.has(
|
|
80031
|
+
if (parent.has(basename5))
|
|
80032
80032
|
return;
|
|
80033
80033
|
const listener = async (path22, newStats) => {
|
|
80034
80034
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
|
@@ -80051,9 +80051,9 @@ var require_nodefs_handler = __commonJS({
|
|
|
80051
80051
|
prevStats = newStats2;
|
|
80052
80052
|
}
|
|
80053
80053
|
} catch (error) {
|
|
80054
|
-
this.fsw._remove(dirname9,
|
|
80054
|
+
this.fsw._remove(dirname9, basename5);
|
|
80055
80055
|
}
|
|
80056
|
-
} else if (parent.has(
|
|
80056
|
+
} else if (parent.has(basename5)) {
|
|
80057
80057
|
const at = newStats.atimeMs;
|
|
80058
80058
|
const mt = newStats.mtimeMs;
|
|
80059
80059
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
|
@@ -82575,8 +82575,8 @@ var require_command_exists = __commonJS({
|
|
|
82575
82575
|
var isPathName = /[\\]/.test(s);
|
|
82576
82576
|
if (isPathName) {
|
|
82577
82577
|
var dirname9 = '"' + path22.dirname(s) + '"';
|
|
82578
|
-
var
|
|
82579
|
-
return dirname9 + ":" +
|
|
82578
|
+
var basename5 = '"' + path22.basename(s) + '"';
|
|
82579
|
+
return dirname9 + ":" + basename5;
|
|
82580
82580
|
}
|
|
82581
82581
|
return '"' + s + '"';
|
|
82582
82582
|
};
|
|
@@ -84145,7 +84145,7 @@ var require_sync = __commonJS({
|
|
|
84145
84145
|
var Glob = require_glob().Glob;
|
|
84146
84146
|
var util = require("util");
|
|
84147
84147
|
var path22 = require("path");
|
|
84148
|
-
var
|
|
84148
|
+
var assert11 = require("assert");
|
|
84149
84149
|
var isAbsolute = require_path_is_absolute();
|
|
84150
84150
|
var common = require_common();
|
|
84151
84151
|
var setopts = common.setopts;
|
|
@@ -84175,7 +84175,7 @@ var require_sync = __commonJS({
|
|
|
84175
84175
|
this._finish();
|
|
84176
84176
|
}
|
|
84177
84177
|
GlobSync.prototype._finish = function() {
|
|
84178
|
-
|
|
84178
|
+
assert11(this instanceof GlobSync);
|
|
84179
84179
|
if (this.realpath) {
|
|
84180
84180
|
var self2 = this;
|
|
84181
84181
|
this.matches.forEach(function(matchset, index) {
|
|
@@ -84197,7 +84197,7 @@ var require_sync = __commonJS({
|
|
|
84197
84197
|
common.finish(this);
|
|
84198
84198
|
};
|
|
84199
84199
|
GlobSync.prototype._process = function(pattern, index, inGlobStar) {
|
|
84200
|
-
|
|
84200
|
+
assert11(this instanceof GlobSync);
|
|
84201
84201
|
var n = 0;
|
|
84202
84202
|
while (typeof pattern[n] === "string") {
|
|
84203
84203
|
n++;
|
|
@@ -84621,7 +84621,7 @@ var require_glob = __commonJS({
|
|
|
84621
84621
|
var inherits = require_inherits();
|
|
84622
84622
|
var EE = require("events").EventEmitter;
|
|
84623
84623
|
var path22 = require("path");
|
|
84624
|
-
var
|
|
84624
|
+
var assert11 = require("assert");
|
|
84625
84625
|
var isAbsolute = require_path_is_absolute();
|
|
84626
84626
|
var globSync = require_sync();
|
|
84627
84627
|
var common = require_common();
|
|
@@ -84726,7 +84726,7 @@ var require_glob = __commonJS({
|
|
|
84726
84726
|
}
|
|
84727
84727
|
}
|
|
84728
84728
|
Glob.prototype._finish = function() {
|
|
84729
|
-
|
|
84729
|
+
assert11(this instanceof Glob);
|
|
84730
84730
|
if (this.aborted)
|
|
84731
84731
|
return;
|
|
84732
84732
|
if (this.realpath && !this._didRealpath)
|
|
@@ -84815,8 +84815,8 @@ var require_glob = __commonJS({
|
|
|
84815
84815
|
}
|
|
84816
84816
|
};
|
|
84817
84817
|
Glob.prototype._process = function(pattern, index, inGlobStar, cb2) {
|
|
84818
|
-
|
|
84819
|
-
|
|
84818
|
+
assert11(this instanceof Glob);
|
|
84819
|
+
assert11(typeof cb2 === "function");
|
|
84820
84820
|
if (this.aborted)
|
|
84821
84821
|
return;
|
|
84822
84822
|
this._processing++;
|
|
@@ -85168,7 +85168,7 @@ var require_glob = __commonJS({
|
|
|
85168
85168
|
var require_rimraf = __commonJS({
|
|
85169
85169
|
"../../node_modules/rimraf/rimraf.js"(exports2, module2) {
|
|
85170
85170
|
init_import_meta_url();
|
|
85171
|
-
var
|
|
85171
|
+
var assert11 = require("assert");
|
|
85172
85172
|
var path22 = require("path");
|
|
85173
85173
|
var fs9 = require("fs");
|
|
85174
85174
|
var glob = void 0;
|
|
@@ -85212,11 +85212,11 @@ var require_rimraf = __commonJS({
|
|
|
85212
85212
|
cb2 = options;
|
|
85213
85213
|
options = {};
|
|
85214
85214
|
}
|
|
85215
|
-
|
|
85216
|
-
|
|
85217
|
-
|
|
85218
|
-
|
|
85219
|
-
|
|
85215
|
+
assert11(p, "rimraf: missing path");
|
|
85216
|
+
assert11.equal(typeof p, "string", "rimraf: path should be a string");
|
|
85217
|
+
assert11.equal(typeof cb2, "function", "rimraf: callback function required");
|
|
85218
|
+
assert11(options, "rimraf: invalid options argument provided");
|
|
85219
|
+
assert11.equal(typeof options, "object", "rimraf: options should be object");
|
|
85220
85220
|
defaults(options);
|
|
85221
85221
|
let busyTries = 0;
|
|
85222
85222
|
let errState = null;
|
|
@@ -85260,9 +85260,9 @@ var require_rimraf = __commonJS({
|
|
|
85260
85260
|
});
|
|
85261
85261
|
};
|
|
85262
85262
|
var rimraf_ = (p, options, cb2) => {
|
|
85263
|
-
|
|
85264
|
-
|
|
85265
|
-
|
|
85263
|
+
assert11(p);
|
|
85264
|
+
assert11(options);
|
|
85265
|
+
assert11(typeof cb2 === "function");
|
|
85266
85266
|
options.lstat(p, (er, st) => {
|
|
85267
85267
|
if (er && er.code === "ENOENT")
|
|
85268
85268
|
return cb2(null);
|
|
@@ -85284,9 +85284,9 @@ var require_rimraf = __commonJS({
|
|
|
85284
85284
|
});
|
|
85285
85285
|
};
|
|
85286
85286
|
var fixWinEPERM = (p, options, er, cb2) => {
|
|
85287
|
-
|
|
85288
|
-
|
|
85289
|
-
|
|
85287
|
+
assert11(p);
|
|
85288
|
+
assert11(options);
|
|
85289
|
+
assert11(typeof cb2 === "function");
|
|
85290
85290
|
options.chmod(p, 438, (er2) => {
|
|
85291
85291
|
if (er2)
|
|
85292
85292
|
cb2(er2.code === "ENOENT" ? null : er);
|
|
@@ -85302,8 +85302,8 @@ var require_rimraf = __commonJS({
|
|
|
85302
85302
|
});
|
|
85303
85303
|
};
|
|
85304
85304
|
var fixWinEPERMSync = (p, options, er) => {
|
|
85305
|
-
|
|
85306
|
-
|
|
85305
|
+
assert11(p);
|
|
85306
|
+
assert11(options);
|
|
85307
85307
|
try {
|
|
85308
85308
|
options.chmodSync(p, 438);
|
|
85309
85309
|
} catch (er2) {
|
|
@@ -85327,9 +85327,9 @@ var require_rimraf = __commonJS({
|
|
|
85327
85327
|
options.unlinkSync(p);
|
|
85328
85328
|
};
|
|
85329
85329
|
var rmdir = (p, options, originalEr, cb2) => {
|
|
85330
|
-
|
|
85331
|
-
|
|
85332
|
-
|
|
85330
|
+
assert11(p);
|
|
85331
|
+
assert11(options);
|
|
85332
|
+
assert11(typeof cb2 === "function");
|
|
85333
85333
|
options.rmdir(p, (er) => {
|
|
85334
85334
|
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
|
85335
85335
|
rmkids(p, options, cb2);
|
|
@@ -85340,9 +85340,9 @@ var require_rimraf = __commonJS({
|
|
|
85340
85340
|
});
|
|
85341
85341
|
};
|
|
85342
85342
|
var rmkids = (p, options, cb2) => {
|
|
85343
|
-
|
|
85344
|
-
|
|
85345
|
-
|
|
85343
|
+
assert11(p);
|
|
85344
|
+
assert11(options);
|
|
85345
|
+
assert11(typeof cb2 === "function");
|
|
85346
85346
|
options.readdir(p, (er, files2) => {
|
|
85347
85347
|
if (er)
|
|
85348
85348
|
return cb2(er);
|
|
@@ -85365,10 +85365,10 @@ var require_rimraf = __commonJS({
|
|
|
85365
85365
|
var rimrafSync = (p, options) => {
|
|
85366
85366
|
options = options || {};
|
|
85367
85367
|
defaults(options);
|
|
85368
|
-
|
|
85369
|
-
|
|
85370
|
-
|
|
85371
|
-
|
|
85368
|
+
assert11(p, "rimraf: missing path");
|
|
85369
|
+
assert11.equal(typeof p, "string", "rimraf: path should be a string");
|
|
85370
|
+
assert11(options, "rimraf: missing options");
|
|
85371
|
+
assert11.equal(typeof options, "object", "rimraf: options should be object");
|
|
85372
85372
|
let results;
|
|
85373
85373
|
if (options.disableGlob || !glob.hasMagic(p)) {
|
|
85374
85374
|
results = [p];
|
|
@@ -85410,8 +85410,8 @@ var require_rimraf = __commonJS({
|
|
|
85410
85410
|
}
|
|
85411
85411
|
};
|
|
85412
85412
|
var rmdirSync = (p, options, originalEr) => {
|
|
85413
|
-
|
|
85414
|
-
|
|
85413
|
+
assert11(p);
|
|
85414
|
+
assert11(options);
|
|
85415
85415
|
try {
|
|
85416
85416
|
options.rmdirSync(p);
|
|
85417
85417
|
} catch (er) {
|
|
@@ -85424,8 +85424,8 @@ var require_rimraf = __commonJS({
|
|
|
85424
85424
|
}
|
|
85425
85425
|
};
|
|
85426
85426
|
var rmkidsSync = (p, options) => {
|
|
85427
|
-
|
|
85428
|
-
|
|
85427
|
+
assert11(p);
|
|
85428
|
+
assert11(options);
|
|
85429
85429
|
options.readdirSync(p).forEach((f) => rimrafSync(path22.join(p, f), options));
|
|
85430
85430
|
const retries = isWindows2 ? 100 : 1;
|
|
85431
85431
|
let i2 = 0;
|
|
@@ -85732,8 +85732,8 @@ var require_tmp = __commonJS({
|
|
|
85732
85732
|
if (option === "name") {
|
|
85733
85733
|
if (path22.isAbsolute(name2))
|
|
85734
85734
|
throw new Error(`${option} option must not contain an absolute path, found "${name2}".`);
|
|
85735
|
-
let
|
|
85736
|
-
if (
|
|
85735
|
+
let basename5 = path22.basename(name2);
|
|
85736
|
+
if (basename5 === ".." || basename5 === "." || basename5 !== name2)
|
|
85737
85737
|
throw new Error(`${option} option must not contain a path, found "${name2}".`);
|
|
85738
85738
|
} else {
|
|
85739
85739
|
if (path22.isAbsolute(name2) && !name2.startsWith(tmpDir)) {
|
|
@@ -88849,17 +88849,17 @@ var require_base = __commonJS({
|
|
|
88849
88849
|
var require_http_parser = __commonJS({
|
|
88850
88850
|
"../../node_modules/http-parser-js/http-parser.js"(exports2) {
|
|
88851
88851
|
init_import_meta_url();
|
|
88852
|
-
var
|
|
88852
|
+
var assert11 = require("assert");
|
|
88853
88853
|
exports2.HTTPParser = HTTPParser;
|
|
88854
88854
|
function HTTPParser(type2) {
|
|
88855
|
-
|
|
88855
|
+
assert11.ok(type2 === HTTPParser.REQUEST || type2 === HTTPParser.RESPONSE || type2 === void 0);
|
|
88856
88856
|
if (type2 === void 0) {
|
|
88857
88857
|
} else {
|
|
88858
88858
|
this.initialize(type2);
|
|
88859
88859
|
}
|
|
88860
88860
|
}
|
|
88861
88861
|
HTTPParser.prototype.initialize = function(type2, async_resource) {
|
|
88862
|
-
|
|
88862
|
+
assert11.ok(type2 === HTTPParser.REQUEST || type2 === HTTPParser.RESPONSE);
|
|
88863
88863
|
this.type = type2;
|
|
88864
88864
|
this.state = type2 + "_LINE";
|
|
88865
88865
|
this.info = {
|
|
@@ -89188,7 +89188,7 @@ var require_http_parser = __commonJS({
|
|
|
89188
89188
|
if (line === void 0) {
|
|
89189
89189
|
return;
|
|
89190
89190
|
}
|
|
89191
|
-
|
|
89191
|
+
assert11.equal(line, "");
|
|
89192
89192
|
this.state = "BODY_CHUNKHEAD";
|
|
89193
89193
|
};
|
|
89194
89194
|
HTTPParser.prototype.BODY_CHUNKTRAILERS = function() {
|
|
@@ -93214,7 +93214,7 @@ var require_send = __commonJS({
|
|
|
93214
93214
|
var statuses = require_statuses();
|
|
93215
93215
|
var Stream = require("stream");
|
|
93216
93216
|
var util = require("util");
|
|
93217
|
-
var
|
|
93217
|
+
var extname4 = path22.extname;
|
|
93218
93218
|
var join8 = path22.join;
|
|
93219
93219
|
var normalize2 = path22.normalize;
|
|
93220
93220
|
var resolve11 = path22.resolve;
|
|
@@ -93534,7 +93534,7 @@ var require_send = __commonJS({
|
|
|
93534
93534
|
var self2 = this;
|
|
93535
93535
|
debug('stat "%s"', path23);
|
|
93536
93536
|
fs9.stat(path23, function onstat(err2, stat3) {
|
|
93537
|
-
if (err2 && err2.code === "ENOENT" && !
|
|
93537
|
+
if (err2 && err2.code === "ENOENT" && !extname4(path23) && path23[path23.length - 1] !== sep2) {
|
|
93538
93538
|
return next(err2);
|
|
93539
93539
|
}
|
|
93540
93540
|
if (err2)
|
|
@@ -104962,7 +104962,7 @@ var yargs_default = Yargs;
|
|
|
104962
104962
|
|
|
104963
104963
|
// package.json
|
|
104964
104964
|
var name = "wrangler";
|
|
104965
|
-
var version = "2.0.
|
|
104965
|
+
var version = "2.0.6";
|
|
104966
104966
|
var author = "wrangler@cloudflare.com";
|
|
104967
104967
|
var description = "Command-line interface for all things Cloudflare Workers";
|
|
104968
104968
|
var bin = {
|
|
@@ -106534,11 +106534,31 @@ function normalizeAndValidateModulePaths(diagnostics, configPath, field, rawMapp
|
|
|
106534
106534
|
return mapping;
|
|
106535
106535
|
}
|
|
106536
106536
|
function isValidRouteValue(item) {
|
|
106537
|
-
|
|
106537
|
+
if (!item) {
|
|
106538
|
+
return false;
|
|
106539
|
+
}
|
|
106540
|
+
if (typeof item === "string") {
|
|
106541
|
+
return true;
|
|
106542
|
+
}
|
|
106543
|
+
if (typeof item === "object") {
|
|
106544
|
+
if (!hasProperty(item, "pattern") || typeof item.pattern !== "string") {
|
|
106545
|
+
return false;
|
|
106546
|
+
}
|
|
106547
|
+
const otherKeys = Object.keys(item).length - 1;
|
|
106548
|
+
const hasZoneId = hasProperty(item, "zone_id") && typeof item.zone_id === "string";
|
|
106549
|
+
const hasZoneName = hasProperty(item, "zone_name") && typeof item.zone_name === "string";
|
|
106550
|
+
const hasCustomDomainFlag = hasProperty(item, "custom_domain") && typeof item.custom_domain === "boolean";
|
|
106551
|
+
if (otherKeys === 2 && hasCustomDomainFlag && (hasZoneId || hasZoneName)) {
|
|
106552
|
+
return true;
|
|
106553
|
+
} else if (otherKeys === 1 && (hasZoneId || hasZoneName || hasCustomDomainFlag)) {
|
|
106554
|
+
return true;
|
|
106555
|
+
}
|
|
106556
|
+
}
|
|
106557
|
+
return false;
|
|
106538
106558
|
}
|
|
106539
106559
|
var isRoute = (diagnostics, field, value) => {
|
|
106540
106560
|
if (value !== void 0 && !isValidRouteValue(value)) {
|
|
106541
|
-
diagnostics.errors.push(`Expected "${field}" to be either a string, or an object with shape { pattern, zone_id | zone_name }, but got ${JSON.stringify(value)}.`);
|
|
106561
|
+
diagnostics.errors.push(`Expected "${field}" to be either a string, or an object with shape { pattern, custom_domain, zone_id | zone_name }, but got ${JSON.stringify(value)}.`);
|
|
106542
106562
|
return false;
|
|
106543
106563
|
}
|
|
106544
106564
|
return true;
|
|
@@ -106558,7 +106578,7 @@ var isRouteArray = (diagnostics, field, value) => {
|
|
|
106558
106578
|
}
|
|
106559
106579
|
}
|
|
106560
106580
|
if (invalidRoutes.length > 0) {
|
|
106561
|
-
diagnostics.errors.push(`Expected "${field}" to be an array of either strings or objects with the shape { pattern, zone_id | zone_name }, but these weren't valid: ${JSON.stringify(invalidRoutes, null, 2)}.`);
|
|
106581
|
+
diagnostics.errors.push(`Expected "${field}" to be an array of either strings or objects with the shape { pattern, custom_domain, zone_id | zone_name }, but these weren't valid: ${JSON.stringify(invalidRoutes, null, 2)}.`);
|
|
106562
106582
|
}
|
|
106563
106583
|
return invalidRoutes.length === 0;
|
|
106564
106584
|
};
|
|
@@ -106570,21 +106590,9 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv) {
|
|
|
106570
106590
|
}
|
|
106571
106591
|
function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envName = "top level", topLevelEnv, isLegacyEnv2, rawConfig) {
|
|
106572
106592
|
deprecated(diagnostics, rawEnv, "zone_id", "This is unnecessary since we can deduce this from routes directly.", false);
|
|
106573
|
-
deprecated(diagnostics, rawEnv, "experimental_services", `The "experimental_services" field is no longer supported.
|
|
106574
|
-
\`\`\`
|
|
106575
|
-
` + import_toml3.default.stringify({
|
|
106576
|
-
unsafe: {
|
|
106577
|
-
bindings: (rawEnv?.experimental_services || []).map((serviceDefinition) => {
|
|
106578
|
-
return {
|
|
106579
|
-
name: serviceDefinition.name,
|
|
106580
|
-
type: "service",
|
|
106581
|
-
service: serviceDefinition.service,
|
|
106582
|
-
environment: serviceDefinition.environment
|
|
106583
|
-
};
|
|
106584
|
-
})
|
|
106585
|
-
}
|
|
106586
|
-
}) + "```", true);
|
|
106593
|
+
deprecated(diagnostics, rawEnv, "experimental_services", `The "experimental_services" field is no longer supported. Simply rename the [experimental_services] field to [services].`, true);
|
|
106587
106594
|
experimental(diagnostics, rawEnv, "unsafe");
|
|
106595
|
+
experimental(diagnostics, rawEnv, "services");
|
|
106588
106596
|
const route = validateRoute(diagnostics, topLevelEnv, rawEnv);
|
|
106589
106597
|
const routes = validateRoutes(diagnostics, topLevelEnv, rawEnv);
|
|
106590
106598
|
const workers_dev = inheritable(diagnostics, topLevelEnv, rawEnv, "workers_dev", isBoolean2, void 0);
|
|
@@ -106611,6 +106619,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
|
|
|
106611
106619
|
}),
|
|
106612
106620
|
kv_namespaces: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "kv_namespaces", validateBindingArray(envName, validateKVBinding), []),
|
|
106613
106621
|
r2_buckets: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "r2_buckets", validateBindingArray(envName, validateR2Binding), []),
|
|
106622
|
+
services: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "services", validateBindingArray(envName, validateServiceBinding), []),
|
|
106614
106623
|
unsafe: notInheritable(diagnostics, topLevelEnv, rawConfig, rawEnv, envName, "unsafe", validateBindingsProperty(envName, validateUnsafeBinding), {
|
|
106615
106624
|
bindings: []
|
|
106616
106625
|
}),
|
|
@@ -106670,7 +106679,7 @@ var validateRule = (diagnostics, field, value) => {
|
|
|
106670
106679
|
}
|
|
106671
106680
|
isValid = validateTypedArray(diagnostics, `${field}.globs`, rule.globs, "string") && isValid;
|
|
106672
106681
|
if (!isOptionalProperty(rule, "fallthrough", "boolean")) {
|
|
106673
|
-
diagnostics.errors.push(`
|
|
106682
|
+
diagnostics.errors.push(`the field "fallthrough", when present, should be a boolean.`);
|
|
106674
106683
|
isValid = false;
|
|
106675
106684
|
}
|
|
106676
106685
|
return isValid;
|
|
@@ -106746,7 +106755,15 @@ var validateDurableObjectBinding = (diagnostics, field, value) => {
|
|
|
106746
106755
|
isValid = false;
|
|
106747
106756
|
}
|
|
106748
106757
|
if (!isOptionalProperty(value, "script_name", "string")) {
|
|
106749
|
-
diagnostics.errors.push(`
|
|
106758
|
+
diagnostics.errors.push(`the field "script_name", when present, should be a string.`);
|
|
106759
|
+
isValid = false;
|
|
106760
|
+
}
|
|
106761
|
+
if (!isOptionalProperty(value, "environment", "string")) {
|
|
106762
|
+
diagnostics.errors.push(`the field "environment", when present, should be a string.`);
|
|
106763
|
+
isValid = false;
|
|
106764
|
+
}
|
|
106765
|
+
if ("environment" in value && !("script_name" in value)) {
|
|
106766
|
+
diagnostics.errors.push(`binding should have a "script_name" field if "environment" is present.`);
|
|
106750
106767
|
isValid = false;
|
|
106751
106768
|
}
|
|
106752
106769
|
return isValid;
|
|
@@ -106765,8 +106782,13 @@ var validateUnsafeBinding = (diagnostics, field, value) => {
|
|
|
106765
106782
|
const safeBindings = [
|
|
106766
106783
|
"plain_text",
|
|
106767
106784
|
"json",
|
|
106785
|
+
"wasm_module",
|
|
106786
|
+
"data_blob",
|
|
106787
|
+
"text_blob",
|
|
106768
106788
|
"kv_namespace",
|
|
106769
|
-
"durable_object_namespace"
|
|
106789
|
+
"durable_object_namespace",
|
|
106790
|
+
"r2_bucket",
|
|
106791
|
+
"service"
|
|
106770
106792
|
];
|
|
106771
106793
|
if (safeBindings.includes(value.type)) {
|
|
106772
106794
|
diagnostics.warnings.push(`The binding type "${value.type}" is directly supported by wrangler.
|
|
@@ -106902,6 +106924,26 @@ ${resolution}`);
|
|
|
106902
106924
|
}
|
|
106903
106925
|
return !hasDuplicates;
|
|
106904
106926
|
};
|
|
106927
|
+
var validateServiceBinding = (diagnostics, field, value) => {
|
|
106928
|
+
if (typeof value !== "object" || value === null) {
|
|
106929
|
+
diagnostics.errors.push(`"services" bindings should be objects, but got ${JSON.stringify(value)}`);
|
|
106930
|
+
return false;
|
|
106931
|
+
}
|
|
106932
|
+
let isValid = true;
|
|
106933
|
+
if (!isRequiredProperty(value, "binding", "string")) {
|
|
106934
|
+
diagnostics.errors.push(`"${field}" bindings should have a string "binding" field but got ${JSON.stringify(value)}.`);
|
|
106935
|
+
isValid = false;
|
|
106936
|
+
}
|
|
106937
|
+
if (!isRequiredProperty(value, "service", "string")) {
|
|
106938
|
+
diagnostics.errors.push(`"${field}" bindings should have a string "service" field but got ${JSON.stringify(value)}.`);
|
|
106939
|
+
isValid = false;
|
|
106940
|
+
}
|
|
106941
|
+
if (!isOptionalProperty(value, "environment", "string")) {
|
|
106942
|
+
diagnostics.errors.push(`"${field}" bindings should have a string "environment" field but got ${JSON.stringify(value)}.`);
|
|
106943
|
+
isValid = false;
|
|
106944
|
+
}
|
|
106945
|
+
return isValid;
|
|
106946
|
+
};
|
|
106905
106947
|
|
|
106906
106948
|
// src/config/index.ts
|
|
106907
106949
|
function readConfig(configPath, args) {
|
|
@@ -106958,6 +107000,13 @@ function createWorkerUploadForm(worker) {
|
|
|
106958
107000
|
} = worker;
|
|
106959
107001
|
let { modules } = worker;
|
|
106960
107002
|
const metadataBindings = [];
|
|
107003
|
+
Object.entries(bindings.vars || {})?.forEach(([key2, value]) => {
|
|
107004
|
+
if (typeof value === "string") {
|
|
107005
|
+
metadataBindings.push({ name: key2, type: "plain_text", text: value });
|
|
107006
|
+
} else {
|
|
107007
|
+
metadataBindings.push({ name: key2, type: "json", json: value });
|
|
107008
|
+
}
|
|
107009
|
+
});
|
|
106961
107010
|
bindings.kv_namespaces?.forEach(({ id, binding }) => {
|
|
106962
107011
|
metadataBindings.push({
|
|
106963
107012
|
name: binding,
|
|
@@ -106965,12 +107014,13 @@ function createWorkerUploadForm(worker) {
|
|
|
106965
107014
|
namespace_id: id
|
|
106966
107015
|
});
|
|
106967
107016
|
});
|
|
106968
|
-
bindings.durable_objects?.bindings.forEach(({ name: name2, class_name, script_name }) => {
|
|
107017
|
+
bindings.durable_objects?.bindings.forEach(({ name: name2, class_name, script_name, environment }) => {
|
|
106969
107018
|
metadataBindings.push({
|
|
106970
107019
|
name: name2,
|
|
106971
107020
|
type: "durable_object_namespace",
|
|
106972
107021
|
class_name,
|
|
106973
|
-
...script_name && { script_name }
|
|
107022
|
+
...script_name && { script_name },
|
|
107023
|
+
...environment && { environment }
|
|
106974
107024
|
});
|
|
106975
107025
|
});
|
|
106976
107026
|
bindings.r2_buckets?.forEach(({ binding, bucket_name }) => {
|
|
@@ -106980,12 +107030,13 @@ function createWorkerUploadForm(worker) {
|
|
|
106980
107030
|
bucket_name
|
|
106981
107031
|
});
|
|
106982
107032
|
});
|
|
106983
|
-
|
|
106984
|
-
|
|
106985
|
-
|
|
106986
|
-
|
|
106987
|
-
|
|
106988
|
-
|
|
107033
|
+
bindings.services?.forEach(({ binding, service, environment }) => {
|
|
107034
|
+
metadataBindings.push({
|
|
107035
|
+
name: binding,
|
|
107036
|
+
type: "service",
|
|
107037
|
+
service,
|
|
107038
|
+
...environment && { environment }
|
|
107039
|
+
});
|
|
106989
107040
|
});
|
|
106990
107041
|
for (const [name2, filePath] of Object.entries(bindings.wasm_modules || {})) {
|
|
106991
107042
|
metadataBindings.push({
|
|
@@ -108264,6 +108315,9 @@ function useLocalWorker({
|
|
|
108264
108315
|
if (publicDirectory) {
|
|
108265
108316
|
throw new Error('\u2394 A "public" folder is not yet supported in local mode.');
|
|
108266
108317
|
}
|
|
108318
|
+
if (bindings.services && bindings.services.length > 0) {
|
|
108319
|
+
throw new Error("\u2394 Service bindings are not yet supported in local mode.");
|
|
108320
|
+
}
|
|
108267
108321
|
for (const module2 of bundle.modules) {
|
|
108268
108322
|
await (0, import_promises2.writeFile)(import_node_path12.default.join(import_node_path12.default.dirname(bundle.path), module2.name), module2.content);
|
|
108269
108323
|
}
|
|
@@ -108392,6 +108446,7 @@ function useLocalWorker({
|
|
|
108392
108446
|
bindings.durable_objects?.bindings,
|
|
108393
108447
|
bindings.kv_namespaces,
|
|
108394
108448
|
bindings.vars,
|
|
108449
|
+
bindings.services,
|
|
108395
108450
|
compatibilityDate,
|
|
108396
108451
|
compatibilityFlags,
|
|
108397
108452
|
localPersistencePath,
|
|
@@ -108408,7 +108463,7 @@ function useLocalWorker({
|
|
|
108408
108463
|
|
|
108409
108464
|
// src/dev/remote.tsx
|
|
108410
108465
|
init_import_meta_url();
|
|
108411
|
-
var
|
|
108466
|
+
var import_node_assert5 = __toESM(require("node:assert"));
|
|
108412
108467
|
var import_promises4 = require("node:fs/promises");
|
|
108413
108468
|
var import_node_path13 = __toESM(require("node:path"));
|
|
108414
108469
|
var import_react5 = __toESM(require_react());
|
|
@@ -108476,6 +108531,7 @@ async function createWorkerPreview(init, account, ctx, abortSignal) {
|
|
|
108476
108531
|
|
|
108477
108532
|
// src/sites.tsx
|
|
108478
108533
|
init_import_meta_url();
|
|
108534
|
+
var import_node_assert4 = __toESM(require("node:assert"));
|
|
108479
108535
|
var import_promises3 = require("node:fs/promises");
|
|
108480
108536
|
var path13 = __toESM(require("node:path"));
|
|
108481
108537
|
var import_ignore = __toESM(require_ignore());
|
|
@@ -108584,8 +108640,7 @@ var KeyValueKeys = /* @__PURE__ */ new Set([
|
|
|
108584
108640
|
"base64"
|
|
108585
108641
|
]);
|
|
108586
108642
|
function isKVKeyValue(keyValue) {
|
|
108587
|
-
|
|
108588
|
-
if (!props.includes("key") || !props.includes("value")) {
|
|
108643
|
+
if (typeof keyValue !== "object" || typeof keyValue.key !== "string" || typeof keyValue.value !== "string" || !(keyValue.expiration === void 0 || typeof keyValue.expiration === "number") || !(keyValue.expiration_ttl === void 0 || typeof keyValue.expiration_ttl === "number") || !(keyValue.base64 === void 0 || typeof keyValue.base64 === "boolean") || !(keyValue.metadata === void 0 || typeof keyValue.metadata === "object")) {
|
|
108589
108644
|
return false;
|
|
108590
108645
|
}
|
|
108591
108646
|
return true;
|
|
@@ -108740,6 +108795,7 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
|
108740
108795
|
logger.log("(Note: doing a dry run, not uploading or deleting anything.)");
|
|
108741
108796
|
return { manifest: void 0, namespace: void 0 };
|
|
108742
108797
|
}
|
|
108798
|
+
(0, import_node_assert4.default)(accountId, "Missing accountId");
|
|
108743
108799
|
const title = `__${scriptName}-workers_sites_assets${preview ? "_preview" : ""}`;
|
|
108744
108800
|
const { id: namespace } = await createKVNamespaceIfNotAlreadyExisting(title, accountId);
|
|
108745
108801
|
const namespaceKeysResponse = await listKVNamespaceKeys(accountId, namespace);
|
|
@@ -108822,8 +108878,8 @@ function getAssetPaths(config, assetDirectory = config.site?.bucket, includePatt
|
|
|
108822
108878
|
|
|
108823
108879
|
// src/dev/remote.tsx
|
|
108824
108880
|
function Remote(props) {
|
|
108825
|
-
(0,
|
|
108826
|
-
(0,
|
|
108881
|
+
(0, import_node_assert5.default)(props.accountId, "accountId is required");
|
|
108882
|
+
(0, import_node_assert5.default)(props.apiToken, "apiToken is required");
|
|
108827
108883
|
const previewToken = useWorker({
|
|
108828
108884
|
name: props.name,
|
|
108829
108885
|
bundle: props.bundle,
|
|
@@ -108947,18 +109003,30 @@ function useWorker(props) {
|
|
|
108947
109003
|
|
|
108948
109004
|
// src/dev/use-esbuild.ts
|
|
108949
109005
|
init_import_meta_url();
|
|
108950
|
-
var
|
|
109006
|
+
var import_node_assert7 = __toESM(require("node:assert"));
|
|
108951
109007
|
var import_ink2 = __toESM(require_build2());
|
|
108952
109008
|
var import_react6 = __toESM(require_react());
|
|
108953
109009
|
|
|
108954
109010
|
// src/bundle.ts
|
|
108955
109011
|
init_import_meta_url();
|
|
108956
|
-
var
|
|
109012
|
+
var import_node_assert6 = __toESM(require("node:assert"));
|
|
108957
109013
|
var fs4 = __toESM(require("node:fs"));
|
|
109014
|
+
var import_node_module = require("node:module");
|
|
108958
109015
|
var path15 = __toESM(require("node:path"));
|
|
108959
109016
|
var import_node_globals_polyfill = __toESM(require("@esbuild-plugins/node-globals-polyfill"));
|
|
108960
109017
|
var import_node_modules_polyfill = __toESM(require("@esbuild-plugins/node-modules-polyfill"));
|
|
108961
109018
|
var esbuild2 = __toESM(require("esbuild"));
|
|
109019
|
+
var checkForNodeBuiltinsPlugin = {
|
|
109020
|
+
name: "checkForNodeBuiltins",
|
|
109021
|
+
setup(build6) {
|
|
109022
|
+
build6.onResolve({
|
|
109023
|
+
filter: new RegExp("^(" + import_node_module.builtinModules.join("|") + "|" + import_node_module.builtinModules.map((module2) => "node:" + module2).join("|") + ")$")
|
|
109024
|
+
}, () => {
|
|
109025
|
+
throw new Error(`Detected a Node builtin module import while Node compatibility is disabled.
|
|
109026
|
+
Add node_compat = true to your wrangler.toml file to enable Node compatibility.`);
|
|
109027
|
+
});
|
|
109028
|
+
}
|
|
109029
|
+
};
|
|
108962
109030
|
async function bundleWorker(entry, destination, options) {
|
|
108963
109031
|
const {
|
|
108964
109032
|
serveAssetsFromWorker,
|
|
@@ -109004,7 +109072,7 @@ async function bundleWorker(entry, destination, options) {
|
|
|
109004
109072
|
},
|
|
109005
109073
|
plugins: [
|
|
109006
109074
|
moduleCollector.plugin,
|
|
109007
|
-
...nodeCompat ? [(0, import_node_globals_polyfill.default)({ buffer: true }), (0, import_node_modules_polyfill.default)()] : []
|
|
109075
|
+
...nodeCompat ? [(0, import_node_globals_polyfill.default)({ buffer: true }), (0, import_node_modules_polyfill.default)()] : [checkForNodeBuiltinsPlugin]
|
|
109008
109076
|
],
|
|
109009
109077
|
...jsxFactory && { jsxFactory },
|
|
109010
109078
|
...jsxFragment && { jsxFragment },
|
|
@@ -109012,8 +109080,8 @@ async function bundleWorker(entry, destination, options) {
|
|
|
109012
109080
|
watch: watch3
|
|
109013
109081
|
});
|
|
109014
109082
|
const entryPointOutputs = Object.entries(result.metafile.outputs).filter(([_path, output]) => output.entryPoint !== void 0);
|
|
109015
|
-
(0,
|
|
109016
|
-
(0,
|
|
109083
|
+
(0, import_node_assert6.default)(entryPointOutputs.length > 0, `Cannot find entry-point "${entry.file}" in generated bundle.` + listEntryPoints2(entryPointOutputs));
|
|
109084
|
+
(0, import_node_assert6.default)(entryPointOutputs.length < 2, "More than one entry-point found for generated bundle." + listEntryPoints2(entryPointOutputs));
|
|
109017
109085
|
const entryPointExports = entryPointOutputs[0][1].exports;
|
|
109018
109086
|
const bundleType = entryPointExports.length > 0 ? "esm" : "commonjs";
|
|
109019
109087
|
return {
|
|
@@ -109064,7 +109132,7 @@ function useEsbuild({
|
|
|
109064
109132
|
logger.error("Watch build failed:", error);
|
|
109065
109133
|
else {
|
|
109066
109134
|
setBundle((previousBundle) => {
|
|
109067
|
-
(0,
|
|
109135
|
+
(0, import_node_assert7.default)(previousBundle, "Rebuild triggered with no previous build available");
|
|
109068
109136
|
return { ...previousBundle, id: previousBundle.id + 1 };
|
|
109069
109137
|
});
|
|
109070
109138
|
}
|
|
@@ -109890,9 +109958,9 @@ async function generateConfigFromFileTree({
|
|
|
109890
109958
|
for (const exportName of exportNames) {
|
|
109891
109959
|
const [match, method = ""] = exportName.match(/^onRequest(Get|Post|Put|Patch|Delete|Options|Head)?$/) ?? [];
|
|
109892
109960
|
if (match) {
|
|
109893
|
-
const
|
|
109894
|
-
const isIndexFile =
|
|
109895
|
-
const isMiddlewareFile =
|
|
109961
|
+
const basename5 = import_node_path17.default.basename(filepath).slice(0, -ext.length);
|
|
109962
|
+
const isIndexFile = basename5 === "index";
|
|
109963
|
+
const isMiddlewareFile = basename5 === "_middleware" || basename5 === "_middleware_";
|
|
109896
109964
|
let routePath = import_node_path17.default.relative(baseDir, filepath).slice(0, -ext.length);
|
|
109897
109965
|
let mountPath = import_node_path17.default.dirname(routePath);
|
|
109898
109966
|
if (isIndexFile || isMiddlewareFile) {
|
|
@@ -110807,7 +110875,7 @@ To silense this warning, pass in --commit-dirty=true`);
|
|
|
110807
110875
|
}
|
|
110808
110876
|
const fileContent = await (0, import_promises9.readFile)(filepath);
|
|
110809
110877
|
const base64Content = fileContent.toString("base64");
|
|
110810
|
-
const extension =
|
|
110878
|
+
const extension = (0, import_node_path19.extname)((0, import_node_path19.basename)(name2)).substring(1);
|
|
110811
110879
|
const content = base64Content + extension;
|
|
110812
110880
|
if (filestat.size > 25 * 1024 * 1024) {
|
|
110813
110881
|
throw new Error(`Error: Pages only supports files up to ${prettyBytes(25 * 1024 * 1024)} in size
|
|
@@ -110912,7 +110980,7 @@ Try a smaller project perhaps?`);
|
|
|
110912
110980
|
}
|
|
110913
110981
|
};
|
|
110914
110982
|
var pages = (yargs) => {
|
|
110915
|
-
return yargs.command("dev [directory] [-- command]", "\u{1F9D1}\u200D\u{1F4BB} Develop your full-stack Pages application locally", (yargs2) => {
|
|
110983
|
+
return yargs.command("dev [directory] [-- command..]", "\u{1F9D1}\u200D\u{1F4BB} Develop your full-stack Pages application locally", (yargs2) => {
|
|
110916
110984
|
return yargs2.positional("directory", {
|
|
110917
110985
|
type: "string",
|
|
110918
110986
|
demandOption: void 0,
|
|
@@ -111341,7 +111409,7 @@ function Progress({ done, total }) {
|
|
|
111341
111409
|
|
|
111342
111410
|
// src/publish.ts
|
|
111343
111411
|
init_import_meta_url();
|
|
111344
|
-
var
|
|
111412
|
+
var import_node_assert8 = __toESM(require("node:assert"));
|
|
111345
111413
|
var import_node_fs8 = require("node:fs");
|
|
111346
111414
|
var import_node_path20 = __toESM(require("node:path"));
|
|
111347
111415
|
var import_node_url12 = require("node:url");
|
|
@@ -111349,11 +111417,129 @@ var import_tmp_promise2 = __toESM(require_tmp_promise());
|
|
|
111349
111417
|
function sleep3(ms) {
|
|
111350
111418
|
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
111351
111419
|
}
|
|
111420
|
+
function renderRoute(route) {
|
|
111421
|
+
let result = "";
|
|
111422
|
+
if (typeof route === "string") {
|
|
111423
|
+
result = route;
|
|
111424
|
+
} else {
|
|
111425
|
+
result = route.pattern;
|
|
111426
|
+
const isCustomDomain = Boolean("custom_domain" in route && route.custom_domain);
|
|
111427
|
+
if (isCustomDomain && "zone_id" in route) {
|
|
111428
|
+
result += ` (custom domain - zone id: ${route.zone_id})`;
|
|
111429
|
+
} else if (isCustomDomain && "zone_name" in route) {
|
|
111430
|
+
result += ` (custom domain - zone name: ${route.zone_name})`;
|
|
111431
|
+
} else if (isCustomDomain) {
|
|
111432
|
+
result += ` (custom domain)`;
|
|
111433
|
+
} else if ("zone_id" in route) {
|
|
111434
|
+
result += ` (zone id: ${route.zone_id})`;
|
|
111435
|
+
} else if ("zone_name" in route) {
|
|
111436
|
+
result += ` (zone name: ${route.zone_name})`;
|
|
111437
|
+
}
|
|
111438
|
+
}
|
|
111439
|
+
return result;
|
|
111440
|
+
}
|
|
111441
|
+
function getQuoteBoundedSubstring(content) {
|
|
111442
|
+
const matches = content.split('"');
|
|
111443
|
+
return matches[1] ?? "";
|
|
111444
|
+
}
|
|
111445
|
+
function isOriginConflictError(e2) {
|
|
111446
|
+
return typeof e2 === "object" && e2 !== null && e2.code === 100116;
|
|
111447
|
+
}
|
|
111448
|
+
function isDNSConflictError(e2) {
|
|
111449
|
+
return typeof e2 === "object" && e2 !== null && e2.code === 100117;
|
|
111450
|
+
}
|
|
111451
|
+
var CustomDomainOverrideRejected = class extends Error {
|
|
111452
|
+
};
|
|
111453
|
+
function publishCustomDomains(workerUrl, domains) {
|
|
111454
|
+
const config = {
|
|
111455
|
+
override_scope: true,
|
|
111456
|
+
override_existing_origin: false,
|
|
111457
|
+
override_existing_dns_record: false
|
|
111458
|
+
};
|
|
111459
|
+
const origins = domains.map((domainRoute) => {
|
|
111460
|
+
return {
|
|
111461
|
+
hostname: domainRoute.pattern,
|
|
111462
|
+
zone_id: "zone_id" in domainRoute ? domainRoute.zone_id : void 0,
|
|
111463
|
+
zone_name: "zone_name" in domainRoute ? domainRoute.zone_name : void 0
|
|
111464
|
+
};
|
|
111465
|
+
});
|
|
111466
|
+
if (!process.stdout.isTTY) {
|
|
111467
|
+
config.override_existing_origin = true;
|
|
111468
|
+
config.override_existing_dns_record = true;
|
|
111469
|
+
}
|
|
111470
|
+
return fetchResult(`${workerUrl}/domains`, {
|
|
111471
|
+
method: "PUT",
|
|
111472
|
+
body: JSON.stringify({ ...config, origins }),
|
|
111473
|
+
headers: {
|
|
111474
|
+
"Content-Type": "application/json"
|
|
111475
|
+
}
|
|
111476
|
+
}).catch(async (err2) => {
|
|
111477
|
+
if (isOriginConflictError(err2)) {
|
|
111478
|
+
const conflictingOrigins = getQuoteBoundedSubstring(err2.notes[0].text);
|
|
111479
|
+
const shouldContinue = await confirm(`Custom Domains already exist for these domains: "${conflictingOrigins}"
|
|
111480
|
+
Update them to point to this script instead?`);
|
|
111481
|
+
if (!shouldContinue) {
|
|
111482
|
+
throw new CustomDomainOverrideRejected();
|
|
111483
|
+
}
|
|
111484
|
+
config.override_existing_origin = true;
|
|
111485
|
+
await fetchResult(`${workerUrl}/domains`, {
|
|
111486
|
+
method: "PUT",
|
|
111487
|
+
body: JSON.stringify({ ...config, origins }),
|
|
111488
|
+
headers: {
|
|
111489
|
+
"Content-Type": "application/json"
|
|
111490
|
+
}
|
|
111491
|
+
});
|
|
111492
|
+
} else {
|
|
111493
|
+
throw err2;
|
|
111494
|
+
}
|
|
111495
|
+
}).catch(async (err2) => {
|
|
111496
|
+
if (isDNSConflictError(err2)) {
|
|
111497
|
+
const conflictingOrigins = getQuoteBoundedSubstring(err2.notes[0].text);
|
|
111498
|
+
const shouldContinue = await confirm(`You already have conflicting DNS records for these domains: "${conflictingOrigins}"
|
|
111499
|
+
Update them to point to this script instead?`);
|
|
111500
|
+
if (!shouldContinue) {
|
|
111501
|
+
throw new CustomDomainOverrideRejected();
|
|
111502
|
+
}
|
|
111503
|
+
config.override_existing_dns_record = true;
|
|
111504
|
+
await fetchResult(`${workerUrl}/domains`, {
|
|
111505
|
+
method: "PUT",
|
|
111506
|
+
body: JSON.stringify({ ...config, origins }),
|
|
111507
|
+
headers: {
|
|
111508
|
+
"Content-Type": "application/json"
|
|
111509
|
+
}
|
|
111510
|
+
});
|
|
111511
|
+
} else {
|
|
111512
|
+
throw err2;
|
|
111513
|
+
}
|
|
111514
|
+
}).then(() => domains.map((domain) => renderRoute(domain))).catch((err2) => {
|
|
111515
|
+
if (err2 instanceof CustomDomainOverrideRejected) {
|
|
111516
|
+
return [
|
|
111517
|
+
domains.length > 1 ? `Publishing to ${domains.length} Custom Domains was skipped, fix conflicts and try again` : `Publishing to Custom Domain "${domains[0].pattern}" was skipped, fix conflict and try again`
|
|
111518
|
+
];
|
|
111519
|
+
}
|
|
111520
|
+
throw err2;
|
|
111521
|
+
});
|
|
111522
|
+
}
|
|
111352
111523
|
async function publish(props) {
|
|
111353
111524
|
const { config, accountId } = props;
|
|
111354
|
-
(0,
|
|
111525
|
+
(0, import_node_assert8.default)(props.compatibilityDate || config.compatibility_date, "A compatibility_date is required when publishing. Add one to your wrangler.toml file, or pass it in your terminal as --compatibility-date. See https://developers.cloudflare.com/workers/platform/compatibility-dates for more information.");
|
|
111355
111526
|
const triggers = props.triggers || config.triggers?.crons;
|
|
111356
111527
|
const routes = props.routes ?? config.routes ?? (config.route ? [config.route] : []) ?? [];
|
|
111528
|
+
const routesOnly = [];
|
|
111529
|
+
const customDomainsOnly = [];
|
|
111530
|
+
for (const route of routes) {
|
|
111531
|
+
if (typeof route !== "string" && route.custom_domain) {
|
|
111532
|
+
if (route.pattern.includes("*")) {
|
|
111533
|
+
throw new Error(`Cannot use "${route.pattern}" as a Custom Domain; wildcard operators (*) are not allowed`);
|
|
111534
|
+
}
|
|
111535
|
+
if (route.pattern.includes("/")) {
|
|
111536
|
+
throw new Error(`Cannot use "${route.pattern}" as a Custom Domain; paths are not allowed`);
|
|
111537
|
+
}
|
|
111538
|
+
customDomainsOnly.push(route);
|
|
111539
|
+
} else {
|
|
111540
|
+
routesOnly.push(route);
|
|
111541
|
+
}
|
|
111542
|
+
}
|
|
111357
111543
|
const deployToWorkersDev = config.workers_dev ?? routes.length === 0;
|
|
111358
111544
|
const jsxFactory = props.jsxFactory || config.jsx_factory;
|
|
111359
111545
|
const jsxFragment = props.jsxFragment || config.jsx_fragment;
|
|
@@ -111363,8 +111549,8 @@ async function publish(props) {
|
|
|
111363
111549
|
logger.warn("Enabling node.js compatibility mode for builtins and globals. This is experimental and has serious tradeoffs. Please see https://github.com/ionic-team/rollup-plugin-node-polyfills/ for more details.");
|
|
111364
111550
|
}
|
|
111365
111551
|
const scriptName = props.name;
|
|
111366
|
-
(0,
|
|
111367
|
-
(0,
|
|
111552
|
+
(0, import_node_assert8.default)(scriptName, 'You need to provide a name when publishing a worker. Either pass it as a cli arg with `--name <name>` or in your config file as `name = "<name>"`');
|
|
111553
|
+
(0, import_node_assert8.default)(!config.site || config.site.bucket, "A [site] definition requires a `bucket` field with a path to the site's public directory.");
|
|
111368
111554
|
if (props.outDir) {
|
|
111369
111555
|
(0, import_node_fs8.mkdirSync)(props.outDir, { recursive: true });
|
|
111370
111556
|
const readmePath = import_node_path20.default.join(props.outDir, "README.md");
|
|
@@ -111410,7 +111596,7 @@ async function publish(props) {
|
|
|
111410
111596
|
encoding: "utf-8"
|
|
111411
111597
|
});
|
|
111412
111598
|
let migrations;
|
|
111413
|
-
if (config.migrations.length > 0) {
|
|
111599
|
+
if (!props.dryRun && config.migrations.length > 0) {
|
|
111414
111600
|
let script;
|
|
111415
111601
|
if (!props.legacyEnv) {
|
|
111416
111602
|
try {
|
|
@@ -111473,6 +111659,7 @@ async function publish(props) {
|
|
|
111473
111659
|
data_blobs: config.data_blobs,
|
|
111474
111660
|
durable_objects: config.durable_objects,
|
|
111475
111661
|
r2_buckets: config.r2_buckets,
|
|
111662
|
+
services: config.services,
|
|
111476
111663
|
unsafe: config.unsafe?.bindings
|
|
111477
111664
|
};
|
|
111478
111665
|
if (assets.manifest) {
|
|
@@ -111511,6 +111698,7 @@ async function publish(props) {
|
|
|
111511
111698
|
logger.log(`--dry-run: exiting now.`);
|
|
111512
111699
|
return;
|
|
111513
111700
|
}
|
|
111701
|
+
(0, import_node_assert8.default)(accountId, "Missing accountId");
|
|
111514
111702
|
const uploadMs = Date.now() - start;
|
|
111515
111703
|
const deployments = [];
|
|
111516
111704
|
if (deployToWorkersDev) {
|
|
@@ -111542,20 +111730,23 @@ async function publish(props) {
|
|
|
111542
111730
|
}
|
|
111543
111731
|
}
|
|
111544
111732
|
logger.log("Uploaded", workerName, formatTime2(uploadMs));
|
|
111545
|
-
if (
|
|
111733
|
+
if (routesOnly.length > 0) {
|
|
111546
111734
|
deployments.push(fetchResult(`${workerUrl}/routes`, {
|
|
111547
111735
|
method: "PUT",
|
|
111548
|
-
body: JSON.stringify(
|
|
111736
|
+
body: JSON.stringify(routesOnly.map((route) => typeof route !== "object" ? { pattern: route } : route)),
|
|
111549
111737
|
headers: {
|
|
111550
111738
|
"Content-Type": "application/json"
|
|
111551
111739
|
}
|
|
111552
111740
|
}).then(() => {
|
|
111553
|
-
if (
|
|
111554
|
-
return
|
|
111741
|
+
if (routesOnly.length > 10) {
|
|
111742
|
+
return routesOnly.slice(0, 9).map((route) => renderRoute(route)).concat([`...and ${routesOnly.length - 10} more routes`]);
|
|
111555
111743
|
}
|
|
111556
|
-
return
|
|
111744
|
+
return routesOnly.map((route) => renderRoute(route));
|
|
111557
111745
|
}));
|
|
111558
111746
|
}
|
|
111747
|
+
if (customDomainsOnly.length > 0) {
|
|
111748
|
+
deployments.push(publishCustomDomains(workerUrl, customDomainsOnly));
|
|
111749
|
+
}
|
|
111559
111750
|
if (triggers && triggers.length) {
|
|
111560
111751
|
deployments.push(fetchResult(`${workerUrl}/schedules`, {
|
|
111561
111752
|
method: "PUT",
|
|
@@ -111908,9 +112099,12 @@ function demandOneOfOption(...options) {
|
|
|
111908
112099
|
return true;
|
|
111909
112100
|
};
|
|
111910
112101
|
}
|
|
112102
|
+
function trimTrailingWhitespace(str) {
|
|
112103
|
+
return str.trimEnd();
|
|
112104
|
+
}
|
|
111911
112105
|
var CommandLineArgsError = class extends Error {
|
|
111912
112106
|
};
|
|
111913
|
-
|
|
112107
|
+
function createCLIParser(argv) {
|
|
111914
112108
|
const wrangler = yargs_default(argv).strict().showHelpOnFail(false).fail((msg, error) => {
|
|
111915
112109
|
if (!error || error.name === "YError") {
|
|
111916
112110
|
error = new CommandLineArgsError(msg);
|
|
@@ -112023,11 +112217,7 @@ ${err2.message ?? err2}`);
|
|
|
112023
112217
|
try {
|
|
112024
112218
|
isGitInstalled = (await execa("git", ["--version"])).exitCode === 0;
|
|
112025
112219
|
} catch (err2) {
|
|
112026
|
-
|
|
112027
|
-
throw err2;
|
|
112028
|
-
} else {
|
|
112029
|
-
isGitInstalled = false;
|
|
112030
|
-
}
|
|
112220
|
+
isGitInstalled = false;
|
|
112031
112221
|
}
|
|
112032
112222
|
if (!isInsideGitProject && isGitInstalled) {
|
|
112033
112223
|
const shouldInitGit = yesFlag || await confirm("Would you like to use git to manage this Worker?");
|
|
@@ -112274,6 +112464,9 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
112274
112464
|
const configPath = args.config || args.script && findWranglerToml(import_node_path21.default.dirname(args.script));
|
|
112275
112465
|
const config = readConfig(configPath, args);
|
|
112276
112466
|
const entry = await getEntry(args, config, "dev");
|
|
112467
|
+
if (config.services && config.services.length > 0) {
|
|
112468
|
+
logger.warn(`This worker is bound to live services: ${config.services.map((service) => `${service.binding} (${service.service}${service.environment ? `@${service.environment}` : ""})`).join(", ")}`);
|
|
112469
|
+
}
|
|
112277
112470
|
if (args.inspect) {
|
|
112278
112471
|
logger.warn("Passing --inspect is unnecessary, now you can always connect to devtools.");
|
|
112279
112472
|
}
|
|
@@ -112289,6 +112482,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
112289
112482
|
}
|
|
112290
112483
|
const accountId = !args.local ? await requireAuth(config) : void 0;
|
|
112291
112484
|
function getHost(urlLike) {
|
|
112485
|
+
urlLike = urlLike.replace(/^\*(\.)?/g, "");
|
|
112292
112486
|
if (!(urlLike.startsWith("http://") || urlLike.startsWith("https://"))) {
|
|
112293
112487
|
urlLike = "http://" + urlLike;
|
|
112294
112488
|
}
|
|
@@ -112370,6 +112564,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
112370
112564
|
bucket_name: preview_bucket_name
|
|
112371
112565
|
};
|
|
112372
112566
|
}),
|
|
112567
|
+
services: config.services,
|
|
112373
112568
|
unsafe: config.unsafe?.bindings
|
|
112374
112569
|
},
|
|
112375
112570
|
crons: config.triggers.crons
|
|
@@ -112482,7 +112677,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
112482
112677
|
if (args.latest) {
|
|
112483
112678
|
logger.warn("Using the latest version of the Workers runtime. To silence this warning, please choose a specific version of the runtime with --compatibility-date, or add a compatibility_date to your wrangler.toml.\n");
|
|
112484
112679
|
}
|
|
112485
|
-
const accountId = await requireAuth(config);
|
|
112680
|
+
const accountId = args.dryRun ? void 0 : await requireAuth(config);
|
|
112486
112681
|
const assetPaths = getAssetPaths(config, args["experimental-public"] || args.site, args.siteInclude, args.siteExclude);
|
|
112487
112682
|
await publish({
|
|
112488
112683
|
config,
|
|
@@ -112678,6 +112873,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
112678
112873
|
bucket_name: preview_bucket_name
|
|
112679
112874
|
};
|
|
112680
112875
|
}),
|
|
112876
|
+
services: config.services,
|
|
112681
112877
|
unsafe: config.unsafe?.bindings
|
|
112682
112878
|
},
|
|
112683
112879
|
crons: config.triggers.crons,
|
|
@@ -112764,7 +112960,7 @@ ${shouldDo}`);
|
|
|
112764
112960
|
}
|
|
112765
112961
|
const accountId = await requireAuth(config);
|
|
112766
112962
|
const isInteractive = process.stdin.isTTY;
|
|
112767
|
-
const secretValue = isInteractive ? await prompt("Enter a secret value:", "password") : await readFromStdin();
|
|
112963
|
+
const secretValue = trimTrailingWhitespace(isInteractive ? await prompt("Enter a secret value:", "password") : await readFromStdin());
|
|
112768
112964
|
logger.log(`\u{1F300} Creating the secret for script ${scriptName} ${args.env && !isLegacyEnv(config) ? `(${args.env})` : ""}`);
|
|
112769
112965
|
async function submitSecret() {
|
|
112770
112966
|
const url3 = !args.env || isLegacyEnv(config) ? `/accounts/${accountId}/workers/scripts/${scriptName}/secrets` : `/accounts/${accountId}/workers/services/${scriptName}/environments/${args.env}/secrets`;
|
|
@@ -112793,6 +112989,7 @@ ${shouldDo}`);
|
|
|
112793
112989
|
vars: {},
|
|
112794
112990
|
durable_objects: { bindings: [] },
|
|
112795
112991
|
r2_buckets: [],
|
|
112992
|
+
services: [],
|
|
112796
112993
|
wasm_modules: {},
|
|
112797
112994
|
text_blobs: {},
|
|
112798
112995
|
data_blobs: {},
|
|
@@ -113121,9 +113318,7 @@ Expected an array of key-value objects but got type "${typeof content}".`);
|
|
|
113121
113318
|
const warnings = [];
|
|
113122
113319
|
for (let i2 = 0; i2 < content.length; i2++) {
|
|
113123
113320
|
const keyValue = content[i2];
|
|
113124
|
-
if (
|
|
113125
|
-
errors.push(`The item at index ${i2} is type: "${typeof keyValue}" - ${JSON.stringify(keyValue)}`);
|
|
113126
|
-
} else if (!isKVKeyValue(keyValue)) {
|
|
113321
|
+
if (!isKVKeyValue(keyValue)) {
|
|
113127
113322
|
errors.push(`The item at index ${i2} is ${JSON.stringify(keyValue)}`);
|
|
113128
113323
|
} else {
|
|
113129
113324
|
const props = unexpectedKVKeyValueProps(keyValue);
|
|
@@ -113307,14 +113502,17 @@ Expected an array of strings.
|
|
|
113307
113502
|
wrangler.help().alias("h", "help");
|
|
113308
113503
|
wrangler.version(version).alias("v", "version");
|
|
113309
113504
|
wrangler.exitProcess(false);
|
|
113505
|
+
return wrangler;
|
|
113506
|
+
}
|
|
113507
|
+
async function main(argv) {
|
|
113508
|
+
const wrangler = createCLIParser(argv);
|
|
113310
113509
|
try {
|
|
113311
113510
|
await wrangler.parse();
|
|
113312
113511
|
} catch (e2) {
|
|
113313
113512
|
logger.log("");
|
|
113314
113513
|
if (e2 instanceof CommandLineArgsError) {
|
|
113315
|
-
wrangler.showHelp("error");
|
|
113316
|
-
logger.log("");
|
|
113317
113514
|
logger.error(e2.message);
|
|
113515
|
+
await createCLIParser([...argv, "--help"]).parse();
|
|
113318
113516
|
} else if (e2 instanceof ParseError) {
|
|
113319
113517
|
e2.notes.push({
|
|
113320
113518
|
text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/wrangler2/issues/new"
|