@harlan-zw/nuxt-cloudflare 0.0.6 → 0.0.8

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/wrangler.mjs CHANGED
@@ -5,18 +5,28 @@ const WRANGLER_DIAGNOSTIC_CODES = [
5
5
  "assets-worker-first-pattern-invalid",
6
6
  "compatibility-date-missing",
7
7
  "compatibility-date-invalid",
8
+ "container-durable-object-binding-missing",
9
+ "container-durable-object-not-sqlite",
10
+ "container-instance-type-deprecated",
11
+ "cpu-limit-raised",
8
12
  "durable-object-binding-inactive",
9
13
  "durable-object-lifecycle-mixed",
10
14
  "durable-object-lifecycle-unmanaged",
15
+ "email-binding-unrestricted",
16
+ "environment-binding-missing",
11
17
  "generated-config-has-env",
12
18
  "keep-vars-enabled",
19
+ "legacy-module-binding",
13
20
  "missing-nodejs-compat",
14
21
  "nodejs-compat-version-implicit",
15
22
  "observability-disabled",
23
+ "observability-log-sampling-high",
16
24
  "observability-sampling-implicit",
17
25
  "observability-sampling-out-of-range",
26
+ "observability-trace-sampling-high",
18
27
  "plaintext-secret-var",
19
28
  "preview-urls-public",
29
+ "pipeline-binding-deprecated",
20
30
  "queue-dlq-missing",
21
31
  "queue-retries-above-policy",
22
32
  "queue-retries-out-of-range",
@@ -25,10 +35,13 @@ const WRANGLER_DIAGNOSTIC_CODES = [
25
35
  "source-maps-disabled",
26
36
  "stale-compatibility-date",
27
37
  "traces-disabled",
38
+ "remote-binding-not-enabled",
39
+ "unsafe-hello-world-binding",
28
40
  "version-metadata-missing",
29
41
  "workers-dev-enabled",
30
42
  "workers-dev-implicit",
31
43
  "workers-cache-cross-version-enabled",
44
+ "workers-cache-assets-billable",
32
45
  "workers-cache-policy-implicit",
33
46
  "wrangler-config-shadowed",
34
47
  "wrangler-config-missing",
@@ -60,11 +73,6 @@ function resolveWorkersCachePolicy(policy) {
60
73
  return { enabled: false, cross_version_cache: false };
61
74
  return { enabled: true, cross_version_cache: policy.crossVersion };
62
75
  }
63
- function resolveAuthoredWorkersCache(cache) {
64
- if (!cache)
65
- return resolveWorkersCachePolicy({ _tag: "disabled" });
66
- return { ...cache, cross_version_cache: cache.cross_version_cache ?? false };
67
- }
68
76
  const WRANGLER_BINDING_CATEGORIES = [
69
77
  "data_blobs",
70
78
  "durable_objects",
@@ -98,39 +106,142 @@ const WRANGLER_BINDING_CATEGORIES = [
98
106
  "secrets_store_secrets",
99
107
  "artifacts",
100
108
  "ratelimits",
109
+ "worker_loaders",
110
+ "vpc_services",
111
+ "vpc_networks",
101
112
  "assets",
102
113
  "unsafe_hello_world",
103
114
  "flagship"
104
115
  ];
105
- function addBindingNames(names, value) {
116
+ const WRANGLER_RECORD_BINDING_CATEGORIES = /* @__PURE__ */ new Set([
117
+ "cloudchamber",
118
+ "data_blobs",
119
+ "define",
120
+ "text_blobs",
121
+ "vars",
122
+ "wasm_modules"
123
+ ]);
124
+ const WRANGLER_NON_INHERITED_BINDING_CATEGORIES = [
125
+ "agent_memory",
126
+ "ai",
127
+ "ai_search",
128
+ "ai_search_namespaces",
129
+ "analytics_engine_datasets",
130
+ "artifacts",
131
+ "browser",
132
+ "cloudchamber",
133
+ "containers",
134
+ "d1_databases",
135
+ "data_blobs",
136
+ "define",
137
+ "dispatch_namespaces",
138
+ "durable_objects",
139
+ "flagship",
140
+ "hyperdrive",
141
+ "images",
142
+ "kv_namespaces",
143
+ "logfwdr",
144
+ "media",
145
+ "mtls_certificates",
146
+ "pipelines",
147
+ "queues",
148
+ "r2_buckets",
149
+ "ratelimits",
150
+ "secrets",
151
+ "secrets_store_secrets",
152
+ "send_email",
153
+ "services",
154
+ "stream",
155
+ "streaming_tail_consumers",
156
+ "tail_consumers",
157
+ "text_blobs",
158
+ "unsafe",
159
+ "unsafe_hello_world",
160
+ "vars",
161
+ "vectorize",
162
+ "version_metadata",
163
+ "vpc_networks",
164
+ "vpc_services",
165
+ "wasm_modules",
166
+ "websearch",
167
+ "worker_loaders",
168
+ "workflows"
169
+ ];
170
+ function addBindingNames(names, value, category) {
106
171
  if (Array.isArray(value)) {
107
172
  value.forEach((entry) => {
108
- if (isRecord(entry) && typeof entry.binding === "string")
173
+ if (!isRecord(entry))
174
+ return;
175
+ if (typeof entry.binding === "string")
109
176
  names.add(entry.binding);
177
+ else if (typeof entry.name === "string")
178
+ names.add(entry.name);
179
+ else if (category === "containers" && typeof entry.class_name === "string")
180
+ names.add(entry.class_name);
181
+ else if ((category === "tail_consumers" || category === "streaming_tail_consumers") && typeof entry.service === "string")
182
+ names.add(entry.service);
110
183
  });
111
184
  return;
112
185
  }
113
186
  if (!isRecord(value))
114
187
  return;
115
- if (Array.isArray(value.bindings) && value.bindings.every((binding) => isRecord(binding) && typeof binding.name === "string")) {
116
- value.bindings.forEach((binding) => names.add(binding.name));
188
+ if (Array.isArray(value.bindings)) {
189
+ value.bindings.forEach((binding) => {
190
+ if (isRecord(binding) && typeof binding.name === "string")
191
+ names.add(binding.name);
192
+ });
117
193
  return;
118
194
  }
119
195
  if (typeof value.binding === "string") {
120
196
  names.add(value.binding);
121
197
  return;
122
198
  }
123
- Object.entries(value).forEach(([name, binding]) => {
124
- if (binding !== void 0)
125
- names.add(name);
126
- });
199
+ if (category && WRANGLER_RECORD_BINDING_CATEGORIES.has(category)) {
200
+ Object.entries(value).forEach(([name, binding]) => {
201
+ if (binding !== void 0)
202
+ names.add(name);
203
+ });
204
+ }
127
205
  }
128
206
  function collectBindingNames(config) {
129
207
  const names = new Set(config.secrets?.required ?? []);
130
- WRANGLER_BINDING_CATEGORIES.forEach((category) => addBindingNames(names, config[category]));
208
+ WRANGLER_BINDING_CATEGORIES.forEach((category) => addBindingNames(names, config[category], category));
131
209
  addBindingNames(names, config.queues?.producers);
132
210
  return names;
133
211
  }
212
+ function collectCategoryBindingNames(config, category) {
213
+ if (category === "secrets")
214
+ return new Set(config.secrets?.required ?? []);
215
+ const names = /* @__PURE__ */ new Set();
216
+ if (category === "queues") {
217
+ addBindingNames(names, config.queues?.producers);
218
+ config.queues?.consumers?.forEach((consumer) => {
219
+ if (typeof consumer.queue === "string")
220
+ names.add(consumer.queue);
221
+ });
222
+ } else {
223
+ addBindingNames(names, config[category], category);
224
+ }
225
+ return names;
226
+ }
227
+ function configuredRemoteBindings(config) {
228
+ const bindings = [];
229
+ for (const category of ["ai", "browser", "images"]) {
230
+ const value = config[category];
231
+ if (isRecord(value) && typeof value.binding === "string")
232
+ bindings.push({ path: category, value });
233
+ }
234
+ for (const category of ["flagship", "mtls_certificates", "vectorize"]) {
235
+ const value = config[category];
236
+ if (!Array.isArray(value))
237
+ continue;
238
+ value.forEach((entry, index) => {
239
+ if (isRecord(entry) && typeof entry.binding === "string")
240
+ bindings.push({ path: `${category}.${index}`, value: entry });
241
+ });
242
+ }
243
+ return bindings;
244
+ }
134
245
  function applyCloudflareDefaults(config, options = {}) {
135
246
  const root = applyEnvironmentDefaults(config, options);
136
247
  const environments = config.env && Object.fromEntries(
@@ -144,7 +255,8 @@ function applyCloudflareDefaults(config, options = {}) {
144
255
  function applyEnvironmentDefaults(config, options, inherited = {}) {
145
256
  const compatibilityDate = config.compatibility_date ?? inherited.compatibility_date ?? options.compatibilityDate;
146
257
  const compatibilityFlags = unique([...config.compatibility_flags ?? inherited.compatibility_flags ?? [], "nodejs_compat"]);
147
- const cache = options.workersCache ? resolveWorkersCachePolicy(options.workersCache) : resolveAuthoredWorkersCache(config.cache ?? inherited.cache);
258
+ const authoredCache = config.cache ?? inherited.cache;
259
+ const cache = options.workersCache ? resolveWorkersCachePolicy(options.workersCache) : authoredCache ? { ...authoredCache, cross_version_cache: authoredCache.cross_version_cache ?? false } : resolveWorkersCachePolicy({ _tag: "disabled" });
148
260
  const requiredSecrets = unique([...config.secrets?.required ?? [], ...options.requiredSecrets ?? []]);
149
261
  const logs = config.observability?.logs;
150
262
  const inheritedLogs = inherited.observability?.logs;
@@ -170,7 +282,7 @@ function applyEnvironmentDefaults(config, options, inherited = {}) {
170
282
  ...inheritedLogs,
171
283
  ...logs,
172
284
  enabled: logs?.enabled ?? inheritedLogs?.enabled ?? true,
173
- head_sampling_rate: logs?.head_sampling_rate ?? inheritedLogs?.head_sampling_rate ?? options.logsSampleRate ?? 0.1,
285
+ head_sampling_rate: logs?.head_sampling_rate ?? inheritedLogs?.head_sampling_rate ?? options.logsSampleRate ?? 0.01,
174
286
  invocation_logs: logs?.invocation_logs ?? inheritedLogs?.invocation_logs ?? true
175
287
  },
176
288
  traces: {
@@ -188,13 +300,13 @@ function applyEnvironmentDefaults(config, options, inherited = {}) {
188
300
  ...workersDev === void 0 ? {} : { workers_dev: workersDev }
189
301
  };
190
302
  }
191
- function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
303
+ function diagnoseEnvironment(config, prefix, diagnostics, generated, normalized, publicVarNames) {
192
304
  const workerFirst = config.assets?.run_worker_first;
193
305
  if (workerFirst === true) {
194
306
  diagnostics.push({
195
- _tag: "error",
307
+ _tag: "warning",
196
308
  code: "assets-worker-first",
197
- message: "Replace blanket Worker-first routing with false or a narrow route-pattern array.",
309
+ message: "Blanket Worker-first routing invokes the Worker for every asset. Use it only when authentication or response transforms require it.",
198
310
  configPath: `${prefix}assets.run_worker_first`
199
311
  });
200
312
  } else if (Array.isArray(workerFirst)) {
@@ -219,7 +331,9 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
219
331
  }
220
332
  const durableObjectExports = isRecord(config.exports) ? Object.entries(config.exports).filter(([, value]) => isRecord(value) && value.type === "durable-object") : [];
221
333
  const migrations = Array.isArray(config.migrations) ? config.migrations : [];
222
- if (durableObjectExports.length > 0 && migrations.length > 0) {
334
+ const hasExports = normalized ? durableObjectExports.length > 0 : Object.hasOwn(config, "exports");
335
+ const hasMigrations = normalized ? migrations.length > 0 : Object.hasOwn(config, "migrations");
336
+ if (hasExports && hasMigrations) {
223
337
  diagnostics.push({
224
338
  _tag: "error",
225
339
  code: "durable-object-lifecycle-mixed",
@@ -235,7 +349,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
235
349
  return [binding.class_name];
236
350
  });
237
351
  const inactiveExportedClassNames = new Set(durableObjectExports.flatMap(([name, value]) => {
238
- if (!isRecord(value) || value.state === void 0 || value.state === "created")
352
+ if (!isRecord(value) || value.state === void 0 || value.state === "created" || value.state === "expecting-transfer")
239
353
  return [];
240
354
  return [name];
241
355
  }));
@@ -243,12 +357,18 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
243
357
  diagnostics.push({
244
358
  _tag: "error",
245
359
  code: "durable-object-binding-inactive",
246
- message: "A Durable Object binding may target only an active declarative export with state created or omitted.",
360
+ message: "A Durable Object binding may target only an active declarative export.",
247
361
  configPath: `${prefix}durable_objects.bindings`
248
362
  });
249
363
  }
250
364
  const exportedClassNames = new Set(durableObjectExports.map(([name]) => name));
365
+ const exportedClassStorage = new Map(durableObjectExports.flatMap(([name, value]) => {
366
+ if (!isRecord(value) || value.storage !== "sqlite" && value.storage !== "legacy-kv")
367
+ return [];
368
+ return [[name, value.storage]];
369
+ }));
251
370
  const migratedClassNames = /* @__PURE__ */ new Set();
371
+ const migratedClassStorage = /* @__PURE__ */ new Map();
252
372
  for (const migration of migrations) {
253
373
  if (!isRecord(migration))
254
374
  continue;
@@ -257,6 +377,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
257
377
  for (const className of migration[key]) {
258
378
  if (typeof className === "string") {
259
379
  migratedClassNames.add(className);
380
+ migratedClassStorage.set(className, key === "new_sqlite_classes" ? "sqlite" : "legacy-kv");
260
381
  }
261
382
  }
262
383
  }
@@ -265,10 +386,16 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
265
386
  for (const rename of migration.renamed_classes) {
266
387
  if (!isRecord(rename))
267
388
  continue;
268
- if (typeof rename.from === "string")
389
+ const storage = typeof rename.from === "string" ? migratedClassStorage.get(rename.from) : void 0;
390
+ if (typeof rename.from === "string") {
269
391
  migratedClassNames.delete(rename.from);
270
- if (typeof rename.to === "string")
392
+ migratedClassStorage.delete(rename.from);
393
+ }
394
+ if (typeof rename.to === "string") {
271
395
  migratedClassNames.add(rename.to);
396
+ if (storage)
397
+ migratedClassStorage.set(rename.to, storage);
398
+ }
272
399
  }
273
400
  }
274
401
  if (Array.isArray(migration.transferred_classes)) {
@@ -281,6 +408,7 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
281
408
  for (const className of migration.deleted_classes) {
282
409
  if (typeof className === "string") {
283
410
  migratedClassNames.delete(className);
411
+ migratedClassStorage.delete(className);
284
412
  }
285
413
  }
286
414
  }
@@ -293,6 +421,91 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
293
421
  configPath: `${prefix}durable_objects.bindings`
294
422
  });
295
423
  }
424
+ for (const [index, container] of (config.containers ?? []).entries()) {
425
+ if (typeof container.class_name !== "string")
426
+ continue;
427
+ const configPath = `${prefix}containers.${index}.class_name`;
428
+ if (!localClassNames.includes(container.class_name)) {
429
+ diagnostics.push({
430
+ _tag: "error",
431
+ code: "container-durable-object-binding-missing",
432
+ message: `Container class ${container.class_name} needs a matching local Durable Object binding.`,
433
+ configPath
434
+ });
435
+ } else if (exportedClassStorage.get(container.class_name) === "legacy-kv" || migratedClassStorage.get(container.class_name) === "legacy-kv") {
436
+ diagnostics.push({
437
+ _tag: "error",
438
+ code: "container-durable-object-not-sqlite",
439
+ message: `Container class ${container.class_name} needs SQLite Durable Object storage.`,
440
+ configPath
441
+ });
442
+ }
443
+ if (container.instance_type === "dev" || container.instance_type === "standard") {
444
+ diagnostics.push({
445
+ _tag: "warning",
446
+ code: "container-instance-type-deprecated",
447
+ message: `Container instance type ${container.instance_type} is deprecated. Choose a current instance type.`,
448
+ configPath: `${prefix}containers.${index}.instance_type`
449
+ });
450
+ }
451
+ }
452
+ if (!generated) {
453
+ for (const binding of configuredRemoteBindings(config)) {
454
+ if (binding.value.remote === true)
455
+ continue;
456
+ diagnostics.push({
457
+ _tag: "warning",
458
+ code: "remote-binding-not-enabled",
459
+ message: "Set remote to true when local development needs the real Cloudflare service.",
460
+ configPath: `${prefix}${binding.path}.remote`
461
+ });
462
+ }
463
+ }
464
+ if (Array.isArray(config.send_email)) {
465
+ config.send_email.forEach((binding, index) => {
466
+ if (!isRecord(binding))
467
+ return;
468
+ const isRestricted = typeof binding.destination_address === "string" || Array.isArray(binding.allowed_destination_addresses) && binding.allowed_destination_addresses.length > 0 || Array.isArray(binding.allowed_sender_addresses) && binding.allowed_sender_addresses.length > 0;
469
+ if (!isRestricted) {
470
+ diagnostics.push({
471
+ _tag: "warning",
472
+ code: "email-binding-unrestricted",
473
+ message: "Restrict this email binding to approved senders or destinations.",
474
+ configPath: `${prefix}send_email.${index}`
475
+ });
476
+ }
477
+ });
478
+ }
479
+ if (Array.isArray(config.pipelines)) {
480
+ config.pipelines.forEach((binding, index) => {
481
+ if (isRecord(binding) && typeof binding.pipeline === "string") {
482
+ diagnostics.push({
483
+ _tag: "warning",
484
+ code: "pipeline-binding-deprecated",
485
+ message: "Replace the deprecated pipeline field with stream.",
486
+ configPath: `${prefix}pipelines.${index}.pipeline`
487
+ });
488
+ }
489
+ });
490
+ }
491
+ for (const category of ["data_blobs", "text_blobs", "wasm_modules"]) {
492
+ if (isRecord(config[category]) && Object.keys(config[category]).length > 0) {
493
+ diagnostics.push({
494
+ _tag: "warning",
495
+ code: "legacy-module-binding",
496
+ message: `Replace legacy ${category} bindings with module rules and imports.`,
497
+ configPath: `${prefix}${category}`
498
+ });
499
+ }
500
+ }
501
+ if (Array.isArray(config.unsafe_hello_world) && config.unsafe_hello_world.length > 0) {
502
+ diagnostics.push({
503
+ _tag: "error",
504
+ code: "unsafe-hello-world-binding",
505
+ message: "Remove the explanatory unsafe_hello_world binding.",
506
+ configPath: `${prefix}unsafe_hello_world`
507
+ });
508
+ }
296
509
  const requiredSecrets = new Set(config.secrets?.required ?? []);
297
510
  for (const name of Object.keys(config.vars ?? {})) {
298
511
  const configPath = `${prefix}vars.${name}`;
@@ -315,6 +528,9 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
315
528
  }
316
529
  }
317
530
  const consumers = config.queues?.consumers ?? [];
531
+ const deadLetterQueues = new Set(consumers.flatMap((consumer) => {
532
+ return typeof consumer.dead_letter_queue === "string" && consumer.dead_letter_queue.length > 0 ? [consumer.dead_letter_queue] : [];
533
+ }));
318
534
  consumers.forEach((consumer, index) => {
319
535
  const retries = consumer.max_retries;
320
536
  const retryDelay = consumer.retry_delay;
@@ -329,11 +545,12 @@ function diagnoseEnvironment(config, prefix, diagnostics, publicVarNames) {
329
545
  diagnostics.push({
330
546
  _tag: "warning",
331
547
  code: "queue-retries-above-policy",
332
- message: `Queue consumer retries ${retries} times, above Cloudflare's default of 3. Verify the work is replay-safe.`,
548
+ message: `Queue consumer retries ${retries} times, above Cloudflare's default of 3. Each retry adds a billed read operation.`,
333
549
  configPath: `${prefix}queues.consumers.${index}.max_retries`
334
550
  });
335
551
  }
336
- if (typeof consumer.dead_letter_queue !== "string" || consumer.dead_letter_queue.length === 0) {
552
+ const drainsDeadLetterQueue = typeof consumer.queue === "string" && deadLetterQueues.has(consumer.queue);
553
+ if (!drainsDeadLetterQueue && (typeof consumer.dead_letter_queue !== "string" || consumer.dead_letter_queue.length === 0)) {
337
554
  diagnostics.push({
338
555
  _tag: "warning",
339
556
  code: "queue-dlq-missing",
@@ -435,6 +652,24 @@ function diagnosePolicy(config, prefix, diagnostics, options, publicVarNames) {
435
652
  configPath: `${prefix}observability`
436
653
  });
437
654
  }
655
+ const logsSampleRate = config.observability.logs?.head_sampling_rate;
656
+ if (logsEnabled && logsSampleRate !== void 0 && logsSampleRate > 0.01 && logsSampleRate <= 1) {
657
+ diagnostics.push({
658
+ _tag: "warning",
659
+ code: "observability-log-sampling-high",
660
+ message: "Log sampling exceeds the 1% routine budget and can create significant metered event volume.",
661
+ configPath: `${prefix}observability.logs.head_sampling_rate`
662
+ });
663
+ }
664
+ const tracesSampleRate = config.observability.traces?.head_sampling_rate;
665
+ if (tracesEnabled && tracesSampleRate !== void 0 && tracesSampleRate > 0.01 && tracesSampleRate <= 1) {
666
+ diagnostics.push({
667
+ _tag: "warning",
668
+ code: "observability-trace-sampling-high",
669
+ message: "Trace sampling exceeds the 1% routine budget; each captured span is a metered event.",
670
+ configPath: `${prefix}observability.traces.head_sampling_rate`
671
+ });
672
+ }
438
673
  }
439
674
  if (config.upload_source_maps !== true) {
440
675
  diagnostics.push({
@@ -475,6 +710,22 @@ function diagnosePolicy(config, prefix, diagnostics, options, publicVarNames) {
475
710
  configPath: `${prefix}cache.cross_version_cache`
476
711
  });
477
712
  }
713
+ if (config.cache?.enabled && config.assets !== void 0) {
714
+ diagnostics.push({
715
+ _tag: "warning",
716
+ code: "workers-cache-assets-billable",
717
+ message: "Workers Caching makes cached static asset requests billable. Confirm CPU savings exceed request charges.",
718
+ configPath: `${prefix}cache.enabled`
719
+ });
720
+ }
721
+ if (typeof config.limits?.cpu_ms === "number" && config.limits.cpu_ms > 3e4) {
722
+ diagnostics.push({
723
+ _tag: "warning",
724
+ code: "cpu-limit-raised",
725
+ message: "The CPU limit exceeds Cloudflare's 30-second default and increases runaway-cost exposure.",
726
+ configPath: `${prefix}limits.cpu_ms`
727
+ });
728
+ }
478
729
  if (config.preview_urls === true) {
479
730
  diagnostics.push({
480
731
  _tag: "warning",
@@ -498,7 +749,7 @@ function diagnosePolicy(config, prefix, diagnostics, options, publicVarNames) {
498
749
  configPath: `${prefix}workers_dev`
499
750
  });
500
751
  }
501
- diagnoseEnvironment(config, prefix, diagnostics, publicVarNames);
752
+ diagnoseEnvironment(config, prefix, diagnostics, options.generated, options.normalized, publicVarNames);
502
753
  }
503
754
  function mergeObservability(inherited, environment) {
504
755
  if (!inherited && !environment)
@@ -511,13 +762,15 @@ function mergeObservability(inherited, environment) {
511
762
  };
512
763
  }
513
764
  function resolveEnvironmentPolicy(root, environment) {
765
+ const exports = environment.exports ?? root.exports;
766
+ const migrations = environment.migrations ?? root.migrations;
514
767
  return {
515
768
  ...environment,
516
769
  cache: environment.cache ?? root.cache,
517
770
  compatibility_date: environment.compatibility_date ?? root.compatibility_date,
518
771
  compatibility_flags: environment.compatibility_flags ?? root.compatibility_flags,
519
- exports: environment.exports ?? root.exports,
520
- migrations: environment.migrations ?? root.migrations,
772
+ ...exports === void 0 ? {} : { exports },
773
+ ...migrations === void 0 ? {} : { migrations },
521
774
  observability: mergeObservability(root.observability, environment.observability),
522
775
  placement: environment.placement ?? root.placement,
523
776
  preview_urls: environment.preview_urls ?? root.preview_urls,
@@ -529,6 +782,8 @@ function diagnoseWranglerConfig(config, options = {}) {
529
782
  const diagnostics = [];
530
783
  const diagnosticOptions = {
531
784
  compatibilityMaxAgeDays: options.compatibilityMaxAgeDays ?? 90,
785
+ generated: options.generated ?? false,
786
+ normalized: options.normalized ?? false,
532
787
  now: options.now ?? /* @__PURE__ */ new Date(),
533
788
  requireNodeCompat: options.requireNodeCompat ?? true
534
789
  };
@@ -543,6 +798,19 @@ function diagnoseWranglerConfig(config, options = {}) {
543
798
  const publicVarNames = new Set(options.publicVarNames ?? []);
544
799
  diagnosePolicy(config, "", diagnostics, diagnosticOptions, publicVarNames);
545
800
  for (const [name, environment] of Object.entries(config.env ?? {})) {
801
+ for (const category of WRANGLER_NON_INHERITED_BINDING_CATEGORIES) {
802
+ const rootNames = collectCategoryBindingNames(config, category);
803
+ const environmentNames = collectCategoryBindingNames(environment, category);
804
+ const missingNames = [...rootNames].filter((binding) => !environmentNames.has(binding));
805
+ if (missingNames.length > 0) {
806
+ diagnostics.push({
807
+ _tag: "warning",
808
+ code: "environment-binding-missing",
809
+ message: `Named environments do not inherit ${category}. Add bindings for: ${missingNames.join(", ")}.`,
810
+ configPath: `env.${name}.${category}`
811
+ });
812
+ }
813
+ }
546
814
  diagnosePolicy(
547
815
  resolveEnvironmentPolicy(config, environment),
548
816
  `env.${name}.`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harlan-zw/nuxt-cloudflare",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "description": "Opinionated Cloudflare deployment defaults and diagnostics for Nuxt.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -86,6 +86,7 @@
86
86
  "dependencies": {
87
87
  "@nuxt/kit": "^4.5.2",
88
88
  "citty": "^0.2.2",
89
+ "confbox": "^0.2.4",
89
90
  "consola": "^3.4.2",
90
91
  "h3": "2.0.1-rc.25",
91
92
  "nitropack": "^2.13.4",
@@ -95,7 +96,7 @@
95
96
  "devDependencies": {
96
97
  "@antfu/eslint-config": "^9.3.0",
97
98
  "@arethetypeswrong/cli": "^0.18.5",
98
- "@cloudflare/workers-types": "^5.20260809.1",
99
+ "@cloudflare/workers-types": "^5.20260811.1",
99
100
  "@nuxt/module-builder": "^1.0.2",
100
101
  "@nuxt/schema": "^4.5.2",
101
102
  "@types/node": "^26.1.1",
@@ -104,7 +105,7 @@
104
105
  "typescript": "^5.9.3",
105
106
  "unbuild": "^3.6.1",
106
107
  "vitest": "^4.1.10",
107
- "wrangler": "^4.120.0"
108
+ "wrangler": "^4.120.1"
108
109
  },
109
110
  "scripts": {
110
111
  "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build",
@@ -112,7 +113,7 @@
112
113
  "lint": "eslint .",
113
114
  "lint:fix": "eslint . --fix",
114
115
  "test": "pnpm run build && vitest run && pnpm run test:fixture",
115
- "test:fixture": "nuxt build tests/fixtures/basic && node dist/cli/index.mjs doctor --cwd tests/fixtures/basic",
116
+ "test:fixture": "nuxi prepare tests/fixtures/basic && tsc --noEmit -p tests/fixtures/basic/.nuxt/tsconfig.server.json && nuxt build tests/fixtures/basic && node dist/cli/index.mjs doctor --cwd tests/fixtures/basic",
116
117
  "typecheck": "nuxt typecheck && tsc --noEmit -p tsconfig.check.json",
117
118
  "test:attw": "attw --pack",
118
119
  "test:pack": "rm -rf .pack && pnpm pack --pack-destination .pack && tar -tf .pack/*.tgz"