@cloudflare/workers-utils 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,16 +1,22 @@
1
- import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as ContainerApp, d as WorkerMetadataBinding, L as Logger, e as Route } from './config-BnUbzrPY.mjs';
2
- export { A as ARTIFACTS_EVENT_TYPES, f as Access, g as ApiCredentials, h as ArtifactsEventTrigger, i as ArtifactsEventType, j as AssetConfigMetadata, k as Assets, l as AssetsOptions, m as AsyncHook, n as BinaryFile, o as COMPLIANCE_REGION_CONFIG_PUBLIC, p as COMPLIANCE_REGION_CONFIG_UNKNOWN, q as CacheOptions, r as CfAIBinding, s as CfAISearch, t as CfAISearchNamespace, u as CfAccount, v as CfAgentMemory, w as CfAnalyticsEngineDataset, x as CfArtifacts, y as CfAssetsBinding, z as CfBrowserBinding, F as CfCapnp, G as CfD1Database, H as CfDataBlobBindings, I as CfDevPluginCfg, J as CfDispatchNamespace, K as CfDurableObject, M as CfDurableObjectMigrations, N as CfExports, O as CfFlagship, P as CfHelloWorld, Q as CfHyperdrive, S as CfImagesBinding, T as CfKvNamespace, U as CfLogfwdr, V as CfLogfwdrBinding, X as CfMTlsCertificate, Y as CfMediaBinding, Z as CfModule, _ as CfModuleType, $ as CfPipeline, a0 as CfPlacement, a1 as CfQueue, a2 as CfR2Bucket, a3 as CfRateLimit, a4 as CfScriptFormat, a5 as CfSecretsStoreSecrets, a6 as CfSendEmailBindings, a7 as CfService, a8 as CfStreamBinding, a9 as CfTailConsumer, aa as CfTextBlobBindings, ab as CfUnsafe, ac as CfUnsafeBinding, ad as CfUserLimits, ae as CfVars, af as CfVectorize, ag as CfVersionMetadataBinding, ah as CfVpcNetwork, ai as CfVpcService, aj as CfWasmModuleBindings, ak as CfWebSearch, al as CfWorkerContext, am as CfWorkerInit, an as CfWorkerLoader, ao as CfWorkerSourceMap, ap as CfWorkflow, aq as CloudchamberConfig, ar as ComplianceConfig, as as ConfigFields, at as ConfigModuleRuleType, au as ConfiguredExport, av as ContainerEngine, aw as CustomDomainRoute, ax as DispatchNamespaceOutbound, ay as DockerConfiguration, az as DurableObjectBindings, aA as DurableObjectExportStorage, aB as DurableObjectMigration, aC as ENVIRONMENT_TAG_PREFIX, aD as Entry, aE as Environment, aF as EnvironmentNonInheritable, aG as ExportsReconciliationEntryBase, aH as ExportsReconciliationErrorDetail, aI as ExportsReconciliationInfo, aJ as ExportsReconciliationRename, aK as ExportsReconciliationResult, aL as ExportsReconciliationTransfer, aM as ExportsReconciliationTransferPending, aN as ExportsReconciliationWarning, aO as FetchKVGetValueFetcher, aP as FetchListResultFetcher, aQ as FetchPagedListResultFetcher, aR as FetchResult, aS as FetchResultFetcher, aT as File, aU as Hook, aV as HookValues, aW as INHERIT_SYMBOL, aX as JSON_CONFIG_FORMATS, aY as Json, aZ as LOGGER_LEVELS, a_ as LegacyAssetPaths, a$ as LocalS3Credentials, b0 as LogLevel, b1 as LoggerLevel, b2 as NodeJSCompatMode, b3 as Observability, b4 as PATH_TO_DEPLOY_CONFIG, b5 as PreviewsConfig, b6 as RawDevConfig, b7 as RawEnvironment, a as RedirectedRawConfig, b8 as Rule, b9 as SERVICE_TAG_PREFIX, ba as ServiceFetch, bb as ServiceMetadataRes, bc as StartDevWorkerInput, bd as StreamingTailConsumer, be as TailConsumer, bf as Trigger, bg as UserLimits, bh as ValidatedAssetsOptions, bi as WorkerMetadata, bj as WorkflowBinding, bk as ZoneIdRoute, bl as ZoneNameRoute, bm as addAuthorizationHeader, bn as defaultWranglerConfig, bo as extractAccountTag, bp as extractWAFBlockRayId, bq as fetchInternalBase, br as fetchKVGetValueBase, bs as fetchListResultBase, bt as fetchResultBase, bu as getBrowserRenderingHeadfulFromEnv, bv as getBuildConditionsFromEnv, bw as getBuildPlatformFromEnv, bx as getC3CommandFromEnv, by as getCIGeneratePreviewAlias, bz as getCIMatchTag, bA as getCIOverrideName, bB as getCIOverrideNetworkModeHost, bC as getCfFetchEnabledFromEnv, bD as getCfFetchPathFromEnv, bE as getCloudflareApiBaseUrl, bF as getCloudflareApiEnvironmentFromEnv, bG as getCloudflareComplianceRegion, bH as getCloudflareEnv, bI as getCloudflareIncludeProcessEnvFromEnv, bJ as getCloudflareLoadDevVarsFromDotEnv, bK as getCloudflaredPathFromEnv, bL as getComplianceRegionSubdomain, bM as getD1ExtraLocationChoices, bN as getDisableConfigWatching, bO as getDockerPath, bP as getLocalExplorerEnabledFromEnv, bQ as getLocalObservabilityEnabledFromEnv, bR as getNoSkillsUpdatePromptsFromEnv, bS as getOpenNextDeployFromEnv, bT as getOutputFileDirectoryFromEnv, bU as getOutputFilePathFromEnv, bV as getRegistryPath, bW as getSanitizeLogs, bX as getSubdomainMixedStateCheckDisabled, bY as getTraceHeader, bZ as getWorkersCIBranchName, b_ as getWranglerCacheDirFromEnv, b$ as getWranglerHideBanner, c0 as getWranglerSendErrorReportsFromEnv, c1 as getWranglerSendMetricsFromEnv, c2 as hasCursor, c3 as hasMorePages, c4 as isDoNotTrackEnabled, c5 as isWAFBlockResponse, c6 as maybeAddTraceHeader, c7 as parseRetryAfterMs, c8 as parseRetryAfterValue, c9 as performApiFetchBase, ca as renderError, cb as throwFetchError, cc as truncate } from './config-BnUbzrPY.mjs';
1
+ import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Exports, D as DurableObjectExport, W as WorkerEntrypointExport, c as ContainerApp, d as WorkerMetadataBinding, e as CfTailConsumer, L as Logger, f as Route } from './compliance-j3-tqeao.mjs';
2
+ export { A as ARTIFACTS_EVENT_TYPES, g as Access, h as ApiCredentials, i as ArtifactsEventTrigger, j as ArtifactsEventType, k as AssetConfigMetadata, l as Assets, m as AssetsOptions, n as AsyncHook, o as BinaryFile, p as COMPLIANCE_REGION_CONFIG_PUBLIC, q as COMPLIANCE_REGION_CONFIG_UNKNOWN, r as CacheOptions, s as CfAIBinding, t as CfAISearch, u as CfAISearchNamespace, v as CfAccount, w as CfAgentMemory, x as CfAnalyticsEngineDataset, y as CfArtifacts, z as CfAssetsBinding, F as CfBrowserBinding, G as CfCapnp, H as CfD1Database, I as CfDataBlobBindings, J as CfDevPluginCfg, K as CfDispatchNamespace, M as CfDurableObject, N as CfDurableObjectMigrations, O as CfExports, P as CfFlagship, Q as CfHelloWorld, S as CfHyperdrive, T as CfImagesBinding, U as CfKvNamespace, V as CfLogfwdr, X as CfLogfwdrBinding, Y as CfMTlsCertificate, Z as CfMediaBinding, _ as CfModule, $ as CfModuleType, a0 as CfPipeline, a1 as CfPlacement, a2 as CfQueue, a3 as CfR2Bucket, a4 as CfRateLimit, a5 as CfScriptFormat, a6 as CfSecretsStoreSecrets, a7 as CfSendEmailBindings, a8 as CfService, a9 as CfStreamBinding, aa as CfTextBlobBindings, ab as CfUnsafe, ac as CfUnsafeBinding, ad as CfUserLimits, ae as CfVars, af as CfVectorize, ag as CfVersionMetadataBinding, ah as CfVpcNetwork, ai as CfVpcService, aj as CfWasmModuleBindings, ak as CfWebSearch, al as CfWorkerContext, am as CfWorkerInit, an as CfWorkerLoader, ao as CfWorkerSourceMap, ap as CfWorkflow, aq as CloudchamberConfig, ar as ComplianceConfig, as as ConfigFields, at as ConfigModuleRuleType, au as ConfiguredExport, av as ContainerEngine, aw as CustomDomainRoute, ax as DispatchNamespaceOutbound, ay as DockerConfiguration, az as DurableObjectBindings, aA as DurableObjectExportStorage, aB as DurableObjectMigration, aC as ENVIRONMENT_TAG_PREFIX, aD as Entry, aE as Environment, aF as EnvironmentNonInheritable, aG as ExportsReconciliationEntryBase, aH as ExportsReconciliationErrorDetail, aI as ExportsReconciliationInfo, aJ as ExportsReconciliationRename, aK as ExportsReconciliationResult, aL as ExportsReconciliationTransfer, aM as ExportsReconciliationTransferPending, aN as ExportsReconciliationWarning, aO as FetchKVGetValueFetcher, aP as FetchListResultFetcher, aQ as FetchPagedListResultFetcher, aR as FetchResult, aS as FetchResultFetcher, aT as File, aU as Hook, aV as HookValues, aW as INHERIT_SYMBOL, aX as JSON_CONFIG_FORMATS, aY as Json, aZ as LOGGER_LEVELS, a_ as LegacyAssetPaths, a$ as LocalS3Credentials, b0 as LogLevel, b1 as LoggerLevel, b2 as NodeJSCompatMode, b3 as Observability, b4 as PATH_TO_DEPLOY_CONFIG, b5 as PreviewsConfig, b6 as RawDevConfig, b7 as RawEnvironment, a as RedirectedRawConfig, b8 as Rule, b9 as SERVICE_TAG_PREFIX, ba as ServiceFetch, bb as ServiceMetadataRes, bc as StartDevWorkerInput, bd as StreamingTailConsumer, be as TailConsumer, bf as Trigger, bg as UserLimits, bh as ValidatedAssetsOptions, bi as WorkerMetadata, bj as WorkflowBinding, bk as ZoneIdRoute, bl as ZoneNameRoute, bm as addAuthorizationHeader, bn as defaultWranglerConfig, bo as extractAccountTag, bp as extractWAFBlockRayId, bq as fetchInternalBase, br as fetchKVGetValueBase, bs as fetchListResultBase, bt as fetchResultBase, bu as getBrowserRenderingHeadfulFromEnv, bv as getBuildConditionsFromEnv, bw as getBuildPlatformFromEnv, bx as getC3CommandFromEnv, by as getCIGeneratePreviewAlias, bz as getCIMatchTag, bA as getCIOverrideName, bB as getCIOverrideNetworkModeHost, bC as getCfFetchEnabledFromEnv, bD as getCfFetchPathFromEnv, bE as getCloudflareApiBaseUrl, bF as getCloudflareApiEnvironmentFromEnv, bG as getCloudflareComplianceRegion, bH as getCloudflareEnv, bI as getCloudflareIncludeProcessEnvFromEnv, bJ as getCloudflareLoadDevVarsFromDotEnv, bK as getCloudflaredPathFromEnv, bL as getComplianceRegionSubdomain, bM as getD1ExtraLocationChoices, bN as getDisableConfigWatching, bO as getLocalExplorerEnabledFromEnv, bP as getLocalObservabilityEnabledFromEnv, bQ as getNoSkillsUpdatePromptsFromEnv, bR as getOpenNextDeployFromEnv, bS as getOutputFileDirectoryFromEnv, bT as getOutputFilePathFromEnv, bU as getRegistryPath, bV as getSanitizeLogs, bW as getSubdomainMixedStateCheckDisabled, bX as getTraceHeader, bY as getWorkersCIBranchName, bZ as getWranglerCacheDirFromEnv, b_ as getWranglerHideBanner, b$ as getWranglerSendErrorReportsFromEnv, c0 as getWranglerSendMetricsFromEnv, c1 as hasCursor, c2 as hasMorePages, c3 as isDoNotTrackEnabled, c4 as isWAFBlockResponse, c5 as maybeAddTraceHeader, c6 as parseRetryAfterMs, c7 as parseRetryAfterValue, c8 as performApiFetchBase, c9 as renderError, ca as throwFetchError, cb as truncate } from './compliance-j3-tqeao.mjs';
3
3
  import * as jsoncParser from 'jsonc-parser';
