create-cloudflare 2.51.7 → 2.52.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 +474 -756
- package/package.json +6 -6
- package/templates/hello-world/py/__dot__gitignore +5 -0
- package/templates/hello-world-durable-object/py/__dot__gitignore +5 -0
- package/templates/hello-world-durable-object-with-assets/py/__dot__gitignore +5 -0
- package/templates/hello-world-with-assets/py/__dot__gitignore +5 -0
- package/templates/hello-world-workflows/js/wrangler.jsonc +1 -1
- package/templates/next/c3.ts +68 -7
- package/templates/react-router/c3.ts +2 -1
- package/templates/waku/c3.ts +35 -0
- package/templates/waku/wrangler.jsonc +19 -0
- package/templates/next/pages/README.md +0 -67
- package/templates/next/pages/app/js/app/api/hello/route.js +0 -21
- package/templates/next/pages/app/js/app/not-found.js +0 -58
- package/templates/next/pages/app/ts/app/api/hello/route.ts +0 -21
- package/templates/next/pages/app/ts/app/not-found.tsx +0 -58
- package/templates/next/pages/c3.ts +0 -222
- package/templates/next/pages/pages/js/pages/api/hello.js +0 -23
- package/templates/next/pages/pages/ts/pages/api/hello.ts +0 -24
- package/templates/next/pages/wrangler.jsonc +0 -8
- package/templates/next/workers/c3.ts +0 -71
- package/templates/remix/c3.ts +0 -10
- package/templates/remix/pages/c3.ts +0 -70
- package/templates/remix/pages/templates/worker-configuration.d.ts +0 -4
- package/templates/remix/pages/templates/wrangler.jsonc +0 -5
- package/templates/remix/workers/c3.ts +0 -53
- package/templates/remix/workers/templates/public/.assetsignore +0 -0
- package/templates/remix/workers/templates/worker-configuration.d.ts +0 -4
- package/templates/remix/workers/templates/wrangler.toml +0 -11
- /package/templates/next/{workers/templates → templates}/.dev.vars +0 -0
- /package/templates/next/{workers/templates → templates}/__dot__gitignore +0 -0
- /package/templates/next/{workers/templates → templates}/open-next.config.ts +0 -0
- /package/templates/next/{workers/templates → templates}/public/_headers +0 -0
- /package/templates/next/{workers/templates → templates}/wrangler.jsonc +0 -0
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 config44(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 config44 = 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: config44, 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 config44 = 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: config44, 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 config44 = 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: config44, data, runtime, state };
|
|
683
683
|
};
|
|
684
684
|
var XDG_ = /* @__PURE__ */ function() {
|
|
685
685
|
function XDG_2() {
|
|
@@ -28908,8 +28908,8 @@ var require_index_688c5d50 = __commonJS({
|
|
|
28908
28908
|
var pathReservations = () => {
|
|
28909
28909
|
const queues = /* @__PURE__ */ new Map();
|
|
28910
28910
|
const reservations = /* @__PURE__ */ new Map();
|
|
28911
|
-
const { join:
|
|
28912
|
-
const getDirs = (path7) =>
|
|
28911
|
+
const { join: join7 } = path__default["default"];
|
|
28912
|
+
const getDirs = (path7) => join7(path7).split(/[\\/]/).slice(0, -1).reduce((set, path8) => set.length ? set.concat(join7(set[set.length - 1], path8)) : [path8], []);
|
|
28913
28913
|
const running = /* @__PURE__ */ new Set();
|
|
28914
28914
|
const getQueues = (fn) => {
|
|
28915
28915
|
const res = reservations.get(fn);
|
|
@@ -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 config44 = (0, _lodash["default"])(options, this.config);
|
|
36183
|
+
if (config44.tokenHex === true) {
|
|
36184
|
+
config44.tokenChars = "0123456789abcdef";
|
|
36185
36185
|
}
|
|
36186
36186
|
var adjective = this._randomElement(this.adjectives);
|
|
36187
36187
|
var noun = this._randomElement(this.nouns);
|
|
36188
|
-
if (!
|
|
36188
|
+
if (!config44.tokenLength) config44.tokenLength = 0;
|
|
36189
36189
|
var token = "";
|
|
36190
|
-
for (var i = 0; i <
|
|
36191
|
-
token += this._randomElement(
|
|
36190
|
+
for (var i = 0; i < config44.tokenLength; i++) {
|
|
36191
|
+
token += this._randomElement(config44.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(config44.delimiter);
|
|
36197
36197
|
}
|
|
36198
36198
|
/**
|
|
36199
36199
|
* Get a random element from an array/string
|
|
@@ -44382,13 +44382,13 @@ var require_esprima = __commonJS({
|
|
|
44382
44382
|
return Reader2;
|
|
44383
44383
|
}();
|
|
44384
44384
|
var Tokenizer = function() {
|
|
44385
|
-
function Tokenizer2(code,
|
|
44385
|
+
function Tokenizer2(code, config44) {
|
|
44386
44386
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
44387
|
-
this.errorHandler.tolerant =
|
|
44387
|
+
this.errorHandler.tolerant = config44 ? typeof config44.tolerant === "boolean" && config44.tolerant : false;
|
|
44388
44388
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
44389
|
-
this.scanner.trackComment =
|
|
44390
|
-
this.trackRange =
|
|
44391
|
-
this.trackLoc =
|
|
44389
|
+
this.scanner.trackComment = config44 ? typeof config44.comment === "boolean" && config44.comment : false;
|
|
44390
|
+
this.trackRange = config44 ? typeof config44.range === "boolean" && config44.range : false;
|
|
44391
|
+
this.trackLoc = config44 ? typeof config44.loc === "boolean" && config44.loc : false;
|
|
44392
44392
|
this.buffer = [];
|
|
44393
44393
|
this.reader = new Reader();
|
|
44394
44394
|
}
|
|
@@ -45990,10 +45990,10 @@ var require_stringify3 = __commonJS({
|
|
|
45990
45990
|
replacer = null;
|
|
45991
45991
|
indent2 = EMPTY;
|
|
45992
45992
|
};
|
|
45993
|
-
var
|
|
45993
|
+
var join7 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + LF + gap : two ? two.trimRight() + LF + gap : EMPTY;
|
|
45994
45994
|
var join_content = (inside, value, gap) => {
|
|
45995
45995
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent2, true);
|
|
45996
|
-
return
|
|
45996
|
+
return join7(comment, inside, gap);
|
|
45997
45997
|
};
|
|
45998
45998
|
var array_stringify = (value, gap) => {
|
|
45999
45999
|
const deeper_gap = gap + indent2;
|
|
@@ -46004,7 +46004,7 @@ var require_stringify3 = __commonJS({
|
|
|
46004
46004
|
if (i !== 0) {
|
|
46005
46005
|
inside += COMMA;
|
|
46006
46006
|
}
|
|
46007
|
-
const before =
|
|
46007
|
+
const before = join7(
|
|
46008
46008
|
after_comma,
|
|
46009
46009
|
process_comments(value, BEFORE(i), deeper_gap),
|
|
46010
46010
|
deeper_gap
|
|
@@ -46014,7 +46014,7 @@ var require_stringify3 = __commonJS({
|
|
|
46014
46014
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
46015
46015
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
46016
46016
|
}
|
|
46017
|
-
inside +=
|
|
46017
|
+
inside += join7(
|
|
46018
46018
|
after_comma,
|
|
46019
46019
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
46020
46020
|
deeper_gap
|
|
@@ -46039,7 +46039,7 @@ var require_stringify3 = __commonJS({
|
|
|
46039
46039
|
inside += COMMA;
|
|
46040
46040
|
}
|
|
46041
46041
|
first = false;
|
|
46042
|
-
const before =
|
|
46042
|
+
const before = join7(
|
|
46043
46043
|
after_comma,
|
|
46044
46044
|
process_comments(value, BEFORE(key), deeper_gap),
|
|
46045
46045
|
deeper_gap
|
|
@@ -46049,7 +46049,7 @@ var require_stringify3 = __commonJS({
|
|
|
46049
46049
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
46050
46050
|
};
|
|
46051
46051
|
keys.forEach(iteratee);
|
|
46052
|
-
inside +=
|
|
46052
|
+
inside += join7(
|
|
46053
46053
|
after_comma,
|
|
46054
46054
|
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
46055
46055
|
deeper_gap
|
|
@@ -50508,7 +50508,7 @@ var require_util8 = __commonJS({
|
|
|
50508
50508
|
return path6;
|
|
50509
50509
|
}
|
|
50510
50510
|
exports2.normalize = normalize2;
|
|
50511
|
-
function
|
|
50511
|
+
function join7(aRoot, aPath) {
|
|
50512
50512
|
if (aRoot === "") {
|
|
50513
50513
|
aRoot = ".";
|
|
50514
50514
|
}
|
|
@@ -50540,7 +50540,7 @@ var require_util8 = __commonJS({
|
|
|
50540
50540
|
}
|
|
50541
50541
|
return joined;
|
|
50542
50542
|
}
|
|
50543
|
-
exports2.join =
|
|
50543
|
+
exports2.join = join7;
|
|
50544
50544
|
exports2.isAbsolute = function(aPath) {
|
|
50545
50545
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
50546
50546
|
};
|
|
@@ -50713,7 +50713,7 @@ var require_util8 = __commonJS({
|
|
|
50713
50713
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
50714
50714
|
}
|
|
50715
50715
|
}
|
|
50716
|
-
sourceURL =
|
|
50716
|
+
sourceURL = join7(urlGenerate(parsed), sourceURL);
|
|
50717
50717
|
}
|
|
50718
50718
|
return normalize2(sourceURL);
|
|
50719
50719
|
}
|
|
@@ -54474,11 +54474,11 @@ var require_printer = __commonJS({
|
|
|
54474
54474
|
return this.code;
|
|
54475
54475
|
};
|
|
54476
54476
|
var emptyPrintResult = new PrintResult("");
|
|
54477
|
-
var Printer = function Printer2(
|
|
54477
|
+
var Printer = function Printer2(config44) {
|
|
54478
54478
|
assert_1.default.ok(this instanceof Printer2);
|
|
54479
|
-
var explicitTabWidth =
|
|
54480
|
-
|
|
54481
|
-
|
|
54479
|
+
var explicitTabWidth = config44 && config44.tabWidth;
|
|
54480
|
+
config44 = options_1.normalize(config44);
|
|
54481
|
+
config44.sourceFileName = null;
|
|
54482
54482
|
function makePrintFunctionWith(options, overrides) {
|
|
54483
54483
|
options = Object.assign({}, options, overrides);
|
|
54484
54484
|
return function(path6) {
|
|
@@ -54493,11 +54493,11 @@ var require_printer = __commonJS({
|
|
|
54493
54493
|
includeComments: false
|
|
54494
54494
|
}));
|
|
54495
54495
|
}
|
|
54496
|
-
var oldTabWidth =
|
|
54496
|
+
var oldTabWidth = config44.tabWidth;
|
|
54497
54497
|
if (!explicitTabWidth) {
|
|
54498
54498
|
var loc = path6.getNode().loc;
|
|
54499
54499
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
54500
|
-
|
|
54500
|
+
config44.tabWidth = loc.lines.guessTabWidth();
|
|
54501
54501
|
}
|
|
54502
54502
|
}
|
|
54503
54503
|
var reprinter = patcher_1.getReprinter(path6);
|
|
@@ -54511,11 +54511,11 @@ var require_printer = __commonJS({
|
|
|
54511
54511
|
// right choice because it gives us the opportunity to reprint
|
|
54512
54512
|
// such nodes using their original source.
|
|
54513
54513
|
reprinter(print2)
|
|
54514
|
-
) : genericPrint(path6,
|
|
54514
|
+
) : genericPrint(path6, config44, options, makePrintFunctionWith(options, {
|
|
54515
54515
|
includeComments: true,
|
|
54516
54516
|
avoidRootParens: false
|
|
54517
54517
|
}));
|
|
54518
|
-
|
|
54518
|
+
config44.tabWidth = oldTabWidth;
|
|
54519
54519
|
return lines;
|
|
54520
54520
|
}
|
|
54521
54521
|
this.print = function(ast) {
|
|
@@ -54526,7 +54526,7 @@ var require_printer = __commonJS({
|
|
|
54526
54526
|
includeComments: true,
|
|
54527
54527
|
avoidRootParens: false
|
|
54528
54528
|
});
|
|
54529
|
-
return new PrintResult(lines.toString(
|
|
54529
|
+
return new PrintResult(lines.toString(config44), util.composeSourceMaps(config44.inputSourceMap, lines.getSourceMap(config44.sourceMapName, config44.sourceRoot)));
|
|
54530
54530
|
};
|
|
54531
54531
|
this.printGenerically = function(ast) {
|
|
54532
54532
|
if (!ast) {
|
|
@@ -54534,26 +54534,26 @@ var require_printer = __commonJS({
|
|
|
54534
54534
|
}
|
|
54535
54535
|
function printGenerically(path7) {
|
|
54536
54536
|
return comments_1.printComments(path7, function(path8) {
|
|
54537
|
-
return genericPrint(path8,
|
|
54537
|
+
return genericPrint(path8, config44, {
|
|
54538
54538
|
includeComments: true,
|
|
54539
54539
|
avoidRootParens: false
|
|
54540
54540
|
}, printGenerically);
|
|
54541
54541
|
});
|
|
54542
54542
|
}
|
|
54543
54543
|
var path6 = fast_path_1.default.from(ast);
|
|
54544
|
-
var oldReuseWhitespace =
|
|
54545
|
-
|
|
54546
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
54547
|
-
|
|
54544
|
+
var oldReuseWhitespace = config44.reuseWhitespace;
|
|
54545
|
+
config44.reuseWhitespace = false;
|
|
54546
|
+
var pr = new PrintResult(printGenerically(path6).toString(config44));
|
|
54547
|
+
config44.reuseWhitespace = oldReuseWhitespace;
|
|
54548
54548
|
return pr;
|
|
54549
54549
|
};
|
|
54550
54550
|
};
|
|
54551
54551
|
exports2.Printer = Printer;
|
|
54552
|
-
function genericPrint(path6,
|
|
54552
|
+
function genericPrint(path6, config44, options, printPath) {
|
|
54553
54553
|
assert_1.default.ok(path6 instanceof fast_path_1.default);
|
|
54554
54554
|
var node = path6.getValue();
|
|
54555
54555
|
var parts = [];
|
|
54556
|
-
var linesWithoutParens = genericPrintNoParens(path6,
|
|
54556
|
+
var linesWithoutParens = genericPrintNoParens(path6, config44, printPath);
|
|
54557
54557
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
54558
54558
|
return linesWithoutParens;
|
|
54559
54559
|
}
|
|
@@ -72104,7 +72104,7 @@ __export(cli_exports, {
|
|
|
72104
72104
|
});
|
|
72105
72105
|
module.exports = __toCommonJS(cli_exports);
|
|
72106
72106
|
var import_fs14 = require("fs");
|
|
72107
|
-
var
|
|
72107
|
+
var import_path16 = require("path");
|
|
72108
72108
|
var import_process2 = require("process");
|
|
72109
72109
|
|
|
72110
72110
|
// ../cli/index.ts
|
|
@@ -74117,33 +74117,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
74117
74117
|
}
|
|
74118
74118
|
return input;
|
|
74119
74119
|
};
|
|
74120
|
-
var renderSubmit = (
|
|
74121
|
-
const { question, label } =
|
|
74122
|
-
if (
|
|
74120
|
+
var renderSubmit = (config44, value) => {
|
|
74121
|
+
const { question, label } = config44;
|
|
74122
|
+
if (config44.type !== "confirm" && !value) {
|
|
74123
74123
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
74124
74124
|
}
|
|
74125
|
-
const content =
|
|
74125
|
+
const content = config44.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
74126
74126
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
74127
74127
|
};
|
|
74128
|
-
var getRenderers = (
|
|
74129
|
-
switch (
|
|
74128
|
+
var getRenderers = (config44) => {
|
|
74129
|
+
switch (config44.type) {
|
|
74130
74130
|
case "select":
|
|
74131
|
-
return getSelectRenderers(
|
|
74131
|
+
return getSelectRenderers(config44);
|
|
74132
74132
|
case "confirm":
|
|
74133
|
-
return getConfirmRenderers(
|
|
74133
|
+
return getConfirmRenderers(config44);
|
|
74134
74134
|
case "text":
|
|
74135
|
-
return getTextRenderers(
|
|
74135
|
+
return getTextRenderers(config44);
|
|
74136
74136
|
case "multiselect":
|
|
74137
|
-
return getSelectRenderers(
|
|
74137
|
+
return getSelectRenderers(config44);
|
|
74138
74138
|
case "list":
|
|
74139
|
-
return getSelectListRenderers(
|
|
74139
|
+
return getSelectListRenderers(config44);
|
|
74140
74140
|
}
|
|
74141
74141
|
};
|
|
74142
|
-
var getTextRenderers = (
|
|
74143
|
-
const { question } =
|
|
74144
|
-
const helpText =
|
|
74145
|
-
const format5 =
|
|
74146
|
-
const defaultValue =
|
|
74142
|
+
var getTextRenderers = (config44) => {
|
|
74143
|
+
const { question } = config44;
|
|
74144
|
+
const helpText = config44.helpText ?? "";
|
|
74145
|
+
const format5 = config44.format ?? ((val) => String(val));
|
|
74146
|
+
const defaultValue = config44.defaultValue?.toString() ?? "";
|
|
74147
74147
|
const activeRenderer = (props) => {
|
|
74148
74148
|
const { valueWithCursor } = props;
|
|
74149
74149
|
return [
|
|
@@ -74169,14 +74169,14 @@ var getTextRenderers = (config47) => {
|
|
|
74169
74169
|
``
|
|
74170
74170
|
// extra line for readability
|
|
74171
74171
|
],
|
|
74172
|
-
submit: ({ value }) => renderSubmit(
|
|
74172
|
+
submit: ({ value }) => renderSubmit(config44, format5(value ?? "")),
|
|
74173
74173
|
cancel: activeRenderer
|
|
74174
74174
|
};
|
|
74175
74175
|
};
|
|
74176
|
-
var getSelectRenderers = (
|
|
74177
|
-
const { options, question, helpText: _helpText } =
|
|
74176
|
+
var getSelectRenderers = (config44) => {
|
|
74177
|
+
const { options, question, helpText: _helpText } = config44;
|
|
74178
74178
|
const helpText = _helpText ?? "";
|
|
74179
|
-
const maxItemsPerPage =
|
|
74179
|
+
const maxItemsPerPage = config44.maxItemsPerPage ?? 32;
|
|
74180
74180
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
74181
74181
|
const renderOption = (opt, i) => {
|
|
74182
74182
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -74251,21 +74251,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
74251
74251
|
submit: ({ value }) => {
|
|
74252
74252
|
if (Array.isArray(value)) {
|
|
74253
74253
|
return renderSubmit(
|
|
74254
|
-
|
|
74254
|
+
config44,
|
|
74255
74255
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
74256
74256
|
);
|
|
74257
74257
|
}
|
|
74258
74258
|
return renderSubmit(
|
|
74259
|
-
|
|
74259
|
+
config44,
|
|
74260
74260
|
options.find((o) => o.value === value)?.label
|
|
74261
74261
|
);
|
|
74262
74262
|
},
|
|
74263
74263
|
cancel: defaultRenderer
|
|
74264
74264
|
};
|
|
74265
74265
|
};
|
|
74266
|
-
var getSelectListRenderers = (
|
|
74267
|
-
const { question, helpText: _helpText } =
|
|
74268
|
-
let options =
|
|
74266
|
+
var getSelectListRenderers = (config44) => {
|
|
74267
|
+
const { question, helpText: _helpText } = config44;
|
|
74268
|
+
let options = config44.options;
|
|
74269
74269
|
const helpText = _helpText ?? "";
|
|
74270
74270
|
const { rows } = stdout;
|
|
74271
74271
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -74346,20 +74346,20 @@ var getSelectListRenderers = (config47) => {
|
|
|
74346
74346
|
submit: ({ value }) => {
|
|
74347
74347
|
if (Array.isArray(value)) {
|
|
74348
74348
|
return renderSubmit(
|
|
74349
|
-
|
|
74349
|
+
config44,
|
|
74350
74350
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
74351
74351
|
);
|
|
74352
74352
|
}
|
|
74353
74353
|
return renderSubmit(
|
|
74354
|
-
|
|
74354
|
+
config44,
|
|
74355
74355
|
options.find((o) => o.value === value)?.value
|
|
74356
74356
|
);
|
|
74357
74357
|
},
|
|
74358
74358
|
cancel: defaultRenderer
|
|
74359
74359
|
};
|
|
74360
74360
|
};
|
|
74361
|
-
var getConfirmRenderers = (
|
|
74362
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
74361
|
+
var getConfirmRenderers = (config44) => {
|
|
74362
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config44;
|
|
74363
74363
|
const helpText = _helpText ?? "";
|
|
74364
74364
|
const active = activeText || "Yes";
|
|
74365
74365
|
const inactive = inactiveText || "No";
|
|
@@ -74376,7 +74376,7 @@ var getConfirmRenderers = (config47) => {
|
|
|
74376
74376
|
active: defaultRenderer,
|
|
74377
74377
|
confirm: defaultRenderer,
|
|
74378
74378
|
error: defaultRenderer,
|
|
74379
|
-
submit: ({ value }) => renderSubmit(
|
|
74379
|
+
submit: ({ value }) => renderSubmit(config44, value ? "yes" : "no"),
|
|
74380
74380
|
cancel: defaultRenderer
|
|
74381
74381
|
};
|
|
74382
74382
|
};
|
|
@@ -75344,23 +75344,23 @@ var YargsParser = class {
|
|
|
75344
75344
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
75345
75345
|
if (configPath) {
|
|
75346
75346
|
try {
|
|
75347
|
-
let
|
|
75347
|
+
let config44 = null;
|
|
75348
75348
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
75349
75349
|
const resolveConfig = flags.configs[configKey];
|
|
75350
75350
|
if (typeof resolveConfig === "function") {
|
|
75351
75351
|
try {
|
|
75352
|
-
|
|
75352
|
+
config44 = resolveConfig(resolvedConfigPath);
|
|
75353
75353
|
} catch (e) {
|
|
75354
|
-
|
|
75354
|
+
config44 = e;
|
|
75355
75355
|
}
|
|
75356
|
-
if (
|
|
75357
|
-
error2 =
|
|
75356
|
+
if (config44 instanceof Error) {
|
|
75357
|
+
error2 = config44;
|
|
75358
75358
|
return;
|
|
75359
75359
|
}
|
|
75360
75360
|
} else {
|
|
75361
|
-
|
|
75361
|
+
config44 = mixin2.require(resolvedConfigPath);
|
|
75362
75362
|
}
|
|
75363
|
-
setConfigObject(
|
|
75363
|
+
setConfigObject(config44);
|
|
75364
75364
|
} catch (ex) {
|
|
75365
75365
|
if (ex.name === "PermissionDenied")
|
|
75366
75366
|
error2 = ex;
|
|
@@ -75370,9 +75370,9 @@ var YargsParser = class {
|
|
|
75370
75370
|
}
|
|
75371
75371
|
});
|
|
75372
75372
|
}
|
|
75373
|
-
function setConfigObject(
|
|
75374
|
-
Object.keys(
|
|
75375
|
-
const value =
|
|
75373
|
+
function setConfigObject(config44, prev) {
|
|
75374
|
+
Object.keys(config44).forEach(function(key) {
|
|
75375
|
+
const value = config44[key];
|
|
75376
75376
|
const fullKey = prev ? prev + "." + key : key;
|
|
75377
75377
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
75378
75378
|
setConfigObject(value, fullKey);
|
|
@@ -76524,11 +76524,11 @@ var CommandInstance = class {
|
|
|
76524
76524
|
});
|
|
76525
76525
|
if (!unparsed.length)
|
|
76526
76526
|
return;
|
|
76527
|
-
const
|
|
76527
|
+
const config44 = Object.assign({}, options.configuration, {
|
|
76528
76528
|
"populate--": false
|
|
76529
76529
|
});
|
|
76530
76530
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
76531
|
-
configuration:
|
|
76531
|
+
configuration: config44
|
|
76532
76532
|
}));
|
|
76533
76533
|
if (parsed.error) {
|
|
76534
76534
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -77751,31 +77751,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
77751
77751
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
77752
77752
|
var previouslyVisitedConfigs = [];
|
|
77753
77753
|
var shim2;
|
|
77754
|
-
function applyExtends(
|
|
77754
|
+
function applyExtends(config44, cwd, mergeExtends, _shim) {
|
|
77755
77755
|
shim2 = _shim;
|
|
77756
77756
|
let defaultConfig = {};
|
|
77757
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
77758
|
-
if (typeof
|
|
77757
|
+
if (Object.prototype.hasOwnProperty.call(config44, "extends")) {
|
|
77758
|
+
if (typeof config44.extends !== "string")
|
|
77759
77759
|
return defaultConfig;
|
|
77760
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
77760
|
+
const isPath = /\.json|\..*rc$/.test(config44.extends);
|
|
77761
77761
|
let pathToDefault = null;
|
|
77762
77762
|
if (!isPath) {
|
|
77763
77763
|
try {
|
|
77764
|
-
pathToDefault = require.resolve(
|
|
77764
|
+
pathToDefault = require.resolve(config44.extends);
|
|
77765
77765
|
} catch (_err) {
|
|
77766
|
-
return
|
|
77766
|
+
return config44;
|
|
77767
77767
|
}
|
|
77768
77768
|
} else {
|
|
77769
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
77769
|
+
pathToDefault = getPathToDefaultConfig(cwd, config44.extends);
|
|
77770
77770
|
}
|
|
77771
77771
|
checkForCircularExtends(pathToDefault);
|
|
77772
77772
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
77773
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
77774
|
-
delete
|
|
77773
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config44.extends);
|
|
77774
|
+
delete config44.extends;
|
|
77775
77775
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
77776
77776
|
}
|
|
77777
77777
|
previouslyVisitedConfigs = [];
|
|
77778
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
77778
|
+
return mergeExtends ? mergeDeep(defaultConfig, config44) : Object.assign({}, defaultConfig, config44);
|
|
77779
77779
|
}
|
|
77780
77780
|
function checkForCircularExtends(cfgPath) {
|
|
77781
77781
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -78551,9 +78551,9 @@ var YargsInstance = class {
|
|
|
78551
78551
|
}
|
|
78552
78552
|
return maybePromise;
|
|
78553
78553
|
}
|
|
78554
|
-
parserConfiguration(
|
|
78555
|
-
argsert("<object>", [
|
|
78556
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
78554
|
+
parserConfiguration(config44) {
|
|
78555
|
+
argsert("<object>", [config44], arguments.length);
|
|
78556
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config44, "f");
|
|
78557
78557
|
return this;
|
|
78558
78558
|
}
|
|
78559
78559
|
pkgConf(key, rootPath) {
|
|
@@ -78725,9 +78725,9 @@ var YargsInstance = class {
|
|
|
78725
78725
|
return this;
|
|
78726
78726
|
}
|
|
78727
78727
|
}
|
|
78728
|
-
usageConfiguration(
|
|
78729
|
-
argsert("<object>", [
|
|
78730
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
78728
|
+
usageConfiguration(config44) {
|
|
78729
|
+
argsert("<object>", [config44], arguments.length);
|
|
78730
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config44, "f");
|
|
78731
78731
|
return this;
|
|
78732
78732
|
}
|
|
78733
78733
|
version(opt, msg, ver) {
|
|
@@ -79133,11 +79133,11 @@ var YargsInstance = class {
|
|
|
79133
79133
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
79134
79134
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
79135
79135
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
79136
|
-
const
|
|
79136
|
+
const config44 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
79137
79137
|
"populate--": true
|
|
79138
79138
|
});
|
|
79139
79139
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
79140
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
79140
|
+
configuration: { "parse-positional-numbers": false, ...config44 }
|
|
79141
79141
|
}));
|
|
79142
79142
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
79143
79143
|
let argvPromise = void 0;
|
|
@@ -79300,7 +79300,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
79300
79300
|
var yargs_default = Yargs;
|
|
79301
79301
|
|
|
79302
79302
|
// package.json
|
|
79303
|
-
var version = "2.
|
|
79303
|
+
var version = "2.52.0";
|
|
79304
79304
|
|
|
79305
79305
|
// src/metrics.ts
|
|
79306
79306
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -79344,12 +79344,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
79344
79344
|
}
|
|
79345
79345
|
|
|
79346
79346
|
// src/helpers/metrics-config.ts
|
|
79347
|
-
function writeMetricsConfig(
|
|
79347
|
+
function writeMetricsConfig(config44) {
|
|
79348
79348
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
79349
79349
|
(0, import_node_fs2.writeFileSync)(
|
|
79350
79350
|
getMetricsConfigPath(),
|
|
79351
79351
|
JSON.stringify(
|
|
79352
|
-
|
|
79352
|
+
config44,
|
|
79353
79353
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
79354
79354
|
" "
|
|
79355
79355
|
)
|
|
@@ -79357,9 +79357,9 @@ function writeMetricsConfig(config47) {
|
|
|
79357
79357
|
}
|
|
79358
79358
|
function readMetricsConfig() {
|
|
79359
79359
|
try {
|
|
79360
|
-
const
|
|
79360
|
+
const config44 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
79361
79361
|
return JSON.parse(
|
|
79362
|
-
|
|
79362
|
+
config44,
|
|
79363
79363
|
(key, value) => key === "date" ? new Date(value) : value
|
|
79364
79364
|
);
|
|
79365
79365
|
} catch {
|
|
@@ -79369,10 +79369,10 @@ function readMetricsConfig() {
|
|
|
79369
79369
|
function getMetricsConfigPath() {
|
|
79370
79370
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
79371
79371
|
}
|
|
79372
|
-
function getDeviceId(
|
|
79373
|
-
const deviceId =
|
|
79374
|
-
if (
|
|
79375
|
-
writeMetricsConfig({ ...
|
|
79372
|
+
function getDeviceId(config44) {
|
|
79373
|
+
const deviceId = config44.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
79374
|
+
if (config44.deviceId === void 0) {
|
|
79375
|
+
writeMetricsConfig({ ...config44, deviceId });
|
|
79376
79376
|
}
|
|
79377
79377
|
return deviceId;
|
|
79378
79378
|
}
|
|
@@ -79585,7 +79585,7 @@ var detectPackageManager = () => {
|
|
|
79585
79585
|
}
|
|
79586
79586
|
};
|
|
79587
79587
|
var rectifyPmMismatch = async (ctx) => {
|
|
79588
|
-
const { npm:
|
|
79588
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79589
79589
|
if (!detectPmMismatch(ctx)) {
|
|
79590
79590
|
return;
|
|
79591
79591
|
}
|
|
@@ -79597,17 +79597,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
79597
79597
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
79598
79598
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
79599
79599
|
}
|
|
79600
|
-
await runCommand([
|
|
79600
|
+
await runCommand([npm22, "install"], {
|
|
79601
79601
|
silent: true,
|
|
79602
79602
|
cwd: ctx.project.path,
|
|
79603
79603
|
startText: "Installing dependencies",
|
|
79604
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
79604
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm22} install\``)}`
|
|
79605
79605
|
});
|
|
79606
79606
|
};
|
|
79607
79607
|
var detectPmMismatch = (ctx) => {
|
|
79608
|
-
const { npm:
|
|
79608
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79609
79609
|
const projectPath = ctx.project.path;
|
|
79610
|
-
switch (
|
|
79610
|
+
switch (npm22) {
|
|
79611
79611
|
case "npm":
|
|
79612
79612
|
return false;
|
|
79613
79613
|
case "yarn":
|
|
@@ -79675,10 +79675,10 @@ function getPlatform() {
|
|
|
79675
79675
|
function createReporter() {
|
|
79676
79676
|
const events = [];
|
|
79677
79677
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
79678
|
-
const
|
|
79679
|
-
const isFirstUsage =
|
|
79678
|
+
const config44 = readMetricsConfig() ?? {};
|
|
79679
|
+
const isFirstUsage = config44.c3permission === void 0;
|
|
79680
79680
|
const isEnabled = isTelemetryEnabled();
|
|
79681
|
-
const deviceId = getDeviceId(
|
|
79681
|
+
const deviceId = getDeviceId(config44);
|
|
79682
79682
|
const packageManager = detectPackageManager();
|
|
79683
79683
|
const platform = getPlatform();
|
|
79684
79684
|
const amplitude_session_id = Date.now();
|
|
@@ -79711,7 +79711,7 @@ function createReporter() {
|
|
|
79711
79711
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
79712
79712
|
return false;
|
|
79713
79713
|
}
|
|
79714
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
79714
|
+
return hasSparrowSourceKey() && getC3Permission(config44).enabled;
|
|
79715
79715
|
}
|
|
79716
79716
|
async function waitForAllEventsSettled() {
|
|
79717
79717
|
await Promise.allSettled(events);
|
|
@@ -79817,20 +79817,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
79817
79817
|
date: /* @__PURE__ */ new Date()
|
|
79818
79818
|
};
|
|
79819
79819
|
}
|
|
79820
|
-
function getC3Permission(
|
|
79821
|
-
if (!
|
|
79822
|
-
|
|
79823
|
-
writeMetricsConfig(
|
|
79820
|
+
function getC3Permission(config44 = readMetricsConfig() ?? {}) {
|
|
79821
|
+
if (!config44.c3permission) {
|
|
79822
|
+
config44.c3permission = initializeC3Permission();
|
|
79823
|
+
writeMetricsConfig(config44);
|
|
79824
79824
|
}
|
|
79825
|
-
return
|
|
79825
|
+
return config44.c3permission;
|
|
79826
79826
|
}
|
|
79827
79827
|
function updateC3Pemission(enabled) {
|
|
79828
|
-
const
|
|
79829
|
-
if (
|
|
79828
|
+
const config44 = readMetricsConfig();
|
|
79829
|
+
if (config44.c3permission?.enabled === enabled) {
|
|
79830
79830
|
return;
|
|
79831
79831
|
}
|
|
79832
|
-
|
|
79833
|
-
writeMetricsConfig(
|
|
79832
|
+
config44.c3permission = initializeC3Permission(enabled);
|
|
79833
|
+
writeMetricsConfig(config44);
|
|
79834
79834
|
}
|
|
79835
79835
|
var runTelemetryCommand = (action) => {
|
|
79836
79836
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -79864,7 +79864,7 @@ var runTelemetryCommand = (action) => {
|
|
|
79864
79864
|
var import_fs11 = require("fs");
|
|
79865
79865
|
var import_promises4 = require("fs/promises");
|
|
79866
79866
|
var import_os2 = require("os");
|
|
79867
|
-
var
|
|
79867
|
+
var import_path12 = require("path");
|
|
79868
79868
|
var import_deepmerge = __toESM(require_cjs());
|
|
79869
79869
|
var import_degit = __toESM(require_dist());
|
|
79870
79870
|
|
|
@@ -79882,13 +79882,6 @@ var import_fs6 = __toESM(require("fs"));
|
|
|
79882
79882
|
var import_path6 = require("path");
|
|
79883
79883
|
var import_toml = __toESM(require_toml());
|
|
79884
79884
|
var import_comment_json = __toESM(require_src3());
|
|
79885
|
-
var copyFile = (path6, dest) => {
|
|
79886
|
-
try {
|
|
79887
|
-
import_fs6.default.copyFileSync(path6, dest);
|
|
79888
|
-
} catch (error2) {
|
|
79889
|
-
throw new Error(error2);
|
|
79890
|
-
}
|
|
79891
|
-
};
|
|
79892
79885
|
var writeFile2 = (path6, content) => {
|
|
79893
79886
|
try {
|
|
79894
79887
|
import_fs6.default.writeFileSync(path6, content);
|
|
@@ -79935,94 +79928,57 @@ var readJSON = (path6) => {
|
|
|
79935
79928
|
var writeJSON = (path6, object, stringifySpace = " ") => {
|
|
79936
79929
|
writeFile2(path6, (0, import_comment_json.stringify)(object, null, stringifySpace));
|
|
79937
79930
|
};
|
|
79938
|
-
var probePaths = (paths) => {
|
|
79939
|
-
for (const path6 of paths) {
|
|
79940
|
-
if ((0, import_fs6.existsSync)(path6)) {
|
|
79941
|
-
return path6;
|
|
79942
|
-
}
|
|
79943
|
-
}
|
|
79944
|
-
return null;
|
|
79945
|
-
};
|
|
79946
79931
|
var usesTypescript = (ctx) => {
|
|
79947
79932
|
return hasTsConfig(ctx.project.path);
|
|
79948
79933
|
};
|
|
79949
79934
|
var hasTsConfig = (path6) => {
|
|
79950
79935
|
return (0, import_fs6.existsSync)((0, import_path6.join)(`${path6}`, `tsconfig.json`));
|
|
79951
79936
|
};
|
|
79952
|
-
var eslintRcExts = ["js", "cjs", "yaml", "yml", "json"];
|
|
79953
|
-
var usesEslint = (ctx) => {
|
|
79954
|
-
for (const ext of eslintRcExts) {
|
|
79955
|
-
const eslintRcFilename = `.eslintrc.${ext}`;
|
|
79956
|
-
if ((0, import_fs6.existsSync)(`${ctx.project.path}/${eslintRcFilename}`)) {
|
|
79957
|
-
return {
|
|
79958
|
-
used: true,
|
|
79959
|
-
configType: eslintRcFilename
|
|
79960
|
-
};
|
|
79961
|
-
}
|
|
79962
|
-
}
|
|
79963
|
-
if ((0, import_fs6.existsSync)(`${ctx.project.path}/eslint.config.js`)) {
|
|
79964
|
-
return {
|
|
79965
|
-
used: true,
|
|
79966
|
-
configType: "eslint.config.js"
|
|
79967
|
-
};
|
|
79968
|
-
}
|
|
79969
|
-
try {
|
|
79970
|
-
const pkgJson = readJSON(`${ctx.project.path}/package.json`);
|
|
79971
|
-
if (pkgJson?.eslintConfig) {
|
|
79972
|
-
return {
|
|
79973
|
-
used: true,
|
|
79974
|
-
configType: "package.json"
|
|
79975
|
-
};
|
|
79976
|
-
}
|
|
79977
|
-
} catch {
|
|
79978
|
-
}
|
|
79979
|
-
return { used: false };
|
|
79980
|
-
};
|
|
79981
79937
|
|
|
79982
79938
|
// src/helpers/packages.ts
|
|
79983
|
-
var installPackages = async (packages,
|
|
79939
|
+
var installPackages = async (packages, config44 = {}) => {
|
|
79984
79940
|
if (packages.length === 0) {
|
|
79985
79941
|
return;
|
|
79986
79942
|
}
|
|
79987
|
-
const { npm:
|
|
79943
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79988
79944
|
let saveFlag;
|
|
79989
79945
|
let cmd;
|
|
79990
|
-
switch (
|
|
79946
|
+
switch (npm22) {
|
|
79991
79947
|
case "yarn":
|
|
79992
79948
|
cmd = "add";
|
|
79993
|
-
saveFlag =
|
|
79949
|
+
saveFlag = config44.dev ? "-D" : "";
|
|
79994
79950
|
break;
|
|
79995
79951
|
case "bun":
|
|
79996
79952
|
cmd = "add";
|
|
79997
|
-
saveFlag =
|
|
79953
|
+
saveFlag = config44.dev ? "-d" : "";
|
|
79998
79954
|
break;
|
|
79999
79955
|
case "npm":
|
|
80000
79956
|
case "pnpm":
|
|
80001
79957
|
default:
|
|
80002
79958
|
cmd = "install";
|
|
80003
|
-
saveFlag =
|
|
79959
|
+
saveFlag = config44.dev ? "--save-dev" : "";
|
|
80004
79960
|
break;
|
|
80005
79961
|
}
|
|
80006
79962
|
await runCommand(
|
|
80007
79963
|
[
|
|
80008
|
-
|
|
79964
|
+
npm22,
|
|
80009
79965
|
cmd,
|
|
80010
79966
|
...saveFlag ? [saveFlag] : [],
|
|
80011
79967
|
...packages,
|
|
80012
79968
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
80013
79969
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
80014
79970
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
80015
|
-
...
|
|
79971
|
+
...npm22 === "npm" ? ["--legacy-peer-deps"] : []
|
|
80016
79972
|
],
|
|
80017
79973
|
{
|
|
80018
|
-
...
|
|
79974
|
+
...config44,
|
|
80019
79975
|
silent: true
|
|
80020
79976
|
}
|
|
80021
79977
|
);
|
|
80022
|
-
if (
|
|
79978
|
+
if (npm22 === "npm") {
|
|
80023
79979
|
const pkgJsonPath = import_path7.default.join(process.cwd(), "package.json");
|
|
80024
79980
|
const pkgJson = readJSON(pkgJsonPath);
|
|
80025
|
-
const deps =
|
|
79981
|
+
const deps = config44.dev ? pkgJson.devDependencies : pkgJson.dependencies;
|
|
80026
79982
|
(0, import_assert2.default)(deps, "dependencies should be defined");
|
|
80027
79983
|
for (const pkg of packages) {
|
|
80028
79984
|
const versionMarker = pkg.lastIndexOf("@");
|
|
@@ -80042,16 +79998,16 @@ var npmInstall = async (ctx) => {
|
|
|
80042
79998
|
if ((0, import_fs7.existsSync)(nodeModulesPath)) {
|
|
80043
79999
|
return;
|
|
80044
80000
|
}
|
|
80045
|
-
const { npm:
|
|
80001
|
+
const { npm: npm22 } = detectPackageManager();
|
|
80046
80002
|
await runCommand(
|
|
80047
80003
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
80048
80004
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
80049
80005
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
80050
|
-
[
|
|
80006
|
+
[npm22, "install", ...npm22 === "npm" ? ["--legacy-peer-deps"] : []],
|
|
80051
80007
|
{
|
|
80052
80008
|
silent: true,
|
|
80053
80009
|
startText: "Installing dependencies",
|
|
80054
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
80010
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm22} install\``)}`
|
|
80055
80011
|
}
|
|
80056
80012
|
);
|
|
80057
80013
|
};
|
|
@@ -80061,14 +80017,14 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
80061
80017
|
return npmInfo["dist-tags"].latest;
|
|
80062
80018
|
}
|
|
80063
80019
|
var installWrangler = async () => {
|
|
80064
|
-
const { npm:
|
|
80020
|
+
const { npm: npm22 } = detectPackageManager();
|
|
80065
80021
|
await installPackages([`wrangler@latest`], {
|
|
80066
80022
|
dev: true,
|
|
80067
80023
|
startText: `Installing wrangler ${dim(
|
|
80068
80024
|
"A command line tool for building Cloudflare Workers"
|
|
80069
80025
|
)}`,
|
|
80070
80026
|
doneText: `${brandColor("installed")} ${dim(
|
|
80071
|
-
`via \`${
|
|
80027
|
+
`via \`${npm22} install wrangler --save-dev\``
|
|
80072
80028
|
)}`
|
|
80073
80029
|
});
|
|
80074
80030
|
};
|
|
@@ -80129,17 +80085,17 @@ var package_default = {
|
|
|
80129
80085
|
"create-astro": "4.13.1",
|
|
80130
80086
|
"create-analog": "1.8.1",
|
|
80131
80087
|
"@angular/create": "20.3.0",
|
|
80132
|
-
"create-docusaurus": "3.
|
|
80088
|
+
"create-docusaurus": "3.9.1",
|
|
80133
80089
|
"create-hono": "0.19.2",
|
|
80134
80090
|
"create-next-app": "15.4.6",
|
|
80135
|
-
"create-qwik": "1.16.
|
|
80091
|
+
"create-qwik": "1.16.1",
|
|
80136
80092
|
"create-vite": "7.1.1",
|
|
80137
|
-
"create-remix": "2.16.8",
|
|
80138
80093
|
"create-react-router": "7.8.2",
|
|
80139
80094
|
"create-solid": "0.6.7",
|
|
80140
80095
|
"create-vue": "3.18.0",
|
|
80096
|
+
"create-waku": "0.12.5-0.26.1-0",
|
|
80141
80097
|
gatsby: "5.15.0",
|
|
80142
|
-
sv: "0.9.
|
|
80098
|
+
sv: "0.9.6",
|
|
80143
80099
|
nuxi: "3.28.0"
|
|
80144
80100
|
}
|
|
80145
80101
|
};
|
|
@@ -80155,9 +80111,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
80155
80111
|
};
|
|
80156
80112
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
80157
80113
|
const cli = getFrameworkCli(ctx, true);
|
|
80158
|
-
const { npm:
|
|
80159
|
-
const cmd = [...
|
|
80160
|
-
const env3 =
|
|
80114
|
+
const { npm: npm22, dlx } = detectPackageManager();
|
|
80115
|
+
const cmd = [...npm22 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
80116
|
+
const env3 = npm22 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
80161
80117
|
if (ctx.args.additionalArgs?.length) {
|
|
80162
80118
|
cmd.push(...ctx.args.additionalArgs);
|
|
80163
80119
|
}
|
|
@@ -81087,183 +81043,19 @@ var config21 = {
|
|
|
81087
81043
|
};
|
|
81088
81044
|
var c3_default23 = config21;
|
|
81089
81045
|
|
|
81090
|
-
// templates/next/
|
|
81091
|
-
var import_path9 = require("path");
|
|
81092
|
-
var { npm: npm8, npx: npx3 } = detectPackageManager();
|
|
81046
|
+
// templates/next/c3.ts
|
|
81093
81047
|
var generate12 = async (ctx) => {
|
|
81094
|
-
const projectName = ctx.project.name;
|
|
81095
|
-
await runFrameworkGenerator(ctx, [projectName]);
|
|
81096
|
-
const wranglerConfig = readFile((0, import_path9.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
81097
|
-
writeFile2((0, import_path9.join)(ctx.project.path, "wrangler.jsonc"), wranglerConfig);
|
|
81098
|
-
updateStatus("Created wrangler.jsonc file");
|
|
81099
|
-
};
|
|
81100
|
-
var updateNextConfig = (usesTs) => {
|
|
81101
|
-
const s = spinner();
|
|
81102
|
-
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
81103
|
-
s.start(`Updating \`${configFile}\``);
|
|
81104
|
-
const configContent = readFile(configFile);
|
|
81105
|
-
const updatedConfigFile = `import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
|
|
81106
|
-
|
|
81107
|
-
// Here we use the @cloudflare/next-on-pages next-dev module to allow us to
|
|
81108
|
-
// use bindings during local development (when running the application with
|
|
81109
|
-
// \`next dev\`). This function is only necessary during development and
|
|
81110
|
-
// has no impact outside of that. For more information see:
|
|
81111
|
-
// https://github.com/cloudflare/next-on-pages/blob/main/internal-packages/next-dev/README.md
|
|
81112
|
-
setupDevPlatform().catch(console.error);
|
|
81113
|
-
|
|
81114
|
-
`.replace(/\n\t*/g, "\n") + configContent;
|
|
81115
|
-
writeFile2(configFile, updatedConfigFile);
|
|
81116
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81117
|
-
};
|
|
81118
|
-
var configure6 = async (ctx) => {
|
|
81119
|
-
const projectPath = ctx.project.path;
|
|
81120
|
-
const path6 = probePaths([
|
|
81121
|
-
`${projectPath}/pages/api`,
|
|
81122
|
-
`${projectPath}/src/pages/api`,
|
|
81123
|
-
`${projectPath}/src/app/api`,
|
|
81124
|
-
`${projectPath}/app/api`,
|
|
81125
|
-
`${projectPath}/src/app`,
|
|
81126
|
-
`${projectPath}/app`
|
|
81127
|
-
]);
|
|
81128
|
-
if (!path6) {
|
|
81129
|
-
throw new Error("Could not find the `/api` or `/app` directory");
|
|
81130
|
-
}
|
|
81131
|
-
const usesTs = usesTypescript(ctx);
|
|
81132
|
-
const installEslintPlugin = await shouldInstallNextOnPagesEslintPlugin(ctx);
|
|
81133
|
-
if (installEslintPlugin) {
|
|
81134
|
-
await writeEslintrc(ctx);
|
|
81135
|
-
}
|
|
81136
|
-
updateNextConfig(usesTs);
|
|
81137
|
-
copyFile(
|
|
81138
|
-
(0, import_path9.join)(getTemplatePath(ctx), "README.md"),
|
|
81139
|
-
(0, import_path9.join)(projectPath, "README.md")
|
|
81140
|
-
);
|
|
81141
|
-
updateStatus("Updated the README file");
|
|
81142
|
-
await addDevDependencies(installEslintPlugin);
|
|
81143
|
-
};
|
|
81144
|
-
var shouldInstallNextOnPagesEslintPlugin = async (ctx) => {
|
|
81145
|
-
const eslintUsage = usesEslint(ctx);
|
|
81146
|
-
if (!eslintUsage.used) {
|
|
81147
|
-
return false;
|
|
81148
|
-
}
|
|
81149
|
-
if (eslintUsage.configType !== ".eslintrc.json") {
|
|
81150
|
-
warn(
|
|
81151
|
-
`Expected .eslintrc.json from Next.js scaffolding but found ${eslintUsage.configType} instead`
|
|
81152
|
-
);
|
|
81153
|
-
return false;
|
|
81154
|
-
}
|
|
81155
|
-
return await inputPrompt({
|
|
81156
|
-
type: "confirm",
|
|
81157
|
-
question: "Do you want to use the next-on-pages eslint-plugin?",
|
|
81158
|
-
label: "eslint-plugin",
|
|
81159
|
-
defaultValue: true
|
|
81160
|
-
});
|
|
81161
|
-
};
|
|
81162
|
-
var writeEslintrc = async (ctx) => {
|
|
81163
|
-
const eslintConfig = readJSON(`${ctx.project.path}/.eslintrc.json`);
|
|
81164
|
-
eslintConfig.plugins ??= [];
|
|
81165
|
-
eslintConfig.plugins.push("eslint-plugin-next-on-pages");
|
|
81166
|
-
if (typeof eslintConfig.extends === "string") {
|
|
81167
|
-
eslintConfig.extends = [eslintConfig.extends];
|
|
81168
|
-
}
|
|
81169
|
-
eslintConfig.extends ??= [];
|
|
81170
|
-
eslintConfig.extends.push("plugin:eslint-plugin-next-on-pages/recommended");
|
|
81171
|
-
writeJSON(`${ctx.project.path}/.eslintrc.json`, eslintConfig);
|
|
81172
|
-
};
|
|
81173
|
-
var addDevDependencies = async (installEslintPlugin) => {
|
|
81174
|
-
const packages = [
|
|
81175
|
-
"@cloudflare/next-on-pages@1",
|
|
81176
|
-
"vercel@47.0.4",
|
|
81177
|
-
"next@15.4.6",
|
|
81178
|
-
...installEslintPlugin ? ["eslint-plugin-next-on-pages"] : []
|
|
81179
|
-
];
|
|
81180
|
-
await installPackages(packages, {
|
|
81181
|
-
dev: true,
|
|
81182
|
-
startText: "Adding the Cloudflare Pages adapter",
|
|
81183
|
-
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
81184
|
-
});
|
|
81185
|
-
};
|
|
81186
|
-
var envInterfaceName3 = "CloudflareEnv";
|
|
81187
|
-
var typesPath = "./env.d.ts";
|
|
81188
|
-
var c3_default24 = {
|
|
81189
|
-
configVersion: 1,
|
|
81190
|
-
id: "next",
|
|
81191
|
-
frameworkCli: "create-next-app",
|
|
81192
|
-
platform: "pages",
|
|
81193
|
-
hidden: true,
|
|
81194
|
-
displayName: "Next.js",
|
|
81195
|
-
path: "templates/next/pages",
|
|
81196
|
-
generate: generate12,
|
|
81197
|
-
configure: configure6,
|
|
81198
|
-
copyFiles: {
|
|
81199
|
-
async selectVariant(ctx) {
|
|
81200
|
-
const isApp = probePaths([
|
|
81201
|
-
`${ctx.project.path}/src/app`,
|
|
81202
|
-
`${ctx.project.path}/app`
|
|
81203
|
-
]);
|
|
81204
|
-
const isTypescript = usesTypescript(ctx);
|
|
81205
|
-
const dir = isApp ? "app" : "pages";
|
|
81206
|
-
return `${dir}/${isTypescript ? "ts" : "js"}`;
|
|
81207
|
-
},
|
|
81208
|
-
destinationDir(ctx) {
|
|
81209
|
-
const srcPath = probePaths([`${ctx.project.path}/src`]);
|
|
81210
|
-
return srcPath ? "./src" : "./";
|
|
81211
|
-
},
|
|
81212
|
-
variants: {
|
|
81213
|
-
"app/ts": {
|
|
81214
|
-
path: "./app/ts"
|
|
81215
|
-
},
|
|
81216
|
-
"app/js": {
|
|
81217
|
-
path: "./app/js"
|
|
81218
|
-
},
|
|
81219
|
-
"pages/ts": {
|
|
81220
|
-
path: "./pages/ts"
|
|
81221
|
-
},
|
|
81222
|
-
"pages/js": {
|
|
81223
|
-
path: "./pages/js"
|
|
81224
|
-
}
|
|
81225
|
-
}
|
|
81226
|
-
},
|
|
81227
|
-
transformPackageJson: async (_3, ctx) => {
|
|
81228
|
-
const isNpm = npm8 === "npm";
|
|
81229
|
-
const isBun = npm8 === "bun";
|
|
81230
|
-
const isNpmOrBun = isNpm || isBun;
|
|
81231
|
-
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
81232
|
-
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
81233
|
-
const pmCommand = isNpmOrBun ? npx3 : npm8;
|
|
81234
|
-
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
81235
|
-
return {
|
|
81236
|
-
scripts: {
|
|
81237
|
-
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
81238
|
-
preview: `${pagesBuildRunCommand} && wrangler pages dev`,
|
|
81239
|
-
deploy: `${pagesBuildRunCommand} && wrangler pages deploy`,
|
|
81240
|
-
...usesTypescript(ctx) && {
|
|
81241
|
-
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
81242
|
-
}
|
|
81243
|
-
}
|
|
81244
|
-
};
|
|
81245
|
-
},
|
|
81246
|
-
devScript: "dev",
|
|
81247
|
-
previewScript: "preview",
|
|
81248
|
-
deployScript: "deploy",
|
|
81249
|
-
compatibilityFlags: ["nodejs_compat"],
|
|
81250
|
-
typesPath,
|
|
81251
|
-
envInterfaceName: envInterfaceName3
|
|
81252
|
-
};
|
|
81253
|
-
|
|
81254
|
-
// templates/next/workers/c3.ts
|
|
81255
|
-
var generate13 = async (ctx) => {
|
|
81256
81048
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
81257
81049
|
};
|
|
81258
|
-
var
|
|
81050
|
+
var configure6 = async (ctx) => {
|
|
81259
81051
|
await installPackages(["@opennextjs/cloudflare@^1.3.0"], {
|
|
81260
81052
|
startText: "Adding the Cloudflare adapter",
|
|
81261
81053
|
doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
|
|
81262
81054
|
});
|
|
81263
81055
|
const usesTs = usesTypescript(ctx);
|
|
81264
|
-
|
|
81056
|
+
updateNextConfig(usesTs);
|
|
81265
81057
|
};
|
|
81266
|
-
var
|
|
81058
|
+
var updateNextConfig = (usesTs) => {
|
|
81267
81059
|
const s = spinner();
|
|
81268
81060
|
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
81269
81061
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -81276,58 +81068,50 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
81276
81068
|
writeFile2(configFile, updatedConfigFile);
|
|
81277
81069
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81278
81070
|
};
|
|
81279
|
-
var
|
|
81280
|
-
var
|
|
81281
|
-
var
|
|
81071
|
+
var envInterfaceName3 = "CloudflareEnv";
|
|
81072
|
+
var typesPath = "./cloudflare-env.d.ts";
|
|
81073
|
+
var c3_default24 = {
|
|
81282
81074
|
configVersion: 1,
|
|
81283
81075
|
id: "next",
|
|
81284
81076
|
frameworkCli: "create-next-app",
|
|
81285
81077
|
platform: "workers",
|
|
81286
81078
|
displayName: "Next.js",
|
|
81287
|
-
path: "templates/next/workers",
|
|
81288
81079
|
copyFiles: {
|
|
81289
81080
|
path: "./templates"
|
|
81290
81081
|
},
|
|
81291
|
-
generate:
|
|
81292
|
-
configure:
|
|
81082
|
+
generate: generate12,
|
|
81083
|
+
configure: configure6,
|
|
81293
81084
|
transformPackageJson: async () => ({
|
|
81294
81085
|
scripts: {
|
|
81295
81086
|
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
81296
81087
|
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
81297
|
-
"cf-typegen": `wrangler types --env-interface ${
|
|
81088
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
81298
81089
|
}
|
|
81299
81090
|
}),
|
|
81300
81091
|
devScript: "dev",
|
|
81301
81092
|
previewScript: "preview",
|
|
81302
81093
|
deployScript: "deploy",
|
|
81303
|
-
typesPath
|
|
81304
|
-
envInterfaceName:
|
|
81305
|
-
};
|
|
81306
|
-
|
|
81307
|
-
// templates/next/c3.ts
|
|
81308
|
-
var config22 = {
|
|
81309
|
-
displayName: "Next.js",
|
|
81310
|
-
platformVariants: { pages: c3_default24, workers: c3_default25 }
|
|
81094
|
+
typesPath,
|
|
81095
|
+
envInterfaceName: envInterfaceName3
|
|
81311
81096
|
};
|
|
81312
|
-
var c3_default26 = config22;
|
|
81313
81097
|
|
|
81314
81098
|
// templates/nuxt/pages/c3.ts
|
|
81315
81099
|
var recast5 = __toESM(require_main2());
|
|
81316
|
-
var { npm:
|
|
81317
|
-
var
|
|
81100
|
+
var { npm: npm8, name: pm2 } = detectPackageManager();
|
|
81101
|
+
var generate13 = async (ctx) => {
|
|
81318
81102
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
81319
81103
|
await runFrameworkGenerator(ctx, [
|
|
81320
81104
|
"init",
|
|
81321
81105
|
ctx.project.name,
|
|
81322
81106
|
"--packageManager",
|
|
81323
|
-
|
|
81107
|
+
npm8,
|
|
81324
81108
|
"--no-install",
|
|
81325
81109
|
gitFlag
|
|
81326
81110
|
]);
|
|
81327
81111
|
writeFile2("./.node-version", "18");
|
|
81328
81112
|
logRaw("");
|
|
81329
81113
|
};
|
|
81330
|
-
var
|
|
81114
|
+
var configure7 = async () => {
|
|
81331
81115
|
const packages = ["nitro-cloudflare-dev"];
|
|
81332
81116
|
if (pm2 === "pnpm") {
|
|
81333
81117
|
packages.push("h3");
|
|
@@ -81335,7 +81119,7 @@ var configure8 = async () => {
|
|
|
81335
81119
|
await installPackages(packages, {
|
|
81336
81120
|
dev: true,
|
|
81337
81121
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
81338
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
81122
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm8} install\``)}`
|
|
81339
81123
|
});
|
|
81340
81124
|
updateNuxtConfig();
|
|
81341
81125
|
};
|
|
@@ -81381,7 +81165,7 @@ var updateNuxtConfig = () => {
|
|
|
81381
81165
|
});
|
|
81382
81166
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81383
81167
|
};
|
|
81384
|
-
var
|
|
81168
|
+
var config22 = {
|
|
81385
81169
|
configVersion: 1,
|
|
81386
81170
|
id: "nuxt",
|
|
81387
81171
|
frameworkCli: "nuxi",
|
|
@@ -81392,12 +81176,12 @@ var config23 = {
|
|
|
81392
81176
|
path: "./templates"
|
|
81393
81177
|
},
|
|
81394
81178
|
path: "templates/nuxt/pages",
|
|
81395
|
-
generate:
|
|
81396
|
-
configure:
|
|
81179
|
+
generate: generate13,
|
|
81180
|
+
configure: configure7,
|
|
81397
81181
|
transformPackageJson: async () => ({
|
|
81398
81182
|
scripts: {
|
|
81399
|
-
deploy: `${
|
|
81400
|
-
preview: `${
|
|
81183
|
+
deploy: `${npm8} run build && wrangler pages deploy`,
|
|
81184
|
+
preview: `${npm8} run build && wrangler pages dev`,
|
|
81401
81185
|
"cf-typegen": `wrangler types`
|
|
81402
81186
|
}
|
|
81403
81187
|
}),
|
|
@@ -81405,25 +81189,25 @@ var config23 = {
|
|
|
81405
81189
|
deployScript: "deploy",
|
|
81406
81190
|
previewScript: "preview"
|
|
81407
81191
|
};
|
|
81408
|
-
var
|
|
81192
|
+
var c3_default25 = config22;
|
|
81409
81193
|
|
|
81410
81194
|
// templates/nuxt/workers/c3.ts
|
|
81411
81195
|
var recast6 = __toESM(require_main2());
|
|
81412
|
-
var { npm:
|
|
81413
|
-
var
|
|
81196
|
+
var { npm: npm9, name: pm3 } = detectPackageManager();
|
|
81197
|
+
var generate14 = async (ctx) => {
|
|
81414
81198
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
81415
81199
|
await runFrameworkGenerator(ctx, [
|
|
81416
81200
|
"init",
|
|
81417
81201
|
ctx.project.name,
|
|
81418
81202
|
"--packageManager",
|
|
81419
|
-
|
|
81203
|
+
npm9,
|
|
81420
81204
|
"--no-install",
|
|
81421
81205
|
gitFlag
|
|
81422
81206
|
]);
|
|
81423
81207
|
writeFile2("./.node-version", "18");
|
|
81424
81208
|
logRaw("");
|
|
81425
81209
|
};
|
|
81426
|
-
var
|
|
81210
|
+
var configure8 = async () => {
|
|
81427
81211
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
81428
81212
|
if (pm3 === "pnpm") {
|
|
81429
81213
|
packages.push("h3");
|
|
@@ -81431,7 +81215,7 @@ var configure9 = async () => {
|
|
|
81431
81215
|
await installPackages(packages, {
|
|
81432
81216
|
dev: true,
|
|
81433
81217
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
81434
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
81218
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
|
|
81435
81219
|
});
|
|
81436
81220
|
updateNuxtConfig2();
|
|
81437
81221
|
};
|
|
@@ -81477,7 +81261,7 @@ var updateNuxtConfig2 = () => {
|
|
|
81477
81261
|
});
|
|
81478
81262
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81479
81263
|
};
|
|
81480
|
-
var
|
|
81264
|
+
var config23 = {
|
|
81481
81265
|
configVersion: 1,
|
|
81482
81266
|
id: "nuxt",
|
|
81483
81267
|
frameworkCli: "nuxi",
|
|
@@ -81487,12 +81271,12 @@ var config24 = {
|
|
|
81487
81271
|
path: "./templates"
|
|
81488
81272
|
},
|
|
81489
81273
|
path: "templates/nuxt/workers",
|
|
81490
|
-
generate:
|
|
81491
|
-
configure:
|
|
81274
|
+
generate: generate14,
|
|
81275
|
+
configure: configure8,
|
|
81492
81276
|
transformPackageJson: async () => ({
|
|
81493
81277
|
scripts: {
|
|
81494
|
-
deploy: `${
|
|
81495
|
-
preview: `${
|
|
81278
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
81279
|
+
preview: `${npm9} run build && wrangler dev`,
|
|
81496
81280
|
"cf-typegen": `wrangler types`
|
|
81497
81281
|
}
|
|
81498
81282
|
}),
|
|
@@ -81500,17 +81284,17 @@ var config24 = {
|
|
|
81500
81284
|
deployScript: "deploy",
|
|
81501
81285
|
previewScript: "preview"
|
|
81502
81286
|
};
|
|
81503
|
-
var
|
|
81287
|
+
var c3_default26 = config23;
|
|
81504
81288
|
|
|
81505
81289
|
// templates/nuxt/c3.ts
|
|
81506
|
-
var
|
|
81290
|
+
var config24 = {
|
|
81507
81291
|
displayName: "Nuxt",
|
|
81508
|
-
platformVariants: { pages:
|
|
81292
|
+
platformVariants: { pages: c3_default25, workers: c3_default26 }
|
|
81509
81293
|
};
|
|
81510
|
-
var
|
|
81294
|
+
var c3_default27 = config24;
|
|
81511
81295
|
|
|
81512
81296
|
// templates/openapi/c3.ts
|
|
81513
|
-
var
|
|
81297
|
+
var config25 = {
|
|
81514
81298
|
configVersion: 1,
|
|
81515
81299
|
id: "openapi",
|
|
81516
81300
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -81520,12 +81304,12 @@ var config26 = {
|
|
|
81520
81304
|
path: "./ts"
|
|
81521
81305
|
}
|
|
81522
81306
|
};
|
|
81523
|
-
var
|
|
81307
|
+
var c3_default28 = config25;
|
|
81524
81308
|
|
|
81525
81309
|
// templates/pre-existing/c3.ts
|
|
81526
81310
|
var import_promises3 = require("fs/promises");
|
|
81527
81311
|
var import_os = require("os");
|
|
81528
|
-
var
|
|
81312
|
+
var import_path9 = require("path");
|
|
81529
81313
|
|
|
81530
81314
|
// src/wrangler/accounts.ts
|
|
81531
81315
|
var chooseAccount = async (ctx) => {
|
|
@@ -81572,7 +81356,7 @@ var wranglerLogin = async (ctx) => {
|
|
|
81572
81356
|
args: ctx.args
|
|
81573
81357
|
},
|
|
81574
81358
|
async promise() {
|
|
81575
|
-
const { npx:
|
|
81359
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81576
81360
|
const s = spinner();
|
|
81577
81361
|
s.start(
|
|
81578
81362
|
`Logging into Cloudflare ${dim("checking authentication status")}`
|
|
@@ -81586,7 +81370,7 @@ var wranglerLogin = async (ctx) => {
|
|
|
81586
81370
|
s.start(
|
|
81587
81371
|
`Logging into Cloudflare ${dim("This will open a browser window")}`
|
|
81588
81372
|
);
|
|
81589
|
-
const output = await runCommand([
|
|
81373
|
+
const output = await runCommand([npx6, "wrangler", "login"], {
|
|
81590
81374
|
silent: true
|
|
81591
81375
|
});
|
|
81592
81376
|
const success = /Successfully logged in/.test(output);
|
|
@@ -81598,8 +81382,8 @@ var wranglerLogin = async (ctx) => {
|
|
|
81598
81382
|
});
|
|
81599
81383
|
};
|
|
81600
81384
|
var listAccounts = async () => {
|
|
81601
|
-
const { npx:
|
|
81602
|
-
const output = await runCommand([
|
|
81385
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81386
|
+
const output = await runCommand([npx6, "wrangler", "whoami"], {
|
|
81603
81387
|
silent: true
|
|
81604
81388
|
});
|
|
81605
81389
|
const accounts = {};
|
|
@@ -81612,9 +81396,9 @@ var listAccounts = async () => {
|
|
|
81612
81396
|
return accounts;
|
|
81613
81397
|
};
|
|
81614
81398
|
var isLoggedIn = async () => {
|
|
81615
|
-
const { npx:
|
|
81399
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81616
81400
|
try {
|
|
81617
|
-
const output = await runCommand([
|
|
81401
|
+
const output = await runCommand([npx6, "wrangler", "whoami"], {
|
|
81618
81402
|
silent: true
|
|
81619
81403
|
});
|
|
81620
81404
|
return /You are logged in/.test(output);
|
|
@@ -81638,7 +81422,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
81638
81422
|
}
|
|
81639
81423
|
);
|
|
81640
81424
|
}
|
|
81641
|
-
const tempdir = await (0, import_promises3.mkdtemp)((0,
|
|
81425
|
+
const tempdir = await (0, import_promises3.mkdtemp)((0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-"));
|
|
81642
81426
|
await runCommand(
|
|
81643
81427
|
[
|
|
81644
81428
|
...dlx,
|
|
@@ -81661,16 +81445,16 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
81661
81445
|
}
|
|
81662
81446
|
);
|
|
81663
81447
|
await (0, import_promises3.cp)(
|
|
81664
|
-
(0,
|
|
81665
|
-
(0,
|
|
81448
|
+
(0, import_path9.join)(tempdir, ctx.args.existingScript, "src"),
|
|
81449
|
+
(0, import_path9.join)(ctx.project.path, "src"),
|
|
81666
81450
|
{ recursive: true }
|
|
81667
81451
|
);
|
|
81668
81452
|
await (0, import_promises3.cp)(
|
|
81669
|
-
(0,
|
|
81670
|
-
(0,
|
|
81453
|
+
(0, import_path9.join)(tempdir, ctx.args.existingScript, "wrangler.toml"),
|
|
81454
|
+
(0, import_path9.join)(ctx.project.path, "wrangler.toml")
|
|
81671
81455
|
);
|
|
81672
81456
|
}
|
|
81673
|
-
var
|
|
81457
|
+
var config26 = {
|
|
81674
81458
|
configVersion: 1,
|
|
81675
81459
|
id: "pre-existing",
|
|
81676
81460
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -81686,9 +81470,9 @@ var config27 = {
|
|
|
81686
81470
|
copyFiles: copyExistingWorkerFiles
|
|
81687
81471
|
})
|
|
81688
81472
|
};
|
|
81689
|
-
var
|
|
81473
|
+
var c3_default29 = config26;
|
|
81690
81474
|
function buildConfigure(params) {
|
|
81691
|
-
return async function
|
|
81475
|
+
return async function configure17(ctx) {
|
|
81692
81476
|
const loginSuccess = await params.login(ctx);
|
|
81693
81477
|
if (!loginSuccess) {
|
|
81694
81478
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -81700,7 +81484,7 @@ function buildConfigure(params) {
|
|
|
81700
81484
|
}
|
|
81701
81485
|
|
|
81702
81486
|
// templates/queues/c3.ts
|
|
81703
|
-
var
|
|
81487
|
+
var config27 = {
|
|
81704
81488
|
configVersion: 1,
|
|
81705
81489
|
id: "queues",
|
|
81706
81490
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -81727,16 +81511,16 @@ var config28 = {
|
|
|
81727
81511
|
]
|
|
81728
81512
|
}
|
|
81729
81513
|
};
|
|
81730
|
-
var
|
|
81514
|
+
var c3_default30 = config27;
|
|
81731
81515
|
|
|
81732
81516
|
// templates/qwik/pages/c3.ts
|
|
81733
81517
|
var recast7 = __toESM(require_main2());
|
|
81734
|
-
var { npm:
|
|
81735
|
-
var
|
|
81518
|
+
var { npm: npm10, npx: npx3, name } = detectPackageManager();
|
|
81519
|
+
var generate15 = async (ctx) => {
|
|
81736
81520
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
81737
81521
|
};
|
|
81738
|
-
var
|
|
81739
|
-
const cmd = [name === "pnpm" ?
|
|
81522
|
+
var configure9 = async (ctx) => {
|
|
81523
|
+
const cmd = [name === "pnpm" ? npm10 : npx3, "qwik", "add", "cloudflare-pages"];
|
|
81740
81524
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
81741
81525
|
await runCommand(cmd);
|
|
81742
81526
|
addBindingsProxy(ctx);
|
|
@@ -81812,7 +81596,7 @@ var populateCloudflareEnv = () => {
|
|
|
81812
81596
|
});
|
|
81813
81597
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
81814
81598
|
};
|
|
81815
|
-
var
|
|
81599
|
+
var config28 = {
|
|
81816
81600
|
configVersion: 1,
|
|
81817
81601
|
id: "qwik",
|
|
81818
81602
|
frameworkCli: "create-qwik",
|
|
@@ -81823,12 +81607,12 @@ var config29 = {
|
|
|
81823
81607
|
path: "./templates"
|
|
81824
81608
|
},
|
|
81825
81609
|
path: "templates/qwik/pages",
|
|
81826
|
-
generate:
|
|
81827
|
-
configure:
|
|
81610
|
+
generate: generate15,
|
|
81611
|
+
configure: configure9,
|
|
81828
81612
|
transformPackageJson: async () => ({
|
|
81829
81613
|
scripts: {
|
|
81830
|
-
deploy: `${
|
|
81831
|
-
preview: `${
|
|
81614
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
81615
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
81832
81616
|
"cf-typegen": `wrangler types`
|
|
81833
81617
|
}
|
|
81834
81618
|
}),
|
|
@@ -81837,16 +81621,16 @@ var config29 = {
|
|
|
81837
81621
|
previewScript: "preview",
|
|
81838
81622
|
workersTypes: "installed"
|
|
81839
81623
|
};
|
|
81840
|
-
var
|
|
81624
|
+
var c3_default31 = config28;
|
|
81841
81625
|
|
|
81842
81626
|
// templates/qwik/workers/c3.ts
|
|
81843
81627
|
var recast8 = __toESM(require_main2());
|
|
81844
|
-
var { npm:
|
|
81845
|
-
var
|
|
81628
|
+
var { npm: npm11, npx: npx4, name: name2 } = detectPackageManager();
|
|
81629
|
+
var generate16 = async (ctx) => {
|
|
81846
81630
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
81847
81631
|
};
|
|
81848
|
-
var
|
|
81849
|
-
const cmd = [name2 === "pnpm" ?
|
|
81632
|
+
var configure10 = async (ctx) => {
|
|
81633
|
+
const cmd = [name2 === "pnpm" ? npm11 : npx4, "qwik", "add", "cloudflare-pages"];
|
|
81850
81634
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
81851
81635
|
await runCommand(cmd);
|
|
81852
81636
|
removeFile("./public/_routes.json");
|
|
@@ -81923,7 +81707,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
81923
81707
|
});
|
|
81924
81708
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
81925
81709
|
};
|
|
81926
|
-
var
|
|
81710
|
+
var config29 = {
|
|
81927
81711
|
configVersion: 1,
|
|
81928
81712
|
id: "qwik",
|
|
81929
81713
|
frameworkCli: "create-qwik",
|
|
@@ -81933,12 +81717,12 @@ var config30 = {
|
|
|
81933
81717
|
path: "./templates"
|
|
81934
81718
|
},
|
|
81935
81719
|
path: "templates/qwik/workers",
|
|
81936
|
-
generate:
|
|
81937
|
-
configure:
|
|
81720
|
+
generate: generate16,
|
|
81721
|
+
configure: configure10,
|
|
81938
81722
|
transformPackageJson: async () => ({
|
|
81939
81723
|
scripts: {
|
|
81940
|
-
deploy: `${
|
|
81941
|
-
preview: `${
|
|
81724
|
+
deploy: `${npm11} run build && wrangler deploy`,
|
|
81725
|
+
preview: `${npm11} run build && wrangler dev`,
|
|
81942
81726
|
"cf-typegen": `wrangler types`
|
|
81943
81727
|
}
|
|
81944
81728
|
}),
|
|
@@ -81947,40 +81731,41 @@ var config30 = {
|
|
|
81947
81731
|
previewScript: "preview",
|
|
81948
81732
|
workersTypes: "installed"
|
|
81949
81733
|
};
|
|
81950
|
-
var
|
|
81734
|
+
var c3_default32 = config29;
|
|
81951
81735
|
|
|
81952
81736
|
// templates/qwik/c3.ts
|
|
81953
|
-
var
|
|
81737
|
+
var config30 = {
|
|
81954
81738
|
displayName: "Qwik",
|
|
81955
|
-
platformVariants: { pages:
|
|
81739
|
+
platformVariants: { pages: c3_default31, workers: c3_default32 }
|
|
81956
81740
|
};
|
|
81957
|
-
var
|
|
81741
|
+
var c3_default33 = config30;
|
|
81958
81742
|
|
|
81959
81743
|
// templates/react-router/c3.ts
|
|
81960
|
-
var { npm:
|
|
81961
|
-
var
|
|
81744
|
+
var { npm: npm12 } = detectPackageManager();
|
|
81745
|
+
var generate17 = async (ctx) => {
|
|
81962
81746
|
await runFrameworkGenerator(ctx, [
|
|
81963
81747
|
ctx.project.name,
|
|
81964
81748
|
"--template",
|
|
81965
|
-
|
|
81749
|
+
// React-router deleted the template here
|
|
81750
|
+
"https://github.com/remix-run/react-router-templates/tree/29ac272b9532fe26463a2d2693fc73ff3c1e884b/cloudflare",
|
|
81966
81751
|
// to prevent asking about git twice, just let c3 do it
|
|
81967
81752
|
"--no-git-init",
|
|
81968
81753
|
"--no-install"
|
|
81969
81754
|
]);
|
|
81970
81755
|
logRaw("");
|
|
81971
81756
|
};
|
|
81972
|
-
var
|
|
81757
|
+
var config31 = {
|
|
81973
81758
|
configVersion: 1,
|
|
81974
81759
|
id: "react-router",
|
|
81975
81760
|
platform: "workers",
|
|
81976
81761
|
frameworkCli: "create-react-router",
|
|
81977
81762
|
displayName: "React Router (formerly Remix)",
|
|
81978
|
-
generate:
|
|
81763
|
+
generate: generate17,
|
|
81979
81764
|
// configure,
|
|
81980
81765
|
transformPackageJson: async () => ({
|
|
81981
81766
|
scripts: {
|
|
81982
|
-
deploy: `${
|
|
81983
|
-
preview: `${
|
|
81767
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
81768
|
+
preview: `${npm12} run build && vite preview`,
|
|
81984
81769
|
"cf-typegen": `wrangler types`
|
|
81985
81770
|
}
|
|
81986
81771
|
}),
|
|
@@ -81988,11 +81773,11 @@ var config32 = {
|
|
|
81988
81773
|
deployScript: "deploy",
|
|
81989
81774
|
previewScript: "preview"
|
|
81990
81775
|
};
|
|
81991
|
-
var
|
|
81776
|
+
var c3_default34 = config31;
|
|
81992
81777
|
|
|
81993
81778
|
// templates/react/pages/c3.ts
|
|
81994
|
-
var { npm:
|
|
81995
|
-
var
|
|
81779
|
+
var { npm: npm13 } = detectPackageManager();
|
|
81780
|
+
var generate18 = async (ctx) => {
|
|
81996
81781
|
const variant = await inputPrompt({
|
|
81997
81782
|
type: "select",
|
|
81998
81783
|
question: "Select a variant:",
|
|
@@ -82021,7 +81806,7 @@ var variantsOptions = [
|
|
|
82021
81806
|
label: "JavaScript + SWC"
|
|
82022
81807
|
}
|
|
82023
81808
|
];
|
|
82024
|
-
var
|
|
81809
|
+
var config32 = {
|
|
82025
81810
|
configVersion: 1,
|
|
82026
81811
|
id: "react",
|
|
82027
81812
|
// React's documentation now recommends using create-vite.
|
|
@@ -82031,11 +81816,11 @@ var config33 = {
|
|
|
82031
81816
|
hidden: true,
|
|
82032
81817
|
path: "templates/react/pages",
|
|
82033
81818
|
copyFiles: { path: "./templates" },
|
|
82034
|
-
generate:
|
|
81819
|
+
generate: generate18,
|
|
82035
81820
|
transformPackageJson: async () => ({
|
|
82036
81821
|
scripts: {
|
|
82037
|
-
deploy: `${
|
|
82038
|
-
preview: `${
|
|
81822
|
+
deploy: `${npm13} run build && wrangler pages deploy`,
|
|
81823
|
+
preview: `${npm13} run build && wrangler pages dev`,
|
|
82039
81824
|
"cf-typegen": `wrangler types`
|
|
82040
81825
|
}
|
|
82041
81826
|
}),
|
|
@@ -82043,15 +81828,15 @@ var config33 = {
|
|
|
82043
81828
|
deployScript: "deploy",
|
|
82044
81829
|
previewScript: "preview"
|
|
82045
81830
|
};
|
|
82046
|
-
var
|
|
81831
|
+
var c3_default35 = config32;
|
|
82047
81832
|
|
|
82048
81833
|
// templates/react/workers/c3.ts
|
|
82049
81834
|
var import_assert3 = __toESM(require("assert"));
|
|
82050
81835
|
var recast9 = __toESM(require_main2());
|
|
82051
81836
|
var b2 = recast9.types.builders;
|
|
82052
81837
|
var t = recast9.types.namedTypes;
|
|
82053
|
-
var { npm:
|
|
82054
|
-
var
|
|
81838
|
+
var { npm: npm14 } = detectPackageManager();
|
|
81839
|
+
var generate19 = async (ctx) => {
|
|
82055
81840
|
const variant = await getVariant();
|
|
82056
81841
|
ctx.args.lang = variant.lang;
|
|
82057
81842
|
await runFrameworkGenerator(ctx, [
|
|
@@ -82061,7 +81846,7 @@ var generate20 = async (ctx) => {
|
|
|
82061
81846
|
]);
|
|
82062
81847
|
logRaw("");
|
|
82063
81848
|
};
|
|
82064
|
-
var
|
|
81849
|
+
var configure11 = async (ctx) => {
|
|
82065
81850
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
82066
81851
|
dev: true,
|
|
82067
81852
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -82092,9 +81877,9 @@ function transformViteConfig(ctx) {
|
|
|
82092
81877
|
if (callee.name !== "defineConfig") {
|
|
82093
81878
|
return this.traverse(n);
|
|
82094
81879
|
}
|
|
82095
|
-
const
|
|
82096
|
-
(0, import_assert3.default)(t.ObjectExpression.check(
|
|
82097
|
-
const pluginsProp =
|
|
81880
|
+
const config44 = n.node.arguments[0];
|
|
81881
|
+
(0, import_assert3.default)(t.ObjectExpression.check(config44));
|
|
81882
|
+
const pluginsProp = config44.properties.find((prop) => isPluginsProp(prop));
|
|
82098
81883
|
(0, import_assert3.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
82099
81884
|
pluginsProp.value.elements.push(
|
|
82100
81885
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -82151,7 +81936,7 @@ async function getVariant() {
|
|
|
82151
81936
|
(0, import_assert3.default)(selected, "Expected a variant to be selected");
|
|
82152
81937
|
return selected;
|
|
82153
81938
|
}
|
|
82154
|
-
var
|
|
81939
|
+
var config33 = {
|
|
82155
81940
|
configVersion: 1,
|
|
82156
81941
|
id: "react",
|
|
82157
81942
|
frameworkCli: "create-vite",
|
|
@@ -82168,12 +81953,12 @@ var config34 = {
|
|
|
82168
81953
|
}
|
|
82169
81954
|
}
|
|
82170
81955
|
},
|
|
82171
|
-
generate:
|
|
82172
|
-
configure:
|
|
81956
|
+
generate: generate19,
|
|
81957
|
+
configure: configure11,
|
|
82173
81958
|
transformPackageJson: async (_3, ctx) => ({
|
|
82174
81959
|
scripts: {
|
|
82175
|
-
deploy: `${
|
|
82176
|
-
preview: `${
|
|
81960
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
81961
|
+
preview: `${npm14} run build && vite preview`,
|
|
82177
81962
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
82178
81963
|
}
|
|
82179
81964
|
}),
|
|
@@ -82181,120 +81966,17 @@ var config34 = {
|
|
|
82181
81966
|
deployScript: "deploy",
|
|
82182
81967
|
previewScript: "preview"
|
|
82183
81968
|
};
|
|
82184
|
-
var
|
|
81969
|
+
var c3_default36 = config33;
|
|
82185
81970
|
|
|
82186
81971
|
// templates/react/c3.ts
|
|
82187
|
-
var
|
|
81972
|
+
var config34 = {
|
|
82188
81973
|
displayName: "React",
|
|
82189
|
-
platformVariants: { pages:
|
|
82190
|
-
};
|
|
82191
|
-
var c3_default39 = config35;
|
|
82192
|
-
|
|
82193
|
-
// templates/remix/pages/c3.ts
|
|
82194
|
-
var { npm: npm16 } = detectPackageManager();
|
|
82195
|
-
var generate21 = async (ctx) => {
|
|
82196
|
-
await runFrameworkGenerator(ctx, [
|
|
82197
|
-
ctx.project.name,
|
|
82198
|
-
"--template",
|
|
82199
|
-
"https://github.com/remix-run/remix/tree/main-prev/templates/cloudflare"
|
|
82200
|
-
]);
|
|
82201
|
-
logRaw("");
|
|
82202
|
-
};
|
|
82203
|
-
var configure13 = async () => {
|
|
82204
|
-
const typeDefsPath = "load-context.ts";
|
|
82205
|
-
const s = spinner();
|
|
82206
|
-
s.start(`Updating \`${typeDefsPath}\``);
|
|
82207
|
-
transformFile(typeDefsPath, {
|
|
82208
|
-
visitTSInterfaceDeclaration(n) {
|
|
82209
|
-
if (n.node.id.type === "Identifier" && n.node.id.name !== "Env") {
|
|
82210
|
-
return this.traverse(n);
|
|
82211
|
-
}
|
|
82212
|
-
n.replace();
|
|
82213
|
-
return false;
|
|
82214
|
-
}
|
|
82215
|
-
});
|
|
82216
|
-
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
82217
|
-
};
|
|
82218
|
-
var config36 = {
|
|
82219
|
-
configVersion: 1,
|
|
82220
|
-
id: "remix",
|
|
82221
|
-
frameworkCli: "create-remix",
|
|
82222
|
-
platform: "pages",
|
|
82223
|
-
hidden: true,
|
|
82224
|
-
displayName: "Remix",
|
|
82225
|
-
copyFiles: {
|
|
82226
|
-
path: "./templates"
|
|
82227
|
-
},
|
|
82228
|
-
path: "templates/remix/pages",
|
|
82229
|
-
generate: generate21,
|
|
82230
|
-
configure: configure13,
|
|
82231
|
-
transformPackageJson: async () => ({
|
|
82232
|
-
scripts: {
|
|
82233
|
-
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
82234
|
-
preview: `${npm16} run build && wrangler pages dev`,
|
|
82235
|
-
"cf-typegen": `wrangler types`
|
|
82236
|
-
}
|
|
82237
|
-
}),
|
|
82238
|
-
devScript: "dev",
|
|
82239
|
-
deployScript: "deploy",
|
|
82240
|
-
previewScript: "preview",
|
|
82241
|
-
workersTypes: "installed"
|
|
82242
|
-
};
|
|
82243
|
-
var c3_default40 = config36;
|
|
82244
|
-
|
|
82245
|
-
// templates/remix/workers/c3.ts
|
|
82246
|
-
var { npm: npm17 } = detectPackageManager();
|
|
82247
|
-
var generate22 = async (ctx) => {
|
|
82248
|
-
await runFrameworkGenerator(ctx, [
|
|
82249
|
-
ctx.project.name,
|
|
82250
|
-
"--template",
|
|
82251
|
-
"https://github.com/remix-run/remix/tree/main-prev/templates/cloudflare-workers"
|
|
82252
|
-
]);
|
|
82253
|
-
logRaw("");
|
|
82254
|
-
};
|
|
82255
|
-
var configure14 = async () => {
|
|
82256
|
-
await installPackages(["wrangler@latest"], {
|
|
82257
|
-
dev: true,
|
|
82258
|
-
startText: "Updating the Wrangler version",
|
|
82259
|
-
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
82260
|
-
});
|
|
82261
|
-
};
|
|
82262
|
-
var config37 = {
|
|
82263
|
-
configVersion: 1,
|
|
82264
|
-
id: "remix",
|
|
82265
|
-
frameworkCli: "create-remix",
|
|
82266
|
-
platform: "workers",
|
|
82267
|
-
displayName: "Remix",
|
|
82268
|
-
copyFiles: {
|
|
82269
|
-
path: "./templates"
|
|
82270
|
-
},
|
|
82271
|
-
path: "templates/remix/workers",
|
|
82272
|
-
generate: generate22,
|
|
82273
|
-
configure: configure14,
|
|
82274
|
-
transformPackageJson: async () => ({
|
|
82275
|
-
scripts: {
|
|
82276
|
-
deploy: `${npm17} run build && wrangler deploy`,
|
|
82277
|
-
preview: `${npm17} run build && wrangler dev`,
|
|
82278
|
-
"cf-typegen": `wrangler types`
|
|
82279
|
-
}
|
|
82280
|
-
}),
|
|
82281
|
-
devScript: "dev",
|
|
82282
|
-
deployScript: "deploy",
|
|
82283
|
-
previewScript: "preview",
|
|
82284
|
-
workersTypes: "installed"
|
|
82285
|
-
};
|
|
82286
|
-
var c3_default41 = config37;
|
|
82287
|
-
|
|
82288
|
-
// templates/remix/c3.ts
|
|
82289
|
-
var config38 = {
|
|
82290
|
-
displayName: "Remix",
|
|
82291
|
-
platformVariants: { pages: c3_default40, workers: c3_default41 },
|
|
82292
|
-
hidden: true
|
|
81974
|
+
platformVariants: { pages: c3_default35, workers: c3_default36 }
|
|
82293
81975
|
};
|
|
82294
|
-
var
|
|
81976
|
+
var c3_default37 = config34;
|
|
82295
81977
|
|
|
82296
81978
|
// templates/scheduled/c3.ts
|
|
82297
|
-
var
|
|
81979
|
+
var config35 = {
|
|
82298
81980
|
configVersion: 1,
|
|
82299
81981
|
id: "scheduled",
|
|
82300
81982
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -82311,11 +81993,11 @@ var config39 = {
|
|
|
82311
81993
|
}
|
|
82312
81994
|
}
|
|
82313
81995
|
};
|
|
82314
|
-
var
|
|
81996
|
+
var c3_default38 = config35;
|
|
82315
81997
|
|
|
82316
81998
|
// src/helpers/compatDate.ts
|
|
82317
81999
|
var import_fs9 = require("fs");
|
|
82318
|
-
var
|
|
82000
|
+
var import_path10 = require("path");
|
|
82319
82001
|
async function getWorkerdCompatibilityDate() {
|
|
82320
82002
|
const s = spinner();
|
|
82321
82003
|
s.start("Retrieving current workerd compatibility date");
|
|
@@ -82343,7 +82025,7 @@ async function getWorkerdCompatibilityDate() {
|
|
|
82343
82025
|
return fallbackDate;
|
|
82344
82026
|
}
|
|
82345
82027
|
function getLatestTypesEntrypoint(ctx) {
|
|
82346
|
-
const workersTypesPath = (0,
|
|
82028
|
+
const workersTypesPath = (0, import_path10.resolve)(
|
|
82347
82029
|
ctx.project.path,
|
|
82348
82030
|
"node_modules",
|
|
82349
82031
|
"@cloudflare",
|
|
@@ -82363,17 +82045,17 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
82363
82045
|
|
|
82364
82046
|
// templates/solid/c3.ts
|
|
82365
82047
|
var recast10 = __toESM(require_main2());
|
|
82366
|
-
var { npm:
|
|
82367
|
-
var
|
|
82048
|
+
var { npm: npm15 } = detectPackageManager();
|
|
82049
|
+
var generate20 = async (ctx) => {
|
|
82368
82050
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
82369
82051
|
logRaw("");
|
|
82370
82052
|
};
|
|
82371
|
-
var
|
|
82053
|
+
var configure12 = async (ctx) => {
|
|
82372
82054
|
const packages = ["nitropack"];
|
|
82373
82055
|
await installPackages(packages, {
|
|
82374
82056
|
dev: true,
|
|
82375
82057
|
startText: "Installing nitro module `nitropack`",
|
|
82376
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
82058
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
|
|
82377
82059
|
});
|
|
82378
82060
|
usesTypescript(ctx);
|
|
82379
82061
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -82409,7 +82091,7 @@ var configure15 = async (ctx) => {
|
|
|
82409
82091
|
}
|
|
82410
82092
|
});
|
|
82411
82093
|
};
|
|
82412
|
-
var
|
|
82094
|
+
var config36 = {
|
|
82413
82095
|
configVersion: 1,
|
|
82414
82096
|
id: "solid",
|
|
82415
82097
|
frameworkCli: "create-solid",
|
|
@@ -82419,12 +82101,12 @@ var config40 = {
|
|
|
82419
82101
|
path: "./templates"
|
|
82420
82102
|
},
|
|
82421
82103
|
path: "templates/solid",
|
|
82422
|
-
generate:
|
|
82423
|
-
configure:
|
|
82104
|
+
generate: generate20,
|
|
82105
|
+
configure: configure12,
|
|
82424
82106
|
transformPackageJson: async () => ({
|
|
82425
82107
|
scripts: {
|
|
82426
|
-
preview: `${
|
|
82427
|
-
deploy: `${
|
|
82108
|
+
preview: `${npm15} run build && npx wrangler dev`,
|
|
82109
|
+
deploy: `${npm15} run build && wrangler deploy`,
|
|
82428
82110
|
"cf-typegen": `wrangler types`
|
|
82429
82111
|
}
|
|
82430
82112
|
}),
|
|
@@ -82432,17 +82114,17 @@ var config40 = {
|
|
|
82432
82114
|
deployScript: "deploy",
|
|
82433
82115
|
previewScript: "preview"
|
|
82434
82116
|
};
|
|
82435
|
-
var
|
|
82117
|
+
var c3_default39 = config36;
|
|
82436
82118
|
|
|
82437
82119
|
// templates/svelte/pages/c3.ts
|
|
82438
82120
|
var import_node_fs3 = require("node:fs");
|
|
82439
82121
|
var recast11 = __toESM(require_main2());
|
|
82440
|
-
var { npm:
|
|
82441
|
-
var
|
|
82122
|
+
var { npm: npm16 } = detectPackageManager();
|
|
82123
|
+
var generate21 = async (ctx) => {
|
|
82442
82124
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
82443
82125
|
logRaw("");
|
|
82444
82126
|
};
|
|
82445
|
-
var
|
|
82127
|
+
var configure13 = async (ctx) => {
|
|
82446
82128
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
82447
82129
|
await installPackages([pkg], {
|
|
82448
82130
|
dev: true,
|
|
@@ -82524,8 +82206,8 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
82524
82206
|
}
|
|
82525
82207
|
});
|
|
82526
82208
|
};
|
|
82527
|
-
var
|
|
82528
|
-
var
|
|
82209
|
+
var typesPath2 = "src/worker-configuration.d.ts";
|
|
82210
|
+
var config37 = {
|
|
82529
82211
|
configVersion: 1,
|
|
82530
82212
|
id: "svelte",
|
|
82531
82213
|
frameworkCli: "sv",
|
|
@@ -82536,17 +82218,17 @@ var config41 = {
|
|
|
82536
82218
|
path: "./templates"
|
|
82537
82219
|
},
|
|
82538
82220
|
path: "templates/svelte/pages",
|
|
82539
|
-
generate:
|
|
82540
|
-
configure:
|
|
82221
|
+
generate: generate21,
|
|
82222
|
+
configure: configure13,
|
|
82541
82223
|
transformPackageJson: async (original, ctx) => {
|
|
82542
82224
|
let scripts = {
|
|
82543
|
-
preview: `${
|
|
82544
|
-
deploy: `${
|
|
82225
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
82226
|
+
deploy: `${npm16} run build && wrangler pages deploy`
|
|
82545
82227
|
};
|
|
82546
82228
|
if (usesTypescript(ctx)) {
|
|
82547
82229
|
scripts = {
|
|
82548
82230
|
...scripts,
|
|
82549
|
-
"cf-typegen": `wrangler types ${
|
|
82231
|
+
"cf-typegen": `wrangler types ${typesPath2}`
|
|
82550
82232
|
};
|
|
82551
82233
|
}
|
|
82552
82234
|
return { scripts };
|
|
@@ -82554,18 +82236,18 @@ var config41 = {
|
|
|
82554
82236
|
devScript: "dev",
|
|
82555
82237
|
deployScript: "deploy",
|
|
82556
82238
|
previewScript: "preview",
|
|
82557
|
-
typesPath:
|
|
82239
|
+
typesPath: typesPath2
|
|
82558
82240
|
};
|
|
82559
|
-
var
|
|
82241
|
+
var c3_default40 = config37;
|
|
82560
82242
|
|
|
82561
82243
|
// templates/svelte/workers/c3.ts
|
|
82562
82244
|
var recast12 = __toESM(require_main2());
|
|
82563
|
-
var { npm:
|
|
82564
|
-
var
|
|
82245
|
+
var { npm: npm17 } = detectPackageManager();
|
|
82246
|
+
var generate22 = async (ctx) => {
|
|
82565
82247
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
82566
82248
|
logRaw("");
|
|
82567
82249
|
};
|
|
82568
|
-
var
|
|
82250
|
+
var configure14 = async (ctx) => {
|
|
82569
82251
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
82570
82252
|
await installPackages([pkg], {
|
|
82571
82253
|
dev: true,
|
|
@@ -82624,8 +82306,8 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
82624
82306
|
}
|
|
82625
82307
|
});
|
|
82626
82308
|
};
|
|
82627
|
-
var
|
|
82628
|
-
var
|
|
82309
|
+
var typesPath3 = "./src/worker-configuration.d.ts";
|
|
82310
|
+
var config38 = {
|
|
82629
82311
|
configVersion: 1,
|
|
82630
82312
|
id: "svelte",
|
|
82631
82313
|
frameworkCli: "sv",
|
|
@@ -82635,17 +82317,17 @@ var config42 = {
|
|
|
82635
82317
|
path: "./templates"
|
|
82636
82318
|
},
|
|
82637
82319
|
path: "templates/svelte/workers",
|
|
82638
|
-
generate:
|
|
82639
|
-
configure:
|
|
82320
|
+
generate: generate22,
|
|
82321
|
+
configure: configure14,
|
|
82640
82322
|
transformPackageJson: async (original, ctx) => {
|
|
82641
82323
|
let scripts = {
|
|
82642
|
-
preview: `${
|
|
82643
|
-
deploy: `${
|
|
82324
|
+
preview: `${npm17} run build && wrangler dev`,
|
|
82325
|
+
deploy: `${npm17} run build && wrangler deploy`
|
|
82644
82326
|
};
|
|
82645
82327
|
if (usesTypescript(ctx)) {
|
|
82646
82328
|
scripts = {
|
|
82647
82329
|
...scripts,
|
|
82648
|
-
"cf-typegen": `wrangler types ${
|
|
82330
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
82649
82331
|
};
|
|
82650
82332
|
}
|
|
82651
82333
|
return { scripts };
|
|
@@ -82653,23 +82335,23 @@ var config42 = {
|
|
|
82653
82335
|
devScript: "dev",
|
|
82654
82336
|
deployScript: "deploy",
|
|
82655
82337
|
previewScript: "preview",
|
|
82656
|
-
typesPath:
|
|
82338
|
+
typesPath: typesPath3
|
|
82657
82339
|
};
|
|
82658
|
-
var
|
|
82340
|
+
var c3_default41 = config38;
|
|
82659
82341
|
|
|
82660
82342
|
// templates/svelte/c3.ts
|
|
82661
|
-
var
|
|
82343
|
+
var config39 = {
|
|
82662
82344
|
displayName: "SvelteKit",
|
|
82663
|
-
platformVariants: { pages:
|
|
82345
|
+
platformVariants: { pages: c3_default40, workers: c3_default41 }
|
|
82664
82346
|
};
|
|
82665
|
-
var
|
|
82347
|
+
var c3_default42 = config39;
|
|
82666
82348
|
|
|
82667
82349
|
// templates/vue/pages/c3.ts
|
|
82668
|
-
var { npm:
|
|
82669
|
-
var
|
|
82350
|
+
var { npm: npm18 } = detectPackageManager();
|
|
82351
|
+
var generate23 = async (ctx) => {
|
|
82670
82352
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
82671
82353
|
};
|
|
82672
|
-
var
|
|
82354
|
+
var config40 = {
|
|
82673
82355
|
configVersion: 1,
|
|
82674
82356
|
id: "vue",
|
|
82675
82357
|
frameworkCli: "create-vue",
|
|
@@ -82678,11 +82360,11 @@ var config44 = {
|
|
|
82678
82360
|
hidden: true,
|
|
82679
82361
|
path: "templates/vue/pages",
|
|
82680
82362
|
copyFiles: { path: "./templates" },
|
|
82681
|
-
generate:
|
|
82363
|
+
generate: generate23,
|
|
82682
82364
|
transformPackageJson: async () => ({
|
|
82683
82365
|
scripts: {
|
|
82684
|
-
deploy: `${
|
|
82685
|
-
preview: `${
|
|
82366
|
+
deploy: `${npm18} run build && wrangler pages deploy`,
|
|
82367
|
+
preview: `${npm18} run build && wrangler pages dev`,
|
|
82686
82368
|
"cf-typegen": `wrangler types`
|
|
82687
82369
|
}
|
|
82688
82370
|
}),
|
|
@@ -82690,11 +82372,11 @@ var config44 = {
|
|
|
82690
82372
|
deployScript: "deploy",
|
|
82691
82373
|
previewScript: "preview"
|
|
82692
82374
|
};
|
|
82693
|
-
var
|
|
82375
|
+
var c3_default43 = config40;
|
|
82694
82376
|
|
|
82695
82377
|
// templates/vue/workers/c3.ts
|
|
82696
|
-
var { npm:
|
|
82697
|
-
var
|
|
82378
|
+
var { npm: npm19 } = detectPackageManager();
|
|
82379
|
+
var generate24 = async (ctx) => {
|
|
82698
82380
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
82699
82381
|
type: "select",
|
|
82700
82382
|
question: "Would you like to use TypeScript?",
|
|
@@ -82711,7 +82393,7 @@ var generate27 = async (ctx) => {
|
|
|
82711
82393
|
]);
|
|
82712
82394
|
logRaw("");
|
|
82713
82395
|
};
|
|
82714
|
-
var
|
|
82396
|
+
var configure15 = async (ctx) => {
|
|
82715
82397
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
82716
82398
|
dev: true,
|
|
82717
82399
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -82732,7 +82414,7 @@ function updateTsconfigJson2() {
|
|
|
82732
82414
|
writeJSON("tsconfig.json", tsconfig);
|
|
82733
82415
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
82734
82416
|
}
|
|
82735
|
-
var
|
|
82417
|
+
var config41 = {
|
|
82736
82418
|
configVersion: 1,
|
|
82737
82419
|
id: "vue",
|
|
82738
82420
|
frameworkCli: "create-vue",
|
|
@@ -82752,12 +82434,12 @@ var config45 = {
|
|
|
82752
82434
|
}
|
|
82753
82435
|
}
|
|
82754
82436
|
},
|
|
82755
|
-
configure:
|
|
82756
|
-
generate:
|
|
82437
|
+
configure: configure15,
|
|
82438
|
+
generate: generate24,
|
|
82757
82439
|
transformPackageJson: async (_3, ctx) => ({
|
|
82758
82440
|
scripts: {
|
|
82759
|
-
deploy: `${
|
|
82760
|
-
preview: `${
|
|
82441
|
+
deploy: `${npm19} run build && wrangler deploy`,
|
|
82442
|
+
preview: `${npm19} run build && wrangler dev`,
|
|
82761
82443
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
82762
82444
|
}
|
|
82763
82445
|
}),
|
|
@@ -82765,20 +82447,50 @@ var config45 = {
|
|
|
82765
82447
|
deployScript: "deploy",
|
|
82766
82448
|
previewScript: "preview"
|
|
82767
82449
|
};
|
|
82768
|
-
var
|
|
82450
|
+
var c3_default44 = config41;
|
|
82769
82451
|
|
|
82770
82452
|
// templates/vue/c3.ts
|
|
82771
|
-
var
|
|
82453
|
+
var config42 = {
|
|
82772
82454
|
displayName: "Vue",
|
|
82773
|
-
platformVariants: { pages:
|
|
82455
|
+
platformVariants: { pages: c3_default43, workers: c3_default44 }
|
|
82774
82456
|
};
|
|
82775
|
-
var
|
|
82457
|
+
var c3_default45 = config42;
|
|
82458
|
+
|
|
82459
|
+
// templates/waku/c3.ts
|
|
82460
|
+
var { npm: npm20 } = detectPackageManager();
|
|
82461
|
+
var generate25 = async (ctx) => {
|
|
82462
|
+
await runFrameworkGenerator(ctx, [
|
|
82463
|
+
"--project-name",
|
|
82464
|
+
ctx.project.name,
|
|
82465
|
+
"--template",
|
|
82466
|
+
"07_cloudflare"
|
|
82467
|
+
]);
|
|
82468
|
+
};
|
|
82469
|
+
var config43 = {
|
|
82470
|
+
configVersion: 1,
|
|
82471
|
+
id: "waku",
|
|
82472
|
+
frameworkCli: "create-waku",
|
|
82473
|
+
platform: "workers",
|
|
82474
|
+
displayName: "Waku",
|
|
82475
|
+
path: "templates/waku",
|
|
82476
|
+
generate: generate25,
|
|
82477
|
+
transformPackageJson: async () => ({
|
|
82478
|
+
scripts: {
|
|
82479
|
+
deploy: `${npm20} run build && wrangler deploy`,
|
|
82480
|
+
preview: `NODE_ENV=production ${npm20} run build && wrangler dev`
|
|
82481
|
+
}
|
|
82482
|
+
}),
|
|
82483
|
+
devScript: "dev",
|
|
82484
|
+
deployScript: "deploy",
|
|
82485
|
+
previewScript: "preview"
|
|
82486
|
+
};
|
|
82487
|
+
var c3_default46 = config43;
|
|
82776
82488
|
|
|
82777
82489
|
// src/git.ts
|
|
82778
82490
|
var import_node_assert2 = __toESM(require("node:assert"));
|
|
82779
82491
|
|
|
82780
82492
|
// ../wrangler/package.json
|
|
82781
|
-
var version2 = "4.
|
|
82493
|
+
var version2 = "4.40.3";
|
|
82782
82494
|
|
|
82783
82495
|
// src/git.ts
|
|
82784
82496
|
var offerGit = async (ctx) => {
|
|
@@ -82957,7 +82669,7 @@ async function getProductionBranch(cwd) {
|
|
|
82957
82669
|
|
|
82958
82670
|
// src/validators.ts
|
|
82959
82671
|
var import_fs10 = require("fs");
|
|
82960
|
-
var
|
|
82672
|
+
var import_path11 = require("path");
|
|
82961
82673
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
82962
82674
|
var validateTemplateUrl = (value) => {
|
|
82963
82675
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -82965,7 +82677,7 @@ var validateTemplateUrl = (value) => {
|
|
|
82965
82677
|
}
|
|
82966
82678
|
};
|
|
82967
82679
|
var validateProjectDirectory = (relativePath, args) => {
|
|
82968
|
-
const path6 = (0,
|
|
82680
|
+
const path6 = (0, import_path11.resolve)(relativePath);
|
|
82969
82681
|
const existsAlready = (0, import_fs10.existsSync)(path6);
|
|
82970
82682
|
if (existsAlready) {
|
|
82971
82683
|
for (const file of (0, import_fs10.readdirSync)(path6)) {
|
|
@@ -82975,7 +82687,7 @@ var validateProjectDirectory = (relativePath, args) => {
|
|
|
82975
82687
|
}
|
|
82976
82688
|
}
|
|
82977
82689
|
if (!args.existingScript) {
|
|
82978
|
-
const projectName = (0,
|
|
82690
|
+
const projectName = (0, import_path11.basename)(path6);
|
|
82979
82691
|
const invalidChars = /[^a-z0-9-]/;
|
|
82980
82692
|
const invalidStartEnd = /^-|-$/;
|
|
82981
82693
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -83049,15 +82761,15 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
83049
82761
|
docusaurus: c3_default11,
|
|
83050
82762
|
gatsby: c3_default14,
|
|
83051
82763
|
hono: c3_default23,
|
|
83052
|
-
next:
|
|
83053
|
-
nuxt:
|
|
83054
|
-
qwik:
|
|
83055
|
-
react:
|
|
83056
|
-
"react-router":
|
|
83057
|
-
|
|
83058
|
-
|
|
83059
|
-
|
|
83060
|
-
|
|
82764
|
+
next: c3_default24,
|
|
82765
|
+
nuxt: c3_default27,
|
|
82766
|
+
qwik: c3_default33,
|
|
82767
|
+
react: c3_default37,
|
|
82768
|
+
"react-router": c3_default34,
|
|
82769
|
+
solid: c3_default39,
|
|
82770
|
+
svelte: c3_default42,
|
|
82771
|
+
vue: c3_default45,
|
|
82772
|
+
waku: c3_default46
|
|
83061
82773
|
};
|
|
83062
82774
|
}
|
|
83063
82775
|
}
|
|
@@ -83069,10 +82781,10 @@ function getOtherTemplateMap({
|
|
|
83069
82781
|
} else {
|
|
83070
82782
|
return {
|
|
83071
82783
|
common: c3_default8,
|
|
83072
|
-
scheduled:
|
|
83073
|
-
queues:
|
|
83074
|
-
openapi:
|
|
83075
|
-
"pre-existing":
|
|
82784
|
+
scheduled: c3_default38,
|
|
82785
|
+
queues: c3_default30,
|
|
82786
|
+
openapi: c3_default28,
|
|
82787
|
+
"pre-existing": c3_default29
|
|
83076
82788
|
};
|
|
83077
82789
|
}
|
|
83078
82790
|
}
|
|
@@ -83090,10 +82802,10 @@ function getHelloWorldTemplateMap({
|
|
|
83090
82802
|
"hello-world-durable-object-with-assets": c3_default16,
|
|
83091
82803
|
"hello-world-workflows": c3_default19,
|
|
83092
82804
|
common: c3_default8,
|
|
83093
|
-
scheduled:
|
|
83094
|
-
queues:
|
|
83095
|
-
openapi:
|
|
83096
|
-
"pre-existing":
|
|
82805
|
+
scheduled: c3_default38,
|
|
82806
|
+
queues: c3_default30,
|
|
82807
|
+
openapi: c3_default28,
|
|
82808
|
+
"pre-existing": c3_default29
|
|
83097
82809
|
};
|
|
83098
82810
|
}
|
|
83099
82811
|
}
|
|
@@ -83252,10 +82964,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
83252
82964
|
let template;
|
|
83253
82965
|
if (category === "web-framework") {
|
|
83254
82966
|
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
83255
|
-
(acc, [key,
|
|
83256
|
-
if (!
|
|
82967
|
+
(acc, [key, config44]) => {
|
|
82968
|
+
if (!config44.hidden || args.framework) {
|
|
83257
82969
|
acc.push({
|
|
83258
|
-
label:
|
|
82970
|
+
label: config44.displayName,
|
|
83259
82971
|
value: key
|
|
83260
82972
|
});
|
|
83261
82973
|
}
|
|
@@ -83281,7 +82993,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
83281
82993
|
if ("platformVariants" in frameworkConfig) {
|
|
83282
82994
|
const availableVariants = Object.entries(
|
|
83283
82995
|
frameworkConfig.platformVariants
|
|
83284
|
-
).filter(([,
|
|
82996
|
+
).filter(([, config44]) => !config44.hidden);
|
|
83285
82997
|
if (availableVariants.length === 1) {
|
|
83286
82998
|
args.platform ??= availableVariants[0][0];
|
|
83287
82999
|
}
|
|
@@ -83359,7 +83071,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
83359
83071
|
envInterfaceName: "Env",
|
|
83360
83072
|
...template
|
|
83361
83073
|
};
|
|
83362
|
-
const path6 = (0,
|
|
83074
|
+
const path6 = (0, import_path12.resolve)(projectName);
|
|
83363
83075
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
83364
83076
|
if (languageVariants.length > 0) {
|
|
83365
83077
|
if (hasTsConfig(path6)) {
|
|
@@ -83385,8 +83097,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
83385
83097
|
}
|
|
83386
83098
|
}
|
|
83387
83099
|
}
|
|
83388
|
-
const name3 = (0,
|
|
83389
|
-
const directory = (0,
|
|
83100
|
+
const name3 = (0, import_path12.basename)(path6);
|
|
83101
|
+
const directory = (0, import_path12.dirname)(path6);
|
|
83390
83102
|
const originalCWD = process.cwd();
|
|
83391
83103
|
return {
|
|
83392
83104
|
project: { name: name3, path: path6 },
|
|
@@ -83406,7 +83118,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
83406
83118
|
const { copyFiles } = ctx.template;
|
|
83407
83119
|
let srcdir;
|
|
83408
83120
|
if (isVariantInfo(copyFiles)) {
|
|
83409
|
-
srcdir = (0,
|
|
83121
|
+
srcdir = (0, import_path12.join)(getTemplatePath(ctx), copyFiles.path);
|
|
83410
83122
|
} else {
|
|
83411
83123
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
83412
83124
|
const variant = await selectVariant(ctx);
|
|
@@ -83416,16 +83128,16 @@ async function copyTemplateFiles(ctx) {
|
|
|
83416
83128
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
83417
83129
|
);
|
|
83418
83130
|
}
|
|
83419
|
-
srcdir = (0,
|
|
83131
|
+
srcdir = (0, import_path12.join)(getTemplatePath(ctx), variantInfo.path);
|
|
83420
83132
|
}
|
|
83421
83133
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
83422
|
-
const destdir = (0,
|
|
83134
|
+
const destdir = (0, import_path12.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
83423
83135
|
const s = spinner();
|
|
83424
83136
|
s.start(`Copying template files`);
|
|
83425
83137
|
await (0, import_promises4.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
83426
|
-
const dummyGitIgnorePath = (0,
|
|
83138
|
+
const dummyGitIgnorePath = (0, import_path12.join)(destdir, "__dot__gitignore");
|
|
83427
83139
|
if ((0, import_fs11.existsSync)(dummyGitIgnorePath)) {
|
|
83428
|
-
await (0, import_promises4.rename)(dummyGitIgnorePath, (0,
|
|
83140
|
+
await (0, import_promises4.rename)(dummyGitIgnorePath, (0, import_path12.join)(destdir, ".gitignore"));
|
|
83429
83141
|
}
|
|
83430
83142
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
83431
83143
|
}
|
|
@@ -83442,38 +83154,38 @@ var processRemoteTemplate = async (args) => {
|
|
|
83442
83154
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
83443
83155
|
}
|
|
83444
83156
|
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
83445
|
-
const
|
|
83446
|
-
validateTemplate(path6,
|
|
83157
|
+
const config44 = inferTemplateConfig(path6);
|
|
83158
|
+
validateTemplate(path6, config44);
|
|
83447
83159
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
83448
83160
|
return {
|
|
83449
83161
|
path: path6,
|
|
83450
|
-
...
|
|
83162
|
+
...config44
|
|
83451
83163
|
};
|
|
83452
83164
|
};
|
|
83453
|
-
var validateTemplate = (path6,
|
|
83454
|
-
if (!
|
|
83165
|
+
var validateTemplate = (path6, config44) => {
|
|
83166
|
+
if (!config44.copyFiles) {
|
|
83455
83167
|
return;
|
|
83456
83168
|
}
|
|
83457
|
-
if (isVariantInfo(
|
|
83458
|
-
validateTemplateSrcDirectory((0,
|
|
83169
|
+
if (isVariantInfo(config44.copyFiles)) {
|
|
83170
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, config44.copyFiles.path), config44);
|
|
83459
83171
|
} else {
|
|
83460
|
-
for (const variant of Object.values(
|
|
83461
|
-
validateTemplateSrcDirectory((0,
|
|
83172
|
+
for (const variant of Object.values(config44.copyFiles.variants)) {
|
|
83173
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, variant.path), config44);
|
|
83462
83174
|
}
|
|
83463
83175
|
}
|
|
83464
83176
|
};
|
|
83465
|
-
var validateTemplateSrcDirectory = (path6,
|
|
83466
|
-
if (
|
|
83467
|
-
const wranglerTomlPath = (0,
|
|
83468
|
-
const wranglerJsonPath = (0,
|
|
83469
|
-
const wranglerJsoncPath = (0,
|
|
83177
|
+
var validateTemplateSrcDirectory = (path6, config44) => {
|
|
83178
|
+
if (config44.platform === "workers") {
|
|
83179
|
+
const wranglerTomlPath = (0, import_path12.resolve)(path6, "wrangler.toml");
|
|
83180
|
+
const wranglerJsonPath = (0, import_path12.resolve)(path6, "wrangler.json");
|
|
83181
|
+
const wranglerJsoncPath = (0, import_path12.resolve)(path6, "wrangler.jsonc");
|
|
83470
83182
|
if (!(0, import_fs11.existsSync)(wranglerTomlPath) && !(0, import_fs11.existsSync)(wranglerJsonPath) && !(0, import_fs11.existsSync)(wranglerJsoncPath)) {
|
|
83471
83183
|
throw new Error(
|
|
83472
83184
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
83473
83185
|
);
|
|
83474
83186
|
}
|
|
83475
83187
|
}
|
|
83476
|
-
const pkgJsonPath = (0,
|
|
83188
|
+
const pkgJsonPath = (0, import_path12.resolve)(path6, "package.json");
|
|
83477
83189
|
if (!(0, import_fs11.existsSync)(pkgJsonPath)) {
|
|
83478
83190
|
throw new Error(
|
|
83479
83191
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
@@ -83491,10 +83203,10 @@ var inferTemplateConfig = (path6) => {
|
|
|
83491
83203
|
};
|
|
83492
83204
|
var inferCopyFilesDefinition = (path6) => {
|
|
83493
83205
|
const variants = {};
|
|
83494
|
-
if ((0, import_fs11.existsSync)((0,
|
|
83206
|
+
if ((0, import_fs11.existsSync)((0, import_path12.join)(path6, "js"))) {
|
|
83495
83207
|
variants["js"] = { path: "./js" };
|
|
83496
83208
|
}
|
|
83497
|
-
if ((0, import_fs11.existsSync)((0,
|
|
83209
|
+
if ((0, import_fs11.existsSync)((0, import_path12.join)(path6, "ts"))) {
|
|
83498
83210
|
variants["ts"] = { path: "./ts" };
|
|
83499
83211
|
}
|
|
83500
83212
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -83509,7 +83221,7 @@ var downloadRemoteTemplate = async (src, mode) => {
|
|
|
83509
83221
|
force: true,
|
|
83510
83222
|
mode
|
|
83511
83223
|
});
|
|
83512
|
-
const tmpDir = await (0, import_promises4.mkdtemp)((0,
|
|
83224
|
+
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path12.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
83513
83225
|
await emitter.clone(tmpDir);
|
|
83514
83226
|
return tmpDir;
|
|
83515
83227
|
} catch {
|
|
@@ -83518,24 +83230,30 @@ var downloadRemoteTemplate = async (src, mode) => {
|
|
|
83518
83230
|
}
|
|
83519
83231
|
};
|
|
83520
83232
|
function updatePythonPackageName(path6, projectName) {
|
|
83521
|
-
const pyprojectTomlPath = (0,
|
|
83522
|
-
const uvLockPath = (0,
|
|
83233
|
+
const pyprojectTomlPath = (0, import_path12.resolve)(path6, "pyproject.toml");
|
|
83234
|
+
const uvLockPath = (0, import_path12.resolve)(path6, "uv.lock");
|
|
83523
83235
|
if (!(0, import_fs11.existsSync)(pyprojectTomlPath)) {
|
|
83524
83236
|
return;
|
|
83525
83237
|
}
|
|
83526
83238
|
const s = spinner();
|
|
83527
83239
|
s.start("Updating name in `pyproject.toml`");
|
|
83528
83240
|
let pyprojectTomlContents = readFile(pyprojectTomlPath);
|
|
83529
|
-
pyprojectTomlContents = pyprojectTomlContents.replace(
|
|
83241
|
+
pyprojectTomlContents = pyprojectTomlContents.replace(
|
|
83242
|
+
'"TBD"',
|
|
83243
|
+
`"${projectName}"`
|
|
83244
|
+
);
|
|
83530
83245
|
writeFile2(pyprojectTomlPath, pyprojectTomlContents);
|
|
83531
83246
|
let uvLockContents = readFile(uvLockPath);
|
|
83532
|
-
uvLockContents = uvLockContents.replace(
|
|
83247
|
+
uvLockContents = uvLockContents.replace(
|
|
83248
|
+
'"tbd"',
|
|
83249
|
+
`${"projectName.toLowerCase()"}`
|
|
83250
|
+
);
|
|
83533
83251
|
writeFile2(uvLockPath, uvLockContents);
|
|
83534
83252
|
s.stop(`${brandColor("updated")} ${dim("`pyproject.toml`")}`);
|
|
83535
83253
|
}
|
|
83536
83254
|
var updatePackageName = async (ctx) => {
|
|
83537
83255
|
const placeholderNames = ["<TBD>", "TBD", ""];
|
|
83538
|
-
const pkgJsonPath = (0,
|
|
83256
|
+
const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
|
|
83539
83257
|
const pkgJson = readJSON(pkgJsonPath);
|
|
83540
83258
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
83541
83259
|
return;
|
|
@@ -83553,7 +83271,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
83553
83271
|
}
|
|
83554
83272
|
const s = spinner();
|
|
83555
83273
|
s.start("Updating `package.json` scripts");
|
|
83556
|
-
const pkgJsonPath = (0,
|
|
83274
|
+
const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
|
|
83557
83275
|
let pkgJson = readJSON(pkgJsonPath);
|
|
83558
83276
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
83559
83277
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -83562,9 +83280,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
83562
83280
|
};
|
|
83563
83281
|
var getTemplatePath = (ctx) => {
|
|
83564
83282
|
if (ctx.template.path) {
|
|
83565
|
-
return (0,
|
|
83283
|
+
return (0, import_path12.resolve)(__dirname, "..", ctx.template.path);
|
|
83566
83284
|
}
|
|
83567
|
-
return (0,
|
|
83285
|
+
return (0, import_path12.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
83568
83286
|
};
|
|
83569
83287
|
var isVariantInfo = (copyFiles) => {
|
|
83570
83288
|
return "path" in copyFiles;
|
|
@@ -83709,7 +83427,7 @@ var cliDefinition = {
|
|
|
83709
83427
|
requiresArg: true,
|
|
83710
83428
|
description: `The type of framework to use to create a web application (when using this option "--category" is coerced to "web-framework")
|
|
83711
83429
|
|
|
83712
|
-
When using the --framework option, C3 will dispatch to the official creation tool used by the framework (
|
|
83430
|
+
When using the --framework option, C3 will dispatch to the official creation tool used by the framework (e.g. "create-astro" is used for Astro).
|
|
83713
83431
|
|
|
83714
83432
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
83715
83433
|
|
|
@@ -83800,9 +83518,9 @@ var cliDefinition = {
|
|
|
83800
83518
|
type: "string",
|
|
83801
83519
|
requiresArg: true,
|
|
83802
83520
|
description: `The mechanism to use when fetching the template.
|
|
83803
|
-
|
|
83804
|
-
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
83805
|
-
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
83521
|
+
|
|
83522
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
83523
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
83806
83524
|
Otherwise, it will use "git".
|
|
83807
83525
|
`,
|
|
83808
83526
|
values: [
|
|
@@ -84081,7 +83799,7 @@ function secondsSince(start) {
|
|
|
84081
83799
|
|
|
84082
83800
|
// src/wrangler/config.ts
|
|
84083
83801
|
var import_fs12 = require("fs");
|
|
84084
|
-
var
|
|
83802
|
+
var import_path13 = require("path");
|
|
84085
83803
|
var import_toml2 = __toESM(require_toml());
|
|
84086
83804
|
|
|
84087
83805
|
// src/helpers/json.ts
|
|
@@ -84220,13 +83938,13 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
84220
83938
|
}
|
|
84221
83939
|
};
|
|
84222
83940
|
var getWranglerTomlPath = (ctx) => {
|
|
84223
|
-
return (0,
|
|
83941
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.toml");
|
|
84224
83942
|
};
|
|
84225
83943
|
var getWranglerJsonPath = (ctx) => {
|
|
84226
|
-
return (0,
|
|
83944
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.json");
|
|
84227
83945
|
};
|
|
84228
83946
|
var getWranglerJsoncPath = (ctx) => {
|
|
84229
|
-
return (0,
|
|
83947
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
84230
83948
|
};
|
|
84231
83949
|
var wranglerTomlExists = (ctx) => {
|
|
84232
83950
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -84253,13 +83971,13 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
84253
83971
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
84254
83972
|
return writeFile2(wranglerTomlPath, contents);
|
|
84255
83973
|
};
|
|
84256
|
-
var writeWranglerJson = (ctx,
|
|
83974
|
+
var writeWranglerJson = (ctx, config44) => {
|
|
84257
83975
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
84258
83976
|
if ((0, import_fs12.existsSync)(wranglerJsonPath)) {
|
|
84259
|
-
return writeJSONWithComments(wranglerJsonPath,
|
|
83977
|
+
return writeJSONWithComments(wranglerJsonPath, config44);
|
|
84260
83978
|
}
|
|
84261
83979
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
84262
|
-
return writeJSONWithComments(wranglerJsoncPath,
|
|
83980
|
+
return writeJSONWithComments(wranglerJsoncPath, config44);
|
|
84263
83981
|
};
|
|
84264
83982
|
var addVscodeConfig = (ctx) => {
|
|
84265
83983
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
@@ -84273,17 +83991,17 @@ var addVscodeConfig = (ctx) => {
|
|
|
84273
83991
|
}
|
|
84274
83992
|
});
|
|
84275
83993
|
};
|
|
84276
|
-
async function getCompatibilityDate(
|
|
83994
|
+
async function getCompatibilityDate(config44) {
|
|
84277
83995
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}$/m;
|
|
84278
|
-
if (typeof
|
|
84279
|
-
return
|
|
83996
|
+
if (typeof config44["compatibility_date"] === "string" && config44["compatibility_date"].match(validCompatDateRe)) {
|
|
83997
|
+
return config44["compatibility_date"];
|
|
84280
83998
|
}
|
|
84281
83999
|
return await getWorkerdCompatibilityDate();
|
|
84282
84000
|
}
|
|
84283
84001
|
|
|
84284
84002
|
// src/deploy.ts
|
|
84285
84003
|
var offerToDeploy = async (ctx) => {
|
|
84286
|
-
const { npm:
|
|
84004
|
+
const { npm: npm22 } = detectPackageManager();
|
|
84287
84005
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
84288
84006
|
if (!await isDeployable(ctx)) {
|
|
84289
84007
|
ctx.args.deploy = false;
|
|
@@ -84294,7 +84012,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
84294
84012
|
);
|
|
84295
84013
|
}
|
|
84296
84014
|
const label = `deploy via \`${quoteShellArgs([
|
|
84297
|
-
|
|
84015
|
+
npm22,
|
|
84298
84016
|
"run",
|
|
84299
84017
|
ctx.template.deployScript ?? "deploy"
|
|
84300
84018
|
])}\``;
|
|
@@ -84330,11 +84048,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
84330
84048
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
84331
84049
|
};
|
|
84332
84050
|
var runDeploy = async (ctx) => {
|
|
84333
|
-
const { npm:
|
|
84051
|
+
const { npm: npm22, name: pm4 } = detectPackageManager();
|
|
84334
84052
|
if (!ctx.account?.id) {
|
|
84335
84053
|
throw new Error("Failed to read Cloudflare account.");
|
|
84336
84054
|
}
|
|
84337
|
-
const baseDeployCmd = [
|
|
84055
|
+
const baseDeployCmd = [npm22, "run", ctx.template.deployScript ?? "deploy"];
|
|
84338
84056
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
84339
84057
|
const deployCmd = [
|
|
84340
84058
|
...baseDeployCmd,
|
|
@@ -84408,7 +84126,7 @@ var hasBinding = (node) => {
|
|
|
84408
84126
|
};
|
|
84409
84127
|
|
|
84410
84128
|
// src/dialog.ts
|
|
84411
|
-
var
|
|
84129
|
+
var import_path14 = require("path");
|
|
84412
84130
|
function createDialog(lines) {
|
|
84413
84131
|
const screenWidth = process.stdout.columns;
|
|
84414
84132
|
const maxLineWidth = Math.max(
|
|
@@ -84448,16 +84166,16 @@ function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
|
84448
84166
|
}
|
|
84449
84167
|
var printSummary = (ctx) => {
|
|
84450
84168
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
84451
|
-
const relativePath = (0,
|
|
84169
|
+
const relativePath = (0, import_path14.relative)(ctx.originalCWD, ctx.project.path);
|
|
84452
84170
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
84453
|
-
const { npm:
|
|
84171
|
+
const { npm: npm22 } = detectPackageManager();
|
|
84454
84172
|
const devServerCommand = quoteShellArgs([
|
|
84455
|
-
|
|
84173
|
+
npm22,
|
|
84456
84174
|
"run",
|
|
84457
84175
|
ctx.template.devScript ?? "start"
|
|
84458
84176
|
]);
|
|
84459
84177
|
const deployCommand = quoteShellArgs([
|
|
84460
|
-
|
|
84178
|
+
npm22,
|
|
84461
84179
|
"run",
|
|
84462
84180
|
ctx.template.deployScript ?? "deploy"
|
|
84463
84181
|
]);
|
|
@@ -84825,8 +84543,8 @@ var renderValues = (values) => {
|
|
|
84825
84543
|
};
|
|
84826
84544
|
|
|
84827
84545
|
// src/helpers/retry.ts
|
|
84828
|
-
var retry = async (
|
|
84829
|
-
let { times } =
|
|
84546
|
+
var retry = async (config44, fn) => {
|
|
84547
|
+
let { times } = config44;
|
|
84830
84548
|
let error2 = null;
|
|
84831
84549
|
while (times > 0) {
|
|
84832
84550
|
try {
|
|
@@ -84834,10 +84552,10 @@ var retry = async (config47, fn) => {
|
|
|
84834
84552
|
} catch (e) {
|
|
84835
84553
|
error2 = e;
|
|
84836
84554
|
times--;
|
|
84837
|
-
if (
|
|
84555
|
+
if (config44.exitCondition?.(e)) {
|
|
84838
84556
|
break;
|
|
84839
84557
|
}
|
|
84840
|
-
await sleep(
|
|
84558
|
+
await sleep(config44.sleepMs ?? 1e3);
|
|
84841
84559
|
}
|
|
84842
84560
|
}
|
|
84843
84561
|
throw error2;
|
|
@@ -84846,7 +84564,7 @@ var retry = async (config47, fn) => {
|
|
|
84846
84564
|
// src/pages.ts
|
|
84847
84565
|
var CREATE_PROJECT_RETRIES = 3;
|
|
84848
84566
|
var VERIFY_PROJECT_RETRIES = 3;
|
|
84849
|
-
var { npx:
|
|
84567
|
+
var { npx: npx5 } = detectPackageManager();
|
|
84850
84568
|
var createProject = async (ctx) => {
|
|
84851
84569
|
if (ctx.template.platform === "workers") {
|
|
84852
84570
|
return;
|
|
@@ -84859,7 +84577,7 @@ var createProject = async (ctx) => {
|
|
|
84859
84577
|
const compatFlags = ctx.template.compatibilityFlags ?? [];
|
|
84860
84578
|
const productionBranch = await getProductionBranch(ctx.project.path);
|
|
84861
84579
|
const cmd = [
|
|
84862
|
-
|
|
84580
|
+
npx5,
|
|
84863
84581
|
"wrangler",
|
|
84864
84582
|
"pages",
|
|
84865
84583
|
"project",
|
|
@@ -84896,7 +84614,7 @@ var createProject = async (ctx) => {
|
|
|
84896
84614
|
}
|
|
84897
84615
|
try {
|
|
84898
84616
|
const verifyProject = [
|
|
84899
|
-
|
|
84617
|
+
npx5,
|
|
84900
84618
|
"wrangler",
|
|
84901
84619
|
"pages",
|
|
84902
84620
|
"deployment",
|
|
@@ -84925,7 +84643,7 @@ var createProject = async (ctx) => {
|
|
|
84925
84643
|
|
|
84926
84644
|
// src/workers.ts
|
|
84927
84645
|
var import_fs13 = require("fs");
|
|
84928
|
-
var
|
|
84646
|
+
var import_path15 = require("path");
|
|
84929
84647
|
var import_toml4 = __toESM(require_toml());
|
|
84930
84648
|
|
|
84931
84649
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
@@ -86246,17 +85964,17 @@ async function addTypes(ctx) {
|
|
|
86246
85964
|
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
86247
85965
|
return;
|
|
86248
85966
|
}
|
|
86249
|
-
const { npm:
|
|
85967
|
+
const { npm: npm22 } = detectPackageManager();
|
|
86250
85968
|
if (ctx.template.workersTypes === "installed") {
|
|
86251
|
-
await installWorkersTypes(
|
|
85969
|
+
await installWorkersTypes(npm22);
|
|
86252
85970
|
} else if (ctx.template.workersTypes === "generated") {
|
|
86253
|
-
await generateWorkersTypes(ctx,
|
|
85971
|
+
await generateWorkersTypes(ctx, npm22);
|
|
86254
85972
|
}
|
|
86255
|
-
const usesNodeCompat = await maybeInstallNodeTypes(ctx,
|
|
85973
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm22);
|
|
86256
85974
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
86257
85975
|
}
|
|
86258
|
-
async function generateWorkersTypes(ctx,
|
|
86259
|
-
const packageJsonPath = (0,
|
|
85976
|
+
async function generateWorkersTypes(ctx, npm22) {
|
|
85977
|
+
const packageJsonPath = (0, import_path15.join)(ctx.project.path, "package.json");
|
|
86260
85978
|
if (!(0, import_fs13.existsSync)(packageJsonPath)) {
|
|
86261
85979
|
return;
|
|
86262
85980
|
}
|
|
@@ -86264,7 +85982,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
86264
85982
|
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
86265
85983
|
return;
|
|
86266
85984
|
}
|
|
86267
|
-
const typesCmd = [
|
|
85985
|
+
const typesCmd = [npm22, "run", "cf-typegen"];
|
|
86268
85986
|
await runCommand(typesCmd, {
|
|
86269
85987
|
cwd: ctx.project.path,
|
|
86270
85988
|
silent: true,
|
|
@@ -86276,7 +85994,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
86276
85994
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
86277
85995
|
}
|
|
86278
85996
|
}
|
|
86279
|
-
var maybeInstallNodeTypes = async (ctx,
|
|
85997
|
+
var maybeInstallNodeTypes = async (ctx, npm22) => {
|
|
86280
85998
|
let parsedConfig = {};
|
|
86281
85999
|
if (wranglerJsonExists(ctx)) {
|
|
86282
86000
|
parsedConfig = readWranglerJson(ctx);
|
|
@@ -86289,21 +86007,21 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
86289
86007
|
await installPackages(["@types/node"], {
|
|
86290
86008
|
dev: true,
|
|
86291
86009
|
startText: "Installing @types/node",
|
|
86292
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86010
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm22}`)}`
|
|
86293
86011
|
});
|
|
86294
86012
|
return true;
|
|
86295
86013
|
}
|
|
86296
86014
|
return false;
|
|
86297
86015
|
};
|
|
86298
86016
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
86299
|
-
const tsconfigPath = (0,
|
|
86017
|
+
const tsconfigPath = (0, import_path15.join)(ctx.project.path, "tsconfig.json");
|
|
86300
86018
|
if (!(0, import_fs13.existsSync)(tsconfigPath)) {
|
|
86301
86019
|
return;
|
|
86302
86020
|
}
|
|
86303
86021
|
const tsconfig = readFile(tsconfigPath);
|
|
86304
86022
|
try {
|
|
86305
|
-
const
|
|
86306
|
-
const currentTypes =
|
|
86023
|
+
const config44 = parse5(tsconfig);
|
|
86024
|
+
const currentTypes = config44.compilerOptions?.types ?? [];
|
|
86307
86025
|
let newTypes = [...currentTypes];
|
|
86308
86026
|
if (ctx.template.workersTypes === "installed") {
|
|
86309
86027
|
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
@@ -86354,16 +86072,16 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
86354
86072
|
warn("Failed to update `tsconfig.json`.");
|
|
86355
86073
|
}
|
|
86356
86074
|
}
|
|
86357
|
-
async function installWorkersTypes(
|
|
86075
|
+
async function installWorkersTypes(npm22) {
|
|
86358
86076
|
await installPackages(["@cloudflare/workers-types"], {
|
|
86359
86077
|
dev: true,
|
|
86360
86078
|
startText: "Installing @cloudflare/workers-types",
|
|
86361
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86079
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm22}`)}`
|
|
86362
86080
|
});
|
|
86363
86081
|
}
|
|
86364
86082
|
|
|
86365
86083
|
// src/cli.ts
|
|
86366
|
-
var { npm:
|
|
86084
|
+
var { npm: npm21 } = detectPackageManager();
|
|
86367
86085
|
var main = async (argv) => {
|
|
86368
86086
|
const result = await parseArgs(argv);
|
|
86369
86087
|
if (result.type === "unknown") {
|
|
@@ -86399,17 +86117,17 @@ ${result.errorMessage}`);
|
|
|
86399
86117
|
};
|
|
86400
86118
|
var runLatest = async () => {
|
|
86401
86119
|
const args = process.argv.slice(2);
|
|
86402
|
-
if (
|
|
86120
|
+
if (npm21 === "npm") {
|
|
86403
86121
|
args.unshift("--");
|
|
86404
86122
|
}
|
|
86405
|
-
await runCommand([
|
|
86123
|
+
await runCommand([npm21, "create", "cloudflare@latest", ...args]);
|
|
86406
86124
|
};
|
|
86407
86125
|
var runCli = async (args) => {
|
|
86408
86126
|
printBanner(args);
|
|
86409
86127
|
checkMacOSVersion({ shouldThrow: true });
|
|
86410
86128
|
const ctx = await createContext(args);
|
|
86411
86129
|
await create(ctx);
|
|
86412
|
-
await
|
|
86130
|
+
await configure16(ctx);
|
|
86413
86131
|
await deploy(ctx);
|
|
86414
86132
|
printSummary(ctx);
|
|
86415
86133
|
logRaw("");
|
|
@@ -86420,7 +86138,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
86420
86138
|
if (err) {
|
|
86421
86139
|
throw new Error(err);
|
|
86422
86140
|
}
|
|
86423
|
-
const directory = (0,
|
|
86141
|
+
const directory = (0, import_path16.dirname)(path6);
|
|
86424
86142
|
(0, import_fs14.mkdirSync)(directory, { recursive: true });
|
|
86425
86143
|
(0, import_process2.chdir)(directory);
|
|
86426
86144
|
};
|
|
@@ -86437,7 +86155,7 @@ var create = async (ctx) => {
|
|
|
86437
86155
|
await rectifyPmMismatch(ctx);
|
|
86438
86156
|
endSection(`Application created`);
|
|
86439
86157
|
};
|
|
86440
|
-
var
|
|
86158
|
+
var configure16 = async (ctx) => {
|
|
86441
86159
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
86442
86160
|
await installWrangler();
|
|
86443
86161
|
await updateWranglerConfig(ctx);
|