create-cloudflare 2.57.1 → 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 +575 -653
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +2 -2
- 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/tsconfig.json +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/tsconfig.json +2 -2
- package/templates/queues/ts/wrangler.jsonc +2 -2
- package/templates/qwik/pages/c3.ts +0 -35
- package/templates/qwik/pages/templates/wrangler.jsonc +2 -2
- package/templates/qwik/workers/c3.ts +0 -35
- 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/react-router/c3.ts +7 -3
- 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/tsconfig.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/vike/c3.ts +28 -0
- 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
|
@@ -568,7 +568,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
568
568
|
XDGAppPaths.cache = function cache(dirOptions) {
|
|
569
569
|
return path6.join(xdg.cache(), finalPathSegment(dirOptions));
|
|
570
570
|
};
|
|
571
|
-
XDGAppPaths.config = function
|
|
571
|
+
XDGAppPaths.config = function config47(dirOptions) {
|
|
572
572
|
return path6.join(xdg.config(), finalPathSegment(dirOptions));
|
|
573
573
|
};
|
|
574
574
|
XDGAppPaths.data = function data(dirOptions) {
|
|
@@ -625,7 +625,7 @@ var require_XDG = __commonJS({
|
|
|
625
625
|
var cache = function() {
|
|
626
626
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
|
|
627
627
|
};
|
|
628
|
-
var
|
|
628
|
+
var config47 = function() {
|
|
629
629
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
|
|
630
630
|
};
|
|
631
631
|
var data = function() {
|
|
@@ -637,13 +637,13 @@ var require_XDG = __commonJS({
|
|
|
637
637
|
var state = function() {
|
|
638
638
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
|
|
639
639
|
};
|
|
640
|
-
return { cache, config:
|
|
640
|
+
return { cache, config: config47, data, runtime, state };
|
|
641
641
|
};
|
|
642
642
|
var macos = function() {
|
|
643
643
|
var cache = function() {
|
|
644
644
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
|
|
645
645
|
};
|
|
646
|
-
var
|
|
646
|
+
var config47 = function() {
|
|
647
647
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
|
|
648
648
|
};
|
|
649
649
|
var data = function() {
|
|
@@ -655,7 +655,7 @@ var require_XDG = __commonJS({
|
|
|
655
655
|
var state = function() {
|
|
656
656
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
|
|
657
657
|
};
|
|
658
|
-
return { cache, config:
|
|
658
|
+
return { cache, config: config47, data, runtime, state };
|
|
659
659
|
};
|
|
660
660
|
var windows = function() {
|
|
661
661
|
function appData() {
|
|
@@ -667,7 +667,7 @@ var require_XDG = __commonJS({
|
|
|
667
667
|
var cache = function() {
|
|
668
668
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
|
|
669
669
|
};
|
|
670
|
-
var
|
|
670
|
+
var config47 = function() {
|
|
671
671
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
|
|
672
672
|
};
|
|
673
673
|
var data = function() {
|
|
@@ -679,7 +679,7 @@ var require_XDG = __commonJS({
|
|
|
679
679
|
var state = function() {
|
|
680
680
|
return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
|
|
681
681
|
};
|
|
682
|
-
return { cache, config:
|
|
682
|
+
return { cache, config: config47, data, runtime, state };
|
|
683
683
|
};
|
|
684
684
|
var XDG_ = /* @__PURE__ */ (function() {
|
|
685
685
|
function XDG_2() {
|
|
@@ -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
|
});
|
|
@@ -36179,21 +36179,21 @@ var require_dist_web = __commonJS({
|
|
|
36179
36179
|
_createClass(Haikunator3, [{
|
|
36180
36180
|
key: "haikunate",
|
|
36181
36181
|
value: function haikunate(options) {
|
|
36182
|
-
var
|
|
36183
|
-
if (
|
|
36184
|
-
|
|
36182
|
+
var config47 = (0, _lodash["default"])(options, this.config);
|
|
36183
|
+
if (config47.tokenHex === true) {
|
|
36184
|
+
config47.tokenChars = "0123456789abcdef";
|
|
36185
36185
|
}
|
|
36186
36186
|
var adjective = this._randomElement(this.adjectives);
|
|
36187
36187
|
var noun = this._randomElement(this.nouns);
|
|
36188
|
-
if (!
|
|
36188
|
+
if (!config47.tokenLength) config47.tokenLength = 0;
|
|
36189
36189
|
var token = "";
|
|
36190
|
-
for (var i = 0; i <
|
|
36191
|
-
token += this._randomElement(
|
|
36190
|
+
for (var i = 0; i < config47.tokenLength; i++) {
|
|
36191
|
+
token += this._randomElement(config47.tokenChars);
|
|
36192
36192
|
}
|
|
36193
36193
|
var sections = [adjective, noun, token];
|
|
36194
36194
|
return sections.filter(function(e) {
|
|
36195
36195
|
return !!e;
|
|
36196
|
-
}).join(
|
|
36196
|
+
}).join(config47.delimiter);
|
|
36197
36197
|
}
|
|
36198
36198
|
/**
|
|
36199
36199
|
* Get a random element from an array/string
|
|
@@ -42368,13 +42368,13 @@ var require_esprima = __commonJS({
|
|
|
42368
42368
|
return Reader2;
|
|
42369
42369
|
})();
|
|
42370
42370
|
var Tokenizer = (function() {
|
|
42371
|
-
function Tokenizer2(code,
|
|
42371
|
+
function Tokenizer2(code, config47) {
|
|
42372
42372
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
42373
|
-
this.errorHandler.tolerant =
|
|
42373
|
+
this.errorHandler.tolerant = config47 ? typeof config47.tolerant === "boolean" && config47.tolerant : false;
|
|
42374
42374
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
42375
|
-
this.scanner.trackComment =
|
|
42376
|
-
this.trackRange =
|
|
42377
|
-
this.trackLoc =
|
|
42375
|
+
this.scanner.trackComment = config47 ? typeof config47.comment === "boolean" && config47.comment : false;
|
|
42376
|
+
this.trackRange = config47 ? typeof config47.range === "boolean" && config47.range : false;
|
|
42377
|
+
this.trackLoc = config47 ? typeof config47.loc === "boolean" && config47.loc : false;
|
|
42378
42378
|
this.buffer = [];
|
|
42379
42379
|
this.reader = new Reader();
|
|
42380
42380
|
}
|
|
@@ -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
|
}
|
|
@@ -52460,11 +52460,11 @@ var require_printer = __commonJS({
|
|
|
52460
52460
|
return this.code;
|
|
52461
52461
|
};
|
|
52462
52462
|
var emptyPrintResult = new PrintResult("");
|
|
52463
|
-
var Printer = function Printer2(
|
|
52463
|
+
var Printer = function Printer2(config47) {
|
|
52464
52464
|
assert_1.default.ok(this instanceof Printer2);
|
|
52465
|
-
var explicitTabWidth =
|
|
52466
|
-
|
|
52467
|
-
|
|
52465
|
+
var explicitTabWidth = config47 && config47.tabWidth;
|
|
52466
|
+
config47 = options_1.normalize(config47);
|
|
52467
|
+
config47.sourceFileName = null;
|
|
52468
52468
|
function makePrintFunctionWith(options, overrides) {
|
|
52469
52469
|
options = Object.assign({}, options, overrides);
|
|
52470
52470
|
return function(path6) {
|
|
@@ -52479,11 +52479,11 @@ var require_printer = __commonJS({
|
|
|
52479
52479
|
includeComments: false
|
|
52480
52480
|
}));
|
|
52481
52481
|
}
|
|
52482
|
-
var oldTabWidth =
|
|
52482
|
+
var oldTabWidth = config47.tabWidth;
|
|
52483
52483
|
if (!explicitTabWidth) {
|
|
52484
52484
|
var loc = path6.getNode().loc;
|
|
52485
52485
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
52486
|
-
|
|
52486
|
+
config47.tabWidth = loc.lines.guessTabWidth();
|
|
52487
52487
|
}
|
|
52488
52488
|
}
|
|
52489
52489
|
var reprinter = patcher_1.getReprinter(path6);
|
|
@@ -52497,11 +52497,11 @@ var require_printer = __commonJS({
|
|
|
52497
52497
|
// right choice because it gives us the opportunity to reprint
|
|
52498
52498
|
// such nodes using their original source.
|
|
52499
52499
|
reprinter(print2)
|
|
52500
|
-
) : genericPrint(path6,
|
|
52500
|
+
) : genericPrint(path6, config47, options, makePrintFunctionWith(options, {
|
|
52501
52501
|
includeComments: true,
|
|
52502
52502
|
avoidRootParens: false
|
|
52503
52503
|
}));
|
|
52504
|
-
|
|
52504
|
+
config47.tabWidth = oldTabWidth;
|
|
52505
52505
|
return lines;
|
|
52506
52506
|
}
|
|
52507
52507
|
this.print = function(ast) {
|
|
@@ -52512,7 +52512,7 @@ var require_printer = __commonJS({
|
|
|
52512
52512
|
includeComments: true,
|
|
52513
52513
|
avoidRootParens: false
|
|
52514
52514
|
});
|
|
52515
|
-
return new PrintResult(lines.toString(
|
|
52515
|
+
return new PrintResult(lines.toString(config47), util.composeSourceMaps(config47.inputSourceMap, lines.getSourceMap(config47.sourceMapName, config47.sourceRoot)));
|
|
52516
52516
|
};
|
|
52517
52517
|
this.printGenerically = function(ast) {
|
|
52518
52518
|
if (!ast) {
|
|
@@ -52520,26 +52520,26 @@ var require_printer = __commonJS({
|
|
|
52520
52520
|
}
|
|
52521
52521
|
function printGenerically(path7) {
|
|
52522
52522
|
return comments_1.printComments(path7, function(path8) {
|
|
52523
|
-
return genericPrint(path8,
|
|
52523
|
+
return genericPrint(path8, config47, {
|
|
52524
52524
|
includeComments: true,
|
|
52525
52525
|
avoidRootParens: false
|
|
52526
52526
|
}, printGenerically);
|
|
52527
52527
|
});
|
|
52528
52528
|
}
|
|
52529
52529
|
var path6 = fast_path_1.default.from(ast);
|
|
52530
|
-
var oldReuseWhitespace =
|
|
52531
|
-
|
|
52532
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
52533
|
-
|
|
52530
|
+
var oldReuseWhitespace = config47.reuseWhitespace;
|
|
52531
|
+
config47.reuseWhitespace = false;
|
|
52532
|
+
var pr = new PrintResult(printGenerically(path6).toString(config47));
|
|
52533
|
+
config47.reuseWhitespace = oldReuseWhitespace;
|
|
52534
52534
|
return pr;
|
|
52535
52535
|
};
|
|
52536
52536
|
};
|
|
52537
52537
|
exports2.Printer = Printer;
|
|
52538
|
-
function genericPrint(path6,
|
|
52538
|
+
function genericPrint(path6, config47, options, printPath) {
|
|
52539
52539
|
assert_1.default.ok(path6 instanceof fast_path_1.default);
|
|
52540
52540
|
var node = path6.getValue();
|
|
52541
52541
|
var parts = [];
|
|
52542
|
-
var linesWithoutParens = genericPrintNoParens(path6,
|
|
52542
|
+
var linesWithoutParens = genericPrintNoParens(path6, config47, printPath);
|
|
52543
52543
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
52544
52544
|
return linesWithoutParens;
|
|
52545
52545
|
}
|
|
@@ -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
|
|
@@ -72119,33 +72119,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
72119
72119
|
}
|
|
72120
72120
|
return input;
|
|
72121
72121
|
};
|
|
72122
|
-
var renderSubmit = (
|
|
72123
|
-
const { question, label } =
|
|
72124
|
-
if (
|
|
72122
|
+
var renderSubmit = (config47, value) => {
|
|
72123
|
+
const { question, label } = config47;
|
|
72124
|
+
if (config47.type !== "confirm" && !value) {
|
|
72125
72125
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
72126
72126
|
}
|
|
72127
|
-
const content =
|
|
72127
|
+
const content = config47.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
72128
72128
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
72129
72129
|
};
|
|
72130
|
-
var getRenderers = (
|
|
72131
|
-
switch (
|
|
72130
|
+
var getRenderers = (config47) => {
|
|
72131
|
+
switch (config47.type) {
|
|
72132
72132
|
case "select":
|
|
72133
|
-
return getSelectRenderers(
|
|
72133
|
+
return getSelectRenderers(config47);
|
|
72134
72134
|
case "confirm":
|
|
72135
|
-
return getConfirmRenderers(
|
|
72135
|
+
return getConfirmRenderers(config47);
|
|
72136
72136
|
case "text":
|
|
72137
|
-
return getTextRenderers(
|
|
72137
|
+
return getTextRenderers(config47);
|
|
72138
72138
|
case "multiselect":
|
|
72139
|
-
return getSelectRenderers(
|
|
72139
|
+
return getSelectRenderers(config47);
|
|
72140
72140
|
case "list":
|
|
72141
|
-
return getSelectListRenderers(
|
|
72141
|
+
return getSelectListRenderers(config47);
|
|
72142
72142
|
}
|
|
72143
72143
|
};
|
|
72144
|
-
var getTextRenderers = (
|
|
72145
|
-
const { question } =
|
|
72146
|
-
const helpText =
|
|
72147
|
-
const format5 =
|
|
72148
|
-
const defaultValue =
|
|
72144
|
+
var getTextRenderers = (config47) => {
|
|
72145
|
+
const { question } = config47;
|
|
72146
|
+
const helpText = config47.helpText ?? "";
|
|
72147
|
+
const format5 = config47.format ?? ((val) => String(val));
|
|
72148
|
+
const defaultValue = config47.defaultValue?.toString() ?? "";
|
|
72149
72149
|
const activeRenderer = (props) => {
|
|
72150
72150
|
const { valueWithCursor } = props;
|
|
72151
72151
|
return [
|
|
@@ -72171,14 +72171,14 @@ var getTextRenderers = (config46) => {
|
|
|
72171
72171
|
``
|
|
72172
72172
|
// extra line for readability
|
|
72173
72173
|
],
|
|
72174
|
-
submit: ({ value }) => renderSubmit(
|
|
72174
|
+
submit: ({ value }) => renderSubmit(config47, format5(value ?? "")),
|
|
72175
72175
|
cancel: activeRenderer
|
|
72176
72176
|
};
|
|
72177
72177
|
};
|
|
72178
|
-
var getSelectRenderers = (
|
|
72179
|
-
const { options, question, helpText: _helpText } =
|
|
72178
|
+
var getSelectRenderers = (config47) => {
|
|
72179
|
+
const { options, question, helpText: _helpText } = config47;
|
|
72180
72180
|
const helpText = _helpText ?? "";
|
|
72181
|
-
const maxItemsPerPage =
|
|
72181
|
+
const maxItemsPerPage = config47.maxItemsPerPage ?? 32;
|
|
72182
72182
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
72183
72183
|
const renderOption = (opt, i) => {
|
|
72184
72184
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -72253,21 +72253,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
72253
72253
|
submit: ({ value }) => {
|
|
72254
72254
|
if (Array.isArray(value)) {
|
|
72255
72255
|
return renderSubmit(
|
|
72256
|
-
|
|
72256
|
+
config47,
|
|
72257
72257
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
72258
72258
|
);
|
|
72259
72259
|
}
|
|
72260
72260
|
return renderSubmit(
|
|
72261
|
-
|
|
72261
|
+
config47,
|
|
72262
72262
|
options.find((o) => o.value === value)?.label
|
|
72263
72263
|
);
|
|
72264
72264
|
},
|
|
72265
72265
|
cancel: defaultRenderer
|
|
72266
72266
|
};
|
|
72267
72267
|
};
|
|
72268
|
-
var getSelectListRenderers = (
|
|
72269
|
-
const { question, helpText: _helpText } =
|
|
72270
|
-
let options =
|
|
72268
|
+
var getSelectListRenderers = (config47) => {
|
|
72269
|
+
const { question, helpText: _helpText } = config47;
|
|
72270
|
+
let options = config47.options;
|
|
72271
72271
|
const helpText = _helpText ?? "";
|
|
72272
72272
|
const { rows } = stdout;
|
|
72273
72273
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -72348,20 +72348,20 @@ var getSelectListRenderers = (config46) => {
|
|
|
72348
72348
|
submit: ({ value }) => {
|
|
72349
72349
|
if (Array.isArray(value)) {
|
|
72350
72350
|
return renderSubmit(
|
|
72351
|
-
|
|
72351
|
+
config47,
|
|
72352
72352
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
72353
72353
|
);
|
|
72354
72354
|
}
|
|
72355
72355
|
return renderSubmit(
|
|
72356
|
-
|
|
72356
|
+
config47,
|
|
72357
72357
|
options.find((o) => o.value === value)?.value
|
|
72358
72358
|
);
|
|
72359
72359
|
},
|
|
72360
72360
|
cancel: defaultRenderer
|
|
72361
72361
|
};
|
|
72362
72362
|
};
|
|
72363
|
-
var getConfirmRenderers = (
|
|
72364
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
72363
|
+
var getConfirmRenderers = (config47) => {
|
|
72364
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config47;
|
|
72365
72365
|
const helpText = _helpText ?? "";
|
|
72366
72366
|
const active = activeText || "Yes";
|
|
72367
72367
|
const inactive = inactiveText || "No";
|
|
@@ -72378,7 +72378,7 @@ var getConfirmRenderers = (config46) => {
|
|
|
72378
72378
|
active: defaultRenderer,
|
|
72379
72379
|
confirm: defaultRenderer,
|
|
72380
72380
|
error: defaultRenderer,
|
|
72381
|
-
submit: ({ value }) => renderSubmit(
|
|
72381
|
+
submit: ({ value }) => renderSubmit(config47, value ? "yes" : "no"),
|
|
72382
72382
|
cancel: defaultRenderer
|
|
72383
72383
|
};
|
|
72384
72384
|
};
|
|
@@ -73346,23 +73346,23 @@ var YargsParser = class {
|
|
|
73346
73346
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
73347
73347
|
if (configPath) {
|
|
73348
73348
|
try {
|
|
73349
|
-
let
|
|
73349
|
+
let config47 = null;
|
|
73350
73350
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
73351
73351
|
const resolveConfig = flags.configs[configKey];
|
|
73352
73352
|
if (typeof resolveConfig === "function") {
|
|
73353
73353
|
try {
|
|
73354
|
-
|
|
73354
|
+
config47 = resolveConfig(resolvedConfigPath);
|
|
73355
73355
|
} catch (e) {
|
|
73356
|
-
|
|
73356
|
+
config47 = e;
|
|
73357
73357
|
}
|
|
73358
|
-
if (
|
|
73359
|
-
error2 =
|
|
73358
|
+
if (config47 instanceof Error) {
|
|
73359
|
+
error2 = config47;
|
|
73360
73360
|
return;
|
|
73361
73361
|
}
|
|
73362
73362
|
} else {
|
|
73363
|
-
|
|
73363
|
+
config47 = mixin2.require(resolvedConfigPath);
|
|
73364
73364
|
}
|
|
73365
|
-
setConfigObject(
|
|
73365
|
+
setConfigObject(config47);
|
|
73366
73366
|
} catch (ex) {
|
|
73367
73367
|
if (ex.name === "PermissionDenied")
|
|
73368
73368
|
error2 = ex;
|
|
@@ -73372,9 +73372,9 @@ var YargsParser = class {
|
|
|
73372
73372
|
}
|
|
73373
73373
|
});
|
|
73374
73374
|
}
|
|
73375
|
-
function setConfigObject(
|
|
73376
|
-
Object.keys(
|
|
73377
|
-
const value =
|
|
73375
|
+
function setConfigObject(config47, prev) {
|
|
73376
|
+
Object.keys(config47).forEach(function(key) {
|
|
73377
|
+
const value = config47[key];
|
|
73378
73378
|
const fullKey = prev ? prev + "." + key : key;
|
|
73379
73379
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
73380
73380
|
setConfigObject(value, fullKey);
|
|
@@ -74526,11 +74526,11 @@ var CommandInstance = class {
|
|
|
74526
74526
|
});
|
|
74527
74527
|
if (!unparsed.length)
|
|
74528
74528
|
return;
|
|
74529
|
-
const
|
|
74529
|
+
const config47 = Object.assign({}, options.configuration, {
|
|
74530
74530
|
"populate--": false
|
|
74531
74531
|
});
|
|
74532
74532
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
74533
|
-
configuration:
|
|
74533
|
+
configuration: config47
|
|
74534
74534
|
}));
|
|
74535
74535
|
if (parsed.error) {
|
|
74536
74536
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -75753,31 +75753,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
75753
75753
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
75754
75754
|
var previouslyVisitedConfigs = [];
|
|
75755
75755
|
var shim2;
|
|
75756
|
-
function applyExtends(
|
|
75756
|
+
function applyExtends(config47, cwd, mergeExtends, _shim) {
|
|
75757
75757
|
shim2 = _shim;
|
|
75758
75758
|
let defaultConfig = {};
|
|
75759
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
75760
|
-
if (typeof
|
|
75759
|
+
if (Object.prototype.hasOwnProperty.call(config47, "extends")) {
|
|
75760
|
+
if (typeof config47.extends !== "string")
|
|
75761
75761
|
return defaultConfig;
|
|
75762
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
75762
|
+
const isPath = /\.json|\..*rc$/.test(config47.extends);
|
|
75763
75763
|
let pathToDefault = null;
|
|
75764
75764
|
if (!isPath) {
|
|
75765
75765
|
try {
|
|
75766
|
-
pathToDefault = require.resolve(
|
|
75766
|
+
pathToDefault = require.resolve(config47.extends);
|
|
75767
75767
|
} catch (_err) {
|
|
75768
|
-
return
|
|
75768
|
+
return config47;
|
|
75769
75769
|
}
|
|
75770
75770
|
} else {
|
|
75771
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
75771
|
+
pathToDefault = getPathToDefaultConfig(cwd, config47.extends);
|
|
75772
75772
|
}
|
|
75773
75773
|
checkForCircularExtends(pathToDefault);
|
|
75774
75774
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
75775
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
75776
|
-
delete
|
|
75775
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config47.extends);
|
|
75776
|
+
delete config47.extends;
|
|
75777
75777
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
75778
75778
|
}
|
|
75779
75779
|
previouslyVisitedConfigs = [];
|
|
75780
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
75780
|
+
return mergeExtends ? mergeDeep(defaultConfig, config47) : Object.assign({}, defaultConfig, config47);
|
|
75781
75781
|
}
|
|
75782
75782
|
function checkForCircularExtends(cfgPath) {
|
|
75783
75783
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -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 {
|
|
@@ -76553,9 +76553,9 @@ var YargsInstance = class {
|
|
|
76553
76553
|
}
|
|
76554
76554
|
return maybePromise;
|
|
76555
76555
|
}
|
|
76556
|
-
parserConfiguration(
|
|
76557
|
-
argsert("<object>", [
|
|
76558
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
76556
|
+
parserConfiguration(config47) {
|
|
76557
|
+
argsert("<object>", [config47], arguments.length);
|
|
76558
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config47, "f");
|
|
76559
76559
|
return this;
|
|
76560
76560
|
}
|
|
76561
76561
|
pkgConf(key, rootPath) {
|
|
@@ -76727,9 +76727,9 @@ var YargsInstance = class {
|
|
|
76727
76727
|
return this;
|
|
76728
76728
|
}
|
|
76729
76729
|
}
|
|
76730
|
-
usageConfiguration(
|
|
76731
|
-
argsert("<object>", [
|
|
76732
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
76730
|
+
usageConfiguration(config47) {
|
|
76731
|
+
argsert("<object>", [config47], arguments.length);
|
|
76732
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config47, "f");
|
|
76733
76733
|
return this;
|
|
76734
76734
|
}
|
|
76735
76735
|
version(opt, msg, ver) {
|
|
@@ -77135,11 +77135,11 @@ var YargsInstance = class {
|
|
|
77135
77135
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
77136
77136
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
77137
77137
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
77138
|
-
const
|
|
77138
|
+
const config47 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
77139
77139
|
"populate--": true
|
|
77140
77140
|
});
|
|
77141
77141
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
77142
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
77142
|
+
configuration: { "parse-positional-numbers": false, ...config47 }
|
|
77143
77143
|
}));
|
|
77144
77144
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
77145
77145
|
let argvPromise = void 0;
|
|
@@ -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");
|
|
@@ -77346,12 +77346,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
77346
77346
|
}
|
|
77347
77347
|
|
|
77348
77348
|
// src/helpers/metrics-config.ts
|
|
77349
|
-
function writeMetricsConfig(
|
|
77349
|
+
function writeMetricsConfig(config47) {
|
|
77350
77350
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
77351
77351
|
(0, import_node_fs2.writeFileSync)(
|
|
77352
77352
|
getMetricsConfigPath(),
|
|
77353
77353
|
JSON.stringify(
|
|
77354
|
-
|
|
77354
|
+
config47,
|
|
77355
77355
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
77356
77356
|
" "
|
|
77357
77357
|
)
|
|
@@ -77359,9 +77359,9 @@ function writeMetricsConfig(config46) {
|
|
|
77359
77359
|
}
|
|
77360
77360
|
function readMetricsConfig() {
|
|
77361
77361
|
try {
|
|
77362
|
-
const
|
|
77362
|
+
const config47 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
77363
77363
|
return JSON.parse(
|
|
77364
|
-
|
|
77364
|
+
config47,
|
|
77365
77365
|
(key, value) => key === "date" ? new Date(value) : value
|
|
77366
77366
|
);
|
|
77367
77367
|
} catch {
|
|
@@ -77371,10 +77371,10 @@ function readMetricsConfig() {
|
|
|
77371
77371
|
function getMetricsConfigPath() {
|
|
77372
77372
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
77373
77373
|
}
|
|
77374
|
-
function getDeviceId(
|
|
77375
|
-
const deviceId =
|
|
77376
|
-
if (
|
|
77377
|
-
writeMetricsConfig({ ...
|
|
77374
|
+
function getDeviceId(config47) {
|
|
77375
|
+
const deviceId = config47.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
77376
|
+
if (config47.deviceId === void 0) {
|
|
77377
|
+
writeMetricsConfig({ ...config47, deviceId });
|
|
77378
77378
|
}
|
|
77379
77379
|
return deviceId;
|
|
77380
77380
|
}
|
|
@@ -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;
|
|
@@ -77678,10 +77678,10 @@ function getPlatform() {
|
|
|
77678
77678
|
function createReporter() {
|
|
77679
77679
|
const events = [];
|
|
77680
77680
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
77681
|
-
const
|
|
77682
|
-
const isFirstUsage =
|
|
77681
|
+
const config47 = readMetricsConfig() ?? {};
|
|
77682
|
+
const isFirstUsage = config47.c3permission === void 0;
|
|
77683
77683
|
const isEnabled = isTelemetryEnabled();
|
|
77684
|
-
const deviceId = getDeviceId(
|
|
77684
|
+
const deviceId = getDeviceId(config47);
|
|
77685
77685
|
const packageManager = detectPackageManager();
|
|
77686
77686
|
const platform = getPlatform();
|
|
77687
77687
|
const amplitude_session_id = Date.now();
|
|
@@ -77714,7 +77714,7 @@ function createReporter() {
|
|
|
77714
77714
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
77715
77715
|
return false;
|
|
77716
77716
|
}
|
|
77717
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
77717
|
+
return hasSparrowSourceKey() && getC3Permission(config47).enabled;
|
|
77718
77718
|
}
|
|
77719
77719
|
async function waitForAllEventsSettled() {
|
|
77720
77720
|
await Promise.allSettled(events);
|
|
@@ -77820,20 +77820,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
77820
77820
|
date: /* @__PURE__ */ new Date()
|
|
77821
77821
|
};
|
|
77822
77822
|
}
|
|
77823
|
-
function getC3Permission(
|
|
77824
|
-
if (!
|
|
77825
|
-
|
|
77826
|
-
writeMetricsConfig(
|
|
77823
|
+
function getC3Permission(config47 = readMetricsConfig() ?? {}) {
|
|
77824
|
+
if (!config47.c3permission) {
|
|
77825
|
+
config47.c3permission = initializeC3Permission();
|
|
77826
|
+
writeMetricsConfig(config47);
|
|
77827
77827
|
}
|
|
77828
|
-
return
|
|
77828
|
+
return config47.c3permission;
|
|
77829
77829
|
}
|
|
77830
77830
|
function updateC3Pemission(enabled) {
|
|
77831
|
-
const
|
|
77832
|
-
if (
|
|
77831
|
+
const config47 = readMetricsConfig();
|
|
77832
|
+
if (config47.c3permission?.enabled === enabled) {
|
|
77833
77833
|
return;
|
|
77834
77834
|
}
|
|
77835
|
-
|
|
77836
|
-
writeMetricsConfig(
|
|
77835
|
+
config47.c3permission = initializeC3Permission(enabled);
|
|
77836
|
+
writeMetricsConfig(config47);
|
|
77837
77837
|
}
|
|
77838
77838
|
var runTelemetryCommand = (action) => {
|
|
77839
77839
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -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
|
|
|
@@ -78785,7 +78785,7 @@ var hasTsConfig = (path6) => {
|
|
|
78785
78785
|
};
|
|
78786
78786
|
|
|
78787
78787
|
// src/helpers/packages.ts
|
|
78788
|
-
var installPackages = async (packages,
|
|
78788
|
+
var installPackages = async (packages, config47 = {}) => {
|
|
78789
78789
|
if (packages.length === 0) {
|
|
78790
78790
|
return;
|
|
78791
78791
|
}
|
|
@@ -78795,39 +78795,27 @@ var installPackages = async (packages, config46 = {}) => {
|
|
|
78795
78795
|
switch (npm24) {
|
|
78796
78796
|
case "yarn":
|
|
78797
78797
|
cmd = "add";
|
|
78798
|
-
saveFlag =
|
|
78798
|
+
saveFlag = config47.dev ? "-D" : "";
|
|
78799
78799
|
break;
|
|
78800
78800
|
case "bun":
|
|
78801
78801
|
cmd = "add";
|
|
78802
|
-
saveFlag =
|
|
78802
|
+
saveFlag = config47.dev ? "-d" : "";
|
|
78803
78803
|
break;
|
|
78804
78804
|
case "npm":
|
|
78805
78805
|
case "pnpm":
|
|
78806
78806
|
default:
|
|
78807
78807
|
cmd = "install";
|
|
78808
|
-
saveFlag =
|
|
78808
|
+
saveFlag = config47.dev ? "--save-dev" : "";
|
|
78809
78809
|
break;
|
|
78810
78810
|
}
|
|
78811
|
-
await runCommand(
|
|
78812
|
-
|
|
78813
|
-
|
|
78814
|
-
|
|
78815
|
-
...saveFlag ? [saveFlag] : [],
|
|
78816
|
-
...packages,
|
|
78817
|
-
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
78818
|
-
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
78819
|
-
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
78820
|
-
...npm24 === "npm" ? ["--legacy-peer-deps"] : []
|
|
78821
|
-
],
|
|
78822
|
-
{
|
|
78823
|
-
...config46,
|
|
78824
|
-
silent: true
|
|
78825
|
-
}
|
|
78826
|
-
);
|
|
78811
|
+
await runCommand([npm24, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
|
|
78812
|
+
...config47,
|
|
78813
|
+
silent: true
|
|
78814
|
+
});
|
|
78827
78815
|
if (npm24 === "npm") {
|
|
78828
78816
|
const pkgJsonPath = import_node_path5.default.join(process.cwd(), "package.json");
|
|
78829
78817
|
const pkgJson = readJSON(pkgJsonPath);
|
|
78830
|
-
const deps =
|
|
78818
|
+
const deps = config47.dev ? pkgJson.devDependencies : pkgJson.dependencies;
|
|
78831
78819
|
(0, import_node_assert2.default)(deps, "dependencies should be defined");
|
|
78832
78820
|
for (const pkg of packages) {
|
|
78833
78821
|
const versionMarker = pkg.lastIndexOf("@");
|
|
@@ -78848,17 +78836,11 @@ var npmInstall = async (ctx) => {
|
|
|
78848
78836
|
return;
|
|
78849
78837
|
}
|
|
78850
78838
|
const { npm: npm24 } = detectPackageManager();
|
|
78851
|
-
await runCommand(
|
|
78852
|
-
|
|
78853
|
-
|
|
78854
|
-
|
|
78855
|
-
|
|
78856
|
-
{
|
|
78857
|
-
silent: true,
|
|
78858
|
-
startText: "Installing dependencies",
|
|
78859
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm24} install\``)}`
|
|
78860
|
-
}
|
|
78861
|
-
);
|
|
78839
|
+
await runCommand([npm24, "install"], {
|
|
78840
|
+
silent: true,
|
|
78841
|
+
startText: "Installing dependencies",
|
|
78842
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm24} install\``)}`
|
|
78843
|
+
});
|
|
78862
78844
|
};
|
|
78863
78845
|
async function getLatestPackageVersion(packageSpecifier) {
|
|
78864
78846
|
const resp = await (0, import_undici2.fetch)(`https://registry.npmjs.org/${packageSpecifier}`);
|
|
@@ -78932,16 +78914,17 @@ var package_default = {
|
|
|
78932
78914
|
],
|
|
78933
78915
|
dependencies: {
|
|
78934
78916
|
"create-astro": "4.13.2",
|
|
78935
|
-
"create-analog": "1.
|
|
78917
|
+
"create-analog": "2.1.3",
|
|
78936
78918
|
"@angular/create": "21.0.1",
|
|
78937
78919
|
"create-docusaurus": "3.9.2",
|
|
78938
78920
|
"create-hono": "0.19.3",
|
|
78939
78921
|
"create-next-app": "15.5.6",
|
|
78940
78922
|
"create-qwik": "1.17.2",
|
|
78941
78923
|
"create-vite": "7.1.1",
|
|
78942
|
-
"create-rwsdk": "3.1.
|
|
78924
|
+
"create-rwsdk": "3.1.2",
|
|
78943
78925
|
"create-react-router": "7.9.6",
|
|
78944
78926
|
"create-solid": "0.6.11",
|
|
78927
|
+
"create-vike": "0.0.528",
|
|
78945
78928
|
"create-vue": "3.18.3",
|
|
78946
78929
|
"create-waku": "0.12.5-0.27.1-0",
|
|
78947
78930
|
"@tanstack/create-start": "0.40.0",
|
|
@@ -79052,85 +79035,117 @@ var getPropertyName = (newProp) => {
|
|
|
79052
79035
|
return newProp.key.type === "Identifier" ? newProp.key.name : newProp.key.type === "StringLiteral" ? newProp.key.value : null;
|
|
79053
79036
|
};
|
|
79054
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
|
+
|
|
79055
79086
|
// templates/analog/c3.ts
|
|
79056
79087
|
var recast2 = __toESM(require_main2());
|
|
79057
|
-
var { npm
|
|
79088
|
+
var { npm } = detectPackageManager();
|
|
79058
79089
|
var generate = async (ctx) => {
|
|
79059
|
-
await runFrameworkGenerator(ctx, [
|
|
79060
|
-
ctx.project.name,
|
|
79061
|
-
"--template",
|
|
79062
|
-
"angular-v17"
|
|
79063
|
-
]);
|
|
79090
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--template=latest"]);
|
|
79064
79091
|
logRaw("");
|
|
79065
79092
|
};
|
|
79066
79093
|
var configure = async (ctx) => {
|
|
79067
|
-
|
|
79068
|
-
|
|
79069
|
-
|
|
79070
|
-
|
|
79071
|
-
|
|
79072
|
-
|
|
79073
|
-
await installPackages(packages, {
|
|
79074
|
-
dev: true,
|
|
79075
|
-
startText: `Installing ${packages.join(", ")}`,
|
|
79076
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
|
|
79077
|
-
});
|
|
79078
|
-
}
|
|
79079
|
-
updateViteConfig(ctx);
|
|
79080
|
-
};
|
|
79081
|
-
var updateViteConfig = (ctx) => {
|
|
79082
|
-
const b3 = recast2.types.builders;
|
|
79083
|
-
const s = spinner();
|
|
79084
|
-
const configFile = "vite.config.ts";
|
|
79085
|
-
s.start(`Updating \`${configFile}\``);
|
|
79086
|
-
const snippets = loadTemplateSnippets(ctx);
|
|
79087
|
-
transformFile(configFile, {
|
|
79088
|
-
visitProgram(n) {
|
|
79089
|
-
const lastImportIndex = n.node.body.findLastIndex(
|
|
79090
|
-
(t2) => t2.type === "ImportDeclaration"
|
|
79091
|
-
);
|
|
79092
|
-
const lastImport = n.get("body", lastImportIndex);
|
|
79093
|
-
lastImport.insertAfter(...snippets.devBindingsModuleTs);
|
|
79094
|
-
return this.traverse(n);
|
|
79095
|
-
},
|
|
79096
|
-
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) {
|
|
79097
79100
|
const callee = n.node.callee;
|
|
79098
|
-
if (callee.name
|
|
79099
|
-
|
|
79101
|
+
if (callee.name !== "analog") {
|
|
79102
|
+
return this.traverse(n);
|
|
79103
|
+
}
|
|
79104
|
+
const b3 = recast2.types.builders;
|
|
79105
|
+
const presetDef = [
|
|
79106
|
+
b3.objectProperty(
|
|
79100
79107
|
b3.identifier("nitro"),
|
|
79101
79108
|
b3.objectExpression([
|
|
79109
|
+
// preset: "cloudflare_module"
|
|
79102
79110
|
b3.objectProperty(
|
|
79103
79111
|
b3.identifier("preset"),
|
|
79104
|
-
b3.stringLiteral("
|
|
79112
|
+
b3.stringLiteral("cloudflare_module")
|
|
79105
79113
|
),
|
|
79106
79114
|
b3.objectProperty(
|
|
79107
|
-
b3.identifier("
|
|
79108
|
-
b3.
|
|
79115
|
+
b3.identifier("compatibilityDate"),
|
|
79116
|
+
b3.stringLiteral(compatDate)
|
|
79109
79117
|
)
|
|
79110
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
|
|
79111
79127
|
);
|
|
79112
|
-
n.node.arguments = [b3.objectExpression([pluginArguments])];
|
|
79113
79128
|
}
|
|
79114
|
-
return
|
|
79129
|
+
return false;
|
|
79115
79130
|
}
|
|
79116
79131
|
});
|
|
79117
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
79118
79132
|
};
|
|
79119
79133
|
var config = {
|
|
79120
79134
|
configVersion: 1,
|
|
79121
79135
|
id: "analog",
|
|
79122
79136
|
frameworkCli: "create-analog",
|
|
79123
|
-
platform: "pages",
|
|
79124
79137
|
displayName: "Analog",
|
|
79138
|
+
platform: "workers",
|
|
79125
79139
|
copyFiles: {
|
|
79126
79140
|
path: "./templates"
|
|
79127
79141
|
},
|
|
79142
|
+
path: "templates/analog",
|
|
79128
79143
|
generate,
|
|
79129
79144
|
configure,
|
|
79130
79145
|
transformPackageJson: async () => ({
|
|
79131
79146
|
scripts: {
|
|
79132
|
-
preview: `${npm} run build && wrangler
|
|
79133
|
-
deploy: `${npm} run build && wrangler
|
|
79147
|
+
preview: `${npm} run build && wrangler dev`,
|
|
79148
|
+
deploy: `${npm} run build && wrangler deploy`,
|
|
79134
79149
|
"cf-typegen": `wrangler types`
|
|
79135
79150
|
}
|
|
79136
79151
|
}),
|
|
@@ -79141,7 +79156,7 @@ var config = {
|
|
|
79141
79156
|
var c3_default = config;
|
|
79142
79157
|
|
|
79143
79158
|
// templates/angular/pages/c3.ts
|
|
79144
|
-
var
|
|
79159
|
+
var import_node_path8 = require("node:path");
|
|
79145
79160
|
var { npm: npm2 } = detectPackageManager();
|
|
79146
79161
|
var generate2 = async (ctx) => {
|
|
79147
79162
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -79163,23 +79178,23 @@ async function updateAppCode() {
|
|
|
79163
79178
|
const s = spinner();
|
|
79164
79179
|
s.start(`Updating application code`);
|
|
79165
79180
|
const appConfigPath = "src/app/app.config.ts";
|
|
79166
|
-
const appConfig = readFile((0,
|
|
79181
|
+
const appConfig = readFile((0, import_node_path8.resolve)(appConfigPath));
|
|
79167
79182
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
79168
79183
|
"providers: [",
|
|
79169
79184
|
"providers: [provideHttpClient(withFetch()), "
|
|
79170
79185
|
);
|
|
79171
|
-
writeFile2((0,
|
|
79186
|
+
writeFile2((0, import_node_path8.resolve)(appConfigPath), newAppConfig);
|
|
79172
79187
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
79173
79188
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
79174
|
-
const appRoutes = readFile((0,
|
|
79189
|
+
const appRoutes = readFile((0, import_node_path8.resolve)(appServerRoutesPath));
|
|
79175
79190
|
const newAppRoutes = appRoutes.replace(
|
|
79176
79191
|
"RenderMode.Prerender",
|
|
79177
79192
|
"RenderMode.Server"
|
|
79178
79193
|
);
|
|
79179
|
-
writeFile2((0,
|
|
79194
|
+
writeFile2((0, import_node_path8.resolve)(appServerRoutesPath), newAppRoutes);
|
|
79180
79195
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
79181
79196
|
s.start(`Updating package.json`);
|
|
79182
|
-
const packageJsonPath = (0,
|
|
79197
|
+
const packageJsonPath = (0, import_node_path8.resolve)("package.json");
|
|
79183
79198
|
const packageManifest = readJSON(packageJsonPath);
|
|
79184
79199
|
delete packageManifest["dependencies"]?.["express"];
|
|
79185
79200
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -79195,7 +79210,7 @@ function updateAngularJson(ctx) {
|
|
|
79195
79210
|
architectSection.build.options.outputMode = "server";
|
|
79196
79211
|
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
79197
79212
|
architectSection.build.options.assets.push("src/_routes.json");
|
|
79198
|
-
writeFile2((0,
|
|
79213
|
+
writeFile2((0, import_node_path8.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
79199
79214
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
79200
79215
|
}
|
|
79201
79216
|
var config2 = {
|
|
@@ -79227,7 +79242,7 @@ var config2 = {
|
|
|
79227
79242
|
var c3_default2 = config2;
|
|
79228
79243
|
|
|
79229
79244
|
// templates/angular/workers/c3.ts
|
|
79230
|
-
var
|
|
79245
|
+
var import_node_path9 = require("node:path");
|
|
79231
79246
|
var { npm: npm3 } = detectPackageManager();
|
|
79232
79247
|
var generate3 = async (ctx) => {
|
|
79233
79248
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
|
|
@@ -79249,23 +79264,23 @@ async function updateAppCode2() {
|
|
|
79249
79264
|
const s = spinner();
|
|
79250
79265
|
s.start(`Updating application code`);
|
|
79251
79266
|
const appConfigPath = "src/app/app.config.ts";
|
|
79252
|
-
const appConfig = readFile((0,
|
|
79267
|
+
const appConfig = readFile((0, import_node_path9.resolve)(appConfigPath));
|
|
79253
79268
|
const newAppConfig = "import { provideHttpClient, withFetch } from '@angular/common/http';\n" + appConfig.replace(
|
|
79254
79269
|
"providers: [",
|
|
79255
79270
|
"providers: [provideHttpClient(withFetch()), "
|
|
79256
79271
|
);
|
|
79257
|
-
writeFile2((0,
|
|
79272
|
+
writeFile2((0, import_node_path9.resolve)(appConfigPath), newAppConfig);
|
|
79258
79273
|
s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
|
|
79259
79274
|
const appServerRoutesPath = "src/app/app.routes.server.ts";
|
|
79260
|
-
const appRoutes = readFile((0,
|
|
79275
|
+
const appRoutes = readFile((0, import_node_path9.resolve)(appServerRoutesPath));
|
|
79261
79276
|
const newAppRoutes = appRoutes.replace(
|
|
79262
79277
|
"RenderMode.Prerender",
|
|
79263
79278
|
"RenderMode.Server"
|
|
79264
79279
|
);
|
|
79265
|
-
writeFile2((0,
|
|
79280
|
+
writeFile2((0, import_node_path9.resolve)(appServerRoutesPath), newAppRoutes);
|
|
79266
79281
|
s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
|
|
79267
79282
|
s.start(`Updating package.json`);
|
|
79268
|
-
const packageJsonPath = (0,
|
|
79283
|
+
const packageJsonPath = (0, import_node_path9.resolve)("package.json");
|
|
79269
79284
|
const packageManifest = readJSON(packageJsonPath);
|
|
79270
79285
|
delete packageManifest["dependencies"]?.["express"];
|
|
79271
79286
|
delete packageManifest["devDependencies"]?.["@types/express"];
|
|
@@ -79275,12 +79290,12 @@ async function updateAppCode2() {
|
|
|
79275
79290
|
function updateAngularJson2(ctx) {
|
|
79276
79291
|
const s = spinner();
|
|
79277
79292
|
s.start(`Updating angular.json config`);
|
|
79278
|
-
const angularJson = readJSON((0,
|
|
79293
|
+
const angularJson = readJSON((0, import_node_path9.resolve)("angular.json"));
|
|
79279
79294
|
const architectSection = angularJson.projects[ctx.project.name].architect;
|
|
79280
79295
|
architectSection.build.options.outputPath = "dist";
|
|
79281
79296
|
architectSection.build.options.outputMode = "server";
|
|
79282
79297
|
architectSection.build.options.ssr.experimentalPlatform = "neutral";
|
|
79283
|
-
writeFile2((0,
|
|
79298
|
+
writeFile2((0, import_node_path9.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
79284
79299
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
79285
79300
|
}
|
|
79286
79301
|
var config3 = {
|
|
@@ -79776,24 +79791,12 @@ var c3_default19 = {
|
|
|
79776
79791
|
};
|
|
79777
79792
|
|
|
79778
79793
|
// templates/hello-world/c3.ts
|
|
79779
|
-
var import_promises2 = require("node:fs/promises");
|
|
79780
|
-
var import_node_path9 = require("node:path");
|
|
79781
79794
|
var c3_default20 = {
|
|
79782
79795
|
configVersion: 1,
|
|
79783
79796
|
id: "hello-world",
|
|
79784
79797
|
displayName: "Worker only",
|
|
79785
79798
|
description: "For processing requests, transforming responses, or API endpoints",
|
|
79786
79799
|
platform: "workers",
|
|
79787
|
-
async configure(ctx) {
|
|
79788
|
-
if (ctx.args.lang === "python") {
|
|
79789
|
-
const contents = await (0, import_promises2.readFile)(
|
|
79790
|
-
(0, import_node_path9.resolve)(ctx.project.path, "pyproject.toml"),
|
|
79791
|
-
"utf8"
|
|
79792
|
-
);
|
|
79793
|
-
const updated = contents.replaceAll(/<TBD>/g, ctx.project.name);
|
|
79794
|
-
await (0, import_promises2.writeFile)((0, import_node_path9.resolve)(ctx.project.path, "pyproject.toml"), updated);
|
|
79795
|
-
}
|
|
79796
|
-
},
|
|
79797
79800
|
copyFiles: {
|
|
79798
79801
|
variants: {
|
|
79799
79802
|
js: {
|
|
@@ -79811,14 +79814,14 @@ var c3_default20 = {
|
|
|
79811
79814
|
|
|
79812
79815
|
// templates/hono/pages/c3.ts
|
|
79813
79816
|
var generate10 = async (ctx) => {
|
|
79814
|
-
const { name:
|
|
79817
|
+
const { name: pm3 } = detectPackageManager();
|
|
79815
79818
|
await runFrameworkGenerator(ctx, [
|
|
79816
79819
|
ctx.project.name,
|
|
79817
79820
|
"--template",
|
|
79818
79821
|
"cloudflare-pages",
|
|
79819
79822
|
"--install",
|
|
79820
79823
|
"--pm",
|
|
79821
|
-
|
|
79824
|
+
pm3
|
|
79822
79825
|
]);
|
|
79823
79826
|
logRaw("");
|
|
79824
79827
|
};
|
|
@@ -79850,14 +79853,14 @@ var c3_default21 = config19;
|
|
|
79850
79853
|
|
|
79851
79854
|
// templates/hono/workers/c3.ts
|
|
79852
79855
|
var generate11 = async (ctx) => {
|
|
79853
|
-
const { name:
|
|
79856
|
+
const { name: pm3 } = detectPackageManager();
|
|
79854
79857
|
await runFrameworkGenerator(ctx, [
|
|
79855
79858
|
ctx.project.name,
|
|
79856
79859
|
"--template",
|
|
79857
79860
|
"cloudflare-workers",
|
|
79858
79861
|
"--install",
|
|
79859
79862
|
"--pm",
|
|
79860
|
-
|
|
79863
|
+
pm3
|
|
79861
79864
|
]);
|
|
79862
79865
|
logRaw("");
|
|
79863
79866
|
};
|
|
@@ -79894,16 +79897,11 @@ var c3_default23 = config21;
|
|
|
79894
79897
|
|
|
79895
79898
|
// templates/next/c3.ts
|
|
79896
79899
|
var generate12 = async (ctx) => {
|
|
79897
|
-
|
|
79898
|
-
|
|
79899
|
-
|
|
79900
|
-
|
|
79901
|
-
|
|
79902
|
-
// This is a template maintained by Cloudflare that based on a standard Next.js starter project,
|
|
79903
|
-
// and has already been configured to work with Cloudflare Workers
|
|
79904
|
-
"--example",
|
|
79905
|
-
"https://github.com/opennextjs/opennextjs-cloudflare/tree/main/create-cloudflare/next"
|
|
79906
|
-
]);
|
|
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);
|
|
79907
79905
|
};
|
|
79908
79906
|
var envInterfaceName3 = "CloudflareEnv";
|
|
79909
79907
|
var typesPath = "./cloudflare-env.d.ts";
|
|
@@ -79913,17 +79911,7 @@ var c3_default24 = {
|
|
|
79913
79911
|
frameworkCli: "create-next-app",
|
|
79914
79912
|
platform: "workers",
|
|
79915
79913
|
displayName: "Next.js",
|
|
79916
|
-
copyFiles: {
|
|
79917
|
-
path: "./templates"
|
|
79918
|
-
},
|
|
79919
79914
|
generate: generate12,
|
|
79920
|
-
transformPackageJson: async () => ({
|
|
79921
|
-
scripts: {
|
|
79922
|
-
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
79923
|
-
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
79924
|
-
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
79925
|
-
}
|
|
79926
|
-
}),
|
|
79927
79915
|
devScript: "dev",
|
|
79928
79916
|
previewScript: "preview",
|
|
79929
79917
|
deployScript: "deploy",
|
|
@@ -79933,7 +79921,7 @@ var c3_default24 = {
|
|
|
79933
79921
|
|
|
79934
79922
|
// templates/nuxt/pages/c3.ts
|
|
79935
79923
|
var recast5 = __toESM(require_main2());
|
|
79936
|
-
var { npm: npm8, name:
|
|
79924
|
+
var { npm: npm8, name: pm } = detectPackageManager();
|
|
79937
79925
|
var generate13 = async (ctx) => {
|
|
79938
79926
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
79939
79927
|
await runFrameworkGenerator(ctx, [
|
|
@@ -79949,7 +79937,7 @@ var generate13 = async (ctx) => {
|
|
|
79949
79937
|
};
|
|
79950
79938
|
var configure6 = async () => {
|
|
79951
79939
|
const packages = ["nitro-cloudflare-dev"];
|
|
79952
|
-
if (
|
|
79940
|
+
if (pm === "pnpm") {
|
|
79953
79941
|
packages.push("h3");
|
|
79954
79942
|
}
|
|
79955
79943
|
await installPackages(packages, {
|
|
@@ -80029,7 +80017,7 @@ var c3_default25 = config22;
|
|
|
80029
80017
|
|
|
80030
80018
|
// templates/nuxt/workers/c3.ts
|
|
80031
80019
|
var recast6 = __toESM(require_main2());
|
|
80032
|
-
var { npm: npm9, name:
|
|
80020
|
+
var { npm: npm9, name: pm2 } = detectPackageManager();
|
|
80033
80021
|
var generate14 = async (ctx) => {
|
|
80034
80022
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
80035
80023
|
await runFrameworkGenerator(ctx, [
|
|
@@ -80045,7 +80033,7 @@ var generate14 = async (ctx) => {
|
|
|
80045
80033
|
};
|
|
80046
80034
|
var configure7 = async () => {
|
|
80047
80035
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
80048
|
-
if (
|
|
80036
|
+
if (pm2 === "pnpm") {
|
|
80049
80037
|
packages.push("h3");
|
|
80050
80038
|
}
|
|
80051
80039
|
await installPackages(packages, {
|
|
@@ -80143,8 +80131,8 @@ var config25 = {
|
|
|
80143
80131
|
var c3_default28 = config25;
|
|
80144
80132
|
|
|
80145
80133
|
// templates/pre-existing/c3.ts
|
|
80146
|
-
var
|
|
80147
|
-
var
|
|
80134
|
+
var import_node_fs8 = require("node:fs");
|
|
80135
|
+
var import_promises2 = require("node:fs/promises");
|
|
80148
80136
|
var import_node_os4 = require("node:os");
|
|
80149
80137
|
var import_node_path10 = require("node:path");
|
|
80150
80138
|
|
|
@@ -80259,7 +80247,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80259
80247
|
}
|
|
80260
80248
|
);
|
|
80261
80249
|
}
|
|
80262
|
-
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-"));
|
|
80263
80251
|
await runCommand(
|
|
80264
80252
|
[
|
|
80265
80253
|
...dlx,
|
|
@@ -80281,7 +80269,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80281
80269
|
)}`
|
|
80282
80270
|
}
|
|
80283
80271
|
);
|
|
80284
|
-
await (0,
|
|
80272
|
+
await (0, import_promises2.cp)(
|
|
80285
80273
|
(0, import_node_path10.join)(tempdir, ctx.args.existingScript, "src"),
|
|
80286
80274
|
(0, import_node_path10.join)(ctx.project.path, "src"),
|
|
80287
80275
|
{ recursive: true }
|
|
@@ -80290,8 +80278,8 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
80290
80278
|
let configFileCopied = false;
|
|
80291
80279
|
for (const configFile of configFiles) {
|
|
80292
80280
|
const sourcePath = (0, import_node_path10.join)(tempdir, ctx.args.existingScript, configFile);
|
|
80293
|
-
if ((0,
|
|
80294
|
-
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));
|
|
80295
80283
|
configFileCopied = true;
|
|
80296
80284
|
break;
|
|
80297
80285
|
}
|
|
@@ -80372,7 +80360,6 @@ var configure8 = async (ctx) => {
|
|
|
80372
80360
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
80373
80361
|
await runCommand(cmd);
|
|
80374
80362
|
addBindingsProxy(ctx);
|
|
80375
|
-
populateCloudflareEnv();
|
|
80376
80363
|
};
|
|
80377
80364
|
var addBindingsProxy = (ctx) => {
|
|
80378
80365
|
if (!usesTypescript(ctx)) {
|
|
@@ -80417,33 +80404,6 @@ var addBindingsProxy = (ctx) => {
|
|
|
80417
80404
|
});
|
|
80418
80405
|
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
80419
80406
|
};
|
|
80420
|
-
var populateCloudflareEnv = () => {
|
|
80421
|
-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
80422
|
-
const s = spinner();
|
|
80423
|
-
s.start(`Updating \`${entrypointPath}\``);
|
|
80424
|
-
transformFile(entrypointPath, {
|
|
80425
|
-
visitTSInterfaceDeclaration: function(n) {
|
|
80426
|
-
const b3 = recast7.types.builders;
|
|
80427
|
-
const id = n.node.id;
|
|
80428
|
-
if (id.name !== "QwikCityPlatform") {
|
|
80429
|
-
this.traverse(n);
|
|
80430
|
-
}
|
|
80431
|
-
const newBody = [
|
|
80432
|
-
["env", "Env"]
|
|
80433
|
-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
80434
|
-
// ["cf", "CfProperties"],
|
|
80435
|
-
].map(
|
|
80436
|
-
([varName, type]) => b3.tsPropertySignature(
|
|
80437
|
-
b3.identifier(varName),
|
|
80438
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
80439
|
-
)
|
|
80440
|
-
);
|
|
80441
|
-
n.node.body.body = newBody;
|
|
80442
|
-
return false;
|
|
80443
|
-
}
|
|
80444
|
-
});
|
|
80445
|
-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
80446
|
-
};
|
|
80447
80407
|
var config28 = {
|
|
80448
80408
|
configVersion: 1,
|
|
80449
80409
|
id: "qwik",
|
|
@@ -80483,7 +80443,6 @@ var configure9 = async (ctx) => {
|
|
|
80483
80443
|
await runCommand(cmd);
|
|
80484
80444
|
removeFile("./public/_routes.json");
|
|
80485
80445
|
addBindingsProxy2(ctx);
|
|
80486
|
-
populateCloudflareEnv2();
|
|
80487
80446
|
};
|
|
80488
80447
|
var addBindingsProxy2 = (ctx) => {
|
|
80489
80448
|
if (!usesTypescript(ctx)) {
|
|
@@ -80528,33 +80487,6 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
80528
80487
|
});
|
|
80529
80488
|
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
|
|
80530
80489
|
};
|
|
80531
|
-
var populateCloudflareEnv2 = () => {
|
|
80532
|
-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
|
|
80533
|
-
const s = spinner();
|
|
80534
|
-
s.start(`Updating \`${entrypointPath}\``);
|
|
80535
|
-
transformFile(entrypointPath, {
|
|
80536
|
-
visitTSInterfaceDeclaration: function(n) {
|
|
80537
|
-
const b3 = recast8.types.builders;
|
|
80538
|
-
const id = n.node.id;
|
|
80539
|
-
if (id.name !== "QwikCityPlatform") {
|
|
80540
|
-
this.traverse(n);
|
|
80541
|
-
}
|
|
80542
|
-
const newBody = [
|
|
80543
|
-
["env", "Env"]
|
|
80544
|
-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
|
|
80545
|
-
// ["cf", "CfProperties"],
|
|
80546
|
-
].map(
|
|
80547
|
-
([varName, type]) => b3.tsPropertySignature(
|
|
80548
|
-
b3.identifier(varName),
|
|
80549
|
-
b3.tsTypeAnnotation(b3.tsTypeReference(b3.identifier(type)))
|
|
80550
|
-
)
|
|
80551
|
-
);
|
|
80552
|
-
n.node.body.body = newBody;
|
|
80553
|
-
return false;
|
|
80554
|
-
}
|
|
80555
|
-
});
|
|
80556
|
-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
80557
|
-
};
|
|
80558
80490
|
var config29 = {
|
|
80559
80491
|
configVersion: 1,
|
|
80560
80492
|
id: "qwik",
|
|
@@ -80593,9 +80525,11 @@ var { npm: npm12 } = detectPackageManager();
|
|
|
80593
80525
|
var generate17 = async (ctx) => {
|
|
80594
80526
|
await runFrameworkGenerator(ctx, [
|
|
80595
80527
|
ctx.project.name,
|
|
80596
|
-
|
|
80597
|
-
|
|
80598
|
-
|
|
80528
|
+
...ctx.args.experimental ? [] : [
|
|
80529
|
+
"--template",
|
|
80530
|
+
// React-router deleted the template here
|
|
80531
|
+
"https://github.com/remix-run/react-router-templates/tree/29ac272b9532fe26463a2d2693fc73ff3c1e884b/cloudflare"
|
|
80532
|
+
],
|
|
80599
80533
|
// to prevent asking about git twice, just let c3 do it
|
|
80600
80534
|
"--no-git-init",
|
|
80601
80535
|
"--no-install"
|
|
@@ -80733,9 +80667,9 @@ function transformViteConfig(ctx) {
|
|
|
80733
80667
|
if (callee.name !== "defineConfig") {
|
|
80734
80668
|
return this.traverse(n);
|
|
80735
80669
|
}
|
|
80736
|
-
const
|
|
80737
|
-
(0, import_node_assert3.default)(t.ObjectExpression.check(
|
|
80738
|
-
const pluginsProp =
|
|
80670
|
+
const config47 = n.node.arguments[0];
|
|
80671
|
+
(0, import_node_assert3.default)(t.ObjectExpression.check(config47));
|
|
80672
|
+
const pluginsProp = config47.properties.find((prop) => isPluginsProp(prop));
|
|
80739
80673
|
(0, import_node_assert3.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
80740
80674
|
pluginsProp.value.elements.push(
|
|
80741
80675
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -80877,54 +80811,6 @@ var config36 = {
|
|
|
80877
80811
|
};
|
|
80878
80812
|
var c3_default39 = config36;
|
|
80879
80813
|
|
|
80880
|
-
// src/helpers/compatDate.ts
|
|
80881
|
-
var import_node_fs8 = require("node:fs");
|
|
80882
|
-
var import_node_path11 = require("node:path");
|
|
80883
|
-
async function getWorkerdCompatibilityDate() {
|
|
80884
|
-
const s = spinner();
|
|
80885
|
-
s.start("Retrieving current workerd compatibility date");
|
|
80886
|
-
try {
|
|
80887
|
-
const latestWorkerdVersion = await getLatestPackageVersion("workerd");
|
|
80888
|
-
const match = latestWorkerdVersion.match(/\d+\.(\d{4})(\d{2})(\d{2})\.\d+/);
|
|
80889
|
-
if (match) {
|
|
80890
|
-
const [, year, month, date] = match;
|
|
80891
|
-
let compatDate = /* @__PURE__ */ new Date(`${year}-${month}-${date}`);
|
|
80892
|
-
if (compatDate.getTime() > Date.now()) {
|
|
80893
|
-
compatDate = new Date(Date.now());
|
|
80894
|
-
}
|
|
80895
|
-
const compatDateString = compatDate.toISOString().slice(0, 10);
|
|
80896
|
-
s.stop(`${brandColor("compatibility date")} ${dim(compatDateString)}`);
|
|
80897
|
-
return compatDateString;
|
|
80898
|
-
}
|
|
80899
|
-
} catch {
|
|
80900
|
-
}
|
|
80901
|
-
const fallbackDate = "2024-11-11";
|
|
80902
|
-
s.stop(
|
|
80903
|
-
`${brandColor("compatibility date")} ${dim(
|
|
80904
|
-
` Could not find workerd date, falling back to ${fallbackDate}`
|
|
80905
|
-
)}`
|
|
80906
|
-
);
|
|
80907
|
-
return fallbackDate;
|
|
80908
|
-
}
|
|
80909
|
-
function getLatestTypesEntrypoint(ctx) {
|
|
80910
|
-
const workersTypesPath = (0, import_node_path11.resolve)(
|
|
80911
|
-
ctx.project.path,
|
|
80912
|
-
"node_modules",
|
|
80913
|
-
"@cloudflare",
|
|
80914
|
-
"workers-types"
|
|
80915
|
-
);
|
|
80916
|
-
try {
|
|
80917
|
-
const entrypoints = (0, import_node_fs8.readdirSync)(workersTypesPath);
|
|
80918
|
-
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
80919
|
-
if (sorted.length === 0) {
|
|
80920
|
-
return null;
|
|
80921
|
-
}
|
|
80922
|
-
return sorted[0];
|
|
80923
|
-
} catch {
|
|
80924
|
-
return null;
|
|
80925
|
-
}
|
|
80926
|
-
}
|
|
80927
|
-
|
|
80928
80814
|
// templates/solid/c3.ts
|
|
80929
80815
|
var recast10 = __toESM(require_main2());
|
|
80930
80816
|
var { npm: npm16 } = detectPackageManager();
|
|
@@ -81256,12 +81142,35 @@ var config41 = {
|
|
|
81256
81142
|
};
|
|
81257
81143
|
var c3_default44 = config41;
|
|
81258
81144
|
|
|
81145
|
+
// templates/vike/c3.ts
|
|
81146
|
+
var generate25 = async (ctx) => {
|
|
81147
|
+
await runFrameworkGenerator(ctx, [
|
|
81148
|
+
ctx.project.name,
|
|
81149
|
+
"--cloudflare",
|
|
81150
|
+
// to prevent asking about git twice, just let c3 do it
|
|
81151
|
+
"--no-git"
|
|
81152
|
+
]);
|
|
81153
|
+
logRaw("");
|
|
81154
|
+
};
|
|
81155
|
+
var config42 = {
|
|
81156
|
+
configVersion: 1,
|
|
81157
|
+
id: "vike",
|
|
81158
|
+
platform: "workers",
|
|
81159
|
+
frameworkCli: "create-vike",
|
|
81160
|
+
displayName: "Vike",
|
|
81161
|
+
generate: generate25,
|
|
81162
|
+
devScript: "dev",
|
|
81163
|
+
deployScript: "deploy",
|
|
81164
|
+
previewScript: "preview"
|
|
81165
|
+
};
|
|
81166
|
+
var c3_default45 = config42;
|
|
81167
|
+
|
|
81259
81168
|
// templates/vue/pages/c3.ts
|
|
81260
81169
|
var { npm: npm20 } = detectPackageManager();
|
|
81261
|
-
var
|
|
81170
|
+
var generate26 = async (ctx) => {
|
|
81262
81171
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
81263
81172
|
};
|
|
81264
|
-
var
|
|
81173
|
+
var config43 = {
|
|
81265
81174
|
configVersion: 1,
|
|
81266
81175
|
id: "vue",
|
|
81267
81176
|
frameworkCli: "create-vue",
|
|
@@ -81270,7 +81179,7 @@ var config42 = {
|
|
|
81270
81179
|
hidden: true,
|
|
81271
81180
|
path: "templates/vue/pages",
|
|
81272
81181
|
copyFiles: { path: "./templates" },
|
|
81273
|
-
generate:
|
|
81182
|
+
generate: generate26,
|
|
81274
81183
|
transformPackageJson: async () => ({
|
|
81275
81184
|
scripts: {
|
|
81276
81185
|
deploy: `${npm20} run build && wrangler pages deploy`,
|
|
@@ -81282,11 +81191,11 @@ var config42 = {
|
|
|
81282
81191
|
deployScript: "deploy",
|
|
81283
81192
|
previewScript: "preview"
|
|
81284
81193
|
};
|
|
81285
|
-
var
|
|
81194
|
+
var c3_default46 = config43;
|
|
81286
81195
|
|
|
81287
81196
|
// templates/vue/workers/c3.ts
|
|
81288
81197
|
var { npm: npm21 } = detectPackageManager();
|
|
81289
|
-
var
|
|
81198
|
+
var generate27 = async (ctx) => {
|
|
81290
81199
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
81291
81200
|
type: "select",
|
|
81292
81201
|
question: "Would you like to use TypeScript?",
|
|
@@ -81324,7 +81233,7 @@ function updateTsconfigJson2() {
|
|
|
81324
81233
|
writeJSON("tsconfig.json", tsconfig);
|
|
81325
81234
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
81326
81235
|
}
|
|
81327
|
-
var
|
|
81236
|
+
var config44 = {
|
|
81328
81237
|
configVersion: 1,
|
|
81329
81238
|
id: "vue",
|
|
81330
81239
|
frameworkCli: "create-vue",
|
|
@@ -81345,7 +81254,7 @@ var config43 = {
|
|
|
81345
81254
|
}
|
|
81346
81255
|
},
|
|
81347
81256
|
configure: configure14,
|
|
81348
|
-
generate:
|
|
81257
|
+
generate: generate27,
|
|
81349
81258
|
transformPackageJson: async (_3, ctx) => ({
|
|
81350
81259
|
scripts: {
|
|
81351
81260
|
deploy: `${npm21} run build && wrangler deploy`,
|
|
@@ -81357,18 +81266,18 @@ var config43 = {
|
|
|
81357
81266
|
deployScript: "deploy",
|
|
81358
81267
|
previewScript: "preview"
|
|
81359
81268
|
};
|
|
81360
|
-
var
|
|
81269
|
+
var c3_default47 = config44;
|
|
81361
81270
|
|
|
81362
81271
|
// templates/vue/c3.ts
|
|
81363
|
-
var
|
|
81272
|
+
var config45 = {
|
|
81364
81273
|
displayName: "Vue",
|
|
81365
|
-
platformVariants: { pages:
|
|
81274
|
+
platformVariants: { pages: c3_default46, workers: c3_default47 }
|
|
81366
81275
|
};
|
|
81367
|
-
var
|
|
81276
|
+
var c3_default48 = config45;
|
|
81368
81277
|
|
|
81369
81278
|
// templates/waku/c3.ts
|
|
81370
81279
|
var { npm: npm22 } = detectPackageManager();
|
|
81371
|
-
var
|
|
81280
|
+
var generate28 = async (ctx) => {
|
|
81372
81281
|
await runFrameworkGenerator(ctx, [
|
|
81373
81282
|
"--project-name",
|
|
81374
81283
|
ctx.project.name,
|
|
@@ -81376,14 +81285,14 @@ var generate27 = async (ctx) => {
|
|
|
81376
81285
|
"07_cloudflare"
|
|
81377
81286
|
]);
|
|
81378
81287
|
};
|
|
81379
|
-
var
|
|
81288
|
+
var config46 = {
|
|
81380
81289
|
configVersion: 1,
|
|
81381
81290
|
id: "waku",
|
|
81382
81291
|
frameworkCli: "create-waku",
|
|
81383
81292
|
platform: "workers",
|
|
81384
81293
|
displayName: "Waku",
|
|
81385
81294
|
path: "templates/waku",
|
|
81386
|
-
generate:
|
|
81295
|
+
generate: generate28,
|
|
81387
81296
|
transformPackageJson: async () => ({
|
|
81388
81297
|
scripts: {
|
|
81389
81298
|
deploy: `${npm22} run build && wrangler deploy`,
|
|
@@ -81394,13 +81303,13 @@ var config45 = {
|
|
|
81394
81303
|
deployScript: "deploy",
|
|
81395
81304
|
previewScript: "preview"
|
|
81396
81305
|
};
|
|
81397
|
-
var
|
|
81306
|
+
var c3_default49 = config46;
|
|
81398
81307
|
|
|
81399
81308
|
// src/git.ts
|
|
81400
81309
|
var import_node_assert4 = __toESM(require("node:assert"));
|
|
81401
81310
|
|
|
81402
81311
|
// ../wrangler/package.json
|
|
81403
|
-
var version2 = "4.
|
|
81312
|
+
var version2 = "4.54.0";
|
|
81404
81313
|
|
|
81405
81314
|
// src/git.ts
|
|
81406
81315
|
var offerGit = async (ctx) => {
|
|
@@ -81579,7 +81488,7 @@ async function getProductionBranch(cwd) {
|
|
|
81579
81488
|
|
|
81580
81489
|
// src/validators.ts
|
|
81581
81490
|
var import_node_fs10 = require("node:fs");
|
|
81582
|
-
var
|
|
81491
|
+
var import_node_path11 = require("node:path");
|
|
81583
81492
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
81584
81493
|
var validateTemplateUrl = (value) => {
|
|
81585
81494
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -81587,7 +81496,7 @@ var validateTemplateUrl = (value) => {
|
|
|
81587
81496
|
}
|
|
81588
81497
|
};
|
|
81589
81498
|
var validateProjectDirectory = (relativePath, args) => {
|
|
81590
|
-
const path6 = (0,
|
|
81499
|
+
const path6 = (0, import_node_path11.resolve)(relativePath);
|
|
81591
81500
|
const existsAlready = (0, import_node_fs10.existsSync)(path6);
|
|
81592
81501
|
if (existsAlready) {
|
|
81593
81502
|
for (const file of (0, import_node_fs10.readdirSync)(path6)) {
|
|
@@ -81597,7 +81506,7 @@ var validateProjectDirectory = (relativePath, args) => {
|
|
|
81597
81506
|
}
|
|
81598
81507
|
}
|
|
81599
81508
|
if (!args.existingScript) {
|
|
81600
|
-
const projectName = (0,
|
|
81509
|
+
const projectName = (0, import_node_path11.basename)(path6);
|
|
81601
81510
|
const invalidChars = /[^a-z0-9-]/;
|
|
81602
81511
|
const invalidStartEnd = /^-|-$/;
|
|
81603
81512
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -81658,8 +81567,8 @@ var isAllowedExistingFile = (file) => {
|
|
|
81658
81567
|
var defaultSelectVariant = async (ctx) => {
|
|
81659
81568
|
return ctx.args.lang;
|
|
81660
81569
|
};
|
|
81661
|
-
var templateSupportsLanguage = (
|
|
81662
|
-
const { copyFiles } =
|
|
81570
|
+
var templateSupportsLanguage = (config47, lang) => {
|
|
81571
|
+
const { copyFiles } = config47;
|
|
81663
81572
|
if (!copyFiles || isVariantInfo(copyFiles)) {
|
|
81664
81573
|
return false;
|
|
81665
81574
|
}
|
|
@@ -81673,24 +81582,31 @@ var filterTemplatesByLanguage = (templates, lang) => {
|
|
|
81673
81582
|
return templates;
|
|
81674
81583
|
}
|
|
81675
81584
|
return Object.fromEntries(
|
|
81676
|
-
Object.entries(templates).filter(([,
|
|
81677
|
-
if ("platformVariants" in
|
|
81678
|
-
return templateSupportsLanguage(
|
|
81585
|
+
Object.entries(templates).filter(([, config47]) => {
|
|
81586
|
+
if ("platformVariants" in config47) {
|
|
81587
|
+
return templateSupportsLanguage(config47.platformVariants.pages, lang) || templateSupportsLanguage(config47.platformVariants.workers, lang);
|
|
81679
81588
|
}
|
|
81680
|
-
return templateSupportsLanguage(
|
|
81589
|
+
return templateSupportsLanguage(config47, lang);
|
|
81681
81590
|
})
|
|
81682
81591
|
);
|
|
81683
81592
|
};
|
|
81684
81593
|
function getFrameworkMap({ experimental = false }) {
|
|
81685
81594
|
if (experimental) {
|
|
81686
81595
|
return {
|
|
81596
|
+
analog: c3_default,
|
|
81597
|
+
angular: c3_default4,
|
|
81598
|
+
astro: c3_default7,
|
|
81599
|
+
docusaurus: c3_default11,
|
|
81687
81600
|
gatsby: c3_default14,
|
|
81601
|
+
nuxt: c3_default27,
|
|
81602
|
+
qwik: c3_default33,
|
|
81603
|
+
react: c3_default37,
|
|
81604
|
+
"react-router": c3_default34,
|
|
81605
|
+
redwood: c3_default38,
|
|
81606
|
+
solid: c3_default40,
|
|
81688
81607
|
svelte: c3_default43,
|
|
81689
|
-
docusaurus: c3_default11,
|
|
81690
|
-
astro: c3_default7,
|
|
81691
81608
|
"tanstack-start": c3_default44,
|
|
81692
|
-
|
|
81693
|
-
solid: c3_default40
|
|
81609
|
+
vue: c3_default48
|
|
81694
81610
|
};
|
|
81695
81611
|
} else {
|
|
81696
81612
|
return {
|
|
@@ -81709,8 +81625,9 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
81709
81625
|
solid: c3_default40,
|
|
81710
81626
|
svelte: c3_default43,
|
|
81711
81627
|
"tanstack-start": c3_default44,
|
|
81712
|
-
|
|
81713
|
-
|
|
81628
|
+
vike: c3_default45,
|
|
81629
|
+
vue: c3_default48,
|
|
81630
|
+
waku: c3_default49
|
|
81714
81631
|
};
|
|
81715
81632
|
}
|
|
81716
81633
|
}
|
|
@@ -81914,10 +81831,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
81914
81831
|
let template;
|
|
81915
81832
|
if (category === "web-framework") {
|
|
81916
81833
|
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
81917
|
-
(acc, [key,
|
|
81918
|
-
if (!
|
|
81834
|
+
(acc, [key, config47]) => {
|
|
81835
|
+
if (!config47.hidden || args.framework) {
|
|
81919
81836
|
acc.push({
|
|
81920
|
-
label:
|
|
81837
|
+
label: config47.displayName,
|
|
81921
81838
|
value: key
|
|
81922
81839
|
});
|
|
81923
81840
|
}
|
|
@@ -81943,7 +81860,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
81943
81860
|
if ("platformVariants" in frameworkConfig) {
|
|
81944
81861
|
const availableVariants = Object.entries(
|
|
81945
81862
|
frameworkConfig.platformVariants
|
|
81946
|
-
).filter(([,
|
|
81863
|
+
).filter(([, config47]) => !config47.hidden);
|
|
81947
81864
|
if (availableVariants.length === 1) {
|
|
81948
81865
|
args.platform ??= availableVariants[0][0];
|
|
81949
81866
|
}
|
|
@@ -82026,7 +81943,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
82026
81943
|
envInterfaceName: "Env",
|
|
82027
81944
|
...template
|
|
82028
81945
|
};
|
|
82029
|
-
const path6 = (0,
|
|
81946
|
+
const path6 = (0, import_node_path12.resolve)(projectName);
|
|
82030
81947
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
82031
81948
|
if (languageVariants.length > 0) {
|
|
82032
81949
|
if (hasTsConfig(path6)) {
|
|
@@ -82052,8 +81969,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
82052
81969
|
}
|
|
82053
81970
|
}
|
|
82054
81971
|
}
|
|
82055
|
-
const name3 = (0,
|
|
82056
|
-
const directory = (0,
|
|
81972
|
+
const name3 = (0, import_node_path12.basename)(path6);
|
|
81973
|
+
const directory = (0, import_node_path12.dirname)(path6);
|
|
82057
81974
|
const originalCWD = process.cwd();
|
|
82058
81975
|
return {
|
|
82059
81976
|
project: { name: name3, path: path6 },
|
|
@@ -82073,7 +81990,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
82073
81990
|
const { copyFiles } = ctx.template;
|
|
82074
81991
|
let srcdir;
|
|
82075
81992
|
if (isVariantInfo(copyFiles)) {
|
|
82076
|
-
srcdir = (0,
|
|
81993
|
+
srcdir = (0, import_node_path12.join)(getTemplatePath(ctx), copyFiles.path);
|
|
82077
81994
|
} else {
|
|
82078
81995
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
82079
81996
|
const variant = await selectVariant(ctx);
|
|
@@ -82083,16 +82000,16 @@ async function copyTemplateFiles(ctx) {
|
|
|
82083
82000
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
82084
82001
|
);
|
|
82085
82002
|
}
|
|
82086
|
-
srcdir = (0,
|
|
82003
|
+
srcdir = (0, import_node_path12.join)(getTemplatePath(ctx), variantInfo.path);
|
|
82087
82004
|
}
|
|
82088
82005
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
82089
|
-
const destdir = (0,
|
|
82006
|
+
const destdir = (0, import_node_path12.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
82090
82007
|
const s = spinner();
|
|
82091
82008
|
s.start(`Copying template files`);
|
|
82092
|
-
await (0,
|
|
82093
|
-
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");
|
|
82094
82011
|
if ((0, import_node_fs11.existsSync)(dummyGitIgnorePath)) {
|
|
82095
|
-
await (0,
|
|
82012
|
+
await (0, import_promises3.rename)(dummyGitIgnorePath, (0, import_node_path12.join)(destdir, ".gitignore"));
|
|
82096
82013
|
}
|
|
82097
82014
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
82098
82015
|
}
|
|
@@ -82104,43 +82021,41 @@ var processRemoteTemplate = async (args) => {
|
|
|
82104
82021
|
validate: (val) => validateTemplateUrl(val || C3_DEFAULTS.template),
|
|
82105
82022
|
defaultValue: C3_DEFAULTS.template
|
|
82106
82023
|
});
|
|
82107
|
-
|
|
82108
|
-
|
|
82109
|
-
|
|
82110
|
-
|
|
82111
|
-
|
|
82112
|
-
const config46 = inferTemplateConfig(path6);
|
|
82113
|
-
validateTemplate(path6, config46);
|
|
82024
|
+
const path6 = await downloadRemoteTemplate(templateUrl, {
|
|
82025
|
+
mode: args.templateMode
|
|
82026
|
+
});
|
|
82027
|
+
const config47 = inferTemplateConfig(path6);
|
|
82028
|
+
validateTemplate(path6, config47);
|
|
82114
82029
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
82115
82030
|
return {
|
|
82116
82031
|
path: path6,
|
|
82117
|
-
...
|
|
82032
|
+
...config47
|
|
82118
82033
|
};
|
|
82119
82034
|
};
|
|
82120
|
-
var validateTemplate = (path6,
|
|
82121
|
-
if (!
|
|
82035
|
+
var validateTemplate = (path6, config47) => {
|
|
82036
|
+
if (!config47.copyFiles) {
|
|
82122
82037
|
return;
|
|
82123
82038
|
}
|
|
82124
|
-
if (isVariantInfo(
|
|
82125
|
-
validateTemplateSrcDirectory((0,
|
|
82039
|
+
if (isVariantInfo(config47.copyFiles)) {
|
|
82040
|
+
validateTemplateSrcDirectory((0, import_node_path12.resolve)(path6, config47.copyFiles.path), config47);
|
|
82126
82041
|
} else {
|
|
82127
|
-
for (const variant of Object.values(
|
|
82128
|
-
validateTemplateSrcDirectory((0,
|
|
82042
|
+
for (const variant of Object.values(config47.copyFiles.variants)) {
|
|
82043
|
+
validateTemplateSrcDirectory((0, import_node_path12.resolve)(path6, variant.path), config47);
|
|
82129
82044
|
}
|
|
82130
82045
|
}
|
|
82131
82046
|
};
|
|
82132
|
-
var validateTemplateSrcDirectory = (path6,
|
|
82133
|
-
if (
|
|
82134
|
-
const wranglerTomlPath = (0,
|
|
82135
|
-
const wranglerJsonPath = (0,
|
|
82136
|
-
const wranglerJsoncPath = (0,
|
|
82047
|
+
var validateTemplateSrcDirectory = (path6, config47) => {
|
|
82048
|
+
if (config47.platform === "workers") {
|
|
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");
|
|
82137
82052
|
if (!(0, import_node_fs11.existsSync)(wranglerTomlPath) && !(0, import_node_fs11.existsSync)(wranglerJsonPath) && !(0, import_node_fs11.existsSync)(wranglerJsoncPath)) {
|
|
82138
82053
|
throw new Error(
|
|
82139
82054
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
82140
82055
|
);
|
|
82141
82056
|
}
|
|
82142
82057
|
}
|
|
82143
|
-
const pkgJsonPath = (0,
|
|
82058
|
+
const pkgJsonPath = (0, import_node_path12.resolve)(path6, "package.json");
|
|
82144
82059
|
if (!(0, import_node_fs11.existsSync)(pkgJsonPath)) {
|
|
82145
82060
|
throw new Error(
|
|
82146
82061
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
@@ -82158,50 +82073,50 @@ var inferTemplateConfig = (path6) => {
|
|
|
82158
82073
|
};
|
|
82159
82074
|
var inferCopyFilesDefinition = (path6) => {
|
|
82160
82075
|
const variants = {};
|
|
82161
|
-
if ((0, import_node_fs11.existsSync)((0,
|
|
82076
|
+
if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(path6, "js"))) {
|
|
82162
82077
|
variants["js"] = { path: "./js" };
|
|
82163
82078
|
}
|
|
82164
|
-
if ((0, import_node_fs11.existsSync)((0,
|
|
82079
|
+
if ((0, import_node_fs11.existsSync)((0, import_node_path12.join)(path6, "ts"))) {
|
|
82165
82080
|
variants["ts"] = { path: "./ts" };
|
|
82166
82081
|
}
|
|
82167
82082
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
82168
82083
|
return copyFiles;
|
|
82169
82084
|
};
|
|
82170
|
-
|
|
82085
|
+
async function downloadRemoteTemplate(src, options = {}) {
|
|
82171
82086
|
try {
|
|
82172
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
|
+
}
|
|
82173
82091
|
const emitter = (0, import_degit.default)(src, {
|
|
82174
82092
|
cache: false,
|
|
82175
82093
|
verbose: false,
|
|
82176
82094
|
force: true,
|
|
82177
|
-
mode
|
|
82095
|
+
mode: options.mode
|
|
82178
82096
|
});
|
|
82179
|
-
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"));
|
|
82180
82098
|
await emitter.clone(tmpDir);
|
|
82181
82099
|
return tmpDir;
|
|
82182
82100
|
} catch {
|
|
82183
82101
|
updateStatus(`${brandColor("template")} ${dim("failed")}`);
|
|
82184
82102
|
throw new Error(`Failed to clone remote template: ${src}`);
|
|
82185
82103
|
}
|
|
82186
|
-
}
|
|
82104
|
+
}
|
|
82187
82105
|
function updatePythonPackageName(path6, projectName) {
|
|
82188
|
-
const
|
|
82189
|
-
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)) {
|
|
82190
82108
|
return;
|
|
82191
82109
|
}
|
|
82192
82110
|
const s = spinner();
|
|
82193
82111
|
s.start("Updating name in `pyproject.toml`");
|
|
82194
|
-
let
|
|
82195
|
-
|
|
82196
|
-
|
|
82197
|
-
`"${projectName}"`
|
|
82198
|
-
);
|
|
82199
|
-
writeFile2(pyprojectTomlPath, pyprojectTomlContents);
|
|
82112
|
+
let pyProject = readFile(pyProjectFile);
|
|
82113
|
+
pyProject = pyProject.replace('"TBD"', `"${projectName}"`).replace('"<PROJECT_NAME>"', `"${projectName}"`);
|
|
82114
|
+
writeFile2(pyProjectFile, pyProject);
|
|
82200
82115
|
s.stop(`${brandColor("updated")} ${dim("`pyproject.toml`")}`);
|
|
82201
82116
|
}
|
|
82202
|
-
var updatePackageName =
|
|
82203
|
-
const placeholderNames = ["<TBD>", "TBD", ""];
|
|
82204
|
-
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");
|
|
82205
82120
|
const pkgJson = readJSON(pkgJsonPath);
|
|
82206
82121
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
82207
82122
|
return;
|
|
@@ -82219,7 +82134,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
82219
82134
|
}
|
|
82220
82135
|
const s = spinner();
|
|
82221
82136
|
s.start("Updating `package.json` scripts");
|
|
82222
|
-
const pkgJsonPath = (0,
|
|
82137
|
+
const pkgJsonPath = (0, import_node_path12.resolve)(ctx.project.path, "package.json");
|
|
82223
82138
|
let pkgJson = readJSON(pkgJsonPath);
|
|
82224
82139
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
82225
82140
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -82228,9 +82143,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
82228
82143
|
};
|
|
82229
82144
|
var getTemplatePath = (ctx) => {
|
|
82230
82145
|
if (ctx.template.path) {
|
|
82231
|
-
return (0,
|
|
82146
|
+
return (0, import_node_path12.resolve)(__dirname, "..", ctx.template.path);
|
|
82232
82147
|
}
|
|
82233
|
-
return (0,
|
|
82148
|
+
return (0, import_node_path12.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
82234
82149
|
};
|
|
82235
82150
|
var isVariantInfo = (copyFiles) => {
|
|
82236
82151
|
return "path" in copyFiles;
|
|
@@ -82381,8 +82296,8 @@ var cliDefinition = {
|
|
|
82381
82296
|
|
|
82382
82297
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
82383
82298
|
|
|
82384
|
-
npm create cloudflare -- --framework
|
|
82385
|
-
pnpm create cloudflare --framework
|
|
82299
|
+
npm create cloudflare -- --framework svelte -- --types=ts
|
|
82300
|
+
pnpm create cloudflare --framework svelte -- --types=ts
|
|
82386
82301
|
`,
|
|
82387
82302
|
values: (args) => getNamesAndDescriptions(
|
|
82388
82303
|
getFrameworkMap({
|
|
@@ -82647,12 +82562,12 @@ var processArgument = async (args, key, promptConfig) => {
|
|
|
82647
82562
|
};
|
|
82648
82563
|
|
|
82649
82564
|
// src/deploy.ts
|
|
82650
|
-
var
|
|
82565
|
+
var import_promises5 = require("node:fs/promises");
|
|
82651
82566
|
var import_node_os6 = require("node:os");
|
|
82652
|
-
var
|
|
82567
|
+
var import_node_path14 = require("node:path");
|
|
82653
82568
|
|
|
82654
82569
|
// src/helpers/poll.ts
|
|
82655
|
-
var
|
|
82570
|
+
var import_promises4 = require("node:timers/promises");
|
|
82656
82571
|
var import_dns2 = __toESM(require_dns22());
|
|
82657
82572
|
var import_undici3 = __toESM(require_undici());
|
|
82658
82573
|
var TIMEOUT_MS = 1e3 * 60 * 5;
|
|
@@ -82662,7 +82577,7 @@ var poll = async (url) => {
|
|
|
82662
82577
|
const domain = new URL(url).host;
|
|
82663
82578
|
const s = spinner();
|
|
82664
82579
|
s.start("Waiting for DNS to propagate. This might take a few minutes.");
|
|
82665
|
-
await (0,
|
|
82580
|
+
await (0, import_promises4.setTimeout)(1e4);
|
|
82666
82581
|
await pollDns(domain, start, s);
|
|
82667
82582
|
if (await pollHttp(url, start, s)) {
|
|
82668
82583
|
return true;
|
|
@@ -82683,7 +82598,7 @@ var pollDns = async (domain, start, s) => {
|
|
|
82683
82598
|
s.stop(`${brandColor("DNS propagation")} ${dim("complete")}.`);
|
|
82684
82599
|
return;
|
|
82685
82600
|
}
|
|
82686
|
-
await (0,
|
|
82601
|
+
await (0, import_promises4.setTimeout)(POLL_INTERVAL_MS);
|
|
82687
82602
|
}
|
|
82688
82603
|
};
|
|
82689
82604
|
var pollHttp = async (url, start, s) => {
|
|
@@ -82708,7 +82623,7 @@ var pollHttp = async (url, start, s) => {
|
|
|
82708
82623
|
throw e;
|
|
82709
82624
|
}
|
|
82710
82625
|
}
|
|
82711
|
-
await (0,
|
|
82626
|
+
await (0, import_promises4.setTimeout)(POLL_INTERVAL_MS);
|
|
82712
82627
|
}
|
|
82713
82628
|
};
|
|
82714
82629
|
var isDomainResolvable = async (domain) => {
|
|
@@ -82742,13 +82657,13 @@ function secondsSince(start) {
|
|
|
82742
82657
|
|
|
82743
82658
|
// src/wrangler/config.ts
|
|
82744
82659
|
var import_node_fs12 = require("node:fs");
|
|
82745
|
-
var
|
|
82660
|
+
var import_node_path13 = require("node:path");
|
|
82746
82661
|
|
|
82747
82662
|
// src/helpers/json.ts
|
|
82748
82663
|
var import_comment_json2 = __toESM(require_src3());
|
|
82749
|
-
function readJSONWithComments(jsonFilePath) {
|
|
82664
|
+
function readJSONWithComments(jsonFilePath, reviver) {
|
|
82750
82665
|
const jsonString = readFile(jsonFilePath);
|
|
82751
|
-
const jsonObject = (0, import_comment_json2.parse)(jsonString);
|
|
82666
|
+
const jsonObject = (0, import_comment_json2.parse)(jsonString, reviver);
|
|
82752
82667
|
return jsonObject;
|
|
82753
82668
|
}
|
|
82754
82669
|
function writeJSONWithComments(jsonFilePath, jsonObject) {
|
|
@@ -82783,8 +82698,15 @@ function insertJSONProperty(jsonObject, property, value) {
|
|
|
82783
82698
|
|
|
82784
82699
|
// src/wrangler/config.ts
|
|
82785
82700
|
var updateWranglerConfig = async (ctx) => {
|
|
82786
|
-
|
|
82787
|
-
|
|
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
|
+
);
|
|
82788
82710
|
wranglerJson = insertJSONProperty(
|
|
82789
82711
|
wranglerJson,
|
|
82790
82712
|
"$schema",
|
|
@@ -82794,7 +82716,7 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82794
82716
|
wranglerJson = appendJSONProperty(
|
|
82795
82717
|
wranglerJson,
|
|
82796
82718
|
"compatibility_date",
|
|
82797
|
-
await getCompatibilityDate(wranglerJson)
|
|
82719
|
+
await getCompatibilityDate(wranglerJson.compatibility_date)
|
|
82798
82720
|
);
|
|
82799
82721
|
wranglerJson = appendJSONProperty(wranglerJson, "observability", {
|
|
82800
82722
|
enabled: true
|
|
@@ -82828,22 +82750,25 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82828
82750
|
value: ' "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]'
|
|
82829
82751
|
}
|
|
82830
82752
|
]);
|
|
82831
|
-
|
|
82753
|
+
writeWranglerJsonOrJsonc(ctx, wranglerJson);
|
|
82832
82754
|
addVscodeConfig(ctx);
|
|
82833
82755
|
} else if (wranglerTomlExists(ctx)) {
|
|
82834
|
-
|
|
82835
|
-
const
|
|
82836
|
-
|
|
82837
|
-
|
|
82838
|
-
|
|
82839
|
-
|
|
82840
|
-
|
|
82841
|
-
|
|
82842
|
-
|
|
82843
|
-
|
|
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 };
|
|
82844
82766
|
writeWranglerToml(
|
|
82845
82767
|
ctx,
|
|
82846
|
-
|
|
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)}
|
|
82847
82772
|
# Smart Placement
|
|
82848
82773
|
# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
|
82849
82774
|
# [placement]
|
|
@@ -82880,19 +82805,19 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
82880
82805
|
}
|
|
82881
82806
|
};
|
|
82882
82807
|
var getWranglerTomlPath = (ctx) => {
|
|
82883
|
-
return (0,
|
|
82808
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.toml");
|
|
82884
82809
|
};
|
|
82885
82810
|
var getWranglerJsonPath = (ctx) => {
|
|
82886
|
-
return (0,
|
|
82811
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.json");
|
|
82887
82812
|
};
|
|
82888
82813
|
var getWranglerJsoncPath = (ctx) => {
|
|
82889
|
-
return (0,
|
|
82814
|
+
return (0, import_node_path13.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
82890
82815
|
};
|
|
82891
82816
|
var wranglerTomlExists = (ctx) => {
|
|
82892
82817
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82893
82818
|
return (0, import_node_fs12.existsSync)(wranglerTomlPath);
|
|
82894
82819
|
};
|
|
82895
|
-
var
|
|
82820
|
+
var wranglerJsonOrJsoncExists = (ctx) => {
|
|
82896
82821
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82897
82822
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
82898
82823
|
return (0, import_node_fs12.existsSync)(wranglerJsonPath) || (0, import_node_fs12.existsSync)(wranglerJsoncPath);
|
|
@@ -82901,25 +82826,25 @@ var readWranglerToml = (ctx) => {
|
|
|
82901
82826
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82902
82827
|
return readFile(wranglerTomlPath);
|
|
82903
82828
|
};
|
|
82904
|
-
var
|
|
82829
|
+
var readWranglerJsonOrJsonc = (ctx, reviver) => {
|
|
82905
82830
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82906
82831
|
if ((0, import_node_fs12.existsSync)(wranglerJsonPath)) {
|
|
82907
|
-
return readJSONWithComments(wranglerJsonPath);
|
|
82832
|
+
return readJSONWithComments(wranglerJsonPath, reviver);
|
|
82908
82833
|
}
|
|
82909
82834
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
82910
|
-
return readJSONWithComments(wranglerJsoncPath);
|
|
82835
|
+
return readJSONWithComments(wranglerJsoncPath, reviver);
|
|
82911
82836
|
};
|
|
82912
82837
|
var writeWranglerToml = (ctx, contents) => {
|
|
82913
82838
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
82914
82839
|
return writeFile2(wranglerTomlPath, contents);
|
|
82915
82840
|
};
|
|
82916
|
-
var
|
|
82841
|
+
var writeWranglerJsonOrJsonc = (ctx, config47) => {
|
|
82917
82842
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
82918
82843
|
if ((0, import_node_fs12.existsSync)(wranglerJsonPath)) {
|
|
82919
|
-
return writeJSONWithComments(wranglerJsonPath,
|
|
82844
|
+
return writeJSONWithComments(wranglerJsonPath, config47);
|
|
82920
82845
|
}
|
|
82921
82846
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
82922
|
-
return writeJSONWithComments(wranglerJsoncPath,
|
|
82847
|
+
return writeJSONWithComments(wranglerJsoncPath, config47);
|
|
82923
82848
|
};
|
|
82924
82849
|
var addVscodeConfig = (ctx) => {
|
|
82925
82850
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
@@ -82933,10 +82858,10 @@ var addVscodeConfig = (ctx) => {
|
|
|
82933
82858
|
}
|
|
82934
82859
|
});
|
|
82935
82860
|
};
|
|
82936
|
-
async function getCompatibilityDate(
|
|
82861
|
+
async function getCompatibilityDate(tentativeDate) {
|
|
82937
82862
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}$/m;
|
|
82938
|
-
if (typeof
|
|
82939
|
-
return
|
|
82863
|
+
if (typeof tentativeDate === "string" && tentativeDate.match(validCompatDateRe)) {
|
|
82864
|
+
return tentativeDate;
|
|
82940
82865
|
}
|
|
82941
82866
|
return await getWorkerdCompatibilityDate();
|
|
82942
82867
|
}
|
|
@@ -82983,14 +82908,14 @@ var isDeployable = async (ctx) => {
|
|
|
82983
82908
|
return !hasBinding(wranglerConfig);
|
|
82984
82909
|
};
|
|
82985
82910
|
var readWranglerConfig = (ctx) => {
|
|
82986
|
-
if (
|
|
82987
|
-
return
|
|
82911
|
+
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
82912
|
+
return readWranglerJsonOrJsonc(ctx);
|
|
82988
82913
|
}
|
|
82989
82914
|
const wranglerTomlStr = readWranglerToml(ctx);
|
|
82990
82915
|
return dist_default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
82991
82916
|
};
|
|
82992
82917
|
var runDeploy = async (ctx) => {
|
|
82993
|
-
const { npm: npm24, name:
|
|
82918
|
+
const { npm: npm24, name: pm3 } = detectPackageManager();
|
|
82994
82919
|
if (!ctx.account?.id) {
|
|
82995
82920
|
throw new Error("Failed to read Cloudflare account.");
|
|
82996
82921
|
}
|
|
@@ -83000,13 +82925,13 @@ var runDeploy = async (ctx) => {
|
|
|
83000
82925
|
...baseDeployCmd,
|
|
83001
82926
|
// Important: the following assumes that all framework deploy commands terminate with `wrangler pages deploy`
|
|
83002
82927
|
...ctx.template.platform === "pages" && ctx.commitMessage && !insideGitRepo ? [
|
|
83003
|
-
...
|
|
82928
|
+
...pm3 === "npm" ? ["--"] : [],
|
|
83004
82929
|
"--commit-message",
|
|
83005
82930
|
JSON.stringify(ctx.commitMessage)
|
|
83006
82931
|
] : []
|
|
83007
82932
|
];
|
|
83008
|
-
const outputFile = (0,
|
|
83009
|
-
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-")),
|
|
83010
82935
|
"output.json"
|
|
83011
82936
|
);
|
|
83012
82937
|
await runCommand(deployCmd, {
|
|
@@ -83068,7 +82993,7 @@ var hasBinding = (node) => {
|
|
|
83068
82993
|
};
|
|
83069
82994
|
|
|
83070
82995
|
// src/dialog.ts
|
|
83071
|
-
var
|
|
82996
|
+
var import_node_path15 = require("node:path");
|
|
83072
82997
|
function createDialog(lines) {
|
|
83073
82998
|
const screenWidth = process.stdout.columns;
|
|
83074
82999
|
const maxLineWidth = Math.max(
|
|
@@ -83108,7 +83033,7 @@ function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
|
83108
83033
|
}
|
|
83109
83034
|
var printSummary = (ctx) => {
|
|
83110
83035
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
83111
|
-
const relativePath = (0,
|
|
83036
|
+
const relativePath = (0, import_node_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
83112
83037
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
83113
83038
|
const { npm: npm24 } = detectPackageManager();
|
|
83114
83039
|
const deployCommand = quoteShellArgs([
|
|
@@ -83406,15 +83331,15 @@ function wrapAnsi3(string, columns, options) {
|
|
|
83406
83331
|
var MAX_WIDTH = 100;
|
|
83407
83332
|
var PADDING_RIGHT = 5;
|
|
83408
83333
|
var showHelp = (args, { positionals, options, intro }) => {
|
|
83409
|
-
const { name:
|
|
83334
|
+
const { name: pm3 } = detectPackageManager();
|
|
83410
83335
|
logRaw(`${brandColor("create-cloudflare")} ${dim("v" + version)}
|
|
83411
83336
|
`);
|
|
83412
83337
|
indent(`${intro.trim()}
|
|
83413
83338
|
`, 1);
|
|
83414
83339
|
logRaw(bold("USAGE\n"));
|
|
83415
|
-
const latest =
|
|
83416
|
-
const opts =
|
|
83417
|
-
indent(`${
|
|
83340
|
+
const latest = pm3 === "yarn" ? "" : "@latest";
|
|
83341
|
+
const opts = pm3 === "npm" ? "-- options" : "options";
|
|
83342
|
+
indent(`${pm3} create cloudflare${latest} [directory] [${opts}]
|
|
83418
83343
|
`, 1);
|
|
83419
83344
|
logRaw(bold("OPTIONS\n"));
|
|
83420
83345
|
if (args?.experimental) {
|
|
@@ -83479,9 +83404,9 @@ var renderValues = (values) => {
|
|
|
83479
83404
|
};
|
|
83480
83405
|
|
|
83481
83406
|
// src/helpers/retry.ts
|
|
83482
|
-
var
|
|
83483
|
-
var retry = async (
|
|
83484
|
-
let { times } =
|
|
83407
|
+
var import_promises6 = require("node:timers/promises");
|
|
83408
|
+
var retry = async (config47, fn) => {
|
|
83409
|
+
let { times } = config47;
|
|
83485
83410
|
let error2 = null;
|
|
83486
83411
|
while (times > 0) {
|
|
83487
83412
|
try {
|
|
@@ -83489,10 +83414,10 @@ var retry = async (config46, fn) => {
|
|
|
83489
83414
|
} catch (e) {
|
|
83490
83415
|
error2 = e;
|
|
83491
83416
|
times--;
|
|
83492
|
-
if (
|
|
83417
|
+
if (config47.exitCondition?.(e)) {
|
|
83493
83418
|
break;
|
|
83494
83419
|
}
|
|
83495
|
-
await (0,
|
|
83420
|
+
await (0, import_promises6.setTimeout)(config47.sleepMs ?? 1e3);
|
|
83496
83421
|
}
|
|
83497
83422
|
}
|
|
83498
83423
|
throw error2;
|
|
@@ -83580,7 +83505,7 @@ var createProject = async (ctx) => {
|
|
|
83580
83505
|
|
|
83581
83506
|
// src/workers.ts
|
|
83582
83507
|
var import_node_fs13 = require("node:fs");
|
|
83583
|
-
var
|
|
83508
|
+
var import_node_path16 = require("node:path");
|
|
83584
83509
|
|
|
83585
83510
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
83586
83511
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -84910,7 +84835,7 @@ async function addTypes(ctx) {
|
|
|
84910
84835
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
84911
84836
|
}
|
|
84912
84837
|
async function generateWorkersTypes(ctx, npm24) {
|
|
84913
|
-
const packageJsonPath = (0,
|
|
84838
|
+
const packageJsonPath = (0, import_node_path16.join)(ctx.project.path, "package.json");
|
|
84914
84839
|
if (!(0, import_node_fs13.existsSync)(packageJsonPath)) {
|
|
84915
84840
|
return;
|
|
84916
84841
|
}
|
|
@@ -84932,8 +84857,8 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
84932
84857
|
}
|
|
84933
84858
|
var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
84934
84859
|
let parsedConfig = {};
|
|
84935
|
-
if (
|
|
84936
|
-
parsedConfig =
|
|
84860
|
+
if (wranglerJsonOrJsoncExists(ctx)) {
|
|
84861
|
+
parsedConfig = readWranglerJsonOrJsonc(ctx);
|
|
84937
84862
|
} else if (wranglerTomlExists(ctx)) {
|
|
84938
84863
|
const wranglerTomlStr = readWranglerToml(ctx);
|
|
84939
84864
|
parsedConfig = dist_default.parse(wranglerTomlStr);
|
|
@@ -84950,15 +84875,15 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
84950
84875
|
return false;
|
|
84951
84876
|
};
|
|
84952
84877
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
84953
|
-
const tsconfigPath = (0,
|
|
84878
|
+
const tsconfigPath = (0, import_node_path16.join)(ctx.project.path, "tsconfig.json");
|
|
84954
84879
|
if (!(0, import_node_fs13.existsSync)(tsconfigPath)) {
|
|
84955
84880
|
return;
|
|
84956
84881
|
}
|
|
84957
84882
|
const tsconfig = readFile(tsconfigPath);
|
|
84958
84883
|
try {
|
|
84959
|
-
const
|
|
84960
|
-
const currentTypes =
|
|
84961
|
-
let newTypes =
|
|
84884
|
+
const config47 = parse6(tsconfig);
|
|
84885
|
+
const currentTypes = config47.compilerOptions?.types ?? [];
|
|
84886
|
+
let newTypes = new Set(currentTypes);
|
|
84962
84887
|
if (ctx.template.workersTypes === "installed") {
|
|
84963
84888
|
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
84964
84889
|
if (entrypointVersion === null) {
|
|
@@ -84969,35 +84894,32 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
84969
84894
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
84970
84895
|
);
|
|
84971
84896
|
if (!explicitEntrypoint) {
|
|
84972
|
-
newTypes
|
|
84973
|
-
|
|
84974
|
-
);
|
|
84975
|
-
newTypes.push(typesEntrypoint);
|
|
84897
|
+
newTypes.delete("@cloudflare/workers-types");
|
|
84898
|
+
newTypes.add(typesEntrypoint);
|
|
84976
84899
|
}
|
|
84977
84900
|
} else if (ctx.template.workersTypes === "generated") {
|
|
84978
|
-
newTypes.
|
|
84901
|
+
newTypes.add(ctx.template.typesPath ?? "./worker-configuration.d.ts");
|
|
84979
84902
|
const typegen = readFile(
|
|
84980
84903
|
ctx.template.typesPath ?? "./worker-configuration.d.ts"
|
|
84981
84904
|
).split("\n");
|
|
84982
84905
|
if (typegen.some(
|
|
84983
84906
|
(line) => line.includes("// Runtime types generated with workerd")
|
|
84984
84907
|
)) {
|
|
84985
|
-
newTypes =
|
|
84986
|
-
|
|
84908
|
+
newTypes = new Set(
|
|
84909
|
+
[...newTypes].filter(
|
|
84910
|
+
(type) => !type.startsWith("@cloudflare/workers-types")
|
|
84911
|
+
)
|
|
84987
84912
|
);
|
|
84988
84913
|
}
|
|
84989
84914
|
}
|
|
84990
84915
|
if (usesNodeCompat) {
|
|
84991
|
-
newTypes.
|
|
84992
|
-
}
|
|
84993
|
-
if (newTypes.sort() === currentTypes.sort()) {
|
|
84994
|
-
return;
|
|
84916
|
+
newTypes.add("node");
|
|
84995
84917
|
}
|
|
84996
84918
|
const useSpaces = !tsconfig.match(/\t/g);
|
|
84997
84919
|
const edits = modify(
|
|
84998
84920
|
tsconfig,
|
|
84999
84921
|
["compilerOptions", "types"],
|
|
85000
|
-
newTypes,
|
|
84922
|
+
[...newTypes].sort(),
|
|
85001
84923
|
{
|
|
85002
84924
|
formattingOptions: { insertSpaces: useSpaces }
|
|
85003
84925
|
}
|
|
@@ -85074,7 +84996,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
85074
84996
|
if (err) {
|
|
85075
84997
|
throw new Error(err);
|
|
85076
84998
|
}
|
|
85077
|
-
const directory = (0,
|
|
84999
|
+
const directory = (0, import_node_path17.dirname)(path6);
|
|
85078
85000
|
(0, import_node_fs14.mkdirSync)(directory, { recursive: true });
|
|
85079
85001
|
(0, import_node_process7.chdir)(directory);
|
|
85080
85002
|
};
|
|
@@ -85087,7 +85009,7 @@ var create = async (ctx) => {
|
|
|
85087
85009
|
if (!ctx.args.experimental) {
|
|
85088
85010
|
await copyTemplateFiles(ctx);
|
|
85089
85011
|
}
|
|
85090
|
-
|
|
85012
|
+
updatePackageName(ctx);
|
|
85091
85013
|
(0, import_node_process7.chdir)(ctx.project.path);
|
|
85092
85014
|
await npmInstall(ctx);
|
|
85093
85015
|
await rectifyPmMismatch(ctx);
|