4
+ import { UserError, TelemetryMessage } from './errors.mjs';
5
+ export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, createFatalError } from './errors.mjs';
4
6
  export { constructWranglerConfig } from './browser.mjs';
5
7
  export { GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath } from './global-wrangler-config-path.mjs';
8
+ import { CompatDate } from './compatibility-date.mjs';
9
+ export { NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, getTodaysCompatDate, isCompatDate, isNodejsCompatDefaultOn, resolveNodejsCompat, stripRedundantNodejsCompatFlags } from './compatibility-date.mjs';
6
10
  export { isDirectory, removeDir, removeDirSync } from './fs-helpers.mjs';
7
11
  export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
8
12
  import { ChildProcess } from 'node:child_process';
9
- import { z } from 'zod';
13
+ export { _forceColour, formatZodError } from './zod-format.mjs';
14
+ export { getDockerPath } from './docker-path.mjs';
10
15
  import 'node:url';
11
16
  import 'undici';
12
17
  import '@cloudflare/workers-shared';
13
18
  import 'cloudflare';
19
+ import 'zod';
14
20
 
15
21
  type ResolveConfigPathOptions = {
16
22
  useRedirectIfAvailable?: boolean;
@@ -219,60 +225,6 @@ patch: RawConfig, isArrayInsertion?: boolean) => string;
219
225
  declare class PatchConfigError extends Error {
220
226
  }
