create-cloudflare 2.42.1 → 2.43.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 +322 -271
- package/package.json +5 -5
- package/templates/hello-world/ts/test/env.d.ts +3 -0
- package/templates/hello-world/ts/worker-configuration.d.ts +6 -2
- package/templates/hello-world-durable-object/ts/worker-configuration.d.ts +6 -4
- package/templates/hello-world-durable-object-with-assets/js/src/index.js +11 -10
- package/templates/hello-world-durable-object-with-assets/js/wrangler.jsonc +2 -2
- package/templates/hello-world-durable-object-with-assets/ts/src/index.ts +10 -9
- package/templates/hello-world-durable-object-with-assets/ts/worker-configuration.d.ts +7 -4
- package/templates/hello-world-durable-object-with-assets/ts/wrangler.jsonc +1 -1
- package/templates/hello-world-with-assets/js/public/index.html +2 -2
- package/templates/hello-world-with-assets/py/public/index.html +2 -2
- package/templates/hello-world-with-assets/ts/public/index.html +2 -2
- package/templates/hello-world-with-assets/ts/test/env.d.ts +3 -0
- package/templates/hello-world-with-assets/ts/test/tsconfig.json +1 -1
- package/templates/hello-world-with-assets/ts/worker-configuration.d.ts +6 -3
- package/templates/nuxt/pages/c3.ts +1 -0
- package/templates/nuxt/workers/c3.ts +1 -0
- package/templates/react-router/c3.ts +53 -0
- package/templates/react-router/templates/worker-configuration.d.ts +8 -0
- package/templates/remix/c3.ts +1 -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 config40(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 config40 = 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: config40, 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 config40 = 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: config40, 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 config40 = 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: config40, data, runtime, state };
|
|
683
683
|
};
|
|
684
684
|
var XDG_ = /* @__PURE__ */ function() {
|
|
685
685
|
function XDG_2() {
|
|
@@ -31509,21 +31509,21 @@ var require_dist_web = __commonJS({
|
|
|
31509
31509
|
_createClass(Haikunator3, [{
|
|
31510
31510
|
key: "haikunate",
|
|
31511
31511
|
value: function haikunate(options) {
|
|
31512
|
-
var
|
|
31513
|
-
if (
|
|
31514
|
-
|
|
31512
|
+
var config40 = (0, _lodash["default"])(options, this.config);
|
|
31513
|
+
if (config40.tokenHex === true) {
|
|
31514
|
+
config40.tokenChars = "0123456789abcdef";
|
|
31515
31515
|
}
|
|
31516
31516
|
var adjective = this._randomElement(this.adjectives);
|
|
31517
31517
|
var noun = this._randomElement(this.nouns);
|
|
31518
|
-
if (!
|
|
31518
|
+
if (!config40.tokenLength) config40.tokenLength = 0;
|
|
31519
31519
|
var token = "";
|
|
31520
|
-
for (var i = 0; i <
|
|
31521
|
-
token += this._randomElement(
|
|
31520
|
+
for (var i = 0; i < config40.tokenLength; i++) {
|
|
31521
|
+
token += this._randomElement(config40.tokenChars);
|
|
31522
31522
|
}
|
|
31523
31523
|
var sections = [adjective, noun, token];
|
|
31524
31524
|
return sections.filter(function(e) {
|
|
31525
31525
|
return !!e;
|
|
31526
|
-
}).join(
|
|
31526
|
+
}).join(config40.delimiter);
|
|
31527
31527
|
}
|
|
31528
31528
|
/**
|
|
31529
31529
|
* Get a random element from an array/string
|
|
@@ -40036,13 +40036,13 @@ var require_esprima = __commonJS({
|
|
|
40036
40036
|
return Reader2;
|
|
40037
40037
|
}();
|
|
40038
40038
|
var Tokenizer = function() {
|
|
40039
|
-
function Tokenizer2(code,
|
|
40039
|
+
function Tokenizer2(code, config40) {
|
|
40040
40040
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
40041
|
-
this.errorHandler.tolerant =
|
|
40041
|
+
this.errorHandler.tolerant = config40 ? typeof config40.tolerant === "boolean" && config40.tolerant : false;
|
|
40042
40042
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
40043
|
-
this.scanner.trackComment =
|
|
40044
|
-
this.trackRange =
|
|
40045
|
-
this.trackLoc =
|
|
40043
|
+
this.scanner.trackComment = config40 ? typeof config40.comment === "boolean" && config40.comment : false;
|
|
40044
|
+
this.trackRange = config40 ? typeof config40.range === "boolean" && config40.range : false;
|
|
40045
|
+
this.trackLoc = config40 ? typeof config40.loc === "boolean" && config40.loc : false;
|
|
40046
40046
|
this.buffer = [];
|
|
40047
40047
|
this.reader = new Reader();
|
|
40048
40048
|
}
|
|
@@ -49803,11 +49803,11 @@ var require_printer = __commonJS({
|
|
|
49803
49803
|
return this.code;
|
|
49804
49804
|
};
|
|
49805
49805
|
var emptyPrintResult = new PrintResult("");
|
|
49806
|
-
var Printer = function Printer2(
|
|
49806
|
+
var Printer = function Printer2(config40) {
|
|
49807
49807
|
assert_1.default.ok(this instanceof Printer2);
|
|
49808
|
-
var explicitTabWidth =
|
|
49809
|
-
|
|
49810
|
-
|
|
49808
|
+
var explicitTabWidth = config40 && config40.tabWidth;
|
|
49809
|
+
config40 = options_1.normalize(config40);
|
|
49810
|
+
config40.sourceFileName = null;
|
|
49811
49811
|
function makePrintFunctionWith(options, overrides) {
|
|
49812
49812
|
options = Object.assign({}, options, overrides);
|
|
49813
49813
|
return function(path6) {
|
|
@@ -49822,11 +49822,11 @@ var require_printer = __commonJS({
|
|
|
49822
49822
|
includeComments: false
|
|
49823
49823
|
}));
|
|
49824
49824
|
}
|
|
49825
|
-
var oldTabWidth =
|
|
49825
|
+
var oldTabWidth = config40.tabWidth;
|
|
49826
49826
|
if (!explicitTabWidth) {
|
|
49827
49827
|
var loc = path6.getNode().loc;
|
|
49828
49828
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
49829
|
-
|
|
49829
|
+
config40.tabWidth = loc.lines.guessTabWidth();
|
|
49830
49830
|
}
|
|
49831
49831
|
}
|
|
49832
49832
|
var reprinter = patcher_1.getReprinter(path6);
|
|
@@ -49840,11 +49840,11 @@ var require_printer = __commonJS({
|
|
|
49840
49840
|
// right choice because it gives us the opportunity to reprint
|
|
49841
49841
|
// such nodes using their original source.
|
|
49842
49842
|
reprinter(print2)
|
|
49843
|
-
) : genericPrint(path6,
|
|
49843
|
+
) : genericPrint(path6, config40, options, makePrintFunctionWith(options, {
|
|
49844
49844
|
includeComments: true,
|
|
49845
49845
|
avoidRootParens: false
|
|
49846
49846
|
}));
|
|
49847
|
-
|
|
49847
|
+
config40.tabWidth = oldTabWidth;
|
|
49848
49848
|
return lines;
|
|
49849
49849
|
}
|
|
49850
49850
|
this.print = function(ast) {
|
|
@@ -49855,7 +49855,7 @@ var require_printer = __commonJS({
|
|
|
49855
49855
|
includeComments: true,
|
|
49856
49856
|
avoidRootParens: false
|
|
49857
49857
|
});
|
|
49858
|
-
return new PrintResult(lines.toString(
|
|
49858
|
+
return new PrintResult(lines.toString(config40), util.composeSourceMaps(config40.inputSourceMap, lines.getSourceMap(config40.sourceMapName, config40.sourceRoot)));
|
|
49859
49859
|
};
|
|
49860
49860
|
this.printGenerically = function(ast) {
|
|
49861
49861
|
if (!ast) {
|
|
@@ -49863,26 +49863,26 @@ var require_printer = __commonJS({
|
|
|
49863
49863
|
}
|
|
49864
49864
|
function printGenerically(path7) {
|
|
49865
49865
|
return comments_1.printComments(path7, function(path8) {
|
|
49866
|
-
return genericPrint(path8,
|
|
49866
|
+
return genericPrint(path8, config40, {
|
|
49867
49867
|
includeComments: true,
|
|
49868
49868
|
avoidRootParens: false
|
|
49869
49869
|
}, printGenerically);
|
|
49870
49870
|
});
|
|
49871
49871
|
}
|
|
49872
49872
|
var path6 = fast_path_1.default.from(ast);
|
|
49873
|
-
var oldReuseWhitespace =
|
|
49874
|
-
|
|
49875
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
49876
|
-
|
|
49873
|
+
var oldReuseWhitespace = config40.reuseWhitespace;
|
|
49874
|
+
config40.reuseWhitespace = false;
|
|
49875
|
+
var pr = new PrintResult(printGenerically(path6).toString(config40));
|
|
49876
|
+
config40.reuseWhitespace = oldReuseWhitespace;
|
|
49877
49877
|
return pr;
|
|
49878
49878
|
};
|
|
49879
49879
|
};
|
|
49880
49880
|
exports2.Printer = Printer;
|
|
49881
|
-
function genericPrint(path6,
|
|
49881
|
+
function genericPrint(path6, config40, options, printPath) {
|
|
49882
49882
|
assert_1.default.ok(path6 instanceof fast_path_1.default);
|
|
49883
49883
|
var node = path6.getValue();
|
|
49884
49884
|
var parts = [];
|
|
49885
|
-
var linesWithoutParens = genericPrintNoParens(path6,
|
|
49885
|
+
var linesWithoutParens = genericPrintNoParens(path6, config40, printPath);
|
|
49886
49886
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
49887
49887
|
return linesWithoutParens;
|
|
49888
49888
|
}
|
|
@@ -69380,33 +69380,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
69380
69380
|
}
|
|
69381
69381
|
return input;
|
|
69382
69382
|
};
|
|
69383
|
-
var renderSubmit = (
|
|
69384
|
-
const { question, label } =
|
|
69385
|
-
if (
|
|
69383
|
+
var renderSubmit = (config40, value) => {
|
|
69384
|
+
const { question, label } = config40;
|
|
69385
|
+
if (config40.type !== "confirm" && !value) {
|
|
69386
69386
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
69387
69387
|
}
|
|
69388
|
-
const content =
|
|
69388
|
+
const content = config40.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
69389
69389
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
69390
69390
|
};
|
|
69391
|
-
var getRenderers = (
|
|
69392
|
-
switch (
|
|
69391
|
+
var getRenderers = (config40) => {
|
|
69392
|
+
switch (config40.type) {
|
|
69393
69393
|
case "select":
|
|
69394
|
-
return getSelectRenderers(
|
|
69394
|
+
return getSelectRenderers(config40);
|
|
69395
69395
|
case "confirm":
|
|
69396
|
-
return getConfirmRenderers(
|
|
69396
|
+
return getConfirmRenderers(config40);
|
|
69397
69397
|
case "text":
|
|
69398
|
-
return getTextRenderers(
|
|
69398
|
+
return getTextRenderers(config40);
|
|
69399
69399
|
case "multiselect":
|
|
69400
|
-
return getSelectRenderers(
|
|
69400
|
+
return getSelectRenderers(config40);
|
|
69401
69401
|
case "list":
|
|
69402
|
-
return getSelectListRenderers(
|
|
69402
|
+
return getSelectListRenderers(config40);
|
|
69403
69403
|
}
|
|
69404
69404
|
};
|
|
69405
|
-
var getTextRenderers = (
|
|
69406
|
-
const { question } =
|
|
69407
|
-
const helpText =
|
|
69408
|
-
const format5 =
|
|
69409
|
-
const defaultValue =
|
|
69405
|
+
var getTextRenderers = (config40) => {
|
|
69406
|
+
const { question } = config40;
|
|
69407
|
+
const helpText = config40.helpText ?? "";
|
|
69408
|
+
const format5 = config40.format ?? ((val) => String(val));
|
|
69409
|
+
const defaultValue = config40.defaultValue?.toString() ?? "";
|
|
69410
69410
|
const activeRenderer = ({ value }) => [
|
|
69411
69411
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
69412
69412
|
`${space(2)}${format5(value || dim(defaultValue))}`,
|
|
@@ -69429,14 +69429,14 @@ var getTextRenderers = (config39) => {
|
|
|
69429
69429
|
``
|
|
69430
69430
|
// extra line for readability
|
|
69431
69431
|
],
|
|
69432
|
-
submit: ({ value }) => renderSubmit(
|
|
69432
|
+
submit: ({ value }) => renderSubmit(config40, format5(value ?? "")),
|
|
69433
69433
|
cancel: activeRenderer
|
|
69434
69434
|
};
|
|
69435
69435
|
};
|
|
69436
|
-
var getSelectRenderers = (
|
|
69437
|
-
const { options, question, helpText: _helpText } =
|
|
69436
|
+
var getSelectRenderers = (config40) => {
|
|
69437
|
+
const { options, question, helpText: _helpText } = config40;
|
|
69438
69438
|
const helpText = _helpText ?? "";
|
|
69439
|
-
const maxItemsPerPage =
|
|
69439
|
+
const maxItemsPerPage = config40.maxItemsPerPage ?? 32;
|
|
69440
69440
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
69441
69441
|
const renderOption = (opt, i) => {
|
|
69442
69442
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -69511,21 +69511,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
69511
69511
|
submit: ({ value }) => {
|
|
69512
69512
|
if (Array.isArray(value)) {
|
|
69513
69513
|
return renderSubmit(
|
|
69514
|
-
|
|
69514
|
+
config40,
|
|
69515
69515
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
69516
69516
|
);
|
|
69517
69517
|
}
|
|
69518
69518
|
return renderSubmit(
|
|
69519
|
-
|
|
69519
|
+
config40,
|
|
69520
69520
|
options.find((o) => o.value === value)?.label
|
|
69521
69521
|
);
|
|
69522
69522
|
},
|
|
69523
69523
|
cancel: defaultRenderer
|
|
69524
69524
|
};
|
|
69525
69525
|
};
|
|
69526
|
-
var getSelectListRenderers = (
|
|
69527
|
-
const { question, helpText: _helpText } =
|
|
69528
|
-
let options =
|
|
69526
|
+
var getSelectListRenderers = (config40) => {
|
|
69527
|
+
const { question, helpText: _helpText } = config40;
|
|
69528
|
+
let options = config40.options;
|
|
69529
69529
|
const helpText = _helpText ?? "";
|
|
69530
69530
|
const { rows } = stdout;
|
|
69531
69531
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -69606,20 +69606,20 @@ var getSelectListRenderers = (config39) => {
|
|
|
69606
69606
|
submit: ({ value }) => {
|
|
69607
69607
|
if (Array.isArray(value)) {
|
|
69608
69608
|
return renderSubmit(
|
|
69609
|
-
|
|
69609
|
+
config40,
|
|
69610
69610
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
69611
69611
|
);
|
|
69612
69612
|
}
|
|
69613
69613
|
return renderSubmit(
|
|
69614
|
-
|
|
69614
|
+
config40,
|
|
69615
69615
|
options.find((o) => o.value === value)?.value
|
|
69616
69616
|
);
|
|
69617
69617
|
},
|
|
69618
69618
|
cancel: defaultRenderer
|
|
69619
69619
|
};
|
|
69620
69620
|
};
|
|
69621
|
-
var getConfirmRenderers = (
|
|
69622
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
69621
|
+
var getConfirmRenderers = (config40) => {
|
|
69622
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config40;
|
|
69623
69623
|
const helpText = _helpText ?? "";
|
|
69624
69624
|
const active = activeText || "Yes";
|
|
69625
69625
|
const inactive = inactiveText || "No";
|
|
@@ -69636,7 +69636,7 @@ var getConfirmRenderers = (config39) => {
|
|
|
69636
69636
|
active: defaultRenderer,
|
|
69637
69637
|
confirm: defaultRenderer,
|
|
69638
69638
|
error: defaultRenderer,
|
|
69639
|
-
submit: ({ value }) => renderSubmit(
|
|
69639
|
+
submit: ({ value }) => renderSubmit(config40, value ? "yes" : "no"),
|
|
69640
69640
|
cancel: defaultRenderer
|
|
69641
69641
|
};
|
|
69642
69642
|
};
|
|
@@ -70604,23 +70604,23 @@ var YargsParser = class {
|
|
|
70604
70604
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
70605
70605
|
if (configPath) {
|
|
70606
70606
|
try {
|
|
70607
|
-
let
|
|
70607
|
+
let config40 = null;
|
|
70608
70608
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
70609
70609
|
const resolveConfig = flags.configs[configKey];
|
|
70610
70610
|
if (typeof resolveConfig === "function") {
|
|
70611
70611
|
try {
|
|
70612
|
-
|
|
70612
|
+
config40 = resolveConfig(resolvedConfigPath);
|
|
70613
70613
|
} catch (e) {
|
|
70614
|
-
|
|
70614
|
+
config40 = e;
|
|
70615
70615
|
}
|
|
70616
|
-
if (
|
|
70617
|
-
error2 =
|
|
70616
|
+
if (config40 instanceof Error) {
|
|
70617
|
+
error2 = config40;
|
|
70618
70618
|
return;
|
|
70619
70619
|
}
|
|
70620
70620
|
} else {
|
|
70621
|
-
|
|
70621
|
+
config40 = mixin2.require(resolvedConfigPath);
|
|
70622
70622
|
}
|
|
70623
|
-
setConfigObject(
|
|
70623
|
+
setConfigObject(config40);
|
|
70624
70624
|
} catch (ex) {
|
|
70625
70625
|
if (ex.name === "PermissionDenied")
|
|
70626
70626
|
error2 = ex;
|
|
@@ -70630,9 +70630,9 @@ var YargsParser = class {
|
|
|
70630
70630
|
}
|
|
70631
70631
|
});
|
|
70632
70632
|
}
|
|
70633
|
-
function setConfigObject(
|
|
70634
|
-
Object.keys(
|
|
70635
|
-
const value =
|
|
70633
|
+
function setConfigObject(config40, prev) {
|
|
70634
|
+
Object.keys(config40).forEach(function(key) {
|
|
70635
|
+
const value = config40[key];
|
|
70636
70636
|
const fullKey = prev ? prev + "." + key : key;
|
|
70637
70637
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
70638
70638
|
setConfigObject(value, fullKey);
|
|
@@ -71784,11 +71784,11 @@ var CommandInstance = class {
|
|
|
71784
71784
|
});
|
|
71785
71785
|
if (!unparsed.length)
|
|
71786
71786
|
return;
|
|
71787
|
-
const
|
|
71787
|
+
const config40 = Object.assign({}, options.configuration, {
|
|
71788
71788
|
"populate--": false
|
|
71789
71789
|
});
|
|
71790
71790
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
71791
|
-
configuration:
|
|
71791
|
+
configuration: config40
|
|
71792
71792
|
}));
|
|
71793
71793
|
if (parsed.error) {
|
|
71794
71794
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -73011,31 +73011,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
73011
73011
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
73012
73012
|
var previouslyVisitedConfigs = [];
|
|
73013
73013
|
var shim2;
|
|
73014
|
-
function applyExtends(
|
|
73014
|
+
function applyExtends(config40, cwd, mergeExtends, _shim) {
|
|
73015
73015
|
shim2 = _shim;
|
|
73016
73016
|
let defaultConfig = {};
|
|
73017
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
73018
|
-
if (typeof
|
|
73017
|
+
if (Object.prototype.hasOwnProperty.call(config40, "extends")) {
|
|
73018
|
+
if (typeof config40.extends !== "string")
|
|
73019
73019
|
return defaultConfig;
|
|
73020
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
73020
|
+
const isPath = /\.json|\..*rc$/.test(config40.extends);
|
|
73021
73021
|
let pathToDefault = null;
|
|
73022
73022
|
if (!isPath) {
|
|
73023
73023
|
try {
|
|
73024
|
-
pathToDefault = require.resolve(
|
|
73024
|
+
pathToDefault = require.resolve(config40.extends);
|
|
73025
73025
|
} catch (_err) {
|
|
73026
|
-
return
|
|
73026
|
+
return config40;
|
|
73027
73027
|
}
|
|
73028
73028
|
} else {
|
|
73029
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
73029
|
+
pathToDefault = getPathToDefaultConfig(cwd, config40.extends);
|
|
73030
73030
|
}
|
|
73031
73031
|
checkForCircularExtends(pathToDefault);
|
|
73032
73032
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
73033
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
73034
|
-
delete
|
|
73033
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config40.extends);
|
|
73034
|
+
delete config40.extends;
|
|
73035
73035
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
73036
73036
|
}
|
|
73037
73037
|
previouslyVisitedConfigs = [];
|
|
73038
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
73038
|
+
return mergeExtends ? mergeDeep(defaultConfig, config40) : Object.assign({}, defaultConfig, config40);
|
|
73039
73039
|
}
|
|
73040
73040
|
function checkForCircularExtends(cfgPath) {
|
|
73041
73041
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -73811,9 +73811,9 @@ var YargsInstance = class {
|
|
|
73811
73811
|
}
|
|
73812
73812
|
return maybePromise;
|
|
73813
73813
|
}
|
|
73814
|
-
parserConfiguration(
|
|
73815
|
-
argsert("<object>", [
|
|
73816
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
73814
|
+
parserConfiguration(config40) {
|
|
73815
|
+
argsert("<object>", [config40], arguments.length);
|
|
73816
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config40, "f");
|
|
73817
73817
|
return this;
|
|
73818
73818
|
}
|
|
73819
73819
|
pkgConf(key, rootPath) {
|
|
@@ -73985,9 +73985,9 @@ var YargsInstance = class {
|
|
|
73985
73985
|
return this;
|
|
73986
73986
|
}
|
|
73987
73987
|
}
|
|
73988
|
-
usageConfiguration(
|
|
73989
|
-
argsert("<object>", [
|
|
73990
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
73988
|
+
usageConfiguration(config40) {
|
|
73989
|
+
argsert("<object>", [config40], arguments.length);
|
|
73990
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config40, "f");
|
|
73991
73991
|
return this;
|
|
73992
73992
|
}
|
|
73993
73993
|
version(opt, msg, ver) {
|
|
@@ -74393,11 +74393,11 @@ var YargsInstance = class {
|
|
|
74393
74393
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
74394
74394
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
74395
74395
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
74396
|
-
const
|
|
74396
|
+
const config40 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
74397
74397
|
"populate--": true
|
|
74398
74398
|
});
|
|
74399
74399
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
74400
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
74400
|
+
configuration: { "parse-positional-numbers": false, ...config40 }
|
|
74401
74401
|
}));
|
|
74402
74402
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
74403
74403
|
let argvPromise = void 0;
|
|
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
74560
74560
|
var yargs_default = Yargs;
|
|
74561
74561
|
|
|
74562
74562
|
// package.json
|
|
74563
|
-
var version = "2.
|
|
74563
|
+
var version = "2.43.0";
|
|
74564
74564
|
|
|
74565
74565
|
// src/metrics.ts
|
|
74566
74566
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -74604,12 +74604,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
74604
74604
|
}
|
|
74605
74605
|
|
|
74606
74606
|
// src/helpers/metrics-config.ts
|
|
74607
|
-
function writeMetricsConfig(
|
|
74607
|
+
function writeMetricsConfig(config40) {
|
|
74608
74608
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
74609
74609
|
(0, import_node_fs2.writeFileSync)(
|
|
74610
74610
|
getMetricsConfigPath(),
|
|
74611
74611
|
JSON.stringify(
|
|
74612
|
-
|
|
74612
|
+
config40,
|
|
74613
74613
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
74614
74614
|
" "
|
|
74615
74615
|
)
|
|
@@ -74617,9 +74617,9 @@ function writeMetricsConfig(config39) {
|
|
|
74617
74617
|
}
|
|
74618
74618
|
function readMetricsConfig() {
|
|
74619
74619
|
try {
|
|
74620
|
-
const
|
|
74620
|
+
const config40 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
74621
74621
|
return JSON.parse(
|
|
74622
|
-
|
|
74622
|
+
config40,
|
|
74623
74623
|
(key, value) => key === "date" ? new Date(value) : value
|
|
74624
74624
|
);
|
|
74625
74625
|
} catch {
|
|
@@ -74629,10 +74629,10 @@ function readMetricsConfig() {
|
|
|
74629
74629
|
function getMetricsConfigPath() {
|
|
74630
74630
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
74631
74631
|
}
|
|
74632
|
-
function getDeviceId(
|
|
74633
|
-
const deviceId =
|
|
74634
|
-
if (
|
|
74635
|
-
writeMetricsConfig({ ...
|
|
74632
|
+
function getDeviceId(config40) {
|
|
74633
|
+
const deviceId = config40.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
74634
|
+
if (config40.deviceId === void 0) {
|
|
74635
|
+
writeMetricsConfig({ ...config40, deviceId });
|
|
74636
74636
|
}
|
|
74637
74637
|
return deviceId;
|
|
74638
74638
|
}
|
|
@@ -74817,7 +74817,7 @@ var detectPackageManager = () => {
|
|
|
74817
74817
|
}
|
|
74818
74818
|
};
|
|
74819
74819
|
var rectifyPmMismatch = async (ctx) => {
|
|
74820
|
-
const { npm:
|
|
74820
|
+
const { npm: npm25 } = detectPackageManager();
|
|
74821
74821
|
if (!detectPmMismatch(ctx)) {
|
|
74822
74822
|
return;
|
|
74823
74823
|
}
|
|
@@ -74829,17 +74829,17 @@ var rectifyPmMismatch = async (ctx) => {
|
|
|
74829
74829
|
if ((0, import_fs5.existsSync)(lockfilePath)) {
|
|
74830
74830
|
(0, import_fs5.rmSync)(lockfilePath);
|
|
74831
74831
|
}
|
|
74832
|
-
await runCommand([
|
|
74832
|
+
await runCommand([npm25, "install"], {
|
|
74833
74833
|
silent: true,
|
|
74834
74834
|
cwd: ctx.project.path,
|
|
74835
74835
|
startText: "Installing dependencies",
|
|
74836
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
74836
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
74837
74837
|
});
|
|
74838
74838
|
};
|
|
74839
74839
|
var detectPmMismatch = (ctx) => {
|
|
74840
|
-
const { npm:
|
|
74840
|
+
const { npm: npm25 } = detectPackageManager();
|
|
74841
74841
|
const projectPath = ctx.project.path;
|
|
74842
|
-
switch (
|
|
74842
|
+
switch (npm25) {
|
|
74843
74843
|
case "npm":
|
|
74844
74844
|
return false;
|
|
74845
74845
|
case "yarn":
|
|
@@ -74907,10 +74907,10 @@ function getPlatform() {
|
|
|
74907
74907
|
function createReporter() {
|
|
74908
74908
|
const events = [];
|
|
74909
74909
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
74910
|
-
const
|
|
74911
|
-
const isFirstUsage =
|
|
74910
|
+
const config40 = readMetricsConfig() ?? {};
|
|
74911
|
+
const isFirstUsage = config40.c3permission === void 0;
|
|
74912
74912
|
const isEnabled = isTelemetryEnabled();
|
|
74913
|
-
const deviceId = getDeviceId(
|
|
74913
|
+
const deviceId = getDeviceId(config40);
|
|
74914
74914
|
const packageManager = detectPackageManager();
|
|
74915
74915
|
const platform3 = getPlatform();
|
|
74916
74916
|
const amplitude_session_id = Date.now();
|
|
@@ -74943,7 +74943,7 @@ function createReporter() {
|
|
|
74943
74943
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
74944
74944
|
return false;
|
|
74945
74945
|
}
|
|
74946
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
74946
|
+
return hasSparrowSourceKey() && getC3Permission(config40).enabled;
|
|
74947
74947
|
}
|
|
74948
74948
|
async function waitForAllEventsSettled() {
|
|
74949
74949
|
await Promise.allSettled(events);
|
|
@@ -75049,20 +75049,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
75049
75049
|
date: /* @__PURE__ */ new Date()
|
|
75050
75050
|
};
|
|
75051
75051
|
}
|
|
75052
|
-
function getC3Permission(
|
|
75053
|
-
if (!
|
|
75054
|
-
|
|
75055
|
-
writeMetricsConfig(
|
|
75052
|
+
function getC3Permission(config40 = readMetricsConfig() ?? {}) {
|
|
75053
|
+
if (!config40.c3permission) {
|
|
75054
|
+
config40.c3permission = initializeC3Permission();
|
|
75055
|
+
writeMetricsConfig(config40);
|
|
75056
75056
|
}
|
|
75057
|
-
return
|
|
75057
|
+
return config40.c3permission;
|
|
75058
75058
|
}
|
|
75059
75059
|
function updateC3Pemission(enabled) {
|
|
75060
|
-
const
|
|
75061
|
-
if (
|
|
75060
|
+
const config40 = readMetricsConfig();
|
|
75061
|
+
if (config40.c3permission?.enabled === enabled) {
|
|
75062
75062
|
return;
|
|
75063
75063
|
}
|
|
75064
|
-
|
|
75065
|
-
writeMetricsConfig(
|
|
75064
|
+
config40.c3permission = initializeC3Permission(enabled);
|
|
75065
|
+
writeMetricsConfig(config40);
|
|
75066
75066
|
}
|
|
75067
75067
|
var runTelemetryCommand = (action) => {
|
|
75068
75068
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -75107,39 +75107,39 @@ var import_haikunator = __toESM(require_dist_web());
|
|
|
75107
75107
|
var import_fs6 = require("fs");
|
|
75108
75108
|
var import_path6 = __toESM(require("path"));
|
|
75109
75109
|
var import_undici2 = __toESM(require_undici());
|
|
75110
|
-
var installPackages = async (packages,
|
|
75111
|
-
const { npm:
|
|
75110
|
+
var installPackages = async (packages, config40 = {}) => {
|
|
75111
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75112
75112
|
let saveFlag;
|
|
75113
75113
|
let cmd;
|
|
75114
|
-
switch (
|
|
75114
|
+
switch (npm25) {
|
|
75115
75115
|
case "yarn":
|
|
75116
75116
|
cmd = "add";
|
|
75117
|
-
saveFlag =
|
|
75117
|
+
saveFlag = config40.dev ? "-D" : "";
|
|
75118
75118
|
break;
|
|
75119
75119
|
case "bun":
|
|
75120
75120
|
cmd = "add";
|
|
75121
|
-
saveFlag =
|
|
75121
|
+
saveFlag = config40.dev ? "-d" : "";
|
|
75122
75122
|
break;
|
|
75123
75123
|
case "npm":
|
|
75124
75124
|
case "pnpm":
|
|
75125
75125
|
default:
|
|
75126
75126
|
cmd = "install";
|
|
75127
|
-
saveFlag =
|
|
75127
|
+
saveFlag = config40.dev ? "--save-dev" : "";
|
|
75128
75128
|
break;
|
|
75129
75129
|
}
|
|
75130
75130
|
await runCommand(
|
|
75131
75131
|
[
|
|
75132
|
-
|
|
75132
|
+
npm25,
|
|
75133
75133
|
cmd,
|
|
75134
75134
|
...saveFlag ? [saveFlag] : [],
|
|
75135
75135
|
...packages,
|
|
75136
75136
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
75137
75137
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
75138
75138
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
75139
|
-
...
|
|
75139
|
+
...npm25 === "npm" ? ["--legacy-peer-deps"] : []
|
|
75140
75140
|
],
|
|
75141
75141
|
{
|
|
75142
|
-
...
|
|
75142
|
+
...config40,
|
|
75143
75143
|
silent: true
|
|
75144
75144
|
}
|
|
75145
75145
|
);
|
|
@@ -75149,16 +75149,16 @@ var npmInstall = async (ctx) => {
|
|
|
75149
75149
|
if ((0, import_fs6.existsSync)(nodeModulesPath)) {
|
|
75150
75150
|
return;
|
|
75151
75151
|
}
|
|
75152
|
-
const { npm:
|
|
75152
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75153
75153
|
await runCommand(
|
|
75154
75154
|
// Add --legacy-peer-deps so that installing Wrangler v4 doesn't case issues with
|
|
75155
75155
|
// frameworks that haven't updated their peer dependency for Wrangler v4
|
|
75156
75156
|
// TODO: Remove this once Wrangler v4 has been released and framework templates are updated
|
|
75157
|
-
[
|
|
75157
|
+
[npm25, "install", ...npm25 === "npm" ? ["--legacy-peer-deps"] : []],
|
|
75158
75158
|
{
|
|
75159
75159
|
silent: true,
|
|
75160
75160
|
startText: "Installing dependencies",
|
|
75161
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
75161
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm25} install\``)}`
|
|
75162
75162
|
}
|
|
75163
75163
|
);
|
|
75164
75164
|
};
|
|
@@ -75168,14 +75168,14 @@ async function getLatestPackageVersion(packageSpecifier) {
|
|
|
75168
75168
|
return npmInfo["dist-tags"].latest;
|
|
75169
75169
|
}
|
|
75170
75170
|
var installWrangler = async () => {
|
|
75171
|
-
const { npm:
|
|
75171
|
+
const { npm: npm25 } = detectPackageManager();
|
|
75172
75172
|
await installPackages([`wrangler@latest`], {
|
|
75173
75173
|
dev: true,
|
|
75174
75174
|
startText: `Installing wrangler ${dim(
|
|
75175
75175
|
"A command line tool for building Cloudflare Workers"
|
|
75176
75176
|
)}`,
|
|
75177
75177
|
doneText: `${brandColor("installed")} ${dim(
|
|
75178
|
-
`via \`${
|
|
75178
|
+
`via \`${npm25} install wrangler --save-dev\``
|
|
75179
75179
|
)}`
|
|
75180
75180
|
});
|
|
75181
75181
|
};
|
|
@@ -75335,7 +75335,7 @@ var package_default = {
|
|
|
75335
75335
|
"so that we can use dependabot to update these dependencies automatically."
|
|
75336
75336
|
],
|
|
75337
75337
|
dependencies: {
|
|
75338
|
-
"create-astro": "4.11.
|
|
75338
|
+
"create-astro": "4.11.1",
|
|
75339
75339
|
"create-analog": "1.8.1",
|
|
75340
75340
|
"@angular/create": "19.1.6",
|
|
75341
75341
|
"create-docusaurus": "3.7.0",
|
|
@@ -75344,8 +75344,9 @@ var package_default = {
|
|
|
75344
75344
|
"create-qwik": "1.12.0",
|
|
75345
75345
|
"create-vite": "6.1.1",
|
|
75346
75346
|
"create-remix": "2.15.3",
|
|
75347
|
+
"create-react-router": "7.4.0",
|
|
75347
75348
|
"create-solid": "0.6.1",
|
|
75348
|
-
"create-vue": "3.
|
|
75349
|
+
"create-vue": "3.15.1",
|
|
75349
75350
|
gatsby: "5.14.1",
|
|
75350
75351
|
sv: "0.6.23",
|
|
75351
75352
|
nuxi: "3.21.1"
|
|
@@ -75363,9 +75364,9 @@ var getFrameworkCli = (ctx, withVersion = true) => {
|
|
|
75363
75364
|
};
|
|
75364
75365
|
var runFrameworkGenerator = async (ctx, args) => {
|
|
75365
75366
|
const cli = getFrameworkCli(ctx, true);
|
|
75366
|
-
const { npm:
|
|
75367
|
-
const cmd = [...
|
|
75368
|
-
const env3 =
|
|
75367
|
+
const { npm: npm25, dlx } = detectPackageManager();
|
|
75368
|
+
const cmd = [...npm25 === "yarn" ? ["npx"] : dlx, cli, ...args];
|
|
75369
|
+
const env3 = npm25 === "yarn" && !process.env.npm_config_user_agent?.startsWith("yarn") ? { npm_config_user_agent: "yarn/1.22.22" } : {};
|
|
75369
75370
|
if (ctx.args.additionalArgs?.length) {
|
|
75370
75371
|
cmd.push(...ctx.args.additionalArgs);
|
|
75371
75372
|
}
|
|
@@ -76615,6 +76616,7 @@ var generate15 = async (ctx) => {
|
|
|
76615
76616
|
ctx.project.name,
|
|
76616
76617
|
"--packageManager",
|
|
76617
76618
|
npm10,
|
|
76619
|
+
"--no-install",
|
|
76618
76620
|
gitFlag
|
|
76619
76621
|
]);
|
|
76620
76622
|
writeFile2("./.node-version", "18");
|
|
@@ -76724,6 +76726,7 @@ var generate16 = async (ctx) => {
|
|
|
76724
76726
|
ctx.project.name,
|
|
76725
76727
|
"--packageManager",
|
|
76726
76728
|
npm11,
|
|
76729
|
+
"--no-install",
|
|
76727
76730
|
gitFlag
|
|
76728
76731
|
]);
|
|
76729
76732
|
writeFile2("./.node-version", "18");
|
|
@@ -77272,9 +77275,46 @@ var config25 = {
|
|
|
77272
77275
|
};
|
|
77273
77276
|
var c3_default34 = config25;
|
|
77274
77277
|
|
|
77275
|
-
// templates/react/
|
|
77278
|
+
// templates/react-router/c3.ts
|
|
77276
77279
|
var { npm: npm14 } = detectPackageManager();
|
|
77277
77280
|
var generate19 = async (ctx) => {
|
|
77281
|
+
await runFrameworkGenerator(ctx, [
|
|
77282
|
+
ctx.project.name,
|
|
77283
|
+
"--template",
|
|
77284
|
+
"https://github.com/remix-run/react-router-templates/tree/main/cloudflare",
|
|
77285
|
+
// to prevent asking about git twice, just let c3 do it
|
|
77286
|
+
"--no-git-init",
|
|
77287
|
+
"--no-install"
|
|
77288
|
+
]);
|
|
77289
|
+
logRaw("");
|
|
77290
|
+
};
|
|
77291
|
+
var config26 = {
|
|
77292
|
+
configVersion: 1,
|
|
77293
|
+
id: "react-router",
|
|
77294
|
+
platform: "workers",
|
|
77295
|
+
frameworkCli: "create-react-router",
|
|
77296
|
+
displayName: "React Router (formerly Remix)",
|
|
77297
|
+
copyFiles: {
|
|
77298
|
+
path: "./templates"
|
|
77299
|
+
},
|
|
77300
|
+
generate: generate19,
|
|
77301
|
+
// configure,
|
|
77302
|
+
transformPackageJson: async () => ({
|
|
77303
|
+
scripts: {
|
|
77304
|
+
deploy: `${npm14} run build && wrangler deploy`,
|
|
77305
|
+
preview: `${npm14} run build && vite preview`,
|
|
77306
|
+
"cf-typegen": `wrangler types`
|
|
77307
|
+
}
|
|
77308
|
+
}),
|
|
77309
|
+
devScript: "dev",
|
|
77310
|
+
deployScript: "deploy",
|
|
77311
|
+
previewScript: "preview"
|
|
77312
|
+
};
|
|
77313
|
+
var c3_default35 = config26;
|
|
77314
|
+
|
|
77315
|
+
// templates/react/pages/c3.ts
|
|
77316
|
+
var { npm: npm15 } = detectPackageManager();
|
|
77317
|
+
var generate20 = async (ctx) => {
|
|
77278
77318
|
const variant = await inputPrompt({
|
|
77279
77319
|
type: "select",
|
|
77280
77320
|
question: "Select a variant:",
|
|
@@ -77303,7 +77343,7 @@ var variantsOptions = [
|
|
|
77303
77343
|
label: "JavaScript + SWC"
|
|
77304
77344
|
}
|
|
77305
77345
|
];
|
|
77306
|
-
var
|
|
77346
|
+
var config27 = {
|
|
77307
77347
|
configVersion: 1,
|
|
77308
77348
|
id: "react",
|
|
77309
77349
|
// React's documentation now recommends using create-vite.
|
|
@@ -77311,26 +77351,26 @@ var config26 = {
|
|
|
77311
77351
|
displayName: "React",
|
|
77312
77352
|
platform: "pages",
|
|
77313
77353
|
path: "templates/react/pages",
|
|
77314
|
-
generate:
|
|
77354
|
+
generate: generate20,
|
|
77315
77355
|
transformPackageJson: async () => ({
|
|
77316
77356
|
scripts: {
|
|
77317
|
-
deploy: `${
|
|
77318
|
-
preview: `${
|
|
77357
|
+
deploy: `${npm15} run build && wrangler pages deploy ./dist`,
|
|
77358
|
+
preview: `${npm15} run build && wrangler pages dev ./dist`
|
|
77319
77359
|
}
|
|
77320
77360
|
}),
|
|
77321
77361
|
devScript: "dev",
|
|
77322
77362
|
deployScript: "deploy",
|
|
77323
77363
|
previewScript: "preview"
|
|
77324
77364
|
};
|
|
77325
|
-
var
|
|
77365
|
+
var c3_default36 = config27;
|
|
77326
77366
|
|
|
77327
77367
|
// templates/react/workers/c3.ts
|
|
77328
77368
|
var import_assert2 = __toESM(require("assert"));
|
|
77329
77369
|
var recast10 = __toESM(require_main3());
|
|
77330
77370
|
var b2 = recast10.types.builders;
|
|
77331
77371
|
var t = recast10.types.namedTypes;
|
|
77332
|
-
var { npm:
|
|
77333
|
-
var
|
|
77372
|
+
var { npm: npm16 } = detectPackageManager();
|
|
77373
|
+
var generate21 = async (ctx) => {
|
|
77334
77374
|
const variant = await getVariant();
|
|
77335
77375
|
ctx.args.lang = variant.lang;
|
|
77336
77376
|
await runFrameworkGenerator(ctx, [
|
|
@@ -77371,9 +77411,9 @@ function transformViteConfig(ctx) {
|
|
|
77371
77411
|
if (callee.name !== "defineConfig") {
|
|
77372
77412
|
return this.traverse(n);
|
|
77373
77413
|
}
|
|
77374
|
-
const
|
|
77375
|
-
(0, import_assert2.default)(t.ObjectExpression.check(
|
|
77376
|
-
const pluginsProp =
|
|
77414
|
+
const config40 = n.node.arguments[0];
|
|
77415
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config40));
|
|
77416
|
+
const pluginsProp = config40.properties.find((prop) => isPluginsProp(prop));
|
|
77377
77417
|
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77378
77418
|
pluginsProp.value.elements.push(
|
|
77379
77419
|
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
@@ -77430,7 +77470,7 @@ async function getVariant() {
|
|
|
77430
77470
|
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
77431
77471
|
return selected;
|
|
77432
77472
|
}
|
|
77433
|
-
var
|
|
77473
|
+
var config28 = {
|
|
77434
77474
|
configVersion: 1,
|
|
77435
77475
|
id: "react",
|
|
77436
77476
|
frameworkCli: "create-vite",
|
|
@@ -77447,12 +77487,12 @@ var config27 = {
|
|
|
77447
77487
|
}
|
|
77448
77488
|
}
|
|
77449
77489
|
},
|
|
77450
|
-
generate:
|
|
77490
|
+
generate: generate21,
|
|
77451
77491
|
configure: configure13,
|
|
77452
77492
|
transformPackageJson: async (_3, ctx) => ({
|
|
77453
77493
|
scripts: {
|
|
77454
|
-
deploy: `${
|
|
77455
|
-
preview: `${
|
|
77494
|
+
deploy: `${npm16} run build && wrangler deploy`,
|
|
77495
|
+
preview: `${npm16} run build && vite preview`,
|
|
77456
77496
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77457
77497
|
}
|
|
77458
77498
|
}),
|
|
@@ -77460,18 +77500,18 @@ var config27 = {
|
|
|
77460
77500
|
deployScript: "deploy",
|
|
77461
77501
|
previewScript: "preview"
|
|
77462
77502
|
};
|
|
77463
|
-
var
|
|
77503
|
+
var c3_default37 = config28;
|
|
77464
77504
|
|
|
77465
77505
|
// templates/react/c3.ts
|
|
77466
|
-
var
|
|
77506
|
+
var config29 = {
|
|
77467
77507
|
displayName: "React",
|
|
77468
|
-
platformVariants: { pages:
|
|
77508
|
+
platformVariants: { pages: c3_default36, workers: c3_default37 }
|
|
77469
77509
|
};
|
|
77470
|
-
var
|
|
77510
|
+
var c3_default38 = config29;
|
|
77471
77511
|
|
|
77472
77512
|
// templates/remix/pages/c3.ts
|
|
77473
|
-
var { npm:
|
|
77474
|
-
var
|
|
77513
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77514
|
+
var generate22 = async (ctx) => {
|
|
77475
77515
|
await runFrameworkGenerator(ctx, [
|
|
77476
77516
|
ctx.project.name,
|
|
77477
77517
|
"--template",
|
|
@@ -77494,7 +77534,7 @@ var configure14 = async () => {
|
|
|
77494
77534
|
});
|
|
77495
77535
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
77496
77536
|
};
|
|
77497
|
-
var
|
|
77537
|
+
var config30 = {
|
|
77498
77538
|
configVersion: 1,
|
|
77499
77539
|
id: "remix",
|
|
77500
77540
|
frameworkCli: "create-remix",
|
|
@@ -77504,12 +77544,12 @@ var config29 = {
|
|
|
77504
77544
|
path: "./templates"
|
|
77505
77545
|
},
|
|
77506
77546
|
path: "templates/remix/pages",
|
|
77507
|
-
generate:
|
|
77547
|
+
generate: generate22,
|
|
77508
77548
|
configure: configure14,
|
|
77509
77549
|
transformPackageJson: async () => ({
|
|
77510
77550
|
scripts: {
|
|
77511
|
-
deploy: `${
|
|
77512
|
-
preview: `${
|
|
77551
|
+
deploy: `${npm17} run build && wrangler pages deploy`,
|
|
77552
|
+
preview: `${npm17} run build && wrangler pages dev`,
|
|
77513
77553
|
"cf-typegen": `wrangler types`
|
|
77514
77554
|
}
|
|
77515
77555
|
}),
|
|
@@ -77517,11 +77557,11 @@ var config29 = {
|
|
|
77517
77557
|
deployScript: "deploy",
|
|
77518
77558
|
previewScript: "preview"
|
|
77519
77559
|
};
|
|
77520
|
-
var
|
|
77560
|
+
var c3_default39 = config30;
|
|
77521
77561
|
|
|
77522
77562
|
// templates/remix/workers/c3.ts
|
|
77523
|
-
var { npm:
|
|
77524
|
-
var
|
|
77563
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77564
|
+
var generate23 = async (ctx) => {
|
|
77525
77565
|
await runFrameworkGenerator(ctx, [
|
|
77526
77566
|
ctx.project.name,
|
|
77527
77567
|
"--template",
|
|
@@ -77536,7 +77576,7 @@ var configure15 = async () => {
|
|
|
77536
77576
|
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
77537
77577
|
});
|
|
77538
77578
|
};
|
|
77539
|
-
var
|
|
77579
|
+
var config31 = {
|
|
77540
77580
|
configVersion: 1,
|
|
77541
77581
|
id: "remix",
|
|
77542
77582
|
frameworkCli: "create-remix",
|
|
@@ -77546,12 +77586,12 @@ var config30 = {
|
|
|
77546
77586
|
path: "./templates"
|
|
77547
77587
|
},
|
|
77548
77588
|
path: "templates/remix/workers",
|
|
77549
|
-
generate:
|
|
77589
|
+
generate: generate23,
|
|
77550
77590
|
configure: configure15,
|
|
77551
77591
|
transformPackageJson: async () => ({
|
|
77552
77592
|
scripts: {
|
|
77553
|
-
deploy: `${
|
|
77554
|
-
preview: `${
|
|
77593
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
77594
|
+
preview: `${npm18} run build && wrangler dev`,
|
|
77555
77595
|
"cf-typegen": `wrangler types`
|
|
77556
77596
|
}
|
|
77557
77597
|
}),
|
|
@@ -77559,17 +77599,18 @@ var config30 = {
|
|
|
77559
77599
|
deployScript: "deploy",
|
|
77560
77600
|
previewScript: "preview"
|
|
77561
77601
|
};
|
|
77562
|
-
var
|
|
77602
|
+
var c3_default40 = config31;
|
|
77563
77603
|
|
|
77564
77604
|
// templates/remix/c3.ts
|
|
77565
|
-
var
|
|
77605
|
+
var config32 = {
|
|
77566
77606
|
displayName: "Remix",
|
|
77567
|
-
platformVariants: { pages:
|
|
77607
|
+
platformVariants: { pages: c3_default39, workers: c3_default40 },
|
|
77608
|
+
hidden: true
|
|
77568
77609
|
};
|
|
77569
|
-
var
|
|
77610
|
+
var c3_default41 = config32;
|
|
77570
77611
|
|
|
77571
77612
|
// templates/scheduled/c3.ts
|
|
77572
|
-
var
|
|
77613
|
+
var c3_default42 = {
|
|
77573
77614
|
configVersion: 1,
|
|
77574
77615
|
id: "scheduled",
|
|
77575
77616
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -77589,8 +77630,8 @@ var c3_default41 = {
|
|
|
77589
77630
|
|
|
77590
77631
|
// templates/solid/c3.ts
|
|
77591
77632
|
var recast11 = __toESM(require_main3());
|
|
77592
|
-
var { npm:
|
|
77593
|
-
var
|
|
77633
|
+
var { npm: npm19 } = detectPackageManager();
|
|
77634
|
+
var generate24 = async (ctx) => {
|
|
77594
77635
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
77595
77636
|
logRaw("");
|
|
77596
77637
|
};
|
|
@@ -77632,7 +77673,7 @@ var configure16 = async (ctx) => {
|
|
|
77632
77673
|
}
|
|
77633
77674
|
});
|
|
77634
77675
|
};
|
|
77635
|
-
var
|
|
77676
|
+
var config33 = {
|
|
77636
77677
|
configVersion: 1,
|
|
77637
77678
|
id: "solid",
|
|
77638
77679
|
frameworkCli: "create-solid",
|
|
@@ -77641,12 +77682,12 @@ var config32 = {
|
|
|
77641
77682
|
copyFiles: {
|
|
77642
77683
|
path: "./templates"
|
|
77643
77684
|
},
|
|
77644
|
-
generate:
|
|
77685
|
+
generate: generate24,
|
|
77645
77686
|
configure: configure16,
|
|
77646
77687
|
transformPackageJson: async () => ({
|
|
77647
77688
|
scripts: {
|
|
77648
|
-
preview: `${
|
|
77649
|
-
deploy: `${
|
|
77689
|
+
preview: `${npm19} run build && npx wrangler pages dev`,
|
|
77690
|
+
deploy: `${npm19} run build && wrangler pages deploy`
|
|
77650
77691
|
}
|
|
77651
77692
|
}),
|
|
77652
77693
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -77654,14 +77695,14 @@ var config32 = {
|
|
|
77654
77695
|
deployScript: "deploy",
|
|
77655
77696
|
previewScript: "preview"
|
|
77656
77697
|
};
|
|
77657
|
-
var
|
|
77698
|
+
var c3_default43 = config33;
|
|
77658
77699
|
|
|
77659
77700
|
// templates/svelte/pages/c3.ts
|
|
77660
77701
|
var import_node_fs3 = require("node:fs");
|
|
77661
77702
|
var import_node_os3 = require("node:os");
|
|
77662
77703
|
var recast12 = __toESM(require_main3());
|
|
77663
|
-
var { npm:
|
|
77664
|
-
var
|
|
77704
|
+
var { npm: npm20 } = detectPackageManager();
|
|
77705
|
+
var generate25 = async (ctx) => {
|
|
77665
77706
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77666
77707
|
logRaw("");
|
|
77667
77708
|
};
|
|
@@ -77747,7 +77788,7 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
77747
77788
|
}
|
|
77748
77789
|
});
|
|
77749
77790
|
};
|
|
77750
|
-
var
|
|
77791
|
+
var config34 = {
|
|
77751
77792
|
configVersion: 1,
|
|
77752
77793
|
id: "svelte",
|
|
77753
77794
|
frameworkCli: "sv",
|
|
@@ -77757,12 +77798,12 @@ var config33 = {
|
|
|
77757
77798
|
path: "./templates"
|
|
77758
77799
|
},
|
|
77759
77800
|
path: "templates/svelte/pages",
|
|
77760
|
-
generate:
|
|
77801
|
+
generate: generate25,
|
|
77761
77802
|
configure: configure17,
|
|
77762
77803
|
transformPackageJson: async (original, ctx) => {
|
|
77763
77804
|
let scripts = {
|
|
77764
|
-
preview: `${
|
|
77765
|
-
deploy: `${
|
|
77805
|
+
preview: `${npm20} run build && wrangler pages dev`,
|
|
77806
|
+
deploy: `${npm20} run build && wrangler pages deploy`
|
|
77766
77807
|
};
|
|
77767
77808
|
if (usesTypescript(ctx)) {
|
|
77768
77809
|
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
@@ -77777,13 +77818,13 @@ var config33 = {
|
|
|
77777
77818
|
deployScript: "deploy",
|
|
77778
77819
|
previewScript: "preview"
|
|
77779
77820
|
};
|
|
77780
|
-
var
|
|
77821
|
+
var c3_default44 = config34;
|
|
77781
77822
|
|
|
77782
77823
|
// templates/svelte/workers/c3.ts
|
|
77783
77824
|
var import_node_os4 = require("node:os");
|
|
77784
77825
|
var recast13 = __toESM(require_main3());
|
|
77785
|
-
var { npm:
|
|
77786
|
-
var
|
|
77826
|
+
var { npm: npm21 } = detectPackageManager();
|
|
77827
|
+
var generate26 = async (ctx) => {
|
|
77787
77828
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
77788
77829
|
logRaw("");
|
|
77789
77830
|
};
|
|
@@ -77846,7 +77887,7 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
77846
77887
|
}
|
|
77847
77888
|
});
|
|
77848
77889
|
};
|
|
77849
|
-
var
|
|
77890
|
+
var config35 = {
|
|
77850
77891
|
configVersion: 1,
|
|
77851
77892
|
id: "svelte",
|
|
77852
77893
|
frameworkCli: "sv",
|
|
@@ -77856,12 +77897,12 @@ var config34 = {
|
|
|
77856
77897
|
path: "./templates"
|
|
77857
77898
|
},
|
|
77858
77899
|
path: "templates/svelte/workers",
|
|
77859
|
-
generate:
|
|
77900
|
+
generate: generate26,
|
|
77860
77901
|
configure: configure18,
|
|
77861
77902
|
transformPackageJson: async (original, ctx) => {
|
|
77862
77903
|
let scripts = {
|
|
77863
|
-
preview: `${
|
|
77864
|
-
deploy: `${
|
|
77904
|
+
preview: `${npm21} run build && wrangler dev`,
|
|
77905
|
+
deploy: `${npm21} run build && wrangler deploy`
|
|
77865
77906
|
};
|
|
77866
77907
|
if (usesTypescript(ctx)) {
|
|
77867
77908
|
const mv = (0, import_node_os4.platform)() === "win32" ? "move" : "mv";
|
|
@@ -77876,43 +77917,43 @@ var config34 = {
|
|
|
77876
77917
|
deployScript: "deploy",
|
|
77877
77918
|
previewScript: "preview"
|
|
77878
77919
|
};
|
|
77879
|
-
var
|
|
77920
|
+
var c3_default45 = config35;
|
|
77880
77921
|
|
|
77881
77922
|
// templates/svelte/c3.ts
|
|
77882
|
-
var
|
|
77923
|
+
var config36 = {
|
|
77883
77924
|
displayName: "SvelteKit",
|
|
77884
|
-
platformVariants: { pages:
|
|
77925
|
+
platformVariants: { pages: c3_default44, workers: c3_default45 }
|
|
77885
77926
|
};
|
|
77886
|
-
var
|
|
77927
|
+
var c3_default46 = config36;
|
|
77887
77928
|
|
|
77888
77929
|
// templates/vue/pages/c3.ts
|
|
77889
|
-
var { npm:
|
|
77890
|
-
var
|
|
77930
|
+
var { npm: npm22 } = detectPackageManager();
|
|
77931
|
+
var generate27 = async (ctx) => {
|
|
77891
77932
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
77892
77933
|
};
|
|
77893
|
-
var
|
|
77934
|
+
var config37 = {
|
|
77894
77935
|
configVersion: 1,
|
|
77895
77936
|
id: "vue",
|
|
77896
77937
|
frameworkCli: "create-vue",
|
|
77897
77938
|
displayName: "Vue",
|
|
77898
77939
|
platform: "pages",
|
|
77899
77940
|
path: "templates/pages/vue",
|
|
77900
|
-
generate:
|
|
77941
|
+
generate: generate27,
|
|
77901
77942
|
transformPackageJson: async () => ({
|
|
77902
77943
|
scripts: {
|
|
77903
|
-
deploy: `${
|
|
77904
|
-
preview: `${
|
|
77944
|
+
deploy: `${npm22} run build && wrangler pages deploy ./dist`,
|
|
77945
|
+
preview: `${npm22} run build && wrangler pages dev ./dist`
|
|
77905
77946
|
}
|
|
77906
77947
|
}),
|
|
77907
77948
|
devScript: "dev",
|
|
77908
77949
|
deployScript: "deploy",
|
|
77909
77950
|
previewScript: "preview"
|
|
77910
77951
|
};
|
|
77911
|
-
var
|
|
77952
|
+
var c3_default47 = config37;
|
|
77912
77953
|
|
|
77913
77954
|
// templates/vue/workers/c3.ts
|
|
77914
|
-
var { npm:
|
|
77915
|
-
var
|
|
77955
|
+
var { npm: npm23 } = detectPackageManager();
|
|
77956
|
+
var generate28 = async (ctx) => {
|
|
77916
77957
|
const lang = ctx.args.lang ?? await inputPrompt({
|
|
77917
77958
|
type: "select",
|
|
77918
77959
|
question: "Would you like to use TypeScript?",
|
|
@@ -77950,7 +77991,7 @@ function updateTsconfigJson2() {
|
|
|
77950
77991
|
writeJSON("tsconfig.json", tsconfig);
|
|
77951
77992
|
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77952
77993
|
}
|
|
77953
|
-
var
|
|
77994
|
+
var config38 = {
|
|
77954
77995
|
configVersion: 1,
|
|
77955
77996
|
id: "vue",
|
|
77956
77997
|
frameworkCli: "create-vue",
|
|
@@ -77971,11 +78012,11 @@ var config37 = {
|
|
|
77971
78012
|
}
|
|
77972
78013
|
},
|
|
77973
78014
|
configure: configure19,
|
|
77974
|
-
generate:
|
|
78015
|
+
generate: generate28,
|
|
77975
78016
|
transformPackageJson: async (_3, ctx) => ({
|
|
77976
78017
|
scripts: {
|
|
77977
|
-
deploy: `${
|
|
77978
|
-
preview: `${
|
|
78018
|
+
deploy: `${npm23} run build && wrangler deploy`,
|
|
78019
|
+
preview: `${npm23} run build && wrangler dev`,
|
|
77979
78020
|
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77980
78021
|
}
|
|
77981
78022
|
}),
|
|
@@ -77983,20 +78024,20 @@ var config37 = {
|
|
|
77983
78024
|
deployScript: "deploy",
|
|
77984
78025
|
previewScript: "preview"
|
|
77985
78026
|
};
|
|
77986
|
-
var
|
|
78027
|
+
var c3_default48 = config38;
|
|
77987
78028
|
|
|
77988
78029
|
// templates/vue/c3.ts
|
|
77989
|
-
var
|
|
78030
|
+
var config39 = {
|
|
77990
78031
|
displayName: "Vue",
|
|
77991
|
-
platformVariants: { pages:
|
|
78032
|
+
platformVariants: { pages: c3_default47, workers: c3_default48 }
|
|
77992
78033
|
};
|
|
77993
|
-
var
|
|
78034
|
+
var c3_default49 = config39;
|
|
77994
78035
|
|
|
77995
78036
|
// src/git.ts
|
|
77996
78037
|
var import_node_assert = __toESM(require("node:assert"));
|
|
77997
78038
|
|
|
77998
78039
|
// ../wrangler/package.json
|
|
77999
|
-
var version2 = "4.4.
|
|
78040
|
+
var version2 = "4.4.1";
|
|
78000
78041
|
|
|
78001
78042
|
// src/git.ts
|
|
78002
78043
|
var offerGit = async (ctx) => {
|
|
@@ -78271,11 +78312,12 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
78271
78312
|
next: c3_default25,
|
|
78272
78313
|
nuxt: c3_default28,
|
|
78273
78314
|
qwik: c3_default34,
|
|
78274
|
-
react:
|
|
78275
|
-
|
|
78276
|
-
|
|
78277
|
-
|
|
78278
|
-
|
|
78315
|
+
react: c3_default38,
|
|
78316
|
+
"react-router": c3_default35,
|
|
78317
|
+
remix: c3_default41,
|
|
78318
|
+
solid: c3_default43,
|
|
78319
|
+
svelte: c3_default46,
|
|
78320
|
+
vue: c3_default49
|
|
78279
78321
|
};
|
|
78280
78322
|
}
|
|
78281
78323
|
}
|
|
@@ -78290,7 +78332,7 @@ function getTemplateMap({ experimental = false }) {
|
|
|
78290
78332
|
"hello-world-durable-object": c3_default19,
|
|
78291
78333
|
"hello-world-durable-object-with-assets": c3_default18,
|
|
78292
78334
|
common: c3_default10,
|
|
78293
|
-
scheduled:
|
|
78335
|
+
scheduled: c3_default42,
|
|
78294
78336
|
queues: c3_default31,
|
|
78295
78337
|
openapi: c3_default29,
|
|
78296
78338
|
"pre-existing": c3_default30
|
|
@@ -78440,11 +78482,17 @@ var createContext = async (args, prevArgs) => {
|
|
|
78440
78482
|
const frameworkMap = getFrameworkMap({
|
|
78441
78483
|
experimental: args.experimental
|
|
78442
78484
|
});
|
|
78443
|
-
const frameworkOptions = Object.entries(frameworkMap).
|
|
78444
|
-
([key,
|
|
78445
|
-
|
|
78446
|
-
|
|
78447
|
-
|
|
78485
|
+
const frameworkOptions = Object.entries(frameworkMap).reduce(
|
|
78486
|
+
(acc, [key, config40]) => {
|
|
78487
|
+
if (!config40.hidden || args.framework) {
|
|
78488
|
+
acc.push({
|
|
78489
|
+
label: config40.displayName,
|
|
78490
|
+
value: key
|
|
78491
|
+
});
|
|
78492
|
+
}
|
|
78493
|
+
return acc;
|
|
78494
|
+
},
|
|
78495
|
+
[]
|
|
78448
78496
|
);
|
|
78449
78497
|
const framework = await processArgument(args, "framework", {
|
|
78450
78498
|
type: "select",
|
|
@@ -78609,28 +78657,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
78609
78657
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78610
78658
|
}
|
|
78611
78659
|
const path6 = await downloadRemoteTemplate(src);
|
|
78612
|
-
const
|
|
78613
|
-
validateTemplate(path6,
|
|
78660
|
+
const config40 = inferTemplateConfig(path6);
|
|
78661
|
+
validateTemplate(path6, config40);
|
|
78614
78662
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78615
78663
|
return {
|
|
78616
78664
|
path: path6,
|
|
78617
|
-
...
|
|
78665
|
+
...config40
|
|
78618
78666
|
};
|
|
78619
78667
|
};
|
|
78620
|
-
var validateTemplate = (path6,
|
|
78621
|
-
if (!
|
|
78668
|
+
var validateTemplate = (path6, config40) => {
|
|
78669
|
+
if (!config40.copyFiles) {
|
|
78622
78670
|
return;
|
|
78623
78671
|
}
|
|
78624
|
-
if (isVariantInfo(
|
|
78625
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78672
|
+
if (isVariantInfo(config40.copyFiles)) {
|
|
78673
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config40.copyFiles.path), config40);
|
|
78626
78674
|
} else {
|
|
78627
|
-
for (const variant of Object.values(
|
|
78628
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78675
|
+
for (const variant of Object.values(config40.copyFiles.variants)) {
|
|
78676
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config40);
|
|
78629
78677
|
}
|
|
78630
78678
|
}
|
|
78631
78679
|
};
|
|
78632
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78633
|
-
if (
|
|
78680
|
+
var validateTemplateSrcDirectory = (path6, config40) => {
|
|
78681
|
+
if (config40.platform === "workers") {
|
|
78634
78682
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78635
78683
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78636
78684
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -80541,20 +80589,20 @@ function applyEdits(text, edits) {
|
|
|
80541
80589
|
var import_fs12 = require("fs");
|
|
80542
80590
|
var import_path14 = require("path");
|
|
80543
80591
|
var import_toml2 = __toESM(require_toml());
|
|
80544
|
-
function ensureNameExists(
|
|
80545
|
-
|
|
80546
|
-
return
|
|
80592
|
+
function ensureNameExists(config40, projectName) {
|
|
80593
|
+
config40["name"] = projectName;
|
|
80594
|
+
return config40;
|
|
80547
80595
|
}
|
|
80548
|
-
async function ensureCompatDateExists(
|
|
80549
|
-
if (typeof
|
|
80596
|
+
async function ensureCompatDateExists(config40) {
|
|
80597
|
+
if (typeof config40["compatibility_date"] === "string") {
|
|
80550
80598
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80551
|
-
if (!
|
|
80552
|
-
|
|
80599
|
+
if (!config40["compatibility_date"].match(validCompatDateRe)) {
|
|
80600
|
+
config40["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80553
80601
|
}
|
|
80554
80602
|
} else {
|
|
80555
|
-
|
|
80603
|
+
config40["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80556
80604
|
}
|
|
80557
|
-
return
|
|
80605
|
+
return config40;
|
|
80558
80606
|
}
|
|
80559
80607
|
var updateWranglerConfig = async (ctx) => {
|
|
80560
80608
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -80565,12 +80613,15 @@ var updateWranglerConfig = async (ctx) => {
|
|
|
80565
80613
|
const modified = await ensureCompatDateExists(
|
|
80566
80614
|
ensureNameExists(parsed, ctx.project.name)
|
|
80567
80615
|
);
|
|
80568
|
-
|
|
80616
|
+
let comment = `/**
|
|
80569
80617
|
* For more details on how to configure Wrangler, refer to:
|
|
80570
80618
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
|
80571
80619
|
*/
|
|
80572
|
-
{
|
|
80620
|
+
{`;
|
|
80621
|
+
if (!modified["$schema"]) {
|
|
80622
|
+
comment += `
|
|
80573
80623
|
"$schema": "node_modules/wrangler/config-schema.json",`;
|
|
80624
|
+
}
|
|
80574
80625
|
if (!modified["observability"]) {
|
|
80575
80626
|
modified["observability"] = { enabled: true };
|
|
80576
80627
|
}
|
|
@@ -80725,7 +80776,7 @@ var addVscodeConfig = (ctx) => {
|
|
|
80725
80776
|
|
|
80726
80777
|
// src/deploy.ts
|
|
80727
80778
|
var offerToDeploy = async (ctx) => {
|
|
80728
|
-
const { npm:
|
|
80779
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80729
80780
|
startSection(`Deploy with Cloudflare`, `Step 3 of 3`);
|
|
80730
80781
|
if (!await isDeployable(ctx)) {
|
|
80731
80782
|
ctx.args.deploy = false;
|
|
@@ -80736,7 +80787,7 @@ var offerToDeploy = async (ctx) => {
|
|
|
80736
80787
|
);
|
|
80737
80788
|
}
|
|
80738
80789
|
const label = `deploy via \`${quoteShellArgs([
|
|
80739
|
-
|
|
80790
|
+
npm25,
|
|
80740
80791
|
"run",
|
|
80741
80792
|
ctx.template.deployScript ?? "deploy"
|
|
80742
80793
|
])}\``;
|
|
@@ -80773,11 +80824,11 @@ var readWranglerConfig = (ctx) => {
|
|
|
80773
80824
|
return import_toml3.default.parse(wranglerTomlStr.replace(/\r\n/g, "\n"));
|
|
80774
80825
|
};
|
|
80775
80826
|
var runDeploy = async (ctx) => {
|
|
80776
|
-
const { npm:
|
|
80827
|
+
const { npm: npm25, name: pm4 } = detectPackageManager();
|
|
80777
80828
|
if (!ctx.account?.id) {
|
|
80778
80829
|
throw new Error("Failed to read Cloudflare account.");
|
|
80779
80830
|
}
|
|
80780
|
-
const baseDeployCmd = [
|
|
80831
|
+
const baseDeployCmd = [npm25, "run", ctx.template.deployScript ?? "deploy"];
|
|
80781
80832
|
const insideGitRepo = await isInsideGitRepo(ctx.project.path);
|
|
80782
80833
|
const deployCmd = [
|
|
80783
80834
|
...baseDeployCmd,
|
|
@@ -80893,14 +80944,14 @@ var printSummary = (ctx) => {
|
|
|
80893
80944
|
const dashboardUrl = ctx.account ? `https://dash.cloudflare.com/?to=/:account/workers/services/view/${ctx.project.name}` : null;
|
|
80894
80945
|
const relativePath = (0, import_path15.relative)(ctx.originalCWD, ctx.project.path);
|
|
80895
80946
|
const cdCommand = relativePath ? `cd ${relativePath}` : null;
|
|
80896
|
-
const { npm:
|
|
80947
|
+
const { npm: npm25 } = detectPackageManager();
|
|
80897
80948
|
const devServerCommand = quoteShellArgs([
|
|
80898
|
-
|
|
80949
|
+
npm25,
|
|
80899
80950
|
"run",
|
|
80900
80951
|
ctx.template.devScript ?? "start"
|
|
80901
80952
|
]);
|
|
80902
80953
|
const deployCommand = quoteShellArgs([
|
|
80903
|
-
|
|
80954
|
+
npm25,
|
|
80904
80955
|
"run",
|
|
80905
80956
|
ctx.template.deployScript ?? "deploy"
|
|
80906
80957
|
]);
|
|
@@ -81268,8 +81319,8 @@ var renderValues = (values) => {
|
|
|
81268
81319
|
};
|
|
81269
81320
|
|
|
81270
81321
|
// src/helpers/retry.ts
|
|
81271
|
-
var retry = async (
|
|
81272
|
-
let { times } =
|
|
81322
|
+
var retry = async (config40, fn) => {
|
|
81323
|
+
let { times } = config40;
|
|
81273
81324
|
let error2 = null;
|
|
81274
81325
|
while (times > 0) {
|
|
81275
81326
|
try {
|
|
@@ -81277,10 +81328,10 @@ var retry = async (config39, fn) => {
|
|
|
81277
81328
|
} catch (e) {
|
|
81278
81329
|
error2 = e;
|
|
81279
81330
|
times--;
|
|
81280
|
-
if (
|
|
81331
|
+
if (config40.exitCondition?.(e)) {
|
|
81281
81332
|
break;
|
|
81282
81333
|
}
|
|
81283
|
-
await sleep(
|
|
81334
|
+
await sleep(config40.sleepMs ?? 1e3);
|
|
81284
81335
|
}
|
|
81285
81336
|
}
|
|
81286
81337
|
throw error2;
|
|
@@ -81370,14 +81421,14 @@ var createProject = async (ctx) => {
|
|
|
81370
81421
|
var import_fs13 = require("fs");
|
|
81371
81422
|
var import_path16 = require("path");
|
|
81372
81423
|
async function installWorkersTypes(ctx) {
|
|
81373
|
-
const { npm:
|
|
81424
|
+
const { npm: npm25 } = detectPackageManager();
|
|
81374
81425
|
if (!usesTypescript(ctx)) {
|
|
81375
81426
|
return;
|
|
81376
81427
|
}
|
|
81377
81428
|
await installPackages(["@cloudflare/workers-types"], {
|
|
81378
81429
|
dev: true,
|
|
81379
81430
|
startText: "Installing @cloudflare/workers-types",
|
|
81380
|
-
doneText: `${brandColor("installed")} ${dim(`via ${
|
|
81431
|
+
doneText: `${brandColor("installed")} ${dim(`via ${npm25}`)}`
|
|
81381
81432
|
});
|
|
81382
81433
|
await addWorkersTypesToTsConfig(ctx);
|
|
81383
81434
|
}
|
|
@@ -81400,8 +81451,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81400
81451
|
}
|
|
81401
81452
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81402
81453
|
try {
|
|
81403
|
-
const
|
|
81404
|
-
const currentTypes =
|
|
81454
|
+
const config40 = parse4(tsconfig);
|
|
81455
|
+
const currentTypes = config40.compilerOptions?.types ?? [];
|
|
81405
81456
|
const explicitEntrypoint = currentTypes.some(
|
|
81406
81457
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81407
81458
|
);
|
|
@@ -81431,7 +81482,7 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81431
81482
|
}
|
|
81432
81483
|
|
|
81433
81484
|
// src/cli.ts
|
|
81434
|
-
var { npm:
|
|
81485
|
+
var { npm: npm24 } = detectPackageManager();
|
|
81435
81486
|
var main = async (argv) => {
|
|
81436
81487
|
const result = await parseArgs(argv);
|
|
81437
81488
|
if (result.type === "unknown") {
|
|
@@ -81467,10 +81518,10 @@ ${result.errorMessage}`);
|
|
|
81467
81518
|
};
|
|
81468
81519
|
var runLatest = async () => {
|
|
81469
81520
|
const args = process.argv.slice(2);
|
|
81470
|
-
if (
|
|
81521
|
+
if (npm24 === "npm") {
|
|
81471
81522
|
args.unshift("--");
|
|
81472
81523
|
}
|
|
81473
|
-
await runCommand([
|
|
81524
|
+
await runCommand([npm24, "create", "cloudflare@latest", ...args]);
|
|
81474
81525
|
};
|
|
81475
81526
|
var runCli = async (args) => {
|
|
81476
81527
|
printBanner(args);
|