create-cloudflare 2.73.4 → 2.74.1
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/dist/cli.js +448 -305
- package/package.json +7 -7
- package/templates/astro/pages/c3.ts +1 -0
- package/templates/astro/workers/c3.ts +1 -0
- package/templates/next/c3.ts +6 -1
- package/templates/nuxt/pages/c3.ts +3 -1
- package/templates/nuxt/workers/c3.ts +3 -1
- package/templates/pre-existing/c3.ts +2 -2
package/dist/cli.js
CHANGED
|
@@ -3643,9 +3643,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
3643
3643
|
}
|
|
3644
3644
|
close(callback) {
|
|
3645
3645
|
if (callback === void 0) {
|
|
3646
|
-
return new Promise((
|
|
3646
|
+
return new Promise((resolve16, reject) => {
|
|
3647
3647
|
this.close((err, data) => {
|
|
3648
|
-
return err ? reject(err) :
|
|
3648
|
+
return err ? reject(err) : resolve16(data);
|
|
3649
3649
|
});
|
|
3650
3650
|
});
|
|
3651
3651
|
}
|
|
@@ -3683,9 +3683,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
3683
3683
|
err = null;
|
|
3684
3684
|
}
|
|
3685
3685
|
if (callback === void 0) {
|
|
3686
|
-
return new Promise((
|
|
3686
|
+
return new Promise((resolve16, reject) => {
|
|
3687
3687
|
this.destroy(err, (err2, data) => {
|
|
3688
|
-
return err2 ? reject(err2) :
|
|
3688
|
+
return err2 ? reject(err2) : resolve16(data);
|
|
3689
3689
|
});
|
|
3690
3690
|
});
|
|
3691
3691
|
}
|
|
@@ -7182,8 +7182,8 @@ var require_promise = __commonJS({
|
|
|
7182
7182
|
function createDeferredPromise() {
|
|
7183
7183
|
let res;
|
|
7184
7184
|
let rej;
|
|
7185
|
-
const promise2 = new Promise((
|
|
7186
|
-
res =
|
|
7185
|
+
const promise2 = new Promise((resolve16, reject) => {
|
|
7186
|
+
res = resolve16;
|
|
7187
7187
|
rej = reject;
|
|
7188
7188
|
});
|
|
7189
7189
|
return { promise: promise2, resolve: res, reject: rej };
|
|
@@ -8586,12 +8586,12 @@ upgrade: ${upgrade}\r
|
|
|
8586
8586
|
cb();
|
|
8587
8587
|
}
|
|
8588
8588
|
}
|
|
8589
|
-
const waitForDrain = () => new Promise((
|
|
8589
|
+
const waitForDrain = () => new Promise((resolve16, reject) => {
|
|
8590
8590
|
assert9(callback === null);
|
|
8591
8591
|
if (socket[kError]) {
|
|
8592
8592
|
reject(socket[kError]);
|
|
8593
8593
|
} else {
|
|
8594
|
-
callback =
|
|
8594
|
+
callback = resolve16;
|
|
8595
8595
|
}
|
|
8596
8596
|
});
|
|
8597
8597
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -9467,12 +9467,12 @@ var require_client_h2 = __commonJS({
|
|
|
9467
9467
|
cb();
|
|
9468
9468
|
}
|
|
9469
9469
|
}
|
|
9470
|
-
const waitForDrain = () => new Promise((
|
|
9470
|
+
const waitForDrain = () => new Promise((resolve16, reject) => {
|
|
9471
9471
|
assert9(callback === null);
|
|
9472
9472
|
if (socket[kError]) {
|
|
9473
9473
|
reject(socket[kError]);
|
|
9474
9474
|
} else {
|
|
9475
|
-
callback =
|
|
9475
|
+
callback = resolve16;
|
|
9476
9476
|
}
|
|
9477
9477
|
});
|
|
9478
9478
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -9788,16 +9788,16 @@ var require_client = __commonJS({
|
|
|
9788
9788
|
return this[kNeedDrain] < 2;
|
|
9789
9789
|
}
|
|
9790
9790
|
[kClose]() {
|
|
9791
|
-
return new Promise((
|
|
9791
|
+
return new Promise((resolve16) => {
|
|
9792
9792
|
if (this[kSize]) {
|
|
9793
|
-
this[kClosedResolve] =
|
|
9793
|
+
this[kClosedResolve] = resolve16;
|
|
9794
9794
|
} else {
|
|
9795
|
-
|
|
9795
|
+
resolve16(null);
|
|
9796
9796
|
}
|
|
9797
9797
|
});
|
|
9798
9798
|
}
|
|
9799
9799
|
[kDestroy](err) {
|
|
9800
|
-
return new Promise((
|
|
9800
|
+
return new Promise((resolve16) => {
|
|
9801
9801
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
9802
9802
|
for (let i = 0; i < requests.length; i++) {
|
|
9803
9803
|
const request2 = requests[i];
|
|
@@ -9810,7 +9810,7 @@ var require_client = __commonJS({
|
|
|
9810
9810
|
this[kClosedResolve]();
|
|
9811
9811
|
this[kClosedResolve] = null;
|
|
9812
9812
|
}
|
|
9813
|
-
|
|
9813
|
+
resolve16(null);
|
|
9814
9814
|
};
|
|
9815
9815
|
if (this[kHTTPContext]) {
|
|
9816
9816
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -10217,8 +10217,8 @@ var require_pool_base = __commonJS({
|
|
|
10217
10217
|
}
|
|
10218
10218
|
return Promise.all(closeAll);
|
|
10219
10219
|
} else {
|
|
10220
|
-
return new Promise((
|
|
10221
|
-
this[kClosedResolve] =
|
|
10220
|
+
return new Promise((resolve16) => {
|
|
10221
|
+
this[kClosedResolve] = resolve16;
|
|
10222
10222
|
});
|
|
10223
10223
|
}
|
|
10224
10224
|
}
|
|
@@ -11337,7 +11337,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11337
11337
|
const proxyHost = this[kProxyUrl].hostname;
|
|
11338
11338
|
const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
|
|
11339
11339
|
debug("creating SOCKS5 connection to", proxyHost, proxyPort);
|
|
11340
|
-
const socket = await new Promise((
|
|
11340
|
+
const socket = await new Promise((resolve16, reject) => {
|
|
11341
11341
|
this[kConnector]({
|
|
11342
11342
|
hostname: proxyHost,
|
|
11343
11343
|
host: proxyHost,
|
|
@@ -11347,7 +11347,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11347
11347
|
if (err) {
|
|
11348
11348
|
reject(err);
|
|
11349
11349
|
} else {
|
|
11350
|
-
|
|
11350
|
+
resolve16(socket2);
|
|
11351
11351
|
}
|
|
11352
11352
|
});
|
|
11353
11353
|
});
|
|
@@ -11357,14 +11357,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11357
11357
|
socket.destroy();
|
|
11358
11358
|
});
|
|
11359
11359
|
await socks5Client.handshake();
|
|
11360
|
-
await new Promise((
|
|
11360
|
+
await new Promise((resolve16, reject) => {
|
|
11361
11361
|
const timeout = setTimeout(() => {
|
|
11362
11362
|
reject(new Error("SOCKS5 authentication timeout"));
|
|
11363
11363
|
}, 5e3);
|
|
11364
11364
|
const onAuthenticated = () => {
|
|
11365
11365
|
clearTimeout(timeout);
|
|
11366
11366
|
socks5Client.removeListener("error", onError);
|
|
11367
|
-
|
|
11367
|
+
resolve16();
|
|
11368
11368
|
};
|
|
11369
11369
|
const onError = (err) => {
|
|
11370
11370
|
clearTimeout(timeout);
|
|
@@ -11373,14 +11373,14 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11373
11373
|
};
|
|
11374
11374
|
if (socks5Client.state === STATES.AUTHENTICATED) {
|
|
11375
11375
|
clearTimeout(timeout);
|
|
11376
|
-
|
|
11376
|
+
resolve16();
|
|
11377
11377
|
} else {
|
|
11378
11378
|
socks5Client.once("authenticated", onAuthenticated);
|
|
11379
11379
|
socks5Client.once("error", onError);
|
|
11380
11380
|
}
|
|
11381
11381
|
});
|
|
11382
11382
|
await socks5Client.connect(targetHost, targetPort);
|
|
11383
|
-
await new Promise((
|
|
11383
|
+
await new Promise((resolve16, reject) => {
|
|
11384
11384
|
const timeout = setTimeout(() => {
|
|
11385
11385
|
reject(new Error("SOCKS5 connection timeout"));
|
|
11386
11386
|
}, 5e3);
|
|
@@ -11388,7 +11388,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11388
11388
|
debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
|
|
11389
11389
|
clearTimeout(timeout);
|
|
11390
11390
|
socks5Client.removeListener("error", onError);
|
|
11391
|
-
|
|
11391
|
+
resolve16();
|
|
11392
11392
|
};
|
|
11393
11393
|
const onError = (err) => {
|
|
11394
11394
|
clearTimeout(timeout);
|
|
@@ -11431,8 +11431,8 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11431
11431
|
socket,
|
|
11432
11432
|
servername: this[kRequestTls]?.servername || targetHost
|
|
11433
11433
|
});
|
|
11434
|
-
await new Promise((
|
|
11435
|
-
finalSocket.once("secureConnect",
|
|
11434
|
+
await new Promise((resolve16, reject) => {
|
|
11435
|
+
finalSocket.once("secureConnect", resolve16);
|
|
11436
11436
|
finalSocket.once("error", reject);
|
|
11437
11437
|
});
|
|
11438
11438
|
}
|
|
@@ -12514,7 +12514,7 @@ var require_readable = __commonJS({
|
|
|
12514
12514
|
if (this._readableState.closeEmitted) {
|
|
12515
12515
|
return Promise.resolve(null);
|
|
12516
12516
|
}
|
|
12517
|
-
return new Promise((
|
|
12517
|
+
return new Promise((resolve16, reject) => {
|
|
12518
12518
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
12519
12519
|
this.destroy(new AbortError());
|
|
12520
12520
|
}
|
|
@@ -12528,11 +12528,11 @@ var require_readable = __commonJS({
|
|
|
12528
12528
|
if (signal.aborted) {
|
|
12529
12529
|
reject(signal.reason ?? new AbortError());
|
|
12530
12530
|
} else {
|
|
12531
|
-
|
|
12531
|
+
resolve16(null);
|
|
12532
12532
|
}
|
|
12533
12533
|
});
|
|
12534
12534
|
} else {
|
|
12535
|
-
this.on("close",
|
|
12535
|
+
this.on("close", resolve16);
|
|
12536
12536
|
}
|
|
12537
12537
|
this.on("error", noop).on("data", () => {
|
|
12538
12538
|
if (this[kBytesRead] > limit) {
|
|
@@ -12560,7 +12560,7 @@ var require_readable = __commonJS({
|
|
|
12560
12560
|
}
|
|
12561
12561
|
function consume(stream, type) {
|
|
12562
12562
|
assert9(!stream[kConsume]);
|
|
12563
|
-
return new Promise((
|
|
12563
|
+
return new Promise((resolve16, reject) => {
|
|
12564
12564
|
if (isUnusable(stream)) {
|
|
12565
12565
|
const rState = stream._readableState;
|
|
12566
12566
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -12575,7 +12575,7 @@ var require_readable = __commonJS({
|
|
|
12575
12575
|
stream[kConsume] = {
|
|
12576
12576
|
type,
|
|
12577
12577
|
stream,
|
|
12578
|
-
resolve:
|
|
12578
|
+
resolve: resolve16,
|
|
12579
12579
|
reject,
|
|
12580
12580
|
length: 0,
|
|
12581
12581
|
body: []
|
|
@@ -12649,18 +12649,18 @@ var require_readable = __commonJS({
|
|
|
12649
12649
|
return buffer;
|
|
12650
12650
|
}
|
|
12651
12651
|
function consumeEnd(consume2, encoding) {
|
|
12652
|
-
const { type, body, resolve:
|
|
12652
|
+
const { type, body, resolve: resolve16, stream, length } = consume2;
|
|
12653
12653
|
try {
|
|
12654
12654
|
if (type === "text") {
|
|
12655
|
-
|
|
12655
|
+
resolve16(chunksDecode(body, length, encoding));
|
|
12656
12656
|
} else if (type === "json") {
|
|
12657
|
-
|
|
12657
|
+
resolve16(JSON.parse(chunksDecode(body, length, encoding)));
|
|
12658
12658
|
} else if (type === "arrayBuffer") {
|
|
12659
|
-
|
|
12659
|
+
resolve16(chunksConcat(body, length).buffer);
|
|
12660
12660
|
} else if (type === "blob") {
|
|
12661
|
-
|
|
12661
|
+
resolve16(new Blob(body, { type: stream[kContentType] }));
|
|
12662
12662
|
} else if (type === "bytes") {
|
|
12663
|
-
|
|
12663
|
+
resolve16(chunksConcat(body, length));
|
|
12664
12664
|
}
|
|
12665
12665
|
consumeFinish(consume2);
|
|
12666
12666
|
} catch (err) {
|
|
@@ -12850,9 +12850,9 @@ var require_api_request = __commonJS({
|
|
|
12850
12850
|
};
|
|
12851
12851
|
function request2(opts, callback) {
|
|
12852
12852
|
if (callback === void 0) {
|
|
12853
|
-
return new Promise((
|
|
12853
|
+
return new Promise((resolve16, reject) => {
|
|
12854
12854
|
request2.call(this, opts, (err, data) => {
|
|
12855
|
-
return err ? reject(err) :
|
|
12855
|
+
return err ? reject(err) : resolve16(data);
|
|
12856
12856
|
});
|
|
12857
12857
|
});
|
|
12858
12858
|
}
|
|
@@ -13064,9 +13064,9 @@ var require_api_stream = __commonJS({
|
|
|
13064
13064
|
};
|
|
13065
13065
|
function stream(opts, factory, callback) {
|
|
13066
13066
|
if (callback === void 0) {
|
|
13067
|
-
return new Promise((
|
|
13067
|
+
return new Promise((resolve16, reject) => {
|
|
13068
13068
|
stream.call(this, opts, factory, (err, data) => {
|
|
13069
|
-
return err ? reject(err) :
|
|
13069
|
+
return err ? reject(err) : resolve16(data);
|
|
13070
13070
|
});
|
|
13071
13071
|
});
|
|
13072
13072
|
}
|
|
@@ -13354,9 +13354,9 @@ var require_api_upgrade = __commonJS({
|
|
|
13354
13354
|
};
|
|
13355
13355
|
function upgrade(opts, callback) {
|
|
13356
13356
|
if (callback === void 0) {
|
|
13357
|
-
return new Promise((
|
|
13357
|
+
return new Promise((resolve16, reject) => {
|
|
13358
13358
|
upgrade.call(this, opts, (err, data) => {
|
|
13359
|
-
return err ? reject(err) :
|
|
13359
|
+
return err ? reject(err) : resolve16(data);
|
|
13360
13360
|
});
|
|
13361
13361
|
});
|
|
13362
13362
|
}
|
|
@@ -13449,9 +13449,9 @@ var require_api_connect = __commonJS({
|
|
|
13449
13449
|
};
|
|
13450
13450
|
function connect(opts, callback) {
|
|
13451
13451
|
if (callback === void 0) {
|
|
13452
|
-
return new Promise((
|
|
13452
|
+
return new Promise((resolve16, reject) => {
|
|
13453
13453
|
connect.call(this, opts, (err, data) => {
|
|
13454
|
-
return err ? reject(err) :
|
|
13454
|
+
return err ? reject(err) : resolve16(data);
|
|
13455
13455
|
});
|
|
13456
13456
|
});
|
|
13457
13457
|
}
|
|
@@ -14725,7 +14725,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14725
14725
|
"../../node_modules/.pnpm/undici@7.29.1/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
|
|
14726
14726
|
"use strict";
|
|
14727
14727
|
var { writeFile: writeFile5, readFile: readFile3, mkdir: mkdir2 } = require("node:fs/promises");
|
|
14728
|
-
var { dirname: dirname8, resolve:
|
|
14728
|
+
var { dirname: dirname8, resolve: resolve16 } = require("node:path");
|
|
14729
14729
|
var { setTimeout: setTimeout6, clearTimeout: clearTimeout2 } = require("node:timers");
|
|
14730
14730
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
14731
14731
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -14926,7 +14926,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14926
14926
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14927
14927
|
}
|
|
14928
14928
|
try {
|
|
14929
|
-
const data = await readFile3(
|
|
14929
|
+
const data = await readFile3(resolve16(path9), "utf8");
|
|
14930
14930
|
const parsed = JSON.parse(data);
|
|
14931
14931
|
if (Array.isArray(parsed)) {
|
|
14932
14932
|
this.#snapshots.clear();
|
|
@@ -14955,7 +14955,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14955
14955
|
if (!path9) {
|
|
14956
14956
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14957
14957
|
}
|
|
14958
|
-
const resolvedPath =
|
|
14958
|
+
const resolvedPath = resolve16(path9);
|
|
14959
14959
|
await mkdir2(dirname8(resolvedPath), { recursive: true });
|
|
14960
14960
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
14961
14961
|
hash: hash2,
|
|
@@ -22381,7 +22381,7 @@ var require_fetch = __commonJS({
|
|
|
22381
22381
|
const agent = fetchParams.controller.dispatcher;
|
|
22382
22382
|
const path9 = url2.pathname + url2.search;
|
|
22383
22383
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
22384
|
-
return new Promise((
|
|
22384
|
+
return new Promise((resolve16, reject) => agent.dispatch(
|
|
22385
22385
|
{
|
|
22386
22386
|
path: hasTrailingQuestionMark ? `${path9}?` : path9,
|
|
22387
22387
|
origin: url2.origin,
|
|
@@ -22469,7 +22469,7 @@ var require_fetch = __commonJS({
|
|
|
22469
22469
|
}
|
|
22470
22470
|
}
|
|
22471
22471
|
const onError = this.onError.bind(this);
|
|
22472
|
-
|
|
22472
|
+
resolve16({
|
|
22473
22473
|
status: status2,
|
|
22474
22474
|
statusText,
|
|
22475
22475
|
headersList,
|
|
@@ -22522,7 +22522,7 @@ var require_fetch = __commonJS({
|
|
|
22522
22522
|
headersList.append(headerName, String(value), true);
|
|
22523
22523
|
}
|
|
22524
22524
|
}
|
|
22525
|
-
|
|
22525
|
+
resolve16({
|
|
22526
22526
|
status: status2,
|
|
22527
22527
|
statusText: STATUS_CODES[status2],
|
|
22528
22528
|
headersList,
|
|
@@ -22546,7 +22546,7 @@ var require_fetch = __commonJS({
|
|
|
22546
22546
|
headersList.append(nameStr, value.toString("latin1"), true);
|
|
22547
22547
|
}
|
|
22548
22548
|
}
|
|
22549
|
-
|
|
22549
|
+
resolve16({
|
|
22550
22550
|
status: status2,
|
|
22551
22551
|
statusText: STATUS_CODES[status2],
|
|
22552
22552
|
headersList,
|
|
@@ -27286,19 +27286,19 @@ var init_open_PCXX3ZDZ = __esm({
|
|
|
27286
27286
|
}
|
|
27287
27287
|
const subprocess = import_node_child_process.default.spawn(command2, cliArguments, childProcessOptions);
|
|
27288
27288
|
if (options.wait) {
|
|
27289
|
-
return new Promise((
|
|
27289
|
+
return new Promise((resolve16, reject) => {
|
|
27290
27290
|
subprocess.once("error", reject);
|
|
27291
27291
|
subprocess.once("close", (exitCode) => {
|
|
27292
27292
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
27293
27293
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
27294
27294
|
return;
|
|
27295
27295
|
}
|
|
27296
|
-
|
|
27296
|
+
resolve16(subprocess);
|
|
27297
27297
|
});
|
|
27298
27298
|
});
|
|
27299
27299
|
}
|
|
27300
27300
|
if (isFallbackAttempt) {
|
|
27301
|
-
return new Promise((
|
|
27301
|
+
return new Promise((resolve16, reject) => {
|
|
27302
27302
|
subprocess.once("error", reject);
|
|
27303
27303
|
subprocess.once("spawn", () => {
|
|
27304
27304
|
subprocess.once("close", (exitCode) => {
|
|
@@ -27308,17 +27308,17 @@ var init_open_PCXX3ZDZ = __esm({
|
|
|
27308
27308
|
return;
|
|
27309
27309
|
}
|
|
27310
27310
|
subprocess.unref();
|
|
27311
|
-
|
|
27311
|
+
resolve16(subprocess);
|
|
27312
27312
|
});
|
|
27313
27313
|
});
|
|
27314
27314
|
});
|
|
27315
27315
|
}
|
|
27316
27316
|
subprocess.unref();
|
|
27317
|
-
return new Promise((
|
|
27317
|
+
return new Promise((resolve16, reject) => {
|
|
27318
27318
|
subprocess.once("error", reject);
|
|
27319
27319
|
subprocess.once("spawn", () => {
|
|
27320
27320
|
subprocess.off("error", reject);
|
|
27321
|
-
|
|
27321
|
+
resolve16(subprocess);
|
|
27322
27322
|
});
|
|
27323
27323
|
});
|
|
27324
27324
|
}, "baseOpen");
|
|
@@ -27489,12 +27489,12 @@ var require_isexe = __commonJS({
|
|
|
27489
27489
|
if (typeof Promise !== "function") {
|
|
27490
27490
|
throw new TypeError("callback not provided");
|
|
27491
27491
|
}
|
|
27492
|
-
return new Promise(function(
|
|
27492
|
+
return new Promise(function(resolve16, reject) {
|
|
27493
27493
|
isexe(path9, options || {}, function(er, is) {
|
|
27494
27494
|
if (er) {
|
|
27495
27495
|
reject(er);
|
|
27496
27496
|
} else {
|
|
27497
|
-
|
|
27497
|
+
resolve16(is);
|
|
27498
27498
|
}
|
|
27499
27499
|
});
|
|
27500
27500
|
});
|
|
@@ -27560,27 +27560,27 @@ var require_which = __commonJS({
|
|
|
27560
27560
|
opt = {};
|
|
27561
27561
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
27562
27562
|
const found = [];
|
|
27563
|
-
const step = (i) => new Promise((
|
|
27563
|
+
const step = (i) => new Promise((resolve16, reject) => {
|
|
27564
27564
|
if (i === pathEnv.length)
|
|
27565
|
-
return opt.all && found.length ?
|
|
27565
|
+
return opt.all && found.length ? resolve16(found) : reject(getNotFoundError(cmd));
|
|
27566
27566
|
const ppRaw = pathEnv[i];
|
|
27567
27567
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
27568
27568
|
const pCmd = path9.join(pathPart, cmd);
|
|
27569
27569
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
27570
|
-
|
|
27570
|
+
resolve16(subStep(p2, i, 0));
|
|
27571
27571
|
});
|
|
27572
|
-
const subStep = (p2, i, ii) => new Promise((
|
|
27572
|
+
const subStep = (p2, i, ii) => new Promise((resolve16, reject) => {
|
|
27573
27573
|
if (ii === pathExt.length)
|
|
27574
|
-
return
|
|
27574
|
+
return resolve16(step(i + 1));
|
|
27575
27575
|
const ext = pathExt[ii];
|
|
27576
27576
|
isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
27577
27577
|
if (!er && is) {
|
|
27578
27578
|
if (opt.all)
|
|
27579
27579
|
found.push(p2 + ext);
|
|
27580
27580
|
else
|
|
27581
|
-
return
|
|
27581
|
+
return resolve16(p2 + ext);
|
|
27582
27582
|
}
|
|
27583
|
-
return
|
|
27583
|
+
return resolve16(subStep(p2, i, ii + 1));
|
|
27584
27584
|
});
|
|
27585
27585
|
});
|
|
27586
27586
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -30664,9 +30664,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
30664
30664
|
}
|
|
30665
30665
|
// stream.promise().then(() => done, er => emitted error)
|
|
30666
30666
|
promise() {
|
|
30667
|
-
return new Promise((
|
|
30667
|
+
return new Promise((resolve17, reject) => {
|
|
30668
30668
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
30669
|
-
this.on("end", () =>
|
|
30669
|
+
this.on("end", () => resolve17());
|
|
30670
30670
|
this.on("error", (er) => reject(er));
|
|
30671
30671
|
});
|
|
30672
30672
|
}
|
|
@@ -30678,7 +30678,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
30678
30678
|
return Promise.resolve({ done: false, value: res });
|
|
30679
30679
|
if (this[EOF$1])
|
|
30680
30680
|
return Promise.resolve({ done: true });
|
|
30681
|
-
let
|
|
30681
|
+
let resolve17 = null;
|
|
30682
30682
|
let reject = null;
|
|
30683
30683
|
const onerr = (er) => {
|
|
30684
30684
|
this.removeListener("data", ondata);
|
|
@@ -30689,17 +30689,17 @@ var require_index_688c5d50 = __commonJS({
|
|
|
30689
30689
|
this.removeListener("error", onerr);
|
|
30690
30690
|
this.removeListener("end", onend);
|
|
30691
30691
|
this.pause();
|
|
30692
|
-
|
|
30692
|
+
resolve17({ value, done: !!this[EOF$1] });
|
|
30693
30693
|
};
|
|
30694
30694
|
const onend = () => {
|
|
30695
30695
|
this.removeListener("error", onerr);
|
|
30696
30696
|
this.removeListener("data", ondata);
|
|
30697
|
-
|
|
30697
|
+
resolve17({ done: true });
|
|
30698
30698
|
};
|
|
30699
30699
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
30700
30700
|
return new Promise((res2, rej) => {
|
|
30701
30701
|
reject = rej;
|
|
30702
|
-
|
|
30702
|
+
resolve17 = res2;
|
|
30703
30703
|
this.once(DESTROYED, ondestroy);
|
|
30704
30704
|
this.once("error", onerr);
|
|
30705
30705
|
this.once("end", onend);
|
|
@@ -33126,9 +33126,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33126
33126
|
const parse11 = new parse$4(opt);
|
|
33127
33127
|
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
33128
33128
|
const file3 = opt.file;
|
|
33129
|
-
const p2 = new Promise((
|
|
33129
|
+
const p2 = new Promise((resolve17, reject) => {
|
|
33130
33130
|
parse11.on("error", reject);
|
|
33131
|
-
parse11.on("end",
|
|
33131
|
+
parse11.on("end", resolve17);
|
|
33132
33132
|
fs__default["default"].stat(file3, (er, stat) => {
|
|
33133
33133
|
if (er)
|
|
33134
33134
|
reject(er);
|
|
@@ -33339,7 +33339,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33339
33339
|
};
|
|
33340
33340
|
fs__default["default"].read(fd, headBuf, 0, 512, position, onread);
|
|
33341
33341
|
};
|
|
33342
|
-
const promise2 = new Promise((
|
|
33342
|
+
const promise2 = new Promise((resolve17, reject) => {
|
|
33343
33343
|
p2.on("error", reject);
|
|
33344
33344
|
let flag = "r+";
|
|
33345
33345
|
const onopen = (er, fd) => {
|
|
@@ -33361,7 +33361,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33361
33361
|
});
|
|
33362
33362
|
p2.pipe(stream);
|
|
33363
33363
|
stream.on("error", reject);
|
|
33364
|
-
stream.on("close",
|
|
33364
|
+
stream.on("close", resolve17);
|
|
33365
33365
|
addFilesAsync(p2, files);
|
|
33366
33366
|
});
|
|
33367
33367
|
});
|
|
@@ -33438,7 +33438,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33438
33438
|
};
|
|
33439
33439
|
var optsArg_1 = optsArg;
|
|
33440
33440
|
var platform$2 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
|
|
33441
|
-
var { resolve:
|
|
33441
|
+
var { resolve: resolve16, parse: parse$3 } = path__default2["default"];
|
|
33442
33442
|
var pathArg = (path10) => {
|
|
33443
33443
|
if (/\0/.test(path10)) {
|
|
33444
33444
|
throw Object.assign(
|
|
@@ -33449,7 +33449,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33449
33449
|
}
|
|
33450
33450
|
);
|
|
33451
33451
|
}
|
|
33452
|
-
path10 =
|
|
33452
|
+
path10 = resolve16(path10);
|
|
33453
33453
|
if (platform$2 === "win32") {
|
|
33454
33454
|
const badWinChars = /[*|"<>?:]/;
|
|
33455
33455
|
const { root } = parse$3(path10);
|
|
@@ -33879,8 +33879,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
33879
33879
|
var pathReservations = () => {
|
|
33880
33880
|
const queues = /* @__PURE__ */ new Map();
|
|
33881
33881
|
const reservations = /* @__PURE__ */ new Map();
|
|
33882
|
-
const { join:
|
|
33883
|
-
const getDirs = (path10) =>
|
|
33882
|
+
const { join: join14 } = path__default2["default"];
|
|
33883
|
+
const getDirs = (path10) => join14(path10).split(/[\\/]/).slice(0, -1).reduce((set2, path11) => set2.length ? set2.concat(join14(set2[set2.length - 1], path11)) : [path11], []);
|
|
33884
33884
|
const running = /* @__PURE__ */ new Set();
|
|
33885
33885
|
const getQueues = (fn) => {
|
|
33886
33886
|
const res = reservations.get(fn);
|
|
@@ -34528,9 +34528,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
34528
34528
|
const u2 = new unpack(opt);
|
|
34529
34529
|
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
34530
34530
|
const file3 = opt.file;
|
|
34531
|
-
const p2 = new Promise((
|
|
34531
|
+
const p2 = new Promise((resolve17, reject) => {
|
|
34532
34532
|
u2.on("error", reject);
|
|
34533
|
-
u2.on("close",
|
|
34533
|
+
u2.on("close", resolve17);
|
|
34534
34534
|
fs__default["default"].stat(file3, (er, stat) => {
|
|
34535
34535
|
if (er)
|
|
34536
34536
|
reject(er);
|
|
@@ -36062,10 +36062,10 @@ var require_index_688c5d50 = __commonJS({
|
|
|
36062
36062
|
process.cwd();
|
|
36063
36063
|
} catch (er) {
|
|
36064
36064
|
}
|
|
36065
|
-
var
|
|
36065
|
+
var chdir3 = process.chdir;
|
|
36066
36066
|
process.chdir = function(d3) {
|
|
36067
36067
|
cwd = null;
|
|
36068
|
-
|
|
36068
|
+
chdir3.call(process, d3);
|
|
36069
36069
|
};
|
|
36070
36070
|
var polyfills = patch;
|
|
36071
36071
|
function patch(fs11) {
|
|
@@ -39845,12 +39845,12 @@ var require_index_688c5d50 = __commonJS({
|
|
|
39845
39845
|
});
|
|
39846
39846
|
function promisify8(fn) {
|
|
39847
39847
|
return function(req, opts) {
|
|
39848
|
-
return new Promise((
|
|
39848
|
+
return new Promise((resolve17, reject) => {
|
|
39849
39849
|
fn.call(this, req, opts, (err, rtn) => {
|
|
39850
39850
|
if (err) {
|
|
39851
39851
|
reject(err);
|
|
39852
39852
|
} else {
|
|
39853
|
-
|
|
39853
|
+
resolve17(rtn);
|
|
39854
39854
|
}
|
|
39855
39855
|
});
|
|
39856
39856
|
});
|
|
@@ -40041,7 +40041,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
40041
40041
|
var debug_1$1 = __importDefault$2(src$1);
|
|
40042
40042
|
var debug$1 = debug_1$1.default("https-proxy-agent:parse-proxy-response");
|
|
40043
40043
|
function parseProxyResponse(socket) {
|
|
40044
|
-
return new Promise((
|
|
40044
|
+
return new Promise((resolve17, reject) => {
|
|
40045
40045
|
let buffersLength = 0;
|
|
40046
40046
|
const buffers = [];
|
|
40047
40047
|
function read() {
|
|
@@ -40081,7 +40081,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
40081
40081
|
const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
|
|
40082
40082
|
const statusCode = +firstLine.split(" ")[1];
|
|
40083
40083
|
debug$1("got proxy server response: %o", firstLine);
|
|
40084
|
-
|
|
40084
|
+
resolve17({
|
|
40085
40085
|
statusCode,
|
|
40086
40086
|
buffered
|
|
40087
40087
|
});
|
|
@@ -40098,11 +40098,11 @@ var require_index_688c5d50 = __commonJS({
|
|
|
40098
40098
|
}, "__esModule", { value: true });
|
|
40099
40099
|
var __awaiter2 = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
40100
40100
|
function adopt(value) {
|
|
40101
|
-
return value instanceof P2 ? value : new P2(function(
|
|
40102
|
-
|
|
40101
|
+
return value instanceof P2 ? value : new P2(function(resolve17) {
|
|
40102
|
+
resolve17(value);
|
|
40103
40103
|
});
|
|
40104
40104
|
}
|
|
40105
|
-
return new (P2 || (P2 = Promise))(function(
|
|
40105
|
+
return new (P2 || (P2 = Promise))(function(resolve17, reject) {
|
|
40106
40106
|
function fulfilled(value) {
|
|
40107
40107
|
try {
|
|
40108
40108
|
step(generator.next(value));
|
|
@@ -40118,7 +40118,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
40118
40118
|
}
|
|
40119
40119
|
}
|
|
40120
40120
|
function step(result) {
|
|
40121
|
-
result.done ?
|
|
40121
|
+
result.done ? resolve17(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
40122
40122
|
}
|
|
40123
40123
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40124
40124
|
});
|
|
@@ -49089,10 +49089,10 @@ var require_stringify2 = __commonJS({
|
|
|
49089
49089
|
replacer = null;
|
|
49090
49090
|
indent2 = EMPTY;
|
|
49091
49091
|
};
|
|
49092
|
-
var
|
|
49092
|
+
var join14 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
|
|
49093
49093
|
var join_content = (inside, value, gap) => {
|
|
49094
49094
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent2, true);
|
|
49095
|
-
return
|
|
49095
|
+
return join14(comment, inside, gap);
|
|
49096
49096
|
};
|
|
49097
49097
|
var array_stringify = (value, gap) => {
|
|
49098
49098
|
const deeper_gap = gap + indent2;
|
|
@@ -49103,7 +49103,7 @@ var require_stringify2 = __commonJS({
|
|
|
49103
49103
|
if (i !== 0) {
|
|
49104
49104
|
inside += COMMA;
|
|
49105
49105
|
}
|
|
49106
|
-
const before =
|
|
49106
|
+
const before = join14(
|
|
49107
49107
|
after_comma,
|
|
49108
49108
|
process_comments(value, BEFORE(i), deeper_gap),
|
|
49109
49109
|
deeper_gap
|
|
@@ -49113,7 +49113,7 @@ var require_stringify2 = __commonJS({
|
|
|
49113
49113
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
49114
49114
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
49115
49115
|
}
|
|
49116
|
-
inside +=
|
|
49116
|
+
inside += join14(
|
|
49117
49117
|
after_comma,
|
|
49118
49118
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
49119
49119
|
deeper_gap
|
|
@@ -49138,7 +49138,7 @@ var require_stringify2 = __commonJS({
|
|
|
49138
49138
|
inside += COMMA;
|
|
49139
49139
|
}
|
|
49140
49140
|
first = false;
|
|
49141
|
-
const before =
|
|
49141
|
+
const before = join14(
|
|
49142
49142
|
after_comma,
|
|
49143
49143
|
process_comments(value, BEFORE(key), deeper_gap),
|
|
49144
49144
|
deeper_gap
|
|
@@ -49148,7 +49148,7 @@ var require_stringify2 = __commonJS({
|
|
|
49148
49148
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
49149
49149
|
};
|
|
49150
49150
|
keys.forEach(iteratee);
|
|
49151
|
-
inside +=
|
|
49151
|
+
inside += join14(
|
|
49152
49152
|
after_comma,
|
|
49153
49153
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
49154
49154
|
deeper_gap
|
|
@@ -49369,11 +49369,11 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
49369
49369
|
}
|
|
49370
49370
|
function __awaiter(thisArg, _arguments, P2, generator) {
|
|
49371
49371
|
function adopt(value) {
|
|
49372
|
-
return value instanceof P2 ? value : new P2(function(
|
|
49373
|
-
|
|
49372
|
+
return value instanceof P2 ? value : new P2(function(resolve16) {
|
|
49373
|
+
resolve16(value);
|
|
49374
49374
|
});
|
|
49375
49375
|
}
|
|
49376
|
-
return new (P2 || (P2 = Promise))(function(
|
|
49376
|
+
return new (P2 || (P2 = Promise))(function(resolve16, reject) {
|
|
49377
49377
|
function fulfilled(value) {
|
|
49378
49378
|
try {
|
|
49379
49379
|
step(generator.next(value));
|
|
@@ -49389,7 +49389,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
49389
49389
|
}
|
|
49390
49390
|
}
|
|
49391
49391
|
function step(result) {
|
|
49392
|
-
result.done ?
|
|
49392
|
+
result.done ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
49393
49393
|
}
|
|
49394
49394
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
49395
49395
|
});
|
|
@@ -49580,14 +49580,14 @@ function __asyncValues(o) {
|
|
|
49580
49580
|
}, i);
|
|
49581
49581
|
function verb(n) {
|
|
49582
49582
|
i[n] = o[n] && function(v) {
|
|
49583
|
-
return new Promise(function(
|
|
49584
|
-
v = o[n](v), settle2(
|
|
49583
|
+
return new Promise(function(resolve16, reject) {
|
|
49584
|
+
v = o[n](v), settle2(resolve16, reject, v.done, v.value);
|
|
49585
49585
|
});
|
|
49586
49586
|
};
|
|
49587
49587
|
}
|
|
49588
|
-
function settle2(
|
|
49588
|
+
function settle2(resolve16, reject, d2, v) {
|
|
49589
49589
|
Promise.resolve(v).then(function(v2) {
|
|
49590
|
-
|
|
49590
|
+
resolve16({ value: v2, done: d2 });
|
|
49591
49591
|
}, reject);
|
|
49592
49592
|
}
|
|
49593
49593
|
}
|
|
@@ -53443,7 +53443,7 @@ var require_util8 = __commonJS({
|
|
|
53443
53443
|
return path9;
|
|
53444
53444
|
}
|
|
53445
53445
|
exports2.normalize = normalize2;
|
|
53446
|
-
function
|
|
53446
|
+
function join14(aRoot, aPath) {
|
|
53447
53447
|
if (aRoot === "") {
|
|
53448
53448
|
aRoot = ".";
|
|
53449
53449
|
}
|
|
@@ -53475,7 +53475,7 @@ var require_util8 = __commonJS({
|
|
|
53475
53475
|
}
|
|
53476
53476
|
return joined;
|
|
53477
53477
|
}
|
|
53478
|
-
exports2.join =
|
|
53478
|
+
exports2.join = join14;
|
|
53479
53479
|
exports2.isAbsolute = function(aPath) {
|
|
53480
53480
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
53481
53481
|
};
|
|
@@ -53648,7 +53648,7 @@ var require_util8 = __commonJS({
|
|
|
53648
53648
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
53649
53649
|
}
|
|
53650
53650
|
}
|
|
53651
|
-
sourceURL =
|
|
53651
|
+
sourceURL = join14(urlGenerate(parsed), sourceURL);
|
|
53652
53652
|
}
|
|
53653
53653
|
return normalize2(sourceURL);
|
|
53654
53654
|
}
|
|
@@ -74512,12 +74512,12 @@ var require_packet = __commonJS({
|
|
|
74512
74512
|
let chunklen = 0;
|
|
74513
74513
|
let received = false;
|
|
74514
74514
|
let expected = false;
|
|
74515
|
-
return new Promise((
|
|
74515
|
+
return new Promise((resolve16, reject) => {
|
|
74516
74516
|
const processMessage = () => {
|
|
74517
74517
|
if (received) return;
|
|
74518
74518
|
received = true;
|
|
74519
74519
|
const buffer = Buffer.concat(chunks, chunklen);
|
|
74520
|
-
|
|
74520
|
+
resolve16(buffer.slice(2));
|
|
74521
74521
|
};
|
|
74522
74522
|
socket.on("end", processMessage);
|
|
74523
74523
|
socket.on("error", reject);
|
|
@@ -74579,15 +74579,15 @@ var require_udp = __commonJS({
|
|
|
74579
74579
|
if (message instanceof Packet) {
|
|
74580
74580
|
message = message.toBuffer();
|
|
74581
74581
|
}
|
|
74582
|
-
return new Promise((
|
|
74582
|
+
return new Promise((resolve16, reject) => {
|
|
74583
74583
|
this.send(message, rinfo.port, rinfo.address, (err) => {
|
|
74584
74584
|
if (err) return reject(err);
|
|
74585
|
-
|
|
74585
|
+
resolve16(message);
|
|
74586
74586
|
});
|
|
74587
74587
|
});
|
|
74588
74588
|
}
|
|
74589
74589
|
listen(port, address) {
|
|
74590
|
-
return new Promise((
|
|
74590
|
+
return new Promise((resolve16) => this.bind(port, address, resolve16));
|
|
74591
74591
|
}
|
|
74592
74592
|
};
|
|
74593
74593
|
module2.exports = Server;
|
|
@@ -74649,11 +74649,11 @@ var require_doh = __commonJS({
|
|
|
74649
74649
|
}
|
|
74650
74650
|
return queryData;
|
|
74651
74651
|
};
|
|
74652
|
-
var readStream = (stream) => new Promise((
|
|
74652
|
+
var readStream = (stream) => new Promise((resolve16, reject) => {
|
|
74653
74653
|
let buffer = "";
|
|
74654
74654
|
stream.on("error", reject).on("data", (chunk) => {
|
|
74655
74655
|
buffer += chunk;
|
|
74656
|
-
}).on("end", () =>
|
|
74656
|
+
}).on("end", () => resolve16(buffer));
|
|
74657
74657
|
});
|
|
74658
74658
|
var Server = class extends EventEmitter {
|
|
74659
74659
|
constructor(options) {
|
|
@@ -74779,12 +74779,12 @@ var require_dns2 = __commonJS({
|
|
|
74779
74779
|
}
|
|
74780
74780
|
const servers = Object.values(this.servers);
|
|
74781
74781
|
this.closed = Promise.all(
|
|
74782
|
-
servers.map((server) => new Promise((
|
|
74782
|
+
servers.map((server) => new Promise((resolve16) => server.once("close", resolve16)))
|
|
74783
74783
|
).then(() => {
|
|
74784
74784
|
this.emit("close");
|
|
74785
74785
|
});
|
|
74786
74786
|
this.listening = Promise.all(
|
|
74787
|
-
servers.map((server) => new Promise((
|
|
74787
|
+
servers.map((server) => new Promise((resolve16) => server.once("listening", resolve16)))
|
|
74788
74788
|
).then(() => {
|
|
74789
74789
|
const addresses = this.addresses();
|
|
74790
74790
|
this.emit("listening", addresses);
|
|
@@ -74916,18 +74916,18 @@ var require_tcp2 = __commonJS({
|
|
|
74916
74916
|
var require_doh2 = __commonJS({
|
|
74917
74917
|
"../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/doh.js"(exports2, module2) {
|
|
74918
74918
|
var Packet = require_packet();
|
|
74919
|
-
var defaultGet = (url2) => new Promise((
|
|
74919
|
+
var defaultGet = (url2) => new Promise((resolve16, reject) => {
|
|
74920
74920
|
const headers = {
|
|
74921
74921
|
accept: "application/dns-message"
|
|
74922
74922
|
};
|
|
74923
74923
|
const base = url2.startsWith("https") ? require("https") : require("http");
|
|
74924
|
-
const req = base.get(url2, { headers },
|
|
74924
|
+
const req = base.get(url2, { headers }, resolve16);
|
|
74925
74925
|
req.on("error", reject);
|
|
74926
74926
|
});
|
|
74927
74927
|
var readStream = (stream) => {
|
|
74928
74928
|
const buffer = [];
|
|
74929
|
-
return new Promise((
|
|
74930
|
-
stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () =>
|
|
74929
|
+
return new Promise((resolve16, reject) => {
|
|
74930
|
+
stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () => resolve16(Buffer.concat(buffer)));
|
|
74931
74931
|
});
|
|
74932
74932
|
};
|
|
74933
74933
|
var DOHClient = ({ dns, http, get = defaultGet } = {}) => {
|
|
@@ -74980,12 +74980,12 @@ var require_udp2 = __commonJS({
|
|
|
74980
74980
|
type: Packet.TYPE[type]
|
|
74981
74981
|
});
|
|
74982
74982
|
const client = new udp.Socket(socketType);
|
|
74983
|
-
return new Promise((
|
|
74983
|
+
return new Promise((resolve16, reject) => {
|
|
74984
74984
|
client.once("message", function onMessage(message) {
|
|
74985
74985
|
client.close();
|
|
74986
74986
|
const response = Packet.parse(message);
|
|
74987
74987
|
equal(response.header.id, query.header.id);
|
|
74988
|
-
|
|
74988
|
+
resolve16(response);
|
|
74989
74989
|
});
|
|
74990
74990
|
debug("send", dns, query.toBuffer());
|
|
74991
74991
|
client.send(query.toBuffer(), port, dns, (err) => err && reject(err));
|
|
@@ -74999,13 +74999,13 @@ var require_udp2 = __commonJS({
|
|
|
74999
74999
|
var require_google = __commonJS({
|
|
75000
75000
|
"../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/google.js"(exports2, module2) {
|
|
75001
75001
|
var https = require("https");
|
|
75002
|
-
var get = (url2) => new Promise((
|
|
75002
|
+
var get = (url2) => new Promise((resolve16) => https.get(url2, resolve16));
|
|
75003
75003
|
var readStream = (stream) => {
|
|
75004
75004
|
const buffer = [];
|
|
75005
|
-
return new Promise((
|
|
75005
|
+
return new Promise((resolve16, reject) => {
|
|
75006
75006
|
stream.on("error", reject).on("data", (chunk) => {
|
|
75007
75007
|
buffer.push(chunk);
|
|
75008
|
-
}).on("end", () =>
|
|
75008
|
+
}).on("end", () => resolve16(Buffer.concat(buffer)));
|
|
75009
75009
|
});
|
|
75010
75010
|
};
|
|
75011
75011
|
var GoogleClient = () => (name3, type = "ANY") => {
|
|
@@ -75066,8 +75066,8 @@ var require_dns22 = __commonJS({
|
|
|
75066
75066
|
const { port, nameServers, recursive: recursive2, resolverProtocol = "UDP" } = this;
|
|
75067
75067
|
const createResolver = _DNS[resolverProtocol + "Client"];
|
|
75068
75068
|
return Promise.race(nameServers.map((address) => {
|
|
75069
|
-
const
|
|
75070
|
-
return
|
|
75069
|
+
const resolve16 = createResolver({ dns: address, port, recursive: recursive2 });
|
|
75070
|
+
return resolve16(name3, type, cls, clientIp);
|
|
75071
75071
|
}));
|
|
75072
75072
|
}
|
|
75073
75073
|
/**
|
|
@@ -75115,13 +75115,10 @@ var require_dns22 = __commonJS({
|
|
|
75115
75115
|
var cli_exports = {};
|
|
75116
75116
|
__export(cli_exports, {
|
|
75117
75117
|
main: () => main,
|
|
75118
|
-
runCli: () => runCli
|
|
75119
|
-
setupProjectDirectory: () => setupProjectDirectory
|
|
75118
|
+
runCli: () => runCli
|
|
75120
75119
|
});
|
|
75121
75120
|
module.exports = __toCommonJS(cli_exports);
|
|
75122
|
-
var
|
|
75123
|
-
var import_node_path28 = require("node:path");
|
|
75124
|
-
var import_node_process15 = require("node:process");
|
|
75121
|
+
var import_node_process16 = require("node:process");
|
|
75125
75122
|
|
|
75126
75123
|
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
75127
75124
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
@@ -82897,7 +82894,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
82897
82894
|
var NONE = 0;
|
|
82898
82895
|
var ASSUMED = 1;
|
|
82899
82896
|
var PROVEN = 2;
|
|
82900
|
-
function isRecursive(inst, stack,
|
|
82897
|
+
function isRecursive(inst, stack, resolve16) {
|
|
82901
82898
|
const cached2 = recursive.get(inst);
|
|
82902
82899
|
if (cached2 !== void 0)
|
|
82903
82900
|
return cached2 ? PROVEN : NONE;
|
|
@@ -82907,7 +82904,7 @@ function isRecursive(inst, stack, resolve15) {
|
|
|
82907
82904
|
let result = NONE;
|
|
82908
82905
|
const check2 = /* @__PURE__ */ __name((child) => {
|
|
82909
82906
|
if (result !== PROVEN && child?._zod) {
|
|
82910
|
-
const answer = isRecursive(child, stack,
|
|
82907
|
+
const answer = isRecursive(child, stack, resolve16);
|
|
82911
82908
|
if (answer > result)
|
|
82912
82909
|
result = answer;
|
|
82913
82910
|
}
|
|
@@ -82918,7 +82915,7 @@ function isRecursive(inst, stack, resolve15) {
|
|
|
82918
82915
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
82919
82916
|
if (spread && !desc.enumerable)
|
|
82920
82917
|
continue;
|
|
82921
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
82918
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve16) : NONE;
|
|
82922
82919
|
if (child > answer)
|
|
82923
82920
|
answer = child;
|
|
82924
82921
|
}
|
|
@@ -82982,7 +82979,7 @@ function isRecursive(inst, stack, resolve15) {
|
|
|
82982
82979
|
break;
|
|
82983
82980
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
82984
82981
|
case "lazy": {
|
|
82985
|
-
const inner = def._cachedInner ?? (
|
|
82982
|
+
const inner = def._cachedInner ?? (resolve16 ? inst._zod.innerType : void 0);
|
|
82986
82983
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
82987
82984
|
break;
|
|
82988
82985
|
}
|
|
@@ -97860,7 +97857,7 @@ function formatZodError(error62) {
|
|
|
97860
97857
|
}
|
|
97861
97858
|
__name(formatZodError, "formatZodError");
|
|
97862
97859
|
|
|
97863
|
-
// ../workers-utils/dist/chunk-
|
|
97860
|
+
// ../workers-utils/dist/chunk-2HLTAS5V.mjs
|
|
97864
97861
|
var import_node_module6 = require("node:module");
|
|
97865
97862
|
|
|
97866
97863
|
// ../workers-utils/dist/chunk-M3RITKR3.mjs
|
|
@@ -97909,7 +97906,7 @@ function dedent(templ) {
|
|
|
97909
97906
|
__name(dedent, "dedent");
|
|
97910
97907
|
var esm_default = dedent;
|
|
97911
97908
|
|
|
97912
|
-
// ../workers-utils/dist/chunk-
|
|
97909
|
+
// ../workers-utils/dist/chunk-2HLTAS5V.mjs
|
|
97913
97910
|
init_chunk_U6NEESU5();
|
|
97914
97911
|
var import_node_fs = require("node:fs");
|
|
97915
97912
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
@@ -98074,7 +98071,7 @@ function getDurableObjectClassNameToUseSQLiteMap(migrations, exports$1) {
|
|
|
98074
98071
|
__name(getDurableObjectClassNameToUseSQLiteMap, "getDurableObjectClassNameToUseSQLiteMap");
|
|
98075
98072
|
function validateDurableObjectContainerApplications(config50, containers = getDurableObjectContainerApps(
|
|
98076
98073
|
config50.containers
|
|
98077
|
-
)) {
|
|
98074
|
+
), configFileName2 = "Wrangler config file") {
|
|
98078
98075
|
const allDOs = getDurableObjectClassNameToUseSQLiteMap(
|
|
98079
98076
|
config50.migrations,
|
|
98080
98077
|
config50.exports
|
|
@@ -98089,7 +98086,7 @@ function validateDurableObjectContainerApplications(config50, containers = getDu
|
|
|
98089
98086
|
const useSQLite = allDOs.get(container.class_name);
|
|
98090
98087
|
if (useSQLite === void 0 && maybeBoundDO === void 0) {
|
|
98091
98088
|
throw new UserError(
|
|
98092
|
-
`The container class_name ${container.class_name} does not match any durable object class_name defined in your
|
|
98089
|
+
`The container class_name ${container.class_name} does not match any durable object class_name defined in your ${configFileName2}. Note that the durable object must be defined in the same script as the container.`,
|
|
98093
98090
|
{ telemetryMessage: "no DO defined that matches container class_name" }
|
|
98094
98091
|
);
|
|
98095
98092
|
}
|
|
@@ -98886,12 +98883,12 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
98886
98883
|
return result;
|
|
98887
98884
|
}
|
|
98888
98885
|
__name(parseTree, "parseTree");
|
|
98889
|
-
function findNodeAtLocation(root,
|
|
98886
|
+
function findNodeAtLocation(root, path32) {
|
|
98890
98887
|
if (!root) {
|
|
98891
98888
|
return void 0;
|
|
98892
98889
|
}
|
|
98893
98890
|
let node2 = root;
|
|
98894
|
-
for (let segment of
|
|
98891
|
+
for (let segment of path32) {
|
|
98895
98892
|
if (typeof segment === "string") {
|
|
98896
98893
|
if (node2.type !== "object" || !Array.isArray(node2.children)) {
|
|
98897
98894
|
return void 0;
|
|
@@ -99238,14 +99235,14 @@ function getNodeType(value) {
|
|
|
99238
99235
|
}
|
|
99239
99236
|
__name(getNodeType, "getNodeType");
|
|
99240
99237
|
function setProperty(text, originalPath, value, options) {
|
|
99241
|
-
const
|
|
99238
|
+
const path32 = originalPath.slice();
|
|
99242
99239
|
const errors = [];
|
|
99243
99240
|
const root = parseTree(text, errors);
|
|
99244
99241
|
let parent = void 0;
|
|
99245
99242
|
let lastSegment = void 0;
|
|
99246
|
-
while (
|
|
99247
|
-
lastSegment =
|
|
99248
|
-
parent = findNodeAtLocation(root,
|
|
99243
|
+
while (path32.length > 0) {
|
|
99244
|
+
lastSegment = path32.pop();
|
|
99245
|
+
parent = findNodeAtLocation(root, path32);
|
|
99249
99246
|
if (parent === void 0 && value !== void 0) {
|
|
99250
99247
|
if (typeof lastSegment === "string") {
|
|
99251
99248
|
value = { [lastSegment]: value };
|
|
@@ -99474,8 +99471,8 @@ function format22(documentText, range, options) {
|
|
|
99474
99471
|
return format2(documentText, range, options);
|
|
99475
99472
|
}
|
|
99476
99473
|
__name(format22, "format");
|
|
99477
|
-
function modify(text,
|
|
99478
|
-
return setProperty(text,
|
|
99474
|
+
function modify(text, path32, value, options) {
|
|
99475
|
+
return setProperty(text, path32, value, options);
|
|
99479
99476
|
}
|
|
99480
99477
|
__name(modify, "modify");
|
|
99481
99478
|
function applyEdits(text, edits) {
|
|
@@ -100957,7 +100954,10 @@ function configFormat(configPath) {
|
|
|
100957
100954
|
return "none";
|
|
100958
100955
|
}
|
|
100959
100956
|
__name(configFormat, "configFormat");
|
|
100960
|
-
function configFileName(configPath) {
|
|
100957
|
+
function configFileName(configPath, userConfigPath) {
|
|
100958
|
+
if (userConfigPath !== void 0) {
|
|
100959
|
+
return import_node_path.default.basename(userConfigPath);
|
|
100960
|
+
}
|
|
100961
100961
|
const format32 = configFormat(configPath);
|
|
100962
100962
|
switch (format32) {
|
|
100963
100963
|
case "toml":
|
|
@@ -110498,7 +110498,7 @@ function mapWorkerMetadataBindings(bindings) {
|
|
|
110498
110498
|
}, {});
|
|
110499
110499
|
}
|
|
110500
110500
|
__name(mapWorkerMetadataBindings, "mapWorkerMetadataBindings");
|
|
110501
|
-
var DEFAULT_COMPAT_DATE = "2026-10-
|
|
110501
|
+
var DEFAULT_COMPAT_DATE = "2026-10-19";
|
|
110502
110502
|
function constructWranglerConfig(config50) {
|
|
110503
110503
|
const mappedBindings = mapWorkerMetadataBindings(config50.bindings);
|
|
110504
110504
|
const durableObjectClassNames = config50.bindings.filter(
|
|
@@ -117766,12 +117766,12 @@ var YargsInstance = class {
|
|
|
117766
117766
|
async getCompletion(args, done) {
|
|
117767
117767
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
117768
117768
|
if (!done) {
|
|
117769
|
-
return new Promise((
|
|
117769
|
+
return new Promise((resolve16, reject) => {
|
|
117770
117770
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
117771
117771
|
if (err)
|
|
117772
117772
|
reject(err);
|
|
117773
117773
|
else
|
|
117774
|
-
|
|
117774
|
+
resolve16(completions);
|
|
117775
117775
|
});
|
|
117776
117776
|
});
|
|
117777
117777
|
} else {
|
|
@@ -118811,7 +118811,7 @@ var Yargs = YargsFactory(esm_default2);
|
|
|
118811
118811
|
var yargs_default = Yargs;
|
|
118812
118812
|
|
|
118813
118813
|
// package.json
|
|
118814
|
-
var version2 = "2.
|
|
118814
|
+
var version2 = "2.74.1";
|
|
118815
118815
|
|
|
118816
118816
|
// src/metrics.ts
|
|
118817
118817
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -118966,6 +118966,7 @@ var CLOUDFLARE_API_TOKEN = process.env.CLOUDFLARE_API_TOKEN;
|
|
|
118966
118966
|
var isExperimental = process.env.E2E_EXPERIMENTAL === "true";
|
|
118967
118967
|
var workerTemplateToTest = process.env.E2E_WORKER_TEMPLATE_TO_TEST;
|
|
118968
118968
|
var frameworkToTestFilter = process.env.E2E_FRAMEWORK_TEMPLATE_TO_TEST;
|
|
118969
|
+
var frameworkTestShard = process.env.E2E_FRAMEWORK_SHARD;
|
|
118969
118970
|
var testPackageManager = isOneOf2(
|
|
118970
118971
|
"E2E_TEST_PM",
|
|
118971
118972
|
["pnpm", "npm", "yarn", "bun"],
|
|
@@ -118974,7 +118975,7 @@ var testPackageManager = isOneOf2(
|
|
|
118974
118975
|
var testPackageManagerVersion = process.env.E2E_TEST_PM_VERSION ?? "";
|
|
118975
118976
|
var runDeployTests = process.env.E2E_RUN_DEPLOY_TESTS === "true";
|
|
118976
118977
|
var customTempProjectPath = process.env.E2E_PROJECT_PATH;
|
|
118977
|
-
var testRetries = process.env.E2E_TEST_RETRIES
|
|
118978
|
+
var testRetries = process.env.E2E_TEST_RETRIES;
|
|
118978
118979
|
function isOneOf2(key, possibleValues, defaultValue) {
|
|
118979
118980
|
const value = process.env[key] ?? defaultValue;
|
|
118980
118981
|
(0, import_node_assert3.default)(
|
|
@@ -119121,16 +119122,16 @@ async function sendEvent(payload, enableLog) {
|
|
|
119121
119122
|
|
|
119122
119123
|
// src/metrics.ts
|
|
119123
119124
|
function promiseWithResolvers() {
|
|
119124
|
-
let
|
|
119125
|
+
let resolve16;
|
|
119125
119126
|
let reject;
|
|
119126
119127
|
const promise2 = new Promise((res, rej) => {
|
|
119127
|
-
|
|
119128
|
+
resolve16 = res;
|
|
119128
119129
|
reject = rej;
|
|
119129
119130
|
});
|
|
119130
|
-
if (!
|
|
119131
|
+
if (!resolve16 || !reject) {
|
|
119131
119132
|
throw new Error("Promise resolvers not set");
|
|
119132
119133
|
}
|
|
119133
|
-
return { resolve:
|
|
119134
|
+
return { resolve: resolve16, reject, promise: promise2 };
|
|
119134
119135
|
}
|
|
119135
119136
|
function getPlatform() {
|
|
119136
119137
|
const platform3 = process.platform;
|
|
@@ -119347,10 +119348,10 @@ var runTelemetryCommand = (action) => {
|
|
|
119347
119348
|
};
|
|
119348
119349
|
|
|
119349
119350
|
// src/templates.ts
|
|
119350
|
-
var
|
|
119351
|
+
var import_node_fs22 = require("node:fs");
|
|
119351
119352
|
var import_promises9 = require("node:fs/promises");
|
|
119352
119353
|
var import_node_os8 = require("node:os");
|
|
119353
|
-
var
|
|
119354
|
+
var import_node_path26 = require("node:path");
|
|
119354
119355
|
var import_deepmerge = __toESM(require_cjs());
|
|
119355
119356
|
var import_degit = __toESM(require_dist());
|
|
119356
119357
|
|
|
@@ -120624,6 +120625,16 @@ async function installWrangler2() {
|
|
|
120624
120625
|
const { npm: npm25 } = detectPackageManager();
|
|
120625
120626
|
return installWrangler(npm25, false);
|
|
120626
120627
|
}
|
|
120628
|
+
async function installCf() {
|
|
120629
|
+
const { npm: npm25 } = detectPackageManager();
|
|
120630
|
+
await installPackages2(["cf@latest"], {
|
|
120631
|
+
dev: true,
|
|
120632
|
+
startText: `Installing cf ${dim("The Cloudflare CLI")}`,
|
|
120633
|
+
doneText: `${brandColor("installed")} ${dim(
|
|
120634
|
+
`via \`${npm25} install cf --save-dev\``
|
|
120635
|
+
)}`
|
|
120636
|
+
});
|
|
120637
|
+
}
|
|
120627
120638
|
var npmInstall = async (ctx) => {
|
|
120628
120639
|
const nodeModulesPath = import_node_path12.default.join(ctx.project.path, "node_modules");
|
|
120629
120640
|
if ((0, import_node_fs11.existsSync)(nodeModulesPath)) {
|
|
@@ -121240,19 +121251,19 @@ var baseOpen2 = async (options) => {
|
|
|
121240
121251
|
}
|
|
121241
121252
|
const subprocess = import_node_child_process9.default.spawn(command2, cliArguments, childProcessOptions);
|
|
121242
121253
|
if (options.wait) {
|
|
121243
|
-
return new Promise((
|
|
121254
|
+
return new Promise((resolve16, reject) => {
|
|
121244
121255
|
subprocess.once("error", reject);
|
|
121245
121256
|
subprocess.once("close", (exitCode) => {
|
|
121246
121257
|
if (!options.allowNonzeroExitCode && exitCode !== 0) {
|
|
121247
121258
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
121248
121259
|
return;
|
|
121249
121260
|
}
|
|
121250
|
-
|
|
121261
|
+
resolve16(subprocess);
|
|
121251
121262
|
});
|
|
121252
121263
|
});
|
|
121253
121264
|
}
|
|
121254
121265
|
if (isFallbackAttempt) {
|
|
121255
|
-
return new Promise((
|
|
121266
|
+
return new Promise((resolve16, reject) => {
|
|
121256
121267
|
subprocess.once("error", reject);
|
|
121257
121268
|
subprocess.once("spawn", () => {
|
|
121258
121269
|
subprocess.once("close", (exitCode) => {
|
|
@@ -121262,17 +121273,17 @@ var baseOpen2 = async (options) => {
|
|
|
121262
121273
|
return;
|
|
121263
121274
|
}
|
|
121264
121275
|
subprocess.unref();
|
|
121265
|
-
|
|
121276
|
+
resolve16(subprocess);
|
|
121266
121277
|
});
|
|
121267
121278
|
});
|
|
121268
121279
|
});
|
|
121269
121280
|
}
|
|
121270
121281
|
subprocess.unref();
|
|
121271
|
-
return new Promise((
|
|
121282
|
+
return new Promise((resolve16, reject) => {
|
|
121272
121283
|
subprocess.once("error", reject);
|
|
121273
121284
|
subprocess.once("spawn", () => {
|
|
121274
121285
|
subprocess.off("error", reject);
|
|
121275
|
-
|
|
121286
|
+
resolve16(subprocess);
|
|
121276
121287
|
});
|
|
121277
121288
|
});
|
|
121278
121289
|
};
|
|
@@ -121505,29 +121516,32 @@ function getPropertyName(newProp) {
|
|
|
121505
121516
|
}
|
|
121506
121517
|
__name2(getPropertyName, "getPropertyName");
|
|
121507
121518
|
|
|
121519
|
+
// src/frameworks/index.ts
|
|
121520
|
+
var import_semver3 = __toESM(require_semver2());
|
|
121521
|
+
|
|
121508
121522
|
// src/frameworks/package.json
|
|
121509
121523
|
var package_default = {
|
|
121510
121524
|
name: "frameworks_clis_info",
|
|
121511
121525
|
dependencies: {
|
|
121512
|
-
"@angular/create": "22.2.
|
|
121513
|
-
"@tanstack/cli": "0.
|
|
121514
|
-
"create-analog": "2.8.
|
|
121515
|
-
"create-astro": "5.
|
|
121526
|
+
"@angular/create": "22.2.3",
|
|
121527
|
+
"@tanstack/cli": "0.72.0",
|
|
121528
|
+
"create-analog": "2.8.1",
|
|
121529
|
+
"create-astro": "5.3.0",
|
|
121516
121530
|
"create-docusaurus": "3.10.2",
|
|
121517
121531
|
"create-hono": "0.19.5",
|
|
121518
|
-
"create-next-app": "16.
|
|
121519
|
-
"create-qwik": "1.20.
|
|
121532
|
+
"create-next-app": "16.4.2",
|
|
121533
|
+
"create-qwik": "1.20.2",
|
|
121520
121534
|
"create-react-router": "8.4.0",
|
|
121521
121535
|
"create-rwsdk": "3.1.3",
|
|
121522
121536
|
"create-solid": "0.12.0",
|
|
121523
|
-
"create-vike": "0.0.
|
|
121524
|
-
"create-vinext-app": "1.
|
|
121537
|
+
"create-vike": "0.0.686",
|
|
121538
|
+
"create-vinext-app": "1.1.0",
|
|
121525
121539
|
"create-vite": "9.2.1",
|
|
121526
121540
|
"create-vue": "3.24.0",
|
|
121527
121541
|
"create-waku": "0.12.5-1.0.0-alpha.10-0",
|
|
121528
121542
|
gatsby: "5.16.1",
|
|
121529
|
-
nuxi: "
|
|
121530
|
-
sv: "1.
|
|
121543
|
+
nuxi: "4.0.1",
|
|
121544
|
+
sv: "1.1.1"
|
|
121531
121545
|
},
|
|
121532
121546
|
info: [
|
|
121533
121547
|
"This package.json is only used to keep track of the frameworks cli dependencies",
|
|
@@ -121546,6 +121560,13 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
121546
121560
|
};
|
|
121547
121561
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
121548
121562
|
const cli = getFrameworkCli(ctx, true);
|
|
121563
|
+
const nodeVersion2 = process.versions.node;
|
|
121564
|
+
const requiredNodeVersion = ctx.template.frameworkCliNodeVersion;
|
|
121565
|
+
if (requiredNodeVersion && !import_semver3.default.satisfies(nodeVersion2, requiredNodeVersion)) {
|
|
121566
|
+
throw new Error(
|
|
121567
|
+
`${ctx.template.displayName} requires Node.js ${requiredNodeVersion}. You are using Node.js ${nodeVersion2}. Please upgrade Node.js and try again.`
|
|
121568
|
+
);
|
|
121569
|
+
}
|
|
121549
121570
|
const { npm: npm25, dlx } = detectPackageManager();
|
|
121550
121571
|
const cmd = [...npm25 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
121551
121572
|
const env3 = npm25 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
@@ -121901,6 +121922,7 @@ var config6 = {
|
|
|
121901
121922
|
configVersion: 1,
|
|
121902
121923
|
id: "astro",
|
|
121903
121924
|
frameworkCli: "create-astro",
|
|
121925
|
+
frameworkCliNodeVersion: ">=22.22.0",
|
|
121904
121926
|
platform: "pages",
|
|
121905
121927
|
hidden: true,
|
|
121906
121928
|
displayName: "Astro",
|
|
@@ -121958,6 +121980,7 @@ var config7 = {
|
|
|
121958
121980
|
configVersion: 1,
|
|
121959
121981
|
id: "astro",
|
|
121960
121982
|
frameworkCli: "create-astro",
|
|
121983
|
+
frameworkCliNodeVersion: ">=22.22.0",
|
|
121961
121984
|
platform: "workers",
|
|
121962
121985
|
displayName: "Astro",
|
|
121963
121986
|
copyFiles: {
|
|
@@ -122450,6 +122473,16 @@ var c3_default26 = config22;
|
|
|
122450
122473
|
|
|
122451
122474
|
// templates/next/c3.ts
|
|
122452
122475
|
var import_node_assert5 = __toESM(require("node:assert"));
|
|
122476
|
+
|
|
122477
|
+
// src/cf/config.ts
|
|
122478
|
+
var import_node_fs17 = require("node:fs");
|
|
122479
|
+
var import_node_path18 = require("node:path");
|
|
122480
|
+
var CF_TYPES_PATH = "./.cloudflare/types/index.d.ts";
|
|
122481
|
+
function usesCfCli(projectPath) {
|
|
122482
|
+
return (0, import_node_fs17.existsSync)((0, import_node_path18.resolve)(projectPath, "cloudflare.config.ts"));
|
|
122483
|
+
}
|
|
122484
|
+
|
|
122485
|
+
// templates/next/c3.ts
|
|
122453
122486
|
var { npm: npm8 } = detectPackageManager();
|
|
122454
122487
|
var VINEXT_TYPES_PATH = "./worker-configuration.d.ts";
|
|
122455
122488
|
var OPENNEXT_TYPES_PATH = "./cloudflare-env.d.ts";
|
|
@@ -122545,7 +122578,9 @@ var c3_default27 = {
|
|
|
122545
122578
|
// Align with OpenNext so the shared previewScript: "preview" works
|
|
122546
122579
|
// for both variants (vinext only ships dev/build/start/deploy).
|
|
122547
122580
|
preview: `${npm8} run build && ${npm8} run start${npm8 === "npm" ? " --" : ""}`,
|
|
122548
|
-
|
|
122581
|
+
// vinext configures projects for the `cf` CLI unless it is passed
|
|
122582
|
+
// `--legacy-wrangler-cloudflare-init`
|
|
122583
|
+
"cf-typegen": usesCfCli(ctx.project.path) ? "cf workers types" : `wrangler types --env-interface ${envInterfaceName3} ${VINEXT_TYPES_PATH}`
|
|
122549
122584
|
}
|
|
122550
122585
|
};
|
|
122551
122586
|
},
|
|
@@ -122583,6 +122618,7 @@ var experimental_c3_default = {
|
|
|
122583
122618
|
};
|
|
122584
122619
|
|
|
122585
122620
|
// templates/nuxt/pages/c3.ts
|
|
122621
|
+
var import_node_path19 = require("node:path");
|
|
122586
122622
|
var recast4 = __toESM(require_main2());
|
|
122587
122623
|
var { npm: npm9, name: pm } = detectPackageManager();
|
|
122588
122624
|
var generate14 = async (ctx) => {
|
|
@@ -122595,7 +122631,7 @@ var generate14 = async (ctx) => {
|
|
|
122595
122631
|
"--no-install",
|
|
122596
122632
|
gitFlag
|
|
122597
122633
|
]);
|
|
122598
|
-
writeFile4("
|
|
122634
|
+
writeFile4((0, import_node_path19.join)(ctx.project.path, ".node-version"), "22.23.1");
|
|
122599
122635
|
logRaw("");
|
|
122600
122636
|
};
|
|
122601
122637
|
var configure6 = async () => {
|
|
@@ -122656,6 +122692,7 @@ var config23 = {
|
|
|
122656
122692
|
configVersion: 1,
|
|
122657
122693
|
id: "nuxt",
|
|
122658
122694
|
frameworkCli: "nuxi",
|
|
122695
|
+
frameworkCliNodeVersion: "^22.21.0 || ^24.11.0 || >=26.0.0",
|
|
122659
122696
|
platform: "pages",
|
|
122660
122697
|
languages: ["ts"],
|
|
122661
122698
|
hidden: true,
|
|
@@ -122680,6 +122717,7 @@ var config23 = {
|
|
|
122680
122717
|
var c3_default28 = config23;
|
|
122681
122718
|
|
|
122682
122719
|
// templates/nuxt/workers/c3.ts
|
|
122720
|
+
var import_node_path20 = require("node:path");
|
|
122683
122721
|
var recast5 = __toESM(require_main2());
|
|
122684
122722
|
var { npm: npm10, name: pm2 } = detectPackageManager();
|
|
122685
122723
|
var generate15 = async (ctx) => {
|
|
@@ -122692,7 +122730,7 @@ var generate15 = async (ctx) => {
|
|
|
122692
122730
|
"--no-install",
|
|
122693
122731
|
gitFlag
|
|
122694
122732
|
]);
|
|
122695
|
-
writeFile4("
|
|
122733
|
+
writeFile4((0, import_node_path20.join)(ctx.project.path, ".node-version"), "22.23.1");
|
|
122696
122734
|
logRaw("");
|
|
122697
122735
|
};
|
|
122698
122736
|
var configure7 = async () => {
|
|
@@ -122753,6 +122791,7 @@ var config24 = {
|
|
|
122753
122791
|
configVersion: 1,
|
|
122754
122792
|
id: "nuxt",
|
|
122755
122793
|
frameworkCli: "nuxi",
|
|
122794
|
+
frameworkCliNodeVersion: "^22.21.0 || ^24.11.0 || >=26.0.0",
|
|
122756
122795
|
platform: "workers",
|
|
122757
122796
|
languages: ["ts"],
|
|
122758
122797
|
displayName: "Nuxt",
|
|
@@ -122797,10 +122836,10 @@ var config26 = {
|
|
|
122797
122836
|
var c3_default31 = config26;
|
|
122798
122837
|
|
|
122799
122838
|
// templates/pre-existing/c3.ts
|
|
122800
|
-
var
|
|
122839
|
+
var import_node_fs18 = require("node:fs");
|
|
122801
122840
|
var import_promises8 = require("node:fs/promises");
|
|
122802
122841
|
var import_node_os7 = require("node:os");
|
|
122803
|
-
var
|
|
122842
|
+
var import_node_path21 = require("node:path");
|
|
122804
122843
|
|
|
122805
122844
|
// src/helpers/command.ts
|
|
122806
122845
|
var runWranglerCommand = async (command2, opts = {}) => {
|
|
@@ -122813,6 +122852,44 @@ var runWranglerCommand = async (command2, opts = {}) => {
|
|
|
122813
122852
|
return runCommand(command2, { ...opts, env: env3 });
|
|
122814
122853
|
};
|
|
122815
122854
|
|
|
122855
|
+
// src/cf/accounts.ts
|
|
122856
|
+
async function cfWhoami() {
|
|
122857
|
+
const { npx: npx6 } = detectPackageManager();
|
|
122858
|
+
try {
|
|
122859
|
+
const output2 = await runWranglerCommand([npx6, "cf", "auth", "whoami"], {
|
|
122860
|
+
silent: true
|
|
122861
|
+
});
|
|
122862
|
+
return JSON.parse(
|
|
122863
|
+
output2.slice(output2.indexOf("{"), output2.lastIndexOf("}") + 1)
|
|
122864
|
+
);
|
|
122865
|
+
} catch (e) {
|
|
122866
|
+
if (e instanceof CancelError) {
|
|
122867
|
+
throw e;
|
|
122868
|
+
}
|
|
122869
|
+
return {};
|
|
122870
|
+
}
|
|
122871
|
+
}
|
|
122872
|
+
async function isLoggedIn() {
|
|
122873
|
+
const { authenticated, tokenValid } = await cfWhoami();
|
|
122874
|
+
return authenticated === true && tokenValid !== false;
|
|
122875
|
+
}
|
|
122876
|
+
async function listAccounts() {
|
|
122877
|
+
const { accounts = [] } = await cfWhoami();
|
|
122878
|
+
return Object.fromEntries(accounts.map(({ name: name3, id }) => [name3, id]));
|
|
122879
|
+
}
|
|
122880
|
+
async function login() {
|
|
122881
|
+
const { npx: npx6 } = detectPackageManager();
|
|
122882
|
+
try {
|
|
122883
|
+
await runWranglerCommand([npx6, "cf", "auth", "login", "--force"]);
|
|
122884
|
+
} catch (e) {
|
|
122885
|
+
if (e instanceof CancelError) {
|
|
122886
|
+
throw e;
|
|
122887
|
+
}
|
|
122888
|
+
return false;
|
|
122889
|
+
}
|
|
122890
|
+
return isLoggedIn();
|
|
122891
|
+
}
|
|
122892
|
+
|
|
122816
122893
|
// src/wrangler/accounts.ts
|
|
122817
122894
|
var chooseAccount = async (ctx) => {
|
|
122818
122895
|
const accountIdFromEnv = process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
@@ -122823,7 +122900,7 @@ var chooseAccount = async (ctx) => {
|
|
|
122823
122900
|
}
|
|
122824
122901
|
const s = spinner();
|
|
122825
122902
|
s.start(`Selecting Cloudflare account ${dim("retrieving accounts")}`);
|
|
122826
|
-
const accounts = await listAccounts();
|
|
122903
|
+
const accounts = usesCfCli(ctx.project.path) ? await listAccounts() : await listAccounts2();
|
|
122827
122904
|
let accountId;
|
|
122828
122905
|
const numAccounts = Object.keys(accounts).length;
|
|
122829
122906
|
if (numAccounts === 0) {
|
|
@@ -122857,7 +122934,7 @@ var chooseAccount = async (ctx) => {
|
|
|
122857
122934
|
);
|
|
122858
122935
|
ctx.account = { id: accountId, name: accountName };
|
|
122859
122936
|
};
|
|
122860
|
-
var
|
|
122937
|
+
var login2 = async (ctx) => {
|
|
122861
122938
|
return reporter.collectAsyncMetrics({
|
|
122862
122939
|
eventPrefix: "c3 login",
|
|
122863
122940
|
props: {
|
|
@@ -122865,16 +122942,25 @@ var wranglerLogin = async (ctx) => {
|
|
|
122865
122942
|
},
|
|
122866
122943
|
async promise() {
|
|
122867
122944
|
const { npx: npx6 } = detectPackageManager();
|
|
122945
|
+
const useCf = usesCfCli(ctx.project.path);
|
|
122868
122946
|
const s = spinner();
|
|
122869
122947
|
s.start(
|
|
122870
122948
|
`Logging into Cloudflare ${dim("checking authentication status")}`
|
|
122871
122949
|
);
|
|
122872
|
-
const isAlreadyLoggedIn = await isLoggedIn();
|
|
122950
|
+
const isAlreadyLoggedIn = useCf ? await isLoggedIn() : await isLoggedIn2();
|
|
122873
122951
|
s.stop(brandColor(isAlreadyLoggedIn ? "logged in" : "not logged in"));
|
|
122874
122952
|
reporter.setEventProperty("isAlreadyLoggedIn", isAlreadyLoggedIn);
|
|
122875
122953
|
if (isAlreadyLoggedIn) {
|
|
122876
122954
|
return true;
|
|
122877
122955
|
}
|
|
122956
|
+
if (useCf) {
|
|
122957
|
+
const success3 = await login();
|
|
122958
|
+
updateStatus(
|
|
122959
|
+
`${brandColor(success3 ? "allowed" : "denied")} ${dim("via `cf auth login`")}`
|
|
122960
|
+
);
|
|
122961
|
+
reporter.setEventProperty("isLoginSuccessful", success3);
|
|
122962
|
+
return success3;
|
|
122963
|
+
}
|
|
122878
122964
|
s.start(
|
|
122879
122965
|
`Logging into Cloudflare ${dim("This will open a browser window")}`
|
|
122880
122966
|
);
|
|
@@ -122889,7 +122975,7 @@ var wranglerLogin = async (ctx) => {
|
|
|
122889
122975
|
}
|
|
122890
122976
|
});
|
|
122891
122977
|
};
|
|
122892
|
-
var
|
|
122978
|
+
var listAccounts2 = async () => {
|
|
122893
122979
|
const { npx: npx6 } = detectPackageManager();
|
|
122894
122980
|
const output2 = await runWranglerCommand([npx6, "wrangler", "whoami"], {
|
|
122895
122981
|
silent: true
|
|
@@ -122903,7 +122989,7 @@ var listAccounts = async () => {
|
|
|
122903
122989
|
});
|
|
122904
122990
|
return accounts;
|
|
122905
122991
|
};
|
|
122906
|
-
var
|
|
122992
|
+
var isLoggedIn2 = async () => {
|
|
122907
122993
|
const { npx: npx6 } = detectPackageManager();
|
|
122908
122994
|
try {
|
|
122909
122995
|
const output2 = await runWranglerCommand([npx6, "wrangler", "whoami"], {
|
|
@@ -122930,7 +123016,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
122930
123016
|
}
|
|
122931
123017
|
);
|
|
122932
123018
|
}
|
|
122933
|
-
const tempdir = await (0, import_promises8.mkdtemp)((0,
|
|
123019
|
+
const tempdir = await (0, import_promises8.mkdtemp)((0, import_node_path21.join)((0, import_node_os7.tmpdir)(), "c3-wrangler-init--from-dash-"));
|
|
122934
123020
|
await runCommand(
|
|
122935
123021
|
[
|
|
122936
123022
|
...dlx,
|
|
@@ -122953,16 +123039,16 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
122953
123039
|
}
|
|
122954
123040
|
);
|
|
122955
123041
|
await (0, import_promises8.cp)(
|
|
122956
|
-
(0,
|
|
122957
|
-
(0,
|
|
123042
|
+
(0, import_node_path21.join)(tempdir, ctx.args.existingScript, "src"),
|
|
123043
|
+
(0, import_node_path21.join)(ctx.project.path, "src"),
|
|
122958
123044
|
{ recursive: true }
|
|
122959
123045
|
);
|
|
122960
123046
|
const configFiles = ["wrangler.jsonc", "wrangler.json", "wrangler.toml"];
|
|
122961
123047
|
let configFileCopied = false;
|
|
122962
123048
|
for (const configFile of configFiles) {
|
|
122963
|
-
const sourcePath = (0,
|
|
122964
|
-
if ((0,
|
|
122965
|
-
await (0, import_promises8.cp)(sourcePath, (0,
|
|
123049
|
+
const sourcePath = (0, import_node_path21.join)(tempdir, ctx.args.existingScript, configFile);
|
|
123050
|
+
if ((0, import_node_fs18.existsSync)(sourcePath)) {
|
|
123051
|
+
await (0, import_promises8.cp)(sourcePath, (0, import_node_path21.join)(ctx.project.path, configFile));
|
|
122966
123052
|
configFileCopied = true;
|
|
122967
123053
|
break;
|
|
122968
123054
|
}
|
|
@@ -122985,7 +123071,7 @@ var config27 = {
|
|
|
122985
123071
|
},
|
|
122986
123072
|
languages: ["js"],
|
|
122987
123073
|
configure: buildConfigure({
|
|
122988
|
-
login:
|
|
123074
|
+
login: login2,
|
|
122989
123075
|
chooseAccount,
|
|
122990
123076
|
copyFiles: copyExistingWorkerFiles
|
|
122991
123077
|
})
|
|
@@ -123034,20 +123120,20 @@ var config28 = {
|
|
|
123034
123120
|
var c3_default33 = config28;
|
|
123035
123121
|
|
|
123036
123122
|
// src/helpers/codemod.ts
|
|
123037
|
-
var
|
|
123038
|
-
var
|
|
123123
|
+
var import_node_fs19 = require("node:fs");
|
|
123124
|
+
var import_node_path22 = require("node:path");
|
|
123039
123125
|
var loadSnippets = (parentFolder) => {
|
|
123040
|
-
const snippetsPath = (0,
|
|
123041
|
-
if (!(0,
|
|
123126
|
+
const snippetsPath = (0, import_node_path22.join)(parentFolder, "snippets");
|
|
123127
|
+
if (!(0, import_node_fs19.lstatSync)(snippetsPath, { throwIfNoEntry: false })?.isDirectory()) {
|
|
123042
123128
|
return {};
|
|
123043
123129
|
}
|
|
123044
|
-
const files = (0,
|
|
123045
|
-
return files.filter((fileName) => (0,
|
|
123130
|
+
const files = (0, import_node_fs19.readdirSync)(snippetsPath);
|
|
123131
|
+
return files.filter((fileName) => (0, import_node_fs19.lstatSync)((0, import_node_path22.join)(snippetsPath, fileName)).isFile()).filter((fileName) => [".js", ".ts"].includes((0, import_node_path22.extname)(fileName))).reduce((acc, snippetPath) => {
|
|
123046
123132
|
const [file3, ext] = snippetPath.split(".");
|
|
123047
123133
|
const key = `${file3}${ext === "js" ? "Js" : "Ts"}`;
|
|
123048
123134
|
return {
|
|
123049
123135
|
...acc,
|
|
123050
|
-
[key]: parseFile((0,
|
|
123136
|
+
[key]: parseFile((0, import_node_path22.join)(snippetsPath, snippetPath))?.body
|
|
123051
123137
|
};
|
|
123052
123138
|
}, {});
|
|
123053
123139
|
};
|
|
@@ -123240,7 +123326,7 @@ var config31 = {
|
|
|
123240
123326
|
var c3_default36 = config31;
|
|
123241
123327
|
|
|
123242
123328
|
// templates/react-router/c3.ts
|
|
123243
|
-
var
|
|
123329
|
+
var import_node_path23 = require("node:path");
|
|
123244
123330
|
var { npm: npm13 } = detectPackageManager();
|
|
123245
123331
|
var generate18 = async (ctx) => {
|
|
123246
123332
|
await runFrameworkGenerator(ctx, [
|
|
@@ -123259,9 +123345,9 @@ var configure10 = async (ctx) => {
|
|
|
123259
123345
|
});
|
|
123260
123346
|
const s = spinner();
|
|
123261
123347
|
s.start("Removing non-Cloudflare artifacts from template");
|
|
123262
|
-
removeFile((0,
|
|
123263
|
-
removeFile((0,
|
|
123264
|
-
const pkgJsonPath = (0,
|
|
123348
|
+
removeFile((0, import_node_path23.resolve)(ctx.project.path, "Dockerfile"));
|
|
123349
|
+
removeFile((0, import_node_path23.resolve)(ctx.project.path, ".dockerignore"));
|
|
123350
|
+
const pkgJsonPath = (0, import_node_path23.resolve)(ctx.project.path, "package.json");
|
|
123265
123351
|
const pkgJson = readJSON(pkgJsonPath);
|
|
123266
123352
|
delete pkgJson.dependencies?.["@react-router/node"];
|
|
123267
123353
|
delete pkgJson.dependencies?.["@react-router/serve"];
|
|
@@ -123634,7 +123720,7 @@ var config38 = {
|
|
|
123634
123720
|
var c3_default43 = config38;
|
|
123635
123721
|
|
|
123636
123722
|
// templates/svelte/pages/c3.ts
|
|
123637
|
-
var
|
|
123723
|
+
var import_node_fs20 = require("node:fs");
|
|
123638
123724
|
var recast10 = __toESM(require_main2());
|
|
123639
123725
|
var { npm: npm18 } = detectPackageManager();
|
|
123640
123726
|
var generate23 = async (ctx) => {
|
|
@@ -123667,7 +123753,7 @@ var updateViteConfig = (ctx) => {
|
|
|
123667
123753
|
};
|
|
123668
123754
|
var updatePlaywrightConfig = (shouldUseTypescript) => {
|
|
123669
123755
|
const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
|
|
123670
|
-
if (!(0,
|
|
123756
|
+
if (!(0, import_node_fs20.existsSync)(filePath)) {
|
|
123671
123757
|
return;
|
|
123672
123758
|
}
|
|
123673
123759
|
updateStatus(`Changing webServer port in ${blue(filePath)}`);
|
|
@@ -124073,7 +124159,7 @@ var config47 = {
|
|
|
124073
124159
|
var c3_default51 = config47;
|
|
124074
124160
|
|
|
124075
124161
|
// templates/waku/c3.ts
|
|
124076
|
-
var
|
|
124162
|
+
var import_node_path24 = require("node:path");
|
|
124077
124163
|
var { npm: npm23 } = detectPackageManager();
|
|
124078
124164
|
var generate30 = async (ctx) => {
|
|
124079
124165
|
await runFrameworkGenerator(ctx, [
|
|
@@ -124097,7 +124183,7 @@ var configure16 = async (ctx) => {
|
|
|
124097
124183
|
);
|
|
124098
124184
|
const s = spinner();
|
|
124099
124185
|
s.start("Removing non-Cloudflare artifacts from template");
|
|
124100
|
-
removeFile((0,
|
|
124186
|
+
removeFile((0, import_node_path24.resolve)(ctx.project.path, "src/middleware/no-trailing-slash.ts"));
|
|
124101
124187
|
s.stop(`${brandColor("removed")} ${dim("trailing-slash dev middleware")}`);
|
|
124102
124188
|
};
|
|
124103
124189
|
var config48 = {
|
|
@@ -124222,7 +124308,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
|
|
|
124222
124308
|
var import_node_assert7 = __toESM(require("node:assert"));
|
|
124223
124309
|
|
|
124224
124310
|
// ../wrangler/package.json
|
|
124225
|
-
var version3 = "4.
|
|
124311
|
+
var version3 = "4.151.2";
|
|
124226
124312
|
|
|
124227
124313
|
// src/git.ts
|
|
124228
124314
|
var offerGit = async (ctx) => {
|
|
@@ -124418,8 +124504,8 @@ async function getProductionBranch(cwd) {
|
|
|
124418
124504
|
}
|
|
124419
124505
|
|
|
124420
124506
|
// src/validators.ts
|
|
124421
|
-
var
|
|
124422
|
-
var
|
|
124507
|
+
var import_node_fs21 = require("node:fs");
|
|
124508
|
+
var import_node_path25 = require("node:path");
|
|
124423
124509
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
124424
124510
|
var validateTemplateUrl = (value) => {
|
|
124425
124511
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -124427,9 +124513,9 @@ var validateTemplateUrl = (value) => {
|
|
|
124427
124513
|
}
|
|
124428
124514
|
};
|
|
124429
124515
|
var validateProjectDirectory = (relativePath, args) => {
|
|
124430
|
-
const path9 = (0,
|
|
124516
|
+
const path9 = (0, import_node_path25.resolve)(relativePath);
|
|
124431
124517
|
if (!args.existingScript) {
|
|
124432
|
-
const projectName = (0,
|
|
124518
|
+
const projectName = (0, import_node_path25.basename)(path9);
|
|
124433
124519
|
const invalidChars = /[^a-z0-9-]/;
|
|
124434
124520
|
const invalidStartEnd = /^-|-$/;
|
|
124435
124521
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -124442,9 +124528,9 @@ var validateProjectDirectory = (relativePath, args) => {
|
|
|
124442
124528
|
return `Project names must be less than 58 characters.`;
|
|
124443
124529
|
}
|
|
124444
124530
|
}
|
|
124445
|
-
const existsAlready = (0,
|
|
124531
|
+
const existsAlready = (0, import_node_fs21.existsSync)(path9);
|
|
124446
124532
|
if (existsAlready) {
|
|
124447
|
-
for (const file3 of (0,
|
|
124533
|
+
for (const file3 of (0, import_node_fs21.readdirSync)(path9)) {
|
|
124448
124534
|
if (!isAllowedExistingFile(file3)) {
|
|
124449
124535
|
return `Directory \`${relativePath}\` already exists and contains files that might conflict. Please choose a new name.`;
|
|
124450
124536
|
}
|
|
@@ -124917,7 +125003,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
124917
125003
|
envInterfaceName: "Env",
|
|
124918
125004
|
...template
|
|
124919
125005
|
};
|
|
124920
|
-
const path9 = (0,
|
|
125006
|
+
const path9 = (0, import_node_path26.resolve)(projectName);
|
|
124921
125007
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
124922
125008
|
if (languageVariants.length > 0) {
|
|
124923
125009
|
if (hasTsConfig(path9)) {
|
|
@@ -124943,8 +125029,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
124943
125029
|
}
|
|
124944
125030
|
}
|
|
124945
125031
|
}
|
|
124946
|
-
const name3 = (0,
|
|
124947
|
-
const directory = (0,
|
|
125032
|
+
const name3 = (0, import_node_path26.basename)(path9);
|
|
125033
|
+
const directory = (0, import_node_path26.dirname)(path9);
|
|
124948
125034
|
const originalCWD = process.cwd();
|
|
124949
125035
|
return {
|
|
124950
125036
|
project: { name: name3, path: path9 },
|
|
@@ -124964,7 +125050,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
124964
125050
|
const { copyFiles } = ctx.template;
|
|
124965
125051
|
let srcdir;
|
|
124966
125052
|
if (isVariantInfo(copyFiles)) {
|
|
124967
|
-
srcdir = (0,
|
|
125053
|
+
srcdir = (0, import_node_path26.join)(getTemplatePath(ctx), copyFiles.path);
|
|
124968
125054
|
} else {
|
|
124969
125055
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
124970
125056
|
const variant = await selectVariant(ctx);
|
|
@@ -124974,22 +125060,22 @@ async function copyTemplateFiles(ctx) {
|
|
|
124974
125060
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
124975
125061
|
);
|
|
124976
125062
|
}
|
|
124977
|
-
srcdir = (0,
|
|
125063
|
+
srcdir = (0, import_node_path26.join)(getTemplatePath(ctx), variantInfo.path);
|
|
124978
125064
|
}
|
|
124979
125065
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
124980
|
-
const destdir = (0,
|
|
125066
|
+
const destdir = (0, import_node_path26.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
124981
125067
|
const s = spinner();
|
|
124982
125068
|
s.start(`Copying template files`);
|
|
124983
125069
|
await (0, import_promises9.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
124984
|
-
const dummyGitIgnorePath = (0,
|
|
124985
|
-
if ((0,
|
|
124986
|
-
await (0, import_promises9.rename)(dummyGitIgnorePath, (0,
|
|
125070
|
+
const dummyGitIgnorePath = (0, import_node_path26.join)(destdir, "__dot__gitignore");
|
|
125071
|
+
if ((0, import_node_fs22.existsSync)(dummyGitIgnorePath)) {
|
|
125072
|
+
await (0, import_promises9.rename)(dummyGitIgnorePath, (0, import_node_path26.join)(destdir, ".gitignore"));
|
|
124987
125073
|
}
|
|
124988
125074
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
124989
125075
|
}
|
|
124990
125076
|
function writeAgentsMd(projectPath) {
|
|
124991
|
-
const agentsMdPath = (0,
|
|
124992
|
-
if ((0,
|
|
125077
|
+
const agentsMdPath = (0, import_node_path26.join)(projectPath, "AGENTS.md");
|
|
125078
|
+
if ((0, import_node_fs22.existsSync)(agentsMdPath)) {
|
|
124993
125079
|
return;
|
|
124994
125080
|
}
|
|
124995
125081
|
writeFile4(agentsMdPath, getAgentsMd());
|
|
@@ -125018,26 +125104,26 @@ var validateTemplate = (path9, config50) => {
|
|
|
125018
125104
|
return;
|
|
125019
125105
|
}
|
|
125020
125106
|
if (isVariantInfo(config50.copyFiles)) {
|
|
125021
|
-
validateTemplateSrcDirectory((0,
|
|
125107
|
+
validateTemplateSrcDirectory((0, import_node_path26.resolve)(path9, config50.copyFiles.path), config50);
|
|
125022
125108
|
} else {
|
|
125023
125109
|
for (const variant of Object.values(config50.copyFiles.variants)) {
|
|
125024
|
-
validateTemplateSrcDirectory((0,
|
|
125110
|
+
validateTemplateSrcDirectory((0, import_node_path26.resolve)(path9, variant.path), config50);
|
|
125025
125111
|
}
|
|
125026
125112
|
}
|
|
125027
125113
|
};
|
|
125028
125114
|
var validateTemplateSrcDirectory = (path9, config50) => {
|
|
125029
125115
|
if (config50.platform === "workers") {
|
|
125030
|
-
const wranglerTomlPath = (0,
|
|
125031
|
-
const wranglerJsonPath = (0,
|
|
125032
|
-
const wranglerJsoncPath = (0,
|
|
125033
|
-
if (!(0,
|
|
125116
|
+
const wranglerTomlPath = (0, import_node_path26.resolve)(path9, "wrangler.toml");
|
|
125117
|
+
const wranglerJsonPath = (0, import_node_path26.resolve)(path9, "wrangler.json");
|
|
125118
|
+
const wranglerJsoncPath = (0, import_node_path26.resolve)(path9, "wrangler.jsonc");
|
|
125119
|
+
if (!(0, import_node_fs22.existsSync)(wranglerTomlPath) && !(0, import_node_fs22.existsSync)(wranglerJsonPath) && !(0, import_node_fs22.existsSync)(wranglerJsoncPath)) {
|
|
125034
125120
|
throw new Error(
|
|
125035
125121
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
125036
125122
|
);
|
|
125037
125123
|
}
|
|
125038
125124
|
}
|
|
125039
|
-
const pkgJsonPath = (0,
|
|
125040
|
-
if (!(0,
|
|
125125
|
+
const pkgJsonPath = (0, import_node_path26.resolve)(path9, "package.json");
|
|
125126
|
+
if (!(0, import_node_fs22.existsSync)(pkgJsonPath)) {
|
|
125041
125127
|
throw new Error(
|
|
125042
125128
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
125043
125129
|
);
|
|
@@ -125054,10 +125140,10 @@ var inferTemplateConfig = (path9) => {
|
|
|
125054
125140
|
};
|
|
125055
125141
|
var inferCopyFilesDefinition = (path9) => {
|
|
125056
125142
|
const variants = {};
|
|
125057
|
-
if ((0,
|
|
125143
|
+
if ((0, import_node_fs22.existsSync)((0, import_node_path26.join)(path9, "js"))) {
|
|
125058
125144
|
variants["js"] = { path: "./js" };
|
|
125059
125145
|
}
|
|
125060
|
-
if ((0,
|
|
125146
|
+
if ((0, import_node_fs22.existsSync)((0, import_node_path26.join)(path9, "ts"))) {
|
|
125061
125147
|
variants["ts"] = { path: "./ts" };
|
|
125062
125148
|
}
|
|
125063
125149
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -125092,7 +125178,7 @@ Use the format "github:<owner>/<repo>/sub/directory[#<branch>]" to clone a speci
|
|
|
125092
125178
|
force: true,
|
|
125093
125179
|
mode: options.mode
|
|
125094
125180
|
});
|
|
125095
|
-
const tmpDir = options.intoFolder ?? await (0, import_promises9.mkdtemp)((0,
|
|
125181
|
+
const tmpDir = options.intoFolder ?? await (0, import_promises9.mkdtemp)((0, import_node_path26.join)((0, import_node_os8.tmpdir)(), "c3-template"));
|
|
125096
125182
|
await emitter.clone(tmpDir);
|
|
125097
125183
|
return tmpDir;
|
|
125098
125184
|
} catch {
|
|
@@ -125101,8 +125187,8 @@ Use the format "github:<owner>/<repo>/sub/directory[#<branch>]" to clone a speci
|
|
|
125101
125187
|
}
|
|
125102
125188
|
}
|
|
125103
125189
|
function updatePythonPackageName(path9, projectName) {
|
|
125104
|
-
const pyProjectFile = (0,
|
|
125105
|
-
if (!(0,
|
|
125190
|
+
const pyProjectFile = (0, import_node_path26.resolve)(path9, "pyproject.toml");
|
|
125191
|
+
if (!(0, import_node_fs22.existsSync)(pyProjectFile)) {
|
|
125106
125192
|
return;
|
|
125107
125193
|
}
|
|
125108
125194
|
const s = spinner();
|
|
@@ -125114,7 +125200,7 @@ function updatePythonPackageName(path9, projectName) {
|
|
|
125114
125200
|
}
|
|
125115
125201
|
var updatePackageName = (ctx) => {
|
|
125116
125202
|
const placeholderNames = ["<PACKAGE_NAME>", "<TBD>", "TBD", ""];
|
|
125117
|
-
const pkgJsonPath = (0,
|
|
125203
|
+
const pkgJsonPath = (0, import_node_path26.resolve)(ctx.project.path, "package.json");
|
|
125118
125204
|
const pkgJson = readJSON(pkgJsonPath);
|
|
125119
125205
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
125120
125206
|
return;
|
|
@@ -125132,7 +125218,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
125132
125218
|
}
|
|
125133
125219
|
const s = spinner();
|
|
125134
125220
|
s.start("Updating `package.json` scripts");
|
|
125135
|
-
const pkgJsonPath = (0,
|
|
125221
|
+
const pkgJsonPath = (0, import_node_path26.resolve)(ctx.project.path, "package.json");
|
|
125136
125222
|
let pkgJson = readJSON(pkgJsonPath);
|
|
125137
125223
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
125138
125224
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -125141,9 +125227,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
125141
125227
|
};
|
|
125142
125228
|
var getTemplatePath = (ctx) => {
|
|
125143
125229
|
if (ctx.template.path) {
|
|
125144
|
-
return (0,
|
|
125230
|
+
return (0, import_node_path26.resolve)(__dirname, "..", ctx.template.path);
|
|
125145
125231
|
}
|
|
125146
|
-
return (0,
|
|
125232
|
+
return (0, import_node_path26.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
125147
125233
|
};
|
|
125148
125234
|
var isVariantInfo = (copyFiles) => {
|
|
125149
125235
|
return "path" in copyFiles;
|
|
@@ -125526,7 +125612,7 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
125526
125612
|
// src/deploy.ts
|
|
125527
125613
|
var import_promises11 = require("node:fs/promises");
|
|
125528
125614
|
var import_node_os9 = require("node:os");
|
|
125529
|
-
var
|
|
125615
|
+
var import_node_path29 = require("node:path");
|
|
125530
125616
|
|
|
125531
125617
|
// src/helpers/poll.ts
|
|
125532
125618
|
var import_promises10 = require("node:timers/promises");
|
|
@@ -125617,9 +125703,51 @@ function secondsSince(start) {
|
|
|
125617
125703
|
return Math.round((Date.now() - start) / 1e3);
|
|
125618
125704
|
}
|
|
125619
125705
|
|
|
125706
|
+
// src/cf/deploy.ts
|
|
125707
|
+
var import_node_path27 = require("node:path");
|
|
125708
|
+
var DEFAULT_WORKER_CONFIG_PATH = ".cloudflare/output/v0/workers/default/worker.config.json";
|
|
125709
|
+
async function getDeploymentUrl(projectPath, accountId) {
|
|
125710
|
+
let name3;
|
|
125711
|
+
try {
|
|
125712
|
+
({ name: name3 } = readJSON((0, import_node_path27.join)(projectPath, DEFAULT_WORKER_CONFIG_PATH)));
|
|
125713
|
+
} catch {
|
|
125714
|
+
throw new Error(
|
|
125715
|
+
`Failed to find deployment url: could not read the Worker's name from \`${DEFAULT_WORKER_CONFIG_PATH}\`.`
|
|
125716
|
+
);
|
|
125717
|
+
}
|
|
125718
|
+
const { npx: npx6 } = detectPackageManager();
|
|
125719
|
+
let worker;
|
|
125720
|
+
try {
|
|
125721
|
+
const output2 = await runWranglerCommand(
|
|
125722
|
+
[npx6, "cf", "workers", "get", name3],
|
|
125723
|
+
{
|
|
125724
|
+
silent: true,
|
|
125725
|
+
env: { CLOUDFLARE_ACCOUNT_ID: accountId }
|
|
125726
|
+
}
|
|
125727
|
+
);
|
|
125728
|
+
worker = JSON.parse(
|
|
125729
|
+
output2.slice(output2.indexOf("{"), output2.lastIndexOf("}") + 1)
|
|
125730
|
+
);
|
|
125731
|
+
} catch (e) {
|
|
125732
|
+
if (e instanceof CancelError) {
|
|
125733
|
+
throw e;
|
|
125734
|
+
}
|
|
125735
|
+
throw new Error(
|
|
125736
|
+
`Failed to find deployment url: \`cf workers get ${name3}\` failed.
|
|
125737
|
+
${e instanceof Error ? e.message : String(e)}`
|
|
125738
|
+
);
|
|
125739
|
+
}
|
|
125740
|
+
if (!worker.subdomain?.enabled || !worker.subdomain.url) {
|
|
125741
|
+
throw new Error(
|
|
125742
|
+
`Failed to find deployment url: the \`${name3}\` Worker is not available on workers.dev.`
|
|
125743
|
+
);
|
|
125744
|
+
}
|
|
125745
|
+
return worker.subdomain.url;
|
|
125746
|
+
}
|
|
125747
|
+
|
|
125620
125748
|
// src/wrangler/config.ts
|
|
125621
|
-
var
|
|
125622
|
-
var
|
|
125749
|
+
var import_node_fs23 = require("node:fs");
|
|
125750
|
+
var import_node_path28 = require("node:path");
|
|
125623
125751
|
|
|
125624
125752
|
// src/helpers/json.ts
|
|
125625
125753
|
var import_comment_json2 = __toESM(require_src3());
|
|
@@ -125731,22 +125859,22 @@ ${generateHintsAsTomlComments(wranglerToml)}
|
|
|
125731
125859
|
}
|
|
125732
125860
|
};
|
|
125733
125861
|
var getWranglerTomlPath = (ctx) => {
|
|
125734
|
-
return (0,
|
|
125862
|
+
return (0, import_node_path28.resolve)(ctx.project.path, "wrangler.toml");
|
|
125735
125863
|
};
|
|
125736
125864
|
var getWranglerJsonPath = (ctx) => {
|
|
125737
|
-
return (0,
|
|
125865
|
+
return (0, import_node_path28.resolve)(ctx.project.path, "wrangler.json");
|
|
125738
125866
|
};
|
|
125739
125867
|
var getWranglerJsoncPath = (ctx) => {
|
|
125740
|
-
return (0,
|
|
125868
|
+
return (0, import_node_path28.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
125741
125869
|
};
|
|
125742
125870
|
var wranglerTomlExists = (ctx) => {
|
|
125743
125871
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
125744
|
-
return (0,
|
|
125872
|
+
return (0, import_node_fs23.existsSync)(wranglerTomlPath);
|
|
125745
125873
|
};
|
|
125746
125874
|
var wranglerJsonOrJsoncExists = (ctx) => {
|
|
125747
125875
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
125748
125876
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
125749
|
-
return (0,
|
|
125877
|
+
return (0, import_node_fs23.existsSync)(wranglerJsonPath) || (0, import_node_fs23.existsSync)(wranglerJsoncPath);
|
|
125750
125878
|
};
|
|
125751
125879
|
var readWranglerToml = (ctx) => {
|
|
125752
125880
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -125754,7 +125882,7 @@ var readWranglerToml = (ctx) => {
|
|
|
125754
125882
|
};
|
|
125755
125883
|
var readWranglerJsonOrJsonc = (ctx, reviver) => {
|
|
125756
125884
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
125757
|
-
if ((0,
|
|
125885
|
+
if ((0, import_node_fs23.existsSync)(wranglerJsonPath)) {
|
|
125758
125886
|
return readJSONWithComments(wranglerJsonPath, reviver);
|
|
125759
125887
|
}
|
|
125760
125888
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -125766,7 +125894,7 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
125766
125894
|
};
|
|
125767
125895
|
var writeWranglerJsonOrJsonc = (ctx, config50) => {
|
|
125768
125896
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
125769
|
-
if ((0,
|
|
125897
|
+
if ((0, import_node_fs23.existsSync)(wranglerJsonPath)) {
|
|
125770
125898
|
return writeJSONWithComments(wranglerJsonPath, config50);
|
|
125771
125899
|
}
|
|
125772
125900
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -125774,10 +125902,10 @@ var writeWranglerJsonOrJsonc = (ctx, config50) => {
|
|
|
125774
125902
|
};
|
|
125775
125903
|
var addVscodeConfig = (ctx) => {
|
|
125776
125904
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
125777
|
-
if ((0,
|
|
125905
|
+
if ((0, import_node_fs23.existsSync)(settingsPath)) {
|
|
125778
125906
|
return;
|
|
125779
125907
|
}
|
|
125780
|
-
(0,
|
|
125908
|
+
(0, import_node_fs23.mkdirSync)(`${ctx.project.path}/.vscode`, { recursive: true });
|
|
125781
125909
|
writeJSON(settingsPath, {
|
|
125782
125910
|
"files.associations": {
|
|
125783
125911
|
"wrangler.json": "jsonc"
|
|
@@ -125926,7 +126054,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
125926
126054
|
return false;
|
|
125927
126055
|
}
|
|
125928
126056
|
ctx.deployment = {};
|
|
125929
|
-
const loginSuccess = await
|
|
126057
|
+
const loginSuccess = await login2(ctx);
|
|
125930
126058
|
if (!loginSuccess) {
|
|
125931
126059
|
return false;
|
|
125932
126060
|
}
|
|
@@ -125934,7 +126062,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
125934
126062
|
return true;
|
|
125935
126063
|
};
|
|
125936
126064
|
var isDeployable = async (ctx) => {
|
|
125937
|
-
if (ctx.template.platform === "pages") {
|
|
126065
|
+
if (ctx.template.platform === "pages" || usesCfCli(ctx.project.path)) {
|
|
125938
126066
|
return true;
|
|
125939
126067
|
}
|
|
125940
126068
|
const wranglerConfig = readWranglerConfig(ctx);
|
|
@@ -125963,10 +126091,8 @@ var runDeploy = async (ctx) => {
|
|
|
125963
126091
|
JSON.stringify(ctx.commitMessage)
|
|
125964
126092
|
] : []
|
|
125965
126093
|
];
|
|
125966
|
-
const
|
|
125967
|
-
|
|
125968
|
-
"output.json"
|
|
125969
|
-
);
|
|
126094
|
+
const useCf = usesCfCli(ctx.project.path);
|
|
126095
|
+
const outputFile = useCf ? void 0 : (0, import_node_path29.join)(await (0, import_promises11.mkdtemp)((0, import_node_path29.join)((0, import_node_os9.tmpdir)(), "c3-wrangler-deploy-")), "output.json");
|
|
125970
126096
|
await runCommand(deployCmd, {
|
|
125971
126097
|
cwd: ctx.project.path,
|
|
125972
126098
|
env: {
|
|
@@ -125979,26 +126105,27 @@ var runDeploy = async (ctx) => {
|
|
|
125979
126105
|
`via \`${quoteShellArgs(baseDeployCmd)}\``
|
|
125980
126106
|
)}`
|
|
125981
126107
|
});
|
|
125982
|
-
|
|
125983
|
-
|
|
125984
|
-
|
|
125985
|
-
|
|
125986
|
-
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
|
|
125987
|
-
const deployedUrlMatch = url2?.match(deployedUrlRegex);
|
|
125988
|
-
if (deployedUrlMatch) {
|
|
125989
|
-
ctx.deployment.url = deployedUrlMatch[0];
|
|
125990
|
-
} else {
|
|
125991
|
-
throw new Error("Failed to find deployment url.");
|
|
125992
|
-
}
|
|
125993
|
-
} catch {
|
|
126108
|
+
const url2 = outputFile ? readDeploymentUrl(outputFile) : await getDeploymentUrl(ctx.project.path, ctx.account.id);
|
|
126109
|
+
const deployedUrlRegex = /https:\/\/.+\.(pages|workers)\.dev/;
|
|
126110
|
+
const deployedUrlMatch = url2?.match(deployedUrlRegex);
|
|
126111
|
+
if (!deployedUrlMatch) {
|
|
125994
126112
|
throw new Error("Failed to find deployment url.");
|
|
125995
126113
|
}
|
|
126114
|
+
ctx.deployment.url = deployedUrlMatch[0];
|
|
125996
126115
|
if (ctx.deployment.url?.endsWith(".pages.dev")) {
|
|
125997
126116
|
const [proto2, hostname3] = ctx.deployment.url.split("://");
|
|
125998
126117
|
const hostnameWithoutSHA1 = hostname3.split(".").slice(-3).join(".");
|
|
125999
126118
|
ctx.deployment.url = `${proto2}://${hostnameWithoutSHA1}`;
|
|
126000
126119
|
}
|
|
126001
126120
|
};
|
|
126121
|
+
function readDeploymentUrl(outputFile) {
|
|
126122
|
+
try {
|
|
126123
|
+
const entries = readFile2(outputFile).split("\n").filter(Boolean).map((entry) => JSON.parse(entry));
|
|
126124
|
+
return entries.find((entry) => entry.type === "deploy")?.targets?.[0] ?? entries.find((entry) => entry.type === "pages-deploy")?.url;
|
|
126125
|
+
} catch {
|
|
126126
|
+
return void 0;
|
|
126127
|
+
}
|
|
126128
|
+
}
|
|
126002
126129
|
var maybeOpenBrowser = async (ctx) => {
|
|
126003
126130
|
if (ctx.deployment.url) {
|
|
126004
126131
|
const success2 = await poll(ctx.deployment.url);
|
|
@@ -126026,7 +126153,7 @@ var hasBinding = (node2) => {
|
|
|
126026
126153
|
};
|
|
126027
126154
|
|
|
126028
126155
|
// src/dialog.ts
|
|
126029
|
-
var
|
|
126156
|
+
var import_node_path30 = require("node:path");
|
|
126030
126157
|
function createDialog(lines) {
|
|
126031
126158
|
const screenWidth = process.stdout.columns;
|
|
126032
126159
|
const maxLineWidth = Math.max(
|
|
@@ -126066,7 +126193,7 @@ function printWelcomeMessage(version4, telemetryEnabled, args) {
|
|
|
126066
126193
|
}
|
|
126067
126194
|
var printSummary = (ctx) => {
|
|
126068
126195
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}/production` : null;
|
|
126069
|
-
const relativePath = (0,
|
|
126196
|
+
const relativePath = (0, import_node_path30.relative)(ctx.originalCWD, ctx.project.path);
|
|
126070
126197
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
126071
126198
|
const { npm: npm25 } = detectPackageManager();
|
|
126072
126199
|
const deployCommand = quoteShellArgs([
|
|
@@ -126536,9 +126663,26 @@ var createProject = async (ctx) => {
|
|
|
126536
126663
|
}
|
|
126537
126664
|
};
|
|
126538
126665
|
|
|
126666
|
+
// src/project-directory.ts
|
|
126667
|
+
var import_node_fs24 = require("node:fs");
|
|
126668
|
+
var import_node_path31 = require("node:path");
|
|
126669
|
+
var import_node_process15 = require("node:process");
|
|
126670
|
+
var setupProjectDirectory = (ctx) => {
|
|
126671
|
+
const path9 = ctx.project.path;
|
|
126672
|
+
const err = validateProjectDirectory(path9, ctx.args);
|
|
126673
|
+
if (err) {
|
|
126674
|
+
throw new Error(err);
|
|
126675
|
+
}
|
|
126676
|
+
const directory = (0, import_node_path31.dirname)(path9);
|
|
126677
|
+
if (!(0, import_node_fs24.existsSync)(directory)) {
|
|
126678
|
+
(0, import_node_fs24.mkdirSync)(directory, { recursive: true });
|
|
126679
|
+
}
|
|
126680
|
+
(0, import_node_process15.chdir)(directory);
|
|
126681
|
+
};
|
|
126682
|
+
|
|
126539
126683
|
// src/workers.ts
|
|
126540
|
-
var
|
|
126541
|
-
var
|
|
126684
|
+
var import_node_fs25 = require("node:fs");
|
|
126685
|
+
var import_node_path32 = require("node:path");
|
|
126542
126686
|
|
|
126543
126687
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
126544
126688
|
function createScanner2(text, ignoreTrivia = false) {
|
|
@@ -127867,9 +128011,12 @@ async function addTypes(ctx) {
|
|
|
127867
128011
|
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm25);
|
|
127868
128012
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
127869
128013
|
}
|
|
128014
|
+
function getTypesPath(ctx) {
|
|
128015
|
+
return usesCfCli(ctx.project.path) ? CF_TYPES_PATH : ctx.template.typesPath ?? "./worker-configuration.d.ts";
|
|
128016
|
+
}
|
|
127870
128017
|
async function generateWorkersTypes(ctx, npm25) {
|
|
127871
|
-
const packageJsonPath = (0,
|
|
127872
|
-
if (!(0,
|
|
128018
|
+
const packageJsonPath = (0, import_node_path32.join)(ctx.project.path, "package.json");
|
|
128019
|
+
if (!(0, import_node_fs25.existsSync)(packageJsonPath)) {
|
|
127873
128020
|
return;
|
|
127874
128021
|
}
|
|
127875
128022
|
const packageManifest = readJSON(packageJsonPath);
|
|
@@ -127881,7 +128028,7 @@ async function generateWorkersTypes(ctx, npm25) {
|
|
|
127881
128028
|
cwd: ctx.project.path,
|
|
127882
128029
|
silent: true,
|
|
127883
128030
|
startText: "Generating types for your application",
|
|
127884
|
-
doneText: `${brandColor("generated")} ${dim(`to \`${ctx
|
|
128031
|
+
doneText: `${brandColor("generated")} ${dim(`to \`${getTypesPath(ctx)}\` via \`${typesCmd.join(" ")}\``)}`
|
|
127885
128032
|
});
|
|
127886
128033
|
if (packageManifest["devDependencies"]?.["@cloudflare/workers-types"]) {
|
|
127887
128034
|
delete packageManifest["devDependencies"]?.["@cloudflare/workers-types"];
|
|
@@ -127912,8 +128059,8 @@ var maybeInstallNodeTypes = async (ctx, npm25) => {
|
|
|
127912
128059
|
return false;
|
|
127913
128060
|
};
|
|
127914
128061
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
127915
|
-
const tsconfigPath = (0,
|
|
127916
|
-
if (!(0,
|
|
128062
|
+
const tsconfigPath = (0, import_node_path32.join)(ctx.project.path, "tsconfig.json");
|
|
128063
|
+
if (!(0, import_node_fs25.existsSync)(tsconfigPath)) {
|
|
127917
128064
|
return;
|
|
127918
128065
|
}
|
|
127919
128066
|
const tsconfig = readFile2(tsconfigPath);
|
|
@@ -127936,8 +128083,8 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
127936
128083
|
newTypes.delete("@cloudflare/workers-types");
|
|
127937
128084
|
if (entrypointVersion !== null) {
|
|
127938
128085
|
newTypes.add(`@cloudflare/workers-types/${entrypointVersion}`);
|
|
127939
|
-
} else if ((0,
|
|
127940
|
-
(0,
|
|
128086
|
+
} else if ((0, import_node_fs25.existsSync)(
|
|
128087
|
+
(0, import_node_path32.join)(
|
|
127941
128088
|
ctx.project.path,
|
|
127942
128089
|
"node_modules",
|
|
127943
128090
|
"@cloudflare",
|
|
@@ -127948,10 +128095,10 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
127948
128095
|
}
|
|
127949
128096
|
}
|
|
127950
128097
|
} else if (ctx.template.workersTypes === "generated") {
|
|
127951
|
-
|
|
127952
|
-
|
|
127953
|
-
|
|
127954
|
-
).split("\n");
|
|
128098
|
+
if (!usesCfCli(ctx.project.path)) {
|
|
128099
|
+
newTypes.add(getTypesPath(ctx));
|
|
128100
|
+
}
|
|
128101
|
+
const typegen = readFile2(getTypesPath(ctx)).split("\n");
|
|
127955
128102
|
if (typegen.some(
|
|
127956
128103
|
(line) => line.includes("// Runtime types generated with workerd")
|
|
127957
128104
|
)) {
|
|
@@ -127965,6 +128112,9 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
127965
128112
|
if (usesNodeCompat) {
|
|
127966
128113
|
newTypes.add("node");
|
|
127967
128114
|
}
|
|
128115
|
+
if (newTypes.size === 0 && config50.compilerOptions?.types === void 0) {
|
|
128116
|
+
return;
|
|
128117
|
+
}
|
|
127968
128118
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
127969
128119
|
const edits = modify2(
|
|
127970
128120
|
tsconfig,
|
|
@@ -128044,16 +128194,6 @@ var runCli = async (args) => {
|
|
|
128044
128194
|
printSummary(ctx);
|
|
128045
128195
|
logRaw("");
|
|
128046
128196
|
};
|
|
128047
|
-
var setupProjectDirectory = (ctx) => {
|
|
128048
|
-
const path9 = ctx.project.path;
|
|
128049
|
-
const err = validateProjectDirectory(path9, ctx.args);
|
|
128050
|
-
if (err) {
|
|
128051
|
-
throw new Error(err);
|
|
128052
|
-
}
|
|
128053
|
-
const directory = (0, import_node_path28.dirname)(path9);
|
|
128054
|
-
(0, import_node_fs24.mkdirSync)(directory, { recursive: true });
|
|
128055
|
-
(0, import_node_process15.chdir)(directory);
|
|
128056
|
-
};
|
|
128057
128197
|
var create = async (ctx) => {
|
|
128058
128198
|
const { template } = ctx;
|
|
128059
128199
|
setupProjectDirectory(ctx);
|
|
@@ -128065,7 +128205,7 @@ var create = async (ctx) => {
|
|
|
128065
128205
|
}
|
|
128066
128206
|
updatePackageName(ctx);
|
|
128067
128207
|
writePnpmBuildApprovals(ctx.project.path);
|
|
128068
|
-
(0,
|
|
128208
|
+
(0, import_node_process16.chdir)(ctx.project.path);
|
|
128069
128209
|
await npmInstall(ctx);
|
|
128070
128210
|
await rectifyPmMismatch(ctx);
|
|
128071
128211
|
if (ctx.template.platform === "workers" && !ctx.template.frameworkCli) {
|
|
@@ -128078,7 +128218,11 @@ var configure17 = async (ctx) => {
|
|
|
128078
128218
|
`Configuring your application for Cloudflare${ctx.args.experimental ? ` via \`wrangler setup\`` : ""}`,
|
|
128079
128219
|
"Step 2 of 3"
|
|
128080
128220
|
);
|
|
128081
|
-
|
|
128221
|
+
if (usesCfCli(ctx.project.path)) {
|
|
128222
|
+
await installCf();
|
|
128223
|
+
} else {
|
|
128224
|
+
await installWrangler2();
|
|
128225
|
+
}
|
|
128082
128226
|
if (ctx.args.experimental) {
|
|
128083
128227
|
const { npx: npx6 } = detectPackageManager();
|
|
128084
128228
|
await runWranglerCommand([
|
|
@@ -128147,8 +128291,7 @@ ${getPnpmIgnoredBuildsGuidance(e.packages)}`);
|
|
|
128147
128291
|
// Annotate the CommonJS export names for ESM import in node:
|
|
128148
128292
|
0 && (module.exports = {
|
|
128149
128293
|
main,
|
|
128150
|
-
runCli
|
|
128151
|
-
setupProjectDirectory
|
|
128294
|
+
runCli
|
|
128152
128295
|
});
|
|
128153
128296
|
/*! Bundled license information:
|
|
128154
128297
|
|