221
227
 
222
- /**
223
- * This is used to provide telemetry with a sanitised error
224
- * message that could not have any user-identifying information.
225
- * Set to `true` to duplicate `message`.
226
- * */
227
- type TelemetryMessage = {
228
- telemetryMessage: string | boolean;
229
- };
230
- type UserErrorOptions = ErrorOptions & TelemetryMessage;
231
- type FatalErrorOptions = UserErrorOptions & {
232
- code?: number;
233
- };
234
- /**
235
- * Base class for errors where the user has done something wrong. These are not
236
- * reported to Sentry. API errors are intentionally *not* `UserError`s, and are
237
- * reported to Sentry. This will help us understand which API errors need better
238
- * messaging.
239
- */
240
- declare class UserError extends Error {
241
- telemetryMessage: string | undefined;
242
- constructor(message: string, options: UserErrorOptions);
243
- }
244
- declare class DeprecationError extends UserError {
245
- constructor(message: string, options: TelemetryMessage);
246
- }
247
- declare class FatalError extends UserError {
248
- readonly code: number | undefined;
249
- constructor(message: string, options: FatalErrorOptions);
250
- }
251
- declare class CommandLineArgsError extends UserError {
252
- }
253
- /**
254
- * JsonFriendlyFatalError is used to output JSON when wrangler crashes, useful for --json mode.
255
- *
256
- * To use, pass stringify'd json into the constructor like so:
257
- * ```js
258
- * throw new JsonFriendlyFatalError(JSON.stringify({ error: messageToDisplay }), {
259
- * telemetryMessage: false,
260
- * });
261
- * ```
262
- */
263
- declare class JsonFriendlyFatalError extends FatalError {
264
- }
265
- declare class MissingConfigError extends Error {
266
- telemetryMessage: string | undefined;
267
- constructor(key: string);
268
- }
269
- /**
270
- * Create either a FatalError or JsonFriendlyFatalError depending upon `isJson` parameter.
271
- *
272
- * If `isJson` is true, then the `message` is JSON stringified.
273
- */
274
- declare function createFatalError(message: unknown, isJson: boolean, options: FatalErrorOptions): Error;
275
-
276
228
  type Message = {
277
229
  text: string;
278
230
  location?: Location;
@@ -400,7 +352,7 @@ declare function parseByteSize(s: string, base?: number | undefined): number;
400
352
 
401
353
  /**
402
354
  * Local-dev capability of each binding type. Source of truth for
403
- * `pickRemoteBindings()` and `warnOrError()`.
355
+ * `pickRemoteBindings()` and `validateBindingRemoteSetting()`.
404
356
  *
405
357
  * - `local-and-remote`: local simulator; `remote: true` opts into proxying.
406
358
  * - `local-only`: local simulator only; `remote: true` is a config error.
@@ -413,6 +365,13 @@ declare function parseByteSize(s: string, base?: number | undefined): number;
413
365
  */
414
366
  type BindingLocalSupport = "local-and-remote" | "local-only" | "remote" | "DO-NOT-USE-this-resource-will-never-have-a-local-simulator";
415
367
  declare function getBindingLocalSupport(type: Binding["type"]): BindingLocalSupport;
368
+ /**
369
+ * Validates the user's `remote` setting for a given binding against the
370
+ * binding type's local-development capabilities. Throws `UserError` for
371
+ * invalid combinations and uses the caller-provided logger for
372
+ * valid-but-noteworthy ones.
373
+ */
374
+ declare function validateBindingRemoteSetting(type: Binding["type"], remote: boolean | undefined, warn: (message: string) => void): void;
416
375
 
417
376
  /**
418
377
  * Pages now supports configuration via a Wrangler configuration file. As opposed to
@@ -506,6 +465,63 @@ declare function getInstalledPackageVersion(packageName: string, projectPath: st
506
465
  */
507
466
  declare function mapWorkerMetadataBindings(bindings: WorkerMetadataBinding[]): RawConfig;
508
467
 
468
+ interface ConvertBindingsOptions {
469
+ /**
470
+ * Use preview IDs (preview_id, preview_bucket_name, preview_database_id) instead of production IDs when resolving a binding ID.
471
+ * This means that the rest of Wrangler does not need to be aware of preview IDs, and can just use regular IDs.
472
+ */
473
+ usePreviewIds?: boolean;
474
+ /**
475
+ * Exclude bindings that Pages doesn't support
476
+ */
477
+ pages?: boolean;
478
+ }
479
+ /**
480
+ * Convert Config to the Record<string, Binding> format for consistent internal use.
481
+ */
482
+ declare function convertConfigToBindings(config: Partial<Pick<Config, ConfigBindingFieldName>>, options?: ConvertBindingsOptions): Record<string, Binding>;
483
+ declare function isUnsafeBindingType(type: string): type is `unsafe_${string}`;
484
+ /**
485
+ * What configuration key does this binding use for referring to it's binding name?
486
+ */
487
+ declare const nameBindings: readonly ["durable_object_namespace", "logfwdr", "ratelimit", "unsafe_ratelimit", "send_email"];
488
+ type FlatBinding<Type> = Extract<Binding, {
489
+ type: Type;
490
+ }> & (Type extends (typeof nameBindings)[number] ? {
491
+ name: string;
492
+ } : {
493
+ binding: string;
494
+ });
495
+ declare function extractBindingsOfType<Type extends Binding["type"]>(type: Type, bindings: Record<string, Binding> | undefined): FlatBinding<Type>[];
496
+ /**
497
+ * Get bindings from a Config object in the standard Record<string, Binding> format.
498
+ */
499
+ declare function getBindings(config: Config | undefined, options?: {
500
+ pages?: boolean;
501
+ }): Record<string, Binding>;
502
+
503
+ type PrintBindingsOptions = {
504
+ log: (message: string) => void;
505
+ tailConsumers?: CfTailConsumer[];
506
+ streamingTailConsumers?: CfTailConsumer[];
507
+ containers?: ContainerApp[];
508
+ registry?: Record<string, {
509
+ debugPortAddress?: string;
510
+ }> | null;
511
+ local?: boolean;
512
+ isMultiWorker?: boolean;
513
+ remoteBindingsDisabled?: boolean;
514
+ name?: string;
515
+ provisioning?: boolean;
516
+ warnIfNoBindings?: boolean;
517
+ unsafeMetadata?: Record<string, unknown>;
518
+ };
519
+ /**
520
+ * Print all the bindings a worker would have access to.
521
+ * Accepts the flat binding record used by StartDevWorkerInput["bindings"].
522
+ */
523
+ declare function printBindings(bindings: Record<string, Binding> | undefined, options: PrintBindingsOptions): void;
524
+
509
525
  /**
510
526
  * Environment variables supported by Wrangler for configuration and authentication.
511
527
  * Each variable is documented with its individual JSDoc comment below.
@@ -675,85 +691,6 @@ declare function getEnvironmentVariableFactory<Choices extends readonly string[]
675
691
  readonly choices?: Choices;
676
692
  }): () => ElementType<Choices>;
677
693
 
678
- type YYYY = `${number}${number}${number}${number}`;
679
- type MM = `${number}${number}`;
680
- type DD = `${number}${number}`;
681
- /**
682
- * Represents a valid compatibility date, a string such as `2025-09-27`
683
- */
684
- type CompatDate = `${YYYY}-${MM}-${DD}`;
685
- /**
686
- * Discern whether a string represents a compatibility date (`YYYY-MM-DD`)
687
- *
688
- * @param str The target string
689
- * @returns true if the string represents a compatibility date, false otherwise
690
- */
691
- declare function isCompatDate(str: string): str is CompatDate;
692
- /**
693
- * Returns today's date as a compatibility date string (`YYYY-MM-DD`).
694
- */
695
- declare function getTodaysCompatDate(): CompatDate;
696
- /**
697
- * The compatibility date on which the `nodejs_compat` and `nodejs_compat_v2`
698
- * compatibility flags became enabled by default in workerd.
699
- *
700
- * From this date onwards, specifying either flag explicitly is a validation
701
- * error ("The compatibility flag nodejs_compat became the default as of
702
- * 2026-08-04 so does not need to be specified anymore"), so tooling must not
703
- * add them to configurations using such a compatibility date.
704
- *
705
- * @see https://github.com/cloudflare/workerd/blob/main/src/workerd/io/compatibility-date.capnp
706
- */
707
- declare const NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
708
- /**
709
- * Whether workerd enables Node.js compatibility by default for the given
710
- * compatibility date, i.e. without the `nodejs_compat` flag being specified.
711
- *
712
- * @param compatibilityDate The compatibility date to check
713
- * @returns true if the date is on or after {@link NODEJS_COMPAT_DEFAULT_ON_DATE}
714
- */
715
- declare function isNodejsCompatDefaultOn(compatibilityDate: string | undefined): boolean;
716
- /**
717
- * The compatibility date on which `nodejs_compat` started implying
718
- * `nodejs_compat_v2`.
719
- */
720
- declare const NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
721
- /**
722
- * Resolves whether workerd will enable the `nodejs_compat` and
723
- * `nodejs_compat_v2` features, mirroring how workerd itself resolves them from
724
- * the compatibility date and flags:
725
- * - Both are enabled by default from {@link NODEJS_COMPAT_DEFAULT_ON_DATE}
726
- * onwards, and each must be turned off separately from that date, with
727
- * `no_nodejs_compat` and `no_nodejs_compat_v2` respectively.
728
- * - Before that date, `nodejs_compat` implies `nodejs_compat_v2` from
729
- * {@link NODEJS_COMPAT_V2_SWITCH_OVER_DATE} onwards.
730
- *
731
- * @param compatibilityDate The compatibility date
732
- * @param compatibilityFlags The compatibility flags
733
- */
734
- declare function resolveNodejsCompat(compatibilityDate: string, compatibilityFlags: string[]): {
735
- isNodejsCompatEnabled: boolean;
736
- isNodejsCompatV2Enabled: boolean;
737
- };
738
- /**
739
- * Removes the `nodejs_compat` and `nodejs_compat_v2` flags from a list of
740
- * compatibility flags when the compatibility date already enables them.
741
- *
742
- * workerd rejects a compatibility flag that its compatibility date enables by
743
- * default, so from {@link NODEJS_COMPAT_DEFAULT_ON_DATE} onwards specifying
744
- * either flag stops a Worker from starting up. Removing them is a no-op for
745
- * such a date, so tooling can accept the redundant flags rather than failing.
746
- *
747
- * A flag is kept when its matching opt-out is specified too, since workerd
748
- * reports those as contradictory and the enable flag wins there - dropping it
749
- * would silently switch Node.js compatibility off instead.
750
- *
751
- * @param compatibilityDate The compatibility date
752
- * @param compatibilityFlags The compatibility flags
753
- * @returns The flags, without the ones the date makes redundant
754
- */
755
- declare function stripRedundantNodejsCompatFlags(compatibilityDate: string | undefined, compatibilityFlags: string[]): string[];
756
-
757
694
  /**
758
695
  * The compatibility date to use when the user has not specified one.
759
696
  *
@@ -1002,6 +939,12 @@ interface OutputEntryBase<T extends string> {
1002
939
  version: number;
1003
940
  type: T;
1004
941
  }
942
+ interface OutputEntryBundleSize {
943
+ /** The uncompressed size of the Worker bundle. */
944
+ raw_bytes: number;
945
+ /** The gzip-compressed size of the Worker bundle. */
946
+ gzip_bytes: number;
947
+ }
1005
948
  /**
1006
949
  * All the different types of entry that can be written to the output file.
1007
950
  */
