create-cloudflare 2.52.3 → 2.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +306 -267
- package/package.json +4 -4
- package/templates/hello-world/c3.ts +6 -8
- package/templates/hello-world/py/README.md +1 -1
- package/templates/hello-world/py/package.json +3 -3
- package/templates/hello-world/py/src/entry.py +2 -2
- package/templates/hello-world/py/src/submodule.py +2 -0
- package/templates/hello-world-durable-object/py/README.md +1 -1
- package/templates/hello-world-durable-object/py/package.json +3 -3
- package/templates/hello-world-durable-object-with-assets/py/README.md +1 -1
- package/templates/hello-world-durable-object-with-assets/py/package.json +3 -3
- package/templates/hello-world-with-assets/py/README.md +1 -1
- package/templates/hello-world-with-assets/py/package.json +3 -3
- package/templates/pre-existing/c3.ts +19 -5
- package/templates/tanstack-start/c3.ts +41 -0
- package/templates/vue/workers/js/wrangler.jsonc +1 -1
- package/templates/hello-world/py/uv.lock +0 -155
- package/templates/hello-world-durable-object/py/uv.lock +0 -155
- package/templates/hello-world-durable-object-with-assets/py/uv.lock +0 -155
- package/templates/hello-world-with-assets/py/uv.lock +0 -155
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 config45(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 config45 = 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: config45, 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 config45 = 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: config45, 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 config45 = 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: config45, data, runtime, state };
|
|
683
683
|
};
|
|
684
684
|
var XDG_ = /* @__PURE__ */ function() {
|
|
685
685
|
function XDG_2() {
|
|
@@ -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 config45 = (0, _lodash["default"])(options, this.config);
|
|
36183
|
+
if (config45.tokenHex === true) {
|
|
36184
|
+
config45.tokenChars = "0123456789abcdef";
|
|
36185
36185
|
}
|
|
36186
36186
|
var adjective = this._randomElement(this.adjectives);
|
|
36187
36187
|
var noun = this._randomElement(this.nouns);
|
|
36188
|
-
if (!
|
|
36188
|
+
if (!config45.tokenLength) config45.tokenLength = 0;
|
|
36189
36189
|
var token = "";
|
|
36190
|
-
for (var i = 0; i <
|
|
36191
|
-
token += this._randomElement(
|
|
36190
|
+
for (var i = 0; i < config45.tokenLength; i++) {
|
|
36191
|
+
token += this._randomElement(config45.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(config45.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, config45) {
|
|
44386
44386
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
44387
|
-
this.errorHandler.tolerant =
|
|
44387
|
+
this.errorHandler.tolerant = config45 ? typeof config45.tolerant === "boolean" && config45.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 = config45 ? typeof config45.comment === "boolean" && config45.comment : false;
|
|
44390
|
+
this.trackRange = config45 ? typeof config45.range === "boolean" && config45.range : false;
|
|
44391
|
+
this.trackLoc = config45 ? typeof config45.loc === "boolean" && config45.loc : false;
|
|
44392
44392
|
this.buffer = [];
|
|
44393
44393
|
this.reader = new Reader();
|
|
44394
44394
|
}
|
|
@@ -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(config45) {
|
|
54478
54478
|
assert_1.default.ok(this instanceof Printer2);
|
|
54479
|
-
var explicitTabWidth =
|
|
54480
|
-
|
|
54481
|
-
|
|
54479
|
+
var explicitTabWidth = config45 && config45.tabWidth;
|
|
54480
|
+
config45 = options_1.normalize(config45);
|
|
54481
|
+
config45.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 = config45.tabWidth;
|
|
54497
54497
|
if (!explicitTabWidth) {
|
|
54498
54498
|
var loc = path6.getNode().loc;
|
|
54499
54499
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
54500
|
-
|
|
54500
|
+
config45.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, config45, options, makePrintFunctionWith(options, {
|
|
54515
54515
|
includeComments: true,
|
|
54516
54516
|
avoidRootParens: false
|
|
54517
54517
|
}));
|
|
54518
|
-
|
|
54518
|
+
config45.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(config45), util.composeSourceMaps(config45.inputSourceMap, lines.getSourceMap(config45.sourceMapName, config45.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, config45, {
|
|
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 = config45.reuseWhitespace;
|
|
54545
|
+
config45.reuseWhitespace = false;
|
|
54546
|
+
var pr = new PrintResult(printGenerically(path6).toString(config45));
|
|
54547
|
+
config45.reuseWhitespace = oldReuseWhitespace;
|
|
54548
54548
|
return pr;
|
|
54549
54549
|
};
|
|
54550
54550
|
};
|
|
54551
54551
|
exports2.Printer = Printer;
|
|
54552
|
-
function genericPrint(path6,
|
|
54552
|
+
function genericPrint(path6, config45, 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, config45, printPath);
|
|
54557
54557
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
54558
54558
|
return linesWithoutParens;
|
|
54559
54559
|
}
|
|
@@ -72103,7 +72103,7 @@ __export(cli_exports, {
|
|
|
72103
72103
|
setupProjectDirectory: () => setupProjectDirectory
|
|
72104
72104
|
});
|
|
72105
72105
|
module.exports = __toCommonJS(cli_exports);
|
|
72106
|
-
var
|
|
72106
|
+
var import_fs15 = require("fs");
|
|
72107
72107
|
var import_path16 = require("path");
|
|
72108
72108
|
var import_process2 = require("process");
|
|
72109
72109
|
|
|
@@ -74133,33 +74133,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
74133
74133
|
}
|
|
74134
74134
|
return input;
|
|
74135
74135
|
};
|
|
74136
|
-
var renderSubmit = (
|
|
74137
|
-
const { question, label } =
|
|
74138
|
-
if (
|
|
74136
|
+
var renderSubmit = (config45, value) => {
|
|
74137
|
+
const { question, label } = config45;
|
|
74138
|
+
if (config45.type !== "confirm" && !value) {
|
|
74139
74139
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
74140
74140
|
}
|
|
74141
|
-
const content =
|
|
74141
|
+
const content = config45.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
74142
74142
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
74143
74143
|
};
|
|
74144
|
-
var getRenderers = (
|
|
74145
|
-
switch (
|
|
74144
|
+
var getRenderers = (config45) => {
|
|
74145
|
+
switch (config45.type) {
|
|
74146
74146
|
case "select":
|
|
74147
|
-
return getSelectRenderers(
|
|
74147
|
+
return getSelectRenderers(config45);
|
|
74148
74148
|
case "confirm":
|
|
74149
|
-
return getConfirmRenderers(
|
|
74149
|
+
return getConfirmRenderers(config45);
|
|
74150
74150
|
case "text":
|
|
74151
|
-
return getTextRenderers(
|
|
74151
|
+
return getTextRenderers(config45);
|
|
74152
74152
|
case "multiselect":
|
|
74153
|
-
return getSelectRenderers(
|
|
74153
|
+
return getSelectRenderers(config45);
|
|
74154
74154
|
case "list":
|
|
74155
|
-
return getSelectListRenderers(
|
|
74155
|
+
return getSelectListRenderers(config45);
|
|
74156
74156
|
}
|
|
74157
74157
|
};
|
|
74158
|
-
var getTextRenderers = (
|
|
74159
|
-
const { question } =
|
|
74160
|
-
const helpText =
|
|
74161
|
-
const format5 =
|
|
74162
|
-
const defaultValue =
|
|
74158
|
+
var getTextRenderers = (config45) => {
|
|
74159
|
+
const { question } = config45;
|
|
74160
|
+
const helpText = config45.helpText ?? "";
|
|
74161
|
+
const format5 = config45.format ?? ((val) => String(val));
|
|
74162
|
+
const defaultValue = config45.defaultValue?.toString() ?? "";
|
|
74163
74163
|
const activeRenderer = (props) => {
|
|
74164
74164
|
const { valueWithCursor } = props;
|
|
74165
74165
|
return [
|
|
@@ -74185,14 +74185,14 @@ var getTextRenderers = (config44) => {
|
|
|
74185
74185
|
``
|
|
74186
74186
|
// extra line for readability
|
|
74187
74187
|
],
|
|
74188
|
-
submit: ({ value }) => renderSubmit(
|
|
74188
|
+
submit: ({ value }) => renderSubmit(config45, format5(value ?? "")),
|
|
74189
74189
|
cancel: activeRenderer
|
|
74190
74190
|
};
|
|
74191
74191
|
};
|
|
74192
|
-
var getSelectRenderers = (
|
|
74193
|
-
const { options, question, helpText: _helpText } =
|
|
74192
|
+
var getSelectRenderers = (config45) => {
|
|
74193
|
+
const { options, question, helpText: _helpText } = config45;
|
|
74194
74194
|
const helpText = _helpText ?? "";
|
|
74195
|
-
const maxItemsPerPage =
|
|
74195
|
+
const maxItemsPerPage = config45.maxItemsPerPage ?? 32;
|
|
74196
74196
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
74197
74197
|
const renderOption = (opt, i) => {
|
|
74198
74198
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -74267,21 +74267,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
74267
74267
|
submit: ({ value }) => {
|
|
74268
74268
|
if (Array.isArray(value)) {
|
|
74269
74269
|
return renderSubmit(
|
|
74270
|
-
|
|
74270
|
+
config45,
|
|
74271
74271
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
74272
74272
|
);
|
|
74273
74273
|
}
|
|
74274
74274
|
return renderSubmit(
|
|
74275
|
-
|
|
74275
|
+
config45,
|
|
74276
74276
|
options.find((o) => o.value === value)?.label
|
|
74277
74277
|
);
|
|
74278
74278
|
},
|
|
74279
74279
|
cancel: defaultRenderer
|
|
74280
74280
|
};
|
|
74281
74281
|
};
|
|
74282
|
-
var getSelectListRenderers = (
|
|
74283
|
-
const { question, helpText: _helpText } =
|
|
74284
|
-
let options =
|
|
74282
|
+
var getSelectListRenderers = (config45) => {
|
|
74283
|
+
const { question, helpText: _helpText } = config45;
|
|
74284
|
+
let options = config45.options;
|
|
74285
74285
|
const helpText = _helpText ?? "";
|
|
74286
74286
|
const { rows } = stdout;
|
|
74287
74287
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -74362,20 +74362,20 @@ var getSelectListRenderers = (config44) => {
|
|
|
74362
74362
|
submit: ({ value }) => {
|
|
74363
74363
|
if (Array.isArray(value)) {
|
|
74364
74364
|
return renderSubmit(
|
|
74365
|
-
|
|
74365
|
+
config45,
|
|
74366
74366
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
74367
74367
|
);
|
|
74368
74368
|
}
|
|
74369
74369
|
return renderSubmit(
|
|
74370
|
-
|
|
74370
|
+
config45,
|
|
74371
74371
|
options.find((o) => o.value === value)?.value
|
|
74372
74372
|
);
|
|
74373
74373
|
},
|
|
74374
74374
|
cancel: defaultRenderer
|
|
74375
74375
|
};
|
|
74376
74376
|
};
|
|
74377
|
-
var getConfirmRenderers = (
|
|
74378
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
74377
|
+
var getConfirmRenderers = (config45) => {
|
|
74378
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config45;
|
|
74379
74379
|
const helpText = _helpText ?? "";
|
|
74380
74380
|
const active = activeText || "Yes";
|
|
74381
74381
|
const inactive = inactiveText || "No";
|
|
@@ -74392,7 +74392,7 @@ var getConfirmRenderers = (config44) => {
|
|
|
74392
74392
|
active: defaultRenderer,
|
|
74393
74393
|
confirm: defaultRenderer,
|
|
74394
74394
|
error: defaultRenderer,
|
|
74395
|
-
submit: ({ value }) => renderSubmit(
|
|
74395
|
+
submit: ({ value }) => renderSubmit(config45, value ? "yes" : "no"),
|
|
74396
74396
|
cancel: defaultRenderer
|
|
74397
74397
|
};
|
|
74398
74398
|
};
|
|
@@ -75360,23 +75360,23 @@ var YargsParser = class {
|
|
|
75360
75360
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
75361
75361
|
if (configPath) {
|
|
75362
75362
|
try {
|
|
75363
|
-
let
|
|
75363
|
+
let config45 = null;
|
|
75364
75364
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
75365
75365
|
const resolveConfig = flags.configs[configKey];
|
|
75366
75366
|
if (typeof resolveConfig === "function") {
|
|
75367
75367
|
try {
|
|
75368
|
-
|
|
75368
|
+
config45 = resolveConfig(resolvedConfigPath);
|
|
75369
75369
|
} catch (e) {
|
|
75370
|
-
|
|
75370
|
+
config45 = e;
|
|
75371
75371
|
}
|
|
75372
|
-
if (
|
|
75373
|
-
error2 =
|
|
75372
|
+
if (config45 instanceof Error) {
|
|
75373
|
+
error2 = config45;
|
|
75374
75374
|
return;
|
|
75375
75375
|
}
|
|
75376
75376
|
} else {
|
|
75377
|
-
|
|
75377
|
+
config45 = mixin2.require(resolvedConfigPath);
|
|
75378
75378
|
}
|
|
75379
|
-
setConfigObject(
|
|
75379
|
+
setConfigObject(config45);
|
|
75380
75380
|
} catch (ex) {
|
|
75381
75381
|
if (ex.name === "PermissionDenied")
|
|
75382
75382
|
error2 = ex;
|
|
@@ -75386,9 +75386,9 @@ var YargsParser = class {
|
|
|
75386
75386
|
}
|
|
75387
75387
|
});
|
|
75388
75388
|
}
|
|
75389
|
-
function setConfigObject(
|
|
75390
|
-
Object.keys(
|
|
75391
|
-
const value =
|
|
75389
|
+
function setConfigObject(config45, prev) {
|
|
75390
|
+
Object.keys(config45).forEach(function(key) {
|
|
75391
|
+
const value = config45[key];
|
|
75392
75392
|
const fullKey = prev ? prev + "." + key : key;
|
|
75393
75393
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
75394
75394
|
setConfigObject(value, fullKey);
|
|
@@ -76540,11 +76540,11 @@ var CommandInstance = class {
|
|
|
76540
76540
|
});
|
|
76541
76541
|
if (!unparsed.length)
|
|
76542
76542
|
return;
|
|
76543
|
-
const
|
|
76543
|
+
const config45 = Object.assign({}, options.configuration, {
|
|
76544
76544
|
"populate--": false
|
|
76545
76545
|
});
|
|
76546
76546
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
76547
|
-
configuration:
|
|
76547
|
+
configuration: config45
|
|
76548
76548
|
}));
|
|
76549
76549
|
if (parsed.error) {
|
|
76550
76550
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -77767,31 +77767,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
77767
77767
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
77768
77768
|
var previouslyVisitedConfigs = [];
|
|
77769
77769
|
var shim2;
|
|
77770
|
-
function applyExtends(
|
|
77770
|
+
function applyExtends(config45, cwd, mergeExtends, _shim) {
|
|
77771
77771
|
shim2 = _shim;
|
|
77772
77772
|
let defaultConfig = {};
|
|
77773
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
77774
|
-
if (typeof
|
|
77773
|
+
if (Object.prototype.hasOwnProperty.call(config45, "extends")) {
|
|
77774
|
+
if (typeof config45.extends !== "string")
|
|
77775
77775
|
return defaultConfig;
|
|
77776
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
77776
|
+
const isPath = /\.json|\..*rc$/.test(config45.extends);
|
|
77777
77777
|
let pathToDefault = null;
|
|
77778
77778
|
if (!isPath) {
|
|
77779
77779
|
try {
|
|
77780
|
-
pathToDefault = require.resolve(
|
|
77780
|
+
pathToDefault = require.resolve(config45.extends);
|
|
77781
77781
|
} catch (_err) {
|
|
77782
|
-
return
|
|
77782
|
+
return config45;
|
|
77783
77783
|
}
|
|
77784
77784
|
} else {
|
|
77785
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
77785
|
+
pathToDefault = getPathToDefaultConfig(cwd, config45.extends);
|
|
77786
77786
|
}
|
|
77787
77787
|
checkForCircularExtends(pathToDefault);
|
|
77788
77788
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
77789
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
77790
|
-
delete
|
|
77789
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config45.extends);
|
|
77790
|
+
delete config45.extends;
|
|
77791
77791
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
77792
77792
|
}
|
|
77793
77793
|
previouslyVisitedConfigs = [];
|
|
77794
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
77794
|
+
return mergeExtends ? mergeDeep(defaultConfig, config45) : Object.assign({}, defaultConfig, config45);
|
|
77795
77795
|
}
|
|
77796
77796
|
function checkForCircularExtends(cfgPath) {
|
|
77797
77797
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -78567,9 +78567,9 @@ var YargsInstance = class {
|
|
|
78567
78567
|
}
|
|
78568
78568
|
return maybePromise;
|
|
78569
78569
|
}
|
|
78570
|
-
parserConfiguration(
|
|
78571
|
-
argsert("<object>", [
|
|
78572
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
78570
|
+
parserConfiguration(config45) {
|
|
78571
|
+
argsert("<object>", [config45], arguments.length);
|
|
78572
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config45, "f");
|
|
78573
78573
|
return this;
|
|
78574
78574
|
}
|
|
78575
78575
|
pkgConf(key, rootPath) {
|
|
@@ -78741,9 +78741,9 @@ var YargsInstance = class {
|
|
|
78741
78741
|
return this;
|
|
78742
78742
|
}
|
|
78743
78743
|
}
|
|
78744
|
-
usageConfiguration(
|
|
78745
|
-
argsert("<object>", [
|
|
78746
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
78744
|
+
usageConfiguration(config45) {
|
|
78745
|
+
argsert("<object>", [config45], arguments.length);
|
|
78746
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config45, "f");
|
|
78747
78747
|
return this;
|
|
78748
78748
|
}
|
|
78749
78749
|
version(opt, msg, ver) {
|
|
@@ -79149,11 +79149,11 @@ var YargsInstance = class {
|
|
|
79149
79149
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
79150
79150
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
79151
79151
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
79152
|
-
const
|
|
79152
|
+
const config45 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
79153
79153
|
"populate--": true
|
|
79154
79154
|
});
|
|
79155
79155
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
79156
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
79156
|
+
configuration: { "parse-positional-numbers": false, ...config45 }
|
|
79157
79157
|
}));
|
|
79158
79158
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
79159
79159
|
let argvPromise = void 0;
|
|
@@ -79316,7 +79316,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
79316
79316
|
var yargs_default = Yargs;
|
|
79317
79317
|
|
|
79318
79318
|
// package.json
|
|
79319
|
-
var version = "2.
|
|
79319
|
+
var version = "2.54.0";
|
|
79320
79320
|
|
|
79321
79321
|
// src/metrics.ts
|
|
79322
79322
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -79360,12 +79360,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
79360
79360
|
}
|
|
79361
79361
|
|
|
79362
79362
|
// src/helpers/metrics-config.ts
|
|
79363
|
-
function writeMetricsConfig(
|
|
79363
|
+
function writeMetricsConfig(config45) {
|
|
79364
79364
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
79365
79365
|
(0, import_node_fs2.writeFileSync)(
|
|
79366
79366
|
getMetricsConfigPath(),
|
|
79367
79367
|
JSON.stringify(
|
|
79368
|
-
|
|
79368
|
+
config45,
|
|
79369
79369
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
79370
79370
|
" "
|
|
79371
79371
|
)
|
|
@@ -79373,9 +79373,9 @@ function writeMetricsConfig(config44) {
|
|
|
79373
79373
|
}
|
|
79374
79374
|
function readMetricsConfig() {
|
|
79375
79375
|
try {
|
|
79376
|
-
const
|
|
79376
|
+
const config45 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
79377
79377
|
return JSON.parse(
|
|
79378
|
-
|
|
79378
|
+
config45,
|
|
79379
79379
|
(key, value) => key === "date" ? new Date(value) : value
|
|
79380
79380
|
);
|
|
79381
79381
|
} catch {
|
|
@@ -79385,10 +79385,10 @@ function readMetricsConfig() {
|
|
|
79385
79385
|
function getMetricsConfigPath() {
|
|
79386
79386
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
79387
79387
|
}
|
|
79388
|
-
function getDeviceId(
|
|
79389
|
-
const deviceId =
|
|
79390
|
-
if (
|
|
79391
|
-
writeMetricsConfig({ ...
|
|
79388
|
+
function getDeviceId(config45) {
|
|
79389
|
+
const deviceId = config45.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
79390
|
+
if (config45.deviceId === void 0) {
|
|
79391
|
+
writeMetricsConfig({ ...config45, deviceId });
|
|
79392
79392
|
}
|
|
79393
79393
|
return deviceId;
|
|
79394
79394
|
}
|
|
@@ -79601,7 +79601,7 @@ var detectPackageManager = () => {
|
|
|
79601
79601
|
}
|
|
79602
79602
|
};
|
|
79603
79603
|
var rectifyPmMismatch = async (ctx) => {
|
|
79604
|
-
const { npm:
|
|
79604
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79605
79605
|
if (!detectPmMismatch(ctx)) {
|
|
79606
79606
|
return;
|
|
79607
79607
|
}
|
|
@@ -79613,17 +79613,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
79613
79613
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
79614
79614
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
79615
79615
|
}
|
|
79616
|
-
await runCommand([
|
|
79616
|
+
await runCommand([npm23, "install"], {
|
|
79617
79617
|
silent: true,
|
|
79618
79618
|
cwd: ctx.project.path,
|
|
79619
79619
|
startText: "Installing dependencies",
|
|
79620
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
79620
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm23} install\``)}`
|
|
79621
79621
|
});
|
|
79622
79622
|
};
|
|
79623
79623
|
var detectPmMismatch = (ctx) => {
|
|
79624
|
-
const { npm:
|
|
79624
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79625
79625
|
const projectPath = ctx.project.path;
|
|
79626
|
-
switch (
|
|
79626
|
+
switch (npm23) {
|
|
79627
79627
|
case "npm":
|
|
79628
79628
|
return false;
|
|
79629
79629
|
case "yarn":
|
|
@@ -79691,10 +79691,10 @@ function getPlatform() {
|
|
|
79691
79691
|
function createReporter() {
|
|
79692
79692
|
const events = [];
|
|
79693
79693
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
79694
|
-
const
|
|
79695
|
-
const isFirstUsage =
|
|
79694
|
+
const config45 = readMetricsConfig() ?? {};
|
|
79695
|
+
const isFirstUsage = config45.c3permission === void 0;
|
|
79696
79696
|
const isEnabled = isTelemetryEnabled();
|
|
79697
|
-
const deviceId = getDeviceId(
|
|
79697
|
+
const deviceId = getDeviceId(config45);
|
|
79698
79698
|
const packageManager = detectPackageManager();
|
|
79699
79699
|
const platform = getPlatform();
|
|
79700
79700
|
const amplitude_session_id = Date.now();
|
|
@@ -79727,7 +79727,7 @@ function createReporter() {
|
|
|
79727
79727
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
79728
79728
|
return false;
|
|
79729
79729
|
}
|
|
79730
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
79730
|
+
return hasSparrowSourceKey() && getC3Permission(config45).enabled;
|
|
79731
79731
|
}
|
|
79732
79732
|
async function waitForAllEventsSettled() {
|
|
79733
79733
|
await Promise.allSettled(events);
|
|
@@ -79833,20 +79833,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
79833
79833
|
date: /* @__PURE__ */ new Date()
|
|
79834
79834
|
};
|
|
79835
79835
|
}
|
|
79836
|
-
function getC3Permission(
|
|
79837
|
-
if (!
|
|
79838
|
-
|
|
79839
|
-
writeMetricsConfig(
|
|
79836
|
+
function getC3Permission(config45 = readMetricsConfig() ?? {}) {
|
|
79837
|
+
if (!config45.c3permission) {
|
|
79838
|
+
config45.c3permission = initializeC3Permission();
|
|
79839
|
+
writeMetricsConfig(config45);
|
|
79840
79840
|
}
|
|
79841
|
-
return
|
|
79841
|
+
return config45.c3permission;
|
|
79842
79842
|
}
|
|
79843
79843
|
function updateC3Pemission(enabled) {
|
|
79844
|
-
const
|
|
79845
|
-
if (
|
|
79844
|
+
const config45 = readMetricsConfig();
|
|
79845
|
+
if (config45.c3permission?.enabled === enabled) {
|
|
79846
79846
|
return;
|
|
79847
79847
|
}
|
|
79848
|
-
|
|
79849
|
-
writeMetricsConfig(
|
|
79848
|
+
config45.c3permission = initializeC3Permission(enabled);
|
|
79849
|
+
writeMetricsConfig(config45);
|
|
79850
79850
|
}
|
|
79851
79851
|
var runTelemetryCommand = (action) => {
|
|
79852
79852
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -79877,7 +79877,7 @@ var runTelemetryCommand = (action) => {
|
|
|
79877
79877
|
};
|
|
79878
79878
|
|
|
79879
79879
|
// src/templates.ts
|
|
79880
|
-
var
|
|
79880
|
+
var import_fs12 = require("fs");
|
|
79881
79881
|
var import_promises4 = require("fs/promises");
|
|
79882
79882
|
var import_os2 = require("os");
|
|
79883
79883
|
var import_path12 = require("path");
|
|
@@ -79952,49 +79952,49 @@ var hasTsConfig = (path6) => {
|
|
|
79952
79952
|
};
|
|
79953
79953
|
|
|
79954
79954
|
// src/helpers/packages.ts
|
|
79955
|
-
var installPackages = async (packages,
|
|
79955
|
+
var installPackages = async (packages, config45 = {}) => {
|
|
79956
79956
|
if (packages.length === 0) {
|
|
79957
79957
|
return;
|
|
79958
79958
|
}
|
|
79959
|
-
const { npm:
|
|
79959
|
+
const { npm: npm23 } = detectPackageManager();
|
|
79960
79960
|
let saveFlag;
|
|
79961
79961
|
let cmd;
|
|
79962
|
-
switch (
|
|
79962
|
+
switch (npm23) {
|
|
79963
79963
|
case "yarn":
|
|
79964
79964
|
cmd = "add";
|
|
79965
|
-
saveFlag =
|
|
79965
|
+
saveFlag = config45.dev ? "-D" : "";
|
|
79966
79966
|
break;
|
|
79967
79967
|
case "bun":
|
|
79968
79968
|
cmd = "add";
|
|
79969
|
-
saveFlag =
|
|
79969
|
+
saveFlag = config45.dev ? "-d" : "";
|
|
79970
79970
|
break;
|
|
79971
79971
|
case "npm":
|
|
79972
79972
|
case "pnpm":
|
|
79973
79973
|
default:
|
|
79974
79974
|
cmd = "install";
|
|
79975
|
-
saveFlag =
|
|
79975
|
+
saveFlag = config45.dev ? "--save-dev" : "";
|
|
79976
79976
|
break;
|
|
79977
79977
|
}
|
|
79978
79978
|
await runCommand(
|
|
79979
79979
|
[
|
|
79980
|
-
|
|
79980
|
+
npm23,
|
|
79981
79981
|
cmd,
|
|
79982
79982
|
...saveFlag ? [saveFlag] : [],
|
|
79983
79983
|
...packages,
|
|
79984
79984
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
79985
79985
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
79986
79986
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
79987
|
-
...
|
|
79987
|
+
...npm23 === "npm" ? ["--legacy-peer-deps"] : []
|
|
79988
79988
|
],
|
|
79989
79989
|
{
|
|
79990
|
-
...
|
|
79990
|
+
...config45,
|
|
79991
79991
|
silent: true
|
|
79992
79992
|
}
|
|
79993
79993
|
);
|
|
79994
|
-
if (
|
|
79994
|
+
if (npm23 === "npm") {
|
|
79995
79995
|
const pkgJsonPath = import_path7.default.join(process.cwd(), "package.json");
|
|
79996
79996
|
const pkgJson = readJSON(pkgJsonPath);
|
|
79997
|
-
const deps =
|
|
79997
|
+
const deps = config45.dev ? pkgJson.devDependencies : pkgJson.dependencies;
|
|
79998
79998
|
(0, import_assert2.default)(deps, "dependencies should be defined");
|
|
79999
79999
|
for (const pkg of packages) {
|
|
80000
80000
|
const versionMarker = pkg.lastIndexOf("@");
|
|
@@ -80014,16 +80014,16 @@ var npmInstall = async (ctx) => {
|
|
|
80014
80014
|
if ((0, import_fs7.existsSync)(nodeModulesPath)) {
|
|
80015
80015
|
return;
|
|
80016
80016
|
}
|
|
80017
|
-
const { npm:
|
|
80017
|
+
const { npm: npm23 } = detectPackageManager();
|
|
80018
80018
|
await runCommand(
|
|
80019
80019
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
80020
80020
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
80021
80021
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
80022
|
-
[
|
|
80022
|
+
[npm23, "install", ...npm23 === "npm" ? ["--legacy-peer-deps"] : []],
|
|
80023
80023
|
{
|
|
80024
80024
|
silent: true,
|
|
80025
80025
|
startText: "Installing dependencies",
|
|
80026
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
80026
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm23} install\``)}`
|
|
80027
80027
|
}
|
|
80028
80028
|
);
|
|
80029
80029
|
};
|
|
@@ -80033,14 +80033,14 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
80033
80033
|
return npmInfo["dist-tags"].latest;
|
|
80034
80034
|
}
|
|
80035
80035
|
var installWrangler = async () => {
|
|
80036
|
-
const { npm:
|
|
80036
|
+
const { npm: npm23 } = detectPackageManager();
|
|
80037
80037
|
await installPackages([`wrangler@latest`], {
|
|
80038
80038
|
dev: true,
|
|
80039
80039
|
startText: `Installing wrangler ${dim(
|
|
80040
80040
|
"A command line tool for building Cloudflare Workers"
|
|
80041
80041
|
)}`,
|
|
80042
80042
|
doneText: `${brandColor("installed")} ${dim(
|
|
80043
|
-
`via \`${
|
|
80043
|
+
`via \`${npm23} install wrangler --save-dev\``
|
|
80044
80044
|
)}`
|
|
80045
80045
|
});
|
|
80046
80046
|
};
|
|
@@ -80100,19 +80100,20 @@ var package_default = {
|
|
|
80100
80100
|
dependencies: {
|
|
80101
80101
|
"create-astro": "4.13.1",
|
|
80102
80102
|
"create-analog": "1.8.1",
|
|
80103
|
-
"@angular/create": "20.3.
|
|
80103
|
+
"@angular/create": "20.3.6",
|
|
80104
80104
|
"create-docusaurus": "3.9.1",
|
|
80105
80105
|
"create-hono": "0.19.2",
|
|
80106
80106
|
"create-next-app": "15.4.6",
|
|
80107
|
-
"create-qwik": "1.
|
|
80107
|
+
"create-qwik": "1.17.0",
|
|
80108
80108
|
"create-vite": "7.1.1",
|
|
80109
|
-
"create-react-router": "7.9.
|
|
80109
|
+
"create-react-router": "7.9.4",
|
|
80110
80110
|
"create-solid": "0.6.11",
|
|
80111
80111
|
"create-vue": "3.18.1",
|
|
80112
80112
|
"create-waku": "0.12.5-0.26.1-0",
|
|
80113
|
+
"@tanstack/create-start": "0.34.2",
|
|
80113
80114
|
gatsby: "5.15.0",
|
|
80114
|
-
sv: "0.9.
|
|
80115
|
-
nuxi: "3.
|
|
80115
|
+
sv: "0.9.8",
|
|
80116
|
+
nuxi: "3.29.3"
|
|
80116
80117
|
}
|
|
80117
80118
|
};
|
|
80118
80119
|
|
|
@@ -80127,9 +80128,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
80127
80128
|
};
|
|
80128
80129
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
80129
80130
|
const cli = getFrameworkCli(ctx, true);
|
|
80130
|
-
const { npm:
|
|
80131
|
-
const cmd = [...
|
|
80132
|
-
const env3 =
|
|
80131
|
+
const { npm: npm23, dlx } = detectPackageManager();
|
|
80132
|
+
const cmd = [...npm23 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
80133
|
+
const env3 = npm23 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
80133
80134
|
if (ctx.args.additionalArgs?.length) {
|
|
80134
80135
|
cmd.push(...ctx.args.additionalArgs);
|
|
80135
80136
|
}
|
|
@@ -80951,14 +80952,12 @@ var c3_default20 = {
|
|
|
80951
80952
|
platform: "workers",
|
|
80952
80953
|
async configure(ctx) {
|
|
80953
80954
|
if (ctx.args.lang === "python") {
|
|
80954
|
-
|
|
80955
|
-
|
|
80956
|
-
|
|
80957
|
-
|
|
80958
|
-
|
|
80959
|
-
|
|
80960
|
-
await (0, import_promises2.writeFile)((0, import_node_path5.resolve)(ctx.project.path, file), updated);
|
|
80961
|
-
}
|
|
80955
|
+
const contents = await (0, import_promises2.readFile)(
|
|
80956
|
+
(0, import_node_path5.resolve)(ctx.project.path, "pyproject.toml"),
|
|
80957
|
+
"utf8"
|
|
80958
|
+
);
|
|
80959
|
+
const updated = contents.replaceAll(/<TBD>/g, ctx.project.name);
|
|
80960
|
+
await (0, import_promises2.writeFile)((0, import_node_path5.resolve)(ctx.project.path, "pyproject.toml"), updated);
|
|
80962
80961
|
}
|
|
80963
80962
|
},
|
|
80964
80963
|
copyFiles: {
|
|
@@ -81323,6 +81322,7 @@ var config25 = {
|
|
|
81323
81322
|
var c3_default28 = config25;
|
|
81324
81323
|
|
|
81325
81324
|
// templates/pre-existing/c3.ts
|
|
81325
|
+
var import_fs9 = require("fs");
|
|
81326
81326
|
var import_promises3 = require("fs/promises");
|
|
81327
81327
|
var import_os = require("os");
|
|
81328
81328
|
var import_path9 = require("path");
|
|
@@ -81465,10 +81465,21 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
81465
81465
|
(0, import_path9.join)(ctx.project.path, "src"),
|
|
81466
81466
|
{ recursive: true }
|
|
81467
81467
|
);
|
|
81468
|
-
|
|
81469
|
-
|
|
81470
|
-
|
|
81471
|
-
|
|
81468
|
+
const configFiles = ["wrangler.jsonc", "wrangler.json", "wrangler.toml"];
|
|
81469
|
+
let configFileCopied = false;
|
|
81470
|
+
for (const configFile of configFiles) {
|
|
81471
|
+
const sourcePath = (0, import_path9.join)(tempdir, ctx.args.existingScript, configFile);
|
|
81472
|
+
if ((0, import_fs9.existsSync)(sourcePath)) {
|
|
81473
|
+
await (0, import_promises3.cp)(sourcePath, (0, import_path9.join)(ctx.project.path, configFile));
|
|
81474
|
+
configFileCopied = true;
|
|
81475
|
+
break;
|
|
81476
|
+
}
|
|
81477
|
+
}
|
|
81478
|
+
if (!configFileCopied) {
|
|
81479
|
+
throw new Error(
|
|
81480
|
+
`No wrangler configuration file found in downloaded worker. Expected one of: ${configFiles.join(", ")}`
|
|
81481
|
+
);
|
|
81482
|
+
}
|
|
81472
81483
|
}
|
|
81473
81484
|
var config26 = {
|
|
81474
81485
|
configVersion: 1,
|
|
@@ -81893,9 +81904,9 @@ function transformViteConfig(ctx) {
|
|
|
81893
81904
|
if (callee.name !== "defineConfig") {
|
|
81894
81905
|
return this.traverse(n);
|
|
81895
81906
|
}
|
|
81896
|
-
const
|
|
81897
|
-
(0, import_assert3.default)(t.ObjectExpression.check(
|
|
81898
|
-
const pluginsProp =
|
|
81907
|
+
const config45 = n.node.arguments[0];
|
|
81908
|
+
(0, import_assert3.default)(t.ObjectExpression.check(config45));
|
|
81909
|
+
const pluginsProp = config45.properties.find((prop) => isPluginsProp(prop));
|
|
81899
81910
|
(0, import_assert3.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
81900
81911
|
pluginsProp.value.elements.push(
|
|
81901
81912
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -82012,7 +82023,7 @@ var config35 = {
|
|
|
82012
82023
|
var c3_default38 = config35;
|
|
82013
82024
|
|
|
82014
82025
|
// src/helpers/compatDate.ts
|
|
82015
|
-
var
|
|
82026
|
+
var import_fs10 = require("fs");
|
|
82016
82027
|
var import_path10 = require("path");
|
|
82017
82028
|
async function getWorkerdCompatibilityDate() {
|
|
82018
82029
|
const s = spinner();
|
|
@@ -82048,7 +82059,7 @@ function getLatestTypesEntrypoint(ctx) {
|
|
|
82048
82059
|
"workers-types"
|
|
82049
82060
|
);
|
|
82050
82061
|
try {
|
|
82051
|
-
const entrypoints = (0,
|
|
82062
|
+
const entrypoints = (0, import_fs10.readdirSync)(workersTypesPath);
|
|
82052
82063
|
const sorted = entrypoints.filter((filename) => filename.match(/(\d{4})-(\d{2})-(\d{2})/)).sort().reverse();
|
|
82053
82064
|
if (sorted.length === 0) {
|
|
82054
82065
|
return null;
|
|
@@ -82362,12 +82373,46 @@ var config39 = {
|
|
|
82362
82373
|
};
|
|
82363
82374
|
var c3_default42 = config39;
|
|
82364
82375
|
|
|
82365
|
-
// templates/
|
|
82376
|
+
// templates/tanstack-start/c3.ts
|
|
82366
82377
|
var { npm: npm18 } = detectPackageManager();
|
|
82367
82378
|
var generate23 = async (ctx) => {
|
|
82368
|
-
await runFrameworkGenerator(ctx, [
|
|
82379
|
+
await runFrameworkGenerator(ctx, [
|
|
82380
|
+
ctx.project.name,
|
|
82381
|
+
"--host",
|
|
82382
|
+
"cloudflare",
|
|
82383
|
+
"--framework",
|
|
82384
|
+
"react",
|
|
82385
|
+
// to prevent asking about git twice, just let c3 do it
|
|
82386
|
+
"--no-git"
|
|
82387
|
+
]);
|
|
82388
|
+
logRaw("");
|
|
82369
82389
|
};
|
|
82370
82390
|
var config40 = {
|
|
82391
|
+
configVersion: 1,
|
|
82392
|
+
id: "tanstack-start",
|
|
82393
|
+
platform: "workers",
|
|
82394
|
+
frameworkCli: "@tanstack/create-start",
|
|
82395
|
+
displayName: "TanStack Start",
|
|
82396
|
+
generate: generate23,
|
|
82397
|
+
transformPackageJson: async () => ({
|
|
82398
|
+
scripts: {
|
|
82399
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
82400
|
+
preview: `${npm18} run build && vite preview`,
|
|
82401
|
+
"cf-typegen": `wrangler types`
|
|
82402
|
+
}
|
|
82403
|
+
}),
|
|
82404
|
+
devScript: "dev",
|
|
82405
|
+
deployScript: "deploy",
|
|
82406
|
+
previewScript: "preview"
|
|
82407
|
+
};
|
|
82408
|
+
var c3_default43 = config40;
|
|
82409
|
+
|
|
82410
|
+
// templates/vue/pages/c3.ts
|
|
82411
|
+
var { npm: npm19 } = detectPackageManager();
|
|
82412
|
+
var generate24 = async (ctx) => {
|
|
82413
|
+
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
82414
|
+
};
|
|
82415
|
+
var config41 = {
|
|
82371
82416
|
configVersion: 1,
|
|
82372
82417
|
id: "vue",
|
|
82373
82418
|
frameworkCli: "create-vue",
|
|
@@ -82376,11 +82421,11 @@ var config40 = {
|
|
|
82376
82421
|
hidden: true,
|
|
82377
82422
|
path: "templates/vue/pages",
|
|
82378
82423
|
copyFiles: { path: "./templates" },
|
|
82379
|
-
generate:
|
|
82424
|
+
generate: generate24,
|
|
82380
82425
|
transformPackageJson: async () => ({
|
|
82381
82426
|
scripts: {
|
|
82382
|
-
deploy: `${
|
|
82383
|
-
preview: `${
|
|
82427
|
+
deploy: `${npm19} run build && wrangler pages deploy`,
|
|
82428
|
+
preview: `${npm19} run build && wrangler pages dev`,
|
|
82384
82429
|
"cf-typegen": `wrangler types`
|
|
82385
82430
|
}
|
|
82386
82431
|
}),
|
|
@@ -82388,11 +82433,11 @@ var config40 = {
|
|
|
82388
82433
|
deployScript: "deploy",
|
|
82389
82434
|
previewScript: "preview"
|
|
82390
82435
|
};
|
|
82391
|
-
var
|
|
82436
|
+
var c3_default44 = config41;
|
|
82392
82437
|
|
|
82393
82438
|
// templates/vue/workers/c3.ts
|
|
82394
|
-
var { npm:
|
|
82395
|
-
var
|
|
82439
|
+
var { npm: npm20 } = detectPackageManager();
|
|
82440
|
+
var generate25 = async (ctx) => {
|
|
82396
82441
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
82397
82442
|
type: "select",
|
|
82398
82443
|
question: "Would you like to use TypeScript?",
|
|
@@ -82430,7 +82475,7 @@ function updateTsconfigJson2() {
|
|
|
82430
82475
|
writeJSON("tsconfig.json", tsconfig);
|
|
82431
82476
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
82432
82477
|
}
|
|
82433
|
-
var
|
|
82478
|
+
var config42 = {
|
|
82434
82479
|
configVersion: 1,
|
|
82435
82480
|
id: "vue",
|
|
82436
82481
|
frameworkCli: "create-vue",
|
|
@@ -82451,11 +82496,11 @@ var config41 = {
|
|
|
82451
82496
|
}
|
|
82452
82497
|
},
|
|
82453
82498
|
configure: configure15,
|
|
82454
|
-
generate:
|
|
82499
|
+
generate: generate25,
|
|
82455
82500
|
transformPackageJson: async (_3, ctx) => ({
|
|
82456
82501
|
scripts: {
|
|
82457
|
-
deploy: `${
|
|
82458
|
-
preview: `${
|
|
82502
|
+
deploy: `${npm20} run build && wrangler deploy`,
|
|
82503
|
+
preview: `${npm20} run build && wrangler dev`,
|
|
82459
82504
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
82460
82505
|
}
|
|
82461
82506
|
}),
|
|
@@ -82463,18 +82508,18 @@ var config41 = {
|
|
|
82463
82508
|
deployScript: "deploy",
|
|
82464
82509
|
previewScript: "preview"
|
|
82465
82510
|
};
|
|
82466
|
-
var
|
|
82511
|
+
var c3_default45 = config42;
|
|
82467
82512
|
|
|
82468
82513
|
// templates/vue/c3.ts
|
|
82469
|
-
var
|
|
82514
|
+
var config43 = {
|
|
82470
82515
|
displayName: "Vue",
|
|
82471
|
-
platformVariants: { pages:
|
|
82516
|
+
platformVariants: { pages: c3_default44, workers: c3_default45 }
|
|
82472
82517
|
};
|
|
82473
|
-
var
|
|
82518
|
+
var c3_default46 = config43;
|
|
82474
82519
|
|
|
82475
82520
|
// templates/waku/c3.ts
|
|
82476
|
-
var { npm:
|
|
82477
|
-
var
|
|
82521
|
+
var { npm: npm21 } = detectPackageManager();
|
|
82522
|
+
var generate26 = async (ctx) => {
|
|
82478
82523
|
await runFrameworkGenerator(ctx, [
|
|
82479
82524
|
"--project-name",
|
|
82480
82525
|
ctx.project.name,
|
|
@@ -82482,31 +82527,31 @@ var generate25 = async (ctx) => {
|
|
|
82482
82527
|
"07_cloudflare"
|
|
82483
82528
|
]);
|
|
82484
82529
|
};
|
|
82485
|
-
var
|
|
82530
|
+
var config44 = {
|
|
82486
82531
|
configVersion: 1,
|
|
82487
82532
|
id: "waku",
|
|
82488
82533
|
frameworkCli: "create-waku",
|
|
82489
82534
|
platform: "workers",
|
|
82490
82535
|
displayName: "Waku",
|
|
82491
82536
|
path: "templates/waku",
|
|
82492
|
-
generate:
|
|
82537
|
+
generate: generate26,
|
|
82493
82538
|
transformPackageJson: async () => ({
|
|
82494
82539
|
scripts: {
|
|
82495
|
-
deploy: `${
|
|
82496
|
-
preview: `NODE_ENV=production ${
|
|
82540
|
+
deploy: `${npm21} run build && wrangler deploy`,
|
|
82541
|
+
preview: `NODE_ENV=production ${npm21} run build && wrangler dev`
|
|
82497
82542
|
}
|
|
82498
82543
|
}),
|
|
82499
82544
|
devScript: "dev",
|
|
82500
82545
|
deployScript: "deploy",
|
|
82501
82546
|
previewScript: "preview"
|
|
82502
82547
|
};
|
|
82503
|
-
var
|
|
82548
|
+
var c3_default47 = config44;
|
|
82504
82549
|
|
|
82505
82550
|
// src/git.ts
|
|
82506
82551
|
var import_node_assert2 = __toESM(require("node:assert"));
|
|
82507
82552
|
|
|
82508
82553
|
// ../wrangler/package.json
|
|
82509
|
-
var version2 = "4.
|
|
82554
|
+
var version2 = "4.45.0";
|
|
82510
82555
|
|
|
82511
82556
|
// src/git.ts
|
|
82512
82557
|
var offerGit = async (ctx) => {
|
|
@@ -82560,7 +82605,7 @@ var gitCommit = async (ctx) => {
|
|
|
82560
82605
|
silent: true,
|
|
82561
82606
|
cwd: ctx.project.path
|
|
82562
82607
|
});
|
|
82563
|
-
await runCommand(["git", "commit", "-m", ctx.commitMessage], {
|
|
82608
|
+
await runCommand(["git", "commit", "-m", ctx.commitMessage, "--no-verify"], {
|
|
82564
82609
|
silent: true,
|
|
82565
82610
|
cwd: ctx.project.path
|
|
82566
82611
|
});
|
|
@@ -82684,7 +82729,7 @@ async function getProductionBranch(cwd) {
|
|
|
82684
82729
|
}
|
|
82685
82730
|
|
|
82686
82731
|
// src/validators.ts
|
|
82687
|
-
var
|
|
82732
|
+
var import_fs11 = require("fs");
|
|
82688
82733
|
var import_path11 = require("path");
|
|
82689
82734
|
var TEMPLATE_REGEX = /^(?:(?:https:\/\/)?(?<httpsUrl>[^:/]+\.[^:/]+)\/|git@(?<gitUrl>[^:/]+)[:/]|(?<shorthandUrl>[^/]+):)?(?<user>[^/\s]+)\/(?<repository>[^/\s#]+)(?:(?<subdirectoryPath>(?:\/[^/\s#]+)+))?(?:\/)?(?:#(?<tag>.+))?/;
|
|
82690
82735
|
var validateTemplateUrl = (value) => {
|
|
@@ -82694,9 +82739,9 @@ var validateTemplateUrl = (value) => {
|
|
|
82694
82739
|
};
|
|
82695
82740
|
var validateProjectDirectory = (relativePath, args) => {
|
|
82696
82741
|
const path6 = (0, import_path11.resolve)(relativePath);
|
|
82697
|
-
const existsAlready = (0,
|
|
82742
|
+
const existsAlready = (0, import_fs11.existsSync)(path6);
|
|
82698
82743
|
if (existsAlready) {
|
|
82699
|
-
for (const file of (0,
|
|
82744
|
+
for (const file of (0, import_fs11.readdirSync)(path6)) {
|
|
82700
82745
|
if (!isAllowedExistingFile(file)) {
|
|
82701
82746
|
return `Directory \`${relativePath}\` already exists and contains files that might conflict. Please choose a new name.`;
|
|
82702
82747
|
}
|
|
@@ -82784,8 +82829,9 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
82784
82829
|
"react-router": c3_default34,
|
|
82785
82830
|
solid: c3_default39,
|
|
82786
82831
|
svelte: c3_default42,
|
|
82787
|
-
|
|
82788
|
-
|
|
82832
|
+
"tanstack-start": c3_default43,
|
|
82833
|
+
vue: c3_default46,
|
|
82834
|
+
waku: c3_default47
|
|
82789
82835
|
};
|
|
82790
82836
|
}
|
|
82791
82837
|
}
|
|
@@ -82980,10 +83026,10 @@ var createContext = async (args, prevArgs) => {
|
|
|
82980
83026
|
let template;
|
|
82981
83027
|
if (category === "web-framework") {
|
|
82982
83028
|
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
82983
|
-
(acc, [key,
|
|
82984
|
-
if (!
|
|
83029
|
+
(acc, [key, config45]) => {
|
|
83030
|
+
if (!config45.hidden || args.framework) {
|
|
82985
83031
|
acc.push({
|
|
82986
|
-
label:
|
|
83032
|
+
label: config45.displayName,
|
|
82987
83033
|
value: key
|
|
82988
83034
|
});
|
|
82989
83035
|
}
|
|
@@ -83009,7 +83055,7 @@ var createContext = async (args, prevArgs) => {
|
|
|
83009
83055
|
if ("platformVariants" in frameworkConfig) {
|
|
83010
83056
|
const availableVariants = Object.entries(
|
|
83011
83057
|
frameworkConfig.platformVariants
|
|
83012
|
-
).filter(([,
|
|
83058
|
+
).filter(([, config45]) => !config45.hidden);
|
|
83013
83059
|
if (availableVariants.length === 1) {
|
|
83014
83060
|
args.platform ??= availableVariants[0][0];
|
|
83015
83061
|
}
|
|
@@ -83152,7 +83198,7 @@ async function copyTemplateFiles(ctx) {
|
|
|
83152
83198
|
s.start(`Copying template files`);
|
|
83153
83199
|
await (0, import_promises4.cp)(srcdir, destdir, { recursive: true, force: true });
|
|
83154
83200
|
const dummyGitIgnorePath = (0, import_path12.join)(destdir, "__dot__gitignore");
|
|
83155
|
-
if ((0,
|
|
83201
|
+
if ((0, import_fs12.existsSync)(dummyGitIgnorePath)) {
|
|
83156
83202
|
await (0, import_promises4.rename)(dummyGitIgnorePath, (0, import_path12.join)(destdir, ".gitignore"));
|
|
83157
83203
|
}
|
|
83158
83204
|
s.stop(`${brandColor("files")} ${dim("copied to project directory")}`);
|
|
@@ -83170,39 +83216,39 @@ var processRemoteTemplate = async (args) => {
|
|
|
83170
83216
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
83171
83217
|
}
|
|
83172
83218
|
const path6 = await downloadRemoteTemplate(src, args.templateMode);
|
|
83173
|
-
const
|
|
83174
|
-
validateTemplate(path6,
|
|
83219
|
+
const config45 = inferTemplateConfig(path6);
|
|
83220
|
+
validateTemplate(path6, config45);
|
|
83175
83221
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
83176
83222
|
return {
|
|
83177
83223
|
path: path6,
|
|
83178
|
-
...
|
|
83224
|
+
...config45
|
|
83179
83225
|
};
|
|
83180
83226
|
};
|
|
83181
|
-
var validateTemplate = (path6,
|
|
83182
|
-
if (!
|
|
83227
|
+
var validateTemplate = (path6, config45) => {
|
|
83228
|
+
if (!config45.copyFiles) {
|
|
83183
83229
|
return;
|
|
83184
83230
|
}
|
|
83185
|
-
if (isVariantInfo(
|
|
83186
|
-
validateTemplateSrcDirectory((0, import_path12.resolve)(path6,
|
|
83231
|
+
if (isVariantInfo(config45.copyFiles)) {
|
|
83232
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, config45.copyFiles.path), config45);
|
|
83187
83233
|
} else {
|
|
83188
|
-
for (const variant of Object.values(
|
|
83189
|
-
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, variant.path),
|
|
83234
|
+
for (const variant of Object.values(config45.copyFiles.variants)) {
|
|
83235
|
+
validateTemplateSrcDirectory((0, import_path12.resolve)(path6, variant.path), config45);
|
|
83190
83236
|
}
|
|
83191
83237
|
}
|
|
83192
83238
|
};
|
|
83193
|
-
var validateTemplateSrcDirectory = (path6,
|
|
83194
|
-
if (
|
|
83239
|
+
var validateTemplateSrcDirectory = (path6, config45) => {
|
|
83240
|
+
if (config45.platform === "workers") {
|
|
83195
83241
|
const wranglerTomlPath = (0, import_path12.resolve)(path6, "wrangler.toml");
|
|
83196
83242
|
const wranglerJsonPath = (0, import_path12.resolve)(path6, "wrangler.json");
|
|
83197
83243
|
const wranglerJsoncPath = (0, import_path12.resolve)(path6, "wrangler.jsonc");
|
|
83198
|
-
if (!(0,
|
|
83244
|
+
if (!(0, import_fs12.existsSync)(wranglerTomlPath) && !(0, import_fs12.existsSync)(wranglerJsonPath) && !(0, import_fs12.existsSync)(wranglerJsoncPath)) {
|
|
83199
83245
|
throw new Error(
|
|
83200
83246
|
`create-cloudflare templates must contain a "wrangler.toml" or "wrangler.json(c)" file.`
|
|
83201
83247
|
);
|
|
83202
83248
|
}
|
|
83203
83249
|
}
|
|
83204
83250
|
const pkgJsonPath = (0, import_path12.resolve)(path6, "package.json");
|
|
83205
|
-
if (!(0,
|
|
83251
|
+
if (!(0, import_fs12.existsSync)(pkgJsonPath)) {
|
|
83206
83252
|
throw new Error(
|
|
83207
83253
|
`create-cloudflare templates must contain a "package.json" file.`
|
|
83208
83254
|
);
|
|
@@ -83219,10 +83265,10 @@ var inferTemplateConfig = (path6) => {
|
|
|
83219
83265
|
};
|
|
83220
83266
|
var inferCopyFilesDefinition = (path6) => {
|
|
83221
83267
|
const variants = {};
|
|
83222
|
-
if ((0,
|
|
83268
|
+
if ((0, import_fs12.existsSync)((0, import_path12.join)(path6, "js"))) {
|
|
83223
83269
|
variants["js"] = { path: "./js" };
|
|
83224
83270
|
}
|
|
83225
|
-
if ((0,
|
|
83271
|
+
if ((0, import_fs12.existsSync)((0, import_path12.join)(path6, "ts"))) {
|
|
83226
83272
|
variants["ts"] = { path: "./ts" };
|
|
83227
83273
|
}
|
|
83228
83274
|
const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
|
|
@@ -83247,8 +83293,7 @@ var downloadRemoteTemplate = async (src, mode) => {
|
|
|
83247
83293
|
};
|
|
83248
83294
|
function updatePythonPackageName(path6, projectName) {
|
|
83249
83295
|
const pyprojectTomlPath = (0, import_path12.resolve)(path6, "pyproject.toml");
|
|
83250
|
-
|
|
83251
|
-
if (!(0, import_fs11.existsSync)(pyprojectTomlPath)) {
|
|
83296
|
+
if (!(0, import_fs12.existsSync)(pyprojectTomlPath)) {
|
|
83252
83297
|
return;
|
|
83253
83298
|
}
|
|
83254
83299
|
const s = spinner();
|
|
@@ -83259,12 +83304,6 @@ function updatePythonPackageName(path6, projectName) {
|
|
|
83259
83304
|
`"${projectName}"`
|
|
83260
83305
|
);
|
|
83261
83306
|
writeFile2(pyprojectTomlPath, pyprojectTomlContents);
|
|
83262
|
-
let uvLockContents = readFile(uvLockPath);
|
|
83263
|
-
uvLockContents = uvLockContents.replace(
|
|
83264
|
-
'"tbd"',
|
|
83265
|
-
`${"projectName.toLowerCase()"}`
|
|
83266
|
-
);
|
|
83267
|
-
writeFile2(uvLockPath, uvLockContents);
|
|
83268
83307
|
s.stop(`${brandColor("updated")} ${dim("`pyproject.toml`")}`);
|
|
83269
83308
|
}
|
|
83270
83309
|
var updatePackageName = async (ctx) => {
|
|
@@ -83315,7 +83354,7 @@ var getCopyFilesDestinationDir = (ctx) => {
|
|
|
83315
83354
|
};
|
|
83316
83355
|
var addWranglerToGitIgnore = (ctx) => {
|
|
83317
83356
|
const gitIgnorePath = `${ctx.project.path}/.gitignore`;
|
|
83318
|
-
const gitIgnorePreExisted = (0,
|
|
83357
|
+
const gitIgnorePreExisted = (0, import_fs12.existsSync)(gitIgnorePath);
|
|
83319
83358
|
const gitDirExists = directoryExists(`${ctx.project.path}/.git`);
|
|
83320
83359
|
if (!gitIgnorePreExisted && !gitDirExists) {
|
|
83321
83360
|
return;
|
|
@@ -83816,7 +83855,7 @@ function secondsSince(start) {
|
|
|
83816
83855
|
}
|
|
83817
83856
|
|
|
83818
83857
|
// src/wrangler/config.ts
|
|
83819
|
-
var
|
|
83858
|
+
var import_fs13 = require("fs");
|
|
83820
83859
|
var import_path13 = require("path");
|
|
83821
83860
|
var import_toml2 = __toESM(require_toml());
|
|
83822
83861
|
|
|
@@ -83966,12 +84005,12 @@ var getWranglerJsoncPath = (ctx) => {
|
|
|
83966
84005
|
};
|
|
83967
84006
|
var wranglerTomlExists = (ctx) => {
|
|
83968
84007
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
83969
|
-
return (0,
|
|
84008
|
+
return (0, import_fs13.existsSync)(wranglerTomlPath);
|
|
83970
84009
|
};
|
|
83971
84010
|
var wranglerJsonExists = (ctx) => {
|
|
83972
84011
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
83973
84012
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
83974
|
-
return (0,
|
|
84013
|
+
return (0, import_fs13.existsSync)(wranglerJsonPath) || (0, import_fs13.existsSync)(wranglerJsoncPath);
|
|
83975
84014
|
};
|
|
83976
84015
|
var readWranglerToml = (ctx) => {
|
|
83977
84016
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
@@ -83979,7 +84018,7 @@ var readWranglerToml = (ctx) => {
|
|
|
83979
84018
|
};
|
|
83980
84019
|
var readWranglerJson = (ctx) => {
|
|
83981
84020
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
83982
|
-
if ((0,
|
|
84021
|
+
if ((0, import_fs13.existsSync)(wranglerJsonPath)) {
|
|
83983
84022
|
return readJSONWithComments(wranglerJsonPath);
|
|
83984
84023
|
}
|
|
83985
84024
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
@@ -83989,37 +84028,37 @@ var writeWranglerToml = (ctx, contents) => {
|
|
|
83989
84028
|
const wranglerTomlPath = getWranglerTomlPath(ctx);
|
|
83990
84029
|
return writeFile2(wranglerTomlPath, contents);
|
|
83991
84030
|
};
|
|
83992
|
-
var writeWranglerJson = (ctx,
|
|
84031
|
+
var writeWranglerJson = (ctx, config45) => {
|
|
83993
84032
|
const wranglerJsonPath = getWranglerJsonPath(ctx);
|
|
83994
|
-
if ((0,
|
|
83995
|
-
return writeJSONWithComments(wranglerJsonPath,
|
|
84033
|
+
if ((0, import_fs13.existsSync)(wranglerJsonPath)) {
|
|
84034
|
+
return writeJSONWithComments(wranglerJsonPath, config45);
|
|
83996
84035
|
}
|
|
83997
84036
|
const wranglerJsoncPath = getWranglerJsoncPath(ctx);
|
|
83998
|
-
return writeJSONWithComments(wranglerJsoncPath,
|
|
84037
|
+
return writeJSONWithComments(wranglerJsoncPath, config45);
|
|
83999
84038
|
};
|
|
84000
84039
|
var addVscodeConfig = (ctx) => {
|
|
84001
84040
|
const settingsPath = `${ctx.project.path}/.vscode/settings.json`;
|
|
84002
|
-
if ((0,
|
|
84041
|
+
if ((0, import_fs13.existsSync)(settingsPath)) {
|
|
84003
84042
|
return;
|
|
84004
84043
|
}
|
|
84005
|
-
(0,
|
|
84044
|
+
(0, import_fs13.mkdirSync)(`${ctx.project.path}/.vscode`, { recursive: true });
|
|
84006
84045
|
writeJSON(settingsPath, {
|
|
84007
84046
|
"files.associations": {
|
|
84008
84047
|
"wrangler.json": "jsonc"
|
|
84009
84048
|
}
|
|
84010
84049
|
});
|
|
84011
84050
|
};
|
|
84012
|
-
async function getCompatibilityDate(
|
|
84051
|
+
async function getCompatibilityDate(config45) {
|
|
84013
84052
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}$/m;
|
|
84014
|
-
if (typeof
|
|
84015
|
-
return
|
|
84053
|
+
if (typeof config45["compatibility_date"] === "string" && config45["compatibility_date"].match(validCompatDateRe)) {
|
|
84054
|
+
return config45["compatibility_date"];
|
|
84016
84055
|
}
|
|
84017
84056
|
return await getWorkerdCompatibilityDate();
|
|
84018
84057
|
}
|
|
84019
84058
|
|
|
84020
84059
|
// src/deploy.ts
|
|
84021
84060
|
var offerToDeploy = async (ctx) => {
|
|
84022
|
-
const { npm:
|
|
84061
|
+
const { npm: npm23 } = detectPackageManager();
|
|
84023
84062
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
84024
84063
|
if (!await isDeployable(ctx)) {
|
|
84025
84064
|
ctx.args.deploy = false;
|
|
@@ -84030,7 +84069,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
84030
84069
|
);
|
|
84031
84070
|
}
|
|
84032
84071
|
const label = `deploy via \`${quoteShellArgs([
|
|
84033
|
-
|
|
84072
|
+
npm23,
|
|
84034
84073
|
"run",
|
|
84035
84074
|
ctx.template.deployScript ?? "deploy"
|
|
84036
84075
|
])}\``;
|
|
@@ -84066,11 +84105,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
84066
84105
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
84067
84106
|
};
|
|
84068
84107
|
var runDeploy = async (ctx) => {
|
|
84069
|
-
const { npm:
|
|
84108
|
+
const { npm: npm23, name: pm4 } = detectPackageManager();
|
|
84070
84109
|
if (!ctx.account?.id) {
|
|
84071
84110
|
throw new Error("Failed to read Cloudflare account.");
|
|
84072
84111
|
}
|
|
84073
|
-
const baseDeployCmd = [
|
|
84112
|
+
const baseDeployCmd = [npm23, "run", ctx.template.deployScript ?? "deploy"];
|
|
84074
84113
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
84075
84114
|
const deployCmd = [
|
|
84076
84115
|
...baseDeployCmd,
|
|
@@ -84186,14 +84225,14 @@ var printSummary = (ctx) => {
|
|
|
84186
84225
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
84187
84226
|
const relativePath = (0, import_path14.relative)(ctx.originalCWD, ctx.project.path);
|
|
84188
84227
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
84189
|
-
const { npm:
|
|
84228
|
+
const { npm: npm23 } = detectPackageManager();
|
|
84190
84229
|
const devServerCommand = quoteShellArgs([
|
|
84191
|
-
|
|
84230
|
+
npm23,
|
|
84192
84231
|
"run",
|
|
84193
84232
|
ctx.template.devScript ?? "start"
|
|
84194
84233
|
]);
|
|
84195
84234
|
const deployCommand = quoteShellArgs([
|
|
84196
|
-
|
|
84235
|
+
npm23,
|
|
84197
84236
|
"run",
|
|
84198
84237
|
ctx.template.deployScript ?? "deploy"
|
|
84199
84238
|
]);
|
|
@@ -84561,8 +84600,8 @@ var renderValues = (values) => {
|
|
|
84561
84600
|
};
|
|
84562
84601
|
|
|
84563
84602
|
// src/helpers/retry.ts
|
|
84564
|
-
var retry = async (
|
|
84565
|
-
let { times } =
|
|
84603
|
+
var retry = async (config45, fn) => {
|
|
84604
|
+
let { times } = config45;
|
|
84566
84605
|
let error2 = null;
|
|
84567
84606
|
while (times > 0) {
|
|
84568
84607
|
try {
|
|
@@ -84570,10 +84609,10 @@ var retry = async (config44, fn) => {
|
|
|
84570
84609
|
} catch (e) {
|
|
84571
84610
|
error2 = e;
|
|
84572
84611
|
times--;
|
|
84573
|
-
if (
|
|
84612
|
+
if (config45.exitCondition?.(e)) {
|
|
84574
84613
|
break;
|
|
84575
84614
|
}
|
|
84576
|
-
await sleep(
|
|
84615
|
+
await sleep(config45.sleepMs ?? 1e3);
|
|
84577
84616
|
}
|
|
84578
84617
|
}
|
|
84579
84618
|
throw error2;
|
|
@@ -84660,7 +84699,7 @@ var createProject = async (ctx) => {
|
|
|
84660
84699
|
};
|
|
84661
84700
|
|
|
84662
84701
|
// src/workers.ts
|
|
84663
|
-
var
|
|
84702
|
+
var import_fs14 = require("fs");
|
|
84664
84703
|
var import_path15 = require("path");
|
|
84665
84704
|
var import_toml4 = __toESM(require_toml());
|
|
84666
84705
|
|
|
@@ -85982,25 +86021,25 @@ async function addTypes(ctx) {
|
|
|
85982
86021
|
if (!usesTypescript(ctx) || ctx.template.workersTypes === "none") {
|
|
85983
86022
|
return;
|
|
85984
86023
|
}
|
|
85985
|
-
const { npm:
|
|
86024
|
+
const { npm: npm23 } = detectPackageManager();
|
|
85986
86025
|
if (ctx.template.workersTypes === "installed") {
|
|
85987
|
-
await installWorkersTypes(
|
|
86026
|
+
await installWorkersTypes(npm23);
|
|
85988
86027
|
} else if (ctx.template.workersTypes === "generated") {
|
|
85989
|
-
await generateWorkersTypes(ctx,
|
|
86028
|
+
await generateWorkersTypes(ctx, npm23);
|
|
85990
86029
|
}
|
|
85991
|
-
const usesNodeCompat = await maybeInstallNodeTypes(ctx,
|
|
86030
|
+
const usesNodeCompat = await maybeInstallNodeTypes(ctx, npm23);
|
|
85992
86031
|
await updateTsConfig(ctx, { usesNodeCompat });
|
|
85993
86032
|
}
|
|
85994
|
-
async function generateWorkersTypes(ctx,
|
|
86033
|
+
async function generateWorkersTypes(ctx, npm23) {
|
|
85995
86034
|
const packageJsonPath = (0, import_path15.join)(ctx.project.path, "package.json");
|
|
85996
|
-
if (!(0,
|
|
86035
|
+
if (!(0, import_fs14.existsSync)(packageJsonPath)) {
|
|
85997
86036
|
return;
|
|
85998
86037
|
}
|
|
85999
86038
|
const packageManifest = readJSON(packageJsonPath);
|
|
86000
86039
|
if (!packageManifest.scripts?.["cf-typegen"]) {
|
|
86001
86040
|
return;
|
|
86002
86041
|
}
|
|
86003
|
-
const typesCmd = [
|
|
86042
|
+
const typesCmd = [npm23, "run", "cf-typegen"];
|
|
86004
86043
|
await runCommand(typesCmd, {
|
|
86005
86044
|
cwd: ctx.project.path,
|
|
86006
86045
|
silent: true,
|
|
@@ -86012,7 +86051,7 @@ async function generateWorkersTypes(ctx, npm22) {
|
|
|
86012
86051
|
writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
|
|
86013
86052
|
}
|
|
86014
86053
|
}
|
|
86015
|
-
var maybeInstallNodeTypes = async (ctx,
|
|
86054
|
+
var maybeInstallNodeTypes = async (ctx, npm23) => {
|
|
86016
86055
|
let parsedConfig = {};
|
|
86017
86056
|
if (wranglerJsonExists(ctx)) {
|
|
86018
86057
|
parsedConfig = readWranglerJson(ctx);
|
|
@@ -86025,7 +86064,7 @@ var maybeInstallNodeTypes = async (ctx, npm22) => {
|
|
|
86025
86064
|
await installPackages(["@types/node"], {
|
|
86026
86065
|
dev: true,
|
|
86027
86066
|
startText: "Installing @types/node",
|
|
86028
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86067
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm23}`)}`
|
|
86029
86068
|
});
|
|
86030
86069
|
return true;
|
|
86031
86070
|
}
|
|
@@ -86033,13 +86072,13 @@ var maybeInstallNodeTypes = async (ctx, npm22) => {
|
|
|
86033
86072
|
};
|
|
86034
86073
|
async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
86035
86074
|
const tsconfigPath = (0, import_path15.join)(ctx.project.path, "tsconfig.json");
|
|
86036
|
-
if (!(0,
|
|
86075
|
+
if (!(0, import_fs14.existsSync)(tsconfigPath)) {
|
|
86037
86076
|
return;
|
|
86038
86077
|
}
|
|
86039
86078
|
const tsconfig = readFile(tsconfigPath);
|
|
86040
86079
|
try {
|
|
86041
|
-
const
|
|
86042
|
-
const currentTypes =
|
|
86080
|
+
const config45 = parse5(tsconfig);
|
|
86081
|
+
const currentTypes = config45.compilerOptions?.types ?? [];
|
|
86043
86082
|
let newTypes = [...currentTypes];
|
|
86044
86083
|
if (ctx.template.workersTypes === "installed") {
|
|
86045
86084
|
const entrypointVersion = getLatestTypesEntrypoint(ctx);
|
|
@@ -86090,16 +86129,16 @@ async function updateTsConfig(ctx, { usesNodeCompat }) {
|
|
|
86090
86129
|
warn("Failed to update `tsconfig.json`.");
|
|
86091
86130
|
}
|
|
86092
86131
|
}
|
|
86093
|
-
async function installWorkersTypes(
|
|
86132
|
+
async function installWorkersTypes(npm23) {
|
|
86094
86133
|
await installPackages(["@cloudflare/workers-types"], {
|
|
86095
86134
|
dev: true,
|
|
86096
86135
|
startText: "Installing @cloudflare/workers-types",
|
|
86097
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
86136
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm23}`)}`
|
|
86098
86137
|
});
|
|
86099
86138
|
}
|
|
86100
86139
|
|
|
86101
86140
|
// src/cli.ts
|
|
86102
|
-
var { npm:
|
|
86141
|
+
var { npm: npm22 } = detectPackageManager();
|
|
86103
86142
|
var main = async (argv) => {
|
|
86104
86143
|
const result = await parseArgs(argv);
|
|
86105
86144
|
if (result.type === "unknown") {
|
|
@@ -86135,10 +86174,10 @@ ${result.errorMessage}`);
|
|
|
86135
86174
|
};
|
|
86136
86175
|
var runLatest = async () => {
|
|
86137
86176
|
const args = process.argv.slice(2);
|
|
86138
|
-
if (
|
|
86177
|
+
if (npm22 === "npm") {
|
|
86139
86178
|
args.unshift("--");
|
|
86140
86179
|
}
|
|
86141
|
-
await runCommand([
|
|
86180
|
+
await runCommand([npm22, "create", "cloudflare@latest", ...args]);
|
|
86142
86181
|
};
|
|
86143
86182
|
var runCli = async (args) => {
|
|
86144
86183
|
printBanner(args);
|
|
@@ -86157,7 +86196,7 @@ var setupProjectDirectory = (ctx) => {
|
|
|
86157
86196
|
throw new Error(err);
|
|
86158
86197
|
}
|
|
86159
86198
|
const directory = (0, import_path16.dirname)(path6);
|
|
86160
|
-
(0,
|
|
86199
|
+
(0, import_fs15.mkdirSync)(directory, { recursive: true });
|
|
86161
86200
|
(0, import_process2.chdir)(directory);
|
|
86162
86201
|
};
|
|
86163
86202
|
var create = async (ctx) => {
|