create-cloudflare 2.51.7 → 2.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +497 -761
- package/package.json +5 -5
- 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
|
|
@@ -72714,9 +72714,24 @@ var status = {
|
|
|
72714
72714
|
var space = (n = 1) => {
|
|
72715
72715
|
return hidden("\u200A".repeat(n));
|
|
72716
72716
|
};
|
|
72717
|
+
var LOGGER_LEVELS = {
|
|
72718
|
+
none: -1,
|
|
72719
|
+
error: 0,
|
|
72720
|
+
warn: 1,
|
|
72721
|
+
info: 2,
|
|
72722
|
+
log: 3,
|
|
72723
|
+
debug: 4
|
|
72724
|
+
};
|
|
72725
|
+
var currentLogLevel = "log";
|
|
72726
|
+
function getLogLevel() {
|
|
72727
|
+
return currentLogLevel;
|
|
72728
|
+
}
|
|
72717
72729
|
var logRaw = (msg) => {
|
|
72718
|
-
|
|
72730
|
+
const currentLevel = getLogLevel();
|
|
72731
|
+
if (LOGGER_LEVELS[currentLevel] >= LOGGER_LEVELS.log) {
|
|
72732
|
+
stdout.write(`${msg}
|
|
72719
72733
|
`);
|
|
72734
|
+
}
|
|
72720
72735
|
};
|
|
72721
72736
|
var log = (msg) => {
|
|
72722
72737
|
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)}${ln.length > 0 ? " " + white(ln) : ""}`);
|
|
@@ -72823,7 +72838,8 @@ var crash = (msg, extra) => {
|
|
|
72823
72838
|
(0, import_process.exit)(1);
|
|
72824
72839
|
};
|
|
72825
72840
|
var error = (msg, extra, corner = shapes.corners.bl) => {
|
|
72826
|
-
|
|
72841
|
+
const currentLevel = getLogLevel();
|
|
72842
|
+
if (msg && LOGGER_LEVELS[currentLevel] >= LOGGER_LEVELS.error) {
|
|
72827
72843
|
stderr.write(
|
|
72828
72844
|
`${gray(corner)} ${status.error} ${dim(msg)}
|
|
72829
72845
|
${extra ? space() + extra + "\n" : ""}`
|
|
@@ -74117,33 +74133,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
74117
74133
|
}
|
|
74118
74134
|
return input;
|
|
74119
74135
|
};
|
|
74120
|
-
var renderSubmit = (
|
|
74121
|
-
const { question, label } =
|
|
74122
|
-
if (
|
|
74136
|
+
var renderSubmit = (config44, value) => {
|
|
74137
|
+
const { question, label } = config44;
|
|
74138
|
+
if (config44.type !== "confirm" && !value) {
|
|
74123
74139
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
74124
74140
|
}
|
|
74125
|
-
const content =
|
|
74141
|
+
const content = config44.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
74126
74142
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
74127
74143
|
};
|
|
74128
|
-
var getRenderers = (
|
|
74129
|
-
switch (
|
|
74144
|
+
var getRenderers = (config44) => {
|
|
74145
|
+
switch (config44.type) {
|
|
74130
74146
|
case "select":
|
|
74131
|
-
return getSelectRenderers(
|
|
74147
|
+
return getSelectRenderers(config44);
|
|
74132
74148
|
case "confirm":
|
|
74133
|
-
return getConfirmRenderers(
|
|
74149
|
+
return getConfirmRenderers(config44);
|
|
74134
74150
|
case "text":
|
|
74135
|
-
return getTextRenderers(
|
|
74151
|
+
return getTextRenderers(config44);
|
|
74136
74152
|
case "multiselect":
|
|
74137
|
-
return getSelectRenderers(
|
|
74153
|
+
return getSelectRenderers(config44);
|
|
74138
74154
|
case "list":
|
|
74139
|
-
return getSelectListRenderers(
|
|
74155
|
+
return getSelectListRenderers(config44);
|
|
74140
74156
|
}
|
|
74141
74157
|
};
|
|
74142
|
-
var getTextRenderers = (
|
|
74143
|
-
const { question } =
|
|
74144
|
-
const helpText =
|
|
74145
|
-
const format5 =
|
|
74146
|
-
const defaultValue =
|
|
74158
|
+
var getTextRenderers = (config44) => {
|
|
74159
|
+
const { question } = config44;
|
|
74160
|
+
const helpText = config44.helpText ?? "";
|
|
74161
|
+
const format5 = config44.format ?? ((val) => String(val));
|
|
74162
|
+
const defaultValue = config44.defaultValue?.toString() ?? "";
|
|
74147
74163
|
const activeRenderer = (props) => {
|
|
74148
74164
|
const { valueWithCursor } = props;
|
|
74149
74165
|
return [
|
|
@@ -74169,14 +74185,14 @@ var getTextRenderers = (config47) => {
|
|
|
74169
74185
|
``
|
|
74170
74186
|
// extra line for readability
|
|
74171
74187
|
],
|
|
74172
|
-
submit: ({ value }) => renderSubmit(
|
|
74188
|
+
submit: ({ value }) => renderSubmit(config44, format5(value ?? "")),
|
|
74173
74189
|
cancel: activeRenderer
|
|
74174
74190
|
};
|
|
74175
74191
|
};
|
|
74176
|
-
var getSelectRenderers = (
|
|
74177
|
-
const { options, question, helpText: _helpText } =
|
|
74192
|
+
var getSelectRenderers = (config44) => {
|
|
74193
|
+
const { options, question, helpText: _helpText } = config44;
|
|
74178
74194
|
const helpText = _helpText ?? "";
|
|
74179
|
-
const maxItemsPerPage =
|
|
74195
|
+
const maxItemsPerPage = config44.maxItemsPerPage ?? 32;
|
|
74180
74196
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
74181
74197
|
const renderOption = (opt, i) => {
|
|
74182
74198
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -74251,21 +74267,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
74251
74267
|
submit: ({ value }) => {
|
|
74252
74268
|
if (Array.isArray(value)) {
|
|
74253
74269
|
return renderSubmit(
|
|
74254
|
-
|
|
74270
|
+
config44,
|
|
74255
74271
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
74256
74272
|
);
|
|
74257
74273
|
}
|
|
74258
74274
|
return renderSubmit(
|
|
74259
|
-
|
|
74275
|
+
config44,
|
|
74260
74276
|
options.find((o) => o.value === value)?.label
|
|
74261
74277
|
);
|
|
74262
74278
|
},
|
|
74263
74279
|
cancel: defaultRenderer
|
|
74264
74280
|
};
|
|
74265
74281
|
};
|
|
74266
|
-
var getSelectListRenderers = (
|
|
74267
|
-
const { question, helpText: _helpText } =
|
|
74268
|
-
let options =
|
|
74282
|
+
var getSelectListRenderers = (config44) => {
|
|
74283
|
+
const { question, helpText: _helpText } = config44;
|
|
74284
|
+
let options = config44.options;
|
|
74269
74285
|
const helpText = _helpText ?? "";
|
|
74270
74286
|
const { rows } = stdout;
|
|
74271
74287
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -74346,20 +74362,20 @@ var getSelectListRenderers = (config47) => {
|
|
|
74346
74362
|
submit: ({ value }) => {
|
|
74347
74363
|
if (Array.isArray(value)) {
|
|
74348
74364
|
return renderSubmit(
|
|
74349
|
-
|
|
74365
|
+
config44,
|
|
74350
74366
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
74351
74367
|
);
|
|
74352
74368
|
}
|
|
74353
74369
|
return renderSubmit(
|
|
74354
|
-
|
|
74370
|
+
config44,
|
|
74355
74371
|
options.find((o) => o.value === value)?.value
|
|
74356
74372
|
);
|
|
74357
74373
|
},
|
|
74358
74374
|
cancel: defaultRenderer
|
|
74359
74375
|
};
|
|
74360
74376
|
};
|
|
74361
|
-
var getConfirmRenderers = (
|
|
74362
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
74377
|
+
var getConfirmRenderers = (config44) => {
|
|
74378
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config44;
|
|
74363
74379
|
const helpText = _helpText ?? "";
|
|
74364
74380
|
const active = activeText || "Yes";
|
|
74365
74381
|
const inactive = inactiveText || "No";
|
|
@@ -74376,7 +74392,7 @@ var getConfirmRenderers = (config47) => {
|
|
|
74376
74392
|
active: defaultRenderer,
|
|
74377
74393
|
confirm: defaultRenderer,
|
|
74378
74394
|
error: defaultRenderer,
|
|
74379
|
-
submit: ({ value }) => renderSubmit(
|
|
74395
|
+
submit: ({ value }) => renderSubmit(config44, value ? "yes" : "no"),
|
|
74380
74396
|
cancel: defaultRenderer
|
|
74381
74397
|
};
|
|
74382
74398
|
};
|
|
@@ -75344,23 +75360,23 @@ var YargsParser = class {
|
|
|
75344
75360
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
75345
75361
|
if (configPath) {
|
|
75346
75362
|
try {
|
|
75347
|
-
let
|
|
75363
|
+
let config44 = null;
|
|
75348
75364
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
75349
75365
|
const resolveConfig = flags.configs[configKey];
|
|
75350
75366
|
if (typeof resolveConfig === "function") {
|
|
75351
75367
|
try {
|
|
75352
|
-
|
|
75368
|
+
config44 = resolveConfig(resolvedConfigPath);
|
|
75353
75369
|
} catch (e) {
|
|
75354
|
-
|
|
75370
|
+
config44 = e;
|
|
75355
75371
|
}
|
|
75356
|
-
if (
|
|
75357
|
-
error2 =
|
|
75372
|
+
if (config44 instanceof Error) {
|
|
75373
|
+
error2 = config44;
|
|
75358
75374
|
return;
|
|
75359
75375
|
}
|
|
75360
75376
|
} else {
|
|
75361
|
-
|
|
75377
|
+
config44 = mixin2.require(resolvedConfigPath);
|
|
75362
75378
|
}
|
|
75363
|
-
setConfigObject(
|
|
75379
|
+
setConfigObject(config44);
|
|
75364
75380
|
} catch (ex) {
|
|
75365
75381
|
if (ex.name === "PermissionDenied")
|
|
75366
75382
|
error2 = ex;
|
|
@@ -75370,9 +75386,9 @@ var YargsParser = class {
|
|
|
75370
75386
|
}
|
|
75371
75387
|
});
|
|
75372
75388
|
}
|
|
75373
|
-
function setConfigObject(
|
|
75374
|
-
Object.keys(
|
|
75375
|
-
const value =
|
|
75389
|
+
function setConfigObject(config44, prev) {
|
|
75390
|
+
Object.keys(config44).forEach(function(key) {
|
|
75391
|
+
const value = config44[key];
|
|
75376
75392
|
const fullKey = prev ? prev + "." + key : key;
|
|
75377
75393
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
75378
75394
|
setConfigObject(value, fullKey);
|
|
@@ -76524,11 +76540,11 @@ var CommandInstance = class {
|
|
|
76524
76540
|
});
|
|
76525
76541
|
if (!unparsed.length)
|
|
76526
76542
|
return;
|
|
76527
|
-
const
|
|
76543
|
+
const config44 = Object.assign({}, options.configuration, {
|
|
76528
76544
|
"populate--": false
|
|
76529
76545
|
});
|
|
76530
76546
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
76531
|
-
configuration:
|
|
76547
|
+
configuration: config44
|
|
76532
76548
|
}));
|
|
76533
76549
|
if (parsed.error) {
|
|
76534
76550
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -77751,31 +77767,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
77751
77767
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
77752
77768
|
var previouslyVisitedConfigs = [];
|
|
77753
77769
|
var shim2;
|
|
77754
|
-
function applyExtends(
|
|
77770
|
+
function applyExtends(config44, cwd, mergeExtends, _shim) {
|
|
77755
77771
|
shim2 = _shim;
|
|
77756
77772
|
let defaultConfig = {};
|
|
77757
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
77758
|
-
if (typeof
|
|
77773
|
+
if (Object.prototype.hasOwnProperty.call(config44, "extends")) {
|
|
77774
|
+
if (typeof config44.extends !== "string")
|
|
77759
77775
|
return defaultConfig;
|
|
77760
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
77776
|
+
const isPath = /\.json|\..*rc$/.test(config44.extends);
|
|
77761
77777
|
let pathToDefault = null;
|
|
77762
77778
|
if (!isPath) {
|
|
77763
77779
|
try {
|
|
77764
|
-
pathToDefault = require.resolve(
|
|
77780
|
+
pathToDefault = require.resolve(config44.extends);
|
|
77765
77781
|
} catch (_err) {
|
|
77766
|
-
return
|
|
77782
|
+
return config44;
|
|
77767
77783
|
}
|
|
77768
77784
|
} else {
|
|
77769
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
77785
|
+
pathToDefault = getPathToDefaultConfig(cwd, config44.extends);
|
|
77770
77786
|
}
|
|
77771
77787
|
checkForCircularExtends(pathToDefault);
|
|
77772
77788
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
77773
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
77774
|
-
delete
|
|
77789
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config44.extends);
|
|
77790
|
+
delete config44.extends;
|
|
77775
77791
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
77776
77792
|
}
|
|
77777
77793
|
previouslyVisitedConfigs = [];
|
|
77778
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
77794
|
+
return mergeExtends ? mergeDeep(defaultConfig, config44) : Object.assign({}, defaultConfig, config44);
|
|
77779
77795
|
}
|
|
77780
77796
|
function checkForCircularExtends(cfgPath) {
|
|
77781
77797
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -78551,9 +78567,9 @@ var YargsInstance = class {
|
|
|
78551
78567
|
}
|
|
78552
78568
|
return maybePromise;
|
|
78553
78569
|
}
|
|
78554
|
-
parserConfiguration(
|
|
78555
|
-
argsert("<object>", [
|
|
78556
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
78570
|
+
parserConfiguration(config44) {
|
|
78571
|
+
argsert("<object>", [config44], arguments.length);
|
|
78572
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config44, "f");
|
|
78557
78573
|
return this;
|
|
78558
78574
|
}
|
|
78559
78575
|
pkgConf(key, rootPath) {
|
|
@@ -78725,9 +78741,9 @@ var YargsInstance = class {
|
|
|
78725
78741
|
return this;
|
|
78726
78742
|
}
|
|
78727
78743
|
}
|
|
78728
|
-
usageConfiguration(
|
|
78729
|
-
argsert("<object>", [
|
|
78730
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
78744
|
+
usageConfiguration(config44) {
|
|
78745
|
+
argsert("<object>", [config44], arguments.length);
|
|
78746
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config44, "f");
|
|
78731
78747
|
return this;
|
|
78732
78748
|
}
|
|
78733
78749
|
version(opt, msg, ver) {
|
|
@@ -79133,11 +79149,11 @@ var YargsInstance = class {
|
|
|
79133
79149
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
79134
79150
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
79135
79151
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
79136
|
-
const
|
|
79152
|
+
const config44 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
79137
79153
|
"populate--": true
|
|
79138
79154
|
});
|
|
79139
79155
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
79140
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
79156
|
+
configuration: { "parse-positional-numbers": false, ...config44 }
|
|
79141
79157
|
}));
|
|
79142
79158
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
79143
79159
|
let argvPromise = void 0;
|
|
@@ -79300,7 +79316,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
79300
79316
|
var yargs_default = Yargs;
|
|
79301
79317
|
|
|
79302
79318
|
// package.json
|
|
79303
|
-
var version = "2.
|
|
79319
|
+
var version = "2.52.1";
|
|
79304
79320
|
|
|
79305
79321
|
// src/metrics.ts
|
|
79306
79322
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -79344,12 +79360,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
79344
79360
|
}
|
|
79345
79361
|
|
|
79346
79362
|
// src/helpers/metrics-config.ts
|
|
79347
|
-
function writeMetricsConfig(
|
|
79363
|
+
function writeMetricsConfig(config44) {
|
|
79348
79364
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
79349
79365
|
(0, import_node_fs2.writeFileSync)(
|
|
79350
79366
|
getMetricsConfigPath(),
|
|
79351
79367
|
JSON.stringify(
|
|
79352
|
-
|
|
79368
|
+
config44,
|
|
79353
79369
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
79354
79370
|
" "
|
|
79355
79371
|
)
|
|
@@ -79357,9 +79373,9 @@ function writeMetricsConfig(config47) {
|
|
|
79357
79373
|
}
|
|
79358
79374
|
function readMetricsConfig() {
|
|
79359
79375
|
try {
|
|
79360
|
-
const
|
|
79376
|
+
const config44 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
79361
79377
|
return JSON.parse(
|
|
79362
|
-
|
|
79378
|
+
config44,
|
|
79363
79379
|
(key, value) => key === "date" ? new Date(value) : value
|
|
79364
79380
|
);
|
|
79365
79381
|
} catch {
|
|
@@ -79369,10 +79385,10 @@ function readMetricsConfig() {
|
|
|
79369
79385
|
function getMetricsConfigPath() {
|
|
79370
79386
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
79371
79387
|
}
|
|
79372
|
-
function getDeviceId(
|
|
79373
|
-
const deviceId =
|
|
79374
|
-
if (
|
|
79375
|
-
writeMetricsConfig({ ...
|
|
79388
|
+
function getDeviceId(config44) {
|
|
79389
|
+
const deviceId = config44.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
79390
|
+
if (config44.deviceId === void 0) {
|
|
79391
|
+
writeMetricsConfig({ ...config44, deviceId });
|
|
79376
79392
|
}
|
|
79377
79393
|
return deviceId;
|
|
79378
79394
|
}
|
|
@@ -79585,7 +79601,7 @@ var detectPackageManager = () => {
|
|
|
79585
79601
|
}
|
|
79586
79602
|
};
|
|
79587
79603
|
var rectifyPmMismatch = async (ctx) => {
|
|
79588
|
-
const { npm:
|
|
79604
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79589
79605
|
if (!detectPmMismatch(ctx)) {
|
|
79590
79606
|
return;
|
|
79591
79607
|
}
|
|
@@ -79597,17 +79613,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
79597
79613
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
79598
79614
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
79599
79615
|
}
|
|
79600
|
-
await runCommand([
|
|
79616
|
+
await runCommand([npm22, "install"], {
|
|
79601
79617
|
silent: true,
|
|
79602
79618
|
cwd: ctx.project.path,
|
|
79603
79619
|
startText: "Installing dependencies",
|
|
79604
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
79620
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm22} install\``)}`
|
|
79605
79621
|
});
|
|
79606
79622
|
};
|
|
79607
79623
|
var detectPmMismatch = (ctx) => {
|
|
79608
|
-
const { npm:
|
|
79624
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79609
79625
|
const projectPath = ctx.project.path;
|
|
79610
|
-
switch (
|
|
79626
|
+
switch (npm22) {
|
|
79611
79627
|
case "npm":
|
|
79612
79628
|
return false;
|
|
79613
79629
|
case "yarn":
|
|
@@ -79675,10 +79691,10 @@ function getPlatform() {
|
|
|
79675
79691
|
function createReporter() {
|
|
79676
79692
|
const events = [];
|
|
79677
79693
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
79678
|
-
const
|
|
79679
|
-
const isFirstUsage =
|
|
79694
|
+
const config44 = readMetricsConfig() ?? {};
|
|
79695
|
+
const isFirstUsage = config44.c3permission === void 0;
|
|
79680
79696
|
const isEnabled = isTelemetryEnabled();
|
|
79681
|
-
const deviceId = getDeviceId(
|
|
79697
|
+
const deviceId = getDeviceId(config44);
|
|
79682
79698
|
const packageManager = detectPackageManager();
|
|
79683
79699
|
const platform = getPlatform();
|
|
79684
79700
|
const amplitude_session_id = Date.now();
|
|
@@ -79711,7 +79727,7 @@ function createReporter() {
|
|
|
79711
79727
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
79712
79728
|
return false;
|
|
79713
79729
|
}
|
|
79714
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
79730
|
+
return hasSparrowSourceKey() && getC3Permission(config44).enabled;
|
|
79715
79731
|
}
|
|
79716
79732
|
async function waitForAllEventsSettled() {
|
|
79717
79733
|
await Promise.allSettled(events);
|
|
@@ -79817,20 +79833,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
79817
79833
|
date: /* @__PURE__ */ new Date()
|
|
79818
79834
|
};
|
|
79819
79835
|
}
|
|
79820
|
-
function getC3Permission(
|
|
79821
|
-
if (!
|
|
79822
|
-
|
|
79823
|
-
writeMetricsConfig(
|
|
79836
|
+
function getC3Permission(config44 = readMetricsConfig() ?? {}) {
|
|
79837
|
+
if (!config44.c3permission) {
|
|
79838
|
+
config44.c3permission = initializeC3Permission();
|
|
79839
|
+
writeMetricsConfig(config44);
|
|
79824
79840
|
}
|
|
79825
|
-
return
|
|
79841
|
+
return config44.c3permission;
|
|
79826
79842
|
}
|
|
79827
79843
|
function updateC3Pemission(enabled) {
|
|
79828
|
-
const
|
|
79829
|
-
if (
|
|
79844
|
+
const config44 = readMetricsConfig();
|
|
79845
|
+
if (config44.c3permission?.enabled === enabled) {
|
|
79830
79846
|
return;
|
|
79831
79847
|
}
|
|
79832
|
-
|
|
79833
|
-
writeMetricsConfig(
|
|
79848
|
+
config44.c3permission = initializeC3Permission(enabled);
|
|
79849
|
+
writeMetricsConfig(config44);
|
|
79834
79850
|
}
|
|
79835
79851
|
var runTelemetryCommand = (action) => {
|
|
79836
79852
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -79864,7 +79880,7 @@ var runTelemetryCommand = (action) => {
|
|
|
79864
79880
|
var import_fs11 = require("fs");
|
|
79865
79881
|
var import_promises4 = require("fs/promises");
|
|
79866
79882
|
var import_os2 = require("os");
|
|
79867
|
-
var
|
|
79883
|
+
var import_path12 = require("path");
|
|
79868
79884
|
var import_deepmerge = __toESM(require_cjs());
|
|
79869
79885
|
var import_degit = __toESM(require_dist());
|
|
79870
79886
|
|
|
@@ -79882,13 +79898,6 @@ var import_fs6 = __toESM(require("fs"));
|
|
|
79882
79898
|
var import_path6 = require("path");
|
|
79883
79899
|
var import_toml = __toESM(require_toml());
|
|
79884
79900
|
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
79901
|
var writeFile2 = (path6, content) => {
|
|
79893
79902
|
try {
|
|
79894
79903
|
import_fs6.default.writeFileSync(path6, content);
|
|
@@ -79935,94 +79944,57 @@ var readJSON = (path6) => {
|
|
|
79935
79944
|
var writeJSON = (path6, object, stringifySpace = " ") => {
|
|
79936
79945
|
writeFile2(path6, (0, import_comment_json.stringify)(object, null, stringifySpace));
|
|
79937
79946
|
};
|
|
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
79947
|
var usesTypescript = (ctx) => {
|
|
79947
79948
|
return hasTsConfig(ctx.project.path);
|
|
79948
79949
|
};
|
|
79949
79950
|
var hasTsConfig = (path6) => {
|
|
79950
79951
|
return (0, import_fs6.existsSync)((0, import_path6.join)(`${path6}`, `tsconfig.json`));
|
|
79951
79952
|
};
|
|
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
79953
|
|
|
79982
79954
|
// src/helpers/packages.ts
|
|
79983
|
-
var installPackages = async (packages,
|
|
79955
|
+
var installPackages = async (packages, config44 = {}) => {
|
|
79984
79956
|
if (packages.length === 0) {
|
|
79985
79957
|
return;
|
|
79986
79958
|
}
|
|
79987
|
-
const { npm:
|
|
79959
|
+
const { npm: npm22 } = detectPackageManager();
|
|
79988
79960
|
let saveFlag;
|
|
79989
79961
|
let cmd;
|
|
79990
|
-
switch (
|
|
79962
|
+
switch (npm22) {
|
|
79991
79963
|
case "yarn":
|
|
79992
79964
|
cmd = "add";
|
|
79993
|
-
saveFlag =
|
|
79965
|
+
saveFlag = config44.dev ? "-D" : "";
|
|
79994
79966
|
break;
|
|
79995
79967
|
case "bun":
|
|
79996
79968
|
cmd = "add";
|
|
79997
|
-
saveFlag =
|
|
79969
|
+
saveFlag = config44.dev ? "-d" : "";
|
|
79998
79970
|
break;
|
|
79999
79971
|
case "npm":
|
|
80000
79972
|
case "pnpm":
|
|
80001
79973
|
default:
|
|
80002
79974
|
cmd = "install";
|
|
80003
|
-
saveFlag =
|
|
79975
|
+
saveFlag = config44.dev ? "--save-dev" : "";
|
|
80004
79976
|
break;
|
|
80005
79977
|
}
|
|
80006
79978
|
await runCommand(
|
|
80007
79979
|
[
|
|
80008
|
-
|
|
79980
|
+
npm22,
|
|
80009
79981
|
cmd,
|
|
80010
79982
|
...saveFlag ? [saveFlag] : [],
|
|
80011
79983
|
...packages,
|
|
80012
79984
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
80013
79985
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
80014
79986
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
80015
|
-
...
|
|
79987
|
+
...npm22 === "npm" ? ["--legacy-peer-deps"] : []
|
|
80016
79988
|
],
|
|
80017
79989
|
{
|
|
80018
|
-
...
|
|
79990
|
+
...config44,
|
|
80019
79991
|
silent: true
|
|
80020
79992
|
}
|
|
80021
79993
|
);
|
|
80022
|
-
if (
|
|
79994
|
+
if (npm22 === "npm") {
|
|
80023
79995
|
const pkgJsonPath = import_path7.default.join(process.cwd(), "package.json");
|
|
80024
79996
|
const pkgJson = readJSON(pkgJsonPath);
|
|
80025
|
-
const deps =
|
|
79997
|
+
const deps = config44.dev ? pkgJson.devDependencies : pkgJson.dependencies;
|
|
80026
79998
|
(0, import_assert2.default)(deps, "dependencies should be defined");
|
|
80027
79999
|
for (const pkg of packages) {
|
|
80028
80000
|
const versionMarker = pkg.lastIndexOf("@");
|
|
@@ -80042,16 +80014,16 @@ var npmInstall = async (ctx) => {
|
|
|
80042
80014
|
if ((0, import_fs7.existsSync)(nodeModulesPath)) {
|
|
80043
80015
|
return;
|
|
80044
80016
|
}
|
|
80045
|
-
const { npm:
|
|
80017
|
+
const { npm: npm22 } = detectPackageManager();
|
|
80046
80018
|
await runCommand(
|
|
80047
80019
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
80048
80020
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
80049
80021
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
80050
|
-
[
|
|
80022
|
+
[npm22, "install", ...npm22 === "npm" ? ["--legacy-peer-deps"] : []],
|
|
80051
80023
|
{
|
|
80052
80024
|
silent: true,
|
|
80053
80025
|
startText: "Installing dependencies",
|
|
80054
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
80026
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm22} install\``)}`
|
|
80055
80027
|
}
|
|
80056
80028
|
);
|
|
80057
80029
|
};
|
|
@@ -80061,14 +80033,14 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
80061
80033
|
return npmInfo["dist-tags"].latest;
|
|
80062
80034
|
}
|
|
80063
80035
|
var installWrangler = async () => {
|
|
80064
|
-
const { npm:
|
|
80036
|
+
const { npm: npm22 } = detectPackageManager();
|
|
80065
80037
|
await installPackages([`wrangler@latest`], {
|
|
80066
80038
|
dev: true,
|
|
80067
80039
|
startText: `Installing wrangler ${dim(
|
|
80068
80040
|
"A command line tool for building Cloudflare Workers"
|
|
80069
80041
|
)}`,
|
|
80070
80042
|
doneText: `${brandColor("installed")} ${dim(
|
|
80071
|
-
`via \`${
|
|
80043
|
+
`via \`${npm22} install wrangler --save-dev\``
|
|
80072
80044
|
)}`
|
|
80073
80045
|
});
|
|
80074
80046
|
};
|
|
@@ -80128,18 +80100,18 @@ var package_default = {
|
|
|
80128
80100
|
dependencies: {
|
|
80129
80101
|
"create-astro": "4.13.1",
|
|
80130
80102
|
"create-analog": "1.8.1",
|
|
80131
|
-
"@angular/create": "20.3.
|
|
80132
|
-
"create-docusaurus": "3.
|
|
80103
|
+
"@angular/create": "20.3.3",
|
|
80104
|
+
"create-docusaurus": "3.9.1",
|
|
80133
80105
|
"create-hono": "0.19.2",
|
|
80134
80106
|
"create-next-app": "15.4.6",
|
|
80135
|
-
"create-qwik": "1.16.
|
|
80107
|
+
"create-qwik": "1.16.1",
|
|
80136
80108
|
"create-vite": "7.1.1",
|
|
80137
|
-
"create-
|
|
80138
|
-
"create-react-router": "7.8.2",
|
|
80109
|
+
"create-react-router": "7.9.3",
|
|
80139
80110
|
"create-solid": "0.6.7",
|
|
80140
80111
|
"create-vue": "3.18.0",
|
|
80112
|
+
"create-waku": "0.12.5-0.26.1-0",
|
|
80141
80113
|
gatsby: "5.15.0",
|
|
80142
|
-
sv: "0.9.
|
|
80114
|
+
sv: "0.9.6",
|
|
80143
80115
|
nuxi: "3.28.0"
|
|
80144
80116
|
}
|
|
80145
80117
|
};
|
|
@@ -80155,9 +80127,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
80155
80127
|
};
|
|
80156
80128
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
80157
80129
|
const cli = getFrameworkCli(ctx, true);
|
|
80158
|
-
const { npm:
|
|
80159
|
-
const cmd = [...
|
|
80160
|
-
const env3 =
|
|
80130
|
+
const { npm: npm22, dlx } = detectPackageManager();
|
|
80131
|
+
const cmd = [...npm22 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
80132
|
+
const env3 = npm22 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
80161
80133
|
if (ctx.args.additionalArgs?.length) {
|
|
80162
80134
|
cmd.push(...ctx.args.additionalArgs);
|
|
80163
80135
|
}
|
|
@@ -81087,183 +81059,19 @@ var config21 = {
|
|
|
81087
81059
|
};
|
|
81088
81060
|
var c3_default23 = config21;
|
|
81089
81061
|
|
|
81090
|
-
// templates/next/
|
|
81091
|
-
var import_path9 = require("path");
|
|
81092
|
-
var { npm: npm8, npx: npx3 } = detectPackageManager();
|
|
81062
|
+
// templates/next/c3.ts
|
|
81093
81063
|
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
81064
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
81257
81065
|
};
|
|
81258
|
-
var
|
|
81066
|
+
var configure6 = async (ctx) => {
|
|
81259
81067
|
await installPackages(["@opennextjs/cloudflare@^1.3.0"], {
|
|
81260
81068
|
startText: "Adding the Cloudflare adapter",
|
|
81261
81069
|
doneText: `${brandColor(`installed`)} @opennextjs/cloudflare)}`
|
|
81262
81070
|
});
|
|
81263
81071
|
const usesTs = usesTypescript(ctx);
|
|
81264
|
-
|
|
81072
|
+
updateNextConfig(usesTs);
|
|
81265
81073
|
};
|
|
81266
|
-
var
|
|
81074
|
+
var updateNextConfig = (usesTs) => {
|
|
81267
81075
|
const s = spinner();
|
|
81268
81076
|
const configFile = `next.config.${usesTs ? "ts" : "mjs"}`;
|
|
81269
81077
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -81276,58 +81084,50 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
81276
81084
|
writeFile2(configFile, updatedConfigFile);
|
|
81277
81085
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81278
81086
|
};
|
|
81279
|
-
var
|
|
81280
|
-
var
|
|
81281
|
-
var
|
|
81087
|
+
var envInterfaceName3 = "CloudflareEnv";
|
|
81088
|
+
var typesPath = "./cloudflare-env.d.ts";
|
|
81089
|
+
var c3_default24 = {
|
|
81282
81090
|
configVersion: 1,
|
|
81283
81091
|
id: "next",
|
|
81284
81092
|
frameworkCli: "create-next-app",
|
|
81285
81093
|
platform: "workers",
|
|
81286
81094
|
displayName: "Next.js",
|
|
81287
|
-
path: "templates/next/workers",
|
|
81288
81095
|
copyFiles: {
|
|
81289
81096
|
path: "./templates"
|
|
81290
81097
|
},
|
|
81291
|
-
generate:
|
|
81292
|
-
configure:
|
|
81098
|
+
generate: generate12,
|
|
81099
|
+
configure: configure6,
|
|
81293
81100
|
transformPackageJson: async () => ({
|
|
81294
81101
|
scripts: {
|
|
81295
81102
|
deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
|
|
81296
81103
|
preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
|
|
81297
|
-
"cf-typegen": `wrangler types --env-interface ${
|
|
81104
|
+
"cf-typegen": `wrangler types --env-interface ${envInterfaceName3} ${typesPath}`
|
|
81298
81105
|
}
|
|
81299
81106
|
}),
|
|
81300
81107
|
devScript: "dev",
|
|
81301
81108
|
previewScript: "preview",
|
|
81302
81109
|
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 }
|
|
81110
|
+
typesPath,
|
|
81111
|
+
envInterfaceName: envInterfaceName3
|
|
81311
81112
|
};
|
|
81312
|
-
var c3_default26 = config22;
|
|
81313
81113
|
|
|
81314
81114
|
// templates/nuxt/pages/c3.ts
|
|
81315
81115
|
var recast5 = __toESM(require_main2());
|
|
81316
|
-
var { npm:
|
|
81317
|
-
var
|
|
81116
|
+
var { npm: npm8, name: pm2 } = detectPackageManager();
|
|
81117
|
+
var generate13 = async (ctx) => {
|
|
81318
81118
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
81319
81119
|
await runFrameworkGenerator(ctx, [
|
|
81320
81120
|
"init",
|
|
81321
81121
|
ctx.project.name,
|
|
81322
81122
|
"--packageManager",
|
|
81323
|
-
|
|
81123
|
+
npm8,
|
|
81324
81124
|
"--no-install",
|
|
81325
81125
|
gitFlag
|
|
81326
81126
|
]);
|
|
81327
81127
|
writeFile2("./.node-version", "18");
|
|
81328
81128
|
logRaw("");
|
|
81329
81129
|
};
|
|
81330
|
-
var
|
|
81130
|
+
var configure7 = async () => {
|
|
81331
81131
|
const packages = ["nitro-cloudflare-dev"];
|
|
81332
81132
|
if (pm2 === "pnpm") {
|
|
81333
81133
|
packages.push("h3");
|
|
@@ -81335,7 +81135,7 @@ var configure8 = async () => {
|
|
|
81335
81135
|
await installPackages(packages, {
|
|
81336
81136
|
dev: true,
|
|
81337
81137
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
81338
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
81138
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm8} install\``)}`
|
|
81339
81139
|
});
|
|
81340
81140
|
updateNuxtConfig();
|
|
81341
81141
|
};
|
|
@@ -81381,7 +81181,7 @@ var updateNuxtConfig = () => {
|
|
|
81381
81181
|
});
|
|
81382
81182
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81383
81183
|
};
|
|
81384
|
-
var
|
|
81184
|
+
var config22 = {
|
|
81385
81185
|
configVersion: 1,
|
|
81386
81186
|
id: "nuxt",
|
|
81387
81187
|
frameworkCli: "nuxi",
|
|
@@ -81392,12 +81192,12 @@ var config23 = {
|
|
|
81392
81192
|
path: "./templates"
|
|
81393
81193
|
},
|
|
81394
81194
|
path: "templates/nuxt/pages",
|
|
81395
|
-
generate:
|
|
81396
|
-
configure:
|
|
81195
|
+
generate: generate13,
|
|
81196
|
+
configure: configure7,
|
|
81397
81197
|
transformPackageJson: async () => ({
|
|
81398
81198
|
scripts: {
|
|
81399
|
-
deploy: `${
|
|
81400
|
-
preview: `${
|
|
81199
|
+
deploy: `${npm8} run build && wrangler pages deploy`,
|
|
81200
|
+
preview: `${npm8} run build && wrangler pages dev`,
|
|
81401
81201
|
"cf-typegen": `wrangler types`
|
|
81402
81202
|
}
|
|
81403
81203
|
}),
|
|
@@ -81405,25 +81205,25 @@ var config23 = {
|
|
|
81405
81205
|
deployScript: "deploy",
|
|
81406
81206
|
previewScript: "preview"
|
|
81407
81207
|
};
|
|
81408
|
-
var
|
|
81208
|
+
var c3_default25 = config22;
|
|
81409
81209
|
|
|
81410
81210
|
// templates/nuxt/workers/c3.ts
|
|
81411
81211
|
var recast6 = __toESM(require_main2());
|
|
81412
|
-
var { npm:
|
|
81413
|
-
var
|
|
81212
|
+
var { npm: npm9, name: pm3 } = detectPackageManager();
|
|
81213
|
+
var generate14 = async (ctx) => {
|
|
81414
81214
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
81415
81215
|
await runFrameworkGenerator(ctx, [
|
|
81416
81216
|
"init",
|
|
81417
81217
|
ctx.project.name,
|
|
81418
81218
|
"--packageManager",
|
|
81419
|
-
|
|
81219
|
+
npm9,
|
|
81420
81220
|
"--no-install",
|
|
81421
81221
|
gitFlag
|
|
81422
81222
|
]);
|
|
81423
81223
|
writeFile2("./.node-version", "18");
|
|
81424
81224
|
logRaw("");
|
|
81425
81225
|
};
|
|
81426
|
-
var
|
|
81226
|
+
var configure8 = async () => {
|
|
81427
81227
|
const packages = ["nitro-cloudflare-dev", "nitropack"];
|
|
81428
81228
|
if (pm3 === "pnpm") {
|
|
81429
81229
|
packages.push("h3");
|
|
@@ -81431,7 +81231,7 @@ var configure9 = async () => {
|
|
|
81431
81231
|
await installPackages(packages, {
|
|
81432
81232
|
dev: true,
|
|
81433
81233
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
81434
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
81234
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
|
|
81435
81235
|
});
|
|
81436
81236
|
updateNuxtConfig2();
|
|
81437
81237
|
};
|
|
@@ -81477,7 +81277,7 @@ var updateNuxtConfig2 = () => {
|
|
|
81477
81277
|
});
|
|
81478
81278
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
81479
81279
|
};
|
|
81480
|
-
var
|
|
81280
|
+
var config23 = {
|
|
81481
81281
|
configVersion: 1,
|
|
81482
81282
|
id: "nuxt",
|
|
81483
81283
|
frameworkCli: "nuxi",
|
|
@@ -81487,12 +81287,12 @@ var config24 = {
|
|
|
81487
81287
|
path: "./templates"
|
|
81488
81288
|
},
|
|
81489
81289
|
path: "templates/nuxt/workers",
|
|
81490
|
-
generate:
|
|
81491
|
-
configure:
|
|
81290
|
+
generate: generate14,
|
|
81291
|
+
configure: configure8,
|
|
81492
81292
|
transformPackageJson: async () => ({
|
|
81493
81293
|
scripts: {
|
|
81494
|
-
deploy: `${
|
|
81495
|
-
preview: `${
|
|
81294
|
+
deploy: `${npm9} run build && wrangler deploy`,
|
|
81295
|
+
preview: `${npm9} run build && wrangler dev`,
|
|
81496
81296
|
"cf-typegen": `wrangler types`
|
|
81497
81297
|
}
|
|
81498
81298
|
}),
|
|
@@ -81500,17 +81300,17 @@ var config24 = {
|
|
|
81500
81300
|
deployScript: "deploy",
|
|
81501
81301
|
previewScript: "preview"
|
|
81502
81302
|
};
|
|
81503
|
-
var
|
|
81303
|
+
var c3_default26 = config23;
|
|
81504
81304
|
|
|
81505
81305
|
// templates/nuxt/c3.ts
|
|
81506
|
-
var
|
|
81306
|
+
var config24 = {
|
|
81507
81307
|
displayName: "Nuxt",
|
|
81508
|
-
platformVariants: { pages:
|
|
81308
|
+
platformVariants: { pages: c3_default25, workers: c3_default26 }
|
|
81509
81309
|
};
|
|
81510
|
-
var
|
|
81310
|
+
var c3_default27 = config24;
|
|
81511
81311
|
|
|
81512
81312
|
// templates/openapi/c3.ts
|
|
81513
|
-
var
|
|
81313
|
+
var config25 = {
|
|
81514
81314
|
configVersion: 1,
|
|
81515
81315
|
id: "openapi",
|
|
81516
81316
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -81520,12 +81320,12 @@ var config26 = {
|
|
|
81520
81320
|
path: "./ts"
|
|
81521
81321
|
}
|
|
81522
81322
|
};
|
|
81523
|
-
var
|
|
81323
|
+
var c3_default28 = config25;
|
|
81524
81324
|
|
|
81525
81325
|
// templates/pre-existing/c3.ts
|
|
81526
81326
|
var import_promises3 = require("fs/promises");
|
|
81527
81327
|
var import_os = require("os");
|
|
81528
|
-
var
|
|
81328
|
+
var import_path9 = require("path");
|
|
81529
81329
|
|
|
81530
81330
|
// src/wrangler/accounts.ts
|
|
81531
81331
|
var chooseAccount = async (ctx) => {
|
|
@@ -81572,7 +81372,7 @@ var wranglerLogin = async (ctx) => {
|
|
|
81572
81372
|
args: ctx.args
|
|
81573
81373
|
},
|
|
81574
81374
|
async promise() {
|
|
81575
|
-
const { npx:
|
|
81375
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81576
81376
|
const s = spinner();
|
|
81577
81377
|
s.start(
|
|
81578
81378
|
`Logging into Cloudflare ${dim("checking authentication status")}`
|
|
@@ -81586,7 +81386,7 @@ var wranglerLogin = async (ctx) => {
|
|
|
81586
81386
|
s.start(
|
|
81587
81387
|
`Logging into Cloudflare ${dim("This will open a browser window")}`
|
|
81588
81388
|
);
|
|
81589
|
-
const output = await runCommand([
|
|
81389
|
+
const output = await runCommand([npx6, "wrangler", "login"], {
|
|
81590
81390
|
silent: true
|
|
81591
81391
|
});
|
|
81592
81392
|
const success = /Successfully logged in/.test(output);
|
|
@@ -81598,8 +81398,8 @@ var wranglerLogin = async (ctx) => {
|
|
|
81598
81398
|
});
|
|
81599
81399
|
};
|
|
81600
81400
|
var listAccounts = async () => {
|
|
81601
|
-
const { npx:
|
|
81602
|
-
const output = await runCommand([
|
|
81401
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81402
|
+
const output = await runCommand([npx6, "wrangler", "whoami"], {
|
|
81603
81403
|
silent: true
|
|
81604
81404
|
});
|
|
81605
81405
|
const accounts = {};
|
|
@@ -81612,9 +81412,9 @@ var listAccounts = async () => {
|
|
|
81612
81412
|
return accounts;
|
|
81613
81413
|
};
|
|
81614
81414
|
var isLoggedIn = async () => {
|
|
81615
|
-
const { npx:
|
|
81415
|
+
const { npx: npx6 } = detectPackageManager();
|
|
81616
81416
|
try {
|
|
81617
|
-
const output = await runCommand([
|
|
81417
|
+
const output = await runCommand([npx6, "wrangler", "whoami"], {
|
|
81618
81418
|
silent: true
|
|
81619
81419
|
});
|
|
81620
81420
|
return /You are logged in/.test(output);
|
|
@@ -81638,7 +81438,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
81638
81438
|
}
|
|
81639
81439
|
);
|
|
81640
81440
|
}
|
|
81641
|
-
const tempdir = await (0, import_promises3.mkdtemp)((0,
|
|
81441
|
+
const tempdir = await (0, import_promises3.mkdtemp)((0, import_path9.join)((0, import_os.tmpdir)(), "c3-wrangler-init--from-dash-"));
|
|
81642
81442
|
await runCommand(
|
|
81643
81443
|
[
|
|
81644
81444
|
...dlx,
|
|
@@ -81661,16 +81461,16 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
81661
81461
|
}
|
|
81662
81462
|
);
|
|
81663
81463
|
await (0, import_promises3.cp)(
|
|
81664
|
-
(0,
|
|
81665
|
-
(0,
|
|
81464
|
+
(0, import_path9.join)(tempdir, ctx.args.existingScript, "src"),
|
|
81465
|
+
(0, import_path9.join)(ctx.project.path, "src"),
|
|
81666
81466
|
{ recursive: true }
|
|
81667
81467
|
);
|
|
81668
81468
|
await (0, import_promises3.cp)(
|
|
81669
|
-
(0,
|
|
81670
|
-
(0,
|
|
81469
|
+
(0, import_path9.join)(tempdir, ctx.args.existingScript, "wrangler.toml"),
|
|
81470
|
+
(0, import_path9.join)(ctx.project.path, "wrangler.toml")
|
|
81671
81471
|
);
|
|
81672
81472
|
}
|
|
81673
|
-
var
|
|
81473
|
+
var config26 = {
|
|
81674
81474
|
configVersion: 1,
|
|
81675
81475
|
id: "pre-existing",
|
|
81676
81476
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -81686,9 +81486,9 @@ var config27 = {
|
|
|
81686
81486
|
copyFiles: copyExistingWorkerFiles
|
|
81687
81487
|
})
|
|
81688
81488
|
};
|
|
81689
|
-
var
|
|
81489
|
+
var c3_default29 = config26;
|
|
81690
81490
|
function buildConfigure(params) {
|
|
81691
|
-
return async function
|
|
81491
|
+
return async function configure17(ctx) {
|
|
81692
81492
|
const loginSuccess = await params.login(ctx);
|
|
81693
81493
|
if (!loginSuccess) {
|
|
81694
81494
|
throw new Error("Failed to login to Cloudflare");
|
|
@@ -81700,7 +81500,7 @@ function buildConfigure(params) {
|
|
|
81700
81500
|
}
|
|
81701
81501
|
|
|
81702
81502
|
// templates/queues/c3.ts
|
|
81703
|
-
var
|
|
81503
|
+
var config27 = {
|
|
81704
81504
|
configVersion: 1,
|
|
81705
81505
|
id: "queues",
|
|
81706
81506
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -81727,16 +81527,16 @@ var config28 = {
|
|
|
81727
81527
|
]
|
|
81728
81528
|
}
|
|
81729
81529
|
};
|
|
81730
|
-
var
|
|
81530
|
+
var c3_default30 = config27;
|
|
81731
81531
|
|
|
81732
81532
|
// templates/qwik/pages/c3.ts
|
|
81733
81533
|
var recast7 = __toESM(require_main2());
|
|
81734
|
-
var { npm:
|
|
81735
|
-
var
|
|
81534
|
+
var { npm: npm10, npx: npx3, name } = detectPackageManager();
|
|
81535
|
+
var generate15 = async (ctx) => {
|
|
81736
81536
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
81737
81537
|
};
|
|
81738
|
-
var
|
|
81739
|
-
const cmd = [name === "pnpm" ?
|
|
81538
|
+
var configure9 = async (ctx) => {
|
|
81539
|
+
const cmd = [name === "pnpm" ? npm10 : npx3, "qwik", "add", "cloudflare-pages"];
|
|
81740
81540
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
81741
81541
|
await runCommand(cmd);
|
|
81742
81542
|
addBindingsProxy(ctx);
|
|
@@ -81812,7 +81612,7 @@ var populateCloudflareEnv = () => {
|
|
|
81812
81612
|
});
|
|
81813
81613
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
81814
81614
|
};
|
|
81815
|
-
var
|
|
81615
|
+
var config28 = {
|
|
81816
81616
|
configVersion: 1,
|
|
81817
81617
|
id: "qwik",
|
|
81818
81618
|
frameworkCli: "create-qwik",
|
|
@@ -81823,12 +81623,12 @@ var config29 = {
|
|
|
81823
81623
|
path: "./templates"
|
|
81824
81624
|
},
|
|
81825
81625
|
path: "templates/qwik/pages",
|
|
81826
|
-
generate:
|
|
81827
|
-
configure:
|
|
81626
|
+
generate: generate15,
|
|
81627
|
+
configure: configure9,
|
|
81828
81628
|
transformPackageJson: async () => ({
|
|
81829
81629
|
scripts: {
|
|
81830
|
-
deploy: `${
|
|
81831
|
-
preview: `${
|
|
81630
|
+
deploy: `${npm10} run build && wrangler pages deploy`,
|
|
81631
|
+
preview: `${npm10} run build && wrangler pages dev`,
|
|
81832
81632
|
"cf-typegen": `wrangler types`
|
|
81833
81633
|
}
|
|
81834
81634
|
}),
|
|
@@ -81837,16 +81637,16 @@ var config29 = {
|
|
|
81837
81637
|
previewScript: "preview",
|
|
81838
81638
|
workersTypes: "installed"
|
|
81839
81639
|
};
|
|
81840
|
-
var
|
|
81640
|
+
var c3_default31 = config28;
|
|
81841
81641
|
|
|
81842
81642
|
// templates/qwik/workers/c3.ts
|
|
81843
81643
|
var recast8 = __toESM(require_main2());
|
|
81844
|
-
var { npm:
|
|
81845
|
-
var
|
|
81644
|
+
var { npm: npm11, npx: npx4, name: name2 } = detectPackageManager();
|
|
81645
|
+
var generate16 = async (ctx) => {
|
|
81846
81646
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
81847
81647
|
};
|
|
81848
|
-
var
|
|
81849
|
-
const cmd = [name2 === "pnpm" ?
|
|
81648
|
+
var configure10 = async (ctx) => {
|
|
81649
|
+
const cmd = [name2 === "pnpm" ? npm11 : npx4, "qwik", "add", "cloudflare-pages"];
|
|
81850
81650
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
81851
81651
|
await runCommand(cmd);
|
|
81852
81652
|
removeFile("./public/_routes.json");
|
|
@@ -81923,7 +81723,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
81923
81723
|
});
|
|
81924
81724
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
81925
81725
|
};
|
|
81926
|
-
var
|
|
81726
|
+
var config29 = {
|
|
81927
81727
|
configVersion: 1,
|
|
81928
81728
|
id: "qwik",
|
|
81929
81729
|
frameworkCli: "create-qwik",
|
|
@@ -81933,12 +81733,12 @@ var config30 = {
|
|
|
81933
81733
|
path: "./templates"
|
|
81934
81734
|
},
|
|
81935
81735
|
path: "templates/qwik/workers",
|
|
81936
|
-
generate:
|
|
81937
|
-
configure:
|
|
81736
|
+
generate: generate16,
|
|
81737
|
+
configure: configure10,
|
|
81938
81738
|
transformPackageJson: async () => ({
|
|
81939
81739
|
scripts: {
|
|
81940
|
-
deploy: `${
|
|
81941
|
-
preview: `${
|
|
81740
|
+
deploy: `${npm11} run build && wrangler deploy`,
|
|
81741
|
+
preview: `${npm11} run build && wrangler dev`,
|
|
81942
81742
|
"cf-typegen": `wrangler types`
|
|
81943
81743
|
}
|
|
81944
81744
|
}),
|
|
@@ -81947,40 +81747,41 @@ var config30 = {
|
|
|
81947
81747
|
previewScript: "preview",
|
|
81948
81748
|
workersTypes: "installed"
|
|
81949
81749
|
};
|
|
81950
|
-
var
|
|
81750
|
+
var c3_default32 = config29;
|
|
81951
81751
|
|
|
81952
81752
|
// templates/qwik/c3.ts
|
|
81953
|
-
var
|
|
81753
|
+
var config30 = {
|
|
81954
81754
|
displayName: "Qwik",
|
|
81955
|
-
platformVariants: { pages:
|
|
81755
|
+
platformVariants: { pages: c3_default31, workers: c3_default32 }
|
|
81956
81756
|
};
|
|
81957
|
-
var
|
|
81757
|
+
var c3_default33 = config30;
|
|
81958
81758
|
|
|
81959
81759
|
// templates/react-router/c3.ts
|
|
81960
|
-
var { npm:
|
|
81961
|
-
var
|
|
81760
|
+
var { npm: npm12 } = detectPackageManager();
|
|
81761
|
+
var generate17 = async (ctx) => {
|
|
81962
81762
|
await runFrameworkGenerator(ctx, [
|
|
81963
81763
|
ctx.project.name,
|
|
81964
81764
|
"--template",
|
|
81965
|
-
|
|
81765
|
+
// React-router deleted the template here
|
|
81766
|
+
"https://github.com/remix-run/react-router-templates/tree/29ac272b9532fe26463a2d2693fc73ff3c1e884b/cloudflare",
|
|
81966
81767
|
// to prevent asking about git twice, just let c3 do it
|
|
81967
81768
|
"--no-git-init",
|
|
81968
81769
|
"--no-install"
|
|
81969
81770
|
]);
|
|
81970
81771
|
logRaw("");
|
|
81971
81772
|
};
|
|
81972
|
-
var
|
|
81773
|
+
var config31 = {
|
|
81973
81774
|
configVersion: 1,
|
|
81974
81775
|
id: "react-router",
|
|
81975
81776
|
platform: "workers",
|
|
81976
81777
|
frameworkCli: "create-react-router",
|
|
81977
81778
|
displayName: "React Router (formerly Remix)",
|
|
81978
|
-
generate:
|
|
81779
|
+
generate: generate17,
|
|
81979
81780
|
// configure,
|
|
81980
81781
|
transformPackageJson: async () => ({
|
|
81981
81782
|
scripts: {
|
|
81982
|
-
deploy: `${
|
|
81983
|
-
preview: `${
|
|
81783
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
81784
|
+
preview: `${npm12} run build && vite preview`,
|
|
81984
81785
|
"cf-typegen": `wrangler types`
|
|
81985
81786
|
}
|
|
81986
81787
|
}),
|
|
@@ -81988,11 +81789,11 @@ var config32 = {
|
|
|
81988
81789
|
deployScript: "deploy",
|
|
81989
81790
|
previewScript: "preview"
|
|
81990
81791
|
};
|
|
81991
|
-
var
|
|
81792
|
+
var c3_default34 = config31;
|
|
81992
81793
|
|
|
81993
81794
|
// templates/react/pages/c3.ts
|
|
81994
|
-
var { npm:
|
|
81995
|
-
var
|
|
81795
|
+
var { npm: npm13 } = detectPackageManager();
|
|
81796
|
+
var generate18 = async (ctx) => {
|
|
81996
81797
|
const variant = await inputPrompt({
|
|
81997
81798
|
type: "select",
|
|
81998
81799
|
question: "Select a variant:",
|
|
@@ -82021,7 +81822,7 @@ var variantsOptions = [
|
|
|
82021
81822
|
label: "JavaScript + SWC"
|
|
82022
81823
|
}
|
|
82023
81824
|
];
|
|
82024
|
-
var
|
|
81825
|
+
var config32 = {
|
|
82025
81826
|
configVersion: 1,
|
|
82026
81827
|
id: "react",
|
|
82027
81828
|
// React's documentation now recommends using create-vite.
|
|
@@ -82031,11 +81832,11 @@ var config33 = {
|
|
|
82031
81832
|
hidden: true,
|
|
82032
81833
|
path: "templates/react/pages",
|
|
82033
81834
|
copyFiles: { path: "./templates" },
|
|
82034
|
-
generate:
|
|
81835
|
+
generate: generate18,
|
|
82035
81836
|
transformPackageJson: async () => ({
|
|
82036
81837
|
scripts: {
|
|
82037
|
-
deploy: `${
|
|
82038
|
-
preview: `${
|
|
81838
|
+
deploy: `${npm13} run build && wrangler pages deploy`,
|
|
81839
|
+
preview: `${npm13} run build && wrangler pages dev`,
|
|
82039
81840
|
"cf-typegen": `wrangler types`
|
|
82040
81841
|
}
|
|
82041
81842
|
}),
|
|
@@ -82043,15 +81844,15 @@ var config33 = {
|
|
|
82043
81844
|
deployScript: "deploy",
|
|
82044
81845
|
previewScript: "preview"
|
|
82045
81846
|
};
|
|
82046
|
-
var
|
|
81847
|
+
var c3_default35 = config32;
|
|
82047
81848
|
|
|
82048
81849
|
// templates/react/workers/c3.ts
|
|
82049
81850
|
var import_assert3 = __toESM(require("assert"));
|
|
82050
81851
|
var recast9 = __toESM(require_main2());
|
|
82051
81852
|
var b2 = recast9.types.builders;
|
|
82052
81853
|
var t = recast9.types.namedTypes;
|
|
82053
|
-
var { npm:
|
|
82054
|
-
var
|
|
81854
|
+
var { npm: npm14 } = detectPackageManager();
|
|
81855
|
+
var generate19 = async (ctx) => {
|
|
82055
81856
|
const variant = await getVariant();
|
|
82056
81857
|
ctx.args.lang = variant.lang;
|
|
82057
81858
|
await runFrameworkGenerator(ctx, [
|
|
@@ -82061,7 +81862,7 @@ var generate20 = async (ctx) => {
|
|
|
82061
81862
|
]);
|
|
82062
81863
|
logRaw("");
|
|
82063
81864
|
};
|
|
82064
|
-
var
|
|
81865
|
+
var configure11 = async (ctx) => {
|
|
82065
81866
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
82066
81867
|
dev: true,
|
|
82067
81868
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -82092,9 +81893,9 @@ function transformViteConfig(ctx) {
|
|
|
82092
81893
|
if (callee.name !== "defineConfig") {
|
|
82093
81894
|
return this.traverse(n);
|
|
82094
81895
|
}
|
|
82095
|
-
const
|
|
82096
|
-
(0, import_assert3.default)(t.ObjectExpression.check(
|
|
82097
|
-
const pluginsProp =
|
|
81896
|
+
const config44 = n.node.arguments[0];
|
|
81897
|
+
(0, import_assert3.default)(t.ObjectExpression.check(config44));
|
|
81898
|
+
const pluginsProp = config44.properties.find((prop) => isPluginsProp(prop));
|
|
82098
81899
|
(0, import_assert3.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
82099
81900
|
pluginsProp.value.elements.push(
|
|
82100
81901
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -82151,7 +81952,7 @@ async function getVariant() {
|
|
|
82151
81952
|
(0, import_assert3.default)(selected, "Expected a variant to be selected");
|
|
82152
81953
|
return selected;
|
|
82153
81954
|
}
|
|
82154
|
-
var
|
|
81955
|
+
var config33 = {
|
|
82155
81956
|
configVersion: 1,
|
|
82156
81957
|
id: "react",
|
|
82157
81958
|
frameworkCli: "create-vite",
|
|
@@ -82168,12 +81969,12 @@ var config34 = {
|
|
|
82168
81969
|
}
|
|
82169
81970
|
}
|
|
82170
81971
|
},
|
|
82171
|
-
generate:
|
|
82172
|
-
configure:
|
|
81972
|
+
generate: generate19,
|
|
81973
|
+
configure: configure11,
|
|
82173
81974
|
transformPackageJson: async (_3, ctx) => ({
|
|
82174
81975
|
scripts: {
|
|
82175
|
-
deploy: `${
|
|
82176
|
-
preview: `${
|
|
81976
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
81977
|
+
preview: `${npm14} run build && vite preview`,
|
|
82177
81978
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
82178
81979
|
}
|
|
82179
81980
|
}),
|
|
@@ -82181,120 +81982,17 @@ var config34 = {
|
|
|
82181
81982
|
deployScript: "deploy",
|
|
82182
81983
|
previewScript: "preview"
|
|
82183
81984
|
};
|
|
82184
|
-
var
|
|
81985
|
+
var c3_default36 = config33;
|
|
82185
81986
|
|
|
82186
81987
|
// templates/react/c3.ts
|
|
82187
|
-
var
|
|
81988
|
+
var config34 = {
|
|
82188
81989
|
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
|
|
81990
|
+
platformVariants: { pages: c3_default35, workers: c3_default36 }
|
|
82293
81991
|
};
|
|
82294
|
-
var
|
|
81992
|
+
var c3_default37 = config34;
|
|
82295
81993
|
|
|
82296
81994
|
// templates/scheduled/c3.ts
|
|
82297
|
-
var
|
|
81995
|
+
var config35 = {
|
|
82298
81996
|
configVersion: 1,
|
|
82299
81997
|
id: "scheduled",
|
|
82300
81998
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -82311,11 +82009,11 @@ var config39 = {
|
|
|
82311
82009
|
}
|
|
82312
82010
|
}
|
|
82313
82011
|
};
|
|
82314
|
-
var
|
|
82012
|
+
var c3_default38 = config35;
|
|
82315
82013
|
|
|
82316
82014
|
// src/helpers/compatDate.ts
|
|
82317
82015
|
var import_fs9 = require("fs");
|
|
82318
|
-
var
|
|
82016
|
+
var import_path10 = require("path");
|
|
82319
82017
|
async function getWorkerdCompatibilityDate() {
|
|
82320
82018
|
const s = spinner();
|
|
82321
82019
|
s.start("Retrieving current workerd compatibility date");
|
|
@@ -82343,7 +82041,7 @@ async function getWorkerdCompatibilityDate() {
|
|
|
82343
82041
|
return fallbackDate;
|
|
82344
82042
|
}
|
|
82345
82043
|
function getLatestTypesEntrypoint(ctx) {
|
|
82346
|
-
const workersTypesPath = (0,
|
|
82044
|
+
const workersTypesPath = (0, import_path10.resolve)(
|
|
82347
82045
|
ctx.project.path,
|
|
82348
82046
|
"node_modules",
|
|
82349
82047
|
"@cloudflare",
|
|
@@ -82363,17 +82061,17 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
82363
82061
|
|
|
82364
82062
|
// templates/solid/c3.ts
|
|
82365
82063
|
var recast10 = __toESM(require_main2());
|
|
82366
|
-
var { npm:
|
|
82367
|
-
var
|
|
82064
|
+
var { npm: npm15 } = detectPackageManager();
|
|
82065
|
+
var generate20 = async (ctx) => {
|
|
82368
82066
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
82369
82067
|
logRaw("");
|
|
82370
82068
|
};
|
|
82371
|
-
var
|
|
82069
|
+
var configure12 = async (ctx) => {
|
|
82372
82070
|
const packages = ["nitropack"];
|
|
82373
82071
|
await installPackages(packages, {
|
|
82374
82072
|
dev: true,
|
|
82375
82073
|
startText: "Installing nitro module `nitropack`",
|
|
82376
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
82074
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
|
|
82377
82075
|
});
|
|
82378
82076
|
usesTypescript(ctx);
|
|
82379
82077
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -82409,7 +82107,7 @@ var configure15 = async (ctx) => {
|
|
|
82409
82107
|
}
|
|
82410
82108
|
});
|
|
82411
82109
|
};
|
|
82412
|
-
var
|
|
82110
|
+
var config36 = {
|
|
82413
82111
|
configVersion: 1,
|
|
82414
82112
|
id: "solid",
|
|
82415
82113
|
frameworkCli: "create-solid",
|
|
@@ -82419,12 +82117,12 @@ var config40 = {
|
|
|
82419
82117
|
path: "./templates"
|
|
82420
82118
|
},
|
|
82421
82119
|
path: "templates/solid",
|
|
82422
|
-
generate:
|
|
82423
|
-
configure:
|
|
82120
|
+
generate: generate20,
|
|
82121
|
+
configure: configure12,
|
|
82424
82122
|
transformPackageJson: async () => ({
|
|
82425
82123
|
scripts: {
|
|
82426
|
-
preview: `${
|
|
82427
|
-
deploy: `${
|
|
82124
|
+
preview: `${npm15} run build && npx wrangler dev`,
|
|
82125
|
+
deploy: `${npm15} run build && wrangler deploy`,
|
|
82428
82126
|
"cf-typegen": `wrangler types`
|
|
82429
82127
|
}
|
|
82430
82128
|
}),
|
|
@@ -82432,17 +82130,17 @@ var config40 = {
|
|
|
82432
82130
|
deployScript: "deploy",
|
|
82433
82131
|
previewScript: "preview"
|
|
82434
82132
|
};
|
|
82435
|
-
var
|
|
82133
|
+
var c3_default39 = config36;
|
|
82436
82134
|
|
|
82437
82135
|
// templates/svelte/pages/c3.ts
|
|
82438
82136
|
var import_node_fs3 = require("node:fs");
|
|
82439
82137
|
var recast11 = __toESM(require_main2());
|
|
82440
|
-
var { npm:
|
|
82441
|
-
var
|
|
82138
|
+
var { npm: npm16 } = detectPackageManager();
|
|
82139
|
+
var generate21 = async (ctx) => {
|
|
82442
82140
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
82443
82141
|
logRaw("");
|
|
82444
82142
|
};
|
|
82445
|
-
var
|
|
82143
|
+
var configure13 = async (ctx) => {
|
|
82446
82144
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
82447
82145
|
await installPackages([pkg], {
|
|
82448
82146
|
dev: true,
|
|
@@ -82524,8 +82222,8 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
82524
82222
|
}
|
|
82525
82223
|
});
|
|
82526
82224
|
};
|
|
82527
|
-
var
|
|
82528
|
-
var
|
|
82225
|
+
var typesPath2 = "src/worker-configuration.d.ts";
|
|
82226
|
+
var config37 = {
|
|
82529
82227
|
configVersion: 1,
|
|
82530
82228
|
id: "svelte",
|
|
82531
82229
|
frameworkCli: "sv",
|
|
@@ -82536,17 +82234,17 @@ var config41 = {
|
|
|
82536
82234
|
path: "./templates"
|
|
82537
82235
|
},
|
|
82538
82236
|
path: "templates/svelte/pages",
|
|
82539
|
-
generate:
|
|
82540
|
-
configure:
|
|
82237
|
+
generate: generate21,
|
|
82238
|
+
configure: configure13,
|
|
82541
82239
|
transformPackageJson: async (original, ctx) => {
|
|
82542
82240
|
let scripts = {
|
|
82543
|
-
preview: `${
|
|
82544
|
-
deploy: `${
|
|
82241
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
82242
|
+
deploy: `${npm16} run build && wrangler pages deploy`
|
|
82545
82243
|
};
|
|
82546
82244
|
if (usesTypescript(ctx)) {
|
|
82547
82245
|
scripts = {
|
|
82548
82246
|
...scripts,
|
|
82549
|
-
"cf-typegen": `wrangler types ${
|
|
82247
|
+
"cf-typegen": `wrangler types ${typesPath2}`
|
|
82550
82248
|
};
|
|
82551
82249
|
}
|
|
82552
82250
|
return { scripts };
|
|
@@ -82554,18 +82252,18 @@ var config41 = {
|
|
|
82554
82252
|
devScript: "dev",
|
|
82555
82253
|
deployScript: "deploy",
|
|
82556
82254
|
previewScript: "preview",
|
|
82557
|
-
typesPath:
|
|
82255
|
+
typesPath: typesPath2
|
|
82558
82256
|
};
|
|
82559
|
-
var
|
|
82257
|
+
var c3_default40 = config37;
|
|
82560
82258
|
|
|
82561
82259
|
// templates/svelte/workers/c3.ts
|
|
82562
82260
|
var recast12 = __toESM(require_main2());
|
|
82563
|
-
var { npm:
|
|
82564
|
-
var
|
|
82261
|
+
var { npm: npm17 } = detectPackageManager();
|
|
82262
|
+
var generate22 = async (ctx) => {
|
|
82565
82263
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
82566
82264
|
logRaw("");
|
|
82567
82265
|
};
|
|
82568
|
-
var
|
|
82266
|
+
var configure14 = async (ctx) => {
|
|
82569
82267
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
82570
82268
|
await installPackages([pkg], {
|
|
82571
82269
|
dev: true,
|
|
@@ -82624,8 +82322,8 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
82624
82322
|
}
|
|
82625
82323
|
});
|
|
82626
82324
|
};
|
|
82627
|
-
var
|
|
82628
|
-
var
|
|
82325
|
+
var typesPath3 = "./src/worker-configuration.d.ts";
|
|
82326
|
+
var config38 = {
|
|
82629
82327
|
configVersion: 1,
|
|
82630
82328
|
id: "svelte",
|
|
82631
82329
|
frameworkCli: "sv",
|
|
@@ -82635,17 +82333,17 @@ var config42 = {
|
|
|
82635
82333
|
path: "./templates"
|
|
82636
82334
|
},
|
|
82637
82335
|
path: "templates/svelte/workers",
|
|
82638
|
-
generate:
|
|
82639
|
-
configure:
|
|
82336
|
+
generate: generate22,
|
|
82337
|
+
configure: configure14,
|
|
82640
82338
|
transformPackageJson: async (original, ctx) => {
|
|
82641
82339
|
let scripts = {
|
|
82642
|
-
preview: `${
|
|
82643
|
-
deploy: `${
|
|
82340
|
+
preview: `${npm17} run build && wrangler dev`,
|
|
82341
|
+
deploy: `${npm17} run build && wrangler deploy`
|
|
82644
82342
|
};
|
|
82645
82343
|
if (usesTypescript(ctx)) {
|
|
82646
82344
|
scripts = {
|
|
82647
82345
|
...scripts,
|
|
82648
|
-
"cf-typegen": `wrangler types ${
|
|
82346
|
+
"cf-typegen": `wrangler types ${typesPath3}`
|
|
82649
82347
|
};
|
|
82650
82348
|
}
|
|
82651
82349
|
return { scripts };
|
|
@@ -82653,23 +82351,23 @@ var config42 = {
|
|
|
82653
82351
|
devScript: "dev",
|
|
82654
82352
|
deployScript: "deploy",
|
|
82655
82353
|
previewScript: "preview",
|
|
82656
|
-
typesPath:
|
|
82354
|
+
typesPath: typesPath3
|
|
82657
82355
|
};
|
|
82658
|
-
var
|
|
82356
|
+
var c3_default41 = config38;
|
|
82659
82357
|
|
|
82660
82358
|
// templates/svelte/c3.ts
|
|
82661
|
-
var
|
|
82359
|
+
var config39 = {
|
|
82662
82360
|
displayName: "SvelteKit",
|
|
82663
|
-
platformVariants: { pages:
|
|
82361
|
+
platformVariants: { pages: c3_default40, workers: c3_default41 }
|
|
82664
82362
|
};
|
|
82665
|
-
var
|
|
82363
|
+
var c3_default42 = config39;
|
|
82666
82364
|
|
|
82667
82365
|
// templates/vue/pages/c3.ts
|
|
82668
|
-
var { npm:
|
|
82669
|
-
var
|
|
82366
|
+
var { npm: npm18 } = detectPackageManager();
|
|
82367
|
+
var generate23 = async (ctx) => {
|
|
82670
82368
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
82671
82369
|
};
|
|
82672
|
-
var
|
|
82370
|
+
var config40 = {
|
|
82673
82371
|
configVersion: 1,
|
|
82674
82372
|
id: "vue",
|
|
82675
82373
|
frameworkCli: "create-vue",
|
|
@@ -82678,11 +82376,11 @@ var config44 = {
|
|
|
82678
82376
|
hidden: true,
|
|
82679
82377
|
path: "templates/vue/pages",
|
|
82680
82378
|
copyFiles: { path: "./templates" },
|
|
82681
|
-
generate:
|
|
82379
|
+
generate: generate23,
|
|
82682
82380
|
transformPackageJson: async () => ({
|
|
82683
82381
|
scripts: {
|
|
82684
|
-
deploy: `${
|
|
82685
|
-
preview: `${
|
|
82382
|
+
deploy: `${npm18} run build && wrangler pages deploy`,
|
|
82383
|
+
preview: `${npm18} run build && wrangler pages dev`,
|
|
82686
82384
|
"cf-typegen": `wrangler types`
|
|
82687
82385
|
}
|
|
82688
82386
|
}),
|
|
@@ -82690,11 +82388,11 @@ var config44 = {
|
|
|
82690
82388
|
deployScript: "deploy",
|
|
82691
82389
|
previewScript: "preview"
|
|
82692
82390
|
};
|
|
82693
|
-
var
|
|
82391
|
+
var c3_default43 = config40;
|
|
82694
82392
|
|
|
82695
82393
|
// templates/vue/workers/c3.ts
|
|
82696
|
-
var { npm:
|
|
82697
|
-
var
|
|
82394
|
+
var { npm: npm19 } = detectPackageManager();
|
|
82395
|
+
var generate24 = async (ctx) => {
|
|
82698
82396
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
82699
82397
|
type: "select",
|
|
82700
82398
|
question: "Would you like to use TypeScript?",
|
|
@@ -82711,7 +82409,7 @@ var generate27 = async (ctx) => {
|
|
|
82711
82409
|
]);
|
|
82712
82410
|
logRaw("");
|
|
82713
82411
|
};
|
|
82714
|
-
var
|
|
82412
|
+
var configure15 = async (ctx) => {
|
|
82715
82413
|
await installPackages(["@cloudflare/vite-plugin"], {
|
|
82716
82414
|
dev: true,
|
|
82717
82415
|
startText: "Installing the Cloudflare Vite plugin",
|
|
@@ -82732,7 +82430,7 @@ function updateTsconfigJson2() {
|
|
|
82732
82430
|
writeJSON("tsconfig.json", tsconfig);
|
|
82733
82431
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
82734
82432
|
}
|
|
82735
|
-
var
|
|
82433
|
+
var config41 = {
|
|
82736
82434
|
configVersion: 1,
|
|
82737
82435
|
id: "vue",
|
|
82738
82436
|
frameworkCli: "create-vue",
|
|
@@ -82752,12 +82450,12 @@ var config45 = {
|
|
|
82752
82450
|
}
|
|
82753
82451
|
}
|
|
82754
82452
|
},
|
|
82755
|
-
configure:
|
|
82756
|
-
generate:
|
|
82453
|
+
configure: configure15,
|
|
82454
|
+
generate: generate24,
|
|
82757
82455
|
transformPackageJson: async (_3, ctx) => ({
|
|
82758
82456
|
scripts: {
|
|
82759
|
-
deploy: `${
|
|
82760
|
-
preview: `${
|
|
82457
|
+
deploy: `${npm19} run build && wrangler deploy`,
|
|
82458
|
+
preview: `${npm19} run build && wrangler dev`,
|
|
82761
82459
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
82762
82460
|
}
|
|
82763
82461
|
}),
|
|
@@ -82765,20 +82463,50 @@ var config45 = {
|
|
|
82765
82463
|
deployScript: "deploy",
|
|
82766
82464
|
previewScript: "preview"
|
|
82767
82465
|
};
|
|
82768
|
-
var
|
|
82466
|
+
var c3_default44 = config41;
|
|
82769
82467
|
|
|
82770
82468
|
// templates/vue/c3.ts
|
|
82771
|
-
var
|
|
82469
|
+
var config42 = {
|
|
82772
82470
|
displayName: "Vue",
|
|
82773
|
-
platformVariants: { pages:
|
|
82471
|
+
platformVariants: { pages: c3_default43, workers: c3_default44 }
|
|
82774
82472
|
};
|
|
82775
|
-
var
|
|
82473
|
+
var c3_default45 = config42;
|
|
82474
|
+
|
|
82475
|
+
// templates/waku/c3.ts
|
|
82476
|
+
var { npm: npm20 } = detectPackageManager();
|
|
82477
|
+
var generate25 = async (ctx) => {
|
|
82478
|
+
await runFrameworkGenerator(ctx, [
|
|
82479
|
+
"--project-name",
|
|
82480
|
+
ctx.project.name,
|
|
82481
|
+
"--template",
|
|
82482
|
+
"07_cloudflare"
|
|
82483
|
+
]);
|
|
82484
|
+
};
|
|
82485
|
+
var config43 = {
|
|
82486
|
+
configVersion: 1,
|
|
82487
|
+
id: "waku",
|
|
82488
|
+
frameworkCli: "create-waku",
|
|
82489
|
+
platform: "workers",
|
|
82490
|
+
displayName: "Waku",
|
|
82491
|
+
path: "templates/waku",
|
|
82492
|
+
generate: generate25,
|
|
82493
|
+
transformPackageJson: async () => ({
|
|
82494
|
+
scripts: {
|
|
82495
|
+
deploy: `${npm20} run build && wrangler deploy`,
|
|
82496
|
+
preview: `NODE_ENV=production ${npm20} run build && wrangler dev`
|
|
82497
|
+
}
|
|
82498
|
+
}),
|
|
82499
|
+
devScript: "dev",
|
|
82500
|
+
deployScript: "deploy",
|
|
82501
|
+
previewScript: "preview"
|
|
82502
|
+
};
|
|
82503
|
+
var c3_default46 = config43;
|
|
82776
82504
|
|
|
82777
82505
|
// src/git.ts
|
|
82778
82506
|
var import_node_assert2 = __toESM(require("node:assert"));
|
|
82779
82507
|
|
|
82780
82508
|
// ../wrangler/package.json
|
|
82781
|
-
var version2 = "4.
|
|
82509
|
+
var version2 = "4.41.0";
|
|
82782
82510
|
|
|
82783
82511
|
// src/git.ts
|
|
82784
82512
|
var offerGit = async (ctx) => {
|
|
@@ -82957,7 +82685,7 @@ async function getProductionBranch(cwd) {
|
|
|
82957
82685
|
|
|
82958
82686
|
// src/validators.ts
|
|
82959
82687
|
var import_fs10 = require("fs");
|
|
82960
|
-
var
|
|
82688
|
+
var import_path11 = require("path");
|
|
82961
82689
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
82962
82690
|
var validateTemplateUrl = (value) => {
|
|
82963
82691
|
if (!String(value).match(TEMPLATE_REGEX)) {
|
|
@@ -82965,7 +82693,7 @@ var validateTemplateUrl = (value) => {
|
|
|
82965
82693
|
}
|
|
82966
82694
|
};
|
|
82967
82695
|
var validateProjectDirectory = (relativePath, args) => {
|
|
82968
|
-
const path6 = (0,
|
|
82696
|
+
const path6 = (0, import_path11.resolve)(relativePath);
|
|
82969
82697
|
const existsAlready = (0, import_fs10.existsSync)(path6);
|
|
82970
82698
|
if (existsAlready) {
|
|
82971
82699
|
for (const file of (0, import_fs10.readdirSync)(path6)) {
|
|
@@ -82975,7 +82703,7 @@ var validateProjectDirectory = (relativePath, args) => {
|
|
|
82975
82703
|
}
|
|
82976
82704
|
}
|
|
82977
82705
|
if (!args.existingScript) {
|
|
82978
|
-
const projectName = (0,
|
|
82706
|
+
const projectName = (0, import_path11.basename)(path6);
|
|
82979
82707
|
const invalidChars = /[^a-z0-9-]/;
|
|
82980
82708
|
const invalidStartEnd = /^-|-$/;
|
|
82981
82709
|
if (projectName.match(invalidStartEnd)) {
|
|
@@ -83049,15 +82777,15 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
83049
82777
|
docusaurus: c3_default11,
|
|
83050
82778
|
gatsby: c3_default14,
|
|
83051
82779
|
hono: c3_default23,
|
|
83052
|
-
next:
|
|
83053
|
-
nuxt:
|
|
83054
|
-
qwik:
|
|
83055
|
-
react:
|
|
83056
|
-
"react-router":
|
|
83057
|
-
|
|
83058
|
-
|
|
83059
|
-
|
|
83060
|
-
|
|
82780
|
+
next: c3_default24,
|
|
82781
|
+
nuxt: c3_default27,
|
|
82782
|
+
qwik: c3_default33,
|
|
82783
|
+
react: c3_default37,
|
|
82784
|
+
"react-router": c3_default34,
|
|
82785
|
+
solid: c3_default39,
|
|
82786
|
+
svelte: c3_default42,
|
|
82787
|
+
vue: c3_default45,
|
|
82788
|
+
waku: c3_default46
|
|
83061
82789
|
};
|
|
83062
82790
|
}
|
|
83063
82791
|
}
|
|
@@ -83069,10 +82797,10 @@ function getOtherTemplateMap({
|
|
|
83069
82797
|
} else {
|
|
83070
82798
|
return {
|
|
83071
82799
|
common: c3_default8,
|
|
83072
|
-
scheduled:
|
|
83073
|
-
queues:
|
|
83074
|
-
openapi:
|
|
83075
|
-
"pre-existing":
|
|
82800
|
+
scheduled: c3_default38,
|
|
82801
|
+
queues: c3_default30,
|
|
82802
|
+
openapi: c3_default28,
|
|
82803
|
+
"pre-existing": c3_default29
|
|
83076
82804
|
};
|
|
83077
82805
|
}
|
|
83078
82806
|
}
|
|
@@ -83090,10 +82818,10 @@ function getHelloWorldTemplateMap({
|
|
|
83090
82818
|
"hello-world-durable-object-with-assets": c3_default16,
|
|
83091
82819
|
"hello-world-workflows": c3_default19,
|
|
83092
82820
|
common: c3_default8,
|
|
83093
|
-
scheduled:
|
|
83094
|
-
queues:
|
|
83095
|
-
openapi:
|
|
83096
|
-
"pre-existing":
|
|
82821
|
+
scheduled: c3_default38,
|
|
82822
|
+
queues: c3_default30,
|
|
82823
|
+
openapi: c3_default28,
|
|
82824
|
+
"pre-existing": c3_default29
|
|
83097
82825
|
};
|
|
83098
82826
|
}
|
|
83099
82827
|
}
|
|
@@ -83252,10 +82980,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
83252
82980
|
let template;
|
|
83253
82981
|
if (category === "web-framework") {
|
|
83254
82982
|
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
83255
|
-
(acc, [key,
|
|
83256
|
-
if (!
|
|
82983
|
+
(acc, [key, config44]) => {
|
|
82984
|
+
if (!config44.hidden || args.framework) {
|
|
83257
82985
|
acc.push({
|
|
83258
|
-
label:
|
|
82986
|
+
label: config44.displayName,
|
|
83259
82987
|
value: key
|
|
83260
82988
|
});
|
|
83261
82989
|
}
|
|
@@ -83281,7 +83009,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
83281
83009
|
if ("platformVariants" in frameworkConfig) {
|
|
83282
83010
|
const availableVariants = Object.entries(
|
|
83283
83011
|
frameworkConfig.platformVariants
|
|
83284
|
-
).filter(([,
|
|
83012
|
+
).filter(([, config44]) => !config44.hidden);
|
|
83285
83013
|
if (availableVariants.length === 1) {
|
|
83286
83014
|
args.platform ??= availableVariants[0][0];
|
|
83287
83015
|
}
|
|
@@ -83359,7 +83087,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
83359
83087
|
envInterfaceName: "Env",
|
|
83360
83088
|
...template
|
|
83361
83089
|
};
|
|
83362
|
-
const path6 = (0,
|
|
83090
|
+
const path6 = (0, import_path12.resolve)(projectName);
|
|
83363
83091
|
const languageVariants = template.copyFiles && !isVariantInfo(template.copyFiles) && !template.copyFiles.selectVariant ? Object.keys(template.copyFiles.variants) : [];
|
|
83364
83092
|
if (languageVariants.length > 0) {
|
|
83365
83093
|
if (hasTsConfig(path6)) {
|
|
@@ -83385,8 +83113,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
83385
83113
|
}
|
|
83386
83114
|
}
|
|
83387
83115
|
}
|
|
83388
|
-
const name3 = (0,
|
|
83389
|
-
const directory = (0,
|
|
83116
|
+
const name3 = (0, import_path12.basename)(path6);
|
|
83117
|
+
const directory = (0, import_path12.dirname)(path6);
|
|
83390
83118
|
const originalCWD = process.cwd();
|
|
83391
83119
|
return {
|
|
83392
83120
|
project: { name: name3, path: path6 },
|
|
@@ -83406,7 +83134,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
83406
83134
|
const { copyFiles } = ctx.template;
|
|
83407
83135
|
let srcdir;
|
|
83408
83136
|
if (isVariantInfo(copyFiles)) {
|
|
83409
|
-
srcdir = (0,
|
|
83137
|
+
srcdir = (0, import_path12.join)(getTemplatePath(ctx), copyFiles.path);
|
|
83410
83138
|
} else {
|
|
83411
83139
|
const selectVariant = copyFiles.selectVariant ?? defaultSelectVariant;
|
|
83412
83140
|
const variant = await selectVariant(ctx);
|
|
@@ -83416,16 +83144,16 @@ async function copyTemplateFiles(ctx) {
|
|
|
83416
83144
|
`Unknown variant provided: ${JSON.stringify(variant ?? "")}`
|
|
83417
83145
|
);
|
|
83418
83146
|
}
|
|
83419
|
-
srcdir = (0,
|
|
83147
|
+
srcdir = (0, import_path12.join)(getTemplatePath(ctx), variantInfo.path);
|
|
83420
83148
|
}
|
|
83421
83149
|
const copyDestDir = getCopyFilesDestinationDir(ctx);
|
|
83422
|
-
const destdir = (0,
|
|
83150
|
+
const destdir = (0, import_path12.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
|
|
83423
83151
|
const s = spinner();
|
|
83424
83152
|
s.start(`Copying template files`);
|
|
83425
83153
|
await (0, import_promises4.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
83426
|
-
const dummyGitIgnorePath = (0,
|
|
83154
|
+
const dummyGitIgnorePath = (0, import_path12.join)(destdir, "__dot__gitignore");
|
|
83427
83155
|
if ((0, import_fs11.existsSync)(dummyGitIgnorePath)) {
|
|
83428
|
-
await (0, import_promises4.rename)(dummyGitIgnorePath, (0,
|
|
83156
|
+
await (0, import_promises4.rename)(dummyGitIgnorePath, (0, import_path12.join)(destdir, ".gitignore"));
|
|
83429
83157
|
}
|
|
83430
83158
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
83431
83159
|
}
|
|
@@ -83442,38 +83170,38 @@ var processRemoteTemplate = async (args) => {
|
|
|
83442
83170
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
83443
83171
|
}
|
|
83444
83172
|
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
83445
|
-
const
|
|
83446
|
-
validateTemplate(path6,
|
|
83173
|
+
const config44 = inferTemplateConfig(path6);
|
|
83174
|
+
validateTemplate(path6, config44);
|
|
83447
83175
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
83448
83176
|
return {
|
|
83449
83177
|
path: path6,
|
|
83450
|
-
...
|
|
83178
|
+
...config44
|
|
83451
83179
|
};
|
|
83452
83180
|
};
|
|
83453
|
-
var validateTemplate = (path6,
|
|
83454
|
-
if (!
|
|
83181
|
+
var validateTemplate = (path6, config44) => {
|
|
83182
|
+
if (!config44.copyFiles) {
|
|
83455
83183
|
return;
|
|
83456
83184
|
}
|
|
83457
|
-
if (isVariantInfo(
|
|
83458
|
-
validateTemplateSrcDirectory((0,
|
|
83185
|
+
if (isVariantInfo(config44.copyFiles)) {
|
|
83186
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, config44.copyFiles.path), config44);
|
|
83459
83187
|
} else {
|
|
83460
|
-
for (const variant of Object.values(
|
|
83461
|
-
validateTemplateSrcDirectory((0,
|
|
83188
|
+
for (const variant of Object.values(config44.copyFiles.variants)) {
|
|
83189
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, variant.path), config44);
|
|
83462
83190
|
}
|
|
83463
83191
|
}
|
|
83464
83192
|
};
|
|
83465
|
-
var validateTemplateSrcDirectory = (path6,
|
|
83466
|
-
if (
|
|
83467
|
-
const wranglerTomlPath = (0,
|
|
83468
|
-
const wranglerJsonPath = (0,
|
|
83469
|
-
const wranglerJsoncPath = (0,
|
|
83193
|
+
var validateTemplateSrcDirectory = (path6, config44) => {
|
|
83194
|
+
if (config44.platform === "workers") {
|
|
83195
|
+
const wranglerTomlPath = (0, import_path12.resolve)(path6, "wrangler.toml");
|
|
83196
|
+
const wranglerJsonPath = (0, import_path12.resolve)(path6, "wrangler.json");
|
|
83197
|
+
const wranglerJsoncPath = (0, import_path12.resolve)(path6, "wrangler.jsonc");
|
|
83470
83198
|
if (!(0, import_fs11.existsSync)(wranglerTomlPath) && !(0, import_fs11.existsSync)(wranglerJsonPath) && !(0, import_fs11.existsSync)(wranglerJsoncPath)) {
|
|
83471
83199
|
throw new Error(
|
|
83472
83200
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
83473
83201
|
);
|
|
83474
83202
|
}
|
|
83475
83203
|
}
|
|
83476
|
-
const pkgJsonPath = (0,
|
|
83204
|
+
const pkgJsonPath = (0, import_path12.resolve)(path6, "package.json");
|
|
83477
83205
|
if (!(0, import_fs11.existsSync)(pkgJsonPath)) {
|
|
83478
83206
|
throw new Error(
|
|
83479
83207
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
@@ -83491,10 +83219,10 @@ var inferTemplateConfig = (path6) => {
|
|
|
83491
83219
|
};
|
|
83492
83220
|
var inferCopyFilesDefinition = (path6) => {
|
|
83493
83221
|
const variants = {};
|
|
83494
|
-
if ((0, import_fs11.existsSync)((0,
|
|
83222
|
+
if ((0, import_fs11.existsSync)((0, import_path12.join)(path6, "js"))) {
|
|
83495
83223
|
variants["js"] = { path: "./js" };
|
|
83496
83224
|
}
|
|
83497
|
-
if ((0, import_fs11.existsSync)((0,
|
|
83225
|
+
if ((0, import_fs11.existsSync)((0, import_path12.join)(path6, "ts"))) {
|
|
83498
83226
|
variants["ts"] = { path: "./ts" };
|
|
83499
83227
|
}
|
|
83500
83228
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -83509,7 +83237,7 @@ var downloadRemoteTemplate = async (src, mode) => {
|
|
|
83509
83237
|
force: true,
|
|
83510
83238
|
mode
|
|
83511
83239
|
});
|
|
83512
|
-
const tmpDir = await (0, import_promises4.mkdtemp)((0,
|
|
83240
|
+
const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path12.join)((0, import_os2.tmpdir)(), "c3-template"));
|
|
83513
83241
|
await emitter.clone(tmpDir);
|
|
83514
83242
|
return tmpDir;
|
|
83515
83243
|
} catch {
|
|
@@ -83518,24 +83246,30 @@ var downloadRemoteTemplate = async (src, mode) => {
|
|
|
83518
83246
|
}
|
|
83519
83247
|
};
|
|
83520
83248
|
function updatePythonPackageName(path6, projectName) {
|
|
83521
|
-
const pyprojectTomlPath = (0,
|
|
83522
|
-
const uvLockPath = (0,
|
|
83249
|
+
const pyprojectTomlPath = (0, import_path12.resolve)(path6, "pyproject.toml");
|
|
83250
|
+
const uvLockPath = (0, import_path12.resolve)(path6, "uv.lock");
|
|
83523
83251
|
if (!(0, import_fs11.existsSync)(pyprojectTomlPath)) {
|
|
83524
83252
|
return;
|
|
83525
83253
|
}
|
|
83526
83254
|
const s = spinner();
|
|
83527
83255
|
s.start("Updating name in `pyproject.toml`");
|
|
83528
83256
|
let pyprojectTomlContents = readFile(pyprojectTomlPath);
|
|
83529
|
-
pyprojectTomlContents = pyprojectTomlContents.replace(
|
|
83257
|
+
pyprojectTomlContents = pyprojectTomlContents.replace(
|
|
83258
|
+
'"TBD"',
|
|
83259
|
+
`"${projectName}"`
|
|
83260
|
+
);
|
|
83530
83261
|
writeFile2(pyprojectTomlPath, pyprojectTomlContents);
|
|
83531
83262
|
let uvLockContents = readFile(uvLockPath);
|
|
83532
|
-
uvLockContents = uvLockContents.replace(
|
|
83263
|
+
uvLockContents = uvLockContents.replace(
|
|
83264
|
+
'"tbd"',
|
|
83265
|
+
`${"projectName.toLowerCase()"}`
|
|
83266
|
+
);
|
|
83533
83267
|
writeFile2(uvLockPath, uvLockContents);
|
|
83534
83268
|
s.stop(`${brandColor("updated")} ${dim("`pyproject.toml`")}`);
|
|
83535
83269
|
}
|
|
83536
83270
|
var updatePackageName = async (ctx) => {
|
|
83537
83271
|
const placeholderNames = ["<TBD>", "TBD", ""];
|
|
83538
|
-
const pkgJsonPath = (0,
|
|
83272
|
+
const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
|
|
83539
83273
|
const pkgJson = readJSON(pkgJsonPath);
|
|
83540
83274
|
if (!placeholderNames.includes(pkgJson.name)) {
|
|
83541
83275
|
return;
|
|
@@ -83553,7 +83287,7 @@ var updatePackageScripts = async (ctx) => {
|
|
|
83553
83287
|
}
|
|
83554
83288
|
const s = spinner();
|
|
83555
83289
|
s.start("Updating `package.json` scripts");
|
|
83556
|
-
const pkgJsonPath = (0,
|
|
83290
|
+
const pkgJsonPath = (0, import_path12.resolve)(ctx.project.path, "package.json");
|
|
83557
83291
|
let pkgJson = readJSON(pkgJsonPath);
|
|
83558
83292
|
const transformed = await ctx.template.transformPackageJson(pkgJson, ctx);
|
|
83559
83293
|
pkgJson = (0, import_deepmerge.default)(pkgJson, transformed);
|
|
@@ -83562,9 +83296,9 @@ var updatePackageScripts = async (ctx) => {
|
|
|
83562
83296
|
};
|
|
83563
83297
|
var getTemplatePath = (ctx) => {
|
|
83564
83298
|
if (ctx.template.path) {
|
|
83565
|
-
return (0,
|
|
83299
|
+
return (0, import_path12.resolve)(__dirname, "..", ctx.template.path);
|
|
83566
83300
|
}
|
|
83567
|
-
return (0,
|
|
83301
|
+
return (0, import_path12.resolve)(__dirname, "..", "templates", ctx.template.id);
|
|
83568
83302
|
};
|
|
83569
83303
|
var isVariantInfo = (copyFiles) => {
|
|
83570
83304
|
return "path" in copyFiles;
|
|
@@ -83609,7 +83343,9 @@ var addWranglerToGitIgnore = (ctx) => {
|
|
|
83609
83343
|
if (!hasDotDevVarsExample) {
|
|
83610
83344
|
wranglerGitIgnoreFilesToAdd.push("!.dev.vars.example");
|
|
83611
83345
|
}
|
|
83612
|
-
const hasDotEnv = existingGitIgnoreContent.match(
|
|
83346
|
+
const hasDotEnv = existingGitIgnoreContent.match(
|
|
83347
|
+
/^\/?\.env\*?(\..*?)?(\s|$)/m
|
|
83348
|
+
);
|
|
83613
83349
|
if (!hasDotEnv) {
|
|
83614
83350
|
wranglerGitIgnoreFilesToAdd.push(".env*");
|
|
83615
83351
|
}
|
|
@@ -83709,7 +83445,7 @@ var cliDefinition = {
|
|
|
83709
83445
|
requiresArg: true,
|
|
83710
83446
|
description: `The type of framework to use to create a web application (when using this option "--category" is coerced to "web-framework")
|
|
83711
83447
|
|
|
83712
|
-
When using the --framework option, C3 will dispatch to the official creation tool used by the framework (
|
|
83448
|
+
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
83449
|
|
|
83714
83450
|
You may specify additional arguments to be passed directly to these underlying tools by adding them after a "--" argument, like so:
|
|
83715
83451
|
|
|
@@ -83800,9 +83536,9 @@ var cliDefinition = {
|
|
|
83800
83536
|
type: "string",
|
|
83801
83537
|
requiresArg: true,
|
|
83802
83538
|
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.
|
|
83539
|
+
|
|
83540
|
+
Can be either "git" or "tar". "tar" does not support fetching from private
|
|
83541
|
+
repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
|
|
83806
83542
|
Otherwise, it will use "git".
|
|
83807
83543
|
`,
|
|
83808
83544
|
values: [
|
|
@@ -84081,7 +83817,7 @@ function secondsSince(start) {
|
|
|
84081
83817
|
|
|
84082
83818
|
// src/wrangler/config.ts
|
|
84083
83819
|
var import_fs12 = require("fs");
|
|
84084
|
-
var
|
|
83820
|
+
var import_path13 = require("path");
|
|
84085
83821
|
var import_toml2 = __toESM(require_toml());
|
|
84086
83822
|
|
|
84087
83823
|
// src/helpers/json.ts
|
|
@@ -84220,13 +83956,13 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
84220
83956
|
}
|
|
84221
83957
|
};
|
|
84222
83958
|
var getWranglerTomlPath = (ctx) => {
|
|
84223
|
-
return (0,
|
|
83959
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.toml");
|
|
84224
83960
|
};
|
|
84225
83961
|
var getWranglerJsonPath = (ctx) => {
|
|
84226
|
-
return (0,
|
|
83962
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.json");
|
|
84227
83963
|
};
|
|
84228
83964
|
var getWranglerJsoncPath = (ctx) => {
|
|
84229
|
-
return (0,
|
|
83965
|
+
return (0, import_path13.resolve)(ctx.project.path, "wrangler.jsonc");
|
|
84230
83966
|
};
|
|
84231
83967
|
var wranglerTomlExists = (ctx) => {
|
|
84232
83968
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -84253,13 +83989,13 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
84253
83989
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
84254
83990
|
return writeFile2(wranglerTomlPath, contents);
|
|
84255
83991
|
};
|
|
84256
|
-
var writeWranglerJson = (ctx,
|
|
83992
|
+
var writeWranglerJson = (ctx, config44) => {
|
|
84257
83993
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
84258
83994
|
if ((0, import_fs12.existsSync)(wranglerJsonPath)) {
|
|
84259
|
-
return writeJSONWithComments(wranglerJsonPath,
|
|
83995
|
+
return writeJSONWithComments(wranglerJsonPath, config44);
|
|
84260
83996
|
}
|
|
84261
83997
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
84262
|
-
return writeJSONWithComments(wranglerJsoncPath,
|
|
83998
|
+
return writeJSONWithComments(wranglerJsoncPath, config44);
|
|
84263
83999
|
};
|
|
84264
84000
|
var addVscodeConfig = (ctx) => {
|
|
84265
84001
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
@@ -84273,17 +84009,17 @@ var addVscodeConfig = (ctx) => {
|
|
|
84273
84009
|
}
|
|
84274
84010
|
});
|
|
84275
84011
|
};
|
|
84276
|
-
async function getCompatibilityDate(
|
|
84012
|
+
async function getCompatibilityDate(config44) {
|
|
84277
84013
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}$/m;
|
|
84278
|
-
if (typeof
|
|
84279
|
-
return
|
|
84014
|
+
if (typeof config44["compatibility_date"] === "string" && config44["compatibility_date"].match(validCompatDateRe)) {
|
|
84015
|
+
return config44["compatibility_date"];
|
|
84280
84016
|
}
|
|
84281
84017
|
return await getWorkerdCompatibilityDate();
|
|
84282
84018
|
}
|
|
84283
84019
|
|
|
84284
84020
|
// src/deploy.ts
|
|
84285
84021
|
var offerToDeploy = async (ctx) => {
|
|
84286
|
-
const { npm:
|
|
84022
|
+
const { npm: npm22 } = detectPackageManager();
|
|
84287
84023
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
84288
84024
|
if (!await isDeployable(ctx)) {
|
|
84289
84025
|
ctx.args.deploy = false;
|
|
@@ -84294,7 +84030,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
84294
84030
|
);
|
|
84295
84031
|
}
|
|
84296
84032
|
const label = `deploy via \`${quoteShellArgs([
|
|
84297
|
-
|
|
84033
|
+
npm22,
|
|
84298
84034
|
"run",
|
|
84299
84035
|
ctx.template.deployScript ?? "deploy"
|
|
84300
84036
|
])}\``;
|
|
@@ -84330,11 +84066,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
84330
84066
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
84331
84067
|
};
|
|
84332
84068
|
var runDeploy = async (ctx) => {
|
|
84333
|
-
const { npm:
|
|
84069
|
+
const { npm: npm22, name: pm4 } = detectPackageManager();
|
|
84334
84070
|
if (!ctx.account?.id) {
|
|
84335
84071
|
throw new Error("Failed to read Cloudflare account.");
|
|
84336
84072
|
}
|
|
84337
|
-
const baseDeployCmd = [
|
|
84073
|
+
const baseDeployCmd = [npm22, "run", ctx.template.deployScript ?? "deploy"];
|
|
84338
84074
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
84339
84075
|
const deployCmd = [
|
|
84340
84076
|
...baseDeployCmd,
|
|
@@ -84408,7 +84144,7 @@ var hasBinding = (node) => {
|
|
|
84408
84144
|
};
|
|
84409
84145
|
|
|
84410
84146
|
// src/dialog.ts
|
|
84411
|
-
var
|
|
84147
|
+
var import_path14 = require("path");
|
|
84412
84148
|
function createDialog(lines) {
|
|
84413
84149
|
const screenWidth = process.stdout.columns;
|
|
84414
84150
|
const maxLineWidth = Math.max(
|
|
@@ -84448,16 +84184,16 @@ function printWelcomeMessage(version3, telemetryEnabled, args) {
|
|
|
84448
84184
|
}
|
|
84449
84185
|
var printSummary = (ctx) => {
|
|
84450
84186
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
84451
|
-
const relativePath = (0,
|
|
84187
|
+
const relativePath = (0, import_path14.relative)(ctx.originalCWD, ctx.project.path);
|
|
84452
84188
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
84453
|
-
const { npm:
|
|
84189
|
+
const { npm: npm22 } = detectPackageManager();
|
|
84454
84190
|
const devServerCommand = quoteShellArgs([
|
|
84455
|
-
|
|
84191
|
+
npm22,
|
|
84456
84192
|
"run",
|
|
84457
84193
|
ctx.template.devScript ?? "start"
|
|
84458
84194
|
]);
|
|
84459
84195
|
const deployCommand = quoteShellArgs([
|
|
84460
|
-
|
|
84196
|
+
npm22,
|
|
84461
84197
|
"run",
|
|
84462
84198
|
ctx.template.deployScript ?? "deploy"
|
|
84463
84199
|
]);
|
|
@@ -84825,8 +84561,8 @@ var renderValues = (values) => {
|
|
|
84825
84561
|
};
|
|
84826
84562
|
|
|
84827
84563
|
// src/helpers/retry.ts
|
|
84828
|
-
var retry = async (
|
|
84829
|
-
let { times } =
|
|
84564
|
+
var retry = async (config44, fn) => {
|
|
84565
|
+
let { times } = config44;
|
|
84830
84566
|
let error2 = null;
|
|
84831
84567
|
while (times > 0) {
|
|
84832
84568
|
try {
|
|
@@ -84834,10 +84570,10 @@ var retry = async (config47, fn) => {
|
|
|
84834
84570
|
} catch (e) {
|
|
84835
84571
|
error2 = e;
|
|
84836
84572
|
times--;
|
|
84837
|
-
if (
|
|
84573
|
+
if (config44.exitCondition?.(e)) {
|
|
84838
84574
|
break;
|
|
84839
84575
|
}
|
|
84840
|
-
await sleep(
|
|
84576
|
+
await sleep(config44.sleepMs ?? 1e3);
|
|
84841
84577
|
}
|
|
84842
84578
|
}
|
|
84843
84579
|
throw error2;
|
|
@@ -84846,7 +84582,7 @@ var retry = async (config47, fn) => {
|
|
|
84846
84582
|
// src/pages.ts
|
|
84847
84583
|
var CREATE_PROJECT_RETRIES = 3;
|
|
84848
84584
|
var VERIFY_PROJECT_RETRIES = 3;
|
|
84849
|
-
var { npx:
|
|
84585
|
+
var { npx: npx5 } = detectPackageManager();
|
|
84850
84586
|
var createProject = async (ctx) => {
|
|
84851
84587
|
if (ctx.template.platform === "workers") {
|
|
84852
84588
|
return;
|
|
@@ -84859,7 +84595,7 @@ var createProject = async (ctx) => {
|
|
|
84859
84595
|
const compatFlags = ctx.template.compatibilityFlags ?? [];
|
|
84860
84596
|
const productionBranch = await getProductionBranch(ctx.project.path);
|
|
84861
84597
|
const cmd = [
|
|
84862
|
-
|
|
84598
|
+
npx5,
|
|
84863
84599
|
"wrangler",
|
|
84864
84600
|
"pages",
|
|
84865
84601
|
"project",
|
|
@@ -84896,7 +84632,7 @@ var createProject = async (ctx) => {
|
|
|
84896
84632
|
}
|
|
84897
84633
|
try {
|
|
84898
84634
|
const verifyProject = [
|
|
84899
|
-
|
|
84635
|
+
npx5,
|
|
84900
84636
|
"wrangler",
|
|
84901
84637
|
"pages",
|
|
84902
84638
|
"deployment",
|
|
@@ -84925,7 +84661,7 @@ var createProject = async (ctx) => {
|
|
|
84925
84661
|
|
|
84926
84662
|
// src/workers.ts
|
|
84927
84663
|
var import_fs13 = require("fs");
|
|
84928
|
-
var
|
|
84664
|
+
var import_path15 = require("path");
|
|
84929
84665
|
var import_toml4 = __toESM(require_toml());
|
|
84930
84666
|
|
|
84931
84667
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
@@ -86246,17 +85982,17 @@ async function addTypes(ctx) {
|
|
|
86246
85982
|
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
86247
85983
|
return;
|
|
86248
85984
|
}
|
|
86249
|
-
const { npm:
|
|
85985
|
+
const { npm: npm22 } = detectPackageManager();
|
|
86250
85986
|
if (ctx.template.workersTypes === "installed") {
|
|
86251
|
-
await installWorkersTypes(
|
|
85987
|
+
await installWorkersTypes(npm22);
|
|
86252
85988
|
} else if (ctx.template.workersTypes === "generated") {
|
|
86253
|
-
await generateWorkersTypes(ctx,
|
|
85989
|
+
await generateWorkersTypes(ctx, npm22);
|
|
86254
85990
|
}
|
|
86255
|
-
const usesNodeCompat = await maybeInstallNodeTypes(ctx,
|
|
85991
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm22);
|
|
86256
85992
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
86257
85993
|
}
|
|
86258
|
-
async function generateWorkersTypes(ctx,
|
|
86259
|
-
const packageJsonPath = (0,
|
|
85994
|
+
async function generateWorkersTypes(ctx, npm22) {
|
|
85995
|
+
const packageJsonPath = (0, import_path15.join)(ctx.project.path, "package.json");
|
|
86260
85996
|
if (!(0, import_fs13.existsSync)(packageJsonPath)) {
|
|
86261
85997
|
return;
|
|
86262
85998
|
}
|
|
@@ -86264,7 +86000,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
86264
86000
|
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
86265
86001
|
return;
|
|
86266
86002
|
}
|
|
86267
|
-
const typesCmd = [
|
|
86003
|
+
const typesCmd = [npm22, "run", "cf-typegen"];
|
|
86268
86004
|
await runCommand(typesCmd, {
|
|
86269
86005
|
cwd: ctx.project.path,
|
|
86270
86006
|
silent: true,
|
|
@@ -86276,7 +86012,7 @@ async function generateWorkersTypes(ctx, npm24) {
|
|
|
86276
86012
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
86277
86013
|
}
|
|
86278
86014
|
}
|
|
86279
|
-
var maybeInstallNodeTypes = async (ctx,
|
|
86015
|
+
var maybeInstallNodeTypes = async (ctx, npm22) => {
|
|
86280
86016
|
let parsedConfig = {};
|
|
86281
86017
|
if (wranglerJsonExists(ctx)) {
|
|
86282
86018
|
parsedConfig = readWranglerJson(ctx);
|
|
@@ -86289,21 +86025,21 @@ var maybeInstallNodeTypes = async (ctx, npm24) => {
|
|
|
86289
86025
|
await installPackages(["@types/node"], {
|
|
86290
86026
|
dev: true,
|
|
86291
86027
|
startText: "Installing @types/node",
|
|
86292
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86028
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm22}`)}`
|
|
86293
86029
|
});
|
|
86294
86030
|
return true;
|
|
86295
86031
|
}
|
|
86296
86032
|
return false;
|
|
86297
86033
|
};
|
|
86298
86034
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
86299
|
-
const tsconfigPath = (0,
|
|
86035
|
+
const tsconfigPath = (0, import_path15.join)(ctx.project.path, "tsconfig.json");
|
|
86300
86036
|
if (!(0, import_fs13.existsSync)(tsconfigPath)) {
|
|
86301
86037
|
return;
|
|
86302
86038
|
}
|
|
86303
86039
|
const tsconfig = readFile(tsconfigPath);
|
|
86304
86040
|
try {
|
|
86305
|
-
const
|
|
86306
|
-
const currentTypes =
|
|
86041
|
+
const config44 = parse5(tsconfig);
|
|
86042
|
+
const currentTypes = config44.compilerOptions?.types ?? [];
|
|
86307
86043
|
let newTypes = [...currentTypes];
|
|
86308
86044
|
if (ctx.template.workersTypes === "installed") {
|
|
86309
86045
|
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
@@ -86354,16 +86090,16 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
86354
86090
|
warn("Failed to update `tsconfig.json`.");
|
|
86355
86091
|
}
|
|
86356
86092
|
}
|
|
86357
|
-
async function installWorkersTypes(
|
|
86093
|
+
async function installWorkersTypes(npm22) {
|
|
86358
86094
|
await installPackages(["@cloudflare/workers-types"], {
|
|
86359
86095
|
dev: true,
|
|
86360
86096
|
startText: "Installing @cloudflare/workers-types",
|
|
86361
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86097
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm22}`)}`
|
|
86362
86098
|
});
|
|
86363
86099
|
}
|
|
86364
86100
|
|
|
86365
86101
|
// src/cli.ts
|
|
86366
|
-
var { npm:
|
|
86102
|
+
var { npm: npm21 } = detectPackageManager();
|
|
86367
86103
|
var main = async (argv) => {
|
|
86368
86104
|
const result = await parseArgs(argv);
|
|
86369
86105
|
if (result.type === "unknown") {
|
|
@@ -86399,17 +86135,17 @@ ${result.errorMessage}`);
|
|
|
86399
86135
|
};
|
|
86400
86136
|
var runLatest = async () => {
|
|
86401
86137
|
const args = process.argv.slice(2);
|
|
86402
|
-
if (
|
|
86138
|
+
if (npm21 === "npm") {
|
|
86403
86139
|
args.unshift("--");
|
|
86404
86140
|
}
|
|
86405
|
-
await runCommand([
|
|
86141
|
+
await runCommand([npm21, "create", "cloudflare@latest", ...args]);
|
|
86406
86142
|
};
|
|
86407
86143
|
var runCli = async (args) => {
|
|
86408
86144
|
printBanner(args);
|
|
86409
86145
|
checkMacOSVersion({ shouldThrow: true });
|
|
86410
86146
|
const ctx = await createContext(args);
|
|
86411
86147
|
await create(ctx);
|
|
86412
|
-
await
|
|
86148
|
+
await configure16(ctx);
|
|
86413
86149
|
await deploy(ctx);
|
|
86414
86150
|
printSummary(ctx);
|
|
86415
86151
|
logRaw("");
|
|
@@ -86420,7 +86156,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
86420
86156
|
if (err) {
|
|
86421
86157
|
throw new Error(err);
|
|
86422
86158
|
}
|
|
86423
|
-
const directory = (0,
|
|
86159
|
+
const directory = (0, import_path16.dirname)(path6);
|
|
86424
86160
|
(0, import_fs14.mkdirSync)(directory, { recursive: true });
|
|
86425
86161
|
(0, import_process2.chdir)(directory);
|
|
86426
86162
|
};
|
|
@@ -86437,7 +86173,7 @@ var create = async (ctx) => {
|
|
|
86437
86173
|
await rectifyPmMismatch(ctx);
|
|
86438
86174
|
endSection(`Application created`);
|
|
86439
86175
|
};
|
|
86440
|
-
var
|
|
86176
|
+
var configure16 = async (ctx) => {
|
|
86441
86177
|
startSection("Configuring your application for Cloudflare", "Step 2 of 3");
|
|
86442
86178
|
await installWrangler();
|
|
86443
86179
|
await updateWranglerConfig(ctx);
|