create-cloudflare 2.72.8 → 2.72.9
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 +58 -55
- package/package.json +7 -7
- package/templates/common/js/src/index.js +2 -2
- package/templates/common/js/src/proxy.js +5 -7
- package/templates/common/js/src/redirect.js +4 -8
- package/templates/common/ts/src/index.ts +2 -2
- package/templates/common/ts/src/proxy.ts +5 -7
- package/templates/common/ts/src/redirect.ts +4 -8
package/dist/cli.js
CHANGED
|
@@ -80413,9 +80413,9 @@ function formatConfigSnippet(snippet, configPath, formatted = true) {
|
|
|
80413
80413
|
}
|
|
80414
80414
|
__name(formatConfigSnippet, "formatConfigSnippet");
|
|
80415
80415
|
|
|
80416
|
-
// ../workers-utils/dist/chunk-
|
|
80416
|
+
// ../workers-utils/dist/chunk-YZWVNJ5I.mjs
|
|
80417
80417
|
init_chunk_Q72B4Q5Z();
|
|
80418
|
-
var DEFAULT_COMPAT_DATE = "2026-09-
|
|
80418
|
+
var DEFAULT_COMPAT_DATE = "2026-09-16";
|
|
80419
80419
|
function assertNever(_value) {
|
|
80420
80420
|
}
|
|
80421
80421
|
__name(assertNever, "assertNever");
|
|
@@ -81358,7 +81358,6 @@ var import_node_crypto = require("node:crypto");
|
|
|
81358
81358
|
var import_node_os5 = require("node:os");
|
|
81359
81359
|
var timersPromises = __toESM(require("node:timers/promises"), 1);
|
|
81360
81360
|
var import_promises2 = require("node:timers/promises");
|
|
81361
|
-
var import_node_console = require("node:console");
|
|
81362
81361
|
var require_vendors2 = __commonJS2({
|
|
81363
81362
|
"../../node_modules/.pnpm/ci-info@4.4.0/node_modules/ci-info/vendors.json"(exports$1, module2) {
|
|
81364
81363
|
module2.exports = [
|
|
@@ -99077,17 +99076,31 @@ function validateRoutes(diagnostics, topLevelEnv, rawEnv, envName) {
|
|
|
99077
99076
|
return result;
|
|
99078
99077
|
}
|
|
99079
99078
|
__name(validateRoutes, "validateRoutes");
|
|
99080
|
-
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
99081
|
-
if (rawEnv.placement) {
|
|
99079
|
+
function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv, diagnosticField = "placement") {
|
|
99080
|
+
if (rawEnv.placement !== void 0) {
|
|
99081
|
+
if (typeof rawEnv.placement !== "object" || rawEnv.placement === null || Array.isArray(rawEnv.placement)) {
|
|
99082
|
+
diagnostics.errors.push(
|
|
99083
|
+
`The field "${diagnosticField}" should be an object but got ${JSON.stringify(rawEnv.placement)}.`
|
|
99084
|
+
);
|
|
99085
|
+
return inheritable(
|
|
99086
|
+
diagnostics,
|
|
99087
|
+
topLevelEnv,
|
|
99088
|
+
rawEnv,
|
|
99089
|
+
"placement",
|
|
99090
|
+
() => true,
|
|
99091
|
+
void 0
|
|
99092
|
+
);
|
|
99093
|
+
}
|
|
99082
99094
|
const placement = rawEnv.placement;
|
|
99083
99095
|
const hasHint = "hint" in placement;
|
|
99084
|
-
const
|
|
99085
|
-
const
|
|
99086
|
-
|
|
99087
|
-
|
|
99096
|
+
const targetedFields = ["region", "host", "hostname"];
|
|
99097
|
+
const presentTargetedFields = targetedFields.filter(
|
|
99098
|
+
(field) => field in placement
|
|
99099
|
+
);
|
|
99100
|
+
const hasTargetedFields = presentTargetedFields.length > 0;
|
|
99088
99101
|
if (hasHint && hasTargetedFields) {
|
|
99089
99102
|
diagnostics.errors.push(
|
|
99090
|
-
`"
|
|
99103
|
+
`"${diagnosticField}" cannot have both "hint" (smart format) and "region"/"host"/"hostname" (targeted format) fields`
|
|
99091
99104
|
);
|
|
99092
99105
|
return inheritable(
|
|
99093
99106
|
diagnostics,
|
|
@@ -99101,7 +99114,7 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
99101
99114
|
if (hasHint) {
|
|
99102
99115
|
validateRequiredProperty(
|
|
99103
99116
|
diagnostics,
|
|
99104
|
-
|
|
99117
|
+
diagnosticField,
|
|
99105
99118
|
"mode",
|
|
99106
99119
|
placement.mode,
|
|
99107
99120
|
"string",
|
|
@@ -99111,75 +99124,58 @@ function normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv) {
|
|
|
99111
99124
|
const hint = placement.hint;
|
|
99112
99125
|
if (hint !== void 0 && typeof hint !== "string") {
|
|
99113
99126
|
diagnostics.errors.push(
|
|
99114
|
-
`"
|
|
99127
|
+
`"${diagnosticField}.hint" must be a string when "${diagnosticField}.mode" is "${mode}"`
|
|
99115
99128
|
);
|
|
99116
99129
|
}
|
|
99117
99130
|
if (hint && mode !== "smart") {
|
|
99118
99131
|
diagnostics.errors.push(
|
|
99119
|
-
`"
|
|
99132
|
+
`"${diagnosticField}.hint" can only be set when "${diagnosticField}.mode" is "smart"`
|
|
99120
99133
|
);
|
|
99121
99134
|
}
|
|
99122
99135
|
} else if (hasTargetedFields) {
|
|
99123
99136
|
validateOptionalProperty(
|
|
99124
99137
|
diagnostics,
|
|
99125
|
-
|
|
99138
|
+
diagnosticField,
|
|
99126
99139
|
"mode",
|
|
99127
99140
|
placement.mode,
|
|
99128
99141
|
"string",
|
|
99129
|
-
["
|
|
99142
|
+
["targeted"]
|
|
99130
99143
|
);
|
|
99131
|
-
|
|
99132
|
-
|
|
99133
|
-
diagnostics,
|
|
99134
|
-
"placement",
|
|
99135
|
-
"region",
|
|
99136
|
-
placement.region,
|
|
99137
|
-
"string"
|
|
99138
|
-
);
|
|
99139
|
-
}
|
|
99140
|
-
if (hasHost) {
|
|
99141
|
-
validateOptionalProperty(
|
|
99144
|
+
for (const field of presentTargetedFields) {
|
|
99145
|
+
validateRequiredProperty(
|
|
99142
99146
|
diagnostics,
|
|
99143
|
-
|
|
99144
|
-
|
|
99145
|
-
placement
|
|
99146
|
-
"string"
|
|
99147
|
-
);
|
|
99148
|
-
}
|
|
99149
|
-
if (hasHostname) {
|
|
99150
|
-
validateOptionalProperty(
|
|
99151
|
-
diagnostics,
|
|
99152
|
-
"placement",
|
|
99153
|
-
"hostname",
|
|
99154
|
-
placement.hostname,
|
|
99147
|
+
diagnosticField,
|
|
99148
|
+
field,
|
|
99149
|
+
placement[field],
|
|
99155
99150
|
"string"
|
|
99156
99151
|
);
|
|
99157
|
-
|
|
99158
|
-
|
|
99159
|
-
|
|
99160
|
-
|
|
99161
|
-
if (hasRegion) {
|
|
99162
|
-
presentFields.push("region");
|
|
99163
|
-
}
|
|
99164
|
-
if (hasHost) {
|
|
99165
|
-
presentFields.push("host");
|
|
99166
|
-
}
|
|
99167
|
-
if (hasHostname) {
|
|
99168
|
-
presentFields.push("hostname");
|
|
99152
|
+
if (placement[field] === "") {
|
|
99153
|
+
diagnostics.errors.push(
|
|
99154
|
+
`"${diagnosticField}.${field}" must be a non-empty string.`
|
|
99155
|
+
);
|
|
99169
99156
|
}
|
|
99157
|
+
}
|
|
99158
|
+
if (presentTargetedFields.length > 1) {
|
|
99170
99159
|
diagnostics.errors.push(
|
|
99171
|
-
`"
|
|
99160
|
+
`"${diagnosticField}" fields ${presentTargetedFields.map((field) => `"${field}"`).join(", ")} are mutually exclusive. Only one can be specified.`
|
|
99172
99161
|
);
|
|
99173
99162
|
}
|
|
99174
99163
|
} else {
|
|
99175
99164
|
validateRequiredProperty(
|
|
99176
99165
|
diagnostics,
|
|
99177
|
-
|
|
99166
|
+
diagnosticField,
|
|
99178
99167
|
"mode",
|
|
99179
99168
|
placement.mode,
|
|
99180
99169
|
"string",
|
|
99181
99170
|
["off", "smart", "targeted"]
|
|
99182
99171
|
);
|
|
99172
|
+
if (placement.mode === "targeted") {
|
|
99173
|
+
validateAtLeastOnePropertyRequired(diagnostics, diagnosticField, [
|
|
99174
|
+
{ key: "region", value: placement.region, type: "string" },
|
|
99175
|
+
{ key: "host", value: placement.host, type: "string" },
|
|
99176
|
+
{ key: "hostname", value: placement.hostname, type: "string" }
|
|
99177
|
+
]);
|
|
99178
|
+
}
|
|
99183
99179
|
}
|
|
99184
99180
|
}
|
|
99185
99181
|
return inheritable(
|
|
@@ -103100,6 +103096,7 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
103100
103096
|
"logpush",
|
|
103101
103097
|
"observability",
|
|
103102
103098
|
"limits",
|
|
103099
|
+
"placement",
|
|
103103
103100
|
"cache"
|
|
103104
103101
|
]) && isValid;
|
|
103105
103102
|
isValid = validateVars(envName)(
|
|
@@ -103114,6 +103111,12 @@ var validatePreviewsConfig = /* @__PURE__ */ __name((envName, configPath) => (di
|
|
|
103114
103111
|
previews.define,
|
|
103115
103112
|
void 0
|
|
103116
103113
|
) && isValid;
|
|
103114
|
+
normalizeAndValidatePlacement(
|
|
103115
|
+
diagnostics,
|
|
103116
|
+
void 0,
|
|
103117
|
+
previews,
|
|
103118
|
+
`${field}.placement`
|
|
103119
|
+
);
|
|
103117
103120
|
isValid = validateBindingsProperty(envName, validateDurableObjectBinding)(
|
|
103118
103121
|
diagnostics,
|
|
103119
103122
|
`${field}.durable_objects`,
|
|
@@ -107692,7 +107695,7 @@ function getWorkerNameFromProject(projectPath) {
|
|
|
107692
107695
|
}
|
|
107693
107696
|
__name(getWorkerNameFromProject, "getWorkerNameFromProject");
|
|
107694
107697
|
function toUrlPath(filePath) {
|
|
107695
|
-
(0,
|
|
107698
|
+
(0, import_node_assert2.default)(
|
|
107696
107699
|
!/^[a-z]:/i.test(filePath),
|
|
107697
107700
|
"Tried to convert a Windows file path with a drive to a URL path."
|
|
107698
107701
|
);
|
|
@@ -112590,7 +112593,7 @@ var Yargs = YargsFactory(esm_default2);
|
|
|
112590
112593
|
var yargs_default = Yargs;
|
|
112591
112594
|
|
|
112592
112595
|
// package.json
|
|
112593
|
-
var version2 = "2.72.
|
|
112596
|
+
var version2 = "2.72.9";
|
|
112594
112597
|
|
|
112595
112598
|
// src/metrics.ts
|
|
112596
112599
|
var import_node_async_hooks = require("node:async_hooks");
|
|
@@ -117803,7 +117806,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
|
|
|
117803
117806
|
var import_node_assert7 = __toESM(require("node:assert"));
|
|
117804
117807
|
|
|
117805
117808
|
// ../wrangler/package.json
|
|
117806
|
-
var version3 = "4.
|
|
117809
|
+
var version3 = "4.133.0";
|
|
117807
117810
|
|
|
117808
117811
|
// src/git.ts
|
|
117809
117812
|
var offerGit = async (ctx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "2.72.
|
|
3
|
+
"version": "2.72.9",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/parser": "^7.21.3",
|
|
32
32
|
"@babel/types": "^7.21.4",
|
|
33
33
|
"@clack/prompts": "^1.2.0",
|
|
34
|
-
"@cloudflare/workers-types": "^5.
|
|
34
|
+
"@cloudflare/workers-types": "^5.20260916.1",
|
|
35
35
|
"@types/command-exists": "^1.2.0",
|
|
36
36
|
"@types/cross-spawn": "^6.0.2",
|
|
37
37
|
"@types/deepmerge": "^2.2.0",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"which-pm-runs": "^1.1.0",
|
|
71
71
|
"wrap-ansi": "^9.0.0",
|
|
72
72
|
"yargs": "^17.7.2",
|
|
73
|
-
"@cloudflare/cli-shared-helpers": "0.1.
|
|
74
|
-
"@cloudflare/shared-ast-primitives": "1.1.0",
|
|
75
|
-
"@cloudflare/vite-plugin": "1.54.10",
|
|
73
|
+
"@cloudflare/cli-shared-helpers": "0.1.32",
|
|
76
74
|
"@cloudflare/mock-npm-registry": "0.0.0",
|
|
75
|
+
"@cloudflare/shared-ast-primitives": "1.1.0",
|
|
76
|
+
"@cloudflare/vite-plugin": "1.54.11",
|
|
77
77
|
"@cloudflare/workers-tsconfig": "0.0.0",
|
|
78
|
-
"@cloudflare/workers-utils": "0.39.
|
|
79
|
-
"wrangler": "4.
|
|
78
|
+
"@cloudflare/workers-utils": "0.39.1",
|
|
79
|
+
"wrangler": "4.133.0"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=22.0.0"
|
|
@@ -37,8 +37,8 @@ export default {
|
|
|
37
37
|
return new Response(
|
|
38
38
|
`Try making requests to:
|
|
39
39
|
<ul>
|
|
40
|
-
<li><code><a href="/redirect
|
|
41
|
-
<li><code><a href="/proxy?modify
|
|
40
|
+
<li><code><a href="/redirect">/redirect</a></code>,</li>
|
|
41
|
+
<li><code><a href="/proxy?modify">/proxy?modify</a></code>, or</li>
|
|
42
42
|
<li><code><a href="/api/todos">/api/todos</a></code></li>`,
|
|
43
43
|
{ headers: { 'Content-Type': 'text/html' } }
|
|
44
44
|
);
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
// Keep the destination fixed to prevent this Worker from becoming an open proxy.
|
|
2
|
+
const PROXY_URL = 'https://example.com/';
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
async fetch(request, env, ctx) {
|
|
3
6
|
const url = new URL(request.url);
|
|
4
7
|
|
|
5
|
-
const
|
|
6
|
-
const modify = url.searchParams.has('modify'); // check if a query param is set (?proxyUrl=...&modify)
|
|
7
|
-
|
|
8
|
-
if (!proxyUrl) {
|
|
9
|
-
return new Response('Bad request: Missing `proxyUrl` query param', { status: 400 });
|
|
10
|
-
}
|
|
8
|
+
const modify = url.searchParams.has('modify'); // check if a query param is set (?modify)
|
|
11
9
|
|
|
12
10
|
// make subrequests with the global `fetch()` function
|
|
13
|
-
let res = await fetch(
|
|
11
|
+
let res = await fetch(PROXY_URL, request);
|
|
14
12
|
|
|
15
13
|
// optionally, modify the respone
|
|
16
14
|
if (modify) {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
// Keep the destination fixed to prevent this Worker from becoming an open redirect.
|
|
2
|
+
const REDIRECT_URL = 'https://example.com/';
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
async fetch(request, env, ctx) {
|
|
3
|
-
const url = new URL(request.url);
|
|
4
|
-
const redirectUrl = url.searchParams.get('redirectUrl'); // get a query param value (?redirectUrl=...)
|
|
5
|
-
|
|
6
|
-
if (!redirectUrl) {
|
|
7
|
-
return new Response('Bad request: Missing `redirectUrl` query param', { status: 400 });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
6
|
// The Response class has static methods to create common Response objects as a convenience
|
|
11
|
-
return Response.redirect(
|
|
7
|
+
return Response.redirect(REDIRECT_URL);
|
|
12
8
|
},
|
|
13
9
|
};
|
|
@@ -40,8 +40,8 @@ export default {
|
|
|
40
40
|
return new Response(
|
|
41
41
|
`Try making requests to:
|
|
42
42
|
<ul>
|
|
43
|
-
<li><code><a href="/redirect
|
|
44
|
-
<li><code><a href="/proxy?modify
|
|
43
|
+
<li><code><a href="/redirect">/redirect</a></code>,</li>
|
|
44
|
+
<li><code><a href="/proxy?modify">/proxy?modify</a></code>, or</li>
|
|
45
45
|
<li><code><a href="/api/todos">/api/todos</a></code></li>`,
|
|
46
46
|
{ headers: { 'Content-Type': 'text/html' } }
|
|
47
47
|
);
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
// Keep the destination fixed to prevent this Worker from becoming an open proxy.
|
|
2
|
+
const PROXY_URL = 'https://example.com/';
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
async fetch(request, env, ctx): Promise<Response> {
|
|
3
6
|
const url = new URL(request.url);
|
|
4
7
|
|
|
5
|
-
const
|
|
6
|
-
const modify = url.searchParams.has('modify'); // check if a query param is set (?proxyUrl=...&modify)
|
|
7
|
-
|
|
8
|
-
if (!proxyUrl) {
|
|
9
|
-
return new Response('Bad request: Missing `proxyUrl` query param', { status: 400 });
|
|
10
|
-
}
|
|
8
|
+
const modify = url.searchParams.has('modify'); // check if a query param is set (?modify)
|
|
11
9
|
|
|
12
10
|
// make subrequests with the global `fetch()` function
|
|
13
|
-
let res = await fetch(
|
|
11
|
+
let res = await fetch(PROXY_URL, request);
|
|
14
12
|
|
|
15
13
|
// optionally, modify the respone
|
|
16
14
|
if (modify) {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
// Keep the destination fixed to prevent this Worker from becoming an open redirect.
|
|
2
|
+
const REDIRECT_URL = 'https://example.com/';
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
async fetch(request, env, ctx): Promise<Response> {
|
|
3
|
-
const url = new URL(request.url);
|
|
4
|
-
const redirectUrl = url.searchParams.get('redirectUrl'); // get a query param value (?redirectUrl=...)
|
|
5
|
-
|
|
6
|
-
if (!redirectUrl) {
|
|
7
|
-
return new Response('Bad request: Missing `redirectUrl` query param', { status: 400 });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
6
|
// The Response class has static methods to create common Response objects as a convenience
|
|
11
|
-
return Response.redirect(
|
|
7
|
+
return Response.redirect(REDIRECT_URL);
|
|
12
8
|
},
|
|
13
9
|
} satisfies ExportedHandler<Env>;
|