@@ -1029,6 +972,8 @@ interface OutputEntryDeployment extends OutputEntryBase<"deploy"> {
1029
972
  worker_name_overridden: boolean;
1030
973
  /** wrangler environment used */
1031
974
  wrangler_environment: string | undefined;
975
+ /** Exact Worker bundle sizes in bytes. */
976
+ bundle_size?: OutputEntryBundleSize;
1032
977
  }
1033
978
  interface OutputEntryPreview extends OutputEntryBase<"preview"> {
1034
979
  version: 1;
@@ -1106,6 +1051,8 @@ interface OutputEntryVersionUpload extends OutputEntryBase<"version-upload"> {
1106
1051
  worker_name_overridden: boolean;
1107
1052
  /** wrangler environment used */
1108
1053
  wrangler_environment: string | undefined;
1054
+ /** Exact Worker bundle sizes in bytes. */
1055
+ bundle_size?: OutputEntryBundleSize;
1109
1056
  }
1110
1057
  interface OutputEntryVersionDeployment extends OutputEntryBase<"version-deploy"> {
1111
1058
  version: 1;
@@ -1288,9 +1235,6 @@ declare function getWorkerName(projectOrWorkerName: string | undefined, projectP
1288
1235
  */
1289
1236
  declare function getWorkerNameFromProject(projectPath: string): string;
1290
1237
 
1291
- declare function _forceColour(enabled?: boolean): void;
1292
- declare function formatZodError(error: z.ZodError, input: unknown): string;
1293
-
1294
1238
  type DiscriminatedPath<Discriminator extends string> = string & {
1295
1239
  _discriminator: Discriminator;
1296
1240
  };
@@ -1316,4 +1260,4 @@ declare function toUrlPath(filePath: string): UrlPath;
1316
1260
  */
1317
1261
  declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
1318
1262
 
1319
- export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, type ConfigCache, type ConfigCacheOptions, ContainerApp, DEFAULT_COMPAT_DATE, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, JsonFriendlyFatalError, type Location, Logger, type Message, MissingConfigError, NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, NubPackageManager, type OutputEntry, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, RawConfig, type ResolveConfigPathOptions, Route, type TelemetryMessage, type Tunnel, type TunnelOptions, type UrlPath, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, _forceColour, assertNever, bucketFormatMessage, checkWorkerNameValidity, clearOutputFilePath, configFileName, configFormat, createConfigCache, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, formatZodError, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCI, isCompatDate, isDockerfile, isInteractive, isNodejsCompatDefaultOn, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, openInBrowser, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveNodejsCompat, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, stripRedundantNodejsCompatFlags, sweepStaleWranglerTmpDirs, toUrlPath, toValidWorkerName, validatePagesConfig, writeOutput };
1263
+ export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CfTailConsumer, CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, type ConfigCache, type ConfigCacheOptions, ContainerApp, type ConvertBindingsOptions, DEFAULT_COMPAT_DATE, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, type Location, Logger, type Message, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, NubPackageManager, type OutputEntry, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, type PrintBindingsOptions, RawConfig, type ResolveConfigPathOptions, Route, TelemetryMessage, type Tunnel, type TunnelOptions, type UrlPath, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, assertNever, bucketFormatMessage, checkWorkerNameValidity, clearOutputFilePath, configFileName, configFormat, convertConfigToBindings, createConfigCache, experimental_patchConfig, experimental_readRawConfig, extractBindingsOfType, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBindings, getBooleanEnvironmentVariableFactory, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCI, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRedirectedConfig, isRequiredProperty, isUnsafeBindingType, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, openInBrowser, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, printBindings, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toUrlPath, toValidWorkerName, validateBindingRemoteSetting, validatePagesConfig, writeOutput };