wrangler 3.2.0 → 3.4.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 +3 -3
- package/templates/middleware/loader-modules.ts +4 -1
- package/wrangler-dist/cli.d.ts +59 -53
- package/wrangler-dist/cli.js +930 -571
package/wrangler-dist/cli.js
CHANGED
|
@@ -5018,8 +5018,8 @@ var require_util2 = __commonJS({
|
|
|
5018
5018
|
function createDeferredPromise() {
|
|
5019
5019
|
let res;
|
|
5020
5020
|
let rej;
|
|
5021
|
-
const promise = new Promise((
|
|
5022
|
-
res =
|
|
5021
|
+
const promise = new Promise((resolve18, reject) => {
|
|
5022
|
+
res = resolve18;
|
|
5023
5023
|
rej = reject;
|
|
5024
5024
|
});
|
|
5025
5025
|
return { promise, resolve: res, reject: rej };
|
|
@@ -6475,8 +6475,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6475
6475
|
});
|
|
6476
6476
|
}
|
|
6477
6477
|
});
|
|
6478
|
-
const busboyResolve = new Promise((
|
|
6479
|
-
busboy.on("finish",
|
|
6478
|
+
const busboyResolve = new Promise((resolve18, reject) => {
|
|
6479
|
+
busboy.on("finish", resolve18);
|
|
6480
6480
|
busboy.on("error", (err) => reject(new TypeError(err)));
|
|
6481
6481
|
});
|
|
6482
6482
|
if (this.body !== null)
|
|
@@ -6921,9 +6921,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6921
6921
|
}
|
|
6922
6922
|
close(callback) {
|
|
6923
6923
|
if (callback === void 0) {
|
|
6924
|
-
return new Promise((
|
|
6924
|
+
return new Promise((resolve18, reject) => {
|
|
6925
6925
|
this.close((err, data) => {
|
|
6926
|
-
return err ? reject(err) :
|
|
6926
|
+
return err ? reject(err) : resolve18(data);
|
|
6927
6927
|
});
|
|
6928
6928
|
});
|
|
6929
6929
|
}
|
|
@@ -6961,9 +6961,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6961
6961
|
err = null;
|
|
6962
6962
|
}
|
|
6963
6963
|
if (callback === void 0) {
|
|
6964
|
-
return new Promise((
|
|
6964
|
+
return new Promise((resolve18, reject) => {
|
|
6965
6965
|
this.destroy(err, (err2, data) => {
|
|
6966
|
-
return err2 ? reject(err2) :
|
|
6966
|
+
return err2 ? reject(err2) : resolve18(data);
|
|
6967
6967
|
});
|
|
6968
6968
|
});
|
|
6969
6969
|
}
|
|
@@ -7968,16 +7968,16 @@ var require_client = __commonJS({
|
|
|
7968
7968
|
return this[kNeedDrain] < 2;
|
|
7969
7969
|
}
|
|
7970
7970
|
async [kClose]() {
|
|
7971
|
-
return new Promise((
|
|
7971
|
+
return new Promise((resolve18) => {
|
|
7972
7972
|
if (!this[kSize]) {
|
|
7973
|
-
this.destroy(
|
|
7973
|
+
this.destroy(resolve18);
|
|
7974
7974
|
} else {
|
|
7975
|
-
this[kClosedResolve] =
|
|
7975
|
+
this[kClosedResolve] = resolve18;
|
|
7976
7976
|
}
|
|
7977
7977
|
});
|
|
7978
7978
|
}
|
|
7979
7979
|
async [kDestroy](err) {
|
|
7980
|
-
return new Promise((
|
|
7980
|
+
return new Promise((resolve18) => {
|
|
7981
7981
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
7982
7982
|
for (let i = 0; i < requests.length; i++) {
|
|
7983
7983
|
const request = requests[i];
|
|
@@ -7988,7 +7988,7 @@ var require_client = __commonJS({
|
|
|
7988
7988
|
this[kClosedResolve]();
|
|
7989
7989
|
this[kClosedResolve] = null;
|
|
7990
7990
|
}
|
|
7991
|
-
|
|
7991
|
+
resolve18();
|
|
7992
7992
|
}, "callback");
|
|
7993
7993
|
if (!this[kSocket]) {
|
|
7994
7994
|
queueMicrotask(callback);
|
|
@@ -8530,7 +8530,7 @@ var require_client = __commonJS({
|
|
|
8530
8530
|
});
|
|
8531
8531
|
}
|
|
8532
8532
|
try {
|
|
8533
|
-
const socket = await new Promise((
|
|
8533
|
+
const socket = await new Promise((resolve18, reject) => {
|
|
8534
8534
|
client[kConnector]({
|
|
8535
8535
|
host,
|
|
8536
8536
|
hostname,
|
|
@@ -8542,7 +8542,7 @@ var require_client = __commonJS({
|
|
|
8542
8542
|
if (err) {
|
|
8543
8543
|
reject(err);
|
|
8544
8544
|
} else {
|
|
8545
|
-
|
|
8545
|
+
resolve18(socket2);
|
|
8546
8546
|
}
|
|
8547
8547
|
});
|
|
8548
8548
|
});
|
|
@@ -8925,12 +8925,12 @@ upgrade: ${upgrade}\r
|
|
|
8925
8925
|
}
|
|
8926
8926
|
}
|
|
8927
8927
|
__name(onDrain, "onDrain");
|
|
8928
|
-
const waitForDrain = /* @__PURE__ */ __name(() => new Promise((
|
|
8928
|
+
const waitForDrain = /* @__PURE__ */ __name(() => new Promise((resolve18, reject) => {
|
|
8929
8929
|
assert17(callback === null);
|
|
8930
8930
|
if (socket[kError]) {
|
|
8931
8931
|
reject(socket[kError]);
|
|
8932
8932
|
} else {
|
|
8933
|
-
callback =
|
|
8933
|
+
callback = resolve18;
|
|
8934
8934
|
}
|
|
8935
8935
|
}), "waitForDrain");
|
|
8936
8936
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -9259,8 +9259,8 @@ var require_pool_base = __commonJS({
|
|
|
9259
9259
|
if (this[kQueue].isEmpty()) {
|
|
9260
9260
|
return Promise.all(this[kClients].map((c) => c.close()));
|
|
9261
9261
|
} else {
|
|
9262
|
-
return new Promise((
|
|
9263
|
-
this[kClosedResolve] =
|
|
9262
|
+
return new Promise((resolve18) => {
|
|
9263
|
+
this[kClosedResolve] = resolve18;
|
|
9264
9264
|
});
|
|
9265
9265
|
}
|
|
9266
9266
|
}
|
|
@@ -9828,11 +9828,11 @@ var require_readable = __commonJS({
|
|
|
9828
9828
|
throw new TypeError("unusable");
|
|
9829
9829
|
}
|
|
9830
9830
|
assert17(!stream2[kConsume]);
|
|
9831
|
-
return new Promise((
|
|
9831
|
+
return new Promise((resolve18, reject) => {
|
|
9832
9832
|
stream2[kConsume] = {
|
|
9833
9833
|
type,
|
|
9834
9834
|
stream: stream2,
|
|
9835
|
-
resolve:
|
|
9835
|
+
resolve: resolve18,
|
|
9836
9836
|
reject,
|
|
9837
9837
|
length: 0,
|
|
9838
9838
|
body: []
|
|
@@ -9869,12 +9869,12 @@ var require_readable = __commonJS({
|
|
|
9869
9869
|
}
|
|
9870
9870
|
__name(consumeStart, "consumeStart");
|
|
9871
9871
|
function consumeEnd(consume2) {
|
|
9872
|
-
const { type, body, resolve:
|
|
9872
|
+
const { type, body, resolve: resolve18, stream: stream2, length } = consume2;
|
|
9873
9873
|
try {
|
|
9874
9874
|
if (type === "text") {
|
|
9875
|
-
|
|
9875
|
+
resolve18(toUSVString(Buffer.concat(body)));
|
|
9876
9876
|
} else if (type === "json") {
|
|
9877
|
-
|
|
9877
|
+
resolve18(JSON.parse(Buffer.concat(body)));
|
|
9878
9878
|
} else if (type === "arrayBuffer") {
|
|
9879
9879
|
const dst = new Uint8Array(length);
|
|
9880
9880
|
let pos = 0;
|
|
@@ -9882,12 +9882,12 @@ var require_readable = __commonJS({
|
|
|
9882
9882
|
dst.set(buf, pos);
|
|
9883
9883
|
pos += buf.byteLength;
|
|
9884
9884
|
}
|
|
9885
|
-
|
|
9885
|
+
resolve18(dst);
|
|
9886
9886
|
} else if (type === "blob") {
|
|
9887
9887
|
if (!Blob3) {
|
|
9888
9888
|
Blob3 = require("buffer").Blob;
|
|
9889
9889
|
}
|
|
9890
|
-
|
|
9890
|
+
resolve18(new Blob3(body, { type: stream2[kContentType] }));
|
|
9891
9891
|
}
|
|
9892
9892
|
consumeFinish(consume2);
|
|
9893
9893
|
} catch (err) {
|
|
@@ -10131,9 +10131,9 @@ var require_api_request = __commonJS({
|
|
|
10131
10131
|
__name(getResolveErrorBodyCallback, "getResolveErrorBodyCallback");
|
|
10132
10132
|
function request(opts, callback) {
|
|
10133
10133
|
if (callback === void 0) {
|
|
10134
|
-
return new Promise((
|
|
10134
|
+
return new Promise((resolve18, reject) => {
|
|
10135
10135
|
request.call(this, opts, (err, data) => {
|
|
10136
|
-
return err ? reject(err) :
|
|
10136
|
+
return err ? reject(err) : resolve18(data);
|
|
10137
10137
|
});
|
|
10138
10138
|
});
|
|
10139
10139
|
}
|
|
@@ -10288,9 +10288,9 @@ var require_api_stream = __commonJS({
|
|
|
10288
10288
|
__name(StreamHandler, "StreamHandler");
|
|
10289
10289
|
function stream2(opts, factory, callback) {
|
|
10290
10290
|
if (callback === void 0) {
|
|
10291
|
-
return new Promise((
|
|
10291
|
+
return new Promise((resolve18, reject) => {
|
|
10292
10292
|
stream2.call(this, opts, factory, (err, data) => {
|
|
10293
|
-
return err ? reject(err) :
|
|
10293
|
+
return err ? reject(err) : resolve18(data);
|
|
10294
10294
|
});
|
|
10295
10295
|
});
|
|
10296
10296
|
}
|
|
@@ -10579,9 +10579,9 @@ var require_api_upgrade = __commonJS({
|
|
|
10579
10579
|
__name(UpgradeHandler, "UpgradeHandler");
|
|
10580
10580
|
function upgrade(opts, callback) {
|
|
10581
10581
|
if (callback === void 0) {
|
|
10582
|
-
return new Promise((
|
|
10582
|
+
return new Promise((resolve18, reject) => {
|
|
10583
10583
|
upgrade.call(this, opts, (err, data) => {
|
|
10584
|
-
return err ? reject(err) :
|
|
10584
|
+
return err ? reject(err) : resolve18(data);
|
|
10585
10585
|
});
|
|
10586
10586
|
});
|
|
10587
10587
|
}
|
|
@@ -10670,9 +10670,9 @@ var require_api_connect = __commonJS({
|
|
|
10670
10670
|
__name(ConnectHandler, "ConnectHandler");
|
|
10671
10671
|
function connect2(opts, callback) {
|
|
10672
10672
|
if (callback === void 0) {
|
|
10673
|
-
return new Promise((
|
|
10673
|
+
return new Promise((resolve18, reject) => {
|
|
10674
10674
|
connect2.call(this, opts, (err, data) => {
|
|
10675
|
-
return err ? reject(err) :
|
|
10675
|
+
return err ? reject(err) : resolve18(data);
|
|
10676
10676
|
});
|
|
10677
10677
|
});
|
|
10678
10678
|
}
|
|
@@ -13927,7 +13927,7 @@ var require_fetch = __commonJS({
|
|
|
13927
13927
|
async function dispatch({ body }) {
|
|
13928
13928
|
const url3 = requestCurrentURL(request);
|
|
13929
13929
|
const agent = fetchParams.controller.dispatcher;
|
|
13930
|
-
return new Promise((
|
|
13930
|
+
return new Promise((resolve18, reject) => agent.dispatch(
|
|
13931
13931
|
{
|
|
13932
13932
|
path: url3.pathname + url3.search,
|
|
13933
13933
|
origin: url3.origin,
|
|
@@ -13983,7 +13983,7 @@ var require_fetch = __commonJS({
|
|
|
13983
13983
|
}
|
|
13984
13984
|
}
|
|
13985
13985
|
}
|
|
13986
|
-
|
|
13986
|
+
resolve18({
|
|
13987
13987
|
status,
|
|
13988
13988
|
statusText,
|
|
13989
13989
|
headersList: headers[kHeadersList],
|
|
@@ -14026,7 +14026,7 @@ var require_fetch = __commonJS({
|
|
|
14026
14026
|
const val = headersList[n + 1].toString("latin1");
|
|
14027
14027
|
headers.append(key, val);
|
|
14028
14028
|
}
|
|
14029
|
-
|
|
14029
|
+
resolve18({
|
|
14030
14030
|
status,
|
|
14031
14031
|
statusText: STATUS_CODES[status],
|
|
14032
14032
|
headersList: headers[kHeadersList],
|
|
@@ -45346,7 +45346,7 @@ var require_backend = __commonJS({
|
|
|
45346
45346
|
__name(bogusSelect, "bogusSelect");
|
|
45347
45347
|
;
|
|
45348
45348
|
return function(data) {
|
|
45349
|
-
return new Promise(function(
|
|
45349
|
+
return new Promise(function(resolve18, reject) {
|
|
45350
45350
|
_intercept = true;
|
|
45351
45351
|
if (typeof data === "string") {
|
|
45352
45352
|
_data = {
|
|
@@ -45365,7 +45365,7 @@ var require_backend = __commonJS({
|
|
|
45365
45365
|
try {
|
|
45366
45366
|
if (document.execCommand("copy")) {
|
|
45367
45367
|
cleanup();
|
|
45368
|
-
|
|
45368
|
+
resolve18();
|
|
45369
45369
|
} else {
|
|
45370
45370
|
if (!tryBogusSelect) {
|
|
45371
45371
|
bogusSelect();
|
|
@@ -45393,15 +45393,15 @@ var require_backend = __commonJS({
|
|
|
45393
45393
|
if (_intercept) {
|
|
45394
45394
|
_intercept = false;
|
|
45395
45395
|
e2.preventDefault();
|
|
45396
|
-
var
|
|
45396
|
+
var resolve18 = _resolve;
|
|
45397
45397
|
_resolve = null;
|
|
45398
|
-
|
|
45398
|
+
resolve18(e2.clipboardData.getData(_dataType));
|
|
45399
45399
|
}
|
|
45400
45400
|
});
|
|
45401
45401
|
return function(dataType) {
|
|
45402
|
-
return new Promise(function(
|
|
45402
|
+
return new Promise(function(resolve18, reject) {
|
|
45403
45403
|
_intercept = true;
|
|
45404
|
-
_resolve =
|
|
45404
|
+
_resolve = resolve18;
|
|
45405
45405
|
_dataType = dataType || "text/plain";
|
|
45406
45406
|
try {
|
|
45407
45407
|
if (!document.execCommand("paste")) {
|
|
@@ -45545,24 +45545,24 @@ var require_backend = __commonJS({
|
|
|
45545
45545
|
}, module3.exports ? module3.exports = c : a.Promise || (a.Promise = c);
|
|
45546
45546
|
})(this);
|
|
45547
45547
|
clipboard6.copy = function(data) {
|
|
45548
|
-
return new Promise(function(
|
|
45548
|
+
return new Promise(function(resolve18, reject) {
|
|
45549
45549
|
if (typeof data !== "string" && !("text/plain" in data)) {
|
|
45550
45550
|
throw new Error("You must provide a text/plain type.");
|
|
45551
45551
|
}
|
|
45552
45552
|
var strData = typeof data === "string" ? data : data["text/plain"];
|
|
45553
45553
|
var copySucceeded = window.clipboardData.setData("Text", strData);
|
|
45554
45554
|
if (copySucceeded) {
|
|
45555
|
-
|
|
45555
|
+
resolve18();
|
|
45556
45556
|
} else {
|
|
45557
45557
|
reject(new Error("Copying was rejected."));
|
|
45558
45558
|
}
|
|
45559
45559
|
});
|
|
45560
45560
|
};
|
|
45561
45561
|
clipboard6.paste = function() {
|
|
45562
|
-
return new Promise(function(
|
|
45562
|
+
return new Promise(function(resolve18, reject) {
|
|
45563
45563
|
var strData = window.clipboardData.getData("Text");
|
|
45564
45564
|
if (strData) {
|
|
45565
|
-
|
|
45565
|
+
resolve18(strData);
|
|
45566
45566
|
} else {
|
|
45567
45567
|
reject(new Error("Pasting was rejected."));
|
|
45568
45568
|
}
|
|
@@ -55227,8 +55227,8 @@ var require_ink = __commonJS({
|
|
|
55227
55227
|
}
|
|
55228
55228
|
waitUntilExit() {
|
|
55229
55229
|
if (!this.exitPromise) {
|
|
55230
|
-
this.exitPromise = new Promise((
|
|
55231
|
-
this.resolveExitPromise =
|
|
55230
|
+
this.exitPromise = new Promise((resolve18, reject) => {
|
|
55231
|
+
this.resolveExitPromise = resolve18;
|
|
55232
55232
|
this.rejectExitPromise = reject;
|
|
55233
55233
|
});
|
|
55234
55234
|
}
|
|
@@ -59219,20 +59219,20 @@ var require_parse_async = __commonJS({
|
|
|
59219
59219
|
const index = 0;
|
|
59220
59220
|
const blocksize = opts.blocksize || 40960;
|
|
59221
59221
|
const parser2 = new TOMLParser();
|
|
59222
|
-
return new Promise((
|
|
59223
|
-
setImmediate(parseAsyncNext, index, blocksize,
|
|
59222
|
+
return new Promise((resolve18, reject) => {
|
|
59223
|
+
setImmediate(parseAsyncNext, index, blocksize, resolve18, reject);
|
|
59224
59224
|
});
|
|
59225
|
-
function parseAsyncNext(index2, blocksize2,
|
|
59225
|
+
function parseAsyncNext(index2, blocksize2, resolve18, reject) {
|
|
59226
59226
|
if (index2 >= str.length) {
|
|
59227
59227
|
try {
|
|
59228
|
-
return
|
|
59228
|
+
return resolve18(parser2.finish());
|
|
59229
59229
|
} catch (err) {
|
|
59230
59230
|
return reject(prettyError(err, str));
|
|
59231
59231
|
}
|
|
59232
59232
|
}
|
|
59233
59233
|
try {
|
|
59234
59234
|
parser2.parse(str.slice(index2, index2 + blocksize2));
|
|
59235
|
-
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2,
|
|
59235
|
+
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve18, reject);
|
|
59236
59236
|
} catch (err) {
|
|
59237
59237
|
reject(prettyError(err, str));
|
|
59238
59238
|
}
|
|
@@ -59262,7 +59262,7 @@ var require_parse_stream = __commonJS({
|
|
|
59262
59262
|
function parseReadable(stm) {
|
|
59263
59263
|
const parser2 = new TOMLParser();
|
|
59264
59264
|
stm.setEncoding("utf8");
|
|
59265
|
-
return new Promise((
|
|
59265
|
+
return new Promise((resolve18, reject) => {
|
|
59266
59266
|
let readable;
|
|
59267
59267
|
let ended = false;
|
|
59268
59268
|
let errored = false;
|
|
@@ -59271,7 +59271,7 @@ var require_parse_stream = __commonJS({
|
|
|
59271
59271
|
if (readable)
|
|
59272
59272
|
return;
|
|
59273
59273
|
try {
|
|
59274
|
-
|
|
59274
|
+
resolve18(parser2.finish());
|
|
59275
59275
|
} catch (err) {
|
|
59276
59276
|
reject(err);
|
|
59277
59277
|
}
|
|
@@ -60394,7 +60394,7 @@ var require_prompt = __commonJS({
|
|
|
60394
60394
|
"../../node_modules/prompts/dist/elements/prompt.js"(exports2, module2) {
|
|
60395
60395
|
"use strict";
|
|
60396
60396
|
init_import_meta_url();
|
|
60397
|
-
var
|
|
60397
|
+
var readline2 = require("readline");
|
|
60398
60398
|
var _require = require_util7();
|
|
60399
60399
|
var action = _require.action;
|
|
60400
60400
|
var EventEmitter3 = require("events");
|
|
@@ -60409,11 +60409,11 @@ var require_prompt = __commonJS({
|
|
|
60409
60409
|
this.in = opts.stdin || process.stdin;
|
|
60410
60410
|
this.out = opts.stdout || process.stdout;
|
|
60411
60411
|
this.onRender = (opts.onRender || (() => void 0)).bind(this);
|
|
60412
|
-
const rl =
|
|
60412
|
+
const rl = readline2.createInterface({
|
|
60413
60413
|
input: this.in,
|
|
60414
60414
|
escapeCodeTimeout: 50
|
|
60415
60415
|
});
|
|
60416
|
-
|
|
60416
|
+
readline2.emitKeypressEvents(this.in, rl);
|
|
60417
60417
|
if (this.in.isTTY)
|
|
60418
60418
|
this.in.setRawMode(true);
|
|
60419
60419
|
const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
|
|
@@ -60464,7 +60464,7 @@ var require_text = __commonJS({
|
|
|
60464
60464
|
"../../node_modules/prompts/dist/elements/text.js"(exports2, module2) {
|
|
60465
60465
|
"use strict";
|
|
60466
60466
|
init_import_meta_url();
|
|
60467
|
-
function asyncGeneratorStep(gen,
|
|
60467
|
+
function asyncGeneratorStep(gen, resolve18, reject, _next, _throw, key, arg) {
|
|
60468
60468
|
try {
|
|
60469
60469
|
var info = gen[key](arg);
|
|
60470
60470
|
var value = info.value;
|
|
@@ -60473,7 +60473,7 @@ var require_text = __commonJS({
|
|
|
60473
60473
|
return;
|
|
60474
60474
|
}
|
|
60475
60475
|
if (info.done) {
|
|
60476
|
-
|
|
60476
|
+
resolve18(value);
|
|
60477
60477
|
} else {
|
|
60478
60478
|
Promise.resolve(value).then(_next, _throw);
|
|
60479
60479
|
}
|
|
@@ -60482,14 +60482,14 @@ var require_text = __commonJS({
|
|
|
60482
60482
|
function _asyncToGenerator(fn2) {
|
|
60483
60483
|
return function() {
|
|
60484
60484
|
var self2 = this, args = arguments;
|
|
60485
|
-
return new Promise(function(
|
|
60485
|
+
return new Promise(function(resolve18, reject) {
|
|
60486
60486
|
var gen = fn2.apply(self2, args);
|
|
60487
60487
|
function _next(value) {
|
|
60488
|
-
asyncGeneratorStep(gen,
|
|
60488
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "next", value);
|
|
60489
60489
|
}
|
|
60490
60490
|
__name(_next, "_next");
|
|
60491
60491
|
function _throw(err) {
|
|
60492
|
-
asyncGeneratorStep(gen,
|
|
60492
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "throw", err);
|
|
60493
60493
|
}
|
|
60494
60494
|
__name(_throw, "_throw");
|
|
60495
60495
|
_next(void 0);
|
|
@@ -61253,7 +61253,7 @@ var require_date = __commonJS({
|
|
|
61253
61253
|
"../../node_modules/prompts/dist/elements/date.js"(exports2, module2) {
|
|
61254
61254
|
"use strict";
|
|
61255
61255
|
init_import_meta_url();
|
|
61256
|
-
function asyncGeneratorStep(gen,
|
|
61256
|
+
function asyncGeneratorStep(gen, resolve18, reject, _next, _throw, key, arg) {
|
|
61257
61257
|
try {
|
|
61258
61258
|
var info = gen[key](arg);
|
|
61259
61259
|
var value = info.value;
|
|
@@ -61262,7 +61262,7 @@ var require_date = __commonJS({
|
|
|
61262
61262
|
return;
|
|
61263
61263
|
}
|
|
61264
61264
|
if (info.done) {
|
|
61265
|
-
|
|
61265
|
+
resolve18(value);
|
|
61266
61266
|
} else {
|
|
61267
61267
|
Promise.resolve(value).then(_next, _throw);
|
|
61268
61268
|
}
|
|
@@ -61271,14 +61271,14 @@ var require_date = __commonJS({
|
|
|
61271
61271
|
function _asyncToGenerator(fn2) {
|
|
61272
61272
|
return function() {
|
|
61273
61273
|
var self2 = this, args = arguments;
|
|
61274
|
-
return new Promise(function(
|
|
61274
|
+
return new Promise(function(resolve18, reject) {
|
|
61275
61275
|
var gen = fn2.apply(self2, args);
|
|
61276
61276
|
function _next(value) {
|
|
61277
|
-
asyncGeneratorStep(gen,
|
|
61277
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "next", value);
|
|
61278
61278
|
}
|
|
61279
61279
|
__name(_next, "_next");
|
|
61280
61280
|
function _throw(err) {
|
|
61281
|
-
asyncGeneratorStep(gen,
|
|
61281
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "throw", err);
|
|
61282
61282
|
}
|
|
61283
61283
|
__name(_throw, "_throw");
|
|
61284
61284
|
_next(void 0);
|
|
@@ -61485,7 +61485,7 @@ var require_number = __commonJS({
|
|
|
61485
61485
|
"../../node_modules/prompts/dist/elements/number.js"(exports2, module2) {
|
|
61486
61486
|
"use strict";
|
|
61487
61487
|
init_import_meta_url();
|
|
61488
|
-
function asyncGeneratorStep(gen,
|
|
61488
|
+
function asyncGeneratorStep(gen, resolve18, reject, _next, _throw, key, arg) {
|
|
61489
61489
|
try {
|
|
61490
61490
|
var info = gen[key](arg);
|
|
61491
61491
|
var value = info.value;
|
|
@@ -61494,7 +61494,7 @@ var require_number = __commonJS({
|
|
|
61494
61494
|
return;
|
|
61495
61495
|
}
|
|
61496
61496
|
if (info.done) {
|
|
61497
|
-
|
|
61497
|
+
resolve18(value);
|
|
61498
61498
|
} else {
|
|
61499
61499
|
Promise.resolve(value).then(_next, _throw);
|
|
61500
61500
|
}
|
|
@@ -61503,14 +61503,14 @@ var require_number = __commonJS({
|
|
|
61503
61503
|
function _asyncToGenerator(fn2) {
|
|
61504
61504
|
return function() {
|
|
61505
61505
|
var self2 = this, args = arguments;
|
|
61506
|
-
return new Promise(function(
|
|
61506
|
+
return new Promise(function(resolve18, reject) {
|
|
61507
61507
|
var gen = fn2.apply(self2, args);
|
|
61508
61508
|
function _next(value) {
|
|
61509
|
-
asyncGeneratorStep(gen,
|
|
61509
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "next", value);
|
|
61510
61510
|
}
|
|
61511
61511
|
__name(_next, "_next");
|
|
61512
61512
|
function _throw(err) {
|
|
61513
|
-
asyncGeneratorStep(gen,
|
|
61513
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "throw", err);
|
|
61514
61514
|
}
|
|
61515
61515
|
__name(_throw, "_throw");
|
|
61516
61516
|
_next(void 0);
|
|
@@ -61951,7 +61951,7 @@ var require_autocomplete = __commonJS({
|
|
|
61951
61951
|
"../../node_modules/prompts/dist/elements/autocomplete.js"(exports2, module2) {
|
|
61952
61952
|
"use strict";
|
|
61953
61953
|
init_import_meta_url();
|
|
61954
|
-
function asyncGeneratorStep(gen,
|
|
61954
|
+
function asyncGeneratorStep(gen, resolve18, reject, _next, _throw, key, arg) {
|
|
61955
61955
|
try {
|
|
61956
61956
|
var info = gen[key](arg);
|
|
61957
61957
|
var value = info.value;
|
|
@@ -61960,7 +61960,7 @@ var require_autocomplete = __commonJS({
|
|
|
61960
61960
|
return;
|
|
61961
61961
|
}
|
|
61962
61962
|
if (info.done) {
|
|
61963
|
-
|
|
61963
|
+
resolve18(value);
|
|
61964
61964
|
} else {
|
|
61965
61965
|
Promise.resolve(value).then(_next, _throw);
|
|
61966
61966
|
}
|
|
@@ -61969,14 +61969,14 @@ var require_autocomplete = __commonJS({
|
|
|
61969
61969
|
function _asyncToGenerator(fn2) {
|
|
61970
61970
|
return function() {
|
|
61971
61971
|
var self2 = this, args = arguments;
|
|
61972
|
-
return new Promise(function(
|
|
61972
|
+
return new Promise(function(resolve18, reject) {
|
|
61973
61973
|
var gen = fn2.apply(self2, args);
|
|
61974
61974
|
function _next(value) {
|
|
61975
|
-
asyncGeneratorStep(gen,
|
|
61975
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "next", value);
|
|
61976
61976
|
}
|
|
61977
61977
|
__name(_next, "_next");
|
|
61978
61978
|
function _throw(err) {
|
|
61979
|
-
asyncGeneratorStep(gen,
|
|
61979
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "throw", err);
|
|
61980
61980
|
}
|
|
61981
61981
|
__name(_throw, "_throw");
|
|
61982
61982
|
_next(void 0);
|
|
@@ -62656,7 +62656,7 @@ var require_dist2 = __commonJS({
|
|
|
62656
62656
|
return arr2;
|
|
62657
62657
|
}
|
|
62658
62658
|
__name(_arrayLikeToArray4, "_arrayLikeToArray");
|
|
62659
|
-
function asyncGeneratorStep(gen,
|
|
62659
|
+
function asyncGeneratorStep(gen, resolve18, reject, _next, _throw, key, arg) {
|
|
62660
62660
|
try {
|
|
62661
62661
|
var info = gen[key](arg);
|
|
62662
62662
|
var value = info.value;
|
|
@@ -62665,7 +62665,7 @@ var require_dist2 = __commonJS({
|
|
|
62665
62665
|
return;
|
|
62666
62666
|
}
|
|
62667
62667
|
if (info.done) {
|
|
62668
|
-
|
|
62668
|
+
resolve18(value);
|
|
62669
62669
|
} else {
|
|
62670
62670
|
Promise.resolve(value).then(_next, _throw);
|
|
62671
62671
|
}
|
|
@@ -62674,14 +62674,14 @@ var require_dist2 = __commonJS({
|
|
|
62674
62674
|
function _asyncToGenerator(fn2) {
|
|
62675
62675
|
return function() {
|
|
62676
62676
|
var self2 = this, args = arguments;
|
|
62677
|
-
return new Promise(function(
|
|
62677
|
+
return new Promise(function(resolve18, reject) {
|
|
62678
62678
|
var gen = fn2.apply(self2, args);
|
|
62679
62679
|
function _next(value) {
|
|
62680
|
-
asyncGeneratorStep(gen,
|
|
62680
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "next", value);
|
|
62681
62681
|
}
|
|
62682
62682
|
__name(_next, "_next");
|
|
62683
62683
|
function _throw(err) {
|
|
62684
|
-
asyncGeneratorStep(gen,
|
|
62684
|
+
asyncGeneratorStep(gen, resolve18, reject, _next, _throw, "throw", err);
|
|
62685
62685
|
}
|
|
62686
62686
|
__name(_throw, "_throw");
|
|
62687
62687
|
_next(void 0);
|
|
@@ -63041,7 +63041,7 @@ var require_prompt2 = __commonJS({
|
|
|
63041
63041
|
"../../node_modules/prompts/lib/elements/prompt.js"(exports2, module2) {
|
|
63042
63042
|
"use strict";
|
|
63043
63043
|
init_import_meta_url();
|
|
63044
|
-
var
|
|
63044
|
+
var readline2 = require("readline");
|
|
63045
63045
|
var { action } = require_util8();
|
|
63046
63046
|
var EventEmitter3 = require("events");
|
|
63047
63047
|
var { beep, cursor } = require_src();
|
|
@@ -63053,8 +63053,8 @@ var require_prompt2 = __commonJS({
|
|
|
63053
63053
|
this.in = opts.stdin || process.stdin;
|
|
63054
63054
|
this.out = opts.stdout || process.stdout;
|
|
63055
63055
|
this.onRender = (opts.onRender || (() => void 0)).bind(this);
|
|
63056
|
-
const rl =
|
|
63057
|
-
|
|
63056
|
+
const rl = readline2.createInterface({ input: this.in, escapeCodeTimeout: 50 });
|
|
63057
|
+
readline2.emitKeypressEvents(this.in, rl);
|
|
63058
63058
|
if (this.in.isTTY)
|
|
63059
63059
|
this.in.setRawMode(true);
|
|
63060
63060
|
const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
|
|
@@ -65878,14 +65878,14 @@ var require_open = __commonJS({
|
|
|
65878
65878
|
}
|
|
65879
65879
|
const subprocess = childProcess2.spawn(command2, cliArguments, childProcessOptions);
|
|
65880
65880
|
if (options14.wait) {
|
|
65881
|
-
return new Promise((
|
|
65881
|
+
return new Promise((resolve18, reject) => {
|
|
65882
65882
|
subprocess.once("error", reject);
|
|
65883
65883
|
subprocess.once("close", (exitCode) => {
|
|
65884
65884
|
if (options14.allowNonzeroExitCode && exitCode > 0) {
|
|
65885
65885
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
65886
65886
|
return;
|
|
65887
65887
|
}
|
|
65888
|
-
|
|
65888
|
+
resolve18(subprocess);
|
|
65889
65889
|
});
|
|
65890
65890
|
});
|
|
65891
65891
|
}
|
|
@@ -69308,12 +69308,12 @@ var require_isexe = __commonJS({
|
|
|
69308
69308
|
if (typeof Promise !== "function") {
|
|
69309
69309
|
throw new TypeError("callback not provided");
|
|
69310
69310
|
}
|
|
69311
|
-
return new Promise(function(
|
|
69311
|
+
return new Promise(function(resolve18, reject) {
|
|
69312
69312
|
isexe(path45, options14 || {}, function(er, is2) {
|
|
69313
69313
|
if (er) {
|
|
69314
69314
|
reject(er);
|
|
69315
69315
|
} else {
|
|
69316
|
-
|
|
69316
|
+
resolve18(is2);
|
|
69317
69317
|
}
|
|
69318
69318
|
});
|
|
69319
69319
|
});
|
|
@@ -69380,27 +69380,27 @@ var require_which = __commonJS({
|
|
|
69380
69380
|
opt = {};
|
|
69381
69381
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
69382
69382
|
const found = [];
|
|
69383
|
-
const step = /* @__PURE__ */ __name((i) => new Promise((
|
|
69383
|
+
const step = /* @__PURE__ */ __name((i) => new Promise((resolve18, reject) => {
|
|
69384
69384
|
if (i === pathEnv.length)
|
|
69385
|
-
return opt.all && found.length ?
|
|
69385
|
+
return opt.all && found.length ? resolve18(found) : reject(getNotFoundError(cmd));
|
|
69386
69386
|
const ppRaw = pathEnv[i];
|
|
69387
69387
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
69388
69388
|
const pCmd = path45.join(pathPart, cmd);
|
|
69389
69389
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
69390
|
-
|
|
69390
|
+
resolve18(subStep(p, i, 0));
|
|
69391
69391
|
}), "step");
|
|
69392
|
-
const subStep = /* @__PURE__ */ __name((p, i, ii) => new Promise((
|
|
69392
|
+
const subStep = /* @__PURE__ */ __name((p, i, ii) => new Promise((resolve18, reject) => {
|
|
69393
69393
|
if (ii === pathExt.length)
|
|
69394
|
-
return
|
|
69394
|
+
return resolve18(step(i + 1));
|
|
69395
69395
|
const ext = pathExt[ii];
|
|
69396
69396
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is2) => {
|
|
69397
69397
|
if (!er && is2) {
|
|
69398
69398
|
if (opt.all)
|
|
69399
69399
|
found.push(p + ext);
|
|
69400
69400
|
else
|
|
69401
|
-
return
|
|
69401
|
+
return resolve18(p + ext);
|
|
69402
69402
|
}
|
|
69403
|
-
return
|
|
69403
|
+
return resolve18(subStep(p, i, ii + 1));
|
|
69404
69404
|
});
|
|
69405
69405
|
}), "subStep");
|
|
69406
69406
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -69720,16 +69720,16 @@ var require_cross_spawn = __commonJS({
|
|
|
69720
69720
|
return spawned;
|
|
69721
69721
|
}
|
|
69722
69722
|
__name(spawn3, "spawn");
|
|
69723
|
-
function
|
|
69723
|
+
function spawnSync3(command2, args, options14) {
|
|
69724
69724
|
const parsed = parse4(command2, args, options14);
|
|
69725
69725
|
const result = cp2.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
69726
69726
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
69727
69727
|
return result;
|
|
69728
69728
|
}
|
|
69729
|
-
__name(
|
|
69729
|
+
__name(spawnSync3, "spawnSync");
|
|
69730
69730
|
module2.exports = spawn3;
|
|
69731
69731
|
module2.exports.spawn = spawn3;
|
|
69732
|
-
module2.exports.sync =
|
|
69732
|
+
module2.exports.sync = spawnSync3;
|
|
69733
69733
|
module2.exports._parse = parse4;
|
|
69734
69734
|
module2.exports._enoent = enoent;
|
|
69735
69735
|
}
|
|
@@ -69808,7 +69808,7 @@ var require_get_stream = __commonJS({
|
|
|
69808
69808
|
};
|
|
69809
69809
|
const { maxBuffer } = options14;
|
|
69810
69810
|
const stream3 = bufferStream(options14);
|
|
69811
|
-
await new Promise((
|
|
69811
|
+
await new Promise((resolve18, reject) => {
|
|
69812
69812
|
const rejectPromise = /* @__PURE__ */ __name((error) => {
|
|
69813
69813
|
if (error && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
69814
69814
|
error.bufferedData = stream3.getBufferedValue();
|
|
@@ -69818,7 +69818,7 @@ var require_get_stream = __commonJS({
|
|
|
69818
69818
|
(async () => {
|
|
69819
69819
|
try {
|
|
69820
69820
|
await streamPipelinePromisified(inputStream, stream3);
|
|
69821
|
-
|
|
69821
|
+
resolve18();
|
|
69822
69822
|
} catch (error) {
|
|
69823
69823
|
rejectPromise(error);
|
|
69824
69824
|
}
|
|
@@ -70577,7 +70577,7 @@ var require_kill = __commonJS({
|
|
|
70577
70577
|
return spawnedPromise;
|
|
70578
70578
|
}
|
|
70579
70579
|
let timeoutId;
|
|
70580
|
-
const timeoutPromise = new Promise((
|
|
70580
|
+
const timeoutPromise = new Promise((resolve18, reject) => {
|
|
70581
70581
|
timeoutId = setTimeout(() => {
|
|
70582
70582
|
timeoutKill2(spawned, killSignal, reject);
|
|
70583
70583
|
}, timeout);
|
|
@@ -70726,9 +70726,9 @@ var require_promise = __commonJS({
|
|
|
70726
70726
|
return spawned;
|
|
70727
70727
|
}, "mergePromise");
|
|
70728
70728
|
var getSpawnedPromise2 = /* @__PURE__ */ __name((spawned) => {
|
|
70729
|
-
return new Promise((
|
|
70729
|
+
return new Promise((resolve18, reject) => {
|
|
70730
70730
|
spawned.on("exit", (exitCode, signal) => {
|
|
70731
|
-
|
|
70731
|
+
resolve18({ exitCode, signal });
|
|
70732
70732
|
});
|
|
70733
70733
|
spawned.on("error", (error) => {
|
|
70734
70734
|
reject(error);
|
|
@@ -71181,10 +71181,10 @@ var require_command_exists = __commonJS({
|
|
|
71181
71181
|
module2.exports = /* @__PURE__ */ __name(function commandExists2(commandName, callback) {
|
|
71182
71182
|
var cleanedCommandName = cleanInput(commandName);
|
|
71183
71183
|
if (!callback && typeof Promise !== "undefined") {
|
|
71184
|
-
return new Promise(function(
|
|
71184
|
+
return new Promise(function(resolve18, reject) {
|
|
71185
71185
|
commandExists2(commandName, function(error, output) {
|
|
71186
71186
|
if (output) {
|
|
71187
|
-
|
|
71187
|
+
resolve18(commandName);
|
|
71188
71188
|
} else {
|
|
71189
71189
|
reject(error);
|
|
71190
71190
|
}
|
|
@@ -76176,11 +76176,11 @@ var require_raw_body = __commonJS({
|
|
|
76176
76176
|
if (done) {
|
|
76177
76177
|
return readStream(stream2, encoding, length, limit, wrap2(done));
|
|
76178
76178
|
}
|
|
76179
|
-
return new Promise(/* @__PURE__ */ __name(function executor(
|
|
76179
|
+
return new Promise(/* @__PURE__ */ __name(function executor(resolve18, reject) {
|
|
76180
76180
|
readStream(stream2, encoding, length, limit, /* @__PURE__ */ __name(function onRead(err, buf) {
|
|
76181
76181
|
if (err)
|
|
76182
76182
|
return reject(err);
|
|
76183
|
-
|
|
76183
|
+
resolve18(buf);
|
|
76184
76184
|
}, "onRead"));
|
|
76185
76185
|
}, "executor"));
|
|
76186
76186
|
}
|
|
@@ -90036,7 +90036,7 @@ var require_view = __commonJS({
|
|
|
90036
90036
|
var basename6 = path45.basename;
|
|
90037
90037
|
var extname4 = path45.extname;
|
|
90038
90038
|
var join12 = path45.join;
|
|
90039
|
-
var
|
|
90039
|
+
var resolve18 = path45.resolve;
|
|
90040
90040
|
module2.exports = View;
|
|
90041
90041
|
function View(name, options14) {
|
|
90042
90042
|
var opts = options14 || {};
|
|
@@ -90071,7 +90071,7 @@ var require_view = __commonJS({
|
|
|
90071
90071
|
debug('lookup "%s"', name);
|
|
90072
90072
|
for (var i = 0; i < roots.length && !path46; i++) {
|
|
90073
90073
|
var root = roots[i];
|
|
90074
|
-
var loc =
|
|
90074
|
+
var loc = resolve18(root, name);
|
|
90075
90075
|
var dir = dirname10(loc);
|
|
90076
90076
|
var file = basename6(loc);
|
|
90077
90077
|
path46 = this.resolve(dir, file);
|
|
@@ -90082,7 +90082,7 @@ var require_view = __commonJS({
|
|
|
90082
90082
|
debug('render "%s"', this.path);
|
|
90083
90083
|
this.engine(this.path, options14, callback);
|
|
90084
90084
|
}, "render");
|
|
90085
|
-
View.prototype.resolve = /* @__PURE__ */ __name(function
|
|
90085
|
+
View.prototype.resolve = /* @__PURE__ */ __name(function resolve19(dir, file) {
|
|
90086
90086
|
var ext = this.ext;
|
|
90087
90087
|
var path46 = join12(dir, file);
|
|
90088
90088
|
var stat3 = tryStat(path46);
|
|
@@ -91284,7 +91284,7 @@ var require_send = __commonJS({
|
|
|
91284
91284
|
var extname4 = path45.extname;
|
|
91285
91285
|
var join12 = path45.join;
|
|
91286
91286
|
var normalize2 = path45.normalize;
|
|
91287
|
-
var
|
|
91287
|
+
var resolve18 = path45.resolve;
|
|
91288
91288
|
var sep2 = path45.sep;
|
|
91289
91289
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
91290
91290
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
@@ -91322,7 +91322,7 @@ var require_send = __commonJS({
|
|
|
91322
91322
|
this._maxage = opts.maxAge || opts.maxage;
|
|
91323
91323
|
this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
|
|
91324
91324
|
this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
|
|
91325
|
-
this._root = opts.root ?
|
|
91325
|
+
this._root = opts.root ? resolve18(opts.root) : null;
|
|
91326
91326
|
if (!this._root && opts.from) {
|
|
91327
91327
|
this.from(opts.from);
|
|
91328
91328
|
}
|
|
@@ -91347,7 +91347,7 @@ var require_send = __commonJS({
|
|
|
91347
91347
|
return this;
|
|
91348
91348
|
}, "index"), "send.index: pass index as option");
|
|
91349
91349
|
SendStream.prototype.root = /* @__PURE__ */ __name(function root(path46) {
|
|
91350
|
-
this._root =
|
|
91350
|
+
this._root = resolve18(String(path46));
|
|
91351
91351
|
debug("root %s", this._root);
|
|
91352
91352
|
return this;
|
|
91353
91353
|
}, "root");
|
|
@@ -91511,7 +91511,7 @@ var require_send = __commonJS({
|
|
|
91511
91511
|
return res;
|
|
91512
91512
|
}
|
|
91513
91513
|
parts = normalize2(path46).split(sep2);
|
|
91514
|
-
path46 =
|
|
91514
|
+
path46 = resolve18(path46);
|
|
91515
91515
|
}
|
|
91516
91516
|
if (containsDotFile(parts)) {
|
|
91517
91517
|
var access3 = this._dotfiles;
|
|
@@ -92847,7 +92847,7 @@ var require_application = __commonJS({
|
|
|
92847
92847
|
var deprecate = require_depd()("express");
|
|
92848
92848
|
var flatten = require_array_flatten();
|
|
92849
92849
|
var merge = require_utils_merge();
|
|
92850
|
-
var
|
|
92850
|
+
var resolve18 = require("path").resolve;
|
|
92851
92851
|
var setPrototypeOf = require_setprototypeof();
|
|
92852
92852
|
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
92853
92853
|
var slice = Array.prototype.slice;
|
|
@@ -92886,7 +92886,7 @@ var require_application = __commonJS({
|
|
|
92886
92886
|
this.mountpath = "/";
|
|
92887
92887
|
this.locals.settings = this.settings;
|
|
92888
92888
|
this.set("view", View);
|
|
92889
|
-
this.set("views",
|
|
92889
|
+
this.set("views", resolve18("views"));
|
|
92890
92890
|
this.set("jsonp callback name", "callback");
|
|
92891
92891
|
if (env5 === "production") {
|
|
92892
92892
|
this.enable("view cache");
|
|
@@ -94190,7 +94190,7 @@ var require_response2 = __commonJS({
|
|
|
94190
94190
|
var send = require_send();
|
|
94191
94191
|
var extname4 = path45.extname;
|
|
94192
94192
|
var mime = send.mime;
|
|
94193
|
-
var
|
|
94193
|
+
var resolve18 = path45.resolve;
|
|
94194
94194
|
var vary = require_vary();
|
|
94195
94195
|
var res = Object.create(http3.ServerResponse.prototype);
|
|
94196
94196
|
module2.exports = res;
|
|
@@ -94454,7 +94454,7 @@ var require_response2 = __commonJS({
|
|
|
94454
94454
|
}
|
|
94455
94455
|
opts = Object.create(opts);
|
|
94456
94456
|
opts.headers = headers;
|
|
94457
|
-
var fullPath = !opts.root ?
|
|
94457
|
+
var fullPath = !opts.root ? resolve18(path46) : path46;
|
|
94458
94458
|
return this.sendFile(fullPath, opts, done);
|
|
94459
94459
|
}, "download");
|
|
94460
94460
|
res.contentType = res.type = /* @__PURE__ */ __name(function contentType(type) {
|
|
@@ -94728,7 +94728,7 @@ var require_serve_static = __commonJS({
|
|
|
94728
94728
|
var encodeUrl = require_encodeurl();
|
|
94729
94729
|
var escapeHtml = require_escape_html();
|
|
94730
94730
|
var parseUrl = require_parseurl();
|
|
94731
|
-
var
|
|
94731
|
+
var resolve18 = require("path").resolve;
|
|
94732
94732
|
var send = require_send();
|
|
94733
94733
|
var url3 = require("url");
|
|
94734
94734
|
module2.exports = serveStatic2;
|
|
@@ -94748,7 +94748,7 @@ var require_serve_static = __commonJS({
|
|
|
94748
94748
|
throw new TypeError("option setHeaders must be function");
|
|
94749
94749
|
}
|
|
94750
94750
|
opts.maxage = opts.maxage || opts.maxAge || 0;
|
|
94751
|
-
opts.root =
|
|
94751
|
+
opts.root = resolve18(root);
|
|
94752
94752
|
var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
|
|
94753
94753
|
return /* @__PURE__ */ __name(function serveStatic3(req, res, next) {
|
|
94754
94754
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -94920,11 +94920,11 @@ var require_p_finally = __commonJS({
|
|
|
94920
94920
|
onFinally = onFinally || (() => {
|
|
94921
94921
|
});
|
|
94922
94922
|
return promise.then(
|
|
94923
|
-
(val) => new Promise((
|
|
94924
|
-
|
|
94923
|
+
(val) => new Promise((resolve18) => {
|
|
94924
|
+
resolve18(onFinally());
|
|
94925
94925
|
}).then(() => val),
|
|
94926
|
-
(err) => new Promise((
|
|
94927
|
-
|
|
94926
|
+
(err) => new Promise((resolve18) => {
|
|
94927
|
+
resolve18(onFinally());
|
|
94928
94928
|
}).then(() => {
|
|
94929
94929
|
throw err;
|
|
94930
94930
|
})
|
|
@@ -94946,18 +94946,18 @@ var require_p_timeout = __commonJS({
|
|
|
94946
94946
|
}
|
|
94947
94947
|
};
|
|
94948
94948
|
__name(TimeoutError2, "TimeoutError");
|
|
94949
|
-
var pTimeout2 = /* @__PURE__ */ __name((promise, milliseconds, fallback) => new Promise((
|
|
94949
|
+
var pTimeout2 = /* @__PURE__ */ __name((promise, milliseconds, fallback) => new Promise((resolve18, reject) => {
|
|
94950
94950
|
if (typeof milliseconds !== "number" || milliseconds < 0) {
|
|
94951
94951
|
throw new TypeError("Expected `milliseconds` to be a positive number");
|
|
94952
94952
|
}
|
|
94953
94953
|
if (milliseconds === Infinity) {
|
|
94954
|
-
|
|
94954
|
+
resolve18(promise);
|
|
94955
94955
|
return;
|
|
94956
94956
|
}
|
|
94957
94957
|
const timer = setTimeout(() => {
|
|
94958
94958
|
if (typeof fallback === "function") {
|
|
94959
94959
|
try {
|
|
94960
|
-
|
|
94960
|
+
resolve18(fallback());
|
|
94961
94961
|
} catch (error) {
|
|
94962
94962
|
reject(error);
|
|
94963
94963
|
}
|
|
@@ -94971,7 +94971,7 @@ var require_p_timeout = __commonJS({
|
|
|
94971
94971
|
reject(timeoutError2);
|
|
94972
94972
|
}, milliseconds);
|
|
94973
94973
|
pFinally(
|
|
94974
|
-
promise.then(
|
|
94974
|
+
promise.then(resolve18, reject),
|
|
94975
94975
|
() => {
|
|
94976
94976
|
clearTimeout(timer);
|
|
94977
94977
|
}
|
|
@@ -94997,7 +94997,7 @@ var require_p_wait_for = __commonJS({
|
|
|
94997
94997
|
...options14
|
|
94998
94998
|
};
|
|
94999
94999
|
let retryTimeout;
|
|
95000
|
-
const promise = new Promise((
|
|
95000
|
+
const promise = new Promise((resolve18, reject) => {
|
|
95001
95001
|
const check = /* @__PURE__ */ __name(async () => {
|
|
95002
95002
|
try {
|
|
95003
95003
|
const value = await condition();
|
|
@@ -95005,7 +95005,7 @@ var require_p_wait_for = __commonJS({
|
|
|
95005
95005
|
throw new TypeError("Expected condition to return a boolean");
|
|
95006
95006
|
}
|
|
95007
95007
|
if (value === true) {
|
|
95008
|
-
|
|
95008
|
+
resolve18();
|
|
95009
95009
|
} else {
|
|
95010
95010
|
retryTimeout = setTimeout(check, options14.interval);
|
|
95011
95011
|
}
|
|
@@ -95868,11 +95868,11 @@ var require_uri_all = __commonJS({
|
|
|
95868
95868
|
return target;
|
|
95869
95869
|
}
|
|
95870
95870
|
__name(resolveComponents, "resolveComponents");
|
|
95871
|
-
function
|
|
95871
|
+
function resolve18(baseURI, relativeURI, options14) {
|
|
95872
95872
|
var schemelessOptions = assign({ scheme: "null" }, options14);
|
|
95873
95873
|
return serialize(resolveComponents(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
|
|
95874
95874
|
}
|
|
95875
|
-
__name(
|
|
95875
|
+
__name(resolve18, "resolve");
|
|
95876
95876
|
function normalize2(uri, options14) {
|
|
95877
95877
|
if (typeof uri === "string") {
|
|
95878
95878
|
uri = serialize(parse4(uri, options14), options14);
|
|
@@ -96143,7 +96143,7 @@ var require_uri_all = __commonJS({
|
|
|
96143
96143
|
exports3.removeDotSegments = removeDotSegments;
|
|
96144
96144
|
exports3.serialize = serialize;
|
|
96145
96145
|
exports3.resolveComponents = resolveComponents;
|
|
96146
|
-
exports3.resolve =
|
|
96146
|
+
exports3.resolve = resolve18;
|
|
96147
96147
|
exports3.normalize = normalize2;
|
|
96148
96148
|
exports3.equal = equal;
|
|
96149
96149
|
exports3.escapeComponent = escapeComponent;
|
|
@@ -96559,20 +96559,20 @@ var require_resolve = __commonJS({
|
|
|
96559
96559
|
var util3 = require_util9();
|
|
96560
96560
|
var SchemaObject = require_schema_obj();
|
|
96561
96561
|
var traverse = require_json_schema_traverse();
|
|
96562
|
-
module2.exports =
|
|
96563
|
-
|
|
96564
|
-
|
|
96565
|
-
|
|
96566
|
-
|
|
96567
|
-
|
|
96568
|
-
|
|
96569
|
-
function
|
|
96562
|
+
module2.exports = resolve18;
|
|
96563
|
+
resolve18.normalizeId = normalizeId;
|
|
96564
|
+
resolve18.fullPath = getFullPath;
|
|
96565
|
+
resolve18.url = resolveUrl;
|
|
96566
|
+
resolve18.ids = resolveIds;
|
|
96567
|
+
resolve18.inlineRef = inlineRef;
|
|
96568
|
+
resolve18.schema = resolveSchema;
|
|
96569
|
+
function resolve18(compile, root, ref) {
|
|
96570
96570
|
var refVal = this._refs[ref];
|
|
96571
96571
|
if (typeof refVal == "string") {
|
|
96572
96572
|
if (this._refs[refVal])
|
|
96573
96573
|
refVal = this._refs[refVal];
|
|
96574
96574
|
else
|
|
96575
|
-
return
|
|
96575
|
+
return resolve18.call(this, compile, root, refVal);
|
|
96576
96576
|
}
|
|
96577
96577
|
refVal = refVal || this._schemas[ref];
|
|
96578
96578
|
if (refVal instanceof SchemaObject) {
|
|
@@ -96592,7 +96592,7 @@ var require_resolve = __commonJS({
|
|
|
96592
96592
|
}
|
|
96593
96593
|
return v;
|
|
96594
96594
|
}
|
|
96595
|
-
__name(
|
|
96595
|
+
__name(resolve18, "resolve");
|
|
96596
96596
|
function resolveSchema(root, ref) {
|
|
96597
96597
|
var p = URI.parse(ref), refPath = _getFullPath(p), baseId = getFullPath(this._getId(root.schema));
|
|
96598
96598
|
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
|
@@ -96811,7 +96811,7 @@ var require_error_classes = __commonJS({
|
|
|
96811
96811
|
"../../node_modules/ajv/lib/compile/error_classes.js"(exports2, module2) {
|
|
96812
96812
|
"use strict";
|
|
96813
96813
|
init_import_meta_url();
|
|
96814
|
-
var
|
|
96814
|
+
var resolve18 = require_resolve();
|
|
96815
96815
|
module2.exports = {
|
|
96816
96816
|
Validation: errorSubclass(ValidationError),
|
|
96817
96817
|
MissingRef: errorSubclass(MissingRefError)
|
|
@@ -96827,8 +96827,8 @@ var require_error_classes = __commonJS({
|
|
|
96827
96827
|
};
|
|
96828
96828
|
function MissingRefError(baseId, ref, message) {
|
|
96829
96829
|
this.message = message || MissingRefError.message(baseId, ref);
|
|
96830
|
-
this.missingRef =
|
|
96831
|
-
this.missingSchema =
|
|
96830
|
+
this.missingRef = resolve18.url(baseId, ref);
|
|
96831
|
+
this.missingSchema = resolve18.normalizeId(resolve18.fullPath(this.missingRef));
|
|
96832
96832
|
}
|
|
96833
96833
|
__name(MissingRefError, "MissingRefError");
|
|
96834
96834
|
function errorSubclass(Subclass) {
|
|
@@ -97387,7 +97387,7 @@ var require_compile = __commonJS({
|
|
|
97387
97387
|
"../../node_modules/ajv/lib/compile/index.js"(exports2, module2) {
|
|
97388
97388
|
"use strict";
|
|
97389
97389
|
init_import_meta_url();
|
|
97390
|
-
var
|
|
97390
|
+
var resolve18 = require_resolve();
|
|
97391
97391
|
var util3 = require_util9();
|
|
97392
97392
|
var errorClasses = require_error_classes();
|
|
97393
97393
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -97448,7 +97448,7 @@ var require_compile = __commonJS({
|
|
|
97448
97448
|
RULES,
|
|
97449
97449
|
validate: validateGenerator,
|
|
97450
97450
|
util: util3,
|
|
97451
|
-
resolve:
|
|
97451
|
+
resolve: resolve18,
|
|
97452
97452
|
resolveRef,
|
|
97453
97453
|
usePattern,
|
|
97454
97454
|
useDefault,
|
|
@@ -97511,7 +97511,7 @@ var require_compile = __commonJS({
|
|
|
97511
97511
|
}
|
|
97512
97512
|
__name(localCompile, "localCompile");
|
|
97513
97513
|
function resolveRef(baseId2, ref, isRoot) {
|
|
97514
|
-
ref =
|
|
97514
|
+
ref = resolve18.url(baseId2, ref);
|
|
97515
97515
|
var refIndex = refs[ref];
|
|
97516
97516
|
var _refVal, refCode;
|
|
97517
97517
|
if (refIndex !== void 0) {
|
|
@@ -97528,11 +97528,11 @@ var require_compile = __commonJS({
|
|
|
97528
97528
|
}
|
|
97529
97529
|
}
|
|
97530
97530
|
refCode = addLocalRef(ref);
|
|
97531
|
-
var v2 =
|
|
97531
|
+
var v2 = resolve18.call(self2, localCompile, root, ref);
|
|
97532
97532
|
if (v2 === void 0) {
|
|
97533
97533
|
var localSchema = localRefs && localRefs[ref];
|
|
97534
97534
|
if (localSchema) {
|
|
97535
|
-
v2 =
|
|
97535
|
+
v2 = resolve18.inlineRef(localSchema, opts.inlineRefs) ? localSchema : compile.call(self2, localSchema, root, localRefs, baseId2);
|
|
97536
97536
|
}
|
|
97537
97537
|
}
|
|
97538
97538
|
if (v2 === void 0) {
|
|
@@ -101224,7 +101224,7 @@ var require_ajv = __commonJS({
|
|
|
101224
101224
|
"use strict";
|
|
101225
101225
|
init_import_meta_url();
|
|
101226
101226
|
var compileSchema = require_compile();
|
|
101227
|
-
var
|
|
101227
|
+
var resolve18 = require_resolve();
|
|
101228
101228
|
var Cache2 = require_cache();
|
|
101229
101229
|
var SchemaObject = require_schema_obj();
|
|
101230
101230
|
var stableStringify = require_fast_json_stable_stringify();
|
|
@@ -101319,7 +101319,7 @@ var require_ajv = __commonJS({
|
|
|
101319
101319
|
var id = this._getId(schema);
|
|
101320
101320
|
if (id !== void 0 && typeof id != "string")
|
|
101321
101321
|
throw new Error("schema id must be string");
|
|
101322
|
-
key =
|
|
101322
|
+
key = resolve18.normalizeId(key || id);
|
|
101323
101323
|
checkUnique(this, key);
|
|
101324
101324
|
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
|
101325
101325
|
return this;
|
|
@@ -101370,7 +101370,7 @@ var require_ajv = __commonJS({
|
|
|
101370
101370
|
}
|
|
101371
101371
|
__name(getSchema, "getSchema");
|
|
101372
101372
|
function _getSchemaFragment(self2, ref) {
|
|
101373
|
-
var res =
|
|
101373
|
+
var res = resolve18.schema.call(self2, { schema: {} }, ref);
|
|
101374
101374
|
if (res) {
|
|
101375
101375
|
var schema = res.schema, root = res.root, baseId = res.baseId;
|
|
101376
101376
|
var v = compileSchema.call(self2, schema, root, void 0, baseId);
|
|
@@ -101387,7 +101387,7 @@ var require_ajv = __commonJS({
|
|
|
101387
101387
|
}
|
|
101388
101388
|
__name(_getSchemaFragment, "_getSchemaFragment");
|
|
101389
101389
|
function _getSchemaObj(self2, keyRef) {
|
|
101390
|
-
keyRef =
|
|
101390
|
+
keyRef = resolve18.normalizeId(keyRef);
|
|
101391
101391
|
return self2._schemas[keyRef] || self2._refs[keyRef] || self2._fragments[keyRef];
|
|
101392
101392
|
}
|
|
101393
101393
|
__name(_getSchemaObj, "_getSchemaObj");
|
|
@@ -101416,7 +101416,7 @@ var require_ajv = __commonJS({
|
|
|
101416
101416
|
this._cache.del(cacheKey);
|
|
101417
101417
|
var id = this._getId(schemaKeyRef);
|
|
101418
101418
|
if (id) {
|
|
101419
|
-
id =
|
|
101419
|
+
id = resolve18.normalizeId(id);
|
|
101420
101420
|
delete this._schemas[id];
|
|
101421
101421
|
delete this._refs[id];
|
|
101422
101422
|
}
|
|
@@ -101443,14 +101443,14 @@ var require_ajv = __commonJS({
|
|
|
101443
101443
|
if (cached)
|
|
101444
101444
|
return cached;
|
|
101445
101445
|
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
|
101446
|
-
var id =
|
|
101446
|
+
var id = resolve18.normalizeId(this._getId(schema));
|
|
101447
101447
|
if (id && shouldAddSchema)
|
|
101448
101448
|
checkUnique(this, id);
|
|
101449
101449
|
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
|
101450
101450
|
var recursiveMeta;
|
|
101451
|
-
if (willValidate && !(recursiveMeta = id && id ==
|
|
101451
|
+
if (willValidate && !(recursiveMeta = id && id == resolve18.normalizeId(schema.$schema)))
|
|
101452
101452
|
this.validateSchema(schema, true);
|
|
101453
|
-
var localRefs =
|
|
101453
|
+
var localRefs = resolve18.ids.call(this, schema);
|
|
101454
101454
|
var schemaObj = new SchemaObject({
|
|
101455
101455
|
id,
|
|
101456
101456
|
schema,
|
|
@@ -106451,8 +106451,8 @@ var require_createInternalHttpTerminator = __commonJS({
|
|
|
106451
106451
|
}
|
|
106452
106452
|
let resolveTerminating;
|
|
106453
106453
|
let rejectTerminating;
|
|
106454
|
-
terminating = new Promise((
|
|
106455
|
-
resolveTerminating =
|
|
106454
|
+
terminating = new Promise((resolve18, reject) => {
|
|
106455
|
+
resolveTerminating = resolve18;
|
|
106456
106456
|
rejectTerminating = reject;
|
|
106457
106457
|
});
|
|
106458
106458
|
server2.on("request", (incomingMessage, outgoingMessage) => {
|
|
@@ -116126,7 +116126,7 @@ var require_update_check = __commonJS({
|
|
|
116126
116126
|
});
|
|
116127
116127
|
await writeFile4(file, content, "utf8");
|
|
116128
116128
|
}, "updateCache");
|
|
116129
|
-
var loadPackage = /* @__PURE__ */ __name((url3, authInfo) => new Promise((
|
|
116129
|
+
var loadPackage = /* @__PURE__ */ __name((url3, authInfo) => new Promise((resolve18, reject) => {
|
|
116130
116130
|
const options14 = {
|
|
116131
116131
|
host: url3.hostname,
|
|
116132
116132
|
path: url3.pathname,
|
|
@@ -116157,7 +116157,7 @@ var require_update_check = __commonJS({
|
|
|
116157
116157
|
response.on("end", () => {
|
|
116158
116158
|
try {
|
|
116159
116159
|
const parsedData = JSON.parse(rawData);
|
|
116160
|
-
|
|
116160
|
+
resolve18(parsedData);
|
|
116161
116161
|
} catch (e2) {
|
|
116162
116162
|
reject(e2);
|
|
116163
116163
|
}
|
|
@@ -117963,7 +117963,7 @@ var import_undici18 = __toESM(require_undici());
|
|
|
117963
117963
|
|
|
117964
117964
|
// src/dev.tsx
|
|
117965
117965
|
init_import_meta_url();
|
|
117966
|
-
var
|
|
117966
|
+
var import_node_path44 = __toESM(require("node:path"));
|
|
117967
117967
|
var import_env = __toESM(require_dist());
|
|
117968
117968
|
var import_chalk15 = __toESM(require_chalk());
|
|
117969
117969
|
var import_chokidar5 = require("chokidar");
|
|
@@ -117994,14 +117994,14 @@ var getLocalHosts = /* @__PURE__ */ __name(() => {
|
|
|
117994
117994
|
}
|
|
117995
117995
|
return results;
|
|
117996
117996
|
}, "getLocalHosts");
|
|
117997
|
-
var checkAvailablePort = /* @__PURE__ */ __name((options14) => new Promise((
|
|
117997
|
+
var checkAvailablePort = /* @__PURE__ */ __name((options14) => new Promise((resolve18, reject) => {
|
|
117998
117998
|
const server2 = import_node_net.default.createServer();
|
|
117999
117999
|
server2.unref();
|
|
118000
118000
|
server2.on("error", reject);
|
|
118001
118001
|
server2.listen(options14, () => {
|
|
118002
118002
|
const { port: port2 } = server2.address();
|
|
118003
118003
|
server2.close(() => {
|
|
118004
|
-
|
|
118004
|
+
resolve18(port2);
|
|
118005
118005
|
});
|
|
118006
118006
|
});
|
|
118007
118007
|
}), "checkAvailablePort");
|
|
@@ -118178,18 +118178,18 @@ function pLimit(concurrency) {
|
|
|
118178
118178
|
queue.dequeue()();
|
|
118179
118179
|
}
|
|
118180
118180
|
}, "next");
|
|
118181
|
-
const run = /* @__PURE__ */ __name(async (fn2,
|
|
118181
|
+
const run = /* @__PURE__ */ __name(async (fn2, resolve18, args) => {
|
|
118182
118182
|
activeCount++;
|
|
118183
118183
|
const result = (async () => fn2(...args))();
|
|
118184
|
-
|
|
118184
|
+
resolve18(result);
|
|
118185
118185
|
try {
|
|
118186
118186
|
await result;
|
|
118187
118187
|
} catch {
|
|
118188
118188
|
}
|
|
118189
118189
|
next();
|
|
118190
118190
|
}, "run");
|
|
118191
|
-
const enqueue = /* @__PURE__ */ __name((fn2,
|
|
118192
|
-
queue.enqueue(run.bind(void 0, fn2,
|
|
118191
|
+
const enqueue = /* @__PURE__ */ __name((fn2, resolve18, args) => {
|
|
118192
|
+
queue.enqueue(run.bind(void 0, fn2, resolve18, args));
|
|
118193
118193
|
(async () => {
|
|
118194
118194
|
await Promise.resolve();
|
|
118195
118195
|
if (activeCount < concurrency && queue.size > 0) {
|
|
@@ -118197,8 +118197,8 @@ function pLimit(concurrency) {
|
|
|
118197
118197
|
}
|
|
118198
118198
|
})();
|
|
118199
118199
|
}, "enqueue");
|
|
118200
|
-
const generator = /* @__PURE__ */ __name((fn2, ...args) => new Promise((
|
|
118201
|
-
enqueue(fn2,
|
|
118200
|
+
const generator = /* @__PURE__ */ __name((fn2, ...args) => new Promise((resolve18) => {
|
|
118201
|
+
enqueue(fn2, resolve18, args);
|
|
118202
118202
|
}), "generator");
|
|
118203
118203
|
Object.defineProperties(generator, {
|
|
118204
118204
|
activeCount: {
|
|
@@ -119568,7 +119568,7 @@ var import_undici3 = __toESM(require_undici());
|
|
|
119568
119568
|
var import_undici4 = __toESM(require_undici());
|
|
119569
119569
|
|
|
119570
119570
|
// package.json
|
|
119571
|
-
var version = "3.
|
|
119571
|
+
var version = "3.4.0";
|
|
119572
119572
|
var package_default = {
|
|
119573
119573
|
name: "wrangler",
|
|
119574
119574
|
version,
|
|
@@ -119674,7 +119674,7 @@ var package_default = {
|
|
|
119674
119674
|
"blake3-wasm": "^2.1.5",
|
|
119675
119675
|
chokidar: "^3.5.3",
|
|
119676
119676
|
esbuild: "0.16.3",
|
|
119677
|
-
miniflare: "3.
|
|
119677
|
+
miniflare: "3.20230724.0",
|
|
119678
119678
|
nanoid: "^3.3.3",
|
|
119679
119679
|
"path-to-regexp": "^6.2.0",
|
|
119680
119680
|
selfsigned: "^2.0.1",
|
|
@@ -119685,7 +119685,7 @@ var package_default = {
|
|
|
119685
119685
|
"@cloudflare/eslint-config-worker": "*",
|
|
119686
119686
|
"@cloudflare/types": "^6.18.4",
|
|
119687
119687
|
"@cloudflare/workers-tsconfig": "*",
|
|
119688
|
-
"@cloudflare/workers-types": "^4.
|
|
119688
|
+
"@cloudflare/workers-types": "^4.20230724.0",
|
|
119689
119689
|
"@iarna/toml": "^3.0.0",
|
|
119690
119690
|
"@microsoft/api-extractor": "^7.28.3",
|
|
119691
119691
|
"@types/better-sqlite3": "^7.6.0",
|
|
@@ -120096,7 +120096,7 @@ async function getAccessToken(domain) {
|
|
|
120096
120096
|
if (cache[domain]) {
|
|
120097
120097
|
return cache[domain];
|
|
120098
120098
|
}
|
|
120099
|
-
const output =
|
|
120099
|
+
const output = (0, import_child_process.spawnSync)("cloudflared", ["access", "login", domain]);
|
|
120100
120100
|
if (output.error) {
|
|
120101
120101
|
throw new Error(
|
|
120102
120102
|
"To use Wrangler with Cloudflare Access, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
|
|
@@ -120653,17 +120653,17 @@ async function login(props = { browser: true }) {
|
|
|
120653
120653
|
const urlToOpen = await getAuthURL(props?.scopes);
|
|
120654
120654
|
let server2;
|
|
120655
120655
|
let loginTimeoutHandle;
|
|
120656
|
-
const timerPromise = new Promise((
|
|
120656
|
+
const timerPromise = new Promise((resolve18) => {
|
|
120657
120657
|
loginTimeoutHandle = setTimeout(() => {
|
|
120658
120658
|
logger.error(
|
|
120659
120659
|
"Timed out waiting for authorization code, please try again."
|
|
120660
120660
|
);
|
|
120661
120661
|
server2.close();
|
|
120662
120662
|
clearTimeout(loginTimeoutHandle);
|
|
120663
|
-
|
|
120663
|
+
resolve18(false);
|
|
120664
120664
|
}, 12e4);
|
|
120665
120665
|
});
|
|
120666
|
-
const loginPromise = new Promise((
|
|
120666
|
+
const loginPromise = new Promise((resolve18, reject) => {
|
|
120667
120667
|
server2 = import_node_http.default.createServer(async (req, res) => {
|
|
120668
120668
|
function finish(status, error) {
|
|
120669
120669
|
clearTimeout(loginTimeoutHandle);
|
|
@@ -120671,7 +120671,7 @@ async function login(props = { browser: true }) {
|
|
|
120671
120671
|
if (error || closeErr) {
|
|
120672
120672
|
reject(error || closeErr);
|
|
120673
120673
|
} else
|
|
120674
|
-
|
|
120674
|
+
resolve18(status);
|
|
120675
120675
|
});
|
|
120676
120676
|
}
|
|
120677
120677
|
__name(finish, "finish");
|
|
@@ -122571,17 +122571,6 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
|
|
|
122571
122571
|
validateTailConsumers,
|
|
122572
122572
|
void 0
|
|
122573
122573
|
),
|
|
122574
|
-
logfwdr: inheritable(
|
|
122575
|
-
diagnostics,
|
|
122576
|
-
topLevelEnv,
|
|
122577
|
-
rawEnv,
|
|
122578
|
-
"logfwdr",
|
|
122579
|
-
validateBindingsProperty(envName, validateCflogfwdrBinding),
|
|
122580
|
-
{
|
|
122581
|
-
schema: void 0,
|
|
122582
|
-
bindings: []
|
|
122583
|
-
}
|
|
122584
|
-
),
|
|
122585
122574
|
unsafe: notInheritable(
|
|
122586
122575
|
diagnostics,
|
|
122587
122576
|
topLevelEnv,
|
|
@@ -122603,6 +122592,16 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
|
|
|
122603
122592
|
void 0
|
|
122604
122593
|
),
|
|
122605
122594
|
zone_id: rawEnv.zone_id,
|
|
122595
|
+
logfwdr: inheritable(
|
|
122596
|
+
diagnostics,
|
|
122597
|
+
topLevelEnv,
|
|
122598
|
+
rawEnv,
|
|
122599
|
+
"logfwdr",
|
|
122600
|
+
validateCflogfwdrObject(envName),
|
|
122601
|
+
{
|
|
122602
|
+
bindings: []
|
|
122603
|
+
}
|
|
122604
|
+
),
|
|
122606
122605
|
no_bundle: inheritable(
|
|
122607
122606
|
diagnostics,
|
|
122608
122607
|
topLevelEnv,
|
|
@@ -122880,9 +122879,9 @@ var validateUnsafeSettings = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
122880
122879
|
);
|
|
122881
122880
|
return false;
|
|
122882
122881
|
}
|
|
122883
|
-
if (!hasProperty(value, "bindings") && !hasProperty(value, "metadata")) {
|
|
122882
|
+
if (!hasProperty(value, "bindings") && !hasProperty(value, "metadata") && !hasProperty(value, "capnp")) {
|
|
122884
122883
|
diagnostics.errors.push(
|
|
122885
|
-
`The field "${fieldPath}" should contain at least one of "bindings" or "
|
|
122884
|
+
`The field "${fieldPath}" should contain at least one of "bindings", "metadata" or "capnp" properties but got ${JSON.stringify(
|
|
122886
122885
|
value
|
|
122887
122886
|
)}.`
|
|
122888
122887
|
);
|
|
@@ -122906,6 +122905,48 @@ var validateUnsafeSettings = /* @__PURE__ */ __name((envName) => (diagnostics, f
|
|
|
122906
122905
|
);
|
|
122907
122906
|
return false;
|
|
122908
122907
|
}
|
|
122908
|
+
if (hasProperty(value, "capnp") && value.capnp !== void 0) {
|
|
122909
|
+
if (typeof value.capnp !== "object" || value.capnp === null || Array.isArray(value.capnp)) {
|
|
122910
|
+
diagnostics.errors.push(
|
|
122911
|
+
`The field "${fieldPath}.capnp" should be an object but got ${JSON.stringify(
|
|
122912
|
+
value.capnp
|
|
122913
|
+
)}.`
|
|
122914
|
+
);
|
|
122915
|
+
return false;
|
|
122916
|
+
}
|
|
122917
|
+
if (hasProperty(value.capnp, "compiled_schema")) {
|
|
122918
|
+
if (hasProperty(value.capnp, "base_path") || hasProperty(value.capnp, "source_schemas")) {
|
|
122919
|
+
diagnostics.errors.push(
|
|
122920
|
+
`The field "${fieldPath}.capnp" cannot contain both "compiled_schema" and one of "base_path" or "source_schemas".`
|
|
122921
|
+
);
|
|
122922
|
+
return false;
|
|
122923
|
+
}
|
|
122924
|
+
if (typeof value.capnp.compiled_schema !== "string") {
|
|
122925
|
+
diagnostics.errors.push(
|
|
122926
|
+
`The field "${fieldPath}.capnp.compiled_schema", when present, should be a string but got ${JSON.stringify(
|
|
122927
|
+
value.capnp.compiled_schema
|
|
122928
|
+
)}.`
|
|
122929
|
+
);
|
|
122930
|
+
return false;
|
|
122931
|
+
}
|
|
122932
|
+
} else {
|
|
122933
|
+
if (!isRequiredProperty(value.capnp, "base_path", "string")) {
|
|
122934
|
+
diagnostics.errors.push(
|
|
122935
|
+
`The field "${fieldPath}.capnp.base_path", when present, should be a string but got ${JSON.stringify(
|
|
122936
|
+
value.capnp.base_path
|
|
122937
|
+
)}`
|
|
122938
|
+
);
|
|
122939
|
+
}
|
|
122940
|
+
if (!validateTypedArray(
|
|
122941
|
+
diagnostics,
|
|
122942
|
+
`${fieldPath}.capnp.source_schemas`,
|
|
122943
|
+
value.capnp.source_schemas,
|
|
122944
|
+
"string"
|
|
122945
|
+
)) {
|
|
122946
|
+
return false;
|
|
122947
|
+
}
|
|
122948
|
+
}
|
|
122949
|
+
}
|
|
122909
122950
|
return true;
|
|
122910
122951
|
}, "validateUnsafeSettings");
|
|
122911
122952
|
var validateDurableObjectBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
@@ -122944,6 +122985,22 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name((diagnostics, field, v
|
|
|
122944
122985
|
}
|
|
122945
122986
|
return isValid;
|
|
122946
122987
|
}, "validateDurableObjectBinding");
|
|
122988
|
+
var validateCflogfwdrObject = /* @__PURE__ */ __name((envName) => (diagnostics, field, value, topLevelEnv) => {
|
|
122989
|
+
const bindingsValidation = validateBindingsProperty(
|
|
122990
|
+
envName,
|
|
122991
|
+
validateCflogfwdrBinding
|
|
122992
|
+
);
|
|
122993
|
+
if (!bindingsValidation(diagnostics, field, value, topLevelEnv))
|
|
122994
|
+
return false;
|
|
122995
|
+
const v = value;
|
|
122996
|
+
if (v?.schema !== void 0) {
|
|
122997
|
+
diagnostics.errors.push(
|
|
122998
|
+
`"${field}" binding "schema" property has been replaced with the "unsafe.capnp" object, which expects a "base_path" and an array of "source_schemas" to compile, or a "compiled_schema" property.`
|
|
122999
|
+
);
|
|
123000
|
+
return false;
|
|
123001
|
+
}
|
|
123002
|
+
return true;
|
|
123003
|
+
}, "validateCflogfwdrObject");
|
|
122947
123004
|
var validateCflogfwdrBinding = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
122948
123005
|
if (typeof value !== "object" || value === null) {
|
|
122949
123006
|
diagnostics.errors.push(
|
|
@@ -125387,7 +125444,7 @@ var setupTimeout = /* @__PURE__ */ __name((spawned, { timeout, killSignal = "SIG
|
|
|
125387
125444
|
return spawnedPromise;
|
|
125388
125445
|
}
|
|
125389
125446
|
let timeoutId;
|
|
125390
|
-
const timeoutPromise = new Promise((
|
|
125447
|
+
const timeoutPromise = new Promise((resolve18, reject) => {
|
|
125391
125448
|
timeoutId = setTimeout(() => {
|
|
125392
125449
|
timeoutKill(spawned, killSignal, reject);
|
|
125393
125450
|
}, timeout);
|
|
@@ -125506,9 +125563,9 @@ var mergePromise = /* @__PURE__ */ __name((spawned, promise) => {
|
|
|
125506
125563
|
}
|
|
125507
125564
|
return spawned;
|
|
125508
125565
|
}, "mergePromise");
|
|
125509
|
-
var getSpawnedPromise = /* @__PURE__ */ __name((spawned) => new Promise((
|
|
125566
|
+
var getSpawnedPromise = /* @__PURE__ */ __name((spawned) => new Promise((resolve18, reject) => {
|
|
125510
125567
|
spawned.on("exit", (exitCode, signal) => {
|
|
125511
|
-
|
|
125568
|
+
resolve18({ exitCode, signal });
|
|
125512
125569
|
});
|
|
125513
125570
|
spawned.on("error", (error) => {
|
|
125514
125571
|
reject(error);
|
|
@@ -125907,7 +125964,7 @@ __name(generateAddScriptNameExamples, "generateAddScriptNameExamples");
|
|
|
125907
125964
|
|
|
125908
125965
|
// src/dev/dev.tsx
|
|
125909
125966
|
init_import_meta_url();
|
|
125910
|
-
var
|
|
125967
|
+
var import_node_child_process6 = require("node:child_process");
|
|
125911
125968
|
var path41 = __toESM(require("node:path"));
|
|
125912
125969
|
var util = __toESM(require("node:util"));
|
|
125913
125970
|
var import_chokidar4 = require("chokidar");
|
|
@@ -126090,7 +126147,7 @@ clipboard5.readSync = () => platformLib.pasteSync({ stripFinalNewline: false });
|
|
|
126090
126147
|
var clipboardy_default = clipboard5;
|
|
126091
126148
|
|
|
126092
126149
|
// src/dev/dev.tsx
|
|
126093
|
-
var
|
|
126150
|
+
var import_command_exists2 = __toESM(require_command_exists2());
|
|
126094
126151
|
var import_ink12 = __toESM(require_build2());
|
|
126095
126152
|
var import_react19 = __toESM(require_react());
|
|
126096
126153
|
|
|
@@ -126236,17 +126293,17 @@ var DEV_REGISTRY_HOST = `http://localhost:${DEV_REGISTRY_PORT}`;
|
|
|
126236
126293
|
var server;
|
|
126237
126294
|
var terminator;
|
|
126238
126295
|
async function isPortAvailable() {
|
|
126239
|
-
return new Promise((
|
|
126296
|
+
return new Promise((resolve18, reject) => {
|
|
126240
126297
|
const netServer = import_net.default.createServer().once("error", (err) => {
|
|
126241
126298
|
netServer.close();
|
|
126242
126299
|
if (err.code === "EADDRINUSE") {
|
|
126243
|
-
|
|
126300
|
+
resolve18(false);
|
|
126244
126301
|
} else {
|
|
126245
126302
|
reject(err);
|
|
126246
126303
|
}
|
|
126247
126304
|
}).once("listening", () => {
|
|
126248
126305
|
netServer.close();
|
|
126249
|
-
|
|
126306
|
+
resolve18(true);
|
|
126250
126307
|
});
|
|
126251
126308
|
netServer.listen(DEV_REGISTRY_PORT);
|
|
126252
126309
|
});
|
|
@@ -126880,7 +126937,7 @@ function createStreamHandler(previewToken, remote, localPort, localProtocol, acc
|
|
|
126880
126937
|
}
|
|
126881
126938
|
__name(createStreamHandler, "createStreamHandler");
|
|
126882
126939
|
async function waitForPortToBeAvailable(port2, options14) {
|
|
126883
|
-
return new Promise((
|
|
126940
|
+
return new Promise((resolve18, reject) => {
|
|
126884
126941
|
options14.abortSignal.addEventListener("abort", () => {
|
|
126885
126942
|
const abortError = new Error("waitForPortToBeAvailable() aborted");
|
|
126886
126943
|
abortError.code = "ABORT_ERR";
|
|
@@ -126894,7 +126951,7 @@ async function waitForPortToBeAvailable(port2, options14) {
|
|
|
126894
126951
|
function doResolve() {
|
|
126895
126952
|
clearTimeout(timeout);
|
|
126896
126953
|
clearInterval(interval2);
|
|
126897
|
-
|
|
126954
|
+
resolve18();
|
|
126898
126955
|
}
|
|
126899
126956
|
__name(doResolve, "doResolve");
|
|
126900
126957
|
function doReject(err) {
|
|
@@ -128014,7 +128071,7 @@ __name(useLocalWorker, "useLocalWorker");
|
|
|
128014
128071
|
// src/dev/remote.tsx
|
|
128015
128072
|
init_import_meta_url();
|
|
128016
128073
|
var import_promises16 = require("node:fs/promises");
|
|
128017
|
-
var
|
|
128074
|
+
var import_node_path43 = __toESM(require("node:path"));
|
|
128018
128075
|
var import_ink10 = __toESM(require_build2());
|
|
128019
128076
|
var import_ink_select_input3 = __toESM(require_build3());
|
|
128020
128077
|
var import_react17 = __toESM(require_react());
|
|
@@ -128026,8 +128083,44 @@ var import_undici8 = __toESM(require_undici());
|
|
|
128026
128083
|
|
|
128027
128084
|
// src/deployment-bundle/create-worker-upload-form.ts
|
|
128028
128085
|
init_import_meta_url();
|
|
128029
|
-
var
|
|
128086
|
+
var import_node_fs10 = require("node:fs");
|
|
128030
128087
|
var import_undici7 = __toESM(require_undici());
|
|
128088
|
+
|
|
128089
|
+
// src/deployment-bundle/capnp.ts
|
|
128090
|
+
init_import_meta_url();
|
|
128091
|
+
var import_node_child_process2 = require("node:child_process");
|
|
128092
|
+
var import_node_fs9 = require("node:fs");
|
|
128093
|
+
var import_node_path19 = require("node:path");
|
|
128094
|
+
var import_command_exists = __toESM(require_command_exists2());
|
|
128095
|
+
function handleUnsafeCapnp(capnp) {
|
|
128096
|
+
if (capnp.compiled_schema) {
|
|
128097
|
+
return (0, import_node_fs9.readFileSync)((0, import_node_path19.resolve)(capnp.compiled_schema));
|
|
128098
|
+
}
|
|
128099
|
+
const { base_path, source_schemas } = capnp;
|
|
128100
|
+
const capnpSchemas = (source_schemas ?? []).map(
|
|
128101
|
+
(x) => (0, import_node_path19.resolve)(base_path, x)
|
|
128102
|
+
);
|
|
128103
|
+
if (!(0, import_command_exists.sync)("capnp")) {
|
|
128104
|
+
throw new Error(
|
|
128105
|
+
"The capnp compiler is required to upload capnp schemas, but is not present."
|
|
128106
|
+
);
|
|
128107
|
+
}
|
|
128108
|
+
const srcPrefix = (0, import_node_path19.resolve)(base_path ?? ".");
|
|
128109
|
+
const capnpProcess = (0, import_node_child_process2.spawnSync)("capnp", [
|
|
128110
|
+
"compile",
|
|
128111
|
+
"-o-",
|
|
128112
|
+
`--src-prefix=${srcPrefix}`,
|
|
128113
|
+
...capnpSchemas
|
|
128114
|
+
]);
|
|
128115
|
+
if (capnpProcess.error)
|
|
128116
|
+
throw capnpProcess.error;
|
|
128117
|
+
if (capnpProcess.stderr.length)
|
|
128118
|
+
throw new Error(capnpProcess.stderr.toString());
|
|
128119
|
+
return capnpProcess.stdout;
|
|
128120
|
+
}
|
|
128121
|
+
__name(handleUnsafeCapnp, "handleUnsafeCapnp");
|
|
128122
|
+
|
|
128123
|
+
// src/deployment-bundle/create-worker-upload-form.ts
|
|
128031
128124
|
function toMimeType(type) {
|
|
128032
128125
|
switch (type) {
|
|
128033
128126
|
case "esm":
|
|
@@ -128180,7 +128273,7 @@ function createWorkerUploadForm(worker) {
|
|
|
128180
128273
|
});
|
|
128181
128274
|
formData.set(
|
|
128182
128275
|
name,
|
|
128183
|
-
new import_undici7.File([(0,
|
|
128276
|
+
new import_undici7.File([(0, import_node_fs10.readFileSync)(filePath)], filePath, {
|
|
128184
128277
|
type: "application/wasm"
|
|
128185
128278
|
})
|
|
128186
128279
|
);
|
|
@@ -128200,7 +128293,7 @@ function createWorkerUploadForm(worker) {
|
|
|
128200
128293
|
if (name !== "__STATIC_CONTENT_MANIFEST") {
|
|
128201
128294
|
formData.set(
|
|
128202
128295
|
name,
|
|
128203
|
-
new import_undici7.File([(0,
|
|
128296
|
+
new import_undici7.File([(0, import_node_fs10.readFileSync)(filePath)], filePath, {
|
|
128204
128297
|
type: "text/plain"
|
|
128205
128298
|
})
|
|
128206
128299
|
);
|
|
@@ -128214,7 +128307,7 @@ function createWorkerUploadForm(worker) {
|
|
|
128214
128307
|
});
|
|
128215
128308
|
formData.set(
|
|
128216
128309
|
name,
|
|
128217
|
-
new import_undici7.File([(0,
|
|
128310
|
+
new import_undici7.File([(0, import_node_fs10.readFileSync)(filePath)], filePath, {
|
|
128218
128311
|
type: "application/octet-stream"
|
|
128219
128312
|
})
|
|
128220
128313
|
);
|
|
@@ -128249,6 +128342,17 @@ function createWorkerUploadForm(worker) {
|
|
|
128249
128342
|
if (bindings.unsafe?.bindings) {
|
|
128250
128343
|
metadataBindings.push(...bindings.unsafe.bindings);
|
|
128251
128344
|
}
|
|
128345
|
+
let capnpSchemaOutputFile;
|
|
128346
|
+
if (bindings.unsafe?.capnp) {
|
|
128347
|
+
const capnpOutput = handleUnsafeCapnp(bindings.unsafe.capnp);
|
|
128348
|
+
capnpSchemaOutputFile = `./capnp-${Date.now()}.compiled`;
|
|
128349
|
+
formData.set(
|
|
128350
|
+
capnpSchemaOutputFile,
|
|
128351
|
+
new import_undici7.File([capnpOutput], capnpSchemaOutputFile, {
|
|
128352
|
+
type: "application/octet-stream"
|
|
128353
|
+
})
|
|
128354
|
+
);
|
|
128355
|
+
}
|
|
128252
128356
|
const metadata = {
|
|
128253
128357
|
...main2.type !== "commonjs" ? { main_module: main2.name } : { body_part: main2.name },
|
|
128254
128358
|
bindings: metadataBindings,
|
|
@@ -128256,7 +128360,7 @@ function createWorkerUploadForm(worker) {
|
|
|
128256
128360
|
...compatibility_flags && { compatibility_flags },
|
|
128257
128361
|
...usage_model && { usage_model },
|
|
128258
128362
|
...migrations && { migrations },
|
|
128259
|
-
capnp_schema:
|
|
128363
|
+
capnp_schema: capnpSchemaOutputFile,
|
|
128260
128364
|
...keepVars && { keep_bindings: ["plain_text", "json"] },
|
|
128261
128365
|
...logpush !== void 0 && { logpush },
|
|
128262
128366
|
...placement && { placement },
|
|
@@ -128281,15 +128385,6 @@ function createWorkerUploadForm(worker) {
|
|
|
128281
128385
|
})
|
|
128282
128386
|
);
|
|
128283
128387
|
}
|
|
128284
|
-
if (bindings.logfwdr && bindings.logfwdr.schema) {
|
|
128285
|
-
const filePath = bindings.logfwdr.schema;
|
|
128286
|
-
formData.set(
|
|
128287
|
-
filePath,
|
|
128288
|
-
new import_undici7.File([(0, import_node_fs9.readFileSync)(filePath)], filePath, {
|
|
128289
|
-
type: "application/octet-stream"
|
|
128290
|
-
})
|
|
128291
|
-
);
|
|
128292
|
-
}
|
|
128293
128388
|
return formData;
|
|
128294
128389
|
}
|
|
128295
128390
|
__name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
@@ -128418,8 +128513,8 @@ __name(createWorkerPreview, "createWorkerPreview");
|
|
|
128418
128513
|
// src/deploy/deploy.ts
|
|
128419
128514
|
init_import_meta_url();
|
|
128420
128515
|
var import_node_assert13 = __toESM(require("node:assert"));
|
|
128421
|
-
var
|
|
128422
|
-
var
|
|
128516
|
+
var import_node_fs26 = require("node:fs");
|
|
128517
|
+
var import_node_path42 = __toESM(require("node:path"));
|
|
128423
128518
|
var import_node_url11 = require("node:url");
|
|
128424
128519
|
var import_chalk13 = __toESM(require_chalk());
|
|
128425
128520
|
var import_tmp_promise2 = __toESM(require_tmp_promise());
|
|
@@ -128474,16 +128569,16 @@ __name(printOffendingDependencies, "printOffendingDependencies");
|
|
|
128474
128569
|
// src/deployment-bundle/traverse-module-graph.ts
|
|
128475
128570
|
init_import_meta_url();
|
|
128476
128571
|
var import_promises4 = require("node:fs/promises");
|
|
128477
|
-
var
|
|
128572
|
+
var import_node_path20 = __toESM(require("node:path"));
|
|
128478
128573
|
var import_chalk5 = __toESM(require_chalk());
|
|
128479
128574
|
async function getFiles(root, relativeTo) {
|
|
128480
128575
|
const files = [];
|
|
128481
128576
|
for (const file of await (0, import_promises4.readdir)(root, { withFileTypes: true })) {
|
|
128482
128577
|
if (file.isDirectory()) {
|
|
128483
|
-
files.push(...await getFiles(
|
|
128578
|
+
files.push(...await getFiles(import_node_path20.default.join(root, file.name), relativeTo));
|
|
128484
128579
|
} else {
|
|
128485
128580
|
files.push(
|
|
128486
|
-
|
|
128581
|
+
import_node_path20.default.relative(relativeTo, import_node_path20.default.join(root, file.name)).replaceAll("\\", "/")
|
|
128487
128582
|
);
|
|
128488
128583
|
}
|
|
128489
128584
|
}
|
|
@@ -128492,7 +128587,7 @@ async function getFiles(root, relativeTo) {
|
|
|
128492
128587
|
__name(getFiles, "getFiles");
|
|
128493
128588
|
async function traverseModuleGraph(entry, rules) {
|
|
128494
128589
|
const files = await getFiles(entry.moduleRoot, entry.moduleRoot);
|
|
128495
|
-
const relativeEntryPoint =
|
|
128590
|
+
const relativeEntryPoint = import_node_path20.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
|
|
128496
128591
|
const modules = (await matchFiles(files, entry.moduleRoot, parseRules(rules))).filter((m) => m.name !== relativeEntryPoint).map((m) => ({
|
|
128497
128592
|
...m,
|
|
128498
128593
|
name: m.name
|
|
@@ -128528,14 +128623,14 @@ var import_undici16 = __toESM(require_undici());
|
|
|
128528
128623
|
init_import_meta_url();
|
|
128529
128624
|
var fs17 = __toESM(require("node:fs"));
|
|
128530
128625
|
var import_promises15 = require("node:fs/promises");
|
|
128531
|
-
var
|
|
128626
|
+
var import_node_path41 = __toESM(require("node:path"));
|
|
128532
128627
|
var import_toml5 = __toESM(require_toml());
|
|
128533
128628
|
|
|
128534
128629
|
// src/git-client.ts
|
|
128535
128630
|
init_import_meta_url();
|
|
128536
|
-
var
|
|
128631
|
+
var import_node_fs11 = __toESM(require("node:fs"));
|
|
128537
128632
|
var import_node_os7 = __toESM(require("node:os"));
|
|
128538
|
-
var
|
|
128633
|
+
var import_node_path21 = __toESM(require("node:path"));
|
|
128539
128634
|
|
|
128540
128635
|
// ../../node_modules/semiver/dist/semiver.mjs
|
|
128541
128636
|
init_import_meta_url();
|
|
@@ -128604,8 +128699,8 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
|
128604
128699
|
args.push("-b", remote.substring(tagIndex + 1));
|
|
128605
128700
|
args.push(remote.substring(0, tagIndex));
|
|
128606
128701
|
}
|
|
128607
|
-
const tempDir =
|
|
128608
|
-
|
|
128702
|
+
const tempDir = import_node_fs11.default.mkdtempSync(
|
|
128703
|
+
import_node_path21.default.join(import_node_os7.default.tmpdir(), `wrangler-generate-repo-`)
|
|
128609
128704
|
);
|
|
128610
128705
|
args.push(tempDir);
|
|
128611
128706
|
await execa("git", args);
|
|
@@ -128614,17 +128709,17 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
|
128614
128709
|
cwd: tempDir
|
|
128615
128710
|
});
|
|
128616
128711
|
}
|
|
128617
|
-
const templatePath = subdirectory !== void 0 ?
|
|
128712
|
+
const templatePath = subdirectory !== void 0 ? import_node_path21.default.join(tempDir, subdirectory) : tempDir;
|
|
128618
128713
|
try {
|
|
128619
|
-
|
|
128714
|
+
import_node_fs11.default.renameSync(templatePath, targetDirectory);
|
|
128620
128715
|
} catch (err) {
|
|
128621
128716
|
if (err.code !== "EXDEV") {
|
|
128622
128717
|
logger.debug(err);
|
|
128623
128718
|
throw new Error(`Failed to find "${subdirectory}" in ${remote}`);
|
|
128624
128719
|
}
|
|
128625
128720
|
try {
|
|
128626
|
-
|
|
128627
|
-
|
|
128721
|
+
import_node_fs11.default.cpSync(templatePath, targetDirectory, { recursive: true });
|
|
128722
|
+
import_node_fs11.default.rmSync(templatePath, {
|
|
128628
128723
|
recursive: true,
|
|
128629
128724
|
force: true
|
|
128630
128725
|
});
|
|
@@ -128633,7 +128728,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
|
128633
128728
|
throw new Error(`Failed to find "${subdirectory}" in ${remote}`);
|
|
128634
128729
|
}
|
|
128635
128730
|
}
|
|
128636
|
-
|
|
128731
|
+
import_node_fs11.default.rmSync(import_node_path21.default.join(targetDirectory, ".git"), {
|
|
128637
128732
|
recursive: true,
|
|
128638
128733
|
force: true
|
|
128639
128734
|
});
|
|
@@ -128642,8 +128737,8 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
|
|
|
128642
128737
|
|
|
128643
128738
|
// src/package-manager.ts
|
|
128644
128739
|
init_import_meta_url();
|
|
128645
|
-
var
|
|
128646
|
-
var
|
|
128740
|
+
var import_node_fs12 = require("node:fs");
|
|
128741
|
+
var import_node_path22 = require("node:path");
|
|
128647
128742
|
var import_node_process5 = require("node:process");
|
|
128648
128743
|
async function getPackageManager(cwd2) {
|
|
128649
128744
|
const [hasYarn, hasNpm, hasPnpm] = await Promise.all([
|
|
@@ -128651,9 +128746,9 @@ async function getPackageManager(cwd2) {
|
|
|
128651
128746
|
supportsNpm(),
|
|
128652
128747
|
supportsPnpm()
|
|
128653
128748
|
]);
|
|
128654
|
-
const hasYarnLock = (0,
|
|
128655
|
-
const hasNpmLock = (0,
|
|
128656
|
-
const hasPnpmLock = (0,
|
|
128749
|
+
const hasYarnLock = (0, import_node_fs12.existsSync)((0, import_node_path22.join)(cwd2, "yarn.lock"));
|
|
128750
|
+
const hasNpmLock = (0, import_node_fs12.existsSync)((0, import_node_path22.join)(cwd2, "package-lock.json"));
|
|
128751
|
+
const hasPnpmLock = (0, import_node_fs12.existsSync)((0, import_node_path22.join)(cwd2, "pnpm-lock.yaml"));
|
|
128657
128752
|
const userAgent = sniffUserAgent();
|
|
128658
128753
|
if (hasNpmLock) {
|
|
128659
128754
|
if (hasNpm) {
|
|
@@ -131194,12 +131289,12 @@ var YargsInstance = class {
|
|
|
131194
131289
|
async getCompletion(args, done) {
|
|
131195
131290
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
131196
131291
|
if (!done) {
|
|
131197
|
-
return new Promise((
|
|
131292
|
+
return new Promise((resolve18, reject) => {
|
|
131198
131293
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
131199
131294
|
if (err)
|
|
131200
131295
|
reject(err);
|
|
131201
131296
|
else
|
|
131202
|
-
|
|
131297
|
+
resolve18(completions);
|
|
131203
131298
|
});
|
|
131204
131299
|
});
|
|
131205
131300
|
} else {
|
|
@@ -132486,7 +132581,7 @@ var handler8 = withConfig(
|
|
|
132486
132581
|
|
|
132487
132582
|
// src/constellation/uploadModel.tsx
|
|
132488
132583
|
init_import_meta_url();
|
|
132489
|
-
var
|
|
132584
|
+
var import_node_fs13 = require("node:fs");
|
|
132490
132585
|
var import_undici9 = __toESM(require_undici());
|
|
132491
132586
|
function options8(yargs) {
|
|
132492
132587
|
return yargs.positional("projectName", {
|
|
@@ -132523,7 +132618,7 @@ var handler9 = withConfig(
|
|
|
132523
132618
|
const formData = new import_undici9.FormData();
|
|
132524
132619
|
formData.set(
|
|
132525
132620
|
"file",
|
|
132526
|
-
new import_undici9.File([(0,
|
|
132621
|
+
new import_undici9.File([(0, import_node_fs13.readFileSync)(modelFile)], modelFile, {
|
|
132527
132622
|
type: "application/octet-stream"
|
|
132528
132623
|
})
|
|
132529
132624
|
);
|
|
@@ -135465,6 +135560,16 @@ var getDatabaseByNameOrBinding = /* @__PURE__ */ __name(async (config, accountId
|
|
|
135465
135560
|
return matchingDB;
|
|
135466
135561
|
}, "getDatabaseByNameOrBinding");
|
|
135467
135562
|
var d1BetaWarning = process.env.NO_D1_WARNING ? "" : "--------------------\n\u{1F6A7} D1 is currently in open alpha and is not recommended for production data and traffic\n\u{1F6A7} Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose\n\u{1F6A7} To request features, visit https://community.cloudflare.com/c/developers/d1\n\u{1F6A7} To give feedback, visit https://discord.gg/cloudflaredev\n--------------------\n";
|
|
135563
|
+
var getDatabaseInfoFromId = /* @__PURE__ */ __name(async (accountId, databaseId) => {
|
|
135564
|
+
return await fetchResult(
|
|
135565
|
+
`/accounts/${accountId}/d1/database/${databaseId}`,
|
|
135566
|
+
{
|
|
135567
|
+
headers: {
|
|
135568
|
+
"Content-Type": "application/json"
|
|
135569
|
+
}
|
|
135570
|
+
}
|
|
135571
|
+
);
|
|
135572
|
+
}, "getDatabaseInfoFromId");
|
|
135468
135573
|
|
|
135469
135574
|
// src/d1/options.ts
|
|
135470
135575
|
function Name(yargs) {
|
|
@@ -135657,18 +135762,14 @@ function Options2(yargs) {
|
|
|
135657
135762
|
}).option("location", {
|
|
135658
135763
|
describe: "A hint for the primary location of the new DB. Options:\nweur: Western Europe\neeur: Eastern Europe\napac: Asia Pacific\nwnam: Western North America\nenam: Eastern North America \n",
|
|
135659
135764
|
type: "string"
|
|
135660
|
-
}).option("experimental-backend", {
|
|
135661
|
-
default: false,
|
|
135662
|
-
describe: "Use new experimental DB backend",
|
|
135663
|
-
type: "boolean"
|
|
135664
135765
|
}).epilogue(d1BetaWarning);
|
|
135665
135766
|
}
|
|
135666
135767
|
__name(Options2, "Options");
|
|
135667
135768
|
var Handler2 = withConfig(
|
|
135668
|
-
async ({ name, config, location
|
|
135769
|
+
async ({ name, config, location }) => {
|
|
135669
135770
|
const accountId = await requireAuth(config);
|
|
135670
135771
|
logger.log(d1BetaWarning);
|
|
135671
|
-
if (
|
|
135772
|
+
if (location) {
|
|
135672
135773
|
if (LOCATION_CHOICES.indexOf(location.toLowerCase()) === -1) {
|
|
135673
135774
|
throw new Error(
|
|
135674
135775
|
`Location '${location}' invalid. Valid values are ${LOCATION_CHOICES.join(
|
|
@@ -135686,8 +135787,8 @@ var Handler2 = withConfig(
|
|
|
135686
135787
|
},
|
|
135687
135788
|
body: JSON.stringify({
|
|
135688
135789
|
name,
|
|
135689
|
-
|
|
135690
|
-
...
|
|
135790
|
+
experimental: true,
|
|
135791
|
+
...location && { primary_location_hint: location }
|
|
135691
135792
|
})
|
|
135692
135793
|
});
|
|
135693
135794
|
} catch (e2) {
|
|
@@ -135698,7 +135799,7 @@ var Handler2 = withConfig(
|
|
|
135698
135799
|
}
|
|
135699
135800
|
logger.log(
|
|
135700
135801
|
renderToString(
|
|
135701
|
-
/* @__PURE__ */ import_react6.default.createElement(import_ink2.Box, { flexDirection: "column" }, /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, "\u2705 Successfully created DB '", db.name, "'", db.created_in_region ? ` in region ${db.created_in_region}` : location ? ` using primary location hint ${location}` : ``),
|
|
135802
|
+
/* @__PURE__ */ import_react6.default.createElement(import_ink2.Box, { flexDirection: "column" }, /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, "\u2705 Successfully created DB '", db.name, "'", db.created_in_region ? ` in region ${db.created_in_region}` : location ? ` using primary location hint ${location}` : ``), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, "Created your database using D1's new storage backend. The new storage backend is not yet recommended for production workloads, but backs up your data via point-in-time restore."), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, "\xA0"), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, "[[d1_databases]]"), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, 'binding = "DB" # i.e. available in your Worker on env.DB'), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, 'database_name = "', db.name, '"'), /* @__PURE__ */ import_react6.default.createElement(import_ink2.Text, null, 'database_id = "', db.uuid, '"'))
|
|
135702
135803
|
)
|
|
135703
135804
|
);
|
|
135704
135805
|
}
|
|
@@ -135743,9 +135844,9 @@ var Handler3 = withConfig(
|
|
|
135743
135844
|
// src/d1/execute.tsx
|
|
135744
135845
|
init_import_meta_url();
|
|
135745
135846
|
var import_node_assert8 = __toESM(require("node:assert"));
|
|
135746
|
-
var
|
|
135847
|
+
var import_node_fs14 = require("node:fs");
|
|
135747
135848
|
var import_promises6 = require("node:fs/promises");
|
|
135748
|
-
var
|
|
135849
|
+
var import_node_path24 = __toESM(require("node:path"));
|
|
135749
135850
|
var import_chalk6 = __toESM(require_chalk());
|
|
135750
135851
|
var import_ink3 = __toESM(require_build2());
|
|
135751
135852
|
var import_ink_table3 = __toESM(require_dist3());
|
|
@@ -135753,10 +135854,10 @@ var import_react7 = __toESM(require_react());
|
|
|
135753
135854
|
|
|
135754
135855
|
// src/dev/get-local-persistence-path.ts
|
|
135755
135856
|
init_import_meta_url();
|
|
135756
|
-
var
|
|
135857
|
+
var import_node_path23 = __toESM(require("node:path"));
|
|
135757
135858
|
function getLocalPersistencePath(persistTo, configPath) {
|
|
135758
|
-
return persistTo ?
|
|
135759
|
-
configPath ?
|
|
135859
|
+
return persistTo ? import_node_path23.default.resolve(process.cwd(), persistTo) : import_node_path23.default.resolve(
|
|
135860
|
+
configPath ? import_node_path23.default.dirname(configPath) : process.cwd(),
|
|
135760
135861
|
".wrangler/state"
|
|
135761
135862
|
);
|
|
135762
135863
|
}
|
|
@@ -136054,11 +136155,11 @@ async function executeLocally({
|
|
|
136054
136155
|
}
|
|
136055
136156
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
|
136056
136157
|
const persistencePath = getLocalPersistencePath(persistTo, config.configPath);
|
|
136057
|
-
const dbDir =
|
|
136058
|
-
const dbPath =
|
|
136158
|
+
const dbDir = import_node_path24.default.join(persistencePath, "v3", "d1", id);
|
|
136159
|
+
const dbPath = import_node_path24.default.join(dbDir, `db.sqlite`);
|
|
136059
136160
|
const { D1Gateway, NoOpLog: NoOpLog2, createFileStorage } = require("miniflare");
|
|
136060
136161
|
const storage = createFileStorage(dbDir);
|
|
136061
|
-
if (!(0,
|
|
136162
|
+
if (!(0, import_node_fs14.existsSync)(dbDir)) {
|
|
136062
136163
|
const ok = json || !shouldPrompt || await confirm(`About to create ${readableRelative(dbPath)}, ok?`);
|
|
136063
136164
|
if (!ok)
|
|
136064
136165
|
return null;
|
|
@@ -136200,14 +136301,7 @@ var Handler5 = withConfig(
|
|
|
136200
136301
|
accountId,
|
|
136201
136302
|
name
|
|
136202
136303
|
);
|
|
136203
|
-
const result = await
|
|
136204
|
-
`/accounts/${accountId}/d1/database/${db.uuid}`,
|
|
136205
|
-
{
|
|
136206
|
-
headers: {
|
|
136207
|
-
"Content-Type": "application/json"
|
|
136208
|
-
}
|
|
136209
|
-
}
|
|
136210
|
-
);
|
|
136304
|
+
const result = await getDatabaseInfoFromId(accountId, db.uuid);
|
|
136211
136305
|
const output = { ...result };
|
|
136212
136306
|
if (output["file_size"]) {
|
|
136213
136307
|
output["database_size"] = output["file_size"];
|
|
@@ -136293,7 +136387,7 @@ init_import_meta_url();
|
|
|
136293
136387
|
// src/d1/migrations/apply.tsx
|
|
136294
136388
|
init_import_meta_url();
|
|
136295
136389
|
var import_node_assert9 = __toESM(require("node:assert"));
|
|
136296
|
-
var
|
|
136390
|
+
var import_node_fs16 = __toESM(require("node:fs"));
|
|
136297
136391
|
var import_path7 = __toESM(require("path"));
|
|
136298
136392
|
var import_ink4 = __toESM(require_build2());
|
|
136299
136393
|
var import_ink_table5 = __toESM(require_dist3());
|
|
@@ -136301,7 +136395,7 @@ var import_react9 = __toESM(require_react());
|
|
|
136301
136395
|
|
|
136302
136396
|
// src/d1/migrations/helpers.ts
|
|
136303
136397
|
init_import_meta_url();
|
|
136304
|
-
var
|
|
136398
|
+
var import_node_fs15 = __toESM(require("node:fs"));
|
|
136305
136399
|
var import_path6 = __toESM(require("path"));
|
|
136306
136400
|
async function getMigrationsPath({
|
|
136307
136401
|
projectPath,
|
|
@@ -136309,12 +136403,12 @@ async function getMigrationsPath({
|
|
|
136309
136403
|
createIfMissing
|
|
136310
136404
|
}) {
|
|
136311
136405
|
const dir = import_path6.default.resolve(projectPath, migrationsFolderPath);
|
|
136312
|
-
if (
|
|
136406
|
+
if (import_node_fs15.default.existsSync(dir))
|
|
136313
136407
|
return dir;
|
|
136314
136408
|
const warning = `No migrations folder found.${migrationsFolderPath === DEFAULT_MIGRATION_PATH ? " Set `migrations_dir` in wrangler.toml to choose a different path." : ""}`;
|
|
136315
136409
|
if (createIfMissing && await confirm(`${warning}
|
|
136316
136410
|
Ok to create ${dir}?`)) {
|
|
136317
|
-
|
|
136411
|
+
import_node_fs15.default.mkdirSync(dir, { recursive: true });
|
|
136318
136412
|
return dir;
|
|
136319
136413
|
} else {
|
|
136320
136414
|
logger.warn(warning);
|
|
@@ -136372,7 +136466,7 @@ var listAppliedMigrations = /* @__PURE__ */ __name(async (migrationsTableName, l
|
|
|
136372
136466
|
}, "listAppliedMigrations");
|
|
136373
136467
|
function getMigrationNames(migrationsPath) {
|
|
136374
136468
|
const migrations = [];
|
|
136375
|
-
const dir =
|
|
136469
|
+
const dir = import_node_fs15.default.opendirSync(migrationsPath);
|
|
136376
136470
|
let dirent;
|
|
136377
136471
|
while ((dirent = dir.readSync()) !== null) {
|
|
136378
136472
|
if (dirent.name.endsWith(".sql"))
|
|
@@ -136439,11 +136533,7 @@ __name(MigrationOptions, "MigrationOptions");
|
|
|
136439
136533
|
|
|
136440
136534
|
// src/d1/migrations/apply.tsx
|
|
136441
136535
|
function ApplyOptions(yargs) {
|
|
136442
|
-
return MigrationOptions(yargs).option("
|
|
136443
|
-
default: false,
|
|
136444
|
-
describe: "Use new experimental DB backend",
|
|
136445
|
-
type: "boolean"
|
|
136446
|
-
}).option("batch-size", {
|
|
136536
|
+
return MigrationOptions(yargs).option("batch-size", {
|
|
136447
136537
|
describe: "Number of queries to send in a single batch",
|
|
136448
136538
|
type: "number",
|
|
136449
136539
|
default: DEFAULT_BATCH_SIZE
|
|
@@ -136457,7 +136547,6 @@ var ApplyHandler = withConfig(
|
|
|
136457
136547
|
local,
|
|
136458
136548
|
persistTo,
|
|
136459
136549
|
preview,
|
|
136460
|
-
experimentalBackend,
|
|
136461
136550
|
batchSize
|
|
136462
136551
|
}) => {
|
|
136463
136552
|
logger.log(d1BetaWarning);
|
|
@@ -136523,17 +136612,20 @@ Your database may not be available to serve requests during the migration, conti
|
|
|
136523
136612
|
);
|
|
136524
136613
|
if (!ok)
|
|
136525
136614
|
return;
|
|
136526
|
-
if (!(local || preview
|
|
136615
|
+
if (!(local || preview)) {
|
|
136527
136616
|
(0, import_node_assert9.default)(
|
|
136528
136617
|
databaseInfo,
|
|
136529
136618
|
"In non-local mode `databaseInfo` should be defined."
|
|
136530
136619
|
);
|
|
136531
|
-
logger.log(renderToString(/* @__PURE__ */ import_react9.default.createElement(import_ink4.Text, null, "\u{1F552} Creating backup...")));
|
|
136532
136620
|
const accountId = await requireAuth(config);
|
|
136533
|
-
await
|
|
136621
|
+
const dbInfo = await getDatabaseInfoFromId(accountId, databaseInfo?.uuid);
|
|
136622
|
+
if (dbInfo.version === "alpha") {
|
|
136623
|
+
logger.log(renderToString(/* @__PURE__ */ import_react9.default.createElement(import_ink4.Text, null, "\u{1F552} Creating backup...")));
|
|
136624
|
+
await createBackup(accountId, databaseInfo.uuid);
|
|
136625
|
+
}
|
|
136534
136626
|
}
|
|
136535
136627
|
for (const migration of unappliedMigrations) {
|
|
136536
|
-
let query =
|
|
136628
|
+
let query = import_node_fs16.default.readFileSync(
|
|
136537
136629
|
`${migrationsPath}/${migration.name}`,
|
|
136538
136630
|
"utf8"
|
|
136539
136631
|
);
|
|
@@ -136599,7 +136691,7 @@ Your database may not be available to serve requests during the migration, conti
|
|
|
136599
136691
|
|
|
136600
136692
|
// src/d1/migrations/create.tsx
|
|
136601
136693
|
init_import_meta_url();
|
|
136602
|
-
var
|
|
136694
|
+
var import_node_fs17 = __toESM(require("node:fs"));
|
|
136603
136695
|
var import_path8 = __toESM(require("path"));
|
|
136604
136696
|
var import_ink5 = __toESM(require_build2());
|
|
136605
136697
|
var import_react10 = __toESM(require_react());
|
|
@@ -136631,7 +136723,7 @@ var CreateHandler2 = withConfig(
|
|
|
136631
136723
|
const nextMigrationNumber = pad(getNextMigrationNumber(migrationsPath), 4);
|
|
136632
136724
|
const migrationName = message.replaceAll(" ", "_");
|
|
136633
136725
|
const newMigrationName = `${nextMigrationNumber}_${migrationName}.sql`;
|
|
136634
|
-
|
|
136726
|
+
import_node_fs17.default.writeFileSync(
|
|
136635
136727
|
`${migrationsPath}/${newMigrationName}`,
|
|
136636
136728
|
`-- Migration number: ${nextMigrationNumber} ${new Date().toISOString()}
|
|
136637
136729
|
`
|
|
@@ -136715,6 +136807,194 @@ var ListHandler2 = withConfig(
|
|
|
136715
136807
|
}
|
|
136716
136808
|
);
|
|
136717
136809
|
|
|
136810
|
+
// src/d1/timeTravel/index.ts
|
|
136811
|
+
init_import_meta_url();
|
|
136812
|
+
|
|
136813
|
+
// src/d1/timeTravel/info.ts
|
|
136814
|
+
init_import_meta_url();
|
|
136815
|
+
|
|
136816
|
+
// src/d1/timeTravel/utils.ts
|
|
136817
|
+
init_import_meta_url();
|
|
136818
|
+
var getBookmarkIdFromTimestamp = /* @__PURE__ */ __name(async (accountId, databaseId, timestamp) => {
|
|
136819
|
+
const searchParams = new URLSearchParams();
|
|
136820
|
+
if (timestamp) {
|
|
136821
|
+
searchParams.append("timestamp", convertTimestampToISO(timestamp));
|
|
136822
|
+
}
|
|
136823
|
+
const bookmarkResult = await fetchResult(
|
|
136824
|
+
`/accounts/${accountId}/d1/database/${databaseId}/time-travel/bookmark?${searchParams.toString()}`,
|
|
136825
|
+
{
|
|
136826
|
+
headers: {
|
|
136827
|
+
"Content-Type": "application/json"
|
|
136828
|
+
}
|
|
136829
|
+
}
|
|
136830
|
+
);
|
|
136831
|
+
return bookmarkResult;
|
|
136832
|
+
}, "getBookmarkIdFromTimestamp");
|
|
136833
|
+
var checkIfDatabaseIsExperimental = /* @__PURE__ */ __name(async (accountId, databaseId) => {
|
|
136834
|
+
const dbInfo = await getDatabaseInfoFromId(accountId, databaseId);
|
|
136835
|
+
if (dbInfo.version !== "beta") {
|
|
136836
|
+
throw new Error(
|
|
136837
|
+
"Time travel is only available for D1 databases created with the --experimental-backend flag"
|
|
136838
|
+
);
|
|
136839
|
+
}
|
|
136840
|
+
}, "checkIfDatabaseIsExperimental");
|
|
136841
|
+
var ISO_DATE_REG_EXP = new RegExp(
|
|
136842
|
+
/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/
|
|
136843
|
+
);
|
|
136844
|
+
function isISODate(date) {
|
|
136845
|
+
return ISO_DATE_REG_EXP.test(date);
|
|
136846
|
+
}
|
|
136847
|
+
__name(isISODate, "isISODate");
|
|
136848
|
+
function getLocalISOString(date) {
|
|
136849
|
+
const offset = date.getTimezoneOffset();
|
|
136850
|
+
const offsetAbs = Math.abs(offset);
|
|
136851
|
+
const isoString = new Date(date.getTime() - offset * 60 * 1e3).toISOString();
|
|
136852
|
+
return `${isoString.slice(0, -1)}${offset > 0 ? "-" : "+"}${String(
|
|
136853
|
+
Math.floor(offsetAbs / 60)
|
|
136854
|
+
).padStart(2, "0")}:${String(offsetAbs % 60).padStart(2, "0")}`;
|
|
136855
|
+
}
|
|
136856
|
+
__name(getLocalISOString, "getLocalISOString");
|
|
136857
|
+
var convertTimestampToISO = /* @__PURE__ */ __name((timestamp) => {
|
|
136858
|
+
const parsedTimestamp = isISODate(timestamp) ? new Date(timestamp) : new Date(Number(timestamp.length === 10 ? timestamp + "000" : timestamp));
|
|
136859
|
+
if (parsedTimestamp.toString() === "Invalid Date") {
|
|
136860
|
+
throw new Error(
|
|
136861
|
+
`Invalid timestamp '${timestamp}'. Please provide a valid Unix timestamp or ISO string, for example: ${getLocalISOString(
|
|
136862
|
+
new Date()
|
|
136863
|
+
)}
|
|
136864
|
+
For accepted format, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format`
|
|
136865
|
+
);
|
|
136866
|
+
}
|
|
136867
|
+
const now = new Date();
|
|
136868
|
+
const thirtyDaysAgo = new Date();
|
|
136869
|
+
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
|
136870
|
+
if (parsedTimestamp > now) {
|
|
136871
|
+
throw new Error(
|
|
136872
|
+
`Invalid timestamp '${timestamp}'. Please provide a timestamp in the past`
|
|
136873
|
+
);
|
|
136874
|
+
}
|
|
136875
|
+
if (parsedTimestamp < thirtyDaysAgo) {
|
|
136876
|
+
throw new Error(
|
|
136877
|
+
`Invalid timestamp '${timestamp}'. Please provide a timestamp within the last 30 days`
|
|
136878
|
+
);
|
|
136879
|
+
}
|
|
136880
|
+
return parsedTimestamp.toISOString();
|
|
136881
|
+
}, "convertTimestampToISO");
|
|
136882
|
+
|
|
136883
|
+
// src/d1/timeTravel/info.ts
|
|
136884
|
+
function InfoOptions(yargs) {
|
|
136885
|
+
return Database(yargs).option("timestamp", {
|
|
136886
|
+
describe: "accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for",
|
|
136887
|
+
type: "string"
|
|
136888
|
+
}).option("json", {
|
|
136889
|
+
describe: "return output as clean JSON",
|
|
136890
|
+
type: "boolean",
|
|
136891
|
+
default: false
|
|
136892
|
+
});
|
|
136893
|
+
}
|
|
136894
|
+
__name(InfoOptions, "InfoOptions");
|
|
136895
|
+
var InfoHandler = withConfig(
|
|
136896
|
+
async ({ database, config, json, timestamp }) => {
|
|
136897
|
+
const accountId = await requireAuth(config);
|
|
136898
|
+
const db = await getDatabaseByNameOrBinding(config, accountId, database);
|
|
136899
|
+
await checkIfDatabaseIsExperimental(accountId, db.uuid);
|
|
136900
|
+
const result = await getBookmarkIdFromTimestamp(
|
|
136901
|
+
accountId,
|
|
136902
|
+
db.uuid,
|
|
136903
|
+
timestamp
|
|
136904
|
+
);
|
|
136905
|
+
if (json) {
|
|
136906
|
+
logger.log(JSON.stringify(result, null, 2));
|
|
136907
|
+
} else {
|
|
136908
|
+
await printWranglerBanner();
|
|
136909
|
+
logger.log("\u{1F6A7} Time Traveling...");
|
|
136910
|
+
logger.log(
|
|
136911
|
+
timestamp ? `\u26A0\uFE0F Timestamp '${timestamp}' corresponds with bookmark '${result.bookmark}'` : `\u26A0\uFE0F The current bookmark is '${result.bookmark}'`
|
|
136912
|
+
);
|
|
136913
|
+
logger.log(`\u26A1\uFE0F To restore to this specific bookmark, run:
|
|
136914
|
+
\`wrangler d1 time-travel restore ${database} --bookmark=${result.bookmark}\`
|
|
136915
|
+
`);
|
|
136916
|
+
}
|
|
136917
|
+
}
|
|
136918
|
+
);
|
|
136919
|
+
|
|
136920
|
+
// src/d1/timeTravel/restore.ts
|
|
136921
|
+
init_import_meta_url();
|
|
136922
|
+
function RestoreOptions2(yargs) {
|
|
136923
|
+
return Database(yargs).option("bookmark", {
|
|
136924
|
+
describe: "Bookmark to use for time travel",
|
|
136925
|
+
type: "string"
|
|
136926
|
+
}).option("timestamp", {
|
|
136927
|
+
describe: "accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for",
|
|
136928
|
+
type: "string"
|
|
136929
|
+
}).option("json", {
|
|
136930
|
+
describe: "return output as clean JSON",
|
|
136931
|
+
type: "boolean",
|
|
136932
|
+
default: false
|
|
136933
|
+
}).check(function(argv) {
|
|
136934
|
+
if (argv.timestamp && !argv.bookmark || !argv.timestamp && argv.bookmark) {
|
|
136935
|
+
return true;
|
|
136936
|
+
} else if (argv.timestamp && argv.bookmark) {
|
|
136937
|
+
throw new Error(
|
|
136938
|
+
"Provide either a timestamp, or a bookmark - not both."
|
|
136939
|
+
);
|
|
136940
|
+
} else {
|
|
136941
|
+
throw new Error("Provide either a timestamp or a bookmark");
|
|
136942
|
+
}
|
|
136943
|
+
});
|
|
136944
|
+
}
|
|
136945
|
+
__name(RestoreOptions2, "RestoreOptions");
|
|
136946
|
+
var RestoreHandler2 = withConfig(
|
|
136947
|
+
async ({ database, config, json, timestamp, bookmark }) => {
|
|
136948
|
+
const accountId = await requireAuth(config);
|
|
136949
|
+
const db = await getDatabaseByNameOrBinding(config, accountId, database);
|
|
136950
|
+
await checkIfDatabaseIsExperimental(accountId, db.uuid);
|
|
136951
|
+
const searchParams = new URLSearchParams();
|
|
136952
|
+
if (timestamp) {
|
|
136953
|
+
const bookmarkResult = await getBookmarkIdFromTimestamp(
|
|
136954
|
+
accountId,
|
|
136955
|
+
db.uuid,
|
|
136956
|
+
timestamp
|
|
136957
|
+
);
|
|
136958
|
+
searchParams.set("bookmark", bookmarkResult.bookmark);
|
|
136959
|
+
} else if (bookmark) {
|
|
136960
|
+
searchParams.set("bookmark", bookmark);
|
|
136961
|
+
}
|
|
136962
|
+
if (json) {
|
|
136963
|
+
const result = await handleRestore(accountId, db.uuid, searchParams);
|
|
136964
|
+
logger.log(JSON.stringify(result, null, 2));
|
|
136965
|
+
} else {
|
|
136966
|
+
await printWranglerBanner();
|
|
136967
|
+
logger.log(`\u{1F6A7} Restoring database ${database} from bookmark ${searchParams.get(
|
|
136968
|
+
"bookmark"
|
|
136969
|
+
)}
|
|
136970
|
+
`);
|
|
136971
|
+
logger.log(`\u26A0\uFE0F This will overwrite all data in database ${database}.
|
|
136972
|
+
In-flight queries and transactions will be cancelled.
|
|
136973
|
+
`);
|
|
136974
|
+
if (await confirm("OK to proceed (y/N)", { defaultValue: false })) {
|
|
136975
|
+
logger.log("\u26A1\uFE0F Time travel in progress...");
|
|
136976
|
+
const result = await handleRestore(accountId, db.uuid, searchParams);
|
|
136977
|
+
logger.log(`\u2705 Database ${database} restored back to bookmark ${result.bookmark}
|
|
136978
|
+
`);
|
|
136979
|
+
logger.log(
|
|
136980
|
+
`\u21A9\uFE0F To undo this operation, you can restore to the previous bookmark: ${result.previous_bookmark}`
|
|
136981
|
+
);
|
|
136982
|
+
}
|
|
136983
|
+
}
|
|
136984
|
+
}
|
|
136985
|
+
);
|
|
136986
|
+
var handleRestore = /* @__PURE__ */ __name(async (accountId, databaseId, searchParams) => {
|
|
136987
|
+
return await fetchResult(
|
|
136988
|
+
`/accounts/${accountId}/d1/database/${databaseId}/time-travel/restore?${searchParams.toString()}`,
|
|
136989
|
+
{
|
|
136990
|
+
headers: {
|
|
136991
|
+
"Content-Type": "application/json"
|
|
136992
|
+
},
|
|
136993
|
+
method: "POST"
|
|
136994
|
+
}
|
|
136995
|
+
);
|
|
136996
|
+
}, "handleRestore");
|
|
136997
|
+
|
|
136718
136998
|
// src/d1/index.ts
|
|
136719
136999
|
function d1(yargs) {
|
|
136720
137000
|
return yargs.command("list", "List D1 databases", Options, Handler).command(
|
|
@@ -136761,6 +137041,20 @@ function d1(yargs) {
|
|
|
136761
137041
|
"Executed command or SQL file",
|
|
136762
137042
|
Options4,
|
|
136763
137043
|
Handler4
|
|
137044
|
+
).command(
|
|
137045
|
+
"time-travel",
|
|
137046
|
+
"Use Time Travel to restore, fork or copy a database at a specific point-in-time.",
|
|
137047
|
+
(yargs2) => yargs2.demandCommand().command(
|
|
137048
|
+
"info <database>",
|
|
137049
|
+
"Retrieve information about a database at a specific point-in-time using Time Travel.",
|
|
137050
|
+
InfoOptions,
|
|
137051
|
+
InfoHandler
|
|
137052
|
+
).command(
|
|
137053
|
+
"restore <database>",
|
|
137054
|
+
"Restore a database back to a specific point-in-time.",
|
|
137055
|
+
RestoreOptions2,
|
|
137056
|
+
RestoreHandler2
|
|
137057
|
+
)
|
|
136764
137058
|
).command(
|
|
136765
137059
|
"migrations",
|
|
136766
137060
|
"Interact with D1 Migrations",
|
|
@@ -137051,8 +137345,8 @@ var import_undici11 = __toESM(require_undici());
|
|
|
137051
137345
|
// src/metrics/metrics-config.ts
|
|
137052
137346
|
init_import_meta_url();
|
|
137053
137347
|
var import_node_crypto4 = require("node:crypto");
|
|
137054
|
-
var
|
|
137055
|
-
var
|
|
137348
|
+
var import_node_fs18 = require("node:fs");
|
|
137349
|
+
var import_node_path25 = __toESM(require("node:path"));
|
|
137056
137350
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
|
137057
137351
|
var USER_ID_CACHE_PATH = "user-id.json";
|
|
137058
137352
|
var getWranglerSendMetricsFromEnv2 = getEnvironmentVariableFactory({
|
|
@@ -137093,7 +137387,7 @@ async function getMetricsConfig({
|
|
|
137093
137387
|
"Would you like to help improve Wrangler by sending usage metrics to Cloudflare?"
|
|
137094
137388
|
);
|
|
137095
137389
|
logger.log(
|
|
137096
|
-
`Your choice has been saved in the following file: ${
|
|
137390
|
+
`Your choice has been saved in the following file: ${import_node_path25.default.relative(
|
|
137097
137391
|
process.cwd(),
|
|
137098
137392
|
getMetricsConfigPath()
|
|
137099
137393
|
)}.
|
|
@@ -137114,8 +137408,8 @@ async function getMetricsConfig({
|
|
|
137114
137408
|
}
|
|
137115
137409
|
__name(getMetricsConfig, "getMetricsConfig");
|
|
137116
137410
|
function writeMetricsConfig(config) {
|
|
137117
|
-
(0,
|
|
137118
|
-
(0,
|
|
137411
|
+
(0, import_node_fs18.mkdirSync)(import_node_path25.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
137412
|
+
(0, import_node_fs18.writeFileSync)(
|
|
137119
137413
|
getMetricsConfigPath(),
|
|
137120
137414
|
JSON.stringify(
|
|
137121
137415
|
config,
|
|
@@ -137127,7 +137421,7 @@ function writeMetricsConfig(config) {
|
|
|
137127
137421
|
__name(writeMetricsConfig, "writeMetricsConfig");
|
|
137128
137422
|
function readMetricsConfig() {
|
|
137129
137423
|
try {
|
|
137130
|
-
const config = (0,
|
|
137424
|
+
const config = (0, import_node_fs18.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
137131
137425
|
return JSON.parse(
|
|
137132
137426
|
config,
|
|
137133
137427
|
(key, value) => key === "date" ? new Date(value) : value
|
|
@@ -137138,7 +137432,7 @@ function readMetricsConfig() {
|
|
|
137138
137432
|
}
|
|
137139
137433
|
__name(readMetricsConfig, "readMetricsConfig");
|
|
137140
137434
|
function getMetricsConfigPath() {
|
|
137141
|
-
return
|
|
137435
|
+
return import_node_path25.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
137142
137436
|
}
|
|
137143
137437
|
__name(getMetricsConfigPath, "getMetricsConfigPath");
|
|
137144
137438
|
function getDeviceId(config) {
|
|
@@ -137413,7 +137707,7 @@ __name(checkAndConfirmForceDeleteIfNecessary, "checkAndConfirmForceDeleteIfNeces
|
|
|
137413
137707
|
|
|
137414
137708
|
// src/deploy/index.ts
|
|
137415
137709
|
init_import_meta_url();
|
|
137416
|
-
var
|
|
137710
|
+
var import_node_path26 = __toESM(require("node:path"));
|
|
137417
137711
|
|
|
137418
137712
|
// src/sites.ts
|
|
137419
137713
|
init_import_meta_url();
|
|
@@ -137539,7 +137833,7 @@ function pluralise(count) {
|
|
|
137539
137833
|
return count === 1 ? "" : "s";
|
|
137540
137834
|
}
|
|
137541
137835
|
__name(pluralise, "pluralise");
|
|
137542
|
-
async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
137836
|
+
async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun, oldAssetTTL) {
|
|
137543
137837
|
if (siteAssets === void 0) {
|
|
137544
137838
|
return { manifest: void 0, namespace: void 0 };
|
|
137545
137839
|
}
|
|
@@ -137555,6 +137849,9 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
|
137555
137849
|
);
|
|
137556
137850
|
logger.info("Fetching list of already uploaded assets...");
|
|
137557
137851
|
const namespaceKeysResponse = await listKVNamespaceKeys(accountId, namespace);
|
|
137852
|
+
const namespaceKeyInfoMap = new Map(
|
|
137853
|
+
namespaceKeysResponse.map((x) => [x.name, x])
|
|
137854
|
+
);
|
|
137558
137855
|
const namespaceKeys = new Set(namespaceKeysResponse.map((x) => x.name));
|
|
137559
137856
|
const assetDirectory = path30.join(
|
|
137560
137857
|
siteAssets.baseDirectory,
|
|
@@ -137616,7 +137913,9 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
|
137616
137913
|
if (uploadBucket.length > 0)
|
|
137617
137914
|
uploadBuckets.push(uploadBucket);
|
|
137618
137915
|
for (const key of namespaceKeys) {
|
|
137619
|
-
logDiff(
|
|
137916
|
+
logDiff(
|
|
137917
|
+
import_chalk7.default.red(` - ${key} (${oldAssetTTL ? "expiring" : "removing"} as stale)`)
|
|
137918
|
+
);
|
|
137620
137919
|
}
|
|
137621
137920
|
if (uploadCount > 0) {
|
|
137622
137921
|
const s = pluralise(uploadCount);
|
|
@@ -137678,9 +137977,39 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
|
137678
137977
|
const deleteCount = namespaceKeys.size;
|
|
137679
137978
|
if (deleteCount > 0) {
|
|
137680
137979
|
const s = pluralise(deleteCount);
|
|
137681
|
-
logger.info(
|
|
137980
|
+
logger.info(
|
|
137981
|
+
`${oldAssetTTL ? "Expiring" : "Removing"} ${formatNumber(
|
|
137982
|
+
deleteCount
|
|
137983
|
+
)} stale asset${s}...`
|
|
137984
|
+
);
|
|
137985
|
+
if (!oldAssetTTL) {
|
|
137986
|
+
await deleteKVBulkKeyValue(
|
|
137987
|
+
accountId,
|
|
137988
|
+
namespace,
|
|
137989
|
+
Array.from(namespaceKeys)
|
|
137990
|
+
);
|
|
137991
|
+
} else {
|
|
137992
|
+
for (const namespaceKey of namespaceKeys) {
|
|
137993
|
+
const expiration = namespaceKeyInfoMap.get(namespaceKey)?.expiration;
|
|
137994
|
+
logger.info(
|
|
137995
|
+
` - ${namespaceKey} ${expiration ? `(already expiring at ${expiration})` : ""}`
|
|
137996
|
+
);
|
|
137997
|
+
if (expiration) {
|
|
137998
|
+
continue;
|
|
137999
|
+
}
|
|
138000
|
+
const currentValue = await getKVKeyValue(
|
|
138001
|
+
accountId,
|
|
138002
|
+
namespace,
|
|
138003
|
+
namespaceKey
|
|
138004
|
+
);
|
|
138005
|
+
await putKVKeyValue(accountId, namespace, {
|
|
138006
|
+
key: namespaceKey,
|
|
138007
|
+
value: Buffer.from(currentValue),
|
|
138008
|
+
expiration_ttl: oldAssetTTL
|
|
138009
|
+
});
|
|
138010
|
+
}
|
|
138011
|
+
}
|
|
137682
138012
|
}
|
|
137683
|
-
await deleteKVBulkKeyValue(accountId, namespace, Array.from(namespaceKeys));
|
|
137684
138013
|
logger.log("\u2197\uFE0F Done syncing assets");
|
|
137685
138014
|
return { manifest, namespace };
|
|
137686
138015
|
}
|
|
@@ -137880,6 +138209,9 @@ function deployOptions(yargs) {
|
|
|
137880
138209
|
}).option("logpush", {
|
|
137881
138210
|
type: "boolean",
|
|
137882
138211
|
describe: "Send Trace Events from this worker to Workers Logpush.\nThis will not configure a corresponding Logpush job automatically."
|
|
138212
|
+
}).option("old-asset-ttl", {
|
|
138213
|
+
describe: "Expire old assets in given seconds rather than immediate deletion.",
|
|
138214
|
+
type: "number"
|
|
137883
138215
|
});
|
|
137884
138216
|
}
|
|
137885
138217
|
__name(deployOptions, "deployOptions");
|
|
@@ -137890,7 +138222,7 @@ async function deployHandler(args) {
|
|
|
137890
138222
|
"`wrangler publish` is deprecated and will be removed in the next major version.\nPlease use `wrangler deploy` instead, which accepts exactly the same arguments."
|
|
137891
138223
|
);
|
|
137892
138224
|
}
|
|
137893
|
-
const configPath = args.config || args.script && findWranglerToml(
|
|
138225
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path26.default.dirname(args.script));
|
|
137894
138226
|
const config = readConfig(configPath, args);
|
|
137895
138227
|
const entry = await getEntry(args, config, "deploy");
|
|
137896
138228
|
await sendMetricsEvent(
|
|
@@ -137957,7 +138289,8 @@ async function deployHandler(args) {
|
|
|
137957
138289
|
dryRun: args.dryRun,
|
|
137958
138290
|
noBundle: !(args.bundle ?? !config.no_bundle),
|
|
137959
138291
|
keepVars: args.keepVars,
|
|
137960
|
-
logpush: args.logpush
|
|
138292
|
+
logpush: args.logpush,
|
|
138293
|
+
oldAssetTtl: args.oldAssetTtl
|
|
137961
138294
|
});
|
|
137962
138295
|
}
|
|
137963
138296
|
__name(deployHandler, "deployHandler");
|
|
@@ -138344,8 +138677,8 @@ __name(docsHandler, "docsHandler");
|
|
|
138344
138677
|
|
|
138345
138678
|
// src/generate/index.ts
|
|
138346
138679
|
init_import_meta_url();
|
|
138347
|
-
var
|
|
138348
|
-
var
|
|
138680
|
+
var import_node_fs19 = __toESM(require("node:fs"));
|
|
138681
|
+
var import_node_path27 = __toESM(require("node:path"));
|
|
138349
138682
|
function generateOptions(yargs) {
|
|
138350
138683
|
return yargs.positional("name", {
|
|
138351
138684
|
describe: "Name of the Workers project",
|
|
@@ -138400,7 +138733,7 @@ async function generateHandler2(args) {
|
|
|
138400
138733
|
}
|
|
138401
138734
|
const creationDirectory = generateWorkerDirectoryName(args.name);
|
|
138402
138735
|
if (args.site) {
|
|
138403
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
|
138736
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path27.default.basename(creationDirectory) : "my-site";
|
|
138404
138737
|
const message = `The --site option is no longer supported.
|
|
138405
138738
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
|
138406
138739
|
|
|
@@ -138414,7 +138747,7 @@ Have you considered using Cloudflare Pages instead? See https://pages.cloudflare
|
|
|
138414
138747
|
throw new CommandLineArgsError(message);
|
|
138415
138748
|
}
|
|
138416
138749
|
logger.log(
|
|
138417
|
-
`Creating a worker in ${
|
|
138750
|
+
`Creating a worker in ${import_node_path27.default.basename(creationDirectory)} from ${args.template}`
|
|
138418
138751
|
);
|
|
138419
138752
|
const { remote, subdirectory } = parseTemplatePath(args.template);
|
|
138420
138753
|
await cloneIntoDirectory(remote, creationDirectory, subdirectory);
|
|
@@ -138423,10 +138756,10 @@ Have you considered using Cloudflare Pages instead? See https://pages.cloudflare
|
|
|
138423
138756
|
}
|
|
138424
138757
|
__name(generateHandler2, "generateHandler");
|
|
138425
138758
|
function generateWorkerDirectoryName(workerName) {
|
|
138426
|
-
let workerDirectoryPath =
|
|
138759
|
+
let workerDirectoryPath = import_node_path27.default.resolve(process.cwd(), workerName);
|
|
138427
138760
|
let i = 1;
|
|
138428
|
-
while (
|
|
138429
|
-
workerDirectoryPath =
|
|
138761
|
+
while (import_node_fs19.default.existsSync(workerDirectoryPath)) {
|
|
138762
|
+
workerDirectoryPath = import_node_path27.default.resolve(process.cwd(), `${workerName}-${i}`);
|
|
138430
138763
|
i++;
|
|
138431
138764
|
}
|
|
138432
138765
|
return workerDirectoryPath;
|
|
@@ -139118,13 +139451,13 @@ init_import_meta_url();
|
|
|
139118
139451
|
|
|
139119
139452
|
// src/pages/build.ts
|
|
139120
139453
|
init_import_meta_url();
|
|
139121
|
-
var
|
|
139122
|
-
var
|
|
139454
|
+
var import_node_fs22 = require("node:fs");
|
|
139455
|
+
var import_node_path35 = require("node:path");
|
|
139123
139456
|
|
|
139124
139457
|
// src/api/pages/create-worker-bundle-contents.ts
|
|
139125
139458
|
init_import_meta_url();
|
|
139126
|
-
var
|
|
139127
|
-
var
|
|
139459
|
+
var import_node_fs20 = require("node:fs");
|
|
139460
|
+
var import_node_path28 = __toESM(require("node:path"));
|
|
139128
139461
|
var import_undici13 = __toESM(require_undici());
|
|
139129
139462
|
async function createUploadWorkerBundleContents(workerBundle) {
|
|
139130
139463
|
const workerBundleFormData = createWorkerBundleFormData(workerBundle);
|
|
@@ -139138,8 +139471,8 @@ async function createUploadWorkerBundleContents(workerBundle) {
|
|
|
139138
139471
|
__name(createUploadWorkerBundleContents, "createUploadWorkerBundleContents");
|
|
139139
139472
|
function createWorkerBundleFormData(workerBundle) {
|
|
139140
139473
|
const mainModule = {
|
|
139141
|
-
name:
|
|
139142
|
-
content: (0,
|
|
139474
|
+
name: import_node_path28.default.basename(workerBundle.resolvedEntryPointPath),
|
|
139475
|
+
content: (0, import_node_fs20.readFileSync)(workerBundle.resolvedEntryPointPath, {
|
|
139143
139476
|
encoding: "utf-8"
|
|
139144
139477
|
}),
|
|
139145
139478
|
type: workerBundle.bundleType || "esm"
|
|
@@ -139183,9 +139516,9 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
|
|
|
139183
139516
|
|
|
139184
139517
|
// src/pages/buildFunctions.ts
|
|
139185
139518
|
init_import_meta_url();
|
|
139186
|
-
var
|
|
139519
|
+
var import_node_fs21 = require("node:fs");
|
|
139187
139520
|
var import_node_os10 = require("node:os");
|
|
139188
|
-
var
|
|
139521
|
+
var import_node_path34 = require("node:path");
|
|
139189
139522
|
|
|
139190
139523
|
// src/pages/errors.ts
|
|
139191
139524
|
init_import_meta_url();
|
|
@@ -139377,13 +139710,13 @@ __name(getRoutesValidationErrorMessage, "getRoutesValidationErrorMessage");
|
|
|
139377
139710
|
// src/pages/functions/buildPlugin.ts
|
|
139378
139711
|
init_import_meta_url();
|
|
139379
139712
|
var import_promises9 = require("node:fs/promises");
|
|
139380
|
-
var
|
|
139713
|
+
var import_node_path30 = require("node:path");
|
|
139381
139714
|
|
|
139382
139715
|
// src/pages/functions/buildWorker.ts
|
|
139383
139716
|
init_import_meta_url();
|
|
139384
139717
|
var import_promises8 = require("node:fs/promises");
|
|
139385
139718
|
var import_node_os9 = require("node:os");
|
|
139386
|
-
var
|
|
139719
|
+
var import_node_path29 = require("node:path");
|
|
139387
139720
|
var import_esbuild3 = require("esbuild");
|
|
139388
139721
|
|
|
139389
139722
|
// ../../node_modules/nanoid/index.js
|
|
@@ -139421,7 +139754,7 @@ var nanoid = /* @__PURE__ */ __name((size = 21) => {
|
|
|
139421
139754
|
// src/pages/functions/buildWorker.ts
|
|
139422
139755
|
function buildWorker({
|
|
139423
139756
|
routesModule,
|
|
139424
|
-
outfile = (0,
|
|
139757
|
+
outfile = (0, import_node_path29.join)((0, import_node_os9.tmpdir)(), `./functionsWorker-${Math.random()}.js`),
|
|
139425
139758
|
outdir,
|
|
139426
139759
|
minify = false,
|
|
139427
139760
|
sourcemap = false,
|
|
@@ -139438,12 +139771,12 @@ function buildWorker({
|
|
|
139438
139771
|
}) {
|
|
139439
139772
|
return bundleWorker(
|
|
139440
139773
|
{
|
|
139441
|
-
file: (0,
|
|
139774
|
+
file: (0, import_node_path29.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
|
|
139442
139775
|
directory: functionsDirectory,
|
|
139443
139776
|
format: "modules",
|
|
139444
139777
|
moduleRoot: functionsDirectory
|
|
139445
139778
|
},
|
|
139446
|
-
outdir ? (0,
|
|
139779
|
+
outdir ? (0, import_node_path29.resolve)(outdir) : (0, import_node_path29.resolve)(outfile),
|
|
139447
139780
|
{
|
|
139448
139781
|
inject: [routesModule],
|
|
139449
139782
|
...outdir ? { entryName: "index" } : {},
|
|
@@ -139466,7 +139799,7 @@ function buildWorker({
|
|
|
139466
139799
|
setup(pluginBuild) {
|
|
139467
139800
|
const identifiers = /* @__PURE__ */ new Map();
|
|
139468
139801
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
|
139469
|
-
const directory = (0,
|
|
139802
|
+
const directory = (0, import_node_path29.resolve)(
|
|
139470
139803
|
args.resolveDir,
|
|
139471
139804
|
args.path.slice("assets:".length)
|
|
139472
139805
|
);
|
|
@@ -139494,7 +139827,7 @@ function buildWorker({
|
|
|
139494
139827
|
async (args) => {
|
|
139495
139828
|
const identifier = identifiers.get(args.path);
|
|
139496
139829
|
if (buildOutputDirectory) {
|
|
139497
|
-
const staticAssetsOutputDirectory = (0,
|
|
139830
|
+
const staticAssetsOutputDirectory = (0, import_node_path29.join)(
|
|
139498
139831
|
buildOutputDirectory,
|
|
139499
139832
|
"cdn-cgi",
|
|
139500
139833
|
"pages-plugins",
|
|
@@ -139536,7 +139869,7 @@ function buildWorker({
|
|
|
139536
139869
|
__name(buildWorker, "buildWorker");
|
|
139537
139870
|
function buildRawWorker({
|
|
139538
139871
|
workerScriptPath,
|
|
139539
|
-
outfile = (0,
|
|
139872
|
+
outfile = (0, import_node_path29.join)((0, import_node_os9.tmpdir)(), `./functionsWorker-${Math.random()}.js`),
|
|
139540
139873
|
outdir,
|
|
139541
139874
|
directory,
|
|
139542
139875
|
bundle = true,
|
|
@@ -139556,11 +139889,11 @@ function buildRawWorker({
|
|
|
139556
139889
|
return bundleWorker(
|
|
139557
139890
|
{
|
|
139558
139891
|
file: workerScriptPath,
|
|
139559
|
-
directory: (0,
|
|
139892
|
+
directory: (0, import_node_path29.resolve)(directory),
|
|
139560
139893
|
format: "modules",
|
|
139561
|
-
moduleRoot: (0,
|
|
139894
|
+
moduleRoot: (0, import_node_path29.resolve)(directory)
|
|
139562
139895
|
},
|
|
139563
|
-
outdir ? (0,
|
|
139896
|
+
outdir ? (0, import_node_path29.resolve)(outdir) : (0, import_node_path29.resolve)(outfile),
|
|
139564
139897
|
{
|
|
139565
139898
|
bundle,
|
|
139566
139899
|
minify,
|
|
@@ -139581,7 +139914,7 @@ function buildRawWorker({
|
|
|
139581
139914
|
name: "external-fixer",
|
|
139582
139915
|
setup(pluginBuild) {
|
|
139583
139916
|
pluginBuild.onResolve({ filter: /.*/ }, async (args) => {
|
|
139584
|
-
if (external.includes((0,
|
|
139917
|
+
if (external.includes((0, import_node_path29.resolve)(args.resolveDir, args.path))) {
|
|
139585
139918
|
return { path: args.path, external: true };
|
|
139586
139919
|
}
|
|
139587
139920
|
});
|
|
@@ -139607,13 +139940,13 @@ async function traverseAndBuildWorkerJSDirectory({
|
|
|
139607
139940
|
d1Databases,
|
|
139608
139941
|
nodejsCompat
|
|
139609
139942
|
}) {
|
|
139610
|
-
const entrypoint = (0,
|
|
139943
|
+
const entrypoint = (0, import_node_path29.resolve)((0, import_node_path29.join)(workerJSDirectory, "index.js"));
|
|
139611
139944
|
const traverseModuleGraphResult = await traverseModuleGraph(
|
|
139612
139945
|
{
|
|
139613
139946
|
file: entrypoint,
|
|
139614
|
-
directory: (0,
|
|
139947
|
+
directory: (0, import_node_path29.resolve)(workerJSDirectory),
|
|
139615
139948
|
format: "modules",
|
|
139616
|
-
moduleRoot: (0,
|
|
139949
|
+
moduleRoot: (0, import_node_path29.resolve)(workerJSDirectory)
|
|
139617
139950
|
},
|
|
139618
139951
|
[
|
|
139619
139952
|
{
|
|
@@ -139622,12 +139955,12 @@ async function traverseAndBuildWorkerJSDirectory({
|
|
|
139622
139955
|
}
|
|
139623
139956
|
]
|
|
139624
139957
|
);
|
|
139625
|
-
const outfile = (0,
|
|
139958
|
+
const outfile = (0, import_node_path29.join)((0, import_node_os9.tmpdir)(), `./bundledWorker-${Math.random()}.mjs`);
|
|
139626
139959
|
const bundleResult = await buildRawWorker({
|
|
139627
139960
|
workerScriptPath: entrypoint,
|
|
139628
139961
|
bundle: true,
|
|
139629
139962
|
external: traverseModuleGraphResult.modules.map(
|
|
139630
|
-
(m) => (0,
|
|
139963
|
+
(m) => (0, import_node_path29.join)(workerJSDirectory, m.name)
|
|
139631
139964
|
),
|
|
139632
139965
|
outfile,
|
|
139633
139966
|
directory: buildOutputDirectory,
|
|
@@ -139716,12 +140049,12 @@ function buildPlugin({
|
|
|
139716
140049
|
}) {
|
|
139717
140050
|
return bundleWorker(
|
|
139718
140051
|
{
|
|
139719
|
-
file: (0,
|
|
140052
|
+
file: (0, import_node_path30.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
|
|
139720
140053
|
directory: functionsDirectory,
|
|
139721
140054
|
format: "modules",
|
|
139722
140055
|
moduleRoot: functionsDirectory
|
|
139723
140056
|
},
|
|
139724
|
-
(0,
|
|
140057
|
+
(0, import_node_path30.resolve)(outdir),
|
|
139725
140058
|
{
|
|
139726
140059
|
inject: [routesModule],
|
|
139727
140060
|
entryName: "index",
|
|
@@ -139741,7 +140074,7 @@ function buildPlugin({
|
|
|
139741
140074
|
name: "Assets",
|
|
139742
140075
|
setup(pluginBuild) {
|
|
139743
140076
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
|
139744
|
-
const directory = (0,
|
|
140077
|
+
const directory = (0, import_node_path30.resolve)(
|
|
139745
140078
|
args.resolveDir,
|
|
139746
140079
|
args.path.slice("assets:".length)
|
|
139747
140080
|
);
|
|
@@ -139756,7 +140089,7 @@ function buildPlugin({
|
|
|
139756
140089
|
]
|
|
139757
140090
|
};
|
|
139758
140091
|
}
|
|
139759
|
-
const path45 = `assets:./${(0,
|
|
140092
|
+
const path45 = `assets:./${(0, import_node_path30.relative)(outdir, directory)}`;
|
|
139760
140093
|
return { path: path45, external: true, namespace: "assets" };
|
|
139761
140094
|
});
|
|
139762
140095
|
}
|
|
@@ -139769,9 +140102,9 @@ function buildPlugin({
|
|
|
139769
140102
|
async (args) => {
|
|
139770
140103
|
return {
|
|
139771
140104
|
external: true,
|
|
139772
|
-
path: `./${(0,
|
|
140105
|
+
path: `./${(0, import_node_path30.relative)(
|
|
139773
140106
|
outdir,
|
|
139774
|
-
(0,
|
|
140107
|
+
(0, import_node_path30.resolve)(args.resolveDir, args.path)
|
|
139775
140108
|
)}`
|
|
139776
140109
|
};
|
|
139777
140110
|
}
|
|
@@ -139793,7 +140126,7 @@ __name(buildPlugin, "buildPlugin");
|
|
|
139793
140126
|
// src/pages/functions/filepath-routing.ts
|
|
139794
140127
|
init_import_meta_url();
|
|
139795
140128
|
var import_promises10 = __toESM(require("node:fs/promises"));
|
|
139796
|
-
var
|
|
140129
|
+
var import_node_path31 = __toESM(require("node:path"));
|
|
139797
140130
|
var import_esbuild4 = require("esbuild");
|
|
139798
140131
|
async function generateConfigFromFileTree({
|
|
139799
140132
|
baseDir,
|
|
@@ -139807,13 +140140,13 @@ async function generateConfigFromFileTree({
|
|
|
139807
140140
|
baseURL = baseURL.slice(0, -1);
|
|
139808
140141
|
}
|
|
139809
140142
|
await forEachFile(baseDir, async (filepath) => {
|
|
139810
|
-
const ext =
|
|
140143
|
+
const ext = import_node_path31.default.extname(filepath);
|
|
139811
140144
|
if (/^\.(mjs|js|ts|tsx|jsx)$/.test(ext)) {
|
|
139812
140145
|
const { metafile } = await (0, import_esbuild4.build)({
|
|
139813
140146
|
metafile: true,
|
|
139814
140147
|
write: false,
|
|
139815
140148
|
bundle: false,
|
|
139816
|
-
entryPoints: [
|
|
140149
|
+
entryPoints: [import_node_path31.default.resolve(filepath)]
|
|
139817
140150
|
});
|
|
139818
140151
|
const exportNames = [];
|
|
139819
140152
|
if (metafile) {
|
|
@@ -139826,13 +140159,13 @@ async function generateConfigFromFileTree({
|
|
|
139826
140159
|
/^onRequest(Get|Post|Put|Patch|Delete|Options|Head)?$/
|
|
139827
140160
|
) ?? [];
|
|
139828
140161
|
if (match) {
|
|
139829
|
-
const basename6 =
|
|
140162
|
+
const basename6 = import_node_path31.default.basename(filepath).slice(0, -ext.length);
|
|
139830
140163
|
const isIndexFile = basename6 === "index";
|
|
139831
140164
|
const isMiddlewareFile = basename6 === "_middleware" || basename6 === "_middleware_";
|
|
139832
|
-
let routePath =
|
|
139833
|
-
let mountPath =
|
|
140165
|
+
let routePath = import_node_path31.default.relative(baseDir, filepath).slice(0, -ext.length);
|
|
140166
|
+
let mountPath = import_node_path31.default.dirname(routePath);
|
|
139834
140167
|
if (isIndexFile || isMiddlewareFile) {
|
|
139835
|
-
routePath =
|
|
140168
|
+
routePath = import_node_path31.default.dirname(routePath);
|
|
139836
140169
|
}
|
|
139837
140170
|
if (routePath === ".") {
|
|
139838
140171
|
routePath = "";
|
|
@@ -139846,7 +140179,7 @@ async function generateConfigFromFileTree({
|
|
|
139846
140179
|
routePath = routePath.replaceAll(/\[([^\]]+)\]/g, ":$1");
|
|
139847
140180
|
mountPath = mountPath.replace(/\[\[([^\]]+)\]\]/g, ":$1*");
|
|
139848
140181
|
mountPath = mountPath.replaceAll(/\[([^\]]+)\]/g, ":$1");
|
|
139849
|
-
const modulePath = toUrlPath(
|
|
140182
|
+
const modulePath = toUrlPath(import_node_path31.default.relative(baseDir, filepath));
|
|
139850
140183
|
const routeEntry = {
|
|
139851
140184
|
routePath: toUrlPath(routePath),
|
|
139852
140185
|
mountPath: toUrlPath(mountPath),
|
|
@@ -139918,7 +140251,7 @@ async function forEachFile(baseDir, fn2) {
|
|
|
139918
140251
|
const cwd2 = searchPaths.shift();
|
|
139919
140252
|
const dir = await import_promises10.default.readdir(cwd2, { withFileTypes: true });
|
|
139920
140253
|
for (const entry of dir) {
|
|
139921
|
-
const pathname =
|
|
140254
|
+
const pathname = import_node_path31.default.join(cwd2, entry.name);
|
|
139922
140255
|
if (entry.isDirectory()) {
|
|
139923
140256
|
searchPaths.push(pathname);
|
|
139924
140257
|
} else if (entry.isFile()) {
|
|
@@ -139937,7 +140270,7 @@ __name(isNotEmpty, "isNotEmpty");
|
|
|
139937
140270
|
// src/pages/functions/routes.ts
|
|
139938
140271
|
init_import_meta_url();
|
|
139939
140272
|
var import_promises11 = __toESM(require("node:fs/promises"));
|
|
139940
|
-
var
|
|
140273
|
+
var import_node_path32 = __toESM(require("node:path"));
|
|
139941
140274
|
|
|
139942
140275
|
// src/pages/functions/identifiers.ts
|
|
139943
140276
|
init_import_meta_url();
|
|
@@ -140034,8 +140367,8 @@ function parseConfig(config, baseDir) {
|
|
|
140034
140367
|
return paths.map((modulePath) => {
|
|
140035
140368
|
const [filepath, name = "default"] = modulePath.split(":");
|
|
140036
140369
|
let { identifier } = importMap.get(modulePath) ?? {};
|
|
140037
|
-
const resolvedPath =
|
|
140038
|
-
if (
|
|
140370
|
+
const resolvedPath = import_node_path32.default.resolve(baseDir, filepath);
|
|
140371
|
+
if (import_node_path32.default.relative(baseDir, resolvedPath).startsWith("..")) {
|
|
140039
140372
|
throw new Error(`Invalid module path "${filepath}"`);
|
|
140040
140373
|
}
|
|
140041
140374
|
if (name !== "default" && !isValidIdentifier(name)) {
|
|
@@ -140087,7 +140420,7 @@ __name(generateRoutesModule, "generateRoutesModule");
|
|
|
140087
140420
|
|
|
140088
140421
|
// src/pages/functions/routes-transformation.ts
|
|
140089
140422
|
init_import_meta_url();
|
|
140090
|
-
var
|
|
140423
|
+
var import_node_path33 = require("node:path");
|
|
140091
140424
|
|
|
140092
140425
|
// src/pages/functions/routes-consolidation.ts
|
|
140093
140426
|
init_import_meta_url();
|
|
@@ -140141,7 +140474,7 @@ function convertRoutesToGlobPatterns(routes) {
|
|
|
140141
140474
|
const globbedRoutePath = routePath.replace(/:\w+\*?.*/, "*");
|
|
140142
140475
|
if (typeof middleware === "string" || Array.isArray(middleware) && middleware.length > 0) {
|
|
140143
140476
|
if (!globbedRoutePath.endsWith("*")) {
|
|
140144
|
-
return toUrlPath((0,
|
|
140477
|
+
return toUrlPath((0, import_node_path33.join)(globbedRoutePath, "*"));
|
|
140145
140478
|
}
|
|
140146
140479
|
}
|
|
140147
140480
|
return toUrlPath(globbedRoutePath);
|
|
@@ -140235,7 +140568,7 @@ async function buildFunctions({
|
|
|
140235
140568
|
RUNNING_BUILDERS.forEach(
|
|
140236
140569
|
(runningBuilder) => runningBuilder.stop && runningBuilder.stop()
|
|
140237
140570
|
);
|
|
140238
|
-
const routesModule = (0,
|
|
140571
|
+
const routesModule = (0, import_node_path34.join)((0, import_node_os10.tmpdir)(), `./functionsRoutes-${Math.random()}.mjs`);
|
|
140239
140572
|
const baseURL = toUrlPath("/");
|
|
140240
140573
|
const config = await generateConfigFromFileTree({
|
|
140241
140574
|
baseDir: functionsDirectory,
|
|
@@ -140248,10 +140581,10 @@ async function buildFunctions({
|
|
|
140248
140581
|
}
|
|
140249
140582
|
if (routesOutputPath) {
|
|
140250
140583
|
const routesJSON = convertRoutesToRoutesJSONSpec(config.routes);
|
|
140251
|
-
(0,
|
|
140584
|
+
(0, import_node_fs21.writeFileSync)(routesOutputPath, JSON.stringify(routesJSON, null, 2));
|
|
140252
140585
|
}
|
|
140253
140586
|
if (outputConfigPath) {
|
|
140254
|
-
(0,
|
|
140587
|
+
(0, import_node_fs21.writeFileSync)(
|
|
140255
140588
|
outputConfigPath,
|
|
140256
140589
|
JSON.stringify({ ...config, baseURL }, null, 2)
|
|
140257
140590
|
);
|
|
@@ -140261,7 +140594,7 @@ async function buildFunctions({
|
|
|
140261
140594
|
srcDir: functionsDirectory,
|
|
140262
140595
|
outfile: routesModule
|
|
140263
140596
|
});
|
|
140264
|
-
const absoluteFunctionsDirectory = (0,
|
|
140597
|
+
const absoluteFunctionsDirectory = (0, import_node_path34.resolve)(functionsDirectory);
|
|
140265
140598
|
let bundle;
|
|
140266
140599
|
if (plugin) {
|
|
140267
140600
|
if (outdir === void 0) {
|
|
@@ -140428,10 +140761,10 @@ var Handler6 = /* @__PURE__ */ __name(async (args) => {
|
|
|
140428
140761
|
}
|
|
140429
140762
|
}
|
|
140430
140763
|
if (outfile && outfile !== bundle.resolvedEntryPointPath) {
|
|
140431
|
-
(0,
|
|
140764
|
+
(0, import_node_fs22.writeFileSync)(
|
|
140432
140765
|
outfile,
|
|
140433
|
-
`export { default } from './${(0,
|
|
140434
|
-
(0,
|
|
140766
|
+
`export { default } from './${(0, import_node_path35.relative)(
|
|
140767
|
+
(0, import_node_path35.dirname)(outfile),
|
|
140435
140768
|
bundle.resolvedEntryPointPath
|
|
140436
140769
|
)}'`
|
|
140437
140770
|
);
|
|
@@ -140464,7 +140797,7 @@ var Handler6 = /* @__PURE__ */ __name(async (args) => {
|
|
|
140464
140797
|
}
|
|
140465
140798
|
}
|
|
140466
140799
|
if (workerScriptPath) {
|
|
140467
|
-
if ((0,
|
|
140800
|
+
if ((0, import_node_fs22.lstatSync)(workerScriptPath).isDirectory()) {
|
|
140468
140801
|
bundle = await traverseAndBuildWorkerJSDirectory({
|
|
140469
140802
|
workerJSDirectory: workerScriptPath,
|
|
140470
140803
|
buildOutputDirectory,
|
|
@@ -140516,8 +140849,8 @@ var Handler6 = /* @__PURE__ */ __name(async (args) => {
|
|
|
140516
140849
|
const workerBundleContents = await createUploadWorkerBundleContents(
|
|
140517
140850
|
bundle
|
|
140518
140851
|
);
|
|
140519
|
-
(0,
|
|
140520
|
-
(0,
|
|
140852
|
+
(0, import_node_fs22.mkdirSync)((0, import_node_path35.dirname)(outfile), { recursive: true });
|
|
140853
|
+
(0, import_node_fs22.writeFileSync)(
|
|
140521
140854
|
outfile,
|
|
140522
140855
|
Buffer.from(await workerBundleContents.arrayBuffer())
|
|
140523
140856
|
);
|
|
@@ -140537,7 +140870,7 @@ var validateArgs = /* @__PURE__ */ __name((args) => {
|
|
|
140537
140870
|
logger.warn(
|
|
140538
140871
|
"Creating a Pages Plugin with `--outfile` is now deprecated. Please use `--outdir` instead."
|
|
140539
140872
|
);
|
|
140540
|
-
args.outdir = (0,
|
|
140873
|
+
args.outdir = (0, import_node_path35.dirname)((0, import_node_path35.resolve)(args.outfile));
|
|
140541
140874
|
} else if (!args.outfile && !args.outdir) {
|
|
140542
140875
|
args.outfile ??= "_worker.js";
|
|
140543
140876
|
args.outdir = ".";
|
|
@@ -140561,16 +140894,16 @@ var validateArgs = /* @__PURE__ */ __name((args) => {
|
|
|
140561
140894
|
if (!args.outdir) {
|
|
140562
140895
|
args.outfile ??= "_worker.bundle";
|
|
140563
140896
|
}
|
|
140564
|
-
args.buildOutputDirectory ??= args.outfile ? (0,
|
|
140897
|
+
args.buildOutputDirectory ??= args.outfile ? (0, import_node_path35.dirname)(args.outfile) : ".";
|
|
140565
140898
|
}
|
|
140566
140899
|
if (args.buildOutputDirectory) {
|
|
140567
|
-
args.buildOutputDirectory = (0,
|
|
140900
|
+
args.buildOutputDirectory = (0, import_node_path35.resolve)(args.buildOutputDirectory);
|
|
140568
140901
|
}
|
|
140569
140902
|
if (args.outdir) {
|
|
140570
|
-
args.outdir = (0,
|
|
140903
|
+
args.outdir = (0, import_node_path35.resolve)(args.outdir);
|
|
140571
140904
|
}
|
|
140572
140905
|
if (args.outfile) {
|
|
140573
|
-
args.outfile = (0,
|
|
140906
|
+
args.outfile = (0, import_node_path35.resolve)(args.outfile);
|
|
140574
140907
|
}
|
|
140575
140908
|
const { nodeCompat: legacyNodeCompat, ...argsExceptNodeCompat } = args;
|
|
140576
140909
|
if (legacyNodeCompat) {
|
|
@@ -140586,19 +140919,19 @@ var validateArgs = /* @__PURE__ */ __name((args) => {
|
|
|
140586
140919
|
}
|
|
140587
140920
|
let workerScriptPath;
|
|
140588
140921
|
if (args.buildOutputDirectory) {
|
|
140589
|
-
const prospectiveWorkerScriptPath = (0,
|
|
140922
|
+
const prospectiveWorkerScriptPath = (0, import_node_path35.resolve)(
|
|
140590
140923
|
args.buildOutputDirectory,
|
|
140591
140924
|
"_worker.js"
|
|
140592
140925
|
);
|
|
140593
|
-
const foundWorkerScript = (0,
|
|
140926
|
+
const foundWorkerScript = (0, import_node_fs22.existsSync)(prospectiveWorkerScriptPath);
|
|
140594
140927
|
if (foundWorkerScript) {
|
|
140595
140928
|
workerScriptPath = prospectiveWorkerScriptPath;
|
|
140596
|
-
} else if (!foundWorkerScript && !(0,
|
|
140929
|
+
} else if (!foundWorkerScript && !(0, import_node_fs22.existsSync)(args.directory)) {
|
|
140597
140930
|
throw new FatalError(
|
|
140598
140931
|
`Could not find anything to build.
|
|
140599
|
-
We first looked inside the build output directory (${(0,
|
|
140600
|
-
(0,
|
|
140601
|
-
)}), then looked for the Functions directory (${(0,
|
|
140932
|
+
We first looked inside the build output directory (${(0, import_node_path35.basename)(
|
|
140933
|
+
(0, import_node_path35.resolve)(args.buildOutputDirectory)
|
|
140934
|
+
)}), then looked for the Functions directory (${(0, import_node_path35.basename)(
|
|
140602
140935
|
args.directory
|
|
140603
140936
|
)}) but couldn't find anything to build.
|
|
140604
140937
|
\u27A4 If you are trying to build _worker.js, please make sure you provide the [--build-output-directory] containing your static files.
|
|
@@ -140606,10 +140939,10 @@ We first looked inside the build output directory (${(0, import_node_path34.base
|
|
|
140606
140939
|
EXIT_CODE_FUNCTIONS_NOTHING_TO_BUILD_ERROR
|
|
140607
140940
|
);
|
|
140608
140941
|
}
|
|
140609
|
-
} else if (!(0,
|
|
140942
|
+
} else if (!(0, import_node_fs22.existsSync)(args.directory)) {
|
|
140610
140943
|
throw new FatalError(
|
|
140611
140944
|
`Could not find anything to build.
|
|
140612
|
-
We looked for the Functions directory (${(0,
|
|
140945
|
+
We looked for the Functions directory (${(0, import_node_path35.basename)(
|
|
140613
140946
|
args.directory
|
|
140614
140947
|
)}) but couldn't find anything to build.
|
|
140615
140948
|
\u27A4 Please make sure [directory] points to the location of your Functions files.`,
|
|
@@ -140626,23 +140959,23 @@ We looked for the Functions directory (${(0, import_node_path34.basename)(
|
|
|
140626
140959
|
|
|
140627
140960
|
// src/pages/deploy.tsx
|
|
140628
140961
|
init_import_meta_url();
|
|
140629
|
-
var
|
|
140962
|
+
var import_node_child_process4 = require("node:child_process");
|
|
140630
140963
|
var import_ink9 = __toESM(require_build2());
|
|
140631
140964
|
var import_ink_select_input2 = __toESM(require_build3());
|
|
140632
140965
|
var import_react15 = __toESM(require_react());
|
|
140633
140966
|
|
|
140634
140967
|
// src/api/pages/deploy.tsx
|
|
140635
140968
|
init_import_meta_url();
|
|
140636
|
-
var
|
|
140969
|
+
var import_node_fs23 = require("node:fs");
|
|
140637
140970
|
var import_node_os11 = require("node:os");
|
|
140638
|
-
var
|
|
140971
|
+
var import_node_path37 = require("node:path");
|
|
140639
140972
|
var import_node_process7 = require("node:process");
|
|
140640
140973
|
var import_undici14 = __toESM(require_undici());
|
|
140641
140974
|
|
|
140642
140975
|
// src/pages/upload.tsx
|
|
140643
140976
|
init_import_meta_url();
|
|
140644
140977
|
var import_promises12 = require("node:fs/promises");
|
|
140645
|
-
var
|
|
140978
|
+
var import_node_path36 = require("node:path");
|
|
140646
140979
|
var import_ink7 = __toESM(require_build2());
|
|
140647
140980
|
var import_ink_spinner = __toESM(require_build4());
|
|
140648
140981
|
var import_mime2 = __toESM(require_mime2());
|
|
@@ -140663,12 +140996,12 @@ var TimeoutError = class extends Error {
|
|
|
140663
140996
|
__name(TimeoutError, "TimeoutError");
|
|
140664
140997
|
function pTimeout(promise, milliseconds, fallback, options14) {
|
|
140665
140998
|
let timer;
|
|
140666
|
-
const cancelablePromise = new Promise((
|
|
140999
|
+
const cancelablePromise = new Promise((resolve18, reject) => {
|
|
140667
141000
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
140668
141001
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
140669
141002
|
}
|
|
140670
141003
|
if (milliseconds === Number.POSITIVE_INFINITY) {
|
|
140671
|
-
|
|
141004
|
+
resolve18(promise);
|
|
140672
141005
|
return;
|
|
140673
141006
|
}
|
|
140674
141007
|
options14 = {
|
|
@@ -140678,7 +141011,7 @@ function pTimeout(promise, milliseconds, fallback, options14) {
|
|
|
140678
141011
|
timer = options14.customTimers.setTimeout.call(void 0, () => {
|
|
140679
141012
|
if (typeof fallback === "function") {
|
|
140680
141013
|
try {
|
|
140681
|
-
|
|
141014
|
+
resolve18(fallback());
|
|
140682
141015
|
} catch (error) {
|
|
140683
141016
|
reject(error);
|
|
140684
141017
|
}
|
|
@@ -140693,7 +141026,7 @@ function pTimeout(promise, milliseconds, fallback, options14) {
|
|
|
140693
141026
|
}, milliseconds);
|
|
140694
141027
|
(async () => {
|
|
140695
141028
|
try {
|
|
140696
|
-
|
|
141029
|
+
resolve18(await promise);
|
|
140697
141030
|
} catch (error) {
|
|
140698
141031
|
reject(error);
|
|
140699
141032
|
} finally {
|
|
@@ -140884,7 +141217,7 @@ var PQueue = class extends import_eventemitter3.default {
|
|
|
140884
141217
|
__classPrivateFieldGet3(this, _PQueue_instances, "m", _PQueue_processQueue).call(this);
|
|
140885
141218
|
}
|
|
140886
141219
|
async add(fn2, options14 = {}) {
|
|
140887
|
-
return new Promise((
|
|
141220
|
+
return new Promise((resolve18, reject) => {
|
|
140888
141221
|
const run = /* @__PURE__ */ __name(async () => {
|
|
140889
141222
|
var _a2;
|
|
140890
141223
|
var _b2, _c2;
|
|
@@ -140902,7 +141235,7 @@ var PQueue = class extends import_eventemitter3.default {
|
|
|
140902
141235
|
return void 0;
|
|
140903
141236
|
});
|
|
140904
141237
|
const result = await operation;
|
|
140905
|
-
|
|
141238
|
+
resolve18(result);
|
|
140906
141239
|
this.emit("completed", result);
|
|
140907
141240
|
} catch (error) {
|
|
140908
141241
|
reject(error);
|
|
@@ -140936,11 +141269,11 @@ var PQueue = class extends import_eventemitter3.default {
|
|
|
140936
141269
|
if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size === 0) {
|
|
140937
141270
|
return;
|
|
140938
141271
|
}
|
|
140939
|
-
return new Promise((
|
|
141272
|
+
return new Promise((resolve18) => {
|
|
140940
141273
|
const existingResolve = __classPrivateFieldGet3(this, _PQueue_resolveEmpty, "f");
|
|
140941
141274
|
__classPrivateFieldSet2(this, _PQueue_resolveEmpty, () => {
|
|
140942
141275
|
existingResolve();
|
|
140943
|
-
|
|
141276
|
+
resolve18();
|
|
140944
141277
|
}, "f");
|
|
140945
141278
|
});
|
|
140946
141279
|
}
|
|
@@ -140948,11 +141281,11 @@ var PQueue = class extends import_eventemitter3.default {
|
|
|
140948
141281
|
if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size < limit) {
|
|
140949
141282
|
return;
|
|
140950
141283
|
}
|
|
140951
|
-
return new Promise((
|
|
141284
|
+
return new Promise((resolve18) => {
|
|
140952
141285
|
const listener = /* @__PURE__ */ __name(() => {
|
|
140953
141286
|
if (__classPrivateFieldGet3(this, _PQueue_queue, "f").size < limit) {
|
|
140954
141287
|
this.removeListener("next", listener);
|
|
140955
|
-
|
|
141288
|
+
resolve18();
|
|
140956
141289
|
}
|
|
140957
141290
|
}, "listener");
|
|
140958
141291
|
this.on("next", listener);
|
|
@@ -140962,11 +141295,11 @@ var PQueue = class extends import_eventemitter3.default {
|
|
|
140962
141295
|
if (__classPrivateFieldGet3(this, _PQueue_pendingCount, "f") === 0 && __classPrivateFieldGet3(this, _PQueue_queue, "f").size === 0) {
|
|
140963
141296
|
return;
|
|
140964
141297
|
}
|
|
140965
|
-
return new Promise((
|
|
141298
|
+
return new Promise((resolve18) => {
|
|
140966
141299
|
const existingResolve = __classPrivateFieldGet3(this, _PQueue_resolveIdle, "f");
|
|
140967
141300
|
__classPrivateFieldSet2(this, _PQueue_resolveIdle, () => {
|
|
140968
141301
|
existingResolve();
|
|
140969
|
-
|
|
141302
|
+
resolve18();
|
|
140970
141303
|
}, "f");
|
|
140971
141304
|
});
|
|
140972
141305
|
}
|
|
@@ -141109,7 +141442,7 @@ var Handler7 = /* @__PURE__ */ __name(async ({
|
|
|
141109
141442
|
skipCaching: skipCaching ?? false
|
|
141110
141443
|
});
|
|
141111
141444
|
if (outputManifestPath) {
|
|
141112
|
-
await (0, import_promises12.mkdir)((0,
|
|
141445
|
+
await (0, import_promises12.mkdir)((0, import_node_path36.dirname)(outputManifestPath), { recursive: true });
|
|
141113
141446
|
await (0, import_promises12.writeFile)(outputManifestPath, JSON.stringify(manifest));
|
|
141114
141447
|
}
|
|
141115
141448
|
logger.log(`\u2728 Upload complete!`);
|
|
@@ -141135,13 +141468,13 @@ var upload = /* @__PURE__ */ __name(async (args) => {
|
|
|
141135
141468
|
"**/node_modules",
|
|
141136
141469
|
"**/.git"
|
|
141137
141470
|
].map((pattern) => new import_minimatch.Minimatch(pattern));
|
|
141138
|
-
const directory = (0,
|
|
141471
|
+
const directory = (0, import_node_path36.resolve)(args.directory);
|
|
141139
141472
|
const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
|
|
141140
141473
|
const files2 = await (0, import_promises12.readdir)(dir);
|
|
141141
141474
|
await Promise.all(
|
|
141142
141475
|
files2.map(async (file) => {
|
|
141143
|
-
const filepath = (0,
|
|
141144
|
-
const relativeFilepath = (0,
|
|
141476
|
+
const filepath = (0, import_node_path36.join)(dir, file);
|
|
141477
|
+
const relativeFilepath = (0, import_node_path36.relative)(startingDir, filepath);
|
|
141145
141478
|
const filestat = await (0, import_promises12.stat)(filepath);
|
|
141146
141479
|
for (const minimatch of IGNORE_LIST) {
|
|
141147
141480
|
if (minimatch.match(relativeFilepath)) {
|
|
@@ -141154,7 +141487,7 @@ var upload = /* @__PURE__ */ __name(async (args) => {
|
|
|
141154
141487
|
if (filestat.isDirectory()) {
|
|
141155
141488
|
fileMap2 = await walk(filepath, fileMap2, startingDir);
|
|
141156
141489
|
} else {
|
|
141157
|
-
const name = relativeFilepath.split(
|
|
141490
|
+
const name = relativeFilepath.split(import_node_path36.sep).join("/");
|
|
141158
141491
|
if (filestat.size > MAX_ASSET_SIZE) {
|
|
141159
141492
|
throw new FatalError(
|
|
141160
141493
|
`Error: Pages only supports files up to ${prettyBytes(
|
|
@@ -141418,23 +141751,23 @@ async function deploy2({
|
|
|
141418
141751
|
}) {
|
|
141419
141752
|
let _headers, _redirects, _routesGenerated, _routesCustom, _workerJSIsDirectory = false, _workerJS;
|
|
141420
141753
|
bundle = bundle ?? true;
|
|
141421
|
-
const _workerPath = (0,
|
|
141754
|
+
const _workerPath = (0, import_node_path37.resolve)(directory, "_worker.js");
|
|
141422
141755
|
try {
|
|
141423
|
-
_headers = (0,
|
|
141756
|
+
_headers = (0, import_node_fs23.readFileSync)((0, import_node_path37.join)(directory, "_headers"), "utf-8");
|
|
141424
141757
|
} catch {
|
|
141425
141758
|
}
|
|
141426
141759
|
try {
|
|
141427
|
-
_redirects = (0,
|
|
141760
|
+
_redirects = (0, import_node_fs23.readFileSync)((0, import_node_path37.join)(directory, "_redirects"), "utf-8");
|
|
141428
141761
|
} catch {
|
|
141429
141762
|
}
|
|
141430
141763
|
try {
|
|
141431
|
-
_routesCustom = (0,
|
|
141764
|
+
_routesCustom = (0, import_node_fs23.readFileSync)((0, import_node_path37.join)(directory, "_routes.json"), "utf-8");
|
|
141432
141765
|
} catch {
|
|
141433
141766
|
}
|
|
141434
141767
|
try {
|
|
141435
|
-
_workerJSIsDirectory = (0,
|
|
141768
|
+
_workerJSIsDirectory = (0, import_node_fs23.lstatSync)(_workerPath).isDirectory();
|
|
141436
141769
|
if (!_workerJSIsDirectory) {
|
|
141437
|
-
_workerJS = (0,
|
|
141770
|
+
_workerJS = (0, import_node_fs23.readFileSync)(_workerPath, "utf-8");
|
|
141438
141771
|
}
|
|
141439
141772
|
} catch {
|
|
141440
141773
|
}
|
|
@@ -141449,14 +141782,14 @@ async function deploy2({
|
|
|
141449
141782
|
const nodejsCompat = deploymentConfig.compatibility_flags?.includes("nodejs_compat");
|
|
141450
141783
|
let builtFunctions = void 0;
|
|
141451
141784
|
let workerBundle = void 0;
|
|
141452
|
-
const functionsDirectory = customFunctionsDirectory || (0,
|
|
141453
|
-
const routesOutputPath = !(0,
|
|
141785
|
+
const functionsDirectory = customFunctionsDirectory || (0, import_node_path37.join)((0, import_node_process7.cwd)(), "functions");
|
|
141786
|
+
const routesOutputPath = !(0, import_node_fs23.existsSync)((0, import_node_path37.join)(directory, "_routes.json")) ? (0, import_node_path37.join)((0, import_node_os11.tmpdir)(), `_routes-${Math.random()}.json`) : void 0;
|
|
141454
141787
|
let filepathRoutingConfig;
|
|
141455
141788
|
const d1Databases = Object.keys(
|
|
141456
141789
|
project.deployment_configs[isProduction ? "production" : "preview"].d1_databases ?? {}
|
|
141457
141790
|
);
|
|
141458
|
-
if (!_workerJS && (0,
|
|
141459
|
-
const outputConfigPath = (0,
|
|
141791
|
+
if (!_workerJS && (0, import_node_fs23.existsSync)(functionsDirectory)) {
|
|
141792
|
+
const outputConfigPath = (0, import_node_path37.join)(
|
|
141460
141793
|
(0, import_node_os11.tmpdir)(),
|
|
141461
141794
|
`functions-filepath-routing-config-${Math.random()}.json`
|
|
141462
141795
|
);
|
|
@@ -141472,11 +141805,11 @@ async function deploy2({
|
|
|
141472
141805
|
d1Databases,
|
|
141473
141806
|
nodejsCompat
|
|
141474
141807
|
});
|
|
141475
|
-
builtFunctions = (0,
|
|
141808
|
+
builtFunctions = (0, import_node_fs23.readFileSync)(
|
|
141476
141809
|
workerBundle.resolvedEntryPointPath,
|
|
141477
141810
|
"utf-8"
|
|
141478
141811
|
);
|
|
141479
|
-
filepathRoutingConfig = (0,
|
|
141812
|
+
filepathRoutingConfig = (0, import_node_fs23.readFileSync)(outputConfigPath, "utf-8");
|
|
141480
141813
|
} catch (e2) {
|
|
141481
141814
|
if (e2 instanceof FunctionsNoRoutesError) {
|
|
141482
141815
|
logger.warn(
|
|
@@ -141533,7 +141866,7 @@ async function deploy2({
|
|
|
141533
141866
|
});
|
|
141534
141867
|
} else if (_workerJS) {
|
|
141535
141868
|
if (bundle) {
|
|
141536
|
-
const outfile = (0,
|
|
141869
|
+
const outfile = (0, import_node_path37.join)((0, import_node_os11.tmpdir)(), `./bundledWorker-${Math.random()}.mjs`);
|
|
141537
141870
|
workerBundle = await buildRawWorker({
|
|
141538
141871
|
workerScriptPath: _workerPath,
|
|
141539
141872
|
outfile,
|
|
@@ -141571,7 +141904,7 @@ async function deploy2({
|
|
|
141571
141904
|
if (_routesCustom) {
|
|
141572
141905
|
try {
|
|
141573
141906
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
|
141574
|
-
validateRoutes2(routesCustomJSON, (0,
|
|
141907
|
+
validateRoutes2(routesCustomJSON, (0, import_node_path37.join)(directory, "_routes.json"));
|
|
141575
141908
|
formData.append(
|
|
141576
141909
|
"_routes.json",
|
|
141577
141910
|
new import_undici14.File([_routesCustom], "_routes.json")
|
|
@@ -141596,7 +141929,7 @@ async function deploy2({
|
|
|
141596
141929
|
if (_routesCustom) {
|
|
141597
141930
|
try {
|
|
141598
141931
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
|
141599
|
-
validateRoutes2(routesCustomJSON, (0,
|
|
141932
|
+
validateRoutes2(routesCustomJSON, (0, import_node_path37.join)(directory, "_routes.json"));
|
|
141600
141933
|
formData.append(
|
|
141601
141934
|
"_routes.json",
|
|
141602
141935
|
new import_undici14.File([_routesCustom], "_routes.json")
|
|
@@ -141609,7 +141942,7 @@ async function deploy2({
|
|
|
141609
141942
|
}
|
|
141610
141943
|
} else if (routesOutputPath) {
|
|
141611
141944
|
try {
|
|
141612
|
-
_routesGenerated = (0,
|
|
141945
|
+
_routesGenerated = (0, import_node_fs23.readFileSync)(routesOutputPath, "utf-8");
|
|
141613
141946
|
if (_routesGenerated) {
|
|
141614
141947
|
formData.append(
|
|
141615
141948
|
"_routes.json",
|
|
@@ -141633,7 +141966,7 @@ __name(deploy2, "deploy");
|
|
|
141633
141966
|
|
|
141634
141967
|
// src/pages/projects.tsx
|
|
141635
141968
|
init_import_meta_url();
|
|
141636
|
-
var
|
|
141969
|
+
var import_node_child_process3 = require("node:child_process");
|
|
141637
141970
|
var import_ink_table7 = __toESM(require_dist3());
|
|
141638
141971
|
var import_react13 = __toESM(require_react());
|
|
141639
141972
|
|
|
@@ -141823,7 +142156,7 @@ async function CreateHandler3({
|
|
|
141823
142156
|
if (!productionBranch && isInteractive2) {
|
|
141824
142157
|
let isGitDir = true;
|
|
141825
142158
|
try {
|
|
141826
|
-
(0,
|
|
142159
|
+
(0, import_node_child_process3.execSync)(`git rev-parse --is-inside-work-tree`, {
|
|
141827
142160
|
stdio: "ignore"
|
|
141828
142161
|
});
|
|
141829
142162
|
} catch (err) {
|
|
@@ -141831,7 +142164,7 @@ async function CreateHandler3({
|
|
|
141831
142164
|
}
|
|
141832
142165
|
if (isGitDir) {
|
|
141833
142166
|
try {
|
|
141834
|
-
productionBranch = (0,
|
|
142167
|
+
productionBranch = (0, import_node_child_process3.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim();
|
|
141835
142168
|
} catch (err) {
|
|
141836
142169
|
}
|
|
141837
142170
|
}
|
|
@@ -141918,7 +142251,7 @@ async function promptSelectProject({
|
|
|
141918
142251
|
accountId
|
|
141919
142252
|
}) {
|
|
141920
142253
|
const projects = await listProjects2({ accountId });
|
|
141921
|
-
return new Promise((
|
|
142254
|
+
return new Promise((resolve18) => {
|
|
141922
142255
|
const { unmount } = (0, import_ink8.render)(
|
|
141923
142256
|
/* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(import_ink8.Text, null, "Select a project:"), /* @__PURE__ */ import_react14.default.createElement(
|
|
141924
142257
|
import_ink_select_input.default,
|
|
@@ -141929,7 +142262,7 @@ async function promptSelectProject({
|
|
|
141929
142262
|
value: project
|
|
141930
142263
|
})),
|
|
141931
142264
|
onSelect: async (selected) => {
|
|
141932
|
-
|
|
142265
|
+
resolve18(selected.value.name);
|
|
141933
142266
|
unmount();
|
|
141934
142267
|
}
|
|
141935
142268
|
}
|
|
@@ -142022,7 +142355,7 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142022
142355
|
);
|
|
142023
142356
|
let existingOrNew = "new";
|
|
142024
142357
|
if (projects.length > 0) {
|
|
142025
|
-
existingOrNew = await new Promise((
|
|
142358
|
+
existingOrNew = await new Promise((resolve18) => {
|
|
142026
142359
|
const { unmount } = (0, import_ink9.render)(
|
|
142027
142360
|
/* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_ink9.Text, null, "No project selected. Would you like to create one or use an existing project?"), /* @__PURE__ */ import_react15.default.createElement(
|
|
142028
142361
|
import_ink_select_input2.default,
|
|
@@ -142040,7 +142373,7 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142040
142373
|
}
|
|
142041
142374
|
],
|
|
142042
142375
|
onSelect: async (selected) => {
|
|
142043
|
-
|
|
142376
|
+
resolve18(selected.value);
|
|
142044
142377
|
unmount();
|
|
142045
142378
|
}
|
|
142046
142379
|
}
|
|
@@ -142060,7 +142393,7 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142060
142393
|
}
|
|
142061
142394
|
let isGitDir2 = true;
|
|
142062
142395
|
try {
|
|
142063
|
-
(0,
|
|
142396
|
+
(0, import_node_child_process4.execSync)(`git rev-parse --is-inside-work-tree`, {
|
|
142064
142397
|
stdio: "ignore"
|
|
142065
142398
|
});
|
|
142066
142399
|
} catch (err) {
|
|
@@ -142069,7 +142402,7 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142069
142402
|
const productionBranch = await prompt(
|
|
142070
142403
|
"Enter the production branch name:",
|
|
142071
142404
|
{
|
|
142072
|
-
defaultValue: isGitDir2 ? (0,
|
|
142405
|
+
defaultValue: isGitDir2 ? (0, import_node_child_process4.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim() : "production"
|
|
142073
142406
|
}
|
|
142074
142407
|
);
|
|
142075
142408
|
if (!productionBranch) {
|
|
@@ -142097,7 +142430,7 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142097
142430
|
}
|
|
142098
142431
|
let isGitDir = true;
|
|
142099
142432
|
try {
|
|
142100
|
-
(0,
|
|
142433
|
+
(0, import_node_child_process4.execSync)(`git rev-parse --is-inside-work-tree`, {
|
|
142101
142434
|
stdio: "ignore"
|
|
142102
142435
|
});
|
|
142103
142436
|
} catch (err) {
|
|
@@ -142107,16 +142440,16 @@ var Handler8 = /* @__PURE__ */ __name(async ({
|
|
|
142107
142440
|
if (isGitDir) {
|
|
142108
142441
|
try {
|
|
142109
142442
|
isGitDirty = Boolean(
|
|
142110
|
-
(0,
|
|
142443
|
+
(0, import_node_child_process4.execSync)(`git status --porcelain`).toString().length
|
|
142111
142444
|
);
|
|
142112
142445
|
if (!branch) {
|
|
142113
|
-
branch = (0,
|
|
142446
|
+
branch = (0, import_node_child_process4.execSync)(`git rev-parse --abbrev-ref HEAD`).toString().trim();
|
|
142114
142447
|
}
|
|
142115
142448
|
if (!commitHash) {
|
|
142116
|
-
commitHash = (0,
|
|
142449
|
+
commitHash = (0, import_node_child_process4.execSync)(`git rev-parse HEAD`).toString().trim();
|
|
142117
142450
|
}
|
|
142118
142451
|
if (!commitMessage) {
|
|
142119
|
-
commitMessage = (0,
|
|
142452
|
+
commitMessage = (0, import_node_child_process4.execSync)(`git show -s --format=%B ${commitHash}`).toString().trim();
|
|
142120
142453
|
}
|
|
142121
142454
|
} catch (err) {
|
|
142122
142455
|
}
|
|
@@ -142684,10 +143017,10 @@ __name(ListHandler4, "ListHandler");
|
|
|
142684
143017
|
|
|
142685
143018
|
// src/pages/dev.ts
|
|
142686
143019
|
init_import_meta_url();
|
|
142687
|
-
var
|
|
142688
|
-
var
|
|
143020
|
+
var import_node_child_process5 = require("node:child_process");
|
|
143021
|
+
var import_node_fs24 = require("node:fs");
|
|
142689
143022
|
var import_node_os12 = require("node:os");
|
|
142690
|
-
var
|
|
143023
|
+
var import_node_path38 = require("node:path");
|
|
142691
143024
|
var import_chokidar2 = require("chokidar");
|
|
142692
143025
|
var esbuild3 = __toESM(require("esbuild"));
|
|
142693
143026
|
|
|
@@ -142893,7 +143226,7 @@ var Handler10 = /* @__PURE__ */ __name(async ({
|
|
|
142893
143226
|
if (proxyPort === void 0)
|
|
142894
143227
|
return void 0;
|
|
142895
143228
|
} else {
|
|
142896
|
-
directory = (0,
|
|
143229
|
+
directory = (0, import_node_path38.resolve)(directory);
|
|
142897
143230
|
}
|
|
142898
143231
|
if (!compatibilityDate) {
|
|
142899
143232
|
const currentDate = new Date().toISOString().substring(0, 10);
|
|
@@ -142911,12 +143244,12 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
142911
143244
|
const scriptReadyPromise = new Promise(
|
|
142912
143245
|
(promiseResolve) => scriptReadyResolve = promiseResolve
|
|
142913
143246
|
);
|
|
142914
|
-
const workerScriptPath = directory !== void 0 ? (0,
|
|
142915
|
-
const usingWorkerDirectory = (0,
|
|
142916
|
-
const usingWorkerScript = (0,
|
|
143247
|
+
const workerScriptPath = directory !== void 0 ? (0, import_node_path38.join)(directory, singleWorkerScriptPath) : singleWorkerScriptPath;
|
|
143248
|
+
const usingWorkerDirectory = (0, import_node_fs24.existsSync)(workerScriptPath) && (0, import_node_fs24.lstatSync)(workerScriptPath).isDirectory();
|
|
143249
|
+
const usingWorkerScript = (0, import_node_fs24.existsSync)(workerScriptPath);
|
|
142917
143250
|
const enableBundling = bundle ?? !noBundle;
|
|
142918
143251
|
const functionsDirectory = "./functions";
|
|
142919
|
-
let usingFunctions = !usingWorkerScript && (0,
|
|
143252
|
+
let usingFunctions = !usingWorkerScript && (0, import_node_fs24.existsSync)(functionsDirectory);
|
|
142920
143253
|
let scriptPath = "";
|
|
142921
143254
|
const nodejsCompat = compatibilityFlags?.includes("nodejs_compat");
|
|
142922
143255
|
let modules = [];
|
|
@@ -142943,11 +143276,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
142943
143276
|
await checkRawWorker(workerScriptPath, () => scriptReadyResolve());
|
|
142944
143277
|
}, "runBuild");
|
|
142945
143278
|
if (enableBundling) {
|
|
142946
|
-
scriptPath = (0,
|
|
143279
|
+
scriptPath = (0, import_node_path38.join)((0, import_node_os12.tmpdir)(), `./bundledWorker-${Math.random()}.mjs`);
|
|
142947
143280
|
runBuild = /* @__PURE__ */ __name(async () => {
|
|
142948
143281
|
try {
|
|
142949
143282
|
await buildRawWorker({
|
|
142950
|
-
workerScriptPath: usingWorkerDirectory ? (0,
|
|
143283
|
+
workerScriptPath: usingWorkerDirectory ? (0, import_node_path38.join)(workerScriptPath, "index.js") : workerScriptPath,
|
|
142951
143284
|
outfile: scriptPath,
|
|
142952
143285
|
directory: directory ?? ".",
|
|
142953
143286
|
nodejsCompat,
|
|
@@ -142969,7 +143302,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
142969
143302
|
await runBuild();
|
|
142970
143303
|
});
|
|
142971
143304
|
} else if (usingFunctions) {
|
|
142972
|
-
scriptPath = (0,
|
|
143305
|
+
scriptPath = (0, import_node_path38.join)((0, import_node_os12.tmpdir)(), `./functionsWorker-${Math.random()}.mjs`);
|
|
142973
143306
|
if (legacyNodeCompat) {
|
|
142974
143307
|
console.warn(
|
|
142975
143308
|
"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."
|
|
@@ -143030,7 +143363,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
143030
143363
|
if (!usingFunctions && !usingWorkerScript) {
|
|
143031
143364
|
scriptReadyResolve();
|
|
143032
143365
|
logger.log("No functions. Shimming...");
|
|
143033
|
-
scriptPath = (0,
|
|
143366
|
+
scriptPath = (0, import_node_path38.resolve)(getBasePath(), "templates/pages-shim.ts");
|
|
143034
143367
|
}
|
|
143035
143368
|
await scriptReadyPromise;
|
|
143036
143369
|
if (scriptPath === "") {
|
|
@@ -143041,13 +143374,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
143041
143374
|
}
|
|
143042
143375
|
let entrypoint = scriptPath;
|
|
143043
143376
|
if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
|
|
143044
|
-
const routesJSONPath = (0,
|
|
143045
|
-
if ((0,
|
|
143377
|
+
const routesJSONPath = (0, import_node_path38.join)(directory, "_routes.json");
|
|
143378
|
+
if ((0, import_node_fs24.existsSync)(routesJSONPath)) {
|
|
143046
143379
|
let routesJSONContents;
|
|
143047
143380
|
const runBuild = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
|
|
143048
143381
|
await esbuild3.build({
|
|
143049
143382
|
entryPoints: [
|
|
143050
|
-
(0,
|
|
143383
|
+
(0, import_node_path38.resolve)(getBasePath(), "templates/pages-dev-pipeline.ts")
|
|
143051
143384
|
],
|
|
143052
143385
|
bundle: true,
|
|
143053
143386
|
sourcemap: true,
|
|
@@ -143055,7 +143388,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
143055
143388
|
plugins: [
|
|
143056
143389
|
esbuildAliasExternalPlugin({
|
|
143057
143390
|
__ENTRY_POINT__: entrypointFile,
|
|
143058
|
-
"./pages-dev-util": (0,
|
|
143391
|
+
"./pages-dev-util": (0, import_node_path38.resolve)(
|
|
143059
143392
|
getBasePath(),
|
|
143060
143393
|
"templates/pages-dev-util.ts"
|
|
143061
143394
|
)
|
|
@@ -143068,9 +143401,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
143068
143401
|
});
|
|
143069
143402
|
}, "runBuild");
|
|
143070
143403
|
try {
|
|
143071
|
-
routesJSONContents = (0,
|
|
143404
|
+
routesJSONContents = (0, import_node_fs24.readFileSync)(routesJSONPath, "utf-8");
|
|
143072
143405
|
validateRoutes2(JSON.parse(routesJSONContents), directory);
|
|
143073
|
-
entrypoint = (0,
|
|
143406
|
+
entrypoint = (0, import_node_path38.join)(
|
|
143074
143407
|
(0, import_node_os12.tmpdir)(),
|
|
143075
143408
|
`${Math.random().toString(36).slice(2)}.js`
|
|
143076
143409
|
);
|
|
@@ -143090,7 +143423,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
143090
143423
|
ignoreInitial: true
|
|
143091
143424
|
}).on("all", async () => {
|
|
143092
143425
|
try {
|
|
143093
|
-
routesJSONContents = (0,
|
|
143426
|
+
routesJSONContents = (0, import_node_fs24.readFileSync)(routesJSONPath, "utf-8");
|
|
143094
143427
|
validateRoutes2(JSON.parse(routesJSONContents), directory);
|
|
143095
143428
|
await runBuild(scriptPath, entrypoint, routesJSONContents);
|
|
143096
143429
|
} catch (err) {
|
|
@@ -143225,7 +143558,7 @@ function getPids(pid) {
|
|
|
143225
143558
|
regExp = new RegExp(/(\d+)/);
|
|
143226
143559
|
}
|
|
143227
143560
|
try {
|
|
143228
|
-
const newPids = (0,
|
|
143561
|
+
const newPids = (0, import_node_child_process5.execSync)(command2).toString().split("\n").map((line) => line.match(regExp)).filter((line) => line !== null).map((match) => parseInt(match[1]));
|
|
143229
143562
|
pids.push(...newPids.map(getPids).flat());
|
|
143230
143563
|
} catch {
|
|
143231
143564
|
}
|
|
@@ -143243,7 +143576,7 @@ function getPort(pid) {
|
|
|
143243
143576
|
regExp = new RegExp(`${pid}\\s+.*TCP\\s+.*:(\\d+)\\s+\\(LISTEN\\)`);
|
|
143244
143577
|
}
|
|
143245
143578
|
try {
|
|
143246
|
-
const matches = (0,
|
|
143579
|
+
const matches = (0, import_node_child_process5.execSync)(command2).toString().split("\n").map((line) => line.match(regExp)).filter((line) => line !== null);
|
|
143247
143580
|
const match = matches[0];
|
|
143248
143581
|
if (match)
|
|
143249
143582
|
return parseInt(match[1]);
|
|
@@ -143269,7 +143602,7 @@ async function spawnProxyProcess({
|
|
|
143269
143602
|
);
|
|
143270
143603
|
}
|
|
143271
143604
|
logger.log(`Running ${command2.join(" ")}...`);
|
|
143272
|
-
const proxy2 = (0,
|
|
143605
|
+
const proxy2 = (0, import_node_child_process5.spawn)(
|
|
143273
143606
|
command2[0].toString(),
|
|
143274
143607
|
command2.slice(1).map((value) => value.toString()),
|
|
143275
143608
|
{
|
|
@@ -143319,8 +143652,8 @@ __name(spawnProxyProcess, "spawnProxyProcess");
|
|
|
143319
143652
|
|
|
143320
143653
|
// src/pages/functions.ts
|
|
143321
143654
|
init_import_meta_url();
|
|
143322
|
-
var
|
|
143323
|
-
var
|
|
143655
|
+
var import_node_fs25 = require("node:fs");
|
|
143656
|
+
var import_node_path39 = __toESM(require("node:path"));
|
|
143324
143657
|
function OptimizeRoutesOptions(yargs) {
|
|
143325
143658
|
return yargs.options({
|
|
143326
143659
|
"routes-path": {
|
|
@@ -143342,21 +143675,21 @@ async function OptimizeRoutesHandler({
|
|
|
143342
143675
|
outputRoutesPath
|
|
143343
143676
|
}) {
|
|
143344
143677
|
let routesFileContents;
|
|
143345
|
-
const routesOutputDirectory =
|
|
143346
|
-
if (!(0,
|
|
143678
|
+
const routesOutputDirectory = import_node_path39.default.dirname(outputRoutesPath);
|
|
143679
|
+
if (!(0, import_node_fs25.existsSync)(routesPath)) {
|
|
143347
143680
|
throw new FatalError(
|
|
143348
143681
|
`Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
|
|
143349
143682
|
1
|
|
143350
143683
|
);
|
|
143351
143684
|
}
|
|
143352
|
-
if (!(0,
|
|
143685
|
+
if (!(0, import_node_fs25.existsSync)(routesOutputDirectory) || !(0, import_node_fs25.lstatSync)(routesOutputDirectory).isDirectory()) {
|
|
143353
143686
|
throw new FatalError(
|
|
143354
143687
|
`Oops! Folder ${routesOutputDirectory} does not exist. Please make sure --output-routes-path is a valid file path (for example "/public/_routes.json").`,
|
|
143355
143688
|
1
|
|
143356
143689
|
);
|
|
143357
143690
|
}
|
|
143358
143691
|
try {
|
|
143359
|
-
routesFileContents = (0,
|
|
143692
|
+
routesFileContents = (0, import_node_fs25.readFileSync)(routesPath, "utf-8");
|
|
143360
143693
|
} catch (err) {
|
|
143361
143694
|
throw new FatalError(`Error while reading ${routesPath} file: ${err}`);
|
|
143362
143695
|
}
|
|
@@ -143365,7 +143698,7 @@ async function OptimizeRoutesHandler({
|
|
|
143365
143698
|
const optimizedRoutes = optimizeRoutesJSONSpec(routes);
|
|
143366
143699
|
const optimizedRoutesContents = JSON.stringify(optimizedRoutes);
|
|
143367
143700
|
try {
|
|
143368
|
-
(0,
|
|
143701
|
+
(0, import_node_fs25.writeFileSync)(outputRoutesPath, optimizedRoutesContents);
|
|
143369
143702
|
} catch (err) {
|
|
143370
143703
|
throw new FatalError(
|
|
143371
143704
|
`Error writing to ${outputRoutesPath} file: ${err}`,
|
|
@@ -144463,9 +144796,9 @@ function r2(r2Yargs) {
|
|
|
144463
144796
|
}
|
|
144464
144797
|
const input = await getR2Object(accountId, bucket, key);
|
|
144465
144798
|
const output = file ? fs15.createWriteStream(file) : process.stdout;
|
|
144466
|
-
await new Promise((
|
|
144799
|
+
await new Promise((resolve18, reject) => {
|
|
144467
144800
|
stream.pipeline(input, output, (err) => {
|
|
144468
|
-
err ? reject(err) :
|
|
144801
|
+
err ? reject(err) : resolve18();
|
|
144469
144802
|
});
|
|
144470
144803
|
});
|
|
144471
144804
|
if (!pipe)
|
|
@@ -144539,11 +144872,11 @@ function r2(r2Yargs) {
|
|
|
144539
144872
|
const stats = fs15.statSync(file);
|
|
144540
144873
|
objectSize = stats.size;
|
|
144541
144874
|
} else {
|
|
144542
|
-
object = await new Promise((
|
|
144875
|
+
object = await new Promise((resolve18, reject) => {
|
|
144543
144876
|
const stdin = process.stdin;
|
|
144544
144877
|
const chunks = Array();
|
|
144545
144878
|
stdin.on("data", (chunk) => chunks.push(chunk));
|
|
144546
|
-
stdin.on("end", () =>
|
|
144879
|
+
stdin.on("end", () => resolve18(Buffer.concat(chunks)));
|
|
144547
144880
|
stdin.on(
|
|
144548
144881
|
"error",
|
|
144549
144882
|
(err) => reject(
|
|
@@ -144656,7 +144989,8 @@ __name(r2, "r2");
|
|
|
144656
144989
|
|
|
144657
144990
|
// src/secret/index.ts
|
|
144658
144991
|
init_import_meta_url();
|
|
144659
|
-
var
|
|
144992
|
+
var import_node_path40 = __toESM(require("node:path"));
|
|
144993
|
+
var import_node_readline = __toESM(require("node:readline"));
|
|
144660
144994
|
var secret = /* @__PURE__ */ __name((secretYargs) => {
|
|
144661
144995
|
return secretYargs.option("legacy-env", {
|
|
144662
144996
|
type: "boolean",
|
|
@@ -144734,8 +145068,12 @@ var secret = /* @__PURE__ */ __name((secretYargs) => {
|
|
|
144734
145068
|
data_blobs: {},
|
|
144735
145069
|
dispatch_namespaces: [],
|
|
144736
145070
|
mtls_certificates: [],
|
|
144737
|
-
logfwdr: {
|
|
144738
|
-
unsafe: {
|
|
145071
|
+
logfwdr: { bindings: [] },
|
|
145072
|
+
unsafe: {
|
|
145073
|
+
bindings: void 0,
|
|
145074
|
+
metadata: void 0,
|
|
145075
|
+
capnp: void 0
|
|
145076
|
+
}
|
|
144739
145077
|
},
|
|
144740
145078
|
modules: [],
|
|
144741
145079
|
migrations: void 0,
|
|
@@ -144833,23 +145171,12 @@ var secret = /* @__PURE__ */ __name((secretYargs) => {
|
|
|
144833
145171
|
}
|
|
144834
145172
|
);
|
|
144835
145173
|
}, "secret");
|
|
144836
|
-
var secretBulkOptions = /* @__PURE__ */ __name((yargs) => {
|
|
144837
|
-
return yargs.positional("json", {
|
|
144838
|
-
describe: `The JSON file of key-value pairs to upload, in form {"key": value, ...}`,
|
|
144839
|
-
type: "string",
|
|
144840
|
-
demandOption: "true"
|
|
144841
|
-
}).option("name", {
|
|
144842
|
-
describe: "Name of the Worker",
|
|
144843
|
-
type: "string",
|
|
144844
|
-
requiresArg: true
|
|
144845
|
-
});
|
|
144846
|
-
}, "secretBulkOptions");
|
|
144847
145174
|
function trimTrailingWhitespace(str) {
|
|
144848
145175
|
return str.trimEnd();
|
|
144849
145176
|
}
|
|
144850
145177
|
__name(trimTrailingWhitespace, "trimTrailingWhitespace");
|
|
144851
145178
|
function readFromStdin() {
|
|
144852
|
-
return new Promise((
|
|
145179
|
+
return new Promise((resolve18, reject) => {
|
|
144853
145180
|
const stdin = process.stdin;
|
|
144854
145181
|
const chunks = [];
|
|
144855
145182
|
stdin.on("readable", () => {
|
|
@@ -144859,7 +145186,7 @@ function readFromStdin() {
|
|
|
144859
145186
|
}
|
|
144860
145187
|
});
|
|
144861
145188
|
stdin.on("end", () => {
|
|
144862
|
-
|
|
145189
|
+
resolve18(chunks.join(""));
|
|
144863
145190
|
});
|
|
144864
145191
|
stdin.on("error", (err) => {
|
|
144865
145192
|
reject(err);
|
|
@@ -144867,12 +145194,22 @@ function readFromStdin() {
|
|
|
144867
145194
|
});
|
|
144868
145195
|
}
|
|
144869
145196
|
__name(readFromStdin, "readFromStdin");
|
|
145197
|
+
var secretBulkOptions = /* @__PURE__ */ __name((yargs) => {
|
|
145198
|
+
return yargs.positional("json", {
|
|
145199
|
+
describe: `The JSON file of key-value pairs to upload, in form {"key": value, ...}`,
|
|
145200
|
+
type: "string"
|
|
145201
|
+
}).option("name", {
|
|
145202
|
+
describe: "Name of the Worker",
|
|
145203
|
+
type: "string",
|
|
145204
|
+
requiresArg: true
|
|
145205
|
+
});
|
|
145206
|
+
}, "secretBulkOptions");
|
|
144870
145207
|
var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
144871
145208
|
await printWranglerBanner();
|
|
144872
145209
|
const config = readConfig(secretBulkArgs.config, secretBulkArgs);
|
|
144873
145210
|
const scriptName = getLegacyScriptName(secretBulkArgs, config);
|
|
144874
145211
|
if (!scriptName) {
|
|
144875
|
-
throw
|
|
145212
|
+
throw logger.error(
|
|
144876
145213
|
"Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name <worker-name>`"
|
|
144877
145214
|
);
|
|
144878
145215
|
}
|
|
@@ -144880,18 +145217,28 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
|
144880
145217
|
logger.log(
|
|
144881
145218
|
`\u{1F300} Creating the secrets for the Worker "${scriptName}" ${secretBulkArgs.env && !isLegacyEnv(config) ? `(${secretBulkArgs.env})` : ""}`
|
|
144882
145219
|
);
|
|
144883
|
-
|
|
144884
|
-
|
|
144885
|
-
|
|
144886
|
-
|
|
144887
|
-
|
|
144888
|
-
|
|
144889
|
-
|
|
144890
|
-
|
|
144891
|
-
|
|
144892
|
-
);
|
|
145220
|
+
let content;
|
|
145221
|
+
if (secretBulkArgs.json) {
|
|
145222
|
+
const jsonFilePath = import_node_path40.default.resolve(secretBulkArgs.json);
|
|
145223
|
+
content = parseJSON(
|
|
145224
|
+
readFileSync5(jsonFilePath),
|
|
145225
|
+
jsonFilePath
|
|
145226
|
+
);
|
|
145227
|
+
} else {
|
|
145228
|
+
try {
|
|
145229
|
+
const rl = import_node_readline.default.createInterface({ input: process.stdin });
|
|
145230
|
+
let pipedInput = "";
|
|
145231
|
+
for await (const line of rl) {
|
|
145232
|
+
pipedInput += line;
|
|
145233
|
+
}
|
|
145234
|
+
content = parseJSON(pipedInput);
|
|
145235
|
+
} catch {
|
|
145236
|
+
return logger.error(`\u{1F6A8} Please provide a JSON file or valid JSON pipe`);
|
|
144893
145237
|
}
|
|
144894
145238
|
}
|
|
145239
|
+
if (!content) {
|
|
145240
|
+
return logger.error(`\u{1F6A8} No content found in JSON file or piped input.`);
|
|
145241
|
+
}
|
|
144895
145242
|
const url3 = !secretBulkArgs.env || isLegacyEnv(config) ? `/accounts/${accountId}/workers/scripts/${scriptName}/secrets` : `/accounts/${accountId}/workers/services/${scriptName}/environments/${secretBulkArgs.env}/secrets`;
|
|
144896
145243
|
const bulkOutcomes = await Promise.all(
|
|
144897
145244
|
Object.entries(content).map(async ([key, value]) => {
|
|
@@ -145242,7 +145589,7 @@ async function generateTypes(configToDTS, config) {
|
|
|
145242
145589
|
envTypeStructure.push(`${namespace.binding}: any;`);
|
|
145243
145590
|
}
|
|
145244
145591
|
}
|
|
145245
|
-
if (configToDTS.logfwdr?.
|
|
145592
|
+
if (configToDTS.logfwdr?.bindings?.length) {
|
|
145246
145593
|
envTypeStructure.push(`LOGFWDR_SCHEMA: any;`);
|
|
145247
145594
|
}
|
|
145248
145595
|
if (configToDTS.data_blobs) {
|
|
@@ -145665,7 +146012,7 @@ function createCLIParser(argv) {
|
|
|
145665
146012
|
}
|
|
145666
146013
|
);
|
|
145667
146014
|
wrangler.command(
|
|
145668
|
-
"secret:bulk
|
|
146015
|
+
"secret:bulk [json]",
|
|
145669
146016
|
"\u{1F5C4}\uFE0F Bulk upload secrets for a Worker",
|
|
145670
146017
|
secretBulkOptions,
|
|
145671
146018
|
secretBulkHandler
|
|
@@ -146010,15 +146357,15 @@ async function initHandler(args) {
|
|
|
146010
146357
|
const instructions = [];
|
|
146011
146358
|
let shouldRunPackageManagerInstall = false;
|
|
146012
146359
|
const fromDashScriptName = args.fromDash;
|
|
146013
|
-
const creationDirectory =
|
|
146360
|
+
const creationDirectory = import_node_path41.default.resolve(
|
|
146014
146361
|
process.cwd(),
|
|
146015
146362
|
(args.name ? args.name : fromDashScriptName) ?? ""
|
|
146016
146363
|
);
|
|
146017
146364
|
assertNoTypeArg(args);
|
|
146018
146365
|
assertNoSiteArg(args, creationDirectory);
|
|
146019
|
-
const workerName =
|
|
146366
|
+
const workerName = import_node_path41.default.basename(creationDirectory).toLowerCase().replaceAll(/[^a-z0-9\-_]/gm, "-");
|
|
146020
146367
|
const packageManager = await getPackageManager(creationDirectory);
|
|
146021
|
-
const wranglerTomlDestination =
|
|
146368
|
+
const wranglerTomlDestination = import_node_path41.default.join(
|
|
146022
146369
|
creationDirectory,
|
|
146023
146370
|
"./wrangler.toml"
|
|
146024
146371
|
);
|
|
@@ -146043,6 +146390,7 @@ async function initHandler(args) {
|
|
|
146043
146390
|
const c3Arguments = [
|
|
146044
146391
|
...getC3CommandFromEnv().split(" "),
|
|
146045
146392
|
fromDashScriptName,
|
|
146393
|
+
...yesFlag ? ["-y"] : [],
|
|
146046
146394
|
"--",
|
|
146047
146395
|
"--type",
|
|
146048
146396
|
"pre-existing",
|
|
@@ -146068,7 +146416,7 @@ The \`init\` command will be removed in a future version.`
|
|
|
146068
146416
|
if (fs17.existsSync(wranglerTomlDestination)) {
|
|
146069
146417
|
let shouldContinue = false;
|
|
146070
146418
|
logger.warn(
|
|
146071
|
-
`${
|
|
146419
|
+
`${import_node_path41.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
|
146072
146420
|
);
|
|
146073
146421
|
if (!fromDashScriptName) {
|
|
146074
146422
|
shouldContinue = await confirm(
|
|
@@ -146090,6 +146438,9 @@ The \`init\` command will be removed in a future version.`
|
|
|
146090
146438
|
if (c3Arguments.length > 0) {
|
|
146091
146439
|
c3Arguments.unshift("--");
|
|
146092
146440
|
}
|
|
146441
|
+
if (yesFlag) {
|
|
146442
|
+
c3Arguments.unshift("-y");
|
|
146443
|
+
}
|
|
146093
146444
|
c3Arguments.unshift(...getC3CommandFromEnv().split(" "));
|
|
146094
146445
|
const replacementC3Command = `\`${packageManager.type} ${c3Arguments.join(
|
|
146095
146446
|
" "
|
|
@@ -146117,12 +146468,12 @@ The \`init\` command will be removed in a future version.`
|
|
|
146117
146468
|
}) + "\n"
|
|
146118
146469
|
);
|
|
146119
146470
|
logger.log(
|
|
146120
|
-
`\u2728 Created ${
|
|
146471
|
+
`\u2728 Created ${import_node_path41.default.relative(process.cwd(), wranglerTomlDestination)}`
|
|
146121
146472
|
);
|
|
146122
146473
|
justCreatedWranglerToml = true;
|
|
146123
146474
|
} catch (err) {
|
|
146124
146475
|
throw new Error(
|
|
146125
|
-
`Failed to create ${
|
|
146476
|
+
`Failed to create ${import_node_path41.default.relative(
|
|
146126
146477
|
process.cwd(),
|
|
146127
146478
|
wranglerTomlDestination
|
|
146128
146479
|
)}.
|
|
@@ -146135,11 +146486,11 @@ ${err.message ?? err}`
|
|
|
146135
146486
|
if (shouldInitGit) {
|
|
146136
146487
|
await initializeGit(creationDirectory);
|
|
146137
146488
|
await (0, import_promises15.writeFile)(
|
|
146138
|
-
|
|
146139
|
-
readFileSync5(
|
|
146489
|
+
import_node_path41.default.join(creationDirectory, ".gitignore"),
|
|
146490
|
+
readFileSync5(import_node_path41.default.join(getBasePath(), "templates/gitignore"))
|
|
146140
146491
|
);
|
|
146141
146492
|
logger.log(
|
|
146142
|
-
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${
|
|
146493
|
+
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${import_node_path41.default.relative(
|
|
146143
146494
|
process.cwd(),
|
|
146144
146495
|
creationDirectory
|
|
146145
146496
|
)}` : `\u2728 Initialized git repository`
|
|
@@ -146159,7 +146510,7 @@ ${err.message ?? err}`
|
|
|
146159
146510
|
shouldCreatePackageJson = yesFlag || await confirm("No package.json found. Would you like to create one?");
|
|
146160
146511
|
if (shouldCreatePackageJson) {
|
|
146161
146512
|
await (0, import_promises15.writeFile)(
|
|
146162
|
-
|
|
146513
|
+
import_node_path41.default.join(creationDirectory, "./package.json"),
|
|
146163
146514
|
JSON.stringify(
|
|
146164
146515
|
{
|
|
146165
146516
|
name: workerName,
|
|
@@ -146174,9 +146525,9 @@ ${err.message ?? err}`
|
|
|
146174
146525
|
) + "\n"
|
|
146175
146526
|
);
|
|
146176
146527
|
shouldRunPackageManagerInstall = true;
|
|
146177
|
-
pathToPackageJson =
|
|
146528
|
+
pathToPackageJson = import_node_path41.default.join(creationDirectory, "package.json");
|
|
146178
146529
|
logger.log(
|
|
146179
|
-
`\u2728 Created ${
|
|
146530
|
+
`\u2728 Created ${import_node_path41.default.relative(process.cwd(), pathToPackageJson)}`
|
|
146180
146531
|
);
|
|
146181
146532
|
} else {
|
|
146182
146533
|
return;
|
|
@@ -146188,7 +146539,7 @@ ${err.message ?? err}`
|
|
|
146188
146539
|
);
|
|
146189
146540
|
if (!(packageJson.devDependencies?.wrangler || packageJson.dependencies?.wrangler)) {
|
|
146190
146541
|
const shouldInstall = yesFlag || await confirm(
|
|
146191
|
-
`Would you like to install wrangler into ${
|
|
146542
|
+
`Would you like to install wrangler into ${import_node_path41.default.relative(
|
|
146192
146543
|
process.cwd(),
|
|
146193
146544
|
pathToPackageJson
|
|
146194
146545
|
)}?`
|
|
@@ -146208,13 +146559,13 @@ ${err.message ?? err}`
|
|
|
146208
146559
|
if (yesFlag || await confirm("Would you like to use TypeScript?")) {
|
|
146209
146560
|
isTypescriptProject = true;
|
|
146210
146561
|
await (0, import_promises15.writeFile)(
|
|
146211
|
-
|
|
146212
|
-
readFileSync5(
|
|
146562
|
+
import_node_path41.default.join(creationDirectory, "./tsconfig.json"),
|
|
146563
|
+
readFileSync5(import_node_path41.default.join(getBasePath(), "templates/tsconfig.init.json"))
|
|
146213
146564
|
);
|
|
146214
146565
|
devDepsToInstall.push("@cloudflare/workers-types");
|
|
146215
146566
|
devDepsToInstall.push("typescript");
|
|
146216
|
-
pathToTSConfig =
|
|
146217
|
-
logger.log(`\u2728 Created ${
|
|
146567
|
+
pathToTSConfig = import_node_path41.default.join(creationDirectory, "tsconfig.json");
|
|
146568
|
+
logger.log(`\u2728 Created ${import_node_path41.default.relative(process.cwd(), pathToTSConfig)}`);
|
|
146218
146569
|
}
|
|
146219
146570
|
} else {
|
|
146220
146571
|
isTypescriptProject = true;
|
|
@@ -146229,7 +146580,7 @@ ${err.message ?? err}`
|
|
|
146229
146580
|
if (shouldInstall) {
|
|
146230
146581
|
devDepsToInstall.push("@cloudflare/workers-types");
|
|
146231
146582
|
instructions.push(
|
|
146232
|
-
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${
|
|
146583
|
+
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${import_node_path41.default.relative(
|
|
146233
146584
|
process.cwd(),
|
|
146234
146585
|
pathToTSConfig
|
|
146235
146586
|
)}`
|
|
@@ -146266,7 +146617,7 @@ ${err.message ?? err}`
|
|
|
146266
146617
|
};
|
|
146267
146618
|
fs17.writeFileSync(wranglerTomlDestination, import_toml5.default.stringify(newToml));
|
|
146268
146619
|
}
|
|
146269
|
-
const isNamedWorker = isCreatingWranglerToml &&
|
|
146620
|
+
const isNamedWorker = isCreatingWranglerToml && import_node_path41.default.dirname(packagePath) !== process.cwd();
|
|
146270
146621
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
|
146271
146622
|
if (isWritingScripts) {
|
|
146272
146623
|
await (0, import_promises15.writeFile)(
|
|
@@ -146307,16 +146658,16 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146307
146658
|
}
|
|
146308
146659
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
|
146309
146660
|
if (isTypescriptProject) {
|
|
146310
|
-
if (!fs17.existsSync(
|
|
146311
|
-
const newWorkerFilename =
|
|
146661
|
+
if (!fs17.existsSync(import_node_path41.default.join(creationDirectory, "./src/index.ts"))) {
|
|
146662
|
+
const newWorkerFilename = import_node_path41.default.relative(
|
|
146312
146663
|
process.cwd(),
|
|
146313
|
-
|
|
146664
|
+
import_node_path41.default.join(creationDirectory, "./src/index.ts")
|
|
146314
146665
|
);
|
|
146315
146666
|
if (fromDashScriptName) {
|
|
146316
146667
|
logger.warn(
|
|
146317
146668
|
"After running `wrangler init --from-dash`, modifying your worker via the Cloudflare dashboard is discouraged.\nEdits made via the Dashboard will not be synchronized locally and will be overridden by your local code and config when you deploy."
|
|
146318
146669
|
);
|
|
146319
|
-
await (0, import_promises15.mkdir)(
|
|
146670
|
+
await (0, import_promises15.mkdir)(import_node_path41.default.join(creationDirectory, "./src"), {
|
|
146320
146671
|
recursive: true
|
|
146321
146672
|
});
|
|
146322
146673
|
const defaultEnvironment = serviceMetadata?.default_environment.environment;
|
|
@@ -146326,8 +146677,8 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146326
146677
|
for (const files of createBatches(dashScript, 10)) {
|
|
146327
146678
|
await Promise.all(
|
|
146328
146679
|
files.map(async (file) => {
|
|
146329
|
-
const filepath =
|
|
146330
|
-
const directory = (0,
|
|
146680
|
+
const filepath = import_node_path41.default.join(creationDirectory, `./src/${file.name}`).replace(/\.js$/, ".ts");
|
|
146681
|
+
const directory = (0, import_node_path41.dirname)(filepath);
|
|
146331
146682
|
await (0, import_promises15.mkdir)(directory, { recursive: true });
|
|
146332
146683
|
await (0, import_promises15.writeFile)(filepath, file.stream());
|
|
146333
146684
|
})
|
|
@@ -146347,17 +146698,17 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146347
146698
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
|
146348
146699
|
if (newWorkerType !== "none") {
|
|
146349
146700
|
const template = getNewWorkerTemplate("ts", newWorkerType);
|
|
146350
|
-
await (0, import_promises15.mkdir)(
|
|
146701
|
+
await (0, import_promises15.mkdir)(import_node_path41.default.join(creationDirectory, "./src"), {
|
|
146351
146702
|
recursive: true
|
|
146352
146703
|
});
|
|
146353
146704
|
await (0, import_promises15.writeFile)(
|
|
146354
|
-
|
|
146355
|
-
readFileSync5(
|
|
146705
|
+
import_node_path41.default.join(creationDirectory, "./src/index.ts"),
|
|
146706
|
+
readFileSync5(import_node_path41.default.join(getBasePath(), `templates/${template}`))
|
|
146356
146707
|
);
|
|
146357
146708
|
logger.log(
|
|
146358
|
-
`\u2728 Created ${
|
|
146709
|
+
`\u2728 Created ${import_node_path41.default.relative(
|
|
146359
146710
|
process.cwd(),
|
|
146360
|
-
|
|
146711
|
+
import_node_path41.default.join(creationDirectory, "./src/index.ts")
|
|
146361
146712
|
)}`
|
|
146362
146713
|
);
|
|
146363
146714
|
shouldCreateTests = yesFlag || await confirm(
|
|
@@ -146370,18 +146721,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146370
146721
|
newWorkerTestType = "vitest";
|
|
146371
146722
|
devDepsToInstall.push(newWorkerTestType);
|
|
146372
146723
|
await (0, import_promises15.writeFile)(
|
|
146373
|
-
|
|
146724
|
+
import_node_path41.default.join(creationDirectory, "./src/index.test.ts"),
|
|
146374
146725
|
readFileSync5(
|
|
146375
|
-
|
|
146726
|
+
import_node_path41.default.join(
|
|
146376
146727
|
getBasePath(),
|
|
146377
146728
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.ts`
|
|
146378
146729
|
)
|
|
146379
146730
|
)
|
|
146380
146731
|
);
|
|
146381
146732
|
logger.log(
|
|
146382
|
-
`\u2728 Created ${
|
|
146733
|
+
`\u2728 Created ${import_node_path41.default.relative(
|
|
146383
146734
|
process.cwd(),
|
|
146384
|
-
|
|
146735
|
+
import_node_path41.default.join(creationDirectory, "./src/index.test.ts")
|
|
146385
146736
|
)}`
|
|
146386
146737
|
);
|
|
146387
146738
|
}
|
|
@@ -146398,16 +146749,16 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146398
146749
|
}
|
|
146399
146750
|
}
|
|
146400
146751
|
} else {
|
|
146401
|
-
if (!fs17.existsSync(
|
|
146402
|
-
const newWorkerFilename =
|
|
146752
|
+
if (!fs17.existsSync(import_node_path41.default.join(creationDirectory, "./src/index.js"))) {
|
|
146753
|
+
const newWorkerFilename = import_node_path41.default.relative(
|
|
146403
146754
|
process.cwd(),
|
|
146404
|
-
|
|
146755
|
+
import_node_path41.default.join(creationDirectory, "./src/index.js")
|
|
146405
146756
|
);
|
|
146406
146757
|
if (fromDashScriptName) {
|
|
146407
146758
|
logger.warn(
|
|
146408
146759
|
"After running `wrangler init --from-dash`, modifying your worker via the Cloudflare dashboard is discouraged.\nEdits made via the Dashboard will not be synchronized locally and will be overridden by your local code and config when you deploy."
|
|
146409
146760
|
);
|
|
146410
|
-
await (0, import_promises15.mkdir)(
|
|
146761
|
+
await (0, import_promises15.mkdir)(import_node_path41.default.join(creationDirectory, "./src"), {
|
|
146411
146762
|
recursive: true
|
|
146412
146763
|
});
|
|
146413
146764
|
const defaultEnvironment = serviceMetadata?.default_environment.environment;
|
|
@@ -146417,11 +146768,11 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146417
146768
|
for (const files of createBatches(dashScript, 10)) {
|
|
146418
146769
|
await Promise.all(
|
|
146419
146770
|
files.map(async (file) => {
|
|
146420
|
-
const filepath =
|
|
146771
|
+
const filepath = import_node_path41.default.join(
|
|
146421
146772
|
creationDirectory,
|
|
146422
146773
|
`./src/${file.name}`
|
|
146423
146774
|
);
|
|
146424
|
-
const directory = (0,
|
|
146775
|
+
const directory = (0, import_node_path41.dirname)(filepath);
|
|
146425
146776
|
await (0, import_promises15.mkdir)(directory, { recursive: true });
|
|
146426
146777
|
await (0, import_promises15.writeFile)(filepath, file.stream());
|
|
146427
146778
|
})
|
|
@@ -146441,17 +146792,17 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146441
146792
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
|
146442
146793
|
if (newWorkerType !== "none") {
|
|
146443
146794
|
const template = getNewWorkerTemplate("js", newWorkerType);
|
|
146444
|
-
await (0, import_promises15.mkdir)(
|
|
146795
|
+
await (0, import_promises15.mkdir)(import_node_path41.default.join(creationDirectory, "./src"), {
|
|
146445
146796
|
recursive: true
|
|
146446
146797
|
});
|
|
146447
146798
|
await (0, import_promises15.writeFile)(
|
|
146448
|
-
|
|
146449
|
-
readFileSync5(
|
|
146799
|
+
import_node_path41.default.join(creationDirectory, "./src/index.js"),
|
|
146800
|
+
readFileSync5(import_node_path41.default.join(getBasePath(), `templates/${template}`))
|
|
146450
146801
|
);
|
|
146451
146802
|
logger.log(
|
|
146452
|
-
`\u2728 Created ${
|
|
146803
|
+
`\u2728 Created ${import_node_path41.default.relative(
|
|
146453
146804
|
process.cwd(),
|
|
146454
|
-
|
|
146805
|
+
import_node_path41.default.join(creationDirectory, "./src/index.js")
|
|
146455
146806
|
)}`
|
|
146456
146807
|
);
|
|
146457
146808
|
shouldCreateTests = yesFlag || await confirm("Would you like us to write your first test?");
|
|
@@ -146459,18 +146810,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
146459
146810
|
newWorkerTestType = await getNewWorkerTestType(yesFlag);
|
|
146460
146811
|
devDepsToInstall.push(newWorkerTestType);
|
|
146461
146812
|
await (0, import_promises15.writeFile)(
|
|
146462
|
-
|
|
146813
|
+
import_node_path41.default.join(creationDirectory, "./src/index.test.js"),
|
|
146463
146814
|
readFileSync5(
|
|
146464
|
-
|
|
146815
|
+
import_node_path41.default.join(
|
|
146465
146816
|
getBasePath(),
|
|
146466
146817
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.js`
|
|
146467
146818
|
)
|
|
146468
146819
|
)
|
|
146469
146820
|
);
|
|
146470
146821
|
logger.log(
|
|
146471
|
-
`\u2728 Created ${
|
|
146822
|
+
`\u2728 Created ${import_node_path41.default.relative(
|
|
146472
146823
|
process.cwd(),
|
|
146473
|
-
|
|
146824
|
+
import_node_path41.default.join(creationDirectory, "./src/index.test.js")
|
|
146474
146825
|
)}`
|
|
146475
146826
|
);
|
|
146476
146827
|
}
|
|
@@ -146583,7 +146934,7 @@ function getNewWorkerToml(workerType) {
|
|
|
146583
146934
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
|
146584
146935
|
async function findPath(isolatedInit, cwd2, basename6) {
|
|
146585
146936
|
if (isolatedInit) {
|
|
146586
|
-
return fs17.existsSync(
|
|
146937
|
+
return fs17.existsSync(import_node_path41.default.resolve(cwd2, basename6)) ? import_node_path41.default.resolve(cwd2, basename6) : void 0;
|
|
146587
146938
|
} else {
|
|
146588
146939
|
return await findUp(basename6, {
|
|
146589
146940
|
cwd: cwd2
|
|
@@ -146749,7 +147100,6 @@ function mapBindings(bindings) {
|
|
|
146749
147100
|
case "logfwdr":
|
|
146750
147101
|
{
|
|
146751
147102
|
configObj.logfwdr = {
|
|
146752
|
-
schema: "",
|
|
146753
147103
|
bindings: [
|
|
146754
147104
|
...configObj.logfwdr?.bindings ?? [],
|
|
146755
147105
|
{ name: binding.name, destination: binding.destination }
|
|
@@ -146812,7 +147162,7 @@ function assertNoTypeArg(args) {
|
|
|
146812
147162
|
__name(assertNoTypeArg, "assertNoTypeArg");
|
|
146813
147163
|
function assertNoSiteArg(args, creationDirectory) {
|
|
146814
147164
|
if (args.site) {
|
|
146815
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
|
147165
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path41.default.basename(creationDirectory) : "my-site";
|
|
146816
147166
|
const message = `The --site option is no longer supported.
|
|
146817
147167
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
|
146818
147168
|
|
|
@@ -147244,7 +147594,7 @@ __name(registerSubdomain, "registerSubdomain");
|
|
|
147244
147594
|
|
|
147245
147595
|
// src/deploy/deploy.ts
|
|
147246
147596
|
function sleep2(ms) {
|
|
147247
|
-
return new Promise((
|
|
147597
|
+
return new Promise((resolve18) => setTimeout(resolve18, ms));
|
|
147248
147598
|
}
|
|
147249
147599
|
__name(sleep2, "sleep");
|
|
147250
147600
|
var scriptStartupErrorRegex = /startup/i;
|
|
@@ -147453,9 +147803,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147453
147803
|
"A [site] definition requires a `bucket` field with a path to the site's assets directory."
|
|
147454
147804
|
);
|
|
147455
147805
|
if (props.outDir) {
|
|
147456
|
-
(0,
|
|
147457
|
-
const readmePath =
|
|
147458
|
-
(0,
|
|
147806
|
+
(0, import_node_fs26.mkdirSync)(props.outDir, { recursive: true });
|
|
147807
|
+
const readmePath = import_node_path42.default.join(props.outDir, "README.md");
|
|
147808
|
+
(0, import_node_fs26.writeFileSync)(
|
|
147459
147809
|
readmePath,
|
|
147460
147810
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${new Date().toISOString()}.`
|
|
147461
147811
|
);
|
|
@@ -147492,10 +147842,10 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147492
147842
|
try {
|
|
147493
147843
|
if (props.noBundle) {
|
|
147494
147844
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
|
147495
|
-
(0,
|
|
147496
|
-
(0,
|
|
147497
|
-
|
|
147498
|
-
(0,
|
|
147845
|
+
(0, import_node_fs26.mkdirSync)(destinationDir, { recursive: true });
|
|
147846
|
+
(0, import_node_fs26.writeFileSync)(
|
|
147847
|
+
import_node_path42.default.join(destinationDir, import_node_path42.default.basename(props.entry.file)),
|
|
147848
|
+
(0, import_node_fs26.readFileSync)(props.entry.file, "utf-8")
|
|
147499
147849
|
);
|
|
147500
147850
|
}
|
|
147501
147851
|
const betaD1Shims = identifyD1BindingsAsBeta(config.d1_databases);
|
|
@@ -147537,7 +147887,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147537
147887
|
targetConsumer: "deploy"
|
|
147538
147888
|
}
|
|
147539
147889
|
);
|
|
147540
|
-
const content = (0,
|
|
147890
|
+
const content = (0, import_node_fs26.readFileSync)(resolvedEntryPointPath, {
|
|
147541
147891
|
encoding: "utf-8"
|
|
147542
147892
|
});
|
|
147543
147893
|
const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
|
|
@@ -147551,7 +147901,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147551
147901
|
scriptName + (!props.legacyEnv && props.env ? `-${props.env}` : ""),
|
|
147552
147902
|
props.assetPaths,
|
|
147553
147903
|
false,
|
|
147554
|
-
props.dryRun
|
|
147904
|
+
props.dryRun,
|
|
147905
|
+
props.oldAssetTtl
|
|
147555
147906
|
);
|
|
147556
147907
|
const bindings = {
|
|
147557
147908
|
kv_namespaces: (config.kv_namespaces || []).concat(
|
|
@@ -147582,7 +147933,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147582
147933
|
logfwdr: config.logfwdr,
|
|
147583
147934
|
unsafe: {
|
|
147584
147935
|
bindings: config.unsafe.bindings,
|
|
147585
|
-
metadata: config.unsafe.metadata
|
|
147936
|
+
metadata: config.unsafe.metadata,
|
|
147937
|
+
capnp: config.unsafe.capnp
|
|
147586
147938
|
}
|
|
147587
147939
|
};
|
|
147588
147940
|
if (assets.manifest) {
|
|
@@ -147596,7 +147948,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147596
147948
|
const worker = {
|
|
147597
147949
|
name: scriptName,
|
|
147598
147950
|
main: {
|
|
147599
|
-
name:
|
|
147951
|
+
name: import_node_path42.default.basename(resolvedEntryPointPath),
|
|
147600
147952
|
content,
|
|
147601
147953
|
type: bundleType
|
|
147602
147954
|
},
|
|
@@ -147612,7 +147964,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
147612
147964
|
tail_consumers: config.tail_consumers
|
|
147613
147965
|
};
|
|
147614
147966
|
const bundleSizePromise = printBundleSize(
|
|
147615
|
-
{ name:
|
|
147967
|
+
{ name: import_node_path42.default.basename(resolvedEntryPointPath), content },
|
|
147616
147968
|
modules
|
|
147617
147969
|
);
|
|
147618
147970
|
if (process.env.JEST_WORKER_ID !== void 0)
|
|
@@ -148300,7 +148652,7 @@ __name(getRemotePreviewToken, "getRemotePreviewToken");
|
|
|
148300
148652
|
async function createRemoteWorkerInit(props) {
|
|
148301
148653
|
const content = await (0, import_promises16.readFile)(props.bundle.path, "utf-8");
|
|
148302
148654
|
void printBundleSize(
|
|
148303
|
-
{ name:
|
|
148655
|
+
{ name: import_node_path43.default.basename(props.bundle.path), content },
|
|
148304
148656
|
props.modules
|
|
148305
148657
|
);
|
|
148306
148658
|
const assets = await syncAssets(
|
|
@@ -148308,12 +148660,13 @@ async function createRemoteWorkerInit(props) {
|
|
|
148308
148660
|
props.name + (!props.legacyEnv && props.env ? `-${props.env}` : ""),
|
|
148309
148661
|
props.isWorkersSite ? props.assetPaths : void 0,
|
|
148310
148662
|
true,
|
|
148311
|
-
false
|
|
148663
|
+
false,
|
|
148664
|
+
void 0
|
|
148312
148665
|
);
|
|
148313
148666
|
const init = {
|
|
148314
148667
|
name: props.name,
|
|
148315
148668
|
main: {
|
|
148316
|
-
name:
|
|
148669
|
+
name: import_node_path43.default.basename(props.bundle.path),
|
|
148317
148670
|
type: props.format === "modules" ? "esm" : "commonjs",
|
|
148318
148671
|
content
|
|
148319
148672
|
},
|
|
@@ -148584,6 +148937,7 @@ __name(validateDevProps, "validateDevProps");
|
|
|
148584
148937
|
// src/dev/dev.tsx
|
|
148585
148938
|
function useDevRegistry(name, services, durableObjects, mode) {
|
|
148586
148939
|
const [workers, setWorkers] = (0, import_react19.useState)({});
|
|
148940
|
+
const hasFailedToFetch = (0, import_react19.useRef)(false);
|
|
148587
148941
|
(0, import_react19.useEffect)(() => {
|
|
148588
148942
|
startWorkerRegistry().catch((err) => {
|
|
148589
148943
|
logger.error("failed to start worker registry", err);
|
|
@@ -148602,7 +148956,10 @@ function useDevRegistry(name, services, durableObjects, mode) {
|
|
|
148602
148956
|
});
|
|
148603
148957
|
},
|
|
148604
148958
|
(err) => {
|
|
148605
|
-
|
|
148959
|
+
if (!hasFailedToFetch.current) {
|
|
148960
|
+
hasFailedToFetch.current = true;
|
|
148961
|
+
logger.warn("Failed to get worker definitions", err);
|
|
148962
|
+
}
|
|
148606
148963
|
}
|
|
148607
148964
|
);
|
|
148608
148965
|
}, 300) : void 0;
|
|
@@ -148842,7 +149199,7 @@ function useCustomBuild(expectedEntry, build5) {
|
|
|
148842
149199
|
}
|
|
148843
149200
|
__name(useCustomBuild, "useCustomBuild");
|
|
148844
149201
|
function sleep3(period) {
|
|
148845
|
-
return new Promise((
|
|
149202
|
+
return new Promise((resolve18) => setTimeout(resolve18, period));
|
|
148846
149203
|
}
|
|
148847
149204
|
__name(sleep3, "sleep");
|
|
148848
149205
|
var SLEEP_DURATION = 2e3;
|
|
@@ -148869,7 +149226,7 @@ function useTunnel(toggle) {
|
|
|
148869
149226
|
async function startTunnel() {
|
|
148870
149227
|
if (toggle) {
|
|
148871
149228
|
try {
|
|
148872
|
-
await (0,
|
|
149229
|
+
await (0, import_command_exists2.default)("cloudflared");
|
|
148873
149230
|
} catch (e2) {
|
|
148874
149231
|
logger.warn(
|
|
148875
149232
|
"To share your worker on the Internet, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation"
|
|
@@ -148877,7 +149234,7 @@ function useTunnel(toggle) {
|
|
|
148877
149234
|
return;
|
|
148878
149235
|
}
|
|
148879
149236
|
logger.log("\u2394 Starting a tunnel...");
|
|
148880
|
-
tunnel.current = (0,
|
|
149237
|
+
tunnel.current = (0, import_node_child_process6.spawn)("cloudflared", [
|
|
148881
149238
|
"tunnel",
|
|
148882
149239
|
"--url",
|
|
148883
149240
|
"http://localhost:8787",
|
|
@@ -149227,12 +149584,12 @@ async function startLocalServer(props) {
|
|
|
149227
149584
|
}
|
|
149228
149585
|
logger.log(import_chalk14.default.dim("\u2394 Starting local server..."));
|
|
149229
149586
|
const config = await localPropsToConfigBundle(props);
|
|
149230
|
-
return new Promise((
|
|
149587
|
+
return new Promise((resolve18, reject) => {
|
|
149231
149588
|
const server2 = new MiniflareServer();
|
|
149232
149589
|
server2.addEventListener("reloaded", async (event) => {
|
|
149233
149590
|
await maybeRegisterLocalWorker(event, props.name);
|
|
149234
149591
|
props.onReady?.(event.url.hostname, parseInt(event.url.port));
|
|
149235
|
-
|
|
149592
|
+
resolve18({
|
|
149236
149593
|
stop: () => {
|
|
149237
149594
|
abortController.abort();
|
|
149238
149595
|
logger.log("\u2394 Shutting down local server...");
|
|
@@ -149489,7 +149846,7 @@ To run an edge preview session for your Worker, use ${import_chalk15.default.gre
|
|
|
149489
149846
|
"--experimental-local is no longer required and will be removed in a future version.\n`wrangler dev` now uses the local Cloudflare Workers runtime by default. \u{1F389}"
|
|
149490
149847
|
);
|
|
149491
149848
|
}
|
|
149492
|
-
const configPath = args.config || args.script && findWranglerToml(
|
|
149849
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path44.default.dirname(args.script));
|
|
149493
149850
|
let config = readConfig(configPath, args);
|
|
149494
149851
|
if (config.configPath) {
|
|
149495
149852
|
watcher = (0, import_chokidar5.watch)(config.configPath, {
|
|
@@ -149497,7 +149854,7 @@ To run an edge preview session for your Worker, use ${import_chalk15.default.gre
|
|
|
149497
149854
|
}).on("change", async (_event) => {
|
|
149498
149855
|
config = readConfig(configPath, args);
|
|
149499
149856
|
if (config.configPath) {
|
|
149500
|
-
logger.log(`${
|
|
149857
|
+
logger.log(`${import_node_path44.default.basename(config.configPath)} changed...`);
|
|
149501
149858
|
rerender(await getDevReactElement(config));
|
|
149502
149859
|
}
|
|
149503
149860
|
});
|
|
@@ -149604,8 +149961,9 @@ To run an edge preview session for your Worker, use ${import_chalk15.default.gre
|
|
|
149604
149961
|
await watcher?.close();
|
|
149605
149962
|
}
|
|
149606
149963
|
};
|
|
149607
|
-
}
|
|
149964
|
+
} catch (e2) {
|
|
149608
149965
|
await watcher?.close();
|
|
149966
|
+
throw e2;
|
|
149609
149967
|
}
|
|
149610
149968
|
}
|
|
149611
149969
|
__name(startDev, "startDev");
|
|
@@ -149614,7 +149972,7 @@ async function startApiDev(args) {
|
|
|
149614
149972
|
logger.loggerLevel = args.logLevel;
|
|
149615
149973
|
}
|
|
149616
149974
|
await printWranglerBanner();
|
|
149617
|
-
const configPath = args.config || args.script && findWranglerToml(
|
|
149975
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path44.default.dirname(args.script));
|
|
149618
149976
|
const config = readConfig(configPath, args);
|
|
149619
149977
|
const {
|
|
149620
149978
|
entry,
|
|
@@ -149922,7 +150280,8 @@ function getBindings(configParam, env5, local, args) {
|
|
|
149922
150280
|
analytics_engine_datasets: configParam.analytics_engine_datasets,
|
|
149923
150281
|
unsafe: {
|
|
149924
150282
|
bindings: configParam.unsafe.bindings,
|
|
149925
|
-
metadata: configParam.unsafe.metadata
|
|
150283
|
+
metadata: configParam.unsafe.metadata,
|
|
150284
|
+
capnp: configParam.unsafe.capnp
|
|
149926
150285
|
},
|
|
149927
150286
|
logfwdr: configParam.logfwdr,
|
|
149928
150287
|
d1_databases: identifyD1BindingsAsBeta([
|
|
@@ -149984,8 +150343,8 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
149984
150343
|
);
|
|
149985
150344
|
}
|
|
149986
150345
|
let readyResolve;
|
|
149987
|
-
const readyPromise = new Promise((
|
|
149988
|
-
readyResolve =
|
|
150346
|
+
const readyPromise = new Promise((resolve18) => {
|
|
150347
|
+
readyResolve = resolve18;
|
|
149989
150348
|
});
|
|
149990
150349
|
const defaultLogLevel = testMode ? "none" : "log";
|
|
149991
150350
|
const devOptions2 = {
|