create-cloudflare 2.70.13 → 2.70.15

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 CHANGED
@@ -75471,7 +75471,7 @@ function getGlobalWranglerCachePath() {
75471
75471
  }
75472
75472
  __name(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
75473
75473
 
75474
- // ../workers-utils/dist/chunk-Y3JVLYM6.mjs
75474
+ // ../workers-utils/dist/chunk-3K53PSCY.mjs
75475
75475
  init_chunk_Q72B4Q5Z();
75476
75476
  var import_node_fs2 = require("node:fs");
75477
75477
  var import_node_path2 = __toESM(require("node:path"), 1);
@@ -77822,10 +77822,20 @@ var APIError = class extends ParseError {
77822
77822
  * endpoint-specific structured error payloads.
77823
77823
  */
77824
77824
  meta;
77825
- constructor({ status: status2, ...rest }) {
77825
+ /**
77826
+ * Optional number of milliseconds the API asked us to wait before retrying,
77827
+ * derived from the response's `Retry-After` header (if present).
77828
+ */
77829
+ retryAfterMs;
77830
+ constructor({
77831
+ status: status2,
77832
+ retryAfterMs,
77833
+ ...rest
77834
+ }) {
77826
77835
  super(rest);
77827
77836
  this.name = this.constructor.name;
77828
77837
  this.#status = status2;
77838
+ this.retryAfterMs = retryAfterMs;
77829
77839
  }
77830
77840
  get status() {
77831
77841
  return this.#status;
@@ -95068,6 +95078,10 @@ var getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({
95068
95078
  variableName: "X_LOCAL_EXPLORER",
95069
95079
  defaultValue: true
95070
95080
  });
95081
+ var getLocalObservabilityEnabledFromEnv = getBooleanEnvironmentVariableFactory({
95082
+ variableName: "X_LOCAL_OBSERVABILITY",
95083
+ defaultValue: false
95084
+ });
95071
95085
  var getBrowserRenderingHeadfulFromEnv = getBooleanEnvironmentVariableFactory({
95072
95086
  variableName: "X_BROWSER_HEADFUL",
95073
95087
  defaultValue: false
@@ -95590,14 +95604,21 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
95590
95604
  const diagnostics = new Diagnostics(
95591
95605
  `Processing ${configPath ? import_node_path4.default.relative(process.cwd(), configPath) : "wrangler"} configuration:`
95592
95606
  );
95607
+ const isRedirectedConfig2 = isRedirectedRawConfig(
95608
+ rawConfig,
95609
+ configPath,
95610
+ userConfigPath
95611
+ );
95593
95612
  if ("legacy_env" in rawConfig) {
95594
- diagnostics.errors.push(
95595
- dedent`
95596
- The "legacy_env" field is no longer supported, so please remove it from your configuration file.
95597
- Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
95598
- Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
95599
- `
95600
- );
95613
+ if (!isRedirectedConfig2) {
95614
+ diagnostics.errors.push(
95615
+ dedent`
95616
+ The "legacy_env" field is no longer supported, so please remove it from your configuration file.
95617
+ Service environments have been removed, and each environment is now deployed as its own Worker named "<name>-<environment>". This matches the behaviour of "legacy_env = true", which was the default, so removing the field will not change how your Worker is deployed.
95618
+ Refer to https://developers.cloudflare.com/workers/wrangler/environments/ for more information.
95619
+ `
95620
+ );
95621
+ }
95601
95622
  delete rawConfig.legacy_env;
95602
95623
  }
95603
95624
  validateOptionalProperty(
@@ -95673,11 +95694,6 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args,
95673
95694
  isDispatchNamespace,
95674
95695
  preserveOriginalMain
95675
95696
  );
95676
- const isRedirectedConfig2 = isRedirectedRawConfig(
95677
- rawConfig,
95678
- configPath,
95679
- userConfigPath
95680
- );
95681
95697
  const definedEnvironments = Object.keys(rawConfig.env ?? {});
95682
95698
  if (isRedirectedConfig2 && definedEnvironments.length > 0) {
95683
95699
  diagnostics.errors.push(
@@ -98662,12 +98678,47 @@ var validateR2Binding = /* @__PURE__ */ __name((diagnostics, field, value) => {
98662
98678
  if (!isRemoteValid(value, field, diagnostics)) {
98663
98679
  isValid = false;
98664
98680
  }
98681
+ if (hasProperty(value, "local_dev")) {
98682
+ const localDev = value.local_dev;
98683
+ if (typeof localDev !== "object" || localDev === null) {
98684
+ diagnostics.errors.push(
98685
+ `"${field}" bindings should, optionally, have an object "local_dev" field but got ${JSON.stringify(
98686
+ value
98687
+ )}.`
98688
+ );
98689
+ isValid = false;
98690
+ } else {
98691
+ experimental(
98692
+ diagnostics,
98693
+ { local_dev: localDev },
98694
+ "local_dev.experimental_s3_credentials"
98695
+ );
98696
+ if (hasProperty(localDev, "experimental_s3_credentials")) {
98697
+ const credentials = localDev.experimental_s3_credentials;
98698
+ if (typeof credentials !== "object" || credentials === null || !isRequiredProperty(credentials, "accessKeyId", "string") || !isRequiredProperty(credentials, "secretAccessKey", "string")) {
98699
+ diagnostics.errors.push(
98700
+ `"${field}" bindings should, optionally, have a "local_dev.experimental_s3_credentials" field with string "accessKeyId" and "secretAccessKey" fields, but got ${JSON.stringify(
98701
+ value
98702
+ )}.`
98703
+ );
98704
+ isValid = false;
98705
+ }
98706
+ }
98707
+ validateAdditionalProperties(
98708
+ diagnostics,
98709
+ `${field}.local_dev`,
98710
+ Object.keys(localDev),
98711
+ ["experimental_s3_credentials"]
98712
+ );
98713
+ }
98714
+ }
98665
98715
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
98666
98716
  "binding",
98667
98717
  "bucket_name",
98668
98718
  "preview_bucket_name",
98669
98719
  "jurisdiction",
98670
- "remote"
98720
+ "remote",
98721
+ "local_dev"
98671
98722
  ]);
98672
98723
  return isValid;
98673
98724
  }, "validateR2Binding");
@@ -102101,6 +102152,7 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
102101
102152
  logHeaders(response.headers, logger);
102102
102153
  logger.debugWithSanitization?.("RESPONSE:", jsonText);
102103
102154
  logger.debug("-- END CF API RESPONSE");
102155
+ const retryAfterMs = parseRetryAfterMs(response.headers);
102104
102156
  if (!jsonText && (response.status === 204 || response.status === 205)) {
102105
102157
  return {
102106
102158
  response: {
@@ -102109,7 +102161,8 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
102109
102161
  errors: [],
102110
102162
  messages: []
102111
102163
  },
102112
- status: response.status
102164
+ status: response.status,
102165
+ retryAfterMs
102113
102166
  };
102114
102167
  }
102115
102168
  if (isWAFBlockResponse(response.headers)) {
@@ -102118,12 +102171,13 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
102118
102171
  method,
102119
102172
  resource,
102120
102173
  response.status,
102121
- response.statusText
102174
+ response.statusText,
102175
+ retryAfterMs
102122
102176
  );
102123
102177
  }
102124
102178
  try {
102125
102179
  const json2 = parseJSON(jsonText);
102126
- return { response: json2, status: response.status };
102180
+ return { response: json2, status: response.status, retryAfterMs };
102127
102181
  } catch {
102128
102182
  const rayId = extractWAFBlockRayId(response.headers);
102129
102183
  throw new APIError({
@@ -102138,13 +102192,18 @@ async function fetchInternalBase(complianceConfig, resource, init = {}, userAgen
102138
102192
  ...rayId ? [{ text: `Cloudflare Ray ID: ${rayId}` }] : []
102139
102193
  ],
102140
102194
  status: response.status,
102195
+ retryAfterMs,
102141
102196
  telemetryMessage: false
102142
102197
  });
102143
102198
  }
102144
102199
  }
102145
102200
  __name(fetchInternalBase, "fetchInternalBase");
102146
102201
  async function fetchResultBase(complianceConfig, resource, init = {}, userAgent, logger, queryParams, abortSignal, credentials) {
102147
- const { response: json2, status: status2 } = await fetchInternalBase(
102202
+ const {
102203
+ response: json2,
102204
+ status: status2,
102205
+ retryAfterMs
102206
+ } = await fetchInternalBase(
102148
102207
  complianceConfig,
102149
102208
  resource,
102150
102209
  init,
@@ -102157,7 +102216,7 @@ async function fetchResultBase(complianceConfig, resource, init = {}, userAgent,
102157
102216
  if (json2.success) {
102158
102217
  return json2.result;
102159
102218
  } else {
102160
- throwFetchError(resource, json2, status2);
102219
+ throwFetchError(resource, json2, status2, retryAfterMs);
102161
102220
  }
102162
102221
  }
102163
102222
  __name(fetchResultBase, "fetchResultBase");
@@ -102170,7 +102229,11 @@ async function fetchListResultBase(complianceConfig, resource, init = {}, userAg
102170
102229
  queryParams = new import_node_url2.URLSearchParams(queryParams);
102171
102230
  queryParams.set("cursor", cursor);
102172
102231
  }
102173
- const { response: json2, status: status2 } = await fetchInternalBase(
102232
+ const {
102233
+ response: json2,
102234
+ status: status2,
102235
+ retryAfterMs
102236
+ } = await fetchInternalBase(
102174
102237
  complianceConfig,
102175
102238
  resource,
102176
102239
  init,
@@ -102188,7 +102251,7 @@ async function fetchListResultBase(complianceConfig, resource, init = {}, userAg
102188
102251
  getMoreResults = false;
102189
102252
  }
102190
102253
  } else {
102191
- throwFetchError(resource, json2, status2);
102254
+ throwFetchError(resource, json2, status2, retryAfterMs);
102192
102255
  }
102193
102256
  }
102194
102257
  return results;
@@ -102206,6 +102269,24 @@ function isWAFBlockResponse(headers) {
102206
102269
  return headers.get("cf-mitigated") === "challenge";
102207
102270
  }
102208
102271
  __name(isWAFBlockResponse, "isWAFBlockResponse");
102272
+ function parseRetryAfterValue(retryAfter) {
102273
+ if (!retryAfter) {
102274
+ return void 0;
102275
+ }
102276
+ if (/^\d+$/.test(retryAfter.trim())) {
102277
+ return Number(retryAfter) * 1e3;
102278
+ }
102279
+ const retryAfterDate = new Date(retryAfter);
102280
+ if (!Number.isNaN(retryAfterDate.getTime())) {
102281
+ return Math.max(0, retryAfterDate.getTime() - Date.now());
102282
+ }
102283
+ return void 0;
102284
+ }
102285
+ __name(parseRetryAfterValue, "parseRetryAfterValue");
102286
+ function parseRetryAfterMs(headers) {
102287
+ return parseRetryAfterValue(headers.get("Retry-After"));
102288
+ }
102289
+ __name(parseRetryAfterMs, "parseRetryAfterMs");
102209
102290
  function extractWAFBlockRayId(headers) {
102210
102291
  return headers.get("cf-ray") ?? void 0;
102211
102292
  }
@@ -102285,7 +102366,7 @@ function escapeCharacter(character) {
102285
102366
  }).join("");
102286
102367
  }
102287
102368
  __name(escapeCharacter, "escapeCharacter");
102288
- function throwFetchError(resource, response, status2) {
102369
+ function throwFetchError(resource, response, status2, retryAfterMs) {
102289
102370
  const errors = response.errors ?? [];
102290
102371
  for (const error52 of errors) {
102291
102372
  maybeThrowFriendlyError(error52);
@@ -102303,10 +102384,19 @@ function throwFetchError(resource, response, status2) {
102303
102384
  notes.push({ text: fallbackMessage });
102304
102385
  }
102305
102386
  }
102387
+ if (retryAfterMs !== void 0) {
102388
+ notes.push({
102389
+ text: `The API responded with a "Retry-After" header indicating you should wait ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying.`
102390
+ });
102391
+ }
102306
102392
  const error512 = new APIError({
102307
102393
  text: `A request to the Cloudflare API (${resource}) failed.`,
102308
102394
  notes,
102309
102395
  status: status2,
102396
+ // hoist the parsed `Retry-After` header (if any) so consumers such as
102397
+ // `retryOnAPIFailure()` can back off for the amount of time the API
102398
+ // asked us to wait, e.g. when rate limited (HTTP 429).
102399
+ retryAfterMs,
102310
102400
  telemetryMessage: false
102311
102401
  });
102312
102402
  const code = errors[0]?.code;
@@ -102321,7 +102411,7 @@ function throwFetchError(resource, response, status2) {
102321
102411
  throw error512;
102322
102412
  }
102323
102413
  __name(throwFetchError, "throwFetchError");
102324
- function throwWAFBlockError(headers, method, resource, status2, statusText) {
102414
+ function throwWAFBlockError(headers, method, resource, status2, statusText, retryAfterMs) {
102325
102415
  const rayId = extractWAFBlockRayId(headers);
102326
102416
  throw new APIError({
102327
102417
  text: "The Cloudflare API responded with a WAF block page instead of the expected JSON response",
@@ -102338,6 +102428,7 @@ function throwWAFBlockError(headers, method, resource, status2, statusText) {
102338
102428
  }
102339
102429
  ],
102340
102430
  status: status2,
102431
+ retryAfterMs,
102341
102432
  telemetryMessage: false
102342
102433
  });
102343
102434
  }
@@ -102436,24 +102527,42 @@ ${url2}`
102436
102527
  }
102437
102528
  __name(handleBrowserOpenError, "handleBrowserOpenError");
102438
102529
  var MAX_ATTEMPTS = 3;
102530
+ var MAX_RETRY_AFTER_MS = 6e4;
102439
102531
  async function retryOnAPIFailure(action, logger, backoff = 0, attempts = MAX_ATTEMPTS, abortSignal) {
102440
102532
  try {
102441
102533
  return await action();
102442
102534
  } catch (err) {
102443
102535
  if (err instanceof APIError) {
102444
- if (!err.isRetryable()) {
102536
+ if (!err.isRetryable() && err.status !== 429) {
102445
102537
  throw err;
102446
102538
  }
102447
102539
  } else if (err instanceof DOMException && err.name === "TimeoutError") ;
102448
102540
  else if (!(err instanceof TypeError)) {
102449
102541
  throw err;
102450
102542
  }
102451
- logger.debug(`Retrying API call after error...`);
102452
- logger.debug(err);
102543
+ const retryAfterMs = err instanceof APIError ? err.retryAfterMs : void 0;
102544
+ if (retryAfterMs !== void 0 && retryAfterMs > MAX_RETRY_AFTER_MS) {
102545
+ throw err;
102546
+ }
102453
102547
  if (attempts <= 1) {
102454
102548
  throw err;
102455
102549
  }
102456
- await (0, import_promises2.setTimeout)(backoff, void 0, { signal: abortSignal });
102550
+ const jitter = Math.random() * 1e3;
102551
+ let wait = backoff;
102552
+ if (retryAfterMs !== void 0) {
102553
+ wait = retryAfterMs + jitter;
102554
+ } else if (err instanceof APIError && err.status === 429) {
102555
+ wait = Math.max(backoff, 1e3) + jitter;
102556
+ }
102557
+ if (retryAfterMs !== void 0) {
102558
+ logger.info(
102559
+ `Received a "Retry-After" header from the Cloudflare API. Waiting ${Math.ceil(retryAfterMs / 1e3)} second(s) before retrying...`
102560
+ );
102561
+ } else {
102562
+ logger.debug(`Retrying API call after error...`);
102563
+ logger.debug(err);
102564
+ }
102565
+ await (0, import_promises2.setTimeout)(wait, void 0, { signal: abortSignal });
102457
102566
  return retryOnAPIFailure(
102458
102567
  action,
102459
102568
  logger,
@@ -109449,7 +109558,7 @@ var Yargs = YargsFactory(esm_default2);
109449
109558
  var yargs_default = Yargs;
109450
109559
 
109451
109560
  // package.json
109452
- var version2 = "2.70.13";
109561
+ var version2 = "2.70.15";
109453
109562
 
109454
109563
  // src/metrics.ts
109455
109564
  var import_node_async_hooks = require("node:async_hooks");
@@ -110977,7 +111086,7 @@ var hasTsConfig = (path7) => {
110977
111086
  };
110978
111087
 
110979
111088
  // src/helpers/pnpmBuildApprovals.ts
110980
- var APPROVED_BUILDS = ["esbuild", "workerd", "sharp"];
111089
+ var APPROVED_BUILDS = ["esbuild", "workerd"];
110981
111090
  var APPROVED_BUILDS_SET = new Set(APPROVED_BUILDS);
110982
111091
  var writePnpmBuildApprovals = (projectPath) => {
110983
111092
  const { npm: npm24 } = detectPackageManager();
@@ -110997,9 +111106,9 @@ var writePnpmBuildApprovals = (projectPath) => {
110997
111106
  };
110998
111107
  var FRESH_HEADER = [
110999
111108
  "# Pre-approve build scripts for the packages C3 itself installs that need",
111000
- "# them: `workerd` downloads the platform binary, `esbuild` and `sharp`",
111001
- "# (via miniflare) download/build native bindings. Without these, pnpm 11+",
111002
- "# aborts the install with ERR_PNPM_IGNORED_BUILDS."
111109
+ "# them: `workerd` downloads the platform binary and `esbuild` downloads/",
111110
+ "# builds native bindings. Without these, pnpm 11+ aborts the install with",
111111
+ "# ERR_PNPM_IGNORED_BUILDS."
111003
111112
  ];
111004
111113
  var formatEntry = (pkg) => pkg.startsWith("@") ? ` '${pkg}': true` : ` ${pkg}: true`;
111005
111114
  var freshWorkspaceYaml = () => [
@@ -112018,24 +112127,24 @@ __name2(getPropertyName, "getPropertyName");
112018
112127
  var package_default = {
112019
112128
  name: "frameworks_clis_info",
112020
112129
  dependencies: {
112021
- "@angular/create": "22.0.7",
112022
- "@tanstack/cli": "0.69.5",
112023
- "create-analog": "2.6.3",
112130
+ "@angular/create": "22.0.8",
112131
+ "@tanstack/cli": "0.70.1",
112132
+ "create-analog": "2.6.4",
112024
112133
  "create-astro": "5.2.2",
112025
112134
  "create-docusaurus": "3.10.2",
112026
112135
  "create-hono": "0.19.4",
112027
112136
  "create-next-app": "16.2.11",
112028
112137
  "create-qwik": "1.20.0",
112029
- "create-react-router": "8.2.0",
112138
+ "create-react-router": "8.3.0",
112030
112139
  "create-rwsdk": "3.1.3",
112031
- "create-solid": "0.7.0",
112032
- "create-vike": "0.0.662",
112140
+ "create-solid": "0.8.0",
112141
+ "create-vike": "0.0.668",
112033
112142
  "create-vite": "9.1.1",
112034
- "create-vue": "3.22.4",
112143
+ "create-vue": "3.23.0",
112035
112144
  "create-waku": "0.12.5-1.0.0-alpha.10-0",
112036
112145
  gatsby: "5.16.1",
112037
- nuxi: "3.36.1",
112038
- sv: "0.16.3"
112146
+ nuxi: "3.37.0",
112147
+ sv: "0.16.5"
112039
112148
  },
112040
112149
  info: [
112041
112150
  "This package.json is only used to keep track of the frameworks cli dependencies",
@@ -112957,7 +113066,7 @@ var generate14 = async (ctx) => {
112957
113066
  var configure6 = async () => {
112958
113067
  const packages = ["nitro-cloudflare-dev"];
112959
113068
  if (pm === "pnpm") {
112960
- packages.push("h3");
113069
+ packages.push("h3@^1");
112961
113070
  }
112962
113071
  await installPackages2(packages, {
112963
113072
  dev: true,
@@ -113053,7 +113162,7 @@ var generate15 = async (ctx) => {
113053
113162
  var configure7 = async () => {
113054
113163
  const packages = ["nitro-cloudflare-dev", "nitropack"];
113055
113164
  if (pm2 === "pnpm") {
113056
- packages.push("h3");
113165
+ packages.push("h3@^1");
113057
113166
  }
113058
113167
  await installPackages2(packages, {
113059
113168
  dev: true,
@@ -114539,7 +114648,7 @@ If the application uses Durable Objects or Workflows, refer to the relevant best
114539
114648
  var import_node_assert6 = __toESM(require("node:assert"));
114540
114649
 
114541
114650
  // ../wrangler/package.json
114542
- var version3 = "4.113.0";
114651
+ var version3 = "4.115.0";
114543
114652
 
114544
114653
  // src/git.ts
114545
114654
  var offerGit = async (ctx) => {
@@ -114594,16 +114703,24 @@ var gitCommit = async (ctx) => {
114594
114703
  silent: true,
114595
114704
  cwd: ctx.project.path
114596
114705
  });
114706
+ } catch {
114707
+ s.stop(`${brandColor("git")} ${dim(`commit failed`)}`);
114708
+ updateStatus(
114709
+ "Failed to create initial commit. You can commit manually later."
114710
+ );
114711
+ return;
114712
+ }
114713
+ s.stop();
114714
+ try {
114597
114715
  await runCommand(
114598
114716
  ["git", "commit", "-m", ctx.commitMessage, "--no-verify"],
114599
114717
  {
114600
- silent: true,
114601
114718
  cwd: ctx.project.path
114602
114719
  }
114603
114720
  );
114604
- s.stop(`${brandColor("git")} ${dim(`commit`)}`);
114721
+ updateStatus(`${brandColor("git")} ${dim(`commit`)}`);
114605
114722
  } catch {
114606
- s.stop(`${brandColor("git")} ${dim(`commit failed`)}`);
114723
+ updateStatus(`${brandColor("git")} ${dim(`commit failed`)}`);
114607
114724
  updateStatus(
114608
114725
  "Failed to create initial commit. You can commit manually later."
114609
114726
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.70.13",
3
+ "version": "2.70.15",
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.20260721.1",
34
+ "@cloudflare/workers-types": "^5.20260722.1",
35
35
  "@types/command-exists": "^1.2.0",
36
36
  "@types/cross-spawn": "^6.0.2",
37
37
  "@types/deepmerge": "^2.2.0",
@@ -65,19 +65,19 @@
65
65
  "tree-kill": "1.2.2",
66
66
  "typescript": "5.8.3",
67
67
  "undici": "7.28.0",
68
- "vite": "8.0.13",
68
+ "vite": "8.1.5",
69
69
  "vite-tsconfig-paths": "^4.0.8",
70
70
  "vitest": "4.1.0",
71
71
  "which-pm-runs": "^1.1.0",
72
72
  "wrap-ansi": "^9.0.0",
73
73
  "yargs": "^17.7.2",
74
- "@cloudflare/cli-shared-helpers": "0.1.16",
75
- "@cloudflare/mock-npm-registry": "0.0.0",
76
- "@cloudflare/vite-plugin": "1.46.0",
77
74
  "@cloudflare/codemod": "1.1.0",
78
- "@cloudflare/workers-utils": "0.28.0",
79
- "wrangler": "4.113.0",
80
- "@cloudflare/workers-tsconfig": "0.0.0"
75
+ "@cloudflare/cli-shared-helpers": "0.1.17",
76
+ "@cloudflare/mock-npm-registry": "0.0.0",
77
+ "@cloudflare/vite-plugin": "1.48.0",
78
+ "@cloudflare/workers-tsconfig": "0.0.0",
79
+ "@cloudflare/workers-utils": "0.29.0",
80
+ "wrangler": "4.115.0"
81
81
  },
82
82
  "engines": {
83
83
  "node": ">=22.0.0"
@@ -22,13 +22,6 @@ import { WorkflowEntrypoint } from "cloudflare:workers";
22
22
  */
23
23
 
24
24
  export class MyWorkflow extends WorkflowEntrypoint {
25
- /**
26
- * @param {Env} env
27
- */
28
- constructor(env) {
29
- this.env = env;
30
- }
31
-
32
25
  /**
33
26
  * @param {WorkflowEvent<Params>} event
34
27
  * @param {WorkflowStep} step
@@ -33,9 +33,12 @@ const configure = async () => {
33
33
  const packages = ["nitro-cloudflare-dev"];
34
34
 
35
35
  // When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
36
- // Package managers other than pnpm will hoist the dependency, as will pnpm with `--shamefully-hoist`
36
+ // Package managers other than pnpm will hoist the dependency, as will pnpm with `--shamefully-hoist`.
37
+ // Pin to the h3 major used by nitropack — h3's `latest` dist-tag now points at the 2.x release
38
+ // candidates, which are incompatible with the h3 v1 runtime Nuxt/Nitro use and break
39
+ // `event.context.cloudflare` in dev.
37
40
  if (pm === "pnpm") {
38
- packages.push("h3");
41
+ packages.push("h3@^1");
39
42
  }
40
43
 
41
44
  await installPackages(packages, {
@@ -33,9 +33,12 @@ const configure = async () => {
33
33
  const packages = ["nitro-cloudflare-dev", "nitropack"];
34
34
 
35
35
  // When using pnpm, explicitly add h3 package so the H3Event type declaration can be updated.
36
- // Package managers other than pnpm will hoist the dependency, as will pnpm with `--shamefully-hoist`
36
+ // Package managers other than pnpm will hoist the dependency, as will pnpm with `--shamefully-hoist`.
37
+ // Pin to the h3 major used by nitropack — h3's `latest` dist-tag now points at the 2.x release
38
+ // candidates, which are incompatible with the h3 v1 runtime Nuxt/Nitro use and break
39
+ // `event.context.cloudflare` in dev.
37
40
  if (pm === "pnpm") {
38
- packages.push("h3");
41
+ packages.push("h3@^1");
39
42
  }
40
43
 
41
44
  await installPackages(packages, {
@@ -1,42 +0,0 @@
1
- import type { EntryContext } from "react-router";
2
- import { ServerRouter } from "react-router";
3
- import { isbot } from "isbot";
4
- import { renderToReadableStream } from "react-dom/server";
5
-
6
- export default async function handleRequest(
7
- request: Request,
8
- responseStatusCode: number,
9
- responseHeaders: Headers,
10
- routerContext: EntryContext,
11
- ) {
12
- let shellRendered = false;
13
- const userAgent = request.headers.get("user-agent");
14
-
15
- const body = await renderToReadableStream(
16
- <ServerRouter context={routerContext} url={request.url} />,
17
- {
18
- onError(error: unknown) {
19
- responseStatusCode = 500;
20
- // Log streaming rendering errors from inside the shell. Don't log
21
- // errors encountered during initial shell rendering since they'll
22
- // reject and get logged in handleDocumentRequest.
23
- if (shellRendered) {
24
- console.error(error);
25
- }
26
- },
27
- },
28
- );
29
- shellRendered = true;
30
-
31
- // Ensure requests from bots and SPA Mode renders wait for all content to load before responding
32
- // https://react.dev/reference/react-dom/server/renderToPipeableStream#waiting-for-all-content-to-load-for-crawlers-and-static-generation
33
- if ((userAgent && isbot(userAgent)) || routerContext.isSpaMode) {
34
- await body.allReady;
35
- }
36
-
37
- responseHeaders.set("Content-Type", "text/html");
38
- return new Response(body, {
39
- headers: responseHeaders,
40
- status: responseStatusCode,
41
- });
42
- }