create-cloudflare 2.40.1 → 2.40.2
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 +483 -475
- package/package.json +3 -3
- package/templates/react/c3.ts +5 -57
- package/templates/react/pages/c3.ts +62 -0
- package/{templates-experimental/react → templates/react/workers}/c3.ts +4 -3
- package/{templates-experimental/react → templates/react/workers}/ts/api/index.ts +0 -4
- package/{templates-experimental/react → templates/react/workers}/ts/tsconfig.worker.json +1 -1
- package/templates/react/workers/ts/worker-configuration.d.ts +5 -0
- /package/{templates-experimental/react → templates/react/workers}/js/api/index.js +0 -0
- /package/{templates-experimental/react → templates/react/workers}/js/src/App.jsx +0 -0
- /package/{templates-experimental/react → templates/react/workers}/js/src/assets/Cloudflare_Logo.svg +0 -0
- /package/{templates-experimental/react/js/wrangler.json → templates/react/workers/js/wrangler.jsonc} +0 -0
- /package/{templates-experimental/react → templates/react/workers}/ts/src/App.tsx +0 -0
- /package/{templates-experimental/react → templates/react/workers}/ts/src/assets/Cloudflare_Logo.svg +0 -0
- /package/{templates-experimental/react/ts/wrangler.json → templates/react/workers/ts/wrangler.jsonc} +0 -0
package/dist/cli.js
CHANGED
|
@@ -573,7 +573,7 @@ var require_XDGAppPaths = __commonJS({
|
|
|
573
573
|
XDGAppPaths.cache = function cache(dirOptions) {
|
|
574
574
|
return path6.join(xdg.cache(), finalPathSegment(dirOptions));
|
|
575
575
|
};
|
|
576
|
-
XDGAppPaths.config = function
|
|
576
|
+
XDGAppPaths.config = function config30(dirOptions) {
|
|
577
577
|
return path6.join(xdg.config(), finalPathSegment(dirOptions));
|
|
578
578
|
};
|
|
579
579
|
XDGAppPaths.data = function data(dirOptions) {
|
|
@@ -630,7 +630,7 @@ var require_XDG = __commonJS({
|
|
|
630
630
|
var cache = function() {
|
|
631
631
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
|
|
632
632
|
};
|
|
633
|
-
var
|
|
633
|
+
var config30 = function() {
|
|
634
634
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
|
|
635
635
|
};
|
|
636
636
|
var data = function() {
|
|
@@ -642,13 +642,13 @@ var require_XDG = __commonJS({
|
|
|
642
642
|
var state = function() {
|
|
643
643
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), ".local", "state"]);
|
|
644
644
|
};
|
|
645
|
-
return { cache, config:
|
|
645
|
+
return { cache, config: config30, data, runtime, state };
|
|
646
646
|
};
|
|
647
647
|
var macos = function() {
|
|
648
648
|
var cache = function() {
|
|
649
649
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [baseDir(), "Library", "Caches"]);
|
|
650
650
|
};
|
|
651
|
-
var
|
|
651
|
+
var config30 = function() {
|
|
652
652
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [baseDir(), "Library", "Preferences"]);
|
|
653
653
|
};
|
|
654
654
|
var data = function() {
|
|
@@ -660,7 +660,7 @@ var require_XDG = __commonJS({
|
|
|
660
660
|
var state = function() {
|
|
661
661
|
return valOrPath(env3.get("XDG_STATE_HOME"), [baseDir(), "Library", "State"]);
|
|
662
662
|
};
|
|
663
|
-
return { cache, config:
|
|
663
|
+
return { cache, config: config30, data, runtime, state };
|
|
664
664
|
};
|
|
665
665
|
var windows = function() {
|
|
666
666
|
function appData() {
|
|
@@ -672,7 +672,7 @@ var require_XDG = __commonJS({
|
|
|
672
672
|
var cache = function() {
|
|
673
673
|
return valOrPath(env3.get("XDG_CACHE_HOME"), [localAppData(), "xdg.cache"]);
|
|
674
674
|
};
|
|
675
|
-
var
|
|
675
|
+
var config30 = function() {
|
|
676
676
|
return valOrPath(env3.get("XDG_CONFIG_HOME"), [appData(), "xdg.config"]);
|
|
677
677
|
};
|
|
678
678
|
var data = function() {
|
|
@@ -684,7 +684,7 @@ var require_XDG = __commonJS({
|
|
|
684
684
|
var state = function() {
|
|
685
685
|
return valOrPath(env3.get("XDG_STATE_HOME"), [localAppData(), "xdg.state"]);
|
|
686
686
|
};
|
|
687
|
-
return { cache, config:
|
|
687
|
+
return { cache, config: config30, data, runtime, state };
|
|
688
688
|
};
|
|
689
689
|
var XDG_ = function() {
|
|
690
690
|
function XDG_2() {
|
|
@@ -31619,22 +31619,22 @@ var require_dist_web = __commonJS({
|
|
|
31619
31619
|
_createClass(Haikunator3, [{
|
|
31620
31620
|
key: "haikunate",
|
|
31621
31621
|
value: function haikunate(options) {
|
|
31622
|
-
var
|
|
31623
|
-
if (
|
|
31624
|
-
|
|
31622
|
+
var config30 = (0, _lodash["default"])(options, this.config);
|
|
31623
|
+
if (config30.tokenHex === true) {
|
|
31624
|
+
config30.tokenChars = "0123456789abcdef";
|
|
31625
31625
|
}
|
|
31626
31626
|
var adjective = this._randomElement(this.adjectives);
|
|
31627
31627
|
var noun = this._randomElement(this.nouns);
|
|
31628
|
-
if (!
|
|
31629
|
-
|
|
31628
|
+
if (!config30.tokenLength)
|
|
31629
|
+
config30.tokenLength = 0;
|
|
31630
31630
|
var token = "";
|
|
31631
|
-
for (var i = 0; i <
|
|
31632
|
-
token += this._randomElement(
|
|
31631
|
+
for (var i = 0; i < config30.tokenLength; i++) {
|
|
31632
|
+
token += this._randomElement(config30.tokenChars);
|
|
31633
31633
|
}
|
|
31634
31634
|
var sections = [adjective, noun, token];
|
|
31635
31635
|
return sections.filter(function(e) {
|
|
31636
31636
|
return !!e;
|
|
31637
|
-
}).join(
|
|
31637
|
+
}).join(config30.delimiter);
|
|
31638
31638
|
}
|
|
31639
31639
|
/**
|
|
31640
31640
|
* Get a random element from an array/string
|
|
@@ -40191,13 +40191,13 @@ var require_esprima = __commonJS({
|
|
|
40191
40191
|
return Reader2;
|
|
40192
40192
|
}();
|
|
40193
40193
|
var Tokenizer = function() {
|
|
40194
|
-
function Tokenizer2(code,
|
|
40194
|
+
function Tokenizer2(code, config30) {
|
|
40195
40195
|
this.errorHandler = new error_handler_1.ErrorHandler();
|
|
40196
|
-
this.errorHandler.tolerant =
|
|
40196
|
+
this.errorHandler.tolerant = config30 ? typeof config30.tolerant === "boolean" && config30.tolerant : false;
|
|
40197
40197
|
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
|
|
40198
|
-
this.scanner.trackComment =
|
|
40199
|
-
this.trackRange =
|
|
40200
|
-
this.trackLoc =
|
|
40198
|
+
this.scanner.trackComment = config30 ? typeof config30.comment === "boolean" && config30.comment : false;
|
|
40199
|
+
this.trackRange = config30 ? typeof config30.range === "boolean" && config30.range : false;
|
|
40200
|
+
this.trackLoc = config30 ? typeof config30.loc === "boolean" && config30.loc : false;
|
|
40201
40201
|
this.buffer = [];
|
|
40202
40202
|
this.reader = new Reader();
|
|
40203
40203
|
}
|
|
@@ -50020,11 +50020,11 @@ var require_printer = __commonJS({
|
|
|
50020
50020
|
return this.code;
|
|
50021
50021
|
};
|
|
50022
50022
|
var emptyPrintResult = new PrintResult("");
|
|
50023
|
-
var Printer = function Printer2(
|
|
50023
|
+
var Printer = function Printer2(config30) {
|
|
50024
50024
|
assert_1.default.ok(this instanceof Printer2);
|
|
50025
|
-
var explicitTabWidth =
|
|
50026
|
-
|
|
50027
|
-
|
|
50025
|
+
var explicitTabWidth = config30 && config30.tabWidth;
|
|
50026
|
+
config30 = options_1.normalize(config30);
|
|
50027
|
+
config30.sourceFileName = null;
|
|
50028
50028
|
function makePrintFunctionWith(options, overrides) {
|
|
50029
50029
|
options = Object.assign({}, options, overrides);
|
|
50030
50030
|
return function(path6) {
|
|
@@ -50039,11 +50039,11 @@ var require_printer = __commonJS({
|
|
|
50039
50039
|
includeComments: false
|
|
50040
50040
|
}));
|
|
50041
50041
|
}
|
|
50042
|
-
var oldTabWidth =
|
|
50042
|
+
var oldTabWidth = config30.tabWidth;
|
|
50043
50043
|
if (!explicitTabWidth) {
|
|
50044
50044
|
var loc = path6.getNode().loc;
|
|
50045
50045
|
if (loc && loc.lines && loc.lines.guessTabWidth) {
|
|
50046
|
-
|
|
50046
|
+
config30.tabWidth = loc.lines.guessTabWidth();
|
|
50047
50047
|
}
|
|
50048
50048
|
}
|
|
50049
50049
|
var reprinter = patcher_1.getReprinter(path6);
|
|
@@ -50057,11 +50057,11 @@ var require_printer = __commonJS({
|
|
|
50057
50057
|
// right choice because it gives us the opportunity to reprint
|
|
50058
50058
|
// such nodes using their original source.
|
|
50059
50059
|
reprinter(print2)
|
|
50060
|
-
) : genericPrint(path6,
|
|
50060
|
+
) : genericPrint(path6, config30, options, makePrintFunctionWith(options, {
|
|
50061
50061
|
includeComments: true,
|
|
50062
50062
|
avoidRootParens: false
|
|
50063
50063
|
}));
|
|
50064
|
-
|
|
50064
|
+
config30.tabWidth = oldTabWidth;
|
|
50065
50065
|
return lines;
|
|
50066
50066
|
}
|
|
50067
50067
|
this.print = function(ast) {
|
|
@@ -50072,7 +50072,7 @@ var require_printer = __commonJS({
|
|
|
50072
50072
|
includeComments: true,
|
|
50073
50073
|
avoidRootParens: false
|
|
50074
50074
|
});
|
|
50075
|
-
return new PrintResult(lines.toString(
|
|
50075
|
+
return new PrintResult(lines.toString(config30), util.composeSourceMaps(config30.inputSourceMap, lines.getSourceMap(config30.sourceMapName, config30.sourceRoot)));
|
|
50076
50076
|
};
|
|
50077
50077
|
this.printGenerically = function(ast) {
|
|
50078
50078
|
if (!ast) {
|
|
@@ -50080,26 +50080,26 @@ var require_printer = __commonJS({
|
|
|
50080
50080
|
}
|
|
50081
50081
|
function printGenerically(path7) {
|
|
50082
50082
|
return comments_1.printComments(path7, function(path8) {
|
|
50083
|
-
return genericPrint(path8,
|
|
50083
|
+
return genericPrint(path8, config30, {
|
|
50084
50084
|
includeComments: true,
|
|
50085
50085
|
avoidRootParens: false
|
|
50086
50086
|
}, printGenerically);
|
|
50087
50087
|
});
|
|
50088
50088
|
}
|
|
50089
50089
|
var path6 = fast_path_1.default.from(ast);
|
|
50090
|
-
var oldReuseWhitespace =
|
|
50091
|
-
|
|
50092
|
-
var pr = new PrintResult(printGenerically(path6).toString(
|
|
50093
|
-
|
|
50090
|
+
var oldReuseWhitespace = config30.reuseWhitespace;
|
|
50091
|
+
config30.reuseWhitespace = false;
|
|
50092
|
+
var pr = new PrintResult(printGenerically(path6).toString(config30));
|
|
50093
|
+
config30.reuseWhitespace = oldReuseWhitespace;
|
|
50094
50094
|
return pr;
|
|
50095
50095
|
};
|
|
50096
50096
|
};
|
|
50097
50097
|
exports2.Printer = Printer;
|
|
50098
|
-
function genericPrint(path6,
|
|
50098
|
+
function genericPrint(path6, config30, options, printPath) {
|
|
50099
50099
|
assert_1.default.ok(path6 instanceof fast_path_1.default);
|
|
50100
50100
|
var node = path6.getValue();
|
|
50101
50101
|
var parts = [];
|
|
50102
|
-
var linesWithoutParens = genericPrintNoParens(path6,
|
|
50102
|
+
var linesWithoutParens = genericPrintNoParens(path6, config30, printPath);
|
|
50103
50103
|
if (!node || linesWithoutParens.isEmpty()) {
|
|
50104
50104
|
return linesWithoutParens;
|
|
50105
50105
|
}
|
|
@@ -69790,33 +69790,33 @@ var inputPrompt = async (promptConfig) => {
|
|
|
69790
69790
|
}
|
|
69791
69791
|
return input;
|
|
69792
69792
|
};
|
|
69793
|
-
var renderSubmit = (
|
|
69794
|
-
const { question, label } =
|
|
69795
|
-
if (
|
|
69793
|
+
var renderSubmit = (config30, value) => {
|
|
69794
|
+
const { question, label } = config30;
|
|
69795
|
+
if (config30.type !== "confirm" && !value) {
|
|
69796
69796
|
return [`${leftT} ${question} ${dim("(skipped)")}`, `${grayBar}`];
|
|
69797
69797
|
}
|
|
69798
|
-
const content =
|
|
69798
|
+
const content = config30.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
|
69799
69799
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
|
69800
69800
|
};
|
|
69801
|
-
var getRenderers = (
|
|
69802
|
-
switch (
|
|
69801
|
+
var getRenderers = (config30) => {
|
|
69802
|
+
switch (config30.type) {
|
|
69803
69803
|
case "select":
|
|
69804
|
-
return getSelectRenderers(
|
|
69804
|
+
return getSelectRenderers(config30);
|
|
69805
69805
|
case "confirm":
|
|
69806
|
-
return getConfirmRenderers(
|
|
69806
|
+
return getConfirmRenderers(config30);
|
|
69807
69807
|
case "text":
|
|
69808
|
-
return getTextRenderers(
|
|
69808
|
+
return getTextRenderers(config30);
|
|
69809
69809
|
case "multiselect":
|
|
69810
|
-
return getSelectRenderers(
|
|
69810
|
+
return getSelectRenderers(config30);
|
|
69811
69811
|
case "list":
|
|
69812
|
-
return getSelectListRenderers(
|
|
69812
|
+
return getSelectListRenderers(config30);
|
|
69813
69813
|
}
|
|
69814
69814
|
};
|
|
69815
|
-
var getTextRenderers = (
|
|
69816
|
-
const { question } =
|
|
69817
|
-
const helpText =
|
|
69818
|
-
const format5 =
|
|
69819
|
-
const defaultValue =
|
|
69815
|
+
var getTextRenderers = (config30) => {
|
|
69816
|
+
const { question } = config30;
|
|
69817
|
+
const helpText = config30.helpText ?? "";
|
|
69818
|
+
const format5 = config30.format ?? ((val) => String(val));
|
|
69819
|
+
const defaultValue = config30.defaultValue?.toString() ?? "";
|
|
69820
69820
|
const activeRenderer = ({ value }) => [
|
|
69821
69821
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
|
69822
69822
|
`${space(2)}${format5(value || dim(defaultValue))}`,
|
|
@@ -69839,14 +69839,14 @@ var getTextRenderers = (config29) => {
|
|
|
69839
69839
|
``
|
|
69840
69840
|
// extra line for readability
|
|
69841
69841
|
],
|
|
69842
|
-
submit: ({ value }) => renderSubmit(
|
|
69842
|
+
submit: ({ value }) => renderSubmit(config30, format5(value ?? "")),
|
|
69843
69843
|
cancel: activeRenderer
|
|
69844
69844
|
};
|
|
69845
69845
|
};
|
|
69846
|
-
var getSelectRenderers = (
|
|
69847
|
-
const { options, question, helpText: _helpText } =
|
|
69846
|
+
var getSelectRenderers = (config30) => {
|
|
69847
|
+
const { options, question, helpText: _helpText } = config30;
|
|
69848
69848
|
const helpText = _helpText ?? "";
|
|
69849
|
-
const maxItemsPerPage =
|
|
69849
|
+
const maxItemsPerPage = config30.maxItemsPerPage ?? 32;
|
|
69850
69850
|
const defaultRenderer = ({ cursor = 0, value }) => {
|
|
69851
69851
|
const renderOption = (opt, i) => {
|
|
69852
69852
|
const { label: optionLabel, value: optionValue } = opt;
|
|
@@ -69921,21 +69921,21 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
|
69921
69921
|
submit: ({ value }) => {
|
|
69922
69922
|
if (Array.isArray(value)) {
|
|
69923
69923
|
return renderSubmit(
|
|
69924
|
-
|
|
69924
|
+
config30,
|
|
69925
69925
|
options.filter((o) => value.includes(o.value)).map((o) => o.label).join(", ")
|
|
69926
69926
|
);
|
|
69927
69927
|
}
|
|
69928
69928
|
return renderSubmit(
|
|
69929
|
-
|
|
69929
|
+
config30,
|
|
69930
69930
|
options.find((o) => o.value === value)?.label
|
|
69931
69931
|
);
|
|
69932
69932
|
},
|
|
69933
69933
|
cancel: defaultRenderer
|
|
69934
69934
|
};
|
|
69935
69935
|
};
|
|
69936
|
-
var getSelectListRenderers = (
|
|
69937
|
-
const { question, helpText: _helpText } =
|
|
69938
|
-
let options =
|
|
69936
|
+
var getSelectListRenderers = (config30) => {
|
|
69937
|
+
const { question, helpText: _helpText } = config30;
|
|
69938
|
+
let options = config30.options;
|
|
69939
69939
|
const helpText = _helpText ?? "";
|
|
69940
69940
|
const { rows } = stdout;
|
|
69941
69941
|
const defaultRenderer = ({ cursor, value }, prompt) => {
|
|
@@ -70016,20 +70016,20 @@ var getSelectListRenderers = (config29) => {
|
|
|
70016
70016
|
submit: ({ value }) => {
|
|
70017
70017
|
if (Array.isArray(value)) {
|
|
70018
70018
|
return renderSubmit(
|
|
70019
|
-
|
|
70019
|
+
config30,
|
|
70020
70020
|
options.filter((o) => value.includes(o.value)).map((o) => o.value).join(", ")
|
|
70021
70021
|
);
|
|
70022
70022
|
}
|
|
70023
70023
|
return renderSubmit(
|
|
70024
|
-
|
|
70024
|
+
config30,
|
|
70025
70025
|
options.find((o) => o.value === value)?.value
|
|
70026
70026
|
);
|
|
70027
70027
|
},
|
|
70028
70028
|
cancel: defaultRenderer
|
|
70029
70029
|
};
|
|
70030
70030
|
};
|
|
70031
|
-
var getConfirmRenderers = (
|
|
70032
|
-
const { activeText, inactiveText, question, helpText: _helpText } =
|
|
70031
|
+
var getConfirmRenderers = (config30) => {
|
|
70032
|
+
const { activeText, inactiveText, question, helpText: _helpText } = config30;
|
|
70033
70033
|
const helpText = _helpText ?? "";
|
|
70034
70034
|
const active = activeText || "Yes";
|
|
70035
70035
|
const inactive = inactiveText || "No";
|
|
@@ -70046,7 +70046,7 @@ var getConfirmRenderers = (config29) => {
|
|
|
70046
70046
|
active: defaultRenderer,
|
|
70047
70047
|
confirm: defaultRenderer,
|
|
70048
70048
|
error: defaultRenderer,
|
|
70049
|
-
submit: ({ value }) => renderSubmit(
|
|
70049
|
+
submit: ({ value }) => renderSubmit(config30, value ? "yes" : "no"),
|
|
70050
70050
|
cancel: defaultRenderer
|
|
70051
70051
|
};
|
|
70052
70052
|
};
|
|
@@ -71016,23 +71016,23 @@ var YargsParser = class {
|
|
|
71016
71016
|
const configPath = argv2[configKey] || configLookup[configKey];
|
|
71017
71017
|
if (configPath) {
|
|
71018
71018
|
try {
|
|
71019
|
-
let
|
|
71019
|
+
let config30 = null;
|
|
71020
71020
|
const resolvedConfigPath = mixin2.resolve(mixin2.cwd(), configPath);
|
|
71021
71021
|
const resolveConfig = flags.configs[configKey];
|
|
71022
71022
|
if (typeof resolveConfig === "function") {
|
|
71023
71023
|
try {
|
|
71024
|
-
|
|
71024
|
+
config30 = resolveConfig(resolvedConfigPath);
|
|
71025
71025
|
} catch (e) {
|
|
71026
|
-
|
|
71026
|
+
config30 = e;
|
|
71027
71027
|
}
|
|
71028
|
-
if (
|
|
71029
|
-
error2 =
|
|
71028
|
+
if (config30 instanceof Error) {
|
|
71029
|
+
error2 = config30;
|
|
71030
71030
|
return;
|
|
71031
71031
|
}
|
|
71032
71032
|
} else {
|
|
71033
|
-
|
|
71033
|
+
config30 = mixin2.require(resolvedConfigPath);
|
|
71034
71034
|
}
|
|
71035
|
-
setConfigObject(
|
|
71035
|
+
setConfigObject(config30);
|
|
71036
71036
|
} catch (ex) {
|
|
71037
71037
|
if (ex.name === "PermissionDenied")
|
|
71038
71038
|
error2 = ex;
|
|
@@ -71042,9 +71042,9 @@ var YargsParser = class {
|
|
|
71042
71042
|
}
|
|
71043
71043
|
});
|
|
71044
71044
|
}
|
|
71045
|
-
function setConfigObject(
|
|
71046
|
-
Object.keys(
|
|
71047
|
-
const value =
|
|
71045
|
+
function setConfigObject(config30, prev) {
|
|
71046
|
+
Object.keys(config30).forEach(function(key) {
|
|
71047
|
+
const value = config30[key];
|
|
71048
71048
|
const fullKey = prev ? prev + "." + key : key;
|
|
71049
71049
|
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
71050
71050
|
setConfigObject(value, fullKey);
|
|
@@ -72196,11 +72196,11 @@ var CommandInstance = class {
|
|
|
72196
72196
|
});
|
|
72197
72197
|
if (!unparsed.length)
|
|
72198
72198
|
return;
|
|
72199
|
-
const
|
|
72199
|
+
const config30 = Object.assign({}, options.configuration, {
|
|
72200
72200
|
"populate--": false
|
|
72201
72201
|
});
|
|
72202
72202
|
const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, {
|
|
72203
|
-
configuration:
|
|
72203
|
+
configuration: config30
|
|
72204
72204
|
}));
|
|
72205
72205
|
if (parsed.error) {
|
|
72206
72206
|
yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
|
|
@@ -73423,31 +73423,31 @@ ${customMsgs.join("\n")}` : "";
|
|
|
73423
73423
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/utils/apply-extends.js
|
|
73424
73424
|
var previouslyVisitedConfigs = [];
|
|
73425
73425
|
var shim2;
|
|
73426
|
-
function applyExtends(
|
|
73426
|
+
function applyExtends(config30, cwd, mergeExtends, _shim) {
|
|
73427
73427
|
shim2 = _shim;
|
|
73428
73428
|
let defaultConfig = {};
|
|
73429
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
73430
|
-
if (typeof
|
|
73429
|
+
if (Object.prototype.hasOwnProperty.call(config30, "extends")) {
|
|
73430
|
+
if (typeof config30.extends !== "string")
|
|
73431
73431
|
return defaultConfig;
|
|
73432
|
-
const isPath = /\.json|\..*rc$/.test(
|
|
73432
|
+
const isPath = /\.json|\..*rc$/.test(config30.extends);
|
|
73433
73433
|
let pathToDefault = null;
|
|
73434
73434
|
if (!isPath) {
|
|
73435
73435
|
try {
|
|
73436
|
-
pathToDefault = require.resolve(
|
|
73436
|
+
pathToDefault = require.resolve(config30.extends);
|
|
73437
73437
|
} catch (_err) {
|
|
73438
|
-
return
|
|
73438
|
+
return config30;
|
|
73439
73439
|
}
|
|
73440
73440
|
} else {
|
|
73441
|
-
pathToDefault = getPathToDefaultConfig(cwd,
|
|
73441
|
+
pathToDefault = getPathToDefaultConfig(cwd, config30.extends);
|
|
73442
73442
|
}
|
|
73443
73443
|
checkForCircularExtends(pathToDefault);
|
|
73444
73444
|
previouslyVisitedConfigs.push(pathToDefault);
|
|
73445
|
-
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(
|
|
73446
|
-
delete
|
|
73445
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : require(config30.extends);
|
|
73446
|
+
delete config30.extends;
|
|
73447
73447
|
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
73448
73448
|
}
|
|
73449
73449
|
previouslyVisitedConfigs = [];
|
|
73450
|
-
return mergeExtends ? mergeDeep(defaultConfig,
|
|
73450
|
+
return mergeExtends ? mergeDeep(defaultConfig, config30) : Object.assign({}, defaultConfig, config30);
|
|
73451
73451
|
}
|
|
73452
73452
|
function checkForCircularExtends(cfgPath) {
|
|
73453
73453
|
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
@@ -73457,17 +73457,17 @@ function checkForCircularExtends(cfgPath) {
|
|
|
73457
73457
|
function getPathToDefaultConfig(cwd, pathToExtend) {
|
|
73458
73458
|
return shim2.path.resolve(cwd, pathToExtend);
|
|
73459
73459
|
}
|
|
73460
|
-
function mergeDeep(config1,
|
|
73460
|
+
function mergeDeep(config1, config210) {
|
|
73461
73461
|
const target = {};
|
|
73462
73462
|
function isObject(obj) {
|
|
73463
73463
|
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
73464
73464
|
}
|
|
73465
73465
|
Object.assign(target, config1);
|
|
73466
|
-
for (const key of Object.keys(
|
|
73467
|
-
if (isObject(
|
|
73468
|
-
target[key] = mergeDeep(config1[key],
|
|
73466
|
+
for (const key of Object.keys(config210)) {
|
|
73467
|
+
if (isObject(config210[key]) && isObject(target[key])) {
|
|
73468
|
+
target[key] = mergeDeep(config1[key], config210[key]);
|
|
73469
73469
|
} else {
|
|
73470
|
-
target[key] =
|
|
73470
|
+
target[key] = config210[key];
|
|
73471
73471
|
}
|
|
73472
73472
|
}
|
|
73473
73473
|
return target;
|
|
@@ -74228,9 +74228,9 @@ var YargsInstance = class {
|
|
|
74228
74228
|
}
|
|
74229
74229
|
return maybePromise;
|
|
74230
74230
|
}
|
|
74231
|
-
parserConfiguration(
|
|
74232
|
-
argsert("<object>", [
|
|
74233
|
-
__classPrivateFieldSet(this, _YargsInstance_parserConfig,
|
|
74231
|
+
parserConfiguration(config30) {
|
|
74232
|
+
argsert("<object>", [config30], arguments.length);
|
|
74233
|
+
__classPrivateFieldSet(this, _YargsInstance_parserConfig, config30, "f");
|
|
74234
74234
|
return this;
|
|
74235
74235
|
}
|
|
74236
74236
|
pkgConf(key, rootPath) {
|
|
@@ -74402,9 +74402,9 @@ var YargsInstance = class {
|
|
|
74402
74402
|
return this;
|
|
74403
74403
|
}
|
|
74404
74404
|
}
|
|
74405
|
-
usageConfiguration(
|
|
74406
|
-
argsert("<object>", [
|
|
74407
|
-
__classPrivateFieldSet(this, _YargsInstance_usageConfig,
|
|
74405
|
+
usageConfiguration(config30) {
|
|
74406
|
+
argsert("<object>", [config30], arguments.length);
|
|
74407
|
+
__classPrivateFieldSet(this, _YargsInstance_usageConfig, config30, "f");
|
|
74408
74408
|
return this;
|
|
74409
74409
|
}
|
|
74410
74410
|
version(opt, msg, ver) {
|
|
@@ -74810,11 +74810,11 @@ var YargsInstance = class {
|
|
|
74810
74810
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
|
|
74811
74811
|
__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
|
|
74812
74812
|
const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
|
|
74813
|
-
const
|
|
74813
|
+
const config30 = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, {
|
|
74814
74814
|
"populate--": true
|
|
74815
74815
|
});
|
|
74816
74816
|
const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), {
|
|
74817
|
-
configuration: { "parse-positional-numbers": false, ...
|
|
74817
|
+
configuration: { "parse-positional-numbers": false, ...config30 }
|
|
74818
74818
|
}));
|
|
74819
74819
|
const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
|
|
74820
74820
|
let argvPromise = void 0;
|
|
@@ -74977,7 +74977,7 @@ var Yargs = YargsFactory(esm_default);
|
|
|
74977
74977
|
var yargs_default = Yargs;
|
|
74978
74978
|
|
|
74979
74979
|
// package.json
|
|
74980
|
-
var version = "2.40.
|
|
74980
|
+
var version = "2.40.2";
|
|
74981
74981
|
|
|
74982
74982
|
// src/metrics.ts
|
|
74983
74983
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -75021,12 +75021,12 @@ function getGlobalWranglerConfigPath() {
|
|
|
75021
75021
|
}
|
|
75022
75022
|
|
|
75023
75023
|
// src/helpers/metrics-config.ts
|
|
75024
|
-
function writeMetricsConfig(
|
|
75024
|
+
function writeMetricsConfig(config30) {
|
|
75025
75025
|
(0, import_node_fs2.mkdirSync)(import_node_path2.default.dirname(getMetricsConfigPath()), { recursive: true });
|
|
75026
75026
|
(0, import_node_fs2.writeFileSync)(
|
|
75027
75027
|
getMetricsConfigPath(),
|
|
75028
75028
|
JSON.stringify(
|
|
75029
|
-
|
|
75029
|
+
config30,
|
|
75030
75030
|
(_key, value) => value instanceof Date ? value.toISOString() : value,
|
|
75031
75031
|
" "
|
|
75032
75032
|
)
|
|
@@ -75034,9 +75034,9 @@ function writeMetricsConfig(config29) {
|
|
|
75034
75034
|
}
|
|
75035
75035
|
function readMetricsConfig() {
|
|
75036
75036
|
try {
|
|
75037
|
-
const
|
|
75037
|
+
const config30 = (0, import_node_fs2.readFileSync)(getMetricsConfigPath(), "utf8");
|
|
75038
75038
|
return JSON.parse(
|
|
75039
|
-
|
|
75039
|
+
config30,
|
|
75040
75040
|
(key, value) => key === "date" ? new Date(value) : value
|
|
75041
75041
|
);
|
|
75042
75042
|
} catch {
|
|
@@ -75046,10 +75046,10 @@ function readMetricsConfig() {
|
|
|
75046
75046
|
function getMetricsConfigPath() {
|
|
75047
75047
|
return import_node_path2.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
|
75048
75048
|
}
|
|
75049
|
-
function getDeviceId(
|
|
75050
|
-
const deviceId =
|
|
75051
|
-
if (
|
|
75052
|
-
writeMetricsConfig({ ...
|
|
75049
|
+
function getDeviceId(config30) {
|
|
75050
|
+
const deviceId = config30.deviceId ?? (0, import_node_crypto.randomUUID)();
|
|
75051
|
+
if (config30.deviceId === void 0) {
|
|
75052
|
+
writeMetricsConfig({ ...config30, deviceId });
|
|
75053
75053
|
}
|
|
75054
75054
|
return deviceId;
|
|
75055
75055
|
}
|
|
@@ -75324,10 +75324,10 @@ function getPlatform() {
|
|
|
75324
75324
|
function createReporter() {
|
|
75325
75325
|
const events = [];
|
|
75326
75326
|
const als = new import_node_async_hooks.AsyncLocalStorage();
|
|
75327
|
-
const
|
|
75328
|
-
const isFirstUsage =
|
|
75327
|
+
const config30 = readMetricsConfig() ?? {};
|
|
75328
|
+
const isFirstUsage = config30.c3permission === void 0;
|
|
75329
75329
|
const isEnabled = isTelemetryEnabled();
|
|
75330
|
-
const deviceId = getDeviceId(
|
|
75330
|
+
const deviceId = getDeviceId(config30);
|
|
75331
75331
|
const packageManager = detectPackageManager();
|
|
75332
75332
|
const platform3 = getPlatform();
|
|
75333
75333
|
const amplitude_session_id = Date.now();
|
|
@@ -75360,7 +75360,7 @@ function createReporter() {
|
|
|
75360
75360
|
if (process.env.CREATE_CLOUDFLARE_TELEMETRY_DISABLED === "1") {
|
|
75361
75361
|
return false;
|
|
75362
75362
|
}
|
|
75363
|
-
return hasSparrowSourceKey() && getC3Permission(
|
|
75363
|
+
return hasSparrowSourceKey() && getC3Permission(config30).enabled;
|
|
75364
75364
|
}
|
|
75365
75365
|
async function waitForAllEventsSettled() {
|
|
75366
75366
|
await Promise.allSettled(events);
|
|
@@ -75466,20 +75466,20 @@ function initializeC3Permission(enabled = true) {
|
|
|
75466
75466
|
date: /* @__PURE__ */ new Date()
|
|
75467
75467
|
};
|
|
75468
75468
|
}
|
|
75469
|
-
function getC3Permission(
|
|
75470
|
-
if (!
|
|
75471
|
-
|
|
75472
|
-
writeMetricsConfig(
|
|
75469
|
+
function getC3Permission(config30 = readMetricsConfig() ?? {}) {
|
|
75470
|
+
if (!config30.c3permission) {
|
|
75471
|
+
config30.c3permission = initializeC3Permission();
|
|
75472
|
+
writeMetricsConfig(config30);
|
|
75473
75473
|
}
|
|
75474
|
-
return
|
|
75474
|
+
return config30.c3permission;
|
|
75475
75475
|
}
|
|
75476
75476
|
function updateC3Pemission(enabled) {
|
|
75477
|
-
const
|
|
75478
|
-
if (
|
|
75477
|
+
const config30 = readMetricsConfig();
|
|
75478
|
+
if (config30.c3permission?.enabled === enabled) {
|
|
75479
75479
|
return;
|
|
75480
75480
|
}
|
|
75481
|
-
|
|
75482
|
-
writeMetricsConfig(
|
|
75481
|
+
config30.c3permission = initializeC3Permission(enabled);
|
|
75482
|
+
writeMetricsConfig(config30);
|
|
75483
75483
|
}
|
|
75484
75484
|
var runTelemetryCommand = (action) => {
|
|
75485
75485
|
const logTelemetryStatus = (enabled) => {
|
|
@@ -75524,28 +75524,28 @@ var import_haikunator = __toESM(require_dist_web());
|
|
|
75524
75524
|
var import_fs6 = require("fs");
|
|
75525
75525
|
var import_path6 = __toESM(require("path"));
|
|
75526
75526
|
var import_undici2 = __toESM(require_undici());
|
|
75527
|
-
var installPackages = async (packages,
|
|
75527
|
+
var installPackages = async (packages, config30 = {}) => {
|
|
75528
75528
|
const { npm: npm24 } = detectPackageManager();
|
|
75529
75529
|
let saveFlag;
|
|
75530
75530
|
let cmd;
|
|
75531
75531
|
switch (npm24) {
|
|
75532
75532
|
case "yarn":
|
|
75533
75533
|
cmd = "add";
|
|
75534
|
-
saveFlag =
|
|
75534
|
+
saveFlag = config30.dev ? "-D" : "";
|
|
75535
75535
|
break;
|
|
75536
75536
|
case "bun":
|
|
75537
75537
|
cmd = "add";
|
|
75538
|
-
saveFlag =
|
|
75538
|
+
saveFlag = config30.dev ? "-d" : "";
|
|
75539
75539
|
break;
|
|
75540
75540
|
case "npm":
|
|
75541
75541
|
case "pnpm":
|
|
75542
75542
|
default:
|
|
75543
75543
|
cmd = "install";
|
|
75544
|
-
saveFlag =
|
|
75544
|
+
saveFlag = config30.dev ? "--save-dev" : "";
|
|
75545
75545
|
break;
|
|
75546
75546
|
}
|
|
75547
75547
|
await runCommand([npm24, cmd, ...saveFlag ? [saveFlag] : [], ...packages], {
|
|
75548
|
-
...
|
|
75548
|
+
...config30,
|
|
75549
75549
|
silent: true
|
|
75550
75550
|
});
|
|
75551
75551
|
};
|
|
@@ -76475,146 +76475,9 @@ var config8 = {
|
|
|
76475
76475
|
};
|
|
76476
76476
|
var c3_default10 = config8;
|
|
76477
76477
|
|
|
76478
|
-
// templates-experimental/
|
|
76479
|
-
var import_assert2 = __toESM(require("assert"));
|
|
76480
|
-
var recast5 = __toESM(require_main3());
|
|
76481
|
-
var b2 = recast5.types.builders;
|
|
76482
|
-
var t = recast5.types.namedTypes;
|
|
76478
|
+
// templates-experimental/remix/c3.ts
|
|
76483
76479
|
var { npm: npm5 } = detectPackageManager();
|
|
76484
76480
|
var generate8 = async (ctx) => {
|
|
76485
|
-
const variant = await getVariant();
|
|
76486
|
-
ctx.args.lang = variant.lang;
|
|
76487
|
-
await runFrameworkGenerator(ctx, [
|
|
76488
|
-
ctx.project.name,
|
|
76489
|
-
"--template",
|
|
76490
|
-
variant.value
|
|
76491
|
-
]);
|
|
76492
|
-
logRaw("");
|
|
76493
|
-
};
|
|
76494
|
-
var configure6 = async (ctx) => {
|
|
76495
|
-
await installPackages(["@cloudflare/vite-plugin"], {
|
|
76496
|
-
dev: true,
|
|
76497
|
-
startText: "Installing the Cloudflare Vite plugin",
|
|
76498
|
-
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
76499
|
-
});
|
|
76500
|
-
await transformViteConfig(ctx);
|
|
76501
|
-
if (usesTypescript(ctx)) {
|
|
76502
|
-
updateTsconfigJson();
|
|
76503
|
-
}
|
|
76504
|
-
};
|
|
76505
|
-
function transformViteConfig(ctx) {
|
|
76506
|
-
const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
76507
|
-
transformFile(filePath, {
|
|
76508
|
-
visitProgram(n) {
|
|
76509
|
-
const lastImportIndex = n.node.body.findLastIndex(
|
|
76510
|
-
(statement) => statement.type === "ImportDeclaration"
|
|
76511
|
-
);
|
|
76512
|
-
const lastImport = n.get("body", lastImportIndex);
|
|
76513
|
-
const importAst = b2.importDeclaration(
|
|
76514
|
-
[b2.importSpecifier(b2.identifier("cloudflare"))],
|
|
76515
|
-
b2.stringLiteral("@cloudflare/vite-plugin")
|
|
76516
|
-
);
|
|
76517
|
-
lastImport.insertAfter(importAst);
|
|
76518
|
-
return this.traverse(n);
|
|
76519
|
-
},
|
|
76520
|
-
visitCallExpression: function(n) {
|
|
76521
|
-
const callee = n.node.callee;
|
|
76522
|
-
if (callee.name !== "defineConfig") {
|
|
76523
|
-
return this.traverse(n);
|
|
76524
|
-
}
|
|
76525
|
-
const config29 = n.node.arguments[0];
|
|
76526
|
-
(0, import_assert2.default)(t.ObjectExpression.check(config29));
|
|
76527
|
-
const pluginsProp = config29.properties.find((prop) => isPluginsProp(prop));
|
|
76528
|
-
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
76529
|
-
pluginsProp.value.elements.push(
|
|
76530
|
-
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
76531
|
-
);
|
|
76532
|
-
return false;
|
|
76533
|
-
}
|
|
76534
|
-
});
|
|
76535
|
-
}
|
|
76536
|
-
function isPluginsProp(prop) {
|
|
76537
|
-
return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
|
|
76538
|
-
}
|
|
76539
|
-
function updateTsconfigJson() {
|
|
76540
|
-
const s = spinner();
|
|
76541
|
-
s.start(`Updating tsconfig.json config`);
|
|
76542
|
-
const tsconfig = readJSON("tsconfig.json");
|
|
76543
|
-
if (tsconfig && typeof tsconfig === "object") {
|
|
76544
|
-
tsconfig.references ??= [];
|
|
76545
|
-
tsconfig.references.push({ path: "./tsconfig.worker.json" });
|
|
76546
|
-
}
|
|
76547
|
-
writeJSON("tsconfig.json", tsconfig);
|
|
76548
|
-
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
76549
|
-
}
|
|
76550
|
-
async function getVariant() {
|
|
76551
|
-
const variantsOptions2 = [
|
|
76552
|
-
{
|
|
76553
|
-
value: "react-ts",
|
|
76554
|
-
lang: "ts",
|
|
76555
|
-
label: "TypeScript"
|
|
76556
|
-
},
|
|
76557
|
-
{
|
|
76558
|
-
value: "react-swc-ts",
|
|
76559
|
-
lang: "ts",
|
|
76560
|
-
label: "TypeScript + SWC"
|
|
76561
|
-
},
|
|
76562
|
-
{
|
|
76563
|
-
value: "react",
|
|
76564
|
-
lang: "js",
|
|
76565
|
-
label: "JavaScript"
|
|
76566
|
-
},
|
|
76567
|
-
{
|
|
76568
|
-
value: "react-swc",
|
|
76569
|
-
lang: "js",
|
|
76570
|
-
label: "JavaScript + SWC"
|
|
76571
|
-
}
|
|
76572
|
-
];
|
|
76573
|
-
const value = await inputPrompt({
|
|
76574
|
-
type: "select",
|
|
76575
|
-
question: "Select a variant:",
|
|
76576
|
-
label: "variant",
|
|
76577
|
-
options: variantsOptions2,
|
|
76578
|
-
defaultValue: variantsOptions2[0].value
|
|
76579
|
-
});
|
|
76580
|
-
const selected = variantsOptions2.find((variant) => variant.value === value);
|
|
76581
|
-
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
76582
|
-
return selected;
|
|
76583
|
-
}
|
|
76584
|
-
var config9 = {
|
|
76585
|
-
configVersion: 1,
|
|
76586
|
-
id: "react",
|
|
76587
|
-
frameworkCli: "create-vite",
|
|
76588
|
-
displayName: "React",
|
|
76589
|
-
platform: "workers",
|
|
76590
|
-
path: "templates-experimental/react",
|
|
76591
|
-
copyFiles: {
|
|
76592
|
-
variants: {
|
|
76593
|
-
ts: {
|
|
76594
|
-
path: "./ts"
|
|
76595
|
-
},
|
|
76596
|
-
js: {
|
|
76597
|
-
path: "./js"
|
|
76598
|
-
}
|
|
76599
|
-
}
|
|
76600
|
-
},
|
|
76601
|
-
generate: generate8,
|
|
76602
|
-
configure: configure6,
|
|
76603
|
-
transformPackageJson: async () => ({
|
|
76604
|
-
scripts: {
|
|
76605
|
-
deploy: `${npm5} run build && wrangler deploy`,
|
|
76606
|
-
preview: `${npm5} run build && vite preview`
|
|
76607
|
-
}
|
|
76608
|
-
}),
|
|
76609
|
-
devScript: "dev",
|
|
76610
|
-
deployScript: "deploy",
|
|
76611
|
-
previewScript: "preview"
|
|
76612
|
-
};
|
|
76613
|
-
var c3_default11 = config9;
|
|
76614
|
-
|
|
76615
|
-
// templates-experimental/remix/c3.ts
|
|
76616
|
-
var { npm: npm6 } = detectPackageManager();
|
|
76617
|
-
var generate9 = async (ctx) => {
|
|
76618
76481
|
await runFrameworkGenerator(ctx, [
|
|
76619
76482
|
ctx.project.name,
|
|
76620
76483
|
"--template",
|
|
@@ -76622,14 +76485,14 @@ var generate9 = async (ctx) => {
|
|
|
76622
76485
|
]);
|
|
76623
76486
|
logRaw("");
|
|
76624
76487
|
};
|
|
76625
|
-
var
|
|
76488
|
+
var configure6 = async () => {
|
|
76626
76489
|
await installPackages(["wrangler@latest"], {
|
|
76627
76490
|
dev: true,
|
|
76628
76491
|
startText: "Updating the Wrangler version",
|
|
76629
76492
|
doneText: `${brandColor(`updated`)} ${dim("wrangler@latest")}`
|
|
76630
76493
|
});
|
|
76631
76494
|
};
|
|
76632
|
-
var
|
|
76495
|
+
var config9 = {
|
|
76633
76496
|
configVersion: 1,
|
|
76634
76497
|
id: "remix",
|
|
76635
76498
|
frameworkCli: "create-remix",
|
|
@@ -76639,12 +76502,12 @@ var config10 = {
|
|
|
76639
76502
|
path: "./templates"
|
|
76640
76503
|
},
|
|
76641
76504
|
path: "templates-experimental/remix",
|
|
76642
|
-
generate:
|
|
76643
|
-
configure:
|
|
76505
|
+
generate: generate8,
|
|
76506
|
+
configure: configure6,
|
|
76644
76507
|
transformPackageJson: async () => ({
|
|
76645
76508
|
scripts: {
|
|
76646
|
-
deploy: `${
|
|
76647
|
-
preview: `${
|
|
76509
|
+
deploy: `${npm5} run build && wrangler deploy`,
|
|
76510
|
+
preview: `${npm5} run build && wrangler dev`,
|
|
76648
76511
|
"cf-typegen": `wrangler types`
|
|
76649
76512
|
}
|
|
76650
76513
|
}),
|
|
@@ -76652,21 +76515,21 @@ var config10 = {
|
|
|
76652
76515
|
deployScript: "deploy",
|
|
76653
76516
|
previewScript: "preview"
|
|
76654
76517
|
};
|
|
76655
|
-
var
|
|
76518
|
+
var c3_default11 = config9;
|
|
76656
76519
|
|
|
76657
76520
|
// templates-experimental/solid/c3.ts
|
|
76658
|
-
var
|
|
76659
|
-
var { npm:
|
|
76660
|
-
var
|
|
76521
|
+
var recast5 = __toESM(require_main3());
|
|
76522
|
+
var { npm: npm6 } = detectPackageManager();
|
|
76523
|
+
var generate9 = async (ctx) => {
|
|
76661
76524
|
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
76662
76525
|
logRaw("");
|
|
76663
76526
|
};
|
|
76664
|
-
var
|
|
76527
|
+
var configure7 = async (ctx) => {
|
|
76665
76528
|
const packages = ["nitropack"];
|
|
76666
76529
|
await installPackages(packages, {
|
|
76667
76530
|
dev: true,
|
|
76668
76531
|
startText: "Installing nitro module `nitropack`",
|
|
76669
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76532
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm6} install\``)}`
|
|
76670
76533
|
});
|
|
76671
76534
|
usesTypescript(ctx);
|
|
76672
76535
|
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
@@ -76678,7 +76541,7 @@ var configure8 = async (ctx) => {
|
|
|
76678
76541
|
if (callee.name !== "defineConfig") {
|
|
76679
76542
|
return this.traverse(n);
|
|
76680
76543
|
}
|
|
76681
|
-
const b3 =
|
|
76544
|
+
const b3 = recast5.types.builders;
|
|
76682
76545
|
mergeObjectProperties(
|
|
76683
76546
|
n.node.arguments[0],
|
|
76684
76547
|
[
|
|
@@ -76702,7 +76565,7 @@ var configure8 = async (ctx) => {
|
|
|
76702
76565
|
}
|
|
76703
76566
|
});
|
|
76704
76567
|
};
|
|
76705
|
-
var
|
|
76568
|
+
var config10 = {
|
|
76706
76569
|
configVersion: 1,
|
|
76707
76570
|
id: "solid",
|
|
76708
76571
|
frameworkCli: "create-solid",
|
|
@@ -76712,12 +76575,12 @@ var config11 = {
|
|
|
76712
76575
|
path: "./templates"
|
|
76713
76576
|
},
|
|
76714
76577
|
path: "templates-experimental/solid",
|
|
76715
|
-
generate:
|
|
76716
|
-
configure:
|
|
76578
|
+
generate: generate9,
|
|
76579
|
+
configure: configure7,
|
|
76717
76580
|
transformPackageJson: async () => ({
|
|
76718
76581
|
scripts: {
|
|
76719
|
-
preview: `${
|
|
76720
|
-
deploy: `${
|
|
76582
|
+
preview: `${npm6} run build && npx wrangler dev`,
|
|
76583
|
+
deploy: `${npm6} run build && wrangler deploy`
|
|
76721
76584
|
}
|
|
76722
76585
|
}),
|
|
76723
76586
|
compatibilityFlags: ["nodejs_compat"],
|
|
@@ -76725,17 +76588,17 @@ var config11 = {
|
|
|
76725
76588
|
deployScript: "deploy",
|
|
76726
76589
|
previewScript: "preview"
|
|
76727
76590
|
};
|
|
76728
|
-
var
|
|
76591
|
+
var c3_default12 = config10;
|
|
76729
76592
|
|
|
76730
76593
|
// templates-experimental/svelte/c3.ts
|
|
76731
76594
|
var import_node_os3 = require("node:os");
|
|
76732
|
-
var
|
|
76733
|
-
var { npm:
|
|
76734
|
-
var
|
|
76595
|
+
var recast6 = __toESM(require_main3());
|
|
76596
|
+
var { npm: npm7 } = detectPackageManager();
|
|
76597
|
+
var generate10 = async (ctx) => {
|
|
76735
76598
|
await runFrameworkGenerator(ctx, ["create", ctx.project.name]);
|
|
76736
76599
|
logRaw("");
|
|
76737
76600
|
};
|
|
76738
|
-
var
|
|
76601
|
+
var configure8 = async (ctx) => {
|
|
76739
76602
|
const pkg = `@sveltejs/adapter-cloudflare`;
|
|
76740
76603
|
await installPackages([pkg], {
|
|
76741
76604
|
dev: true,
|
|
@@ -76762,7 +76625,7 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
76762
76625
|
return;
|
|
76763
76626
|
}
|
|
76764
76627
|
updateStatus(`Updating global type definitions in ${blue("app.d.ts")}`);
|
|
76765
|
-
const b3 =
|
|
76628
|
+
const b3 = recast6.types.builders;
|
|
76766
76629
|
transformFile("src/app.d.ts", {
|
|
76767
76630
|
visitTSModuleDeclaration(n) {
|
|
76768
76631
|
if (n.value.id.name === "App" && n.node.body) {
|
|
@@ -76794,7 +76657,7 @@ var updateTypeDefinitions = (ctx) => {
|
|
|
76794
76657
|
}
|
|
76795
76658
|
});
|
|
76796
76659
|
};
|
|
76797
|
-
var
|
|
76660
|
+
var config11 = {
|
|
76798
76661
|
configVersion: 1,
|
|
76799
76662
|
id: "svelte",
|
|
76800
76663
|
frameworkCli: "sv",
|
|
@@ -76804,12 +76667,12 @@ var config12 = {
|
|
|
76804
76667
|
path: "./templates"
|
|
76805
76668
|
},
|
|
76806
76669
|
path: "templates-experimental/svelte",
|
|
76807
|
-
generate:
|
|
76808
|
-
configure:
|
|
76670
|
+
generate: generate10,
|
|
76671
|
+
configure: configure8,
|
|
76809
76672
|
transformPackageJson: async (original, ctx) => {
|
|
76810
76673
|
let scripts = {
|
|
76811
|
-
preview: `${
|
|
76812
|
-
deploy: `${
|
|
76674
|
+
preview: `${npm7} run build && wrangler dev`,
|
|
76675
|
+
deploy: `${npm7} run build && wrangler deploy`
|
|
76813
76676
|
};
|
|
76814
76677
|
if (usesTypescript(ctx)) {
|
|
76815
76678
|
const mv = (0, import_node_os3.platform)() === "win32" ? "move" : "mv";
|
|
@@ -76824,14 +76687,14 @@ var config12 = {
|
|
|
76824
76687
|
deployScript: "deploy",
|
|
76825
76688
|
previewScript: "preview"
|
|
76826
76689
|
};
|
|
76827
|
-
var
|
|
76690
|
+
var c3_default13 = config11;
|
|
76828
76691
|
|
|
76829
76692
|
// templates-experimental/vue/c3.ts
|
|
76830
|
-
var { npm:
|
|
76831
|
-
var
|
|
76693
|
+
var { npm: npm8 } = detectPackageManager();
|
|
76694
|
+
var generate11 = async (ctx) => {
|
|
76832
76695
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
76833
76696
|
};
|
|
76834
|
-
var
|
|
76697
|
+
var config12 = {
|
|
76835
76698
|
configVersion: 1,
|
|
76836
76699
|
id: "vue",
|
|
76837
76700
|
frameworkCli: "create-vue",
|
|
@@ -76841,23 +76704,23 @@ var config13 = {
|
|
|
76841
76704
|
path: "./templates"
|
|
76842
76705
|
},
|
|
76843
76706
|
path: "templates-experimental/vue",
|
|
76844
|
-
generate:
|
|
76707
|
+
generate: generate11,
|
|
76845
76708
|
transformPackageJson: async () => ({
|
|
76846
76709
|
scripts: {
|
|
76847
|
-
deploy: `${
|
|
76848
|
-
preview: `${
|
|
76710
|
+
deploy: `${npm8} run build && wrangler deploy`,
|
|
76711
|
+
preview: `${npm8} run build && wrangler dev`
|
|
76849
76712
|
}
|
|
76850
76713
|
}),
|
|
76851
76714
|
devScript: "dev",
|
|
76852
76715
|
deployScript: "deploy",
|
|
76853
76716
|
previewScript: "preview"
|
|
76854
76717
|
};
|
|
76855
|
-
var
|
|
76718
|
+
var c3_default14 = config12;
|
|
76856
76719
|
|
|
76857
76720
|
// templates/analog/c3.ts
|
|
76858
|
-
var
|
|
76859
|
-
var { npm:
|
|
76860
|
-
var
|
|
76721
|
+
var recast7 = __toESM(require_main3());
|
|
76722
|
+
var { npm: npm9, name: pm2 } = detectPackageManager();
|
|
76723
|
+
var generate12 = async (ctx) => {
|
|
76861
76724
|
await runFrameworkGenerator(ctx, [
|
|
76862
76725
|
ctx.project.name,
|
|
76863
76726
|
"--template",
|
|
@@ -76865,7 +76728,7 @@ var generate13 = async (ctx) => {
|
|
|
76865
76728
|
]);
|
|
76866
76729
|
logRaw("");
|
|
76867
76730
|
};
|
|
76868
|
-
var
|
|
76731
|
+
var configure9 = async (ctx) => {
|
|
76869
76732
|
if (pm2 === "pnpm" || pm2 === "yarn" || pm2 === "bun") {
|
|
76870
76733
|
const packages = [];
|
|
76871
76734
|
packages.push("nitropack");
|
|
@@ -76875,7 +76738,7 @@ var configure10 = async (ctx) => {
|
|
|
76875
76738
|
await installPackages(packages, {
|
|
76876
76739
|
dev: true,
|
|
76877
76740
|
startText: `Installing ${packages.join(", ")}`,
|
|
76878
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76741
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm9} install\``)}`
|
|
76879
76742
|
});
|
|
76880
76743
|
}
|
|
76881
76744
|
updateViteConfig(ctx);
|
|
@@ -76896,7 +76759,7 @@ var updateEnvTypes2 = (ctx) => {
|
|
|
76896
76759
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${filepath}\``)}`);
|
|
76897
76760
|
};
|
|
76898
76761
|
var updateViteConfig = (ctx) => {
|
|
76899
|
-
const b3 =
|
|
76762
|
+
const b3 = recast7.types.builders;
|
|
76900
76763
|
const s = spinner();
|
|
76901
76764
|
const configFile = "vite.config.ts";
|
|
76902
76765
|
s.start(`Updating \`${configFile}\``);
|
|
@@ -76933,7 +76796,7 @@ var updateViteConfig = (ctx) => {
|
|
|
76933
76796
|
});
|
|
76934
76797
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
76935
76798
|
};
|
|
76936
|
-
var
|
|
76799
|
+
var config13 = {
|
|
76937
76800
|
configVersion: 1,
|
|
76938
76801
|
id: "analog",
|
|
76939
76802
|
frameworkCli: "create-analog",
|
|
@@ -76942,12 +76805,12 @@ var config14 = {
|
|
|
76942
76805
|
copyFiles: {
|
|
76943
76806
|
path: "./templates"
|
|
76944
76807
|
},
|
|
76945
|
-
generate:
|
|
76946
|
-
configure:
|
|
76808
|
+
generate: generate12,
|
|
76809
|
+
configure: configure9,
|
|
76947
76810
|
transformPackageJson: async () => ({
|
|
76948
76811
|
scripts: {
|
|
76949
|
-
preview: `${
|
|
76950
|
-
deploy: `${
|
|
76812
|
+
preview: `${npm9} run build && wrangler pages dev`,
|
|
76813
|
+
deploy: `${npm9} run build && wrangler pages deploy`,
|
|
76951
76814
|
"cf-typegen": `wrangler types`
|
|
76952
76815
|
}
|
|
76953
76816
|
}),
|
|
@@ -76955,12 +76818,12 @@ var config14 = {
|
|
|
76955
76818
|
deployScript: "deploy",
|
|
76956
76819
|
previewScript: "preview"
|
|
76957
76820
|
};
|
|
76958
|
-
var
|
|
76821
|
+
var c3_default15 = config13;
|
|
76959
76822
|
|
|
76960
76823
|
// templates/angular/c3.ts
|
|
76961
76824
|
var import_node_path4 = require("node:path");
|
|
76962
|
-
var { npm:
|
|
76963
|
-
var
|
|
76825
|
+
var { npm: npm10 } = detectPackageManager();
|
|
76826
|
+
var generate13 = async (ctx) => {
|
|
76964
76827
|
await runFrameworkGenerator(ctx, [
|
|
76965
76828
|
ctx.project.name,
|
|
76966
76829
|
"--ssr",
|
|
@@ -76968,7 +76831,7 @@ var generate14 = async (ctx) => {
|
|
|
76968
76831
|
]);
|
|
76969
76832
|
logRaw("");
|
|
76970
76833
|
};
|
|
76971
|
-
var
|
|
76834
|
+
var configure10 = async (ctx) => {
|
|
76972
76835
|
updateAngularJson2(ctx);
|
|
76973
76836
|
await updateAppCode2();
|
|
76974
76837
|
await installCFWorker2();
|
|
@@ -76977,7 +76840,7 @@ async function installCFWorker2() {
|
|
|
76977
76840
|
await installPackages(["xhr2"], {
|
|
76978
76841
|
dev: true,
|
|
76979
76842
|
startText: "Installing additional dependencies",
|
|
76980
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
76843
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
|
|
76981
76844
|
});
|
|
76982
76845
|
}
|
|
76983
76846
|
async function updateAppCode2() {
|
|
@@ -77019,7 +76882,7 @@ function updateAngularJson2(ctx) {
|
|
|
77019
76882
|
writeFile2((0, import_node_path4.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
|
|
77020
76883
|
s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
|
|
77021
76884
|
}
|
|
77022
|
-
var
|
|
76885
|
+
var config14 = {
|
|
77023
76886
|
configVersion: 1,
|
|
77024
76887
|
id: "angular",
|
|
77025
76888
|
frameworkCli: "@angular/create",
|
|
@@ -77031,27 +76894,27 @@ var config15 = {
|
|
|
77031
76894
|
devScript: "start",
|
|
77032
76895
|
deployScript: "deploy",
|
|
77033
76896
|
previewScript: "start",
|
|
77034
|
-
generate:
|
|
77035
|
-
configure:
|
|
76897
|
+
generate: generate13,
|
|
76898
|
+
configure: configure10,
|
|
77036
76899
|
transformPackageJson: async () => ({
|
|
77037
76900
|
scripts: {
|
|
77038
|
-
start: `${
|
|
77039
|
-
build: `ng build && ${
|
|
76901
|
+
start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
|
|
76902
|
+
build: `ng build && ${npm10} run process`,
|
|
77040
76903
|
process: "node ./tools/copy-files.mjs",
|
|
77041
|
-
deploy: `${
|
|
76904
|
+
deploy: `${npm10} run build && wrangler pages deploy dist/cloudflare`
|
|
77042
76905
|
}
|
|
77043
76906
|
})
|
|
77044
76907
|
};
|
|
77045
|
-
var
|
|
76908
|
+
var c3_default16 = config14;
|
|
77046
76909
|
|
|
77047
76910
|
// templates/astro/c3.ts
|
|
77048
|
-
var
|
|
76911
|
+
var recast8 = __toESM(require_main3());
|
|
77049
76912
|
var { npx: npx3 } = detectPackageManager();
|
|
77050
|
-
var
|
|
76913
|
+
var generate14 = async (ctx) => {
|
|
77051
76914
|
await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
|
|
77052
76915
|
logRaw("");
|
|
77053
76916
|
};
|
|
77054
|
-
var
|
|
76917
|
+
var configure11 = async () => {
|
|
77055
76918
|
await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
|
|
77056
76919
|
silent: true,
|
|
77057
76920
|
startText: "Installing adapter",
|
|
@@ -77070,7 +76933,7 @@ var updateAstroConfig2 = () => {
|
|
|
77070
76933
|
if (callee.name !== "cloudflare") {
|
|
77071
76934
|
return this.traverse(n);
|
|
77072
76935
|
}
|
|
77073
|
-
const b3 =
|
|
76936
|
+
const b3 = recast8.types.builders;
|
|
77074
76937
|
n.node.arguments = [
|
|
77075
76938
|
b3.objectExpression([
|
|
77076
76939
|
b3.objectProperty(
|
|
@@ -77085,7 +76948,7 @@ var updateAstroConfig2 = () => {
|
|
|
77085
76948
|
}
|
|
77086
76949
|
});
|
|
77087
76950
|
};
|
|
77088
|
-
var
|
|
76951
|
+
var config15 = {
|
|
77089
76952
|
configVersion: 1,
|
|
77090
76953
|
id: "astro",
|
|
77091
76954
|
frameworkCli: "create-astro",
|
|
@@ -77107,8 +76970,8 @@ var config16 = {
|
|
|
77107
76970
|
devScript: "dev",
|
|
77108
76971
|
deployScript: "deploy",
|
|
77109
76972
|
previewScript: "preview",
|
|
77110
|
-
generate:
|
|
77111
|
-
configure:
|
|
76973
|
+
generate: generate14,
|
|
76974
|
+
configure: configure11,
|
|
77112
76975
|
transformPackageJson: async (pkgJson, ctx) => ({
|
|
77113
76976
|
scripts: {
|
|
77114
76977
|
deploy: `astro build && wrangler pages deploy`,
|
|
@@ -77117,10 +76980,10 @@ var config16 = {
|
|
|
77117
76980
|
}
|
|
77118
76981
|
})
|
|
77119
76982
|
};
|
|
77120
|
-
var
|
|
76983
|
+
var c3_default17 = config15;
|
|
77121
76984
|
|
|
77122
76985
|
// templates/common/c3.ts
|
|
77123
|
-
var
|
|
76986
|
+
var c3_default18 = {
|
|
77124
76987
|
configVersion: 1,
|
|
77125
76988
|
id: "common",
|
|
77126
76989
|
displayName: "Example router & proxy Worker",
|
|
@@ -77140,36 +77003,36 @@ var c3_default19 = {
|
|
|
77140
77003
|
};
|
|
77141
77004
|
|
|
77142
77005
|
// templates/docusaurus/pages/c3.ts
|
|
77143
|
-
var { npm:
|
|
77144
|
-
var
|
|
77006
|
+
var { npm: npm11 } = detectPackageManager();
|
|
77007
|
+
var generate15 = async (ctx) => {
|
|
77145
77008
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
77146
77009
|
};
|
|
77147
|
-
var
|
|
77010
|
+
var config16 = {
|
|
77148
77011
|
configVersion: 1,
|
|
77149
77012
|
id: "docusaurus",
|
|
77150
77013
|
frameworkCli: "create-docusaurus",
|
|
77151
77014
|
platform: "pages",
|
|
77152
77015
|
displayName: "Docusaurus",
|
|
77153
77016
|
path: "templates/docusaurus/pages",
|
|
77154
|
-
generate:
|
|
77017
|
+
generate: generate15,
|
|
77155
77018
|
transformPackageJson: async () => ({
|
|
77156
77019
|
scripts: {
|
|
77157
|
-
preview: `${
|
|
77158
|
-
deploy: `${
|
|
77020
|
+
preview: `${npm11} run build && wrangler pages dev ./build`,
|
|
77021
|
+
deploy: `${npm11} run build && wrangler pages deploy ./build`
|
|
77159
77022
|
}
|
|
77160
77023
|
}),
|
|
77161
77024
|
devScript: "preview",
|
|
77162
77025
|
deployScript: "deploy",
|
|
77163
77026
|
previewScript: "preview"
|
|
77164
77027
|
};
|
|
77165
|
-
var
|
|
77028
|
+
var c3_default19 = config16;
|
|
77166
77029
|
|
|
77167
77030
|
// templates/docusaurus/workers/c3.ts
|
|
77168
|
-
var { npm:
|
|
77169
|
-
var
|
|
77031
|
+
var { npm: npm12 } = detectPackageManager();
|
|
77032
|
+
var generate16 = async (ctx) => {
|
|
77170
77033
|
await runFrameworkGenerator(ctx, [ctx.project.name, "classic"]);
|
|
77171
77034
|
};
|
|
77172
|
-
var
|
|
77035
|
+
var config17 = {
|
|
77173
77036
|
configVersion: 1,
|
|
77174
77037
|
id: "docusaurus",
|
|
77175
77038
|
frameworkCli: "create-docusaurus",
|
|
@@ -77179,29 +77042,29 @@ var config18 = {
|
|
|
77179
77042
|
path: "./templates"
|
|
77180
77043
|
},
|
|
77181
77044
|
path: "templates/docusaurus/workers",
|
|
77182
|
-
generate:
|
|
77045
|
+
generate: generate16,
|
|
77183
77046
|
transformPackageJson: async () => ({
|
|
77184
77047
|
scripts: {
|
|
77185
|
-
deploy: `${
|
|
77186
|
-
preview: `${
|
|
77048
|
+
deploy: `${npm12} run build && wrangler deploy`,
|
|
77049
|
+
preview: `${npm12} run build && wrangler dev`
|
|
77187
77050
|
}
|
|
77188
77051
|
}),
|
|
77189
77052
|
devScript: "start",
|
|
77190
77053
|
deployScript: "deploy",
|
|
77191
77054
|
previewScript: "preview"
|
|
77192
77055
|
};
|
|
77193
|
-
var
|
|
77056
|
+
var c3_default20 = config17;
|
|
77194
77057
|
|
|
77195
77058
|
// templates/docusaurus/c3.ts
|
|
77196
|
-
var
|
|
77059
|
+
var config18 = {
|
|
77197
77060
|
displayName: "Docusaurus",
|
|
77198
|
-
platformVariants: { pages:
|
|
77061
|
+
platformVariants: { pages: c3_default19, workers: c3_default20 }
|
|
77199
77062
|
};
|
|
77200
|
-
var
|
|
77063
|
+
var c3_default21 = config18;
|
|
77201
77064
|
|
|
77202
77065
|
// templates/gatsby/c3.ts
|
|
77203
|
-
var { npm:
|
|
77204
|
-
var
|
|
77066
|
+
var { npm: npm13 } = detectPackageManager();
|
|
77067
|
+
var generate17 = async (ctx) => {
|
|
77205
77068
|
const defaultTemplate = "https://github.com/gatsbyjs/gatsby-starter-blog";
|
|
77206
77069
|
const useTemplate = await inputPrompt({
|
|
77207
77070
|
type: "confirm",
|
|
@@ -77220,27 +77083,27 @@ var generate18 = async (ctx) => {
|
|
|
77220
77083
|
}
|
|
77221
77084
|
await runFrameworkGenerator(ctx, ["new", ctx.project.name, templateUrl]);
|
|
77222
77085
|
};
|
|
77223
|
-
var
|
|
77086
|
+
var config19 = {
|
|
77224
77087
|
configVersion: 1,
|
|
77225
77088
|
id: "gatsby",
|
|
77226
77089
|
frameworkCli: "gatsby",
|
|
77227
77090
|
platform: "pages",
|
|
77228
77091
|
displayName: "Gatsby",
|
|
77229
|
-
generate:
|
|
77092
|
+
generate: generate17,
|
|
77230
77093
|
transformPackageJson: async () => ({
|
|
77231
77094
|
scripts: {
|
|
77232
|
-
deploy: `${
|
|
77233
|
-
preview: `${
|
|
77095
|
+
deploy: `${npm13} run build && wrangler pages deploy ./public`,
|
|
77096
|
+
preview: `${npm13} run build && wrangler pages dev ./public`
|
|
77234
77097
|
}
|
|
77235
77098
|
}),
|
|
77236
77099
|
devScript: "develop",
|
|
77237
77100
|
deployScript: "deploy",
|
|
77238
77101
|
previewScript: "preview"
|
|
77239
77102
|
};
|
|
77240
|
-
var
|
|
77103
|
+
var c3_default22 = config19;
|
|
77241
77104
|
|
|
77242
77105
|
// templates/hello-world-durable-object/c3.ts
|
|
77243
|
-
var
|
|
77106
|
+
var c3_default23 = {
|
|
77244
77107
|
configVersion: 1,
|
|
77245
77108
|
id: "hello-world-durable-object",
|
|
77246
77109
|
displayName: "Hello World Worker Using Durable Objects",
|
|
@@ -77261,7 +77124,7 @@ var c3_default24 = {
|
|
|
77261
77124
|
// templates/hello-world/c3.ts
|
|
77262
77125
|
var import_promises2 = require("node:fs/promises");
|
|
77263
77126
|
var import_node_path5 = require("node:path");
|
|
77264
|
-
var
|
|
77127
|
+
var c3_default24 = {
|
|
77265
77128
|
configVersion: 1,
|
|
77266
77129
|
id: "hello-world",
|
|
77267
77130
|
displayName: "Hello World Worker",
|
|
@@ -77295,7 +77158,7 @@ var c3_default25 = {
|
|
|
77295
77158
|
};
|
|
77296
77159
|
|
|
77297
77160
|
// templates/hono/c3.ts
|
|
77298
|
-
var
|
|
77161
|
+
var generate18 = async (ctx) => {
|
|
77299
77162
|
const { name: pm4 } = detectPackageManager();
|
|
77300
77163
|
await runFrameworkGenerator(ctx, [
|
|
77301
77164
|
ctx.project.name,
|
|
@@ -77307,7 +77170,7 @@ var generate19 = async (ctx) => {
|
|
|
77307
77170
|
]);
|
|
77308
77171
|
logRaw("");
|
|
77309
77172
|
};
|
|
77310
|
-
var
|
|
77173
|
+
var configure12 = async (ctx) => {
|
|
77311
77174
|
const indexFile = "src/index.ts";
|
|
77312
77175
|
const s = spinner();
|
|
77313
77176
|
s.start(`Updating \`${indexFile}\``);
|
|
@@ -77322,7 +77185,7 @@ var configure13 = async (ctx) => {
|
|
|
77322
77185
|
});
|
|
77323
77186
|
s.stop(`${brandColor("updated")} \`${dim(indexFile)}\``);
|
|
77324
77187
|
};
|
|
77325
|
-
var
|
|
77188
|
+
var config20 = {
|
|
77326
77189
|
configVersion: 1,
|
|
77327
77190
|
id: "hono",
|
|
77328
77191
|
frameworkCli: "create-hono",
|
|
@@ -77331,8 +77194,8 @@ var config21 = {
|
|
|
77331
77194
|
path: "./templates"
|
|
77332
77195
|
},
|
|
77333
77196
|
platform: "workers",
|
|
77334
|
-
generate:
|
|
77335
|
-
configure:
|
|
77197
|
+
generate: generate18,
|
|
77198
|
+
configure: configure12,
|
|
77336
77199
|
transformPackageJson: async () => ({
|
|
77337
77200
|
scripts: {
|
|
77338
77201
|
dev: "wrangler dev",
|
|
@@ -77344,12 +77207,12 @@ var config21 = {
|
|
|
77344
77207
|
deployScript: "deploy",
|
|
77345
77208
|
previewScript: "dev"
|
|
77346
77209
|
};
|
|
77347
|
-
var
|
|
77210
|
+
var c3_default25 = config20;
|
|
77348
77211
|
|
|
77349
77212
|
// templates/next/c3.ts
|
|
77350
77213
|
var import_path10 = require("path");
|
|
77351
|
-
var { npm:
|
|
77352
|
-
var
|
|
77214
|
+
var { npm: npm14, npx: npx4 } = detectPackageManager();
|
|
77215
|
+
var generate19 = async (ctx) => {
|
|
77353
77216
|
const projectName = ctx.project.name;
|
|
77354
77217
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
77355
77218
|
const wranglerConfig = readFile((0, import_path10.join)(getTemplatePath(ctx), "wrangler.jsonc"));
|
|
@@ -77374,7 +77237,7 @@ var updateNextConfig2 = (usesTs) => {
|
|
|
77374
77237
|
writeFile2(configFile, updatedConfigFile);
|
|
77375
77238
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
77376
77239
|
};
|
|
77377
|
-
var
|
|
77240
|
+
var configure13 = async (ctx) => {
|
|
77378
77241
|
const projectPath = ctx.project.path;
|
|
77379
77242
|
const path6 = probePaths([
|
|
77380
77243
|
`${projectPath}/pages/api`,
|
|
@@ -77449,14 +77312,14 @@ var addDevDependencies = async (installEslintPlugin) => {
|
|
|
77449
77312
|
doneText: `${brandColor(`installed`)} ${dim(packages.join(", "))}`
|
|
77450
77313
|
});
|
|
77451
77314
|
};
|
|
77452
|
-
var
|
|
77315
|
+
var c3_default26 = {
|
|
77453
77316
|
configVersion: 1,
|
|
77454
77317
|
id: "next",
|
|
77455
77318
|
frameworkCli: "create-next-app",
|
|
77456
77319
|
platform: "pages",
|
|
77457
77320
|
displayName: "Next.js",
|
|
77458
|
-
generate:
|
|
77459
|
-
configure:
|
|
77321
|
+
generate: generate19,
|
|
77322
|
+
configure: configure13,
|
|
77460
77323
|
copyFiles: {
|
|
77461
77324
|
async selectVariant(ctx) {
|
|
77462
77325
|
const isApp = probePaths([
|
|
@@ -77487,12 +77350,12 @@ var c3_default27 = {
|
|
|
77487
77350
|
}
|
|
77488
77351
|
},
|
|
77489
77352
|
transformPackageJson: async (_3, ctx) => {
|
|
77490
|
-
const isNpm =
|
|
77491
|
-
const isBun =
|
|
77353
|
+
const isNpm = npm14 === "npm";
|
|
77354
|
+
const isBun = npm14 === "bun";
|
|
77492
77355
|
const isNpmOrBun = isNpm || isBun;
|
|
77493
77356
|
const nextOnPagesScope = isNpmOrBun ? "@cloudflare/" : "";
|
|
77494
77357
|
const nextOnPagesCommand = `${nextOnPagesScope}next-on-pages`;
|
|
77495
|
-
const pmCommand = isNpmOrBun ? npx4 :
|
|
77358
|
+
const pmCommand = isNpmOrBun ? npx4 : npm14;
|
|
77496
77359
|
const pagesBuildRunCommand = `${isNpm ? "npm run" : isBun ? "bun" : pmCommand} pages:build`;
|
|
77497
77360
|
return {
|
|
77498
77361
|
scripts: {
|
|
@@ -77512,21 +77375,21 @@ var c3_default27 = {
|
|
|
77512
77375
|
};
|
|
77513
77376
|
|
|
77514
77377
|
// templates/nuxt/c3.ts
|
|
77515
|
-
var
|
|
77516
|
-
var { npm:
|
|
77517
|
-
var
|
|
77378
|
+
var recast9 = __toESM(require_main3());
|
|
77379
|
+
var { npm: npm15, name: pm3 } = detectPackageManager();
|
|
77380
|
+
var generate20 = async (ctx) => {
|
|
77518
77381
|
const gitFlag = ctx.args.git ? `--gitInit` : `--no-gitInit`;
|
|
77519
77382
|
await runFrameworkGenerator(ctx, [
|
|
77520
77383
|
"init",
|
|
77521
77384
|
ctx.project.name,
|
|
77522
77385
|
"--packageManager",
|
|
77523
|
-
|
|
77386
|
+
npm15,
|
|
77524
77387
|
gitFlag
|
|
77525
77388
|
]);
|
|
77526
77389
|
writeFile2("./.node-version", "18");
|
|
77527
77390
|
logRaw("");
|
|
77528
77391
|
};
|
|
77529
|
-
var
|
|
77392
|
+
var configure14 = async (ctx) => {
|
|
77530
77393
|
const packages = ["nitro-cloudflare-dev"];
|
|
77531
77394
|
if (pm3 === "pnpm") {
|
|
77532
77395
|
packages.push("h3");
|
|
@@ -77534,7 +77397,7 @@ var configure15 = async (ctx) => {
|
|
|
77534
77397
|
await installPackages(packages, {
|
|
77535
77398
|
dev: true,
|
|
77536
77399
|
startText: "Installing nitro module `nitro-cloudflare-dev`",
|
|
77537
|
-
doneText: `${brandColor("installed")} ${dim(`via \`${
|
|
77400
|
+
doneText: `${brandColor("installed")} ${dim(`via \`${npm15} install\``)}`
|
|
77538
77401
|
});
|
|
77539
77402
|
updateNuxtConfig2();
|
|
77540
77403
|
updateEnvTypes3(ctx);
|
|
@@ -77557,7 +77420,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77557
77420
|
const s = spinner();
|
|
77558
77421
|
const configFile = "nuxt.config.ts";
|
|
77559
77422
|
s.start(`Updating \`${configFile}\``);
|
|
77560
|
-
const b3 =
|
|
77423
|
+
const b3 = recast9.types.builders;
|
|
77561
77424
|
const presetDef = b3.objectProperty(
|
|
77562
77425
|
b3.identifier("nitro"),
|
|
77563
77426
|
b3.objectExpression([
|
|
@@ -77585,7 +77448,7 @@ var updateNuxtConfig2 = () => {
|
|
|
77585
77448
|
});
|
|
77586
77449
|
s.stop(`${brandColor(`updated`)} ${dim(`\`${configFile}\``)}`);
|
|
77587
77450
|
};
|
|
77588
|
-
var
|
|
77451
|
+
var config21 = {
|
|
77589
77452
|
configVersion: 1,
|
|
77590
77453
|
id: "nuxt",
|
|
77591
77454
|
frameworkCli: "nuxi",
|
|
@@ -77594,12 +77457,12 @@ var config22 = {
|
|
|
77594
77457
|
copyFiles: {
|
|
77595
77458
|
path: "./templates"
|
|
77596
77459
|
},
|
|
77597
|
-
generate:
|
|
77598
|
-
configure:
|
|
77460
|
+
generate: generate20,
|
|
77461
|
+
configure: configure14,
|
|
77599
77462
|
transformPackageJson: async () => ({
|
|
77600
77463
|
scripts: {
|
|
77601
|
-
deploy: `${
|
|
77602
|
-
preview: `${
|
|
77464
|
+
deploy: `${npm15} run build && wrangler pages deploy`,
|
|
77465
|
+
preview: `${npm15} run build && wrangler pages dev`,
|
|
77603
77466
|
"cf-typegen": `wrangler types`
|
|
77604
77467
|
}
|
|
77605
77468
|
}),
|
|
@@ -77607,10 +77470,10 @@ var config22 = {
|
|
|
77607
77470
|
deployScript: "deploy",
|
|
77608
77471
|
previewScript: "preview"
|
|
77609
77472
|
};
|
|
77610
|
-
var
|
|
77473
|
+
var c3_default27 = config21;
|
|
77611
77474
|
|
|
77612
77475
|
// templates/openapi/c3.ts
|
|
77613
|
-
var
|
|
77476
|
+
var c3_default28 = {
|
|
77614
77477
|
configVersion: 1,
|
|
77615
77478
|
id: "openapi",
|
|
77616
77479
|
displayName: "API starter (OpenAPI compliant)",
|
|
@@ -77769,7 +77632,7 @@ async function copyExistingWorkerFiles(ctx) {
|
|
|
77769
77632
|
(0, import_path11.join)(ctx.project.path, "wrangler.toml")
|
|
77770
77633
|
);
|
|
77771
77634
|
}
|
|
77772
|
-
var
|
|
77635
|
+
var c3_default29 = {
|
|
77773
77636
|
configVersion: 1,
|
|
77774
77637
|
id: "pre-existing",
|
|
77775
77638
|
displayName: "Pre-existing Worker (from Dashboard)",
|
|
@@ -77797,7 +77660,7 @@ function buildConfigure(params) {
|
|
|
77797
77660
|
}
|
|
77798
77661
|
|
|
77799
77662
|
// templates/queues/c3.ts
|
|
77800
|
-
var
|
|
77663
|
+
var c3_default30 = {
|
|
77801
77664
|
configVersion: 1,
|
|
77802
77665
|
id: "queues",
|
|
77803
77666
|
displayName: "Queue consumer & producer Worker",
|
|
@@ -77826,13 +77689,13 @@ var c3_default31 = {
|
|
|
77826
77689
|
};
|
|
77827
77690
|
|
|
77828
77691
|
// templates/qwik/c3.ts
|
|
77829
|
-
var
|
|
77830
|
-
var { npm:
|
|
77831
|
-
var
|
|
77692
|
+
var recast10 = __toESM(require_main3());
|
|
77693
|
+
var { npm: npm16, npx: npx5, name: name2 } = detectPackageManager();
|
|
77694
|
+
var generate21 = async (ctx) => {
|
|
77832
77695
|
await runFrameworkGenerator(ctx, ["playground", ctx.project.name]);
|
|
77833
77696
|
};
|
|
77834
|
-
var
|
|
77835
|
-
const cmd = [name2 === "pnpm" ?
|
|
77697
|
+
var configure15 = async (ctx) => {
|
|
77698
|
+
const cmd = [name2 === "pnpm" ? npm16 : npx5, "qwik", "add", "cloudflare-pages"];
|
|
77836
77699
|
endSection(`Running ${quoteShellArgs(cmd)}`);
|
|
77837
77700
|
await runCommand(cmd);
|
|
77838
77701
|
addBindingsProxy2(ctx);
|
|
@@ -77845,7 +77708,7 @@ var addBindingsProxy2 = (ctx) => {
|
|
|
77845
77708
|
const s = spinner();
|
|
77846
77709
|
s.start("Updating `vite.config.ts`");
|
|
77847
77710
|
const snippets = loadTemplateSnippets(ctx);
|
|
77848
|
-
const b3 =
|
|
77711
|
+
const b3 = recast10.types.builders;
|
|
77849
77712
|
transformFile("vite.config.ts", {
|
|
77850
77713
|
// Insert the env declaration after the last import (but before the rest of the body)
|
|
77851
77714
|
visitProgram: function(n) {
|
|
@@ -77887,7 +77750,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77887
77750
|
s.start(`Updating \`${entrypointPath}\``);
|
|
77888
77751
|
transformFile(entrypointPath, {
|
|
77889
77752
|
visitTSInterfaceDeclaration: function(n) {
|
|
77890
|
-
const b3 =
|
|
77753
|
+
const b3 = recast10.types.builders;
|
|
77891
77754
|
const id = n.node.id;
|
|
77892
77755
|
if (id.name !== "QwikCityPlatform") {
|
|
77893
77756
|
this.traverse(n);
|
|
@@ -77908,7 +77771,7 @@ var populateCloudflareEnv2 = () => {
|
|
|
77908
77771
|
});
|
|
77909
77772
|
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
|
|
77910
77773
|
};
|
|
77911
|
-
var
|
|
77774
|
+
var config22 = {
|
|
77912
77775
|
configVersion: 1,
|
|
77913
77776
|
id: "qwik",
|
|
77914
77777
|
frameworkCli: "create-qwik",
|
|
@@ -77917,12 +77780,12 @@ var config23 = {
|
|
|
77917
77780
|
copyFiles: {
|
|
77918
77781
|
path: "./templates"
|
|
77919
77782
|
},
|
|
77920
|
-
generate:
|
|
77921
|
-
configure:
|
|
77783
|
+
generate: generate21,
|
|
77784
|
+
configure: configure15,
|
|
77922
77785
|
transformPackageJson: async () => ({
|
|
77923
77786
|
scripts: {
|
|
77924
|
-
deploy: `${
|
|
77925
|
-
preview: `${
|
|
77787
|
+
deploy: `${npm16} run build && wrangler pages deploy`,
|
|
77788
|
+
preview: `${npm16} run build && wrangler pages dev`,
|
|
77926
77789
|
"cf-typegen": `wrangler types`
|
|
77927
77790
|
}
|
|
77928
77791
|
}),
|
|
@@ -77930,11 +77793,11 @@ var config23 = {
|
|
|
77930
77793
|
deployScript: "deploy",
|
|
77931
77794
|
previewScript: "preview"
|
|
77932
77795
|
};
|
|
77933
|
-
var
|
|
77796
|
+
var c3_default31 = config22;
|
|
77934
77797
|
|
|
77935
|
-
// templates/react/c3.ts
|
|
77936
|
-
var { npm:
|
|
77937
|
-
var
|
|
77798
|
+
// templates/react/pages/c3.ts
|
|
77799
|
+
var { npm: npm17 } = detectPackageManager();
|
|
77800
|
+
var generate22 = async (ctx) => {
|
|
77938
77801
|
const variant = await inputPrompt({
|
|
77939
77802
|
type: "select",
|
|
77940
77803
|
question: "Select a variant:",
|
|
@@ -77963,18 +77826,157 @@ var variantsOptions = [
|
|
|
77963
77826
|
label: "JavaScript + SWC"
|
|
77964
77827
|
}
|
|
77965
77828
|
];
|
|
77966
|
-
var
|
|
77829
|
+
var config23 = {
|
|
77967
77830
|
configVersion: 1,
|
|
77968
77831
|
id: "react",
|
|
77969
77832
|
// React's documentation now recommends using create-vite.
|
|
77970
77833
|
frameworkCli: "create-vite",
|
|
77971
77834
|
displayName: "React",
|
|
77972
77835
|
platform: "pages",
|
|
77973
|
-
|
|
77836
|
+
path: "templates/react/pages",
|
|
77837
|
+
generate: generate22,
|
|
77974
77838
|
transformPackageJson: async () => ({
|
|
77975
77839
|
scripts: {
|
|
77976
|
-
deploy: `${
|
|
77977
|
-
preview: `${
|
|
77840
|
+
deploy: `${npm17} run build && wrangler pages deploy ./dist`,
|
|
77841
|
+
preview: `${npm17} run build && wrangler pages dev ./dist`
|
|
77842
|
+
}
|
|
77843
|
+
}),
|
|
77844
|
+
devScript: "dev",
|
|
77845
|
+
deployScript: "deploy",
|
|
77846
|
+
previewScript: "preview"
|
|
77847
|
+
};
|
|
77848
|
+
var c3_default32 = config23;
|
|
77849
|
+
|
|
77850
|
+
// templates/react/workers/c3.ts
|
|
77851
|
+
var import_assert2 = __toESM(require("assert"));
|
|
77852
|
+
var recast11 = __toESM(require_main3());
|
|
77853
|
+
var b2 = recast11.types.builders;
|
|
77854
|
+
var t = recast11.types.namedTypes;
|
|
77855
|
+
var { npm: npm18 } = detectPackageManager();
|
|
77856
|
+
var generate23 = async (ctx) => {
|
|
77857
|
+
const variant = await getVariant();
|
|
77858
|
+
ctx.args.lang = variant.lang;
|
|
77859
|
+
await runFrameworkGenerator(ctx, [
|
|
77860
|
+
ctx.project.name,
|
|
77861
|
+
"--template",
|
|
77862
|
+
variant.value
|
|
77863
|
+
]);
|
|
77864
|
+
logRaw("");
|
|
77865
|
+
};
|
|
77866
|
+
var configure16 = async (ctx) => {
|
|
77867
|
+
await installPackages(["@cloudflare/vite-plugin"], {
|
|
77868
|
+
dev: true,
|
|
77869
|
+
startText: "Installing the Cloudflare Vite plugin",
|
|
77870
|
+
doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
|
|
77871
|
+
});
|
|
77872
|
+
await transformViteConfig(ctx);
|
|
77873
|
+
if (usesTypescript(ctx)) {
|
|
77874
|
+
updateTsconfigJson();
|
|
77875
|
+
}
|
|
77876
|
+
};
|
|
77877
|
+
function transformViteConfig(ctx) {
|
|
77878
|
+
const filePath = `vite.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
77879
|
+
transformFile(filePath, {
|
|
77880
|
+
visitProgram(n) {
|
|
77881
|
+
const lastImportIndex = n.node.body.findLastIndex(
|
|
77882
|
+
(statement) => statement.type === "ImportDeclaration"
|
|
77883
|
+
);
|
|
77884
|
+
const lastImport = n.get("body", lastImportIndex);
|
|
77885
|
+
const importAst = b2.importDeclaration(
|
|
77886
|
+
[b2.importSpecifier(b2.identifier("cloudflare"))],
|
|
77887
|
+
b2.stringLiteral("@cloudflare/vite-plugin")
|
|
77888
|
+
);
|
|
77889
|
+
lastImport.insertAfter(importAst);
|
|
77890
|
+
return this.traverse(n);
|
|
77891
|
+
},
|
|
77892
|
+
visitCallExpression: function(n) {
|
|
77893
|
+
const callee = n.node.callee;
|
|
77894
|
+
if (callee.name !== "defineConfig") {
|
|
77895
|
+
return this.traverse(n);
|
|
77896
|
+
}
|
|
77897
|
+
const config30 = n.node.arguments[0];
|
|
77898
|
+
(0, import_assert2.default)(t.ObjectExpression.check(config30));
|
|
77899
|
+
const pluginsProp = config30.properties.find((prop) => isPluginsProp(prop));
|
|
77900
|
+
(0, import_assert2.default)(pluginsProp && t.ArrayExpression.check(pluginsProp.value));
|
|
77901
|
+
pluginsProp.value.elements.push(
|
|
77902
|
+
b2.callExpression(b2.identifier("cloudflare"), [])
|
|
77903
|
+
);
|
|
77904
|
+
return false;
|
|
77905
|
+
}
|
|
77906
|
+
});
|
|
77907
|
+
}
|
|
77908
|
+
function isPluginsProp(prop) {
|
|
77909
|
+
return (t.Property.check(prop) || t.ObjectProperty.check(prop)) && t.Identifier.check(prop.key) && prop.key.name === "plugins";
|
|
77910
|
+
}
|
|
77911
|
+
function updateTsconfigJson() {
|
|
77912
|
+
const s = spinner();
|
|
77913
|
+
s.start(`Updating tsconfig.json config`);
|
|
77914
|
+
const tsconfig = readJSON("tsconfig.json");
|
|
77915
|
+
if (tsconfig && typeof tsconfig === "object") {
|
|
77916
|
+
tsconfig.references ??= [];
|
|
77917
|
+
tsconfig.references.push({ path: "./tsconfig.worker.json" });
|
|
77918
|
+
}
|
|
77919
|
+
writeJSON("tsconfig.json", tsconfig);
|
|
77920
|
+
s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
|
|
77921
|
+
}
|
|
77922
|
+
async function getVariant() {
|
|
77923
|
+
const variantsOptions2 = [
|
|
77924
|
+
{
|
|
77925
|
+
value: "react-ts",
|
|
77926
|
+
lang: "ts",
|
|
77927
|
+
label: "TypeScript"
|
|
77928
|
+
},
|
|
77929
|
+
{
|
|
77930
|
+
value: "react-swc-ts",
|
|
77931
|
+
lang: "ts",
|
|
77932
|
+
label: "TypeScript + SWC"
|
|
77933
|
+
},
|
|
77934
|
+
{
|
|
77935
|
+
value: "react",
|
|
77936
|
+
lang: "js",
|
|
77937
|
+
label: "JavaScript"
|
|
77938
|
+
},
|
|
77939
|
+
{
|
|
77940
|
+
value: "react-swc",
|
|
77941
|
+
lang: "js",
|
|
77942
|
+
label: "JavaScript + SWC"
|
|
77943
|
+
}
|
|
77944
|
+
];
|
|
77945
|
+
const value = await inputPrompt({
|
|
77946
|
+
type: "select",
|
|
77947
|
+
question: "Select a variant:",
|
|
77948
|
+
label: "variant",
|
|
77949
|
+
options: variantsOptions2,
|
|
77950
|
+
defaultValue: variantsOptions2[0].value
|
|
77951
|
+
});
|
|
77952
|
+
const selected = variantsOptions2.find((variant) => variant.value === value);
|
|
77953
|
+
(0, import_assert2.default)(selected, "Expected a variant to be selected");
|
|
77954
|
+
return selected;
|
|
77955
|
+
}
|
|
77956
|
+
var config24 = {
|
|
77957
|
+
configVersion: 1,
|
|
77958
|
+
id: "react",
|
|
77959
|
+
frameworkCli: "create-vite",
|
|
77960
|
+
displayName: "React",
|
|
77961
|
+
platform: "workers",
|
|
77962
|
+
path: "templates/react/workers",
|
|
77963
|
+
copyFiles: {
|
|
77964
|
+
variants: {
|
|
77965
|
+
ts: {
|
|
77966
|
+
path: "./ts"
|
|
77967
|
+
},
|
|
77968
|
+
js: {
|
|
77969
|
+
path: "./js"
|
|
77970
|
+
}
|
|
77971
|
+
}
|
|
77972
|
+
},
|
|
77973
|
+
generate: generate23,
|
|
77974
|
+
configure: configure16,
|
|
77975
|
+
transformPackageJson: async (_3, ctx) => ({
|
|
77976
|
+
scripts: {
|
|
77977
|
+
deploy: `${npm18} run build && wrangler deploy`,
|
|
77978
|
+
preview: `${npm18} run build && vite preview`,
|
|
77979
|
+
...usesTypescript(ctx) && { "cf-typegen": `wrangler types` }
|
|
77978
77980
|
}
|
|
77979
77981
|
}),
|
|
77980
77982
|
devScript: "dev",
|
|
@@ -77983,6 +77985,13 @@ var config24 = {
|
|
|
77983
77985
|
};
|
|
77984
77986
|
var c3_default33 = config24;
|
|
77985
77987
|
|
|
77988
|
+
// templates/react/c3.ts
|
|
77989
|
+
var config25 = {
|
|
77990
|
+
displayName: "React",
|
|
77991
|
+
platformVariants: { pages: c3_default32, workers: c3_default33 }
|
|
77992
|
+
};
|
|
77993
|
+
var c3_default34 = config25;
|
|
77994
|
+
|
|
77986
77995
|
// templates/remix/c3.ts
|
|
77987
77996
|
var { npm: npm19 } = detectPackageManager();
|
|
77988
77997
|
var generate24 = async (ctx) => {
|
|
@@ -78008,7 +78017,7 @@ var configure17 = async () => {
|
|
|
78008
78017
|
});
|
|
78009
78018
|
s.stop(`${brandColor("updated")} \`${dim(typeDefsPath)}\``);
|
|
78010
78019
|
};
|
|
78011
|
-
var
|
|
78020
|
+
var config26 = {
|
|
78012
78021
|
configVersion: 1,
|
|
78013
78022
|
id: "remix",
|
|
78014
78023
|
frameworkCli: "create-remix",
|
|
@@ -78030,10 +78039,10 @@ var config25 = {
|
|
|
78030
78039
|
deployScript: "deploy",
|
|
78031
78040
|
previewScript: "preview"
|
|
78032
78041
|
};
|
|
78033
|
-
var
|
|
78042
|
+
var c3_default35 = config26;
|
|
78034
78043
|
|
|
78035
78044
|
// templates/scheduled/c3.ts
|
|
78036
|
-
var
|
|
78045
|
+
var c3_default36 = {
|
|
78037
78046
|
configVersion: 1,
|
|
78038
78047
|
id: "scheduled",
|
|
78039
78048
|
displayName: "Scheduled Worker (Cron Trigger)",
|
|
@@ -78096,7 +78105,7 @@ var configure18 = async (ctx) => {
|
|
|
78096
78105
|
}
|
|
78097
78106
|
});
|
|
78098
78107
|
};
|
|
78099
|
-
var
|
|
78108
|
+
var config27 = {
|
|
78100
78109
|
configVersion: 1,
|
|
78101
78110
|
id: "solid",
|
|
78102
78111
|
frameworkCli: "create-solid",
|
|
@@ -78118,7 +78127,7 @@ var config26 = {
|
|
|
78118
78127
|
deployScript: "deploy",
|
|
78119
78128
|
previewScript: "preview"
|
|
78120
78129
|
};
|
|
78121
|
-
var
|
|
78130
|
+
var c3_default37 = config27;
|
|
78122
78131
|
|
|
78123
78132
|
// templates/svelte/c3.ts
|
|
78124
78133
|
var import_node_fs3 = require("node:fs");
|
|
@@ -78211,7 +78220,7 @@ var updateTypeDefinitions2 = (ctx) => {
|
|
|
78211
78220
|
}
|
|
78212
78221
|
});
|
|
78213
78222
|
};
|
|
78214
|
-
var
|
|
78223
|
+
var config28 = {
|
|
78215
78224
|
configVersion: 1,
|
|
78216
78225
|
id: "svelte",
|
|
78217
78226
|
frameworkCli: "sv",
|
|
@@ -78240,14 +78249,14 @@ var config27 = {
|
|
|
78240
78249
|
deployScript: "deploy",
|
|
78241
78250
|
previewScript: "preview"
|
|
78242
78251
|
};
|
|
78243
|
-
var
|
|
78252
|
+
var c3_default38 = config28;
|
|
78244
78253
|
|
|
78245
78254
|
// templates/vue/c3.ts
|
|
78246
78255
|
var { npm: npm22 } = detectPackageManager();
|
|
78247
78256
|
var generate27 = async (ctx) => {
|
|
78248
78257
|
await runFrameworkGenerator(ctx, [ctx.project.name]);
|
|
78249
78258
|
};
|
|
78250
|
-
var
|
|
78259
|
+
var config29 = {
|
|
78251
78260
|
configVersion: 1,
|
|
78252
78261
|
id: "vue",
|
|
78253
78262
|
frameworkCli: "create-vue",
|
|
@@ -78264,7 +78273,7 @@ var config28 = {
|
|
|
78264
78273
|
deployScript: "deploy",
|
|
78265
78274
|
previewScript: "preview"
|
|
78266
78275
|
};
|
|
78267
|
-
var
|
|
78276
|
+
var c3_default39 = config29;
|
|
78268
78277
|
|
|
78269
78278
|
// src/git.ts
|
|
78270
78279
|
var import_node_assert = __toESM(require("node:assert"));
|
|
@@ -78538,28 +78547,27 @@ function getFrameworkMap({ experimental = false }) {
|
|
|
78538
78547
|
next: c3_default8,
|
|
78539
78548
|
nuxt: c3_default9,
|
|
78540
78549
|
qwik: c3_default10,
|
|
78541
|
-
|
|
78542
|
-
|
|
78543
|
-
|
|
78544
|
-
|
|
78545
|
-
vue: c3_default15
|
|
78550
|
+
remix: c3_default11,
|
|
78551
|
+
solid: c3_default12,
|
|
78552
|
+
svelte: c3_default13,
|
|
78553
|
+
vue: c3_default14
|
|
78546
78554
|
};
|
|
78547
78555
|
} else {
|
|
78548
78556
|
return {
|
|
78549
|
-
analog:
|
|
78550
|
-
angular:
|
|
78551
|
-
astro:
|
|
78552
|
-
docusaurus:
|
|
78553
|
-
gatsby:
|
|
78554
|
-
hono:
|
|
78555
|
-
next:
|
|
78556
|
-
nuxt:
|
|
78557
|
-
qwik:
|
|
78558
|
-
react:
|
|
78559
|
-
remix:
|
|
78560
|
-
solid:
|
|
78561
|
-
svelte:
|
|
78562
|
-
vue:
|
|
78557
|
+
analog: c3_default15,
|
|
78558
|
+
angular: c3_default16,
|
|
78559
|
+
astro: c3_default17,
|
|
78560
|
+
docusaurus: c3_default21,
|
|
78561
|
+
gatsby: c3_default22,
|
|
78562
|
+
hono: c3_default25,
|
|
78563
|
+
next: c3_default26,
|
|
78564
|
+
nuxt: c3_default27,
|
|
78565
|
+
qwik: c3_default31,
|
|
78566
|
+
react: c3_default34,
|
|
78567
|
+
remix: c3_default35,
|
|
78568
|
+
solid: c3_default37,
|
|
78569
|
+
svelte: c3_default38,
|
|
78570
|
+
vue: c3_default39
|
|
78563
78571
|
};
|
|
78564
78572
|
}
|
|
78565
78573
|
}
|
|
@@ -78572,13 +78580,13 @@ function getTemplateMap({ experimental = false }) {
|
|
|
78572
78580
|
};
|
|
78573
78581
|
} else {
|
|
78574
78582
|
return {
|
|
78575
|
-
"hello-world":
|
|
78576
|
-
common:
|
|
78577
|
-
scheduled:
|
|
78578
|
-
queues:
|
|
78579
|
-
"hello-world-durable-object":
|
|
78580
|
-
openapi:
|
|
78581
|
-
"pre-existing":
|
|
78583
|
+
"hello-world": c3_default24,
|
|
78584
|
+
common: c3_default18,
|
|
78585
|
+
scheduled: c3_default36,
|
|
78586
|
+
queues: c3_default30,
|
|
78587
|
+
"hello-world-durable-object": c3_default23,
|
|
78588
|
+
openapi: c3_default28,
|
|
78589
|
+
"pre-existing": c3_default29
|
|
78582
78590
|
};
|
|
78583
78591
|
}
|
|
78584
78592
|
}
|
|
@@ -78726,8 +78734,8 @@ var createContext = async (args, prevArgs) => {
|
|
|
78726
78734
|
experimental: args.experimental
|
|
78727
78735
|
});
|
|
78728
78736
|
const frameworkOptions = Object.entries(frameworkMap).map(
|
|
78729
|
-
([key,
|
|
78730
|
-
label:
|
|
78737
|
+
([key, config30]) => ({
|
|
78738
|
+
label: config30.displayName,
|
|
78731
78739
|
value: key
|
|
78732
78740
|
})
|
|
78733
78741
|
);
|
|
@@ -78894,28 +78902,28 @@ var processRemoteTemplate = async (args) => {
|
|
|
78894
78902
|
src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
|
|
78895
78903
|
}
|
|
78896
78904
|
const path6 = await downloadRemoteTemplate(src);
|
|
78897
|
-
const
|
|
78898
|
-
validateTemplate(path6,
|
|
78905
|
+
const config30 = inferTemplateConfig(path6);
|
|
78906
|
+
validateTemplate(path6, config30);
|
|
78899
78907
|
updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
|
|
78900
78908
|
return {
|
|
78901
78909
|
path: path6,
|
|
78902
|
-
...
|
|
78910
|
+
...config30
|
|
78903
78911
|
};
|
|
78904
78912
|
};
|
|
78905
|
-
var validateTemplate = (path6,
|
|
78906
|
-
if (!
|
|
78913
|
+
var validateTemplate = (path6, config30) => {
|
|
78914
|
+
if (!config30.copyFiles) {
|
|
78907
78915
|
return;
|
|
78908
78916
|
}
|
|
78909
|
-
if (isVariantInfo(
|
|
78910
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6,
|
|
78917
|
+
if (isVariantInfo(config30.copyFiles)) {
|
|
78918
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, config30.copyFiles.path), config30);
|
|
78911
78919
|
} else {
|
|
78912
|
-
for (const variant of Object.values(
|
|
78913
|
-
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path),
|
|
78920
|
+
for (const variant of Object.values(config30.copyFiles.variants)) {
|
|
78921
|
+
validateTemplateSrcDirectory((0, import_path13.resolve)(path6, variant.path), config30);
|
|
78914
78922
|
}
|
|
78915
78923
|
}
|
|
78916
78924
|
};
|
|
78917
|
-
var validateTemplateSrcDirectory = (path6,
|
|
78918
|
-
if (
|
|
78925
|
+
var validateTemplateSrcDirectory = (path6, config30) => {
|
|
78926
|
+
if (config30.platform === "workers") {
|
|
78919
78927
|
const wranglerTomlPath = (0, import_path13.resolve)(path6, "wrangler.toml");
|
|
78920
78928
|
const wranglerJsonPath = (0, import_path13.resolve)(path6, "wrangler.json");
|
|
78921
78929
|
const wranglerJsoncPath = (0, import_path13.resolve)(path6, "wrangler.jsonc");
|
|
@@ -80812,20 +80820,20 @@ function applyEdits(text, edits) {
|
|
|
80812
80820
|
var import_fs12 = require("fs");
|
|
80813
80821
|
var import_path14 = require("path");
|
|
80814
80822
|
var import_toml2 = __toESM(require_toml());
|
|
80815
|
-
function ensureNameExists(
|
|
80816
|
-
|
|
80817
|
-
return
|
|
80823
|
+
function ensureNameExists(config30, projectName) {
|
|
80824
|
+
config30["name"] = projectName;
|
|
80825
|
+
return config30;
|
|
80818
80826
|
}
|
|
80819
|
-
async function ensureCompatDateExists(
|
|
80820
|
-
if (typeof
|
|
80827
|
+
async function ensureCompatDateExists(config30) {
|
|
80828
|
+
if (typeof config30["compatibility_date"] === "string") {
|
|
80821
80829
|
const validCompatDateRe = /^\d{4}-\d{2}-\d{2}/m;
|
|
80822
|
-
if (!
|
|
80823
|
-
|
|
80830
|
+
if (!config30["compatibility_date"].match(validCompatDateRe)) {
|
|
80831
|
+
config30["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80824
80832
|
}
|
|
80825
80833
|
} else {
|
|
80826
|
-
|
|
80834
|
+
config30["compatibility_date"] = await getWorkerdCompatibilityDate();
|
|
80827
80835
|
}
|
|
80828
|
-
return
|
|
80836
|
+
return config30;
|
|
80829
80837
|
}
|
|
80830
80838
|
var updateWranglerConfig = async (ctx) => {
|
|
80831
80839
|
if (wranglerJsonExists(ctx)) {
|
|
@@ -81539,8 +81547,8 @@ var renderValues = (values) => {
|
|
|
81539
81547
|
};
|
|
81540
81548
|
|
|
81541
81549
|
// src/helpers/retry.ts
|
|
81542
|
-
var retry = async (
|
|
81543
|
-
let { times } =
|
|
81550
|
+
var retry = async (config30, fn) => {
|
|
81551
|
+
let { times } = config30;
|
|
81544
81552
|
let error2 = null;
|
|
81545
81553
|
while (times > 0) {
|
|
81546
81554
|
try {
|
|
@@ -81548,10 +81556,10 @@ var retry = async (config29, fn) => {
|
|
|
81548
81556
|
} catch (e) {
|
|
81549
81557
|
error2 = e;
|
|
81550
81558
|
times--;
|
|
81551
|
-
if (
|
|
81559
|
+
if (config30.exitCondition?.(e)) {
|
|
81552
81560
|
break;
|
|
81553
81561
|
}
|
|
81554
|
-
await sleep(
|
|
81562
|
+
await sleep(config30.sleepMs ?? 1e3);
|
|
81555
81563
|
}
|
|
81556
81564
|
}
|
|
81557
81565
|
throw error2;
|
|
@@ -81671,8 +81679,8 @@ async function addWorkersTypesToTsConfig(ctx) {
|
|
|
81671
81679
|
}
|
|
81672
81680
|
const typesEntrypoint = `@cloudflare/workers-types/${entrypointVersion}`;
|
|
81673
81681
|
try {
|
|
81674
|
-
const
|
|
81675
|
-
const currentTypes =
|
|
81682
|
+
const config30 = parse4(tsconfig);
|
|
81683
|
+
const currentTypes = config30.compilerOptions?.types ?? [];
|
|
81676
81684
|
const explicitEntrypoint = currentTypes.some(
|
|
81677
81685
|
(t2) => t2.match(/@cloudflare\/workers-types\/\d{4}-\d{2}-\d{2}/)
|
|
81678
81686
|
);
|