create-cloudflare 2.58.0 → 2.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +360 -396
- package/package.json +6 -6
- package/templates/analog/c3.ts +39 -61
- package/templates/analog/templates/wrangler.jsonc +10 -3
- package/templates/angular/pages/templates/wrangler.jsonc +2 -2
- package/templates/angular/workers/templates/wrangler.jsonc +2 -2
- package/templates/astro/pages/templates/js/wrangler.jsonc +2 -2
- package/templates/astro/pages/templates/ts/wrangler.jsonc +2 -2
- package/templates/astro/workers/templates/js/wrangler.jsonc +2 -2
- package/templates/astro/workers/templates/ts/wrangler.jsonc +2 -2
- package/templates/common/js/package.json +1 -1
- package/templates/common/js/wrangler.jsonc +2 -2
- package/templates/common/ts/package.json +1 -1
- package/templates/common/ts/wrangler.jsonc +2 -2
- package/templates/docusaurus/workers/templates/wrangler.jsonc +2 -2
- package/templates/gatsby/workers/templates/wrangler.jsonc +2 -2
- package/templates/hello-world/c3.ts +0 -12
- package/templates/hello-world/js/package.json +1 -1
- package/templates/hello-world/js/wrangler.jsonc +2 -2
- package/templates/hello-world/py/package.json +1 -1
- package/templates/hello-world/py/pyproject.toml +1 -1
- package/templates/hello-world/py/wrangler.jsonc +2 -2
- package/templates/hello-world/ts/package.json +1 -1
- package/templates/hello-world/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-assets-only/templates/package.json +1 -1
- package/templates/hello-world-assets-only/templates/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/js/package.json +1 -1
- package/templates/hello-world-durable-object/js/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/py/package.json +1 -1
- package/templates/hello-world-durable-object/py/pyproject.toml +1 -1
- package/templates/hello-world-durable-object/py/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object/ts/package.json +1 -1
- package/templates/hello-world-durable-object/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/js/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/py/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/py/pyproject.toml +1 -1
- package/templates/hello-world-durable-object-with-assets/py/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/ts/package.json +1 -1
- package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/js/package.json +1 -1
- package/templates/hello-world-with-assets/js/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/py/package.json +1 -1
- package/templates/hello-world-with-assets/py/pyproject.toml +1 -1
- package/templates/hello-world-with-assets/py/wrangler.jsonc +2 -2
- package/templates/hello-world-with-assets/ts/package.json +1 -1
- package/templates/hello-world-with-assets/ts/wrangler.jsonc +2 -2
- package/templates/hello-world-workflows/js/package.json +1 -1
- package/templates/hello-world-workflows/js/wrangler.jsonc +2 -2
- package/templates/hello-world-workflows/ts/package.json +1 -1
- package/templates/hello-world-workflows/ts/wrangler.jsonc +2 -2
- package/templates/hono/pages/templates/wrangler.jsonc +2 -2
- package/templates/hono/workers/templates/wrangler.jsonc +2 -2
- package/templates/next/c3.ts +9 -22
- package/templates/nuxt/pages/templates/wrangler.jsonc +2 -2
- package/templates/nuxt/workers/templates/wrangler.jsonc +2 -2
- package/templates/openapi/ts/wrangler.jsonc +2 -2
- package/templates/pre-existing/js/package.json +1 -1
- package/templates/queues/js/package.json +1 -1
- package/templates/queues/js/wrangler.jsonc +2 -2
- package/templates/queues/ts/package.json +1 -1
- package/templates/queues/ts/wrangler.jsonc +2 -2
- package/templates/qwik/pages/templates/wrangler.jsonc +2 -2
- package/templates/qwik/workers/templates/wrangler.jsonc +2 -2
- package/templates/react/pages/templates/wrangler.jsonc +2 -2
- package/templates/react/workers/js/wrangler.jsonc +2 -2
- package/templates/react/workers/ts/wrangler.jsonc +2 -2
- package/templates/scheduled/js/package.json +1 -1
- package/templates/scheduled/js/wrangler.jsonc +2 -2
- package/templates/scheduled/ts/package.json +2 -2
- package/templates/scheduled/ts/wrangler.jsonc +2 -2
- package/templates/solid/templates/wrangler.jsonc +2 -2
- package/templates/svelte/pages/templates/wrangler.jsonc +2 -2
- package/templates/svelte/workers/templates/wrangler.jsonc +2 -2
- package/templates/vue/pages/templates/wrangler.jsonc +2 -2
- package/templates/vue/workers/js/wrangler.jsonc +2 -2
- package/templates/vue/workers/ts/wrangler.jsonc +2 -2
- package/templates/waku/wrangler.jsonc +2 -2
- package/templates/analog/snippets/devBindingsModule.ts +0 -7
- package/templates/analog/templates/env.d.ts +0 -13
- package/templates/analog/templates/src/dev-bindings.ts +0 -18
- package/templates/next/templates/.dev.vars +0 -2
- package/templates/next/templates/__dot__gitignore +0 -39
- package/templates/next/templates/open-next.config.ts +0 -9
- package/templates/next/templates/public/_headers +0 -3
- package/templates/next/templates/wrangler.jsonc +0 -13
package/dist/cli.js
CHANGED
|
@@ -2975,12 +2975,12 @@ var require_isexe = __commonJS({
|
|
|
2975
2975
|
if (typeof Promise !== "function") {
|
|
2976
2976
|
throw new TypeError("callback not provided");
|
|
2977
2977
|
}
|
|
2978
|
-
return new Promise(function(
|
|
2978
|
+
return new Promise(function(resolve11, reject) {
|
|
2979
2979
|
isexe(path6, options || {}, function(er, is) {
|
|
2980
2980
|
if (er) {
|
|
2981
2981
|
reject(er);
|
|
2982
2982
|
} else {
|
|
2983
|
-
|
|
2983
|
+
resolve11(is);
|
|
2984
2984
|
}
|
|
2985
2985
|
});
|
|
2986
2986
|
});
|
|
@@ -3046,27 +3046,27 @@ var require_which = __commonJS({
|
|
|
3046
3046
|
opt = {};
|
|
3047
3047
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
3048
3048
|
const found = [];
|
|
3049
|
-
const step = (i) => new Promise((
|
|
3049
|
+
const step = (i) => new Promise((resolve11, reject) => {
|
|
3050
3050
|
if (i === pathEnv.length)
|
|
3051
|
-
return opt.all && found.length ?
|
|
3051
|
+
return opt.all && found.length ? resolve11(found) : reject(getNotFoundError(cmd));
|
|
3052
3052
|
const ppRaw = pathEnv[i];
|
|
3053
3053
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
3054
3054
|
const pCmd = path6.join(pathPart, cmd);
|
|
3055
3055
|
const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
3056
|
-
|
|
3056
|
+
resolve11(subStep(p2, i, 0));
|
|
3057
3057
|
});
|
|
3058
|
-
const subStep = (p2, i, ii) => new Promise((
|
|
3058
|
+
const subStep = (p2, i, ii) => new Promise((resolve11, reject) => {
|
|
3059
3059
|
if (ii === pathExt.length)
|
|
3060
|
-
return
|
|
3060
|
+
return resolve11(step(i + 1));
|
|
3061
3061
|
const ext = pathExt[ii];
|
|
3062
3062
|
isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
3063
3063
|
if (!er && is) {
|
|
3064
3064
|
if (opt.all)
|
|
3065
3065
|
found.push(p2 + ext);
|
|
3066
3066
|
else
|
|
3067
|
-
return
|
|
3067
|
+
return resolve11(p2 + ext);
|
|
3068
3068
|
}
|
|
3069
|
-
return
|
|
3069
|
+
return resolve11(subStep(p2, i, ii + 1));
|
|
3070
3070
|
});
|
|
3071
3071
|
});
|
|
3072
3072
|
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
|
|
@@ -5526,9 +5526,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
5526
5526
|
}
|
|
5527
5527
|
close(callback) {
|
|
5528
5528
|
if (callback === void 0) {
|
|
5529
|
-
return new Promise((
|
|
5529
|
+
return new Promise((resolve11, reject) => {
|
|
5530
5530
|
this.close((err, data) => {
|
|
5531
|
-
return err ? reject(err) :
|
|
5531
|
+
return err ? reject(err) : resolve11(data);
|
|
5532
5532
|
});
|
|
5533
5533
|
});
|
|
5534
5534
|
}
|
|
@@ -5566,12 +5566,12 @@ var require_dispatcher_base = __commonJS({
|
|
|
5566
5566
|
err = null;
|
|
5567
5567
|
}
|
|
5568
5568
|
if (callback === void 0) {
|
|
5569
|
-
return new Promise((
|
|
5569
|
+
return new Promise((resolve11, reject) => {
|
|
5570
5570
|
this.destroy(err, (err2, data) => {
|
|
5571
5571
|
return err2 ? (
|
|
5572
5572
|
/* istanbul ignore next: should never error */
|
|
5573
5573
|
reject(err2)
|
|
5574
|
-
) :
|
|
5574
|
+
) : resolve11(data);
|
|
5575
5575
|
});
|
|
5576
5576
|
});
|
|
5577
5577
|
}
|
|
@@ -8787,8 +8787,8 @@ var require_promise = __commonJS({
|
|
|
8787
8787
|
function createDeferredPromise() {
|
|
8788
8788
|
let res;
|
|
8789
8789
|
let rej;
|
|
8790
|
-
const promise = new Promise((
|
|
8791
|
-
res =
|
|
8790
|
+
const promise = new Promise((resolve11, reject) => {
|
|
8791
|
+
res = resolve11;
|
|
8792
8792
|
rej = reject;
|
|
8793
8793
|
});
|
|
8794
8794
|
return { promise, resolve: res, reject: rej };
|
|
@@ -10094,12 +10094,12 @@ upgrade: ${upgrade}\r
|
|
|
10094
10094
|
cb();
|
|
10095
10095
|
}
|
|
10096
10096
|
}
|
|
10097
|
-
const waitForDrain = () => new Promise((
|
|
10097
|
+
const waitForDrain = () => new Promise((resolve11, reject) => {
|
|
10098
10098
|
assert5(callback === null);
|
|
10099
10099
|
if (socket[kError]) {
|
|
10100
10100
|
reject(socket[kError]);
|
|
10101
10101
|
} else {
|
|
10102
|
-
callback =
|
|
10102
|
+
callback = resolve11;
|
|
10103
10103
|
}
|
|
10104
10104
|
});
|
|
10105
10105
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -10806,12 +10806,12 @@ var require_client_h2 = __commonJS({
|
|
|
10806
10806
|
cb();
|
|
10807
10807
|
}
|
|
10808
10808
|
}
|
|
10809
|
-
const waitForDrain = () => new Promise((
|
|
10809
|
+
const waitForDrain = () => new Promise((resolve11, reject) => {
|
|
10810
10810
|
assert5(callback === null);
|
|
10811
10811
|
if (socket[kError]) {
|
|
10812
10812
|
reject(socket[kError]);
|
|
10813
10813
|
} else {
|
|
10814
|
-
callback =
|
|
10814
|
+
callback = resolve11;
|
|
10815
10815
|
}
|
|
10816
10816
|
});
|
|
10817
10817
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -11098,16 +11098,16 @@ var require_client = __commonJS({
|
|
|
11098
11098
|
return this[kNeedDrain] < 2;
|
|
11099
11099
|
}
|
|
11100
11100
|
async [kClose]() {
|
|
11101
|
-
return new Promise((
|
|
11101
|
+
return new Promise((resolve11) => {
|
|
11102
11102
|
if (this[kSize]) {
|
|
11103
|
-
this[kClosedResolve] =
|
|
11103
|
+
this[kClosedResolve] = resolve11;
|
|
11104
11104
|
} else {
|
|
11105
|
-
|
|
11105
|
+
resolve11(null);
|
|
11106
11106
|
}
|
|
11107
11107
|
});
|
|
11108
11108
|
}
|
|
11109
11109
|
async [kDestroy](err) {
|
|
11110
|
-
return new Promise((
|
|
11110
|
+
return new Promise((resolve11) => {
|
|
11111
11111
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
11112
11112
|
for (let i = 0; i < requests.length; i++) {
|
|
11113
11113
|
const request2 = requests[i];
|
|
@@ -11118,7 +11118,7 @@ var require_client = __commonJS({
|
|
|
11118
11118
|
this[kClosedResolve]();
|
|
11119
11119
|
this[kClosedResolve] = null;
|
|
11120
11120
|
}
|
|
11121
|
-
|
|
11121
|
+
resolve11(null);
|
|
11122
11122
|
};
|
|
11123
11123
|
if (this[kHTTPContext]) {
|
|
11124
11124
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -11168,7 +11168,7 @@ var require_client = __commonJS({
|
|
|
11168
11168
|
});
|
|
11169
11169
|
}
|
|
11170
11170
|
try {
|
|
11171
|
-
const socket = await new Promise((
|
|
11171
|
+
const socket = await new Promise((resolve11, reject) => {
|
|
11172
11172
|
client[kConnector]({
|
|
11173
11173
|
host,
|
|
11174
11174
|
hostname,
|
|
@@ -11180,7 +11180,7 @@ var require_client = __commonJS({
|
|
|
11180
11180
|
if (err) {
|
|
11181
11181
|
reject(err);
|
|
11182
11182
|
} else {
|
|
11183
|
-
|
|
11183
|
+
resolve11(socket2);
|
|
11184
11184
|
}
|
|
11185
11185
|
});
|
|
11186
11186
|
});
|
|
@@ -11506,8 +11506,8 @@ var require_pool_base = __commonJS({
|
|
|
11506
11506
|
if (this[kQueue].isEmpty()) {
|
|
11507
11507
|
await Promise.all(this[kClients].map((c2) => c2.close()));
|
|
11508
11508
|
} else {
|
|
11509
|
-
await new Promise((
|
|
11510
|
-
this[kClosedResolve] =
|
|
11509
|
+
await new Promise((resolve11) => {
|
|
11510
|
+
this[kClosedResolve] = resolve11;
|
|
11511
11511
|
});
|
|
11512
11512
|
}
|
|
11513
11513
|
}
|
|
@@ -12933,7 +12933,7 @@ var require_readable = __commonJS({
|
|
|
12933
12933
|
if (this._readableState.closeEmitted) {
|
|
12934
12934
|
return null;
|
|
12935
12935
|
}
|
|
12936
|
-
return await new Promise((
|
|
12936
|
+
return await new Promise((resolve11, reject) => {
|
|
12937
12937
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
12938
12938
|
this.destroy(new AbortError());
|
|
12939
12939
|
}
|
|
@@ -12947,11 +12947,11 @@ var require_readable = __commonJS({
|
|
|
12947
12947
|
if (signal.aborted) {
|
|
12948
12948
|
reject(signal.reason ?? new AbortError());
|
|
12949
12949
|
} else {
|
|
12950
|
-
|
|
12950
|
+
resolve11(null);
|
|
12951
12951
|
}
|
|
12952
12952
|
});
|
|
12953
12953
|
} else {
|
|
12954
|
-
this.on("close",
|
|
12954
|
+
this.on("close", resolve11);
|
|
12955
12955
|
}
|
|
12956
12956
|
this.on("error", noop).on("data", () => {
|
|
12957
12957
|
if (this[kBytesRead] > limit) {
|
|
@@ -12979,7 +12979,7 @@ var require_readable = __commonJS({
|
|
|
12979
12979
|
}
|
|
12980
12980
|
function consume(stream, type) {
|
|
12981
12981
|
assert5(!stream[kConsume]);
|
|
12982
|
-
return new Promise((
|
|
12982
|
+
return new Promise((resolve11, reject) => {
|
|
12983
12983
|
if (isUnusable(stream)) {
|
|
12984
12984
|
const rState = stream._readableState;
|
|
12985
12985
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -12994,7 +12994,7 @@ var require_readable = __commonJS({
|
|
|
12994
12994
|
stream[kConsume] = {
|
|
12995
12995
|
type,
|
|
12996
12996
|
stream,
|
|
12997
|
-
resolve:
|
|
12997
|
+
resolve: resolve11,
|
|
12998
12998
|
reject,
|
|
12999
12999
|
length: 0,
|
|
13000
13000
|
body: []
|
|
@@ -13068,18 +13068,18 @@ var require_readable = __commonJS({
|
|
|
13068
13068
|
return buffer;
|
|
13069
13069
|
}
|
|
13070
13070
|
function consumeEnd(consume2, encoding) {
|
|
13071
|
-
const { type, body, resolve:
|
|
13071
|
+
const { type, body, resolve: resolve11, stream, length } = consume2;
|
|
13072
13072
|
try {
|
|
13073
13073
|
if (type === "text") {
|
|
13074
|
-
|
|
13074
|
+
resolve11(chunksDecode(body, length, encoding));
|
|
13075
13075
|
} else if (type === "json") {
|
|
13076
|
-
|
|
13076
|
+
resolve11(JSON.parse(chunksDecode(body, length, encoding)));
|
|
13077
13077
|
} else if (type === "arrayBuffer") {
|
|
13078
|
-
|
|
13078
|
+
resolve11(chunksConcat(body, length).buffer);
|
|
13079
13079
|
} else if (type === "blob") {
|
|
13080
|
-
|
|
13080
|
+
resolve11(new Blob(body, { type: stream[kContentType] }));
|
|
13081
13081
|
} else if (type === "bytes") {
|
|
13082
|
-
|
|
13082
|
+
resolve11(chunksConcat(body, length));
|
|
13083
13083
|
}
|
|
13084
13084
|
consumeFinish(consume2);
|
|
13085
13085
|
} catch (err) {
|
|
@@ -13260,9 +13260,9 @@ var require_api_request = __commonJS({
|
|
|
13260
13260
|
};
|
|
13261
13261
|
function request2(opts, callback) {
|
|
13262
13262
|
if (callback === void 0) {
|
|
13263
|
-
return new Promise((
|
|
13263
|
+
return new Promise((resolve11, reject) => {
|
|
13264
13264
|
request2.call(this, opts, (err, data) => {
|
|
13265
|
-
return err ? reject(err) :
|
|
13265
|
+
return err ? reject(err) : resolve11(data);
|
|
13266
13266
|
});
|
|
13267
13267
|
});
|
|
13268
13268
|
}
|
|
@@ -13474,9 +13474,9 @@ var require_api_stream = __commonJS({
|
|
|
13474
13474
|
};
|
|
13475
13475
|
function stream(opts, factory, callback) {
|
|
13476
13476
|
if (callback === void 0) {
|
|
13477
|
-
return new Promise((
|
|
13477
|
+
return new Promise((resolve11, reject) => {
|
|
13478
13478
|
stream.call(this, opts, factory, (err, data) => {
|
|
13479
|
-
return err ? reject(err) :
|
|
13479
|
+
return err ? reject(err) : resolve11(data);
|
|
13480
13480
|
});
|
|
13481
13481
|
});
|
|
13482
13482
|
}
|
|
@@ -13763,9 +13763,9 @@ var require_api_upgrade = __commonJS({
|
|
|
13763
13763
|
};
|
|
13764
13764
|
function upgrade(opts, callback) {
|
|
13765
13765
|
if (callback === void 0) {
|
|
13766
|
-
return new Promise((
|
|
13766
|
+
return new Promise((resolve11, reject) => {
|
|
13767
13767
|
upgrade.call(this, opts, (err, data) => {
|
|
13768
|
-
return err ? reject(err) :
|
|
13768
|
+
return err ? reject(err) : resolve11(data);
|
|
13769
13769
|
});
|
|
13770
13770
|
});
|
|
13771
13771
|
}
|
|
@@ -13858,9 +13858,9 @@ var require_api_connect = __commonJS({
|
|
|
13858
13858
|
};
|
|
13859
13859
|
function connect(opts, callback) {
|
|
13860
13860
|
if (callback === void 0) {
|
|
13861
|
-
return new Promise((
|
|
13861
|
+
return new Promise((resolve11, reject) => {
|
|
13862
13862
|
connect.call(this, opts, (err, data) => {
|
|
13863
|
-
return err ? reject(err) :
|
|
13863
|
+
return err ? reject(err) : resolve11(data);
|
|
13864
13864
|
});
|
|
13865
13865
|
});
|
|
13866
13866
|
}
|
|
@@ -15091,8 +15091,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
15091
15091
|
var require_snapshot_recorder = __commonJS({
|
|
15092
15092
|
"../../node_modules/.pnpm/undici@7.14.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
|
|
15093
15093
|
"use strict";
|
|
15094
|
-
var { writeFile:
|
|
15095
|
-
var { dirname: dirname5, resolve:
|
|
15094
|
+
var { writeFile: writeFile3, readFile: readFile2, mkdir } = require("node:fs/promises");
|
|
15095
|
+
var { dirname: dirname5, resolve: resolve11 } = require("node:path");
|
|
15096
15096
|
var { setTimeout: setTimeout5, clearTimeout: clearTimeout2 } = require("node:timers");
|
|
15097
15097
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
15098
15098
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -15286,7 +15286,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
15286
15286
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
15287
15287
|
}
|
|
15288
15288
|
try {
|
|
15289
|
-
const data = await
|
|
15289
|
+
const data = await readFile2(resolve11(path6), "utf8");
|
|
15290
15290
|
const parsed = JSON.parse(data);
|
|
15291
15291
|
if (Array.isArray(parsed)) {
|
|
15292
15292
|
this.#snapshots.clear();
|
|
@@ -15315,13 +15315,13 @@ var require_snapshot_recorder = __commonJS({
|
|
|
15315
15315
|
if (!path6) {
|
|
15316
15316
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
15317
15317
|
}
|
|
15318
|
-
const resolvedPath =
|
|
15318
|
+
const resolvedPath = resolve11(path6);
|
|
15319
15319
|
await mkdir(dirname5(resolvedPath), { recursive: true });
|
|
15320
15320
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
15321
15321
|
hash,
|
|
15322
15322
|
snapshot
|
|
15323
15323
|
}));
|
|
15324
|
-
await
|
|
15324
|
+
await writeFile3(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
15325
15325
|
}
|
|
15326
15326
|
/**
|
|
15327
15327
|
* Clears all recorded snapshots
|
|
@@ -20709,7 +20709,7 @@ var require_fetch = __commonJS({
|
|
|
20709
20709
|
function dispatch({ body }) {
|
|
20710
20710
|
const url = requestCurrentURL(request2);
|
|
20711
20711
|
const agent = fetchParams.controller.dispatcher;
|
|
20712
|
-
return new Promise((
|
|
20712
|
+
return new Promise((resolve11, reject) => agent.dispatch(
|
|
20713
20713
|
{
|
|
20714
20714
|
path: url.pathname + url.search,
|
|
20715
20715
|
origin: url.origin,
|
|
@@ -20787,7 +20787,7 @@ var require_fetch = __commonJS({
|
|
|
20787
20787
|
}
|
|
20788
20788
|
}
|
|
20789
20789
|
const onError = this.onError.bind(this);
|
|
20790
|
-
|
|
20790
|
+
resolve11({
|
|
20791
20791
|
status: status2,
|
|
20792
20792
|
statusText,
|
|
20793
20793
|
headersList,
|
|
@@ -20830,7 +20830,7 @@ var require_fetch = __commonJS({
|
|
|
20830
20830
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
20831
20831
|
headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString("latin1"), true);
|
|
20832
20832
|
}
|
|
20833
|
-
|
|
20833
|
+
resolve11({
|
|
20834
20834
|
status: status2,
|
|
20835
20835
|
statusText: STATUS_CODES[status2],
|
|
20836
20836
|
headersList,
|
|
@@ -24080,8 +24080,8 @@ var require_util6 = __commonJS({
|
|
|
24080
24080
|
return true;
|
|
24081
24081
|
}
|
|
24082
24082
|
function delay(ms) {
|
|
24083
|
-
return new Promise((
|
|
24084
|
-
setTimeout(
|
|
24083
|
+
return new Promise((resolve11) => {
|
|
24084
|
+
setTimeout(resolve11, ms);
|
|
24085
24085
|
});
|
|
24086
24086
|
}
|
|
24087
24087
|
module2.exports = {
|
|
@@ -25693,9 +25693,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
25693
25693
|
}
|
|
25694
25694
|
// stream.promise().then(() => done, er => emitted error)
|
|
25695
25695
|
promise() {
|
|
25696
|
-
return new Promise((
|
|
25696
|
+
return new Promise((resolve12, reject) => {
|
|
25697
25697
|
this.on(DESTROYED, () => reject(new Error("stream destroyed")));
|
|
25698
|
-
this.on("end", () =>
|
|
25698
|
+
this.on("end", () => resolve12());
|
|
25699
25699
|
this.on("error", (er) => reject(er));
|
|
25700
25700
|
});
|
|
25701
25701
|
}
|
|
@@ -25707,7 +25707,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
25707
25707
|
return Promise.resolve({ done: false, value: res });
|
|
25708
25708
|
if (this[EOF$1])
|
|
25709
25709
|
return Promise.resolve({ done: true });
|
|
25710
|
-
let
|
|
25710
|
+
let resolve12 = null;
|
|
25711
25711
|
let reject = null;
|
|
25712
25712
|
const onerr = (er) => {
|
|
25713
25713
|
this.removeListener("data", ondata);
|
|
@@ -25718,17 +25718,17 @@ var require_index_688c5d50 = __commonJS({
|
|
|
25718
25718
|
this.removeListener("error", onerr);
|
|
25719
25719
|
this.removeListener("end", onend);
|
|
25720
25720
|
this.pause();
|
|
25721
|
-
|
|
25721
|
+
resolve12({ value, done: !!this[EOF$1] });
|
|
25722
25722
|
};
|
|
25723
25723
|
const onend = () => {
|
|
25724
25724
|
this.removeListener("error", onerr);
|
|
25725
25725
|
this.removeListener("data", ondata);
|
|
25726
|
-
|
|
25726
|
+
resolve12({ done: true });
|
|
25727
25727
|
};
|
|
25728
25728
|
const ondestroy = () => onerr(new Error("stream destroyed"));
|
|
25729
25729
|
return new Promise((res2, rej) => {
|
|
25730
25730
|
reject = rej;
|
|
25731
|
-
|
|
25731
|
+
resolve12 = res2;
|
|
25732
25732
|
this.once(DESTROYED, ondestroy);
|
|
25733
25733
|
this.once("error", onerr);
|
|
25734
25734
|
this.once("end", onend);
|
|
@@ -28155,9 +28155,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28155
28155
|
const parse8 = new parse$4(opt);
|
|
28156
28156
|
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
28157
28157
|
const file = opt.file;
|
|
28158
|
-
const p2 = new Promise((
|
|
28158
|
+
const p2 = new Promise((resolve12, reject) => {
|
|
28159
28159
|
parse8.on("error", reject);
|
|
28160
|
-
parse8.on("end",
|
|
28160
|
+
parse8.on("end", resolve12);
|
|
28161
28161
|
fs__default["default"].stat(file, (er, stat) => {
|
|
28162
28162
|
if (er)
|
|
28163
28163
|
reject(er);
|
|
@@ -28368,7 +28368,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28368
28368
|
};
|
|
28369
28369
|
fs__default["default"].read(fd, headBuf, 0, 512, position, onread);
|
|
28370
28370
|
};
|
|
28371
|
-
const promise = new Promise((
|
|
28371
|
+
const promise = new Promise((resolve12, reject) => {
|
|
28372
28372
|
p2.on("error", reject);
|
|
28373
28373
|
let flag = "r+";
|
|
28374
28374
|
const onopen = (er, fd) => {
|
|
@@ -28390,7 +28390,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28390
28390
|
});
|
|
28391
28391
|
p2.pipe(stream);
|
|
28392
28392
|
stream.on("error", reject);
|
|
28393
|
-
stream.on("close",
|
|
28393
|
+
stream.on("close", resolve12);
|
|
28394
28394
|
addFilesAsync(p2, files);
|
|
28395
28395
|
});
|
|
28396
28396
|
});
|
|
@@ -28467,7 +28467,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28467
28467
|
};
|
|
28468
28468
|
var optsArg_1 = optsArg;
|
|
28469
28469
|
var platform$2 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
|
|
28470
|
-
var { resolve:
|
|
28470
|
+
var { resolve: resolve11, parse: parse$3 } = path__default["default"];
|
|
28471
28471
|
var pathArg = (path7) => {
|
|
28472
28472
|
if (/\0/.test(path7)) {
|
|
28473
28473
|
throw Object.assign(
|
|
@@ -28478,7 +28478,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28478
28478
|
}
|
|
28479
28479
|
);
|
|
28480
28480
|
}
|
|
28481
|
-
path7 =
|
|
28481
|
+
path7 = resolve11(path7);
|
|
28482
28482
|
if (platform$2 === "win32") {
|
|
28483
28483
|
const badWinChars = /[*|"<>?:]/;
|
|
28484
28484
|
const { root } = parse$3(path7);
|
|
@@ -29557,9 +29557,9 @@ var require_index_688c5d50 = __commonJS({
|
|
|
29557
29557
|
const u = new unpack(opt);
|
|
29558
29558
|
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
|
|
29559
29559
|
const file = opt.file;
|
|
29560
|
-
const p2 = new Promise((
|
|
29560
|
+
const p2 = new Promise((resolve12, reject) => {
|
|
29561
29561
|
u.on("error", reject);
|
|
29562
|
-
u.on("close",
|
|
29562
|
+
u.on("close", resolve12);
|
|
29563
29563
|
fs__default["default"].stat(file, (er, stat) => {
|
|
29564
29564
|
if (er)
|
|
29565
29565
|
reject(er);
|
|
@@ -31482,8 +31482,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
31482
31482
|
fs4.createReadStream = createReadStream;
|
|
31483
31483
|
fs4.createWriteStream = createWriteStream;
|
|
31484
31484
|
var fs$readFile = fs4.readFile;
|
|
31485
|
-
fs4.readFile =
|
|
31486
|
-
function
|
|
31485
|
+
fs4.readFile = readFile2;
|
|
31486
|
+
function readFile2(path7, options, cb) {
|
|
31487
31487
|
if (typeof options === "function")
|
|
31488
31488
|
cb = options, options = null;
|
|
31489
31489
|
return go$readFile(path7, options, cb);
|
|
@@ -31500,8 +31500,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
31500
31500
|
}
|
|
31501
31501
|
}
|
|
31502
31502
|
var fs$writeFile = fs4.writeFile;
|
|
31503
|
-
fs4.writeFile =
|
|
31504
|
-
function
|
|
31503
|
+
fs4.writeFile = writeFile3;
|
|
31504
|
+
function writeFile3(path7, data, options, cb) {
|
|
31505
31505
|
if (typeof options === "function")
|
|
31506
31506
|
cb = options, options = null;
|
|
31507
31507
|
return go$writeFile(path7, data, options, cb);
|
|
@@ -34874,12 +34874,12 @@ var require_index_688c5d50 = __commonJS({
|
|
|
34874
34874
|
});
|
|
34875
34875
|
function promisify(fn) {
|
|
34876
34876
|
return function(req, opts) {
|
|
34877
|
-
return new Promise((
|
|
34877
|
+
return new Promise((resolve12, reject) => {
|
|
34878
34878
|
fn.call(this, req, opts, (err, rtn) => {
|
|
34879
34879
|
if (err) {
|
|
34880
34880
|
reject(err);
|
|
34881
34881
|
} else {
|
|
34882
|
-
|
|
34882
|
+
resolve12(rtn);
|
|
34883
34883
|
}
|
|
34884
34884
|
});
|
|
34885
34885
|
});
|
|
@@ -35070,7 +35070,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35070
35070
|
var debug_1$1 = __importDefault$2(src$1);
|
|
35071
35071
|
var debug$1 = debug_1$1.default("https-proxy-agent:parse-proxy-response");
|
|
35072
35072
|
function parseProxyResponse(socket) {
|
|
35073
|
-
return new Promise((
|
|
35073
|
+
return new Promise((resolve12, reject) => {
|
|
35074
35074
|
let buffersLength = 0;
|
|
35075
35075
|
const buffers = [];
|
|
35076
35076
|
function read() {
|
|
@@ -35110,7 +35110,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35110
35110
|
const firstLine = buffered.toString("ascii", 0, buffered.indexOf("\r\n"));
|
|
35111
35111
|
const statusCode = +firstLine.split(" ")[1];
|
|
35112
35112
|
debug$1("got proxy server response: %o", firstLine);
|
|
35113
|
-
|
|
35113
|
+
resolve12({
|
|
35114
35114
|
statusCode,
|
|
35115
35115
|
buffered
|
|
35116
35116
|
});
|
|
@@ -35127,11 +35127,11 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35127
35127
|
}, "__esModule", { value: true });
|
|
35128
35128
|
var __awaiter2 = commonjsGlobal && commonjsGlobal.__awaiter || function(thisArg, _arguments, P2, generator) {
|
|
35129
35129
|
function adopt(value) {
|
|
35130
|
-
return value instanceof P2 ? value : new P2(function(
|
|
35131
|
-
|
|
35130
|
+
return value instanceof P2 ? value : new P2(function(resolve12) {
|
|
35131
|
+
resolve12(value);
|
|
35132
35132
|
});
|
|
35133
35133
|
}
|
|
35134
|
-
return new (P2 || (P2 = Promise))(function(
|
|
35134
|
+
return new (P2 || (P2 = Promise))(function(resolve12, reject) {
|
|
35135
35135
|
function fulfilled(value) {
|
|
35136
35136
|
try {
|
|
35137
35137
|
step(generator.next(value));
|
|
@@ -35147,7 +35147,7 @@ var require_index_688c5d50 = __commonJS({
|
|
|
35147
35147
|
}
|
|
35148
35148
|
}
|
|
35149
35149
|
function step(result) {
|
|
35150
|
-
result.done ?
|
|
35150
|
+
result.done ? resolve12(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
35151
35151
|
}
|
|
35152
35152
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35153
35153
|
});
|
|
@@ -44349,14 +44349,14 @@ var require_open = __commonJS({
|
|
|
44349
44349
|
}
|
|
44350
44350
|
const subprocess = childProcess.spawn(command2, cliArguments, childProcessOptions);
|
|
44351
44351
|
if (options.wait) {
|
|
44352
|
-
return new Promise((
|
|
44352
|
+
return new Promise((resolve11, reject) => {
|
|
44353
44353
|
subprocess.once("error", reject);
|
|
44354
44354
|
subprocess.once("close", (exitCode) => {
|
|
44355
44355
|
if (options.allowNonzeroExitCode && exitCode > 0) {
|
|
44356
44356
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
44357
44357
|
return;
|
|
44358
44358
|
}
|
|
44359
|
-
|
|
44359
|
+
resolve11(subprocess);
|
|
44360
44360
|
});
|
|
44361
44361
|
});
|
|
44362
44362
|
}
|
|
@@ -44557,11 +44557,11 @@ function __metadata(metadataKey, metadataValue) {
|
|
|
44557
44557
|
}
|
|
44558
44558
|
function __awaiter(thisArg, _arguments, P2, generator) {
|
|
44559
44559
|
function adopt(value) {
|
|
44560
|
-
return value instanceof P2 ? value : new P2(function(
|
|
44561
|
-
|
|
44560
|
+
return value instanceof P2 ? value : new P2(function(resolve11) {
|
|
44561
|
+
resolve11(value);
|
|
44562
44562
|
});
|
|
44563
44563
|
}
|
|
44564
|
-
return new (P2 || (P2 = Promise))(function(
|
|
44564
|
+
return new (P2 || (P2 = Promise))(function(resolve11, reject) {
|
|
44565
44565
|
function fulfilled(value) {
|
|
44566
44566
|
try {
|
|
44567
44567
|
step(generator.next(value));
|
|
@@ -44577,7 +44577,7 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
44577
44577
|
}
|
|
44578
44578
|
}
|
|
44579
44579
|
function step(result) {
|
|
44580
|
-
result.done ?
|
|
44580
|
+
result.done ? resolve11(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
44581
44581
|
}
|
|
44582
44582
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44583
44583
|
});
|
|
@@ -44768,14 +44768,14 @@ function __asyncValues(o) {
|
|
|
44768
44768
|
}, i);
|
|
44769
44769
|
function verb(n) {
|
|
44770
44770
|
i[n] = o[n] && function(v2) {
|
|
44771
|
-
return new Promise(function(
|
|
44772
|
-
v2 = o[n](v2), settle(
|
|
44771
|
+
return new Promise(function(resolve11, reject) {
|
|
44772
|
+
v2 = o[n](v2), settle(resolve11, reject, v2.done, v2.value);
|
|
44773
44773
|
});
|
|
44774
44774
|
};
|
|
44775
44775
|
}
|
|
44776
|
-
function settle(
|
|
44776
|
+
function settle(resolve11, reject, d2, v2) {
|
|
44777
44777
|
Promise.resolve(v2).then(function(v3) {
|
|
44778
|
-
|
|
44778
|
+
resolve11({ value: v3, done: d2 });
|
|
44779
44779
|
}, reject);
|
|
44780
44780
|
}
|
|
44781
44781
|
}
|
|
@@ -69481,12 +69481,12 @@ var require_packet = __commonJS({
|
|
|
69481
69481
|
let chunklen = 0;
|
|
69482
69482
|
let received = false;
|
|
69483
69483
|
let expected = false;
|
|
69484
|
-
return new Promise((
|
|
69484
|
+
return new Promise((resolve11, reject) => {
|
|
69485
69485
|
const processMessage = () => {
|
|
69486
69486
|
if (received) return;
|
|
69487
69487
|
received = true;
|
|
69488
69488
|
const buffer = Buffer.concat(chunks, chunklen);
|
|
69489
|
-
|
|
69489
|
+
resolve11(buffer.slice(2));
|
|
69490
69490
|
};
|
|
69491
69491
|
socket.on("end", processMessage);
|
|
69492
69492
|
socket.on("error", reject);
|
|
@@ -69548,15 +69548,15 @@ var require_udp = __commonJS({
|
|
|
69548
69548
|
if (message instanceof Packet) {
|
|
69549
69549
|
message = message.toBuffer();
|
|
69550
69550
|
}
|
|
69551
|
-
return new Promise((
|
|
69551
|
+
return new Promise((resolve11, reject) => {
|
|
69552
69552
|
this.send(message, rinfo.port, rinfo.address, (err) => {
|
|
69553
69553
|
if (err) return reject(err);
|
|
69554
|
-
|
|
69554
|
+
resolve11(message);
|
|
69555
69555
|
});
|
|
69556
69556
|
});
|
|
69557
69557
|
}
|
|
69558
69558
|
listen(port, address) {
|
|
69559
|
-
return new Promise((
|
|
69559
|
+
return new Promise((resolve11) => this.bind(port, address, resolve11));
|
|
69560
69560
|
}
|
|
69561
69561
|
};
|
|
69562
69562
|
module2.exports = Server;
|
|
@@ -69618,11 +69618,11 @@ var require_doh = __commonJS({
|
|
|
69618
69618
|
}
|
|
69619
69619
|
return queryData;
|
|
69620
69620
|
};
|
|
69621
|
-
var readStream = (stream) => new Promise((
|
|
69621
|
+
var readStream = (stream) => new Promise((resolve11, reject) => {
|
|
69622
69622
|
let buffer = "";
|
|
69623
69623
|
stream.on("error", reject).on("data", (chunk) => {
|
|
69624
69624
|
buffer += chunk;
|
|
69625
|
-
}).on("end", () =>
|
|
69625
|
+
}).on("end", () => resolve11(buffer));
|
|
69626
69626
|
});
|
|
69627
69627
|
var Server = class extends EventEmitter {
|
|
69628
69628
|
constructor(options) {
|
|
@@ -69748,12 +69748,12 @@ var require_dns2 = __commonJS({
|
|
|
69748
69748
|
}
|
|
69749
69749
|
const servers = Object.values(this.servers);
|
|
69750
69750
|
this.closed = Promise.all(
|
|
69751
|
-
servers.map((server) => new Promise((
|
|
69751
|
+
servers.map((server) => new Promise((resolve11) => server.once("close", resolve11)))
|
|
69752
69752
|
).then(() => {
|
|
69753
69753
|
this.emit("close");
|
|
69754
69754
|
});
|
|
69755
69755
|
this.listening = Promise.all(
|
|
69756
|
-
servers.map((server) => new Promise((
|
|
69756
|
+
servers.map((server) => new Promise((resolve11) => server.once("listening", resolve11)))
|
|
69757
69757
|
).then(() => {
|
|
69758
69758
|
const addresses = this.addresses();
|
|
69759
69759
|
this.emit("listening", addresses);
|
|
@@ -69885,18 +69885,18 @@ var require_tcp2 = __commonJS({
|
|
|
69885
69885
|
var require_doh2 = __commonJS({
|
|
69886
69886
|
"../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/doh.js"(exports2, module2) {
|
|
69887
69887
|
var Packet = require_packet();
|
|
69888
|
-
var defaultGet = (url) => new Promise((
|
|
69888
|
+
var defaultGet = (url) => new Promise((resolve11, reject) => {
|
|
69889
69889
|
const headers = {
|
|
69890
69890
|
accept: "application/dns-message"
|
|
69891
69891
|
};
|
|
69892
69892
|
const base = url.startsWith("https") ? require("https") : require("http");
|
|
69893
|
-
const req = base.get(url, { headers },
|
|
69893
|
+
const req = base.get(url, { headers }, resolve11);
|
|
69894
69894
|
req.on("error", reject);
|
|
69895
69895
|
});
|
|
69896
69896
|
var readStream = (stream) => {
|
|
69897
69897
|
const buffer = [];
|
|
69898
|
-
return new Promise((
|
|
69899
|
-
stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () =>
|
|
69898
|
+
return new Promise((resolve11, reject) => {
|
|
69899
|
+
stream.on("error", reject).on("data", (chunk) => buffer.push(chunk)).on("end", () => resolve11(Buffer.concat(buffer)));
|
|
69900
69900
|
});
|
|
69901
69901
|
};
|
|
69902
69902
|
var DOHClient = ({ dns, http, get = defaultGet } = {}) => {
|
|
@@ -69949,12 +69949,12 @@ var require_udp2 = __commonJS({
|
|
|
69949
69949
|
type: Packet.TYPE[type]
|
|
69950
69950
|
});
|
|
69951
69951
|
const client = new udp.Socket(socketType);
|
|
69952
|
-
return new Promise((
|
|
69952
|
+
return new Promise((resolve11, reject) => {
|
|
69953
69953
|
client.once("message", function onMessage(message) {
|
|
69954
69954
|
client.close();
|
|
69955
69955
|
const response = Packet.parse(message);
|
|
69956
69956
|
equal(response.header.id, query.header.id);
|
|
69957
|
-
|
|
69957
|
+
resolve11(response);
|
|
69958
69958
|
});
|
|
69959
69959
|
debug("send", dns, query.toBuffer());
|
|
69960
69960
|
client.send(query.toBuffer(), port, dns, (err) => err && reject(err));
|
|
@@ -69968,13 +69968,13 @@ var require_udp2 = __commonJS({
|
|
|
69968
69968
|
var require_google = __commonJS({
|
|
69969
69969
|
"../../node_modules/.pnpm/dns2@2.1.0/node_modules/dns2/client/google.js"(exports2, module2) {
|
|
69970
69970
|
var https = require("https");
|
|
69971
|
-
var get = (url) => new Promise((
|
|
69971
|
+
var get = (url) => new Promise((resolve11) => https.get(url, resolve11));
|
|
69972
69972
|
var readStream = (stream) => {
|
|
69973
69973
|
const buffer = [];
|
|
69974
|
-
return new Promise((
|
|
69974
|
+
return new Promise((resolve11, reject) => {
|
|
69975
69975
|
stream.on("error", reject).on("data", (chunk) => {
|
|
69976
69976
|
buffer.push(chunk);
|
|
69977
|
-
}).on("end", () =>
|
|
69977
|
+
}).on("end", () => resolve11(Buffer.concat(buffer)));
|
|
69978
69978
|
});
|
|
69979
69979
|
};
|
|
69980
69980
|
var GoogleClient = () => (name3, type = "ANY") => {
|
|
@@ -70035,8 +70035,8 @@ var require_dns22 = __commonJS({
|
|
|
70035
70035
|
const { port, nameServers, recursive, resolverProtocol = "UDP" } = this;
|
|
70036
70036
|
const createResolver = _DNS[resolverProtocol + "Client"];
|
|
70037
70037
|
return Promise.race(nameServers.map((address) => {
|
|
70038
|
-
const
|
|
70039
|
-
return
|
|
70038
|
+
const resolve11 = createResolver({ dns: address, port, recursive });
|
|
70039
|
+
return resolve11(name3, type, cls, clientIp);
|
|
70040
70040
|
}));
|
|
70041
70041
|
}
|
|
70042
70042
|
/**
|
|
@@ -70090,7 +70090,7 @@ __export(cli_exports, {
|
|
|
70090
70090
|
});
|
|
70091
70091
|
module.exports = __toCommonJS(cli_exports);
|
|
70092
70092
|
var import_node_fs14 = require("node:fs");
|
|
70093
|
-
var
|
|
70093
|
+
var import_node_path17 = require("node:path");
|
|
70094
70094
|
var import_node_process7 = require("node:process");
|
|
70095
70095
|
|
|
70096
70096
|
// ../cli/index.ts
|
|
@@ -76257,12 +76257,12 @@ var YargsInstance = class {
|
|
|
76257
76257
|
async getCompletion(args, done) {
|
|
76258
76258
|
argsert("<array> [function]", [args, done], arguments.length);
|
|
76259
76259
|
if (!done) {
|
|
76260
|
-
return new Promise((
|
|
76260
|
+
return new Promise((resolve11, reject) => {
|
|
76261
76261
|
__classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
|
|
76262
76262
|
if (err)
|
|
76263
76263
|
reject(err);
|
|
76264
76264
|
else
|
|
76265
|
-
|
|
76265
|
+
resolve11(completions);
|
|
76266
76266
|
});
|
|
76267
76267
|
});
|
|
76268
76268
|
} else {
|
|
@@ -77302,7 +77302,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
77302
77302
|
var yargs_default = Yargs;
|
|
77303
77303
|
|
|
77304
77304
|
// package.json
|
|
77305
|
-
var version = "2.
|
|
77305
|
+
var version = "2.59.0";
|
|
77306
77306
|
|
|
77307
77307
|
// src/metrics.ts
|
|
77308
77308
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -77651,16 +77651,16 @@ async function sendEvent(payload, enableLog) {
|
|
|
77651
77651
|
|
|
77652
77652
|
// src/metrics.ts
|
|
77653
77653
|
function promiseWithResolvers() {
|
|
77654
|
-
let
|
|
77654
|
+
let resolve11;
|
|
77655
77655
|
let reject;
|
|
77656
77656
|
const promise = new Promise((res, rej) => {
|
|
77657
|
-
|
|
77657
|
+
resolve11 = res;
|
|
77658
77658
|
reject = rej;
|
|
77659
77659
|
});
|
|
77660
|
-
if (!
|
|
77660
|
+
if (!resolve11 || !reject) {
|
|
77661
77661
|
throw new Error("Promise resolvers not set");
|
|
77662
77662
|
}
|
|
77663
|
-
return { resolve:
|
|
77663
|
+
return { resolve: resolve11, reject, promise };
|
|
77664
77664
|
}
|
|
77665
77665
|
function getPlatform() {
|
|
77666
77666
|
const platform = process.platform;
|
|
@@ -77865,9 +77865,9 @@ var runTelemetryCommand = (action) => {
|
|
|
77865
77865
|
|
|
77866
77866
|
// src/templates.ts
|
|
77867
77867
|
var import_node_fs11 = require("node:fs");
|
|
77868
|
-
var
|
|
77868
|
+
var import_promises3 = require("node:fs/promises");
|
|
77869
77869
|
var import_node_os5 = require("node:os");
|
|
77870
|
-
var
|
|
77870
|
+
var import_node_path12 = require("node:path");
|
|
77871
77871
|
var import_deepmerge = __toESM(require_cjs());
|
|
77872
77872
|
var import_degit = __toESM(require_dist());
|
|
77873
77873
|
|
|
@@ -78914,14 +78914,14 @@ var package_default = {
|
|
|
78914
78914
|
],
|
|
78915
78915
|
dependencies: {
|
|
78916
78916
|
"create-astro": "4.13.2",
|
|
78917
|
-
"create-analog": "1.
|
|
78917
|
+
"create-analog": "2.1.3",
|
|
78918
78918
|
"@angular/create": "21.0.1",
|
|
78919
78919
|
"create-docusaurus": "3.9.2",
|
|
78920
78920
|
"create-hono": "0.19.3",
|
|
78921
78921
|
"create-next-app": "15.5.6",
|
|
78922
78922
|
"create-qwik": "1.17.2",
|
|
78923
78923
|
"create-vite": "7.1.1",
|
|
78924
|
-
"create-rwsdk": "3.1.
|
|
78924
|
+
"create-rwsdk": "3.1.2",
|
|
78925
78925
|
"create-react-router": "7.9.6",
|
|
78926
78926
|
"create-solid": "0.6.11",
|
|
78927
78927
|
"create-vike": "0.0.528",
|
|
@@ -79035,85 +79035,117 @@ var getPropertyName = (newProp) => {
|
|
|
79035
79035
|
return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
|
|
79036
79036
|
};
|
|
79037
79037
|
|
|
79038
|
+
// src/helpers/compatDate.ts
|
|
79039
|
+
var import_node_fs7 = require("node:fs");
|
|
79040
|
+
var import_node_path7 = require("node:path");
|
|
79041
|
+
async function getWorkerdCompatibilityDate() {
|
|
79042
|
+
const s = spinner();
|
|
79043
|
+
s.start("Retrieving current workerd compatibility date");
|
|
79044
|
+
try {
|
|
79045
|
+
const latestWorkerdVersion = await getLatestPackageVersion("workerd");
|
|
79046
|
+
const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
79047
|
+
if (match) {
|
|
79048
|
+
const [, year, month, date] = match;
|
|
79049
|
+
let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
|
|
79050
|
+
if (compatDate.getTime() > Date.now()) {
|
|
79051
|
+
compatDate = new Date(Date.now());
|
|
79052
|
+
}
|
|
79053
|
+
const compatDateString = compatDate.toISOString().slice(0, 10);
|
|
79054
|
+
s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
|
|
79055
|
+
return compatDateString;
|
|
79056
|
+
}
|
|
79057
|
+
} catch {
|
|
79058
|
+
}
|
|
79059
|
+
const fallbackDate = "2024-11-11";
|
|
79060
|
+
s.stop(
|
|
79061
|
+
`${brandColor("compatibility date")} ${dim(
|
|
79062
|
+
` Could not find workerd date, falling back to ${fallbackDate}`
|
|
79063
|
+
)}`
|
|
79064
|
+
);
|
|
79065
|
+
return fallbackDate;
|
|
79066
|
+
}
|
|
79067
|
+
function getLatestTypesEntrypoint(ctx) {
|
|
79068
|
+
const workersTypesPath = (0, import_node_path7.resolve)(
|
|
79069
|
+
ctx.project.path,
|
|
79070
|
+
"node_modules",
|
|
79071
|
+
"@cloudflare",
|
|
79072
|
+
"workers-types"
|
|
79073
|
+
);
|
|
79074
|
+
try {
|
|
79075
|
+
const entrypoints = (0, import_node_fs7.readdirSync)(workersTypesPath);
|
|
79076
|
+
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
79077
|
+
if (sorted.length === 0) {
|
|
79078
|
+
return null;
|
|
79079
|
+
}
|
|
79080
|
+
return sorted[0];
|
|
79081
|
+
} catch {
|
|
79082
|
+
return null;
|
|
79083
|
+
}
|
|
79084
|
+
}
|
|
79085
|
+
|
|
79038
79086
|
// templates/analog/c3.ts
|
|
79039
79087
|
var recast2 = __toESM(require_main2());
|
|
79040
|
-
var { npm
|
|
79088
|
+
var { npm } = detectPackageManager();
|
|
79041
79089
|
var generate = async (ctx) => {
|
|
79042
|
-
await runFrameworkGenerator(ctx, [
|
|
79043
|
-
ctx.project.name,
|
|
79044
|
-
"--template",
|
|
79045
|
-
"angular-v17"
|
|
79046
|
-
]);
|
|
79090
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--template=latest"]);
|
|
79047
79091
|
logRaw("");
|
|
79048
79092
|
};
|
|
79049
79093
|
var configure = async (ctx) => {
|
|
79050
|
-
|
|
79051
|
-
|
|
79052
|
-
|
|
79053
|
-
|
|
79054
|
-
|
|
79055
|
-
|
|
79056
|
-
await installPackages(packages, {
|
|
79057
|
-
dev: true,
|
|
79058
|
-
startText: `Installing ${packages.join(", ")}`,
|
|
79059
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
79060
|
-
});
|
|
79061
|
-
}
|
|
79062
|
-
updateViteConfig(ctx);
|
|
79063
|
-
};
|
|
79064
|
-
var updateViteConfig = (ctx) => {
|
|
79065
|
-
const b3 = recast2.types.builders;
|
|
79066
|
-
const s = spinner();
|
|
79067
|
-
const configFile = "vite.config.ts";
|
|
79068
|
-
s.start(`Updating \`${configFile}\``);
|
|
79069
|
-
const snippets = loadTemplateSnippets(ctx);
|
|
79070
|
-
transformFile(configFile, {
|
|
79071
|
-
visitProgram(n) {
|
|
79072
|
-
const lastImportIndex = n.node.body.findLastIndex(
|
|
79073
|
-
(t2) => t2.type === "ImportDeclaration"
|
|
79074
|
-
);
|
|
79075
|
-
const lastImport = n.get("body", lastImportIndex);
|
|
79076
|
-
lastImport.insertAfter(...snippets.devBindingsModuleTs);
|
|
79077
|
-
return this.traverse(n);
|
|
79078
|
-
},
|
|
79079
|
-
visitCallExpression(n) {
|
|
79094
|
+
usesTypescript(ctx);
|
|
79095
|
+
const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
79096
|
+
const compatDate = await getWorkerdCompatibilityDate();
|
|
79097
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
79098
|
+
transformFile(filePath, {
|
|
79099
|
+
visitCallExpression: function(n) {
|
|
79080
79100
|
const callee = n.node.callee;
|
|
79081
|
-
if (callee.name
|
|
79082
|
-
|
|
79101
|
+
if (callee.name !== "analog") {
|
|
79102
|
+
return this.traverse(n);
|
|
79103
|
+
}
|
|
79104
|
+
const b3 = recast2.types.builders;
|
|
79105
|
+
const presetDef = [
|
|
79106
|
+
b3.objectProperty(
|
|
79083
79107
|
b3.identifier("nitro"),
|
|
79084
79108
|
b3.objectExpression([
|
|
79109
|
+
// preset: "cloudflare_module"
|
|
79085
79110
|
b3.objectProperty(
|
|
79086
79111
|
b3.identifier("preset"),
|
|
79087
|
-
b3.stringLiteral("
|
|
79112
|
+
b3.stringLiteral("cloudflare_module")
|
|
79088
79113
|
),
|
|
79089
79114
|
b3.objectProperty(
|
|
79090
|
-
b3.identifier("
|
|
79091
|
-
b3.
|
|
79115
|
+
b3.identifier("compatibilityDate"),
|
|
79116
|
+
b3.stringLiteral(compatDate)
|
|
79092
79117
|
)
|
|
79093
79118
|
])
|
|
79119
|
+
)
|
|
79120
|
+
];
|
|
79121
|
+
if (n.node.arguments.length === 0) {
|
|
79122
|
+
n.node.arguments.push(b3.objectExpression(presetDef));
|
|
79123
|
+
} else {
|
|
79124
|
+
mergeObjectProperties(
|
|
79125
|
+
n.node.arguments[0],
|
|
79126
|
+
presetDef
|
|
79094
79127
|
);
|
|
79095
|
-
n.node.arguments = [b3.objectExpression([pluginArguments])];
|
|
79096
79128
|
}
|
|
79097
|
-
return
|
|
79129
|
+
return false;
|
|
79098
79130
|
}
|
|
79099
79131
|
});
|
|
79100
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
79101
79132
|
};
|
|
79102
79133
|
var config = {
|
|
79103
79134
|
configVersion: 1,
|
|
79104
79135
|
id: "analog",
|
|
79105
79136
|
frameworkCli: "create-analog",
|
|
79106
|
-
platform: "pages",
|
|
79107
79137
|
displayName: "Analog",
|
|
79138
|
+
platform: "workers",
|
|
79108
79139
|
copyFiles: {
|
|
79109
79140
|
path: "./templates"
|
|
79110
79141
|
},
|
|
79142
|
+
path: "templates/analog",
|
|
79111
79143
|
generate,
|
|
79112
79144
|
configure,
|
|
79113
79145
|
transformPackageJson: async () => ({
|
|
79114
79146
|
scripts: {
|
|
79115
|
-
preview: `${npm} run build && wrangler
|
|
79116
|
-
deploy: `${npm} run build && wrangler
|
|
79147
|
+
preview: `${npm} run build && wrangler dev`,
|
|
79148
|
+
deploy: `${npm} run build && wrangler deploy`,
|
|
79117
79149
|
"cf-typegen": `wrangler types`
|
|
79118
79150
|
}
|
|
79119
79151
|
}),
|
|
@@ -79124,7 +79156,7 @@ var config = {
|
|
|
79124
79156
|
var c3_default = config;
|
|
79125
79157
|
|
|
79126
79158
|
// templates/angular/pages/c3.ts
|
|
79127
|
-
var
|
|
79159
|
+
var import_node_path8 = require("node:path");
|
|
79128
79160
|
var { npm: npm2 } = detectPackageManager();
|
|
79129
79161
|
var generate2 = async (ctx) => {
|
|
79130
79162
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -79146,23 +79178,23 @@ async function updateAppCode() {
|
|
|
79146
79178
|
const s = spinner();
|
|
79147
79179
|
s.start(`Updating application code`);
|
|
79148
79180
|
const appConfigPath = "src/app/app.config.ts";
|
|
79149
|
-
const appConfig = readFile((0,
|
|
79181
|
+
const appConfig = readFile((0, import_node_path8.resolve)(appConfigPath));
|
|
79150
79182
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
79151
79183
|
"providers: [",
|
|
79152
79184
|
"providers: [provideHttpClient(withFetch()), "
|
|
79153
79185
|
);
|
|
79154
|
-
writeFile2((0,
|
|
79186
|
+
writeFile2((0, import_node_path8.resolve)(appConfigPath), newAppConfig);
|
|
79155
79187
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
79156
79188
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
79157
|
-
const appRoutes = readFile((0,
|
|
79189
|
+
const appRoutes = readFile((0, import_node_path8.resolve)(appServerRoutesPath));
|
|
79158
79190
|
const newAppRoutes = appRoutes.replace(
|
|
79159
79191
|
"RenderMode.Prerender",
|
|
79160
79192
|
"RenderMode.Server"
|
|
79161
79193
|
);
|
|
79162
|
-
writeFile2((0,
|
|
79194
|
+
writeFile2((0, import_node_path8.resolve)(appServerRoutesPath), newAppRoutes);
|
|
79163
79195
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
79164
79196
|
s.start(`Updating package.json`);
|
|
79165
|
-
const packageJsonPath = (0,
|
|
79197
|
+
const packageJsonPath = (0, import_node_path8.resolve)("package.json");
|
|
79166
79198
|
const packageManifest = readJSON(packageJsonPath);
|
|
79167
79199
|
delete packageManifest["dependencies"]?.["express"];
|
|
79168
79200
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -79178,7 +79210,7 @@ function updateAngularJson(ctx) {
|
|
|
79178
79210
|
architectSection.build.options.outputMode = "server";
|
|
79179
79211
|
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
79180
79212
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
79181
|
-
writeFile2((0,
|
|
79213
|
+
writeFile2((0, import_node_path8.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
79182
79214
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
79183
79215
|
}
|
|
79184
79216
|
var config2 = {
|
|
@@ -79210,7 +79242,7 @@ var config2 = {
|
|
|
79210
79242
|
var c3_default2 = config2;
|
|
79211
79243
|
|
|
79212
79244
|
// templates/angular/workers/c3.ts
|
|
79213
|
-
var
|
|
79245
|
+
var import_node_path9 = require("node:path");
|
|
79214
79246
|
var { npm: npm3 } = detectPackageManager();
|
|
79215
79247
|
var generate3 = async (ctx) => {
|
|
79216
79248
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -79232,23 +79264,23 @@ async function updateAppCode2() {
|
|
|
79232
79264
|
const s = spinner();
|
|
79233
79265
|
s.start(`Updating application code`);
|
|
79234
79266
|
const appConfigPath = "src/app/app.config.ts";
|
|
79235
|
-
const appConfig = readFile((0,
|
|
79267
|
+
const appConfig = readFile((0, import_node_path9.resolve)(appConfigPath));
|
|
79236
79268
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
79237
79269
|
"providers: [",
|
|
79238
79270
|
"providers: [provideHttpClient(withFetch()), "
|
|
79239
79271
|
);
|
|
79240
|
-
writeFile2((0,
|
|
79272
|
+
writeFile2((0, import_node_path9.resolve)(appConfigPath), newAppConfig);
|
|
79241
79273
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
79242
79274
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
79243
|
-
const appRoutes = readFile((0,
|
|
79275
|
+
const appRoutes = readFile((0, import_node_path9.resolve)(appServerRoutesPath));
|
|
79244
79276
|
const newAppRoutes = appRoutes.replace(
|
|
79245
79277
|
"RenderMode.Prerender",
|
|
79246
79278
|
"RenderMode.Server"
|
|
79247
79279
|
);
|
|
79248
|
-
writeFile2((0,
|
|
79280
|
+
writeFile2((0, import_node_path9.resolve)(appServerRoutesPath), newAppRoutes);
|
|
79249
79281
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
79250
79282
|
s.start(`Updating package.json`);
|
|
79251
|
-
const packageJsonPath = (0,
|
|
79283
|
+
const packageJsonPath = (0, import_node_path9.resolve)("package.json");
|
|
79252
79284
|
const packageManifest = readJSON(packageJsonPath);
|
|
79253
79285
|
delete packageManifest["dependencies"]?.["express"];
|
|
79254
79286
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -79258,12 +79290,12 @@ async function updateAppCode2() {
|
|
|
79258
79290
|
function updateAngularJson2(ctx) {
|
|
79259
79291
|
const s = spinner();
|
|
79260
79292
|
s.start(`Updating angular.json config`);
|
|
79261
|
-
const angularJson = readJSON((0,
|
|
79293
|
+
const angularJson = readJSON((0, import_node_path9.resolve)("angular.json"));
|
|
79262
79294
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
79263
79295
|
architectSection.build.options.outputPath = "dist";
|
|
79264
79296
|
architectSection.build.options.outputMode = "server";
|
|
79265
79297
|
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
79266
|
-
writeFile2((0,
|
|
79298
|
+
writeFile2((0, import_node_path9.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
79267
79299
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
79268
79300
|
}
|
|
79269
79301
|
var config3 = {
|
|
@@ -79759,24 +79791,12 @@ var c3_default19 = {
|
|
|
79759
79791
|
};
|
|
79760
79792
|
|
|
79761
79793
|
// templates/hello-world/c3.ts
|
|
79762
|
-
var import_promises2 = require("node:fs/promises");
|
|
79763
|
-
var import_node_path9 = require("node:path");
|
|
79764
79794
|
var c3_default20 = {
|
|
79765
79795
|
configVersion: 1,
|
|
79766
79796
|
id: "hello-world",
|
|
79767
79797
|
displayName: "Worker only",
|
|
79768
79798
|
description: "For processing requests, transforming responses, or API endpoints",
|
|
79769
79799
|
platform: "workers",
|
|
79770
|
-
async configure(ctx) {
|
|
79771
|
-
if (ctx.args.lang === "python") {
|
|
79772
|
-
const contents = await (0, import_promises2.readFile)(
|
|
79773
|
-
(0, import_node_path9.resolve)(ctx.project.path, "pyproject.toml"),
|
|
79774
|
-
"utf8"
|
|
79775
|
-
);
|
|
79776
|
-
const updated = contents.replaceAll(/<TBD>/g, ctx.project.name);
|
|
79777
|
-
await (0, import_promises2.writeFile)((0, import_node_path9.resolve)(ctx.project.path, "pyproject.toml"), updated);
|
|
79778
|
-
}
|
|
79779
|
-
},
|
|
79780
79800
|
copyFiles: {
|
|
79781
79801
|
variants: {
|
|
79782
79802
|
js: {
|
|
@@ -79794,14 +79814,14 @@ var c3_default20 = {
|
|
|
79794
79814
|
|
|
79795
79815
|
// templates/hono/pages/c3.ts
|
|
79796
79816
|
var generate10 = async (ctx) => {
|
|
79797
|
-
const { name:
|
|
79817
|
+
const { name: pm3 } = detectPackageManager();
|
|
79798
79818
|
await runFrameworkGenerator(ctx, [
|
|
79799
79819
|
ctx.project.name,
|
|
79800
79820
|
"--template",
|
|
79801
79821
|
"cloudflare-pages",
|
|
79802
79822
|
"--install",
|
|
79803
79823
|
"--pm",
|
|
79804
|
-
|
|
79824
|
+
pm3
|
|
79805
79825
|
]);
|
|
79806
79826
|
logRaw("");
|
|
79807
79827
|
};
|
|
@@ -79833,14 +79853,14 @@ var c3_default21 = config19;
|
|
|
79833
79853
|
|
|
79834
79854
|
// templates/hono/workers/c3.ts
|
|
79835
79855
|
var generate11 = async (ctx) => {
|
|
79836
|
-
const { name:
|
|
79856
|
+
const { name: pm3 } = detectPackageManager();
|
|
79837
79857
|
await runFrameworkGenerator(ctx, [
|
|
79838
79858
|
ctx.project.name,
|
|
79839
79859
|
"--template",
|
|
79840
79860
|
"cloudflare-workers",
|
|
79841
79861
|
"--install",
|
|
79842
79862
|
"--pm",
|
|
79843
|
-
|
|
79863
|
+
pm3
|
|
79844
79864
|
]);
|
|
79845
79865
|
logRaw("");
|
|
79846
79866
|
};
|
|
@@ -79877,16 +79897,11 @@ var c3_default23 = config21;
|
|
|
79877
79897
|
|
|
79878
79898
|
// templates/next/c3.ts
|
|
79879
79899
|
var generate12 = async (ctx) => {
|
|
79880
|
-
|
|
79881
|
-
|
|
79882
|
-
|
|
79883
|
-
|
|
79884
|
-
|
|
79885
|
-
// This is a template maintained by Cloudflare that based on a standard Next.js starter project,
|
|
79886
|
-
// and has already been configured to work with Cloudflare Workers
|
|
79887
|
-
"--example",
|
|
79888
|
-
"https://github.com/opennextjs/opennextjs-cloudflare/tree/main/create-cloudflare/next"
|
|
79889
|
-
]);
|
|
79900
|
+
const repoUrl = "https://github.com/opennextjs/opennextjs-cloudflare/tree/main/create-cloudflare/next";
|
|
79901
|
+
await downloadRemoteTemplate(repoUrl, {
|
|
79902
|
+
intoFolder: ctx.project.path
|
|
79903
|
+
});
|
|
79904
|
+
await updatePackageName(ctx);
|
|
79890
79905
|
};
|
|
79891
79906
|
var envInterfaceName3 = "CloudflareEnv";
|
|
79892
79907
|
var typesPath = "./cloudflare-env.d.ts";
|
|
@@ -79896,17 +79911,7 @@ var c3_default24 = {
|
|
|
79896
79911
|
frameworkCli: "create-next-app",
|
|
79897
79912
|
platform: "workers",
|
|
79898
79913
|
displayName: "Next.js",
|
|
79899
|
-
copyFiles: {
|
|
79900
|
-
path: "./templates"
|
|
79901
|
-
},
|
|
79902
79914
|
generate: generate12,
|
|
79903
|
-
transformPackageJson: async () => ({
|
|
79904
|
-
scripts: {
|
|
79905
|
-
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
79906
|
-
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
79907
|
-
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
79908
|
-
}
|
|
79909
|
-
}),
|
|
79910
79915
|
devScript: "dev",
|
|
79911
79916
|
previewScript: "preview",
|
|
79912
79917
|
deployScript: "deploy",
|
|
@@ -79916,7 +79921,7 @@ var c3_default24 = {
|
|
|
79916
79921
|
|
|
79917
79922
|
// templates/nuxt/pages/c3.ts
|
|
79918
79923
|
var recast5 = __toESM(require_main2());
|
|
79919
|
-
var { npm: npm8, name:
|
|
79924
|
+
var { npm: npm8, name: pm } = detectPackageManager();
|
|
79920
79925
|
var generate13 = async (ctx) => {
|
|
79921
79926
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
79922
79927
|
await runFrameworkGenerator(ctx, [
|
|
@@ -79932,7 +79937,7 @@ var generate13 = async (ctx) => {
|
|
|
79932
79937
|
};
|
|
79933
79938
|
var configure6 = async () => {
|
|
79934
79939
|
const packages = ["nitro-cloudflare-dev"];
|
|
79935
|
-
if (
|
|
79940
|
+
if (pm === "pnpm") {
|
|
79936
79941
|
packages.push("h3");
|
|
79937
79942
|
}
|
|
79938
79943
|
await installPackages(packages, {
|
|
@@ -80012,7 +80017,7 @@ var c3_default25 = config22;
|
|
|
80012
80017
|
|
|
80013
80018
|
// templates/nuxt/workers/c3.ts
|
|
80014
80019
|
var recast6 = __toESM(require_main2());
|
|
80015
|
-
var { npm: npm9, name:
|
|
80020
|
+
var { npm: npm9, name: pm2 } = detectPackageManager();
|
|
80016
80021
|
var generate14 = async (ctx) => {
|
|
80017
80022
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
80018
80023
|
await runFrameworkGenerator(ctx, [
|
|
@@ -80028,7 +80033,7 @@ var generate14 = async (ctx) => {
|
|
|
80028
80033
|
};
|
|
80029
80034
|
var configure7 = async () => {
|
|
80030
80035
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
80031
|
-
if (
|
|
80036
|
+
if (pm2 === "pnpm") {
|
|
80032
80037
|
packages.push("h3");
|
|
80033
80038
|
}
|
|
80034
80039
|
await installPackages(packages, {
|
|
@@ -80126,8 +80131,8 @@ var config25 = {
|
|
|
80126
80131
|
var c3_default28 = config25;
|
|
80127
80132
|
|
|
80128
80133
|
// templates/pre-existing/c3.ts
|
|
80129
|
-
var
|
|
80130
|
-
var
|
|
80134
|
+
var import_node_fs8 = require("node:fs");
|
|
80135
|
+
var import_promises2 = require("node:fs/promises");
|
|
80131
80136
|
var import_node_os4 = require("node:os");
|
|
80132
80137
|
var import_node_path10 = require("node:path");
|
|
80133
80138
|
|
|
@@ -80242,7 +80247,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80242
80247
|
}
|
|
80243
80248
|
);
|
|
80244
80249
|
}
|
|
80245
|
-
const tempdir = await (0,
|
|
80250
|
+
const tempdir = await (0, import_promises2.mkdtemp)((0, import_node_path10.join)((0, import_node_os4.tmpdir)(), "c3-wrangler-init--from-dash-"));
|
|
80246
80251
|
await runCommand(
|
|
80247
80252
|
[
|
|
80248
80253
|
...dlx,
|
|
@@ -80264,7 +80269,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80264
80269
|
)}`
|
|
80265
80270
|
}
|
|
80266
80271
|
);
|
|
80267
|
-
await (0,
|
|
80272
|
+
await (0, import_promises2.cp)(
|
|
80268
80273
|
(0, import_node_path10.join)(tempdir, ctx.args.existingScript, "src"),
|
|
80269
80274
|
(0, import_node_path10.join)(ctx.project.path, "src"),
|
|
80270
80275
|
{ recursive: true }
|
|
@@ -80273,8 +80278,8 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80273
80278
|
let configFileCopied = false;
|
|
80274
80279
|
for (const configFile of configFiles) {
|
|
80275
80280
|
const sourcePath = (0, import_node_path10.join)(tempdir, ctx.args.existingScript, configFile);
|
|
80276
|
-
if ((0,
|
|
80277
|
-
await (0,
|
|
80281
|
+
if ((0, import_node_fs8.existsSync)(sourcePath)) {
|
|
80282
|
+
await (0, import_promises2.cp)(sourcePath, (0, import_node_path10.join)(ctx.project.path, configFile));
|
|
80278
80283
|
configFileCopied = true;
|
|
80279
80284
|
break;
|
|
80280
80285
|
}
|
|
@@ -80806,54 +80811,6 @@ var config36 = {
|
|
|
80806
80811
|
};
|
|
80807
80812
|
var c3_default39 = config36;
|
|
80808
80813
|
|
|
80809
|
-
// src/helpers/compatDate.ts
|
|
80810
|
-
var import_node_fs8 = require("node:fs");
|
|
80811
|
-
var import_node_path11 = require("node:path");
|
|
80812
|
-
async function getWorkerdCompatibilityDate() {
|
|
80813
|
-
const s = spinner();
|
|
80814
|
-
s.start("Retrieving current workerd compatibility date");
|
|
80815
|
-
try {
|
|
80816
|
-
const latestWorkerdVersion = await getLatestPackageVersion("workerd");
|
|
80817
|
-
const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
80818
|
-
if (match) {
|
|
80819
|
-
const [, year, month, date] = match;
|
|
80820
|
-
let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
|
|
80821
|
-
if (compatDate.getTime() > Date.now()) {
|
|
80822
|
-
compatDate = new Date(Date.now());
|
|
80823
|
-
}
|
|
80824
|
-
const compatDateString = compatDate.toISOString().slice(0, 10);
|
|
80825
|
-
s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
|
|
80826
|
-
return compatDateString;
|
|
80827
|
-
}
|
|
80828
|
-
} catch {
|
|
80829
|
-
}
|
|
80830
|
-
const fallbackDate = "2024-11-11";
|
|
80831
|
-
s.stop(
|
|
80832
|
-
`${brandColor("compatibility date")} ${dim(
|
|
80833
|
-
` Could not find workerd date, falling back to ${fallbackDate}`
|
|
80834
|
-
)}`
|
|
80835
|
-
);
|
|
80836
|
-
return fallbackDate;
|
|
80837
|
-
}
|
|
80838
|
-
function getLatestTypesEntrypoint(ctx) {
|
|
80839
|
-
const workersTypesPath = (0, import_node_path11.resolve)(
|
|
80840
|
-
ctx.project.path,
|
|
80841
|
-
"node_modules",
|
|
80842
|
-
"@cloudflare",
|
|
80843
|
-
"workers-types"
|
|
80844
|
-
);
|
|
80845
|
-
try {
|
|
80846
|
-
const entrypoints = (0, import_node_fs8.readdirSync)(workersTypesPath);
|
|
80847
|
-
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
80848
|
-
if (sorted.length === 0) {
|
|
80849
|
-
return null;
|
|
80850
|
-
}
|
|
80851
|
-
return sorted[0];
|
|
80852
|
-
} catch {
|
|
80853
|
-
return null;
|
|
80854
|
-
}
|
|
80855
|
-
}
|
|
80856
|
-
|
|
80857
80814
|
// templates/solid/c3.ts
|
|
80858
80815
|
var recast10 = __toESM(require_main2());
|
|
80859
80816
|
var { npm: npm16 } = detectPackageManager();
|
|
@@ -81352,7 +81309,7 @@ var c3_default49 = config46;
|
|
|
81352
81309
|
var import_node_assert4 = __toESM(require("node:assert"));
|
|
81353
81310
|
|
|
81354
81311
|
// ../wrangler/package.json
|
|
81355
|
-
var version2 = "4.
|
|
81312
|
+
var version2 = "4.54.0";
|
|
81356
81313
|
|
|
81357
81314
|
// src/git.ts
|
|
81358
81315
|
var offerGit = async (ctx) => {
|
|
@@ -81531,7 +81488,7 @@ async function getProductionBranch(cwd) {
|
|
|
81531
81488
|
|
|
81532
81489
|
// src/validators.ts
|
|
81533
81490
|
var import_node_fs10 = require("node:fs");
|
|
81534
|
-
var
|
|
81491
|
+
var import_node_path11 = require("node:path");
|
|
81535
81492
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
81536
81493
|
var validateTemplateUrl = (value) => {
|
|
81537
81494
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -81539,7 +81496,7 @@ var validateTemplateUrl = (value) => {
|
|
|
81539
81496
|
}
|
|
81540
81497
|
};
|
|
81541
81498
|
var validateProjectDirectory = (relativePath, args) => {
|
|
81542
|
-
const path6 = (0,
|
|
81499
|
+
const path6 = (0, import_node_path11.resolve)(relativePath);
|
|
81543
81500
|
const existsAlready = (0, import_node_fs10.existsSync)(path6);
|
|
81544
81501
|
if (existsAlready) {
|
|
81545
81502
|
for (const file of (0, import_node_fs10.readdirSync)(path6)) {
|
|
@@ -81549,7 +81506,7 @@ var validateProjectDirectory = (relativePath, args) => {
|
|
|
81549
81506
|
}
|
|
81550
81507
|
}
|
|
81551
81508
|
if (!args.existingScript) {
|
|
81552
|
-
const projectName = (0,
|
|
81509
|
+
const projectName = (0, import_node_path11.basename)(path6);
|
|
81553
81510
|
const invalidChars = /[^a-z0-9-]/;
|
|
81554
81511
|
const invalidStartEnd = /^-|-$/;
|
|
81555
81512
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -81636,6 +81593,7 @@ var filterTemplatesByLanguage = (templates, lang) => {
|
|
|
81636
81593
|
function getFrameworkMap({ experimental = false }) {
|
|
81637
81594
|
if (experimental) {
|
|
81638
81595
|
return {
|
|
81596
|
+
analog: c3_default,
|
|
81639
81597
|
angular: c3_default4,
|
|
81640
81598
|
astro: c3_default7,
|
|
81641
81599
|
docusaurus: c3_default11,
|
|
@@ -81644,6 +81602,7 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
81644
81602
|
qwik: c3_default33,
|
|
81645
81603
|
react: c3_default37,
|
|
81646
81604
|
"react-router": c3_default34,
|
|
81605
|
+
redwood: c3_default38,
|
|
81647
81606
|
solid: c3_default40,
|
|
81648
81607
|
svelte: c3_default43,
|
|
81649
81608
|
"tanstack-start": c3_default44,
|
|
@@ -81984,7 +81943,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
81984
81943
|
envInterfaceName: "Env",
|
|
81985
81944
|
...template
|
|
81986
81945
|
};
|
|
81987
|
-
const path6 = (0,
|
|
81946
|
+
const path6 = (0, import_node_path12.resolve)(projectName);
|
|
81988
81947
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
81989
81948
|
if (languageVariants.length > 0) {
|
|
81990
81949
|
if (hasTsConfig(path6)) {
|
|
@@ -82010,8 +81969,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
82010
81969
|
}
|
|
82011
81970
|
}
|
|
82012
81971
|
}
|
|
82013
|
-
const name3 = (0,
|
|
82014
|
-
const directory = (0,
|
|
81972
|
+
const name3 = (0, import_node_path12.basename)(path6);
|
|
81973
|
+
const directory = (0, import_node_path12.dirname)(path6);
|
|
82015
81974
|
const originalCWD = process.cwd();
|
|
82016
81975
|
return {
|
|
82017
81976
|
project: { name: name3, path: path6 },
|
|
@@ -82031,7 +81990,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
82031
81990
|
const { copyFiles } = ctx.template;
|
|
82032
81991
|
let srcdir;
|
|
82033
81992
|
if (isVariantInfo(copyFiles)) {
|
|
82034
|
-
srcdir = (0,
|
|
81993
|
+
srcdir = (0, import_node_path12.join)(getTemplatePath(ctx), copyFiles.path);
|
|
82035
81994
|
} else {
|
|
82036
81995
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
82037
81996
|
const variant = await selectVariant(ctx);
|
|
@@ -82041,16 +82000,16 @@ async function copyTemplateFiles(ctx) {
|
|
|
82041
82000
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
82042
82001
|
);
|
|
82043
82002
|
}
|
|
82044
|
-
srcdir = (0,
|
|
82003
|
+
srcdir = (0, import_node_path12.join)(getTemplatePath(ctx), variantInfo.path);
|
|
82045
82004
|
}
|
|
82046
82005
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
82047
|
-
const destdir = (0,
|
|
82006
|
+
const destdir = (0, import_node_path12.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
82048
82007
|
const s = spinner();
|
|
82049
82008
|
s.start(`Copying template files`);
|
|
82050
|
-
await (0,
|
|
82051
|
-
const dummyGitIgnorePath = (0,
|
|
82009
|
+
await (0, import_promises3.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
82010
|
+
const dummyGitIgnorePath = (0, import_node_path12.join)(destdir, "__dot__gitignore");
|
|
82052
82011
|
if ((0, import_node_fs11.existsSync)(dummyGitIgnorePath)) {
|
|
82053
|
-
await (0,
|
|
82012
|
+
await (0, import_promises3.rename)(dummyGitIgnorePath, (0, import_node_path12.join)(destdir, ".gitignore"));
|
|
82054
82013
|
}
|
|
82055
82014
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
82056
82015
|
}
|
|
@@ -82062,11 +82021,9 @@ var processRemoteTemplate = async (args) => {
|
|
|
82062
82021
|
validate: (val) => validateTemplateUrl(val || C3_DEFAULTS.template),
|
|
82063
82022
|
defaultValue: C3_DEFAULTS.template
|
|
82064
82023
|
});
|
|
82065
|
-
|
|
82066
|
-
|
|
82067
|
-
|
|
82068
|
-
}
|
|
82069
|
-
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
82024
|
+
const path6 = await downloadRemoteTemplate(templateUrl, {
|
|
82025
|
+
mode: args.templateMode
|
|
82026
|
+
});
|
|
82070
82027
|
const config47 = inferTemplateConfig(path6);
|
|
82071
82028
|
validateTemplate(path6, config47);
|
|
82072
82029
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
@@ -82080,25 +82037,25 @@ var validateTemplate = (path6, config47) => {
|
|
|
82080
82037
|
return;
|
|
82081
82038
|
}
|
|
82082
82039
|
if (isVariantInfo(config47.copyFiles)) {
|
|
82083
|
-
validateTemplateSrcDirectory((0,
|
|
82040
|
+
validateTemplateSrcDirectory((0, import_node_path12.resolve)(path6, config47.copyFiles.path), config47);
|
|
82084
82041
|
} else {
|
|
82085
82042
|
for (const variant of Object.values(config47.copyFiles.variants)) {
|
|
82086
|
-
validateTemplateSrcDirectory((0,
|
|
82043
|
+
validateTemplateSrcDirectory((0, import_node_path12.resolve)(path6, variant.path), config47);
|
|
82087
82044
|
}
|
|
82088
82045
|
}
|
|
82089
82046
|
};
|
|
82090
82047
|
var validateTemplateSrcDirectory = (path6, config47) => {
|
|
82091
82048
|
if (config47.platform === "workers") {
|
|
82092
|
-
const wranglerTomlPath = (0,
|
|
82093
|
-
const wranglerJsonPath = (0,
|
|
82094
|
-
const wranglerJsoncPath = (0,
|
|
82049
|
+
const wranglerTomlPath = (0, import_node_path12.resolve)(path6, "wrangler.toml");
|
|
82050
|
+
const wranglerJsonPath = (0, import_node_path12.resolve)(path6, "wrangler.json");
|
|
82051
|
+
const wranglerJsoncPath = (0, import_node_path12.resolve)(path6, "wrangler.jsonc");
|
|
82095
82052
|
if (!(0, import_node_fs11.existsSync)(wranglerTomlPath) && !(0, import_node_fs11.existsSync)(wranglerJsonPath) && !(0, import_node_fs11.existsSync)(wranglerJsoncPath)) {
|
|
82096
82053
|
throw new Error(
|
|
82097
82054
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
82098
82055
|
);
|
|
82099
82056
|
}
|
|
82100
82057
|
}
|
|
82101
|
-
const pkgJsonPath = (0,
|
|
82058
|
+
const pkgJsonPath = (0, import_node_path12.resolve)(path6, "package.json");
|
|
82102
82059
|
if (!(0, import_node_fs11.existsSync)(pkgJsonPath)) {
|
|
82103
82060
|
throw new Error(
|
|
82104
82061
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
@@ -82116,50 +82073,50 @@ var inferTemplateConfig = (path6) => {
|
|
|
82116
82073
|
};
|
|
82117
82074
|
var inferCopyFilesDefinition = (path6) => {
|
|
82118
82075
|
const variants = {};
|
|
82119
|
-
if ((0, import_node_fs11.existsSync)((0,
|
|
82076
|
+
if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(path6, "js"))) {
|
|
82120
82077
|
variants["js"] = { path: "./js" };
|
|
82121
82078
|
}
|
|
82122
|
-
if ((0, import_node_fs11.existsSync)((0,
|
|
82079
|
+
if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(path6, "ts"))) {
|
|
82123
82080
|
variants["ts"] = { path: "./ts" };
|
|
82124
82081
|
}
|
|
82125
82082
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
82126
82083
|
return copyFiles;
|
|
82127
82084
|
};
|
|
82128
|
-
|
|
82085
|
+
async function downloadRemoteTemplate(src, options = {}) {
|
|
82129
82086
|
try {
|
|
82130
82087
|
updateStatus(`Cloning template from: ${blue(src)}`);
|
|
82088
|
+
if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
|
|
82089
|
+
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
82090
|
+
}
|
|
82131
82091
|
const emitter = (0, import_degit.default)(src, {
|
|
82132
82092
|
cache: false,
|
|
82133
82093
|
verbose: false,
|
|
82134
82094
|
force: true,
|
|
82135
|
-
mode
|
|
82095
|
+
mode: options.mode
|
|
82136
82096
|
});
|
|
82137
|
-
const tmpDir = await (0,
|
|
82097
|
+
const tmpDir = options.intoFolder ?? await (0, import_promises3.mkdtemp)((0, import_node_path12.join)((0, import_node_os5.tmpdir)(), "c3-template"));
|
|
82138
82098
|
await emitter.clone(tmpDir);
|
|
82139
82099
|
return tmpDir;
|
|
82140
82100
|
} catch {
|
|
82141
82101
|
updateStatus(`${brandColor("template")} ${dim("failed")}`);
|
|
82142
82102
|
throw new Error(`Failed to clone remote template: ${src}`);
|
|
82143
82103
|
}
|
|
82144
|
-
}
|
|
82104
|
+
}
|
|
82145
82105
|
function updatePythonPackageName(path6, projectName) {
|
|
82146
|
-
const
|
|
82147
|
-
if (!(0, import_node_fs11.existsSync)(
|
|
82106
|
+
const pyProjectFile = (0, import_node_path12.resolve)(path6, "pyproject.toml");
|
|
82107
|
+
if (!(0, import_node_fs11.existsSync)(pyProjectFile)) {
|
|
82148
82108
|
return;
|
|
82149
82109
|
}
|
|
82150
82110
|
const s = spinner();
|
|
82151
82111
|
s.start("Updating name in `pyproject.toml`");
|
|
82152
|
-
let
|
|
82153
|
-
|
|
82154
|
-
|
|
82155
|
-
`"${projectName}"`
|
|
82156
|
-
);
|
|
82157
|
-
writeFile2(pyprojectTomlPath, pyprojectTomlContents);
|
|
82112
|
+
let pyProject = readFile(pyProjectFile);
|
|
82113
|
+
pyProject = pyProject.replace('"TBD"', `"${projectName}"`).replace('"<PROJECT_NAME>"', `"${projectName}"`);
|
|
82114
|
+
writeFile2(pyProjectFile, pyProject);
|
|
82158
82115
|
s.stop(`${brandColor("updated")} ${dim("`pyproject.toml`")}`);
|
|
82159
82116
|
}
|
|
82160
|
-
var updatePackageName =
|
|
82161
|
-
const placeholderNames = ["<TBD>", "TBD", ""];
|
|
82162
|
-
const pkgJsonPath = (0,
|
|
82117
|
+
var updatePackageName = (ctx) => {
|
|
82118
|
+
const placeholderNames = ["<PACKAGE_NAME>", "<TBD>", "TBD", ""];
|
|
82119
|
+
const pkgJsonPath = (0, import_node_path12.resolve)(ctx.project.path, "package.json");
|
|
82163
82120
|
const pkgJson = readJSON(pkgJsonPath);
|
|
82164
82121
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
82165
82122
|
return;
|
|
@@ -82177,7 +82134,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
82177
82134
|
}
|
|
82178
82135
|
const s = spinner();
|
|
82179
82136
|
s.start("Updating `package.json` scripts");
|
|
82180
|
-
const pkgJsonPath = (0,
|
|
82137
|
+
const pkgJsonPath = (0, import_node_path12.resolve)(ctx.project.path, "package.json");
|
|
82181
82138
|
let pkgJson = readJSON(pkgJsonPath);
|
|
82182
82139
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
82183
82140
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -82186,9 +82143,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
82186
82143
|
};
|
|
82187
82144
|
var getTemplatePath = (ctx) => {
|
|
82188
82145
|
if (ctx.template.path) {
|
|
82189
|
-
return (0,
|
|
82146
|
+
return (0, import_node_path12.resolve)(__dirname, "..", ctx.template.path);
|
|
82190
82147
|
}
|
|
82191
|
-
return (0,
|
|
82148
|
+
return (0, import_node_path12.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
82192
82149
|
};
|
|
82193
82150
|
var isVariantInfo = (copyFiles) => {
|
|
82194
82151
|
return "path" in copyFiles;
|
|
@@ -82339,8 +82296,8 @@ var cliDefinition = {
|
|
|
82339
82296
|
|
|
82340
82297
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
82341
82298
|
|
|
82342
|
-
npm create cloudflare -- --framework
|
|
82343
|
-
pnpm create cloudflare --framework
|
|
82299
|
+
npm create cloudflare -- --framework svelte -- --types=ts
|
|
82300
|
+
pnpm create cloudflare --framework svelte -- --types=ts
|
|
82344
82301
|
`,
|
|
82345
82302
|
values: (args) => getNamesAndDescriptions(
|
|
82346
82303
|
getFrameworkMap({
|
|
@@ -82605,12 +82562,12 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
82605
82562
|
};
|
|
82606
82563
|
|
|
82607
82564
|
// src/deploy.ts
|
|
82608
|
-
var
|
|
82565
|
+
var import_promises5 = require("node:fs/promises");
|
|
82609
82566
|
var import_node_os6 = require("node:os");
|
|
82610
|
-
var
|
|
82567
|
+
var import_node_path14 = require("node:path");
|
|
82611
82568
|
|
|
82612
82569
|
// src/helpers/poll.ts
|
|
82613
|
-
var
|
|
82570
|
+
var import_promises4 = require("node:timers/promises");
|
|
82614
82571
|
var import_dns2 = __toESM(require_dns22());
|
|
82615
82572
|
var import_undici3 = __toESM(require_undici());
|
|
82616
82573
|
var TIMEOUT_MS = 1e3 * 60 * 5;
|
|
@@ -82620,7 +82577,7 @@ var poll = async (url) => {
|
|
|
82620
82577
|
const domain = new URL(url).host;
|
|
82621
82578
|
const s = spinner();
|
|
82622
82579
|
s.start("Waiting for DNS to propagate. This might take a few minutes.");
|
|
82623
|
-
await (0,
|
|
82580
|
+
await (0, import_promises4.setTimeout)(1e4);
|
|
82624
82581
|
await pollDns(domain, start, s);
|
|
82625
82582
|
if (await pollHttp(url, start, s)) {
|
|
82626
82583
|
return true;
|
|
@@ -82641,7 +82598,7 @@ var pollDns = async (domain, start, s) => {
|
|
|
82641
82598
|
s.stop(`${brandColor("DNS propagation")} ${dim("complete")}.`);
|
|
82642
82599
|
return;
|
|
82643
82600
|
}
|
|
82644
|
-
await (0,
|
|
82601
|
+
await (0, import_promises4.setTimeout)(POLL_INTERVAL_MS);
|
|
82645
82602
|
}
|
|
82646
82603
|
};
|
|
82647
82604
|
var pollHttp = async (url, start, s) => {
|
|
@@ -82666,7 +82623,7 @@ var pollHttp = async (url, start, s) => {
|
|
|
82666
82623
|
throw e;
|
|
82667
82624
|
}
|
|
82668
82625
|
}
|
|
82669
|
-
await (0,
|
|
82626
|
+
await (0, import_promises4.setTimeout)(POLL_INTERVAL_MS);
|
|
82670
82627
|
}
|
|
82671
82628
|
};
|
|
82672
82629
|
var isDomainResolvable = async (domain) => {
|
|
@@ -82700,13 +82657,13 @@ function secondsSince(start) {
|
|
|
82700
82657
|
|
|
82701
82658
|
// src/wrangler/config.ts
|
|
82702
82659
|
var import_node_fs12 = require("node:fs");
|
|
82703
|
-
var
|
|
82660
|
+
var import_node_path13 = require("node:path");
|
|
82704
82661
|
|
|
82705
82662
|
// src/helpers/json.ts
|
|
82706
82663
|
var import_comment_json2 = __toESM(require_src3());
|
|
82707
|
-
function readJSONWithComments(jsonFilePath) {
|
|
82664
|
+
function readJSONWithComments(jsonFilePath, reviver) {
|
|
82708
82665
|
const jsonString = readFile(jsonFilePath);
|
|
82709
|
-
const jsonObject = (0, import_comment_json2.parse)(jsonString);
|
|
82666
|
+
const jsonObject = (0, import_comment_json2.parse)(jsonString, reviver);
|
|
82710
82667
|
return jsonObject;
|
|
82711
82668
|
}
|
|
82712
82669
|
function writeJSONWithComments(jsonFilePath, jsonObject) {
|
|
@@ -82741,8 +82698,15 @@ function insertJSONProperty(jsonObject, property, value) {
|
|
|
82741
82698
|
|
|
82742
82699
|
// src/wrangler/config.ts
|
|
82743
82700
|
var updateWranglerConfig = async (ctx) => {
|
|
82744
|
-
|
|
82745
|
-
|
|
82701
|
+
const substitutions = {
|
|
82702
|
+
"<WORKER_NAME>": ctx.project.name,
|
|
82703
|
+
"<COMPATIBILITY_DATE>": await getWorkerdCompatibilityDate()
|
|
82704
|
+
};
|
|
82705
|
+
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
82706
|
+
let wranglerJson = readWranglerJsonOrJsonc(
|
|
82707
|
+
ctx,
|
|
82708
|
+
(_key, value) => typeof value === "string" && value in substitutions ? substitutions[value] : value
|
|
82709
|
+
);
|
|
82746
82710
|
wranglerJson = insertJSONProperty(
|
|
82747
82711
|
wranglerJson,
|
|
82748
82712
|
"$schema",
|
|
@@ -82752,7 +82716,7 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82752
82716
|
wranglerJson = appendJSONProperty(
|
|
82753
82717
|
wranglerJson,
|
|
82754
82718
|
"compatibility_date",
|
|
82755
|
-
await getCompatibilityDate(wranglerJson)
|
|
82719
|
+
await getCompatibilityDate(wranglerJson.compatibility_date)
|
|
82756
82720
|
);
|
|
82757
82721
|
wranglerJson = appendJSONProperty(wranglerJson, "observability", {
|
|
82758
82722
|
enabled: true
|
|
@@ -82786,22 +82750,25 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82786
82750
|
value: ' "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]'
|
|
82787
82751
|
}
|
|
82788
82752
|
]);
|
|
82789
|
-
|
|
82753
|
+
writeWranglerJsonOrJsonc(ctx, wranglerJson);
|
|
82790
82754
|
addVscodeConfig(ctx);
|
|
82791
82755
|
} else if (wranglerTomlExists(ctx)) {
|
|
82792
|
-
|
|
82793
|
-
const
|
|
82794
|
-
|
|
82795
|
-
|
|
82796
|
-
|
|
82797
|
-
|
|
82798
|
-
|
|
82799
|
-
|
|
82800
|
-
|
|
82801
|
-
|
|
82756
|
+
let strToml = readWranglerToml(ctx);
|
|
82757
|
+
for (const [key, value] of Object.entries(substitutions)) {
|
|
82758
|
+
strToml = strToml.replaceAll(key, value);
|
|
82759
|
+
}
|
|
82760
|
+
const wranglerToml = dist_default.parse(strToml);
|
|
82761
|
+
wranglerToml.name = ctx.project.name;
|
|
82762
|
+
wranglerToml.compatibility_date = await getCompatibilityDate(
|
|
82763
|
+
wranglerToml.compatibility_date
|
|
82764
|
+
);
|
|
82765
|
+
wranglerToml.observability ??= { enabled: true };
|
|
82802
82766
|
writeWranglerToml(
|
|
82803
82767
|
ctx,
|
|
82804
|
-
|
|
82768
|
+
`#:schema node_modules/wrangler/config-schema.json
|
|
82769
|
+
# For more details on how to configure Wrangler, refer to:
|
|
82770
|
+
# https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
82771
|
+
${dist_default.stringify(wranglerToml)}
|
|
82805
82772
|
# Smart Placement
|
|
82806
82773
|
# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
|
82807
82774
|
# [placement]
|
|
@@ -82838,19 +82805,19 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82838
82805
|
}
|
|
82839
82806
|
};
|
|
82840
82807
|
var getWranglerTomlPath = (ctx) => {
|
|
82841
|
-
return (0,
|
|
82808
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.toml");
|
|
82842
82809
|
};
|
|
82843
82810
|
var getWranglerJsonPath = (ctx) => {
|
|
82844
|
-
return (0,
|
|
82811
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.json");
|
|
82845
82812
|
};
|
|
82846
82813
|
var getWranglerJsoncPath = (ctx) => {
|
|
82847
|
-
return (0,
|
|
82814
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
82848
82815
|
};
|
|
82849
82816
|
var wranglerTomlExists = (ctx) => {
|
|
82850
82817
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82851
82818
|
return (0, import_node_fs12.existsSync)(wranglerTomlPath);
|
|
82852
82819
|
};
|
|
82853
|
-
var
|
|
82820
|
+
var wranglerJsonOrJsoncExists = (ctx) => {
|
|
82854
82821
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82855
82822
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
82856
82823
|
return (0, import_node_fs12.existsSync)(wranglerJsonPath) || (0, import_node_fs12.existsSync)(wranglerJsoncPath);
|
|
@@ -82859,19 +82826,19 @@ var readWranglerToml = (ctx) => {
|
|
|
82859
82826
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82860
82827
|
return readFile(wranglerTomlPath);
|
|
82861
82828
|
};
|
|
82862
|
-
var
|
|
82829
|
+
var readWranglerJsonOrJsonc = (ctx, reviver) => {
|
|
82863
82830
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82864
82831
|
if ((0, import_node_fs12.existsSync)(wranglerJsonPath)) {
|
|
82865
|
-
return readJSONWithComments(wranglerJsonPath);
|
|
82832
|
+
return readJSONWithComments(wranglerJsonPath, reviver);
|
|
82866
82833
|
}
|
|
82867
82834
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
82868
|
-
return readJSONWithComments(wranglerJsoncPath);
|
|
82835
|
+
return readJSONWithComments(wranglerJsoncPath, reviver);
|
|
82869
82836
|
};
|
|
82870
82837
|
var writeWranglerToml = (ctx, contents) => {
|
|
82871
82838
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82872
82839
|
return writeFile2(wranglerTomlPath, contents);
|
|
82873
82840
|
};
|
|
82874
|
-
var
|
|
82841
|
+
var writeWranglerJsonOrJsonc = (ctx, config47) => {
|
|
82875
82842
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82876
82843
|
if ((0, import_node_fs12.existsSync)(wranglerJsonPath)) {
|
|
82877
82844
|
return writeJSONWithComments(wranglerJsonPath, config47);
|
|
@@ -82891,10 +82858,10 @@ var addVscodeConfig = (ctx) => {
|
|
|
82891
82858
|
}
|
|
82892
82859
|
});
|
|
82893
82860
|
};
|
|
82894
|
-
async function getCompatibilityDate(
|
|
82861
|
+
async function getCompatibilityDate(tentativeDate) {
|
|
82895
82862
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}$/m;
|
|
82896
|
-
if (typeof
|
|
82897
|
-
return
|
|
82863
|
+
if (typeof tentativeDate === "string" && tentativeDate.match(validCompatDateRe)) {
|
|
82864
|
+
return tentativeDate;
|
|
82898
82865
|
}
|
|
82899
82866
|
return await getWorkerdCompatibilityDate();
|
|
82900
82867
|
}
|
|
@@ -82941,14 +82908,14 @@ var isDeployable = async (ctx) => {
|
|
|
82941
82908
|
return !hasBinding(wranglerConfig);
|
|
82942
82909
|
};
|
|
82943
82910
|
var readWranglerConfig = (ctx) => {
|
|
82944
|
-
if (
|
|
82945
|
-
return
|
|
82911
|
+
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
82912
|
+
return readWranglerJsonOrJsonc(ctx);
|
|
82946
82913
|
}
|
|
82947
82914
|
const wranglerTomlStr = readWranglerToml(ctx);
|
|
82948
82915
|
return dist_default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
82949
82916
|
};
|
|
82950
82917
|
var runDeploy = async (ctx) => {
|
|
82951
|
-
const { npm: npm24, name:
|
|
82918
|
+
const { npm: npm24, name: pm3 } = detectPackageManager();
|
|
82952
82919
|
if (!ctx.account?.id) {
|
|
82953
82920
|
throw new Error("Failed to read Cloudflare account.");
|
|
82954
82921
|
}
|
|
@@ -82958,13 +82925,13 @@ var runDeploy = async (ctx) => {
|
|
|
82958
82925
|
...baseDeployCmd,
|
|
82959
82926
|
// Important: the following assumes that all framework deploy commands terminate with `wrangler pages deploy`
|
|
82960
82927
|
...ctx.template.platform === "pages" && ctx.commitMessage && !insideGitRepo ? [
|
|
82961
|
-
...
|
|
82928
|
+
...pm3 === "npm" ? ["--"] : [],
|
|
82962
82929
|
"--commit-message",
|
|
82963
82930
|
JSON.stringify(ctx.commitMessage)
|
|
82964
82931
|
] : []
|
|
82965
82932
|
];
|
|
82966
|
-
const outputFile = (0,
|
|
82967
|
-
await (0,
|
|
82933
|
+
const outputFile = (0, import_node_path14.join)(
|
|
82934
|
+
await (0, import_promises5.mkdtemp)((0, import_node_path14.join)((0, import_node_os6.tmpdir)(), "c3-wrangler-deploy-")),
|
|
82968
82935
|
"output.json"
|
|
82969
82936
|
);
|
|
82970
82937
|
await runCommand(deployCmd, {
|
|
@@ -83026,7 +82993,7 @@ var hasBinding = (node) => {
|
|
|
83026
82993
|
};
|
|
83027
82994
|
|
|
83028
82995
|
// src/dialog.ts
|
|
83029
|
-
var
|
|
82996
|
+
var import_node_path15 = require("node:path");
|
|
83030
82997
|
function createDialog(lines) {
|
|
83031
82998
|
const screenWidth = process.stdout.columns;
|
|
83032
82999
|
const maxLineWidth = Math.max(
|
|
@@ -83066,7 +83033,7 @@ function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
|
83066
83033
|
}
|
|
83067
83034
|
var printSummary = (ctx) => {
|
|
83068
83035
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
83069
|
-
const relativePath = (0,
|
|
83036
|
+
const relativePath = (0, import_node_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
83070
83037
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
83071
83038
|
const { npm: npm24 } = detectPackageManager();
|
|
83072
83039
|
const deployCommand = quoteShellArgs([
|
|
@@ -83364,15 +83331,15 @@ function wrapAnsi3(string, columns, options) {
|
|
|
83364
83331
|
var MAX_WIDTH = 100;
|
|
83365
83332
|
var PADDING_RIGHT = 5;
|
|
83366
83333
|
var showHelp = (args, { positionals, options, intro }) => {
|
|
83367
|
-
const { name:
|
|
83334
|
+
const { name: pm3 } = detectPackageManager();
|
|
83368
83335
|
logRaw(`${brandColor("create-cloudflare")} ${dim("v" + version)}
|
|
83369
83336
|
`);
|
|
83370
83337
|
indent(`${intro.trim()}
|
|
83371
83338
|
`, 1);
|
|
83372
83339
|
logRaw(bold("USAGE\n"));
|
|
83373
|
-
const latest =
|
|
83374
|
-
const opts =
|
|
83375
|
-
indent(`${
|
|
83340
|
+
const latest = pm3 === "yarn" ? "" : "@latest";
|
|
83341
|
+
const opts = pm3 === "npm" ? "-- options" : "options";
|
|
83342
|
+
indent(`${pm3} create cloudflare${latest} [directory] [${opts}]
|
|
83376
83343
|
`, 1);
|
|
83377
83344
|
logRaw(bold("OPTIONS\n"));
|
|
83378
83345
|
if (args?.experimental) {
|
|
@@ -83437,7 +83404,7 @@ var renderValues = (values) => {
|
|
|
83437
83404
|
};
|
|
83438
83405
|
|
|
83439
83406
|
// src/helpers/retry.ts
|
|
83440
|
-
var
|
|
83407
|
+
var import_promises6 = require("node:timers/promises");
|
|
83441
83408
|
var retry = async (config47, fn) => {
|
|
83442
83409
|
let { times } = config47;
|
|
83443
83410
|
let error2 = null;
|
|
@@ -83450,7 +83417,7 @@ var retry = async (config47, fn) => {
|
|
|
83450
83417
|
if (config47.exitCondition?.(e)) {
|
|
83451
83418
|
break;
|
|
83452
83419
|
}
|
|
83453
|
-
await (0,
|
|
83420
|
+
await (0, import_promises6.setTimeout)(config47.sleepMs ?? 1e3);
|
|
83454
83421
|
}
|
|
83455
83422
|
}
|
|
83456
83423
|
throw error2;
|
|
@@ -83538,7 +83505,7 @@ var createProject = async (ctx) => {
|
|
|
83538
83505
|
|
|
83539
83506
|
// src/workers.ts
|
|
83540
83507
|
var import_node_fs13 = require("node:fs");
|
|
83541
|
-
var
|
|
83508
|
+
var import_node_path16 = require("node:path");
|
|
83542
83509
|
|
|
83543
83510
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
83544
83511
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -84868,7 +84835,7 @@ async function addTypes(ctx) {
|
|
|
84868
84835
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
84869
84836
|
}
|
|
84870
84837
|
async function generateWorkersTypes(ctx, npm24) {
|
|
84871
|
-
const packageJsonPath = (0,
|
|
84838
|
+
const packageJsonPath = (0, import_node_path16.join)(ctx.project.path, "package.json");
|
|
84872
84839
|
if (!(0, import_node_fs13.existsSync)(packageJsonPath)) {
|
|
84873
84840
|
return;
|
|
84874
84841
|
}
|
|
@@ -84890,8 +84857,8 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
84890
84857
|
}
|
|
84891
84858
|
var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
84892
84859
|
let parsedConfig = {};
|
|
84893
|
-
if (
|
|
84894
|
-
parsedConfig =
|
|
84860
|
+
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
84861
|
+
parsedConfig = readWranglerJsonOrJsonc(ctx);
|
|
84895
84862
|
} else if (wranglerTomlExists(ctx)) {
|
|
84896
84863
|
const wranglerTomlStr = readWranglerToml(ctx);
|
|
84897
84864
|
parsedConfig = dist_default.parse(wranglerTomlStr);
|
|
@@ -84908,7 +84875,7 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
84908
84875
|
return false;
|
|
84909
84876
|
};
|
|
84910
84877
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
84911
|
-
const tsconfigPath = (0,
|
|
84878
|
+
const tsconfigPath = (0, import_node_path16.join)(ctx.project.path, "tsconfig.json");
|
|
84912
84879
|
if (!(0, import_node_fs13.existsSync)(tsconfigPath)) {
|
|
84913
84880
|
return;
|
|
84914
84881
|
}
|
|
@@ -84916,7 +84883,7 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
84916
84883
|
try {
|
|
84917
84884
|
const config47 = parse6(tsconfig);
|
|
84918
84885
|
const currentTypes = config47.compilerOptions?.types ?? [];
|
|
84919
|
-
let newTypes =
|
|
84886
|
+
let newTypes = new Set(currentTypes);
|
|
84920
84887
|
if (ctx.template.workersTypes === "installed") {
|
|
84921
84888
|
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
84922
84889
|
if (entrypointVersion === null) {
|
|
@@ -84927,35 +84894,32 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
84927
84894
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
84928
84895
|
);
|
|
84929
84896
|
if (!explicitEntrypoint) {
|
|
84930
|
-
newTypes
|
|
84931
|
-
|
|
84932
|
-
);
|
|
84933
|
-
newTypes.push(typesEntrypoint);
|
|
84897
|
+
newTypes.delete("@cloudflare/workers-types");
|
|
84898
|
+
newTypes.add(typesEntrypoint);
|
|
84934
84899
|
}
|
|
84935
84900
|
} else if (ctx.template.workersTypes === "generated") {
|
|
84936
|
-
newTypes.
|
|
84901
|
+
newTypes.add(ctx.template.typesPath ?? "./worker-configuration.d.ts");
|
|
84937
84902
|
const typegen = readFile(
|
|
84938
84903
|
ctx.template.typesPath ?? "./worker-configuration.d.ts"
|
|
84939
84904
|
).split("\n");
|
|
84940
84905
|
if (typegen.some(
|
|
84941
84906
|
(line) => line.includes("// Runtime types generated with workerd")
|
|
84942
84907
|
)) {
|
|
84943
|
-
newTypes =
|
|
84944
|
-
|
|
84908
|
+
newTypes = new Set(
|
|
84909
|
+
[...newTypes].filter(
|
|
84910
|
+
(type) => !type.startsWith("@cloudflare/workers-types")
|
|
84911
|
+
)
|
|
84945
84912
|
);
|
|
84946
84913
|
}
|
|
84947
84914
|
}
|
|
84948
84915
|
if (usesNodeCompat) {
|
|
84949
|
-
newTypes.
|
|
84950
|
-
}
|
|
84951
|
-
if (newTypes.sort() === currentTypes.sort()) {
|
|
84952
|
-
return;
|
|
84916
|
+
newTypes.add("node");
|
|
84953
84917
|
}
|
|
84954
84918
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
84955
84919
|
const edits = modify(
|
|
84956
84920
|
tsconfig,
|
|
84957
84921
|
["compilerOptions", "types"],
|
|
84958
|
-
newTypes,
|
|
84922
|
+
[...newTypes].sort(),
|
|
84959
84923
|
{
|
|
84960
84924
|
formattingOptions: { insertSpaces: useSpaces }
|
|
84961
84925
|
}
|
|
@@ -85032,7 +84996,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
85032
84996
|
if (err) {
|
|
85033
84997
|
throw new Error(err);
|
|
85034
84998
|
}
|
|
85035
|
-
const directory = (0,
|
|
84999
|
+
const directory = (0, import_node_path17.dirname)(path6);
|
|
85036
85000
|
(0, import_node_fs14.mkdirSync)(directory, { recursive: true });
|
|
85037
85001
|
(0, import_node_process7.chdir)(directory);
|
|
85038
85002
|
};
|
|
@@ -85045,7 +85009,7 @@ var create = async (ctx) => {
|
|
|
85045
85009
|
if (!ctx.args.experimental) {
|
|
85046
85010
|
await copyTemplateFiles(ctx);
|
|
85047
85011
|
}
|
|
85048
|
-
|
|
85012
|
+
updatePackageName(ctx);
|
|
85049
85013
|
(0, import_node_process7.chdir)(ctx.project.path);
|
|
85050
85014
|
await npmInstall(ctx);
|
|
85051
85015
|
await rectifyPmMismatch(ctx);
|