@cloudflare/workers-utils 0.25.1 → 0.27.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.
@@ -1,4 +1,4 @@
1
- import { T as TailConsumer, aK as WorkerMetadata, R as RawConfig } from './config-B_-PmLum.mjs';
1
+ import { T as TailConsumer, aK as WorkerMetadata, R as RawConfig } from './config-CkPlrcrD.mjs';
2
2
  import { AssetConfig } from '@cloudflare/workers-shared';
3
3
  import { Cloudflare } from 'cloudflare';
4
4
  import 'node:url';
@@ -2702,17 +2702,29 @@ __name(up, "up");
2702
2702
 
2703
2703
  // ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/find.mjs
2704
2704
  function file(name, options) {
2705
- let dir, tmp;
2705
+ let dir2, tmp;
2706
2706
  let start = options && options.cwd || "";
2707
- for (dir of up(start, options)) {
2707
+ for (dir2 of up(start, options)) {
2708
2708
  try {
2709
- tmp = join(dir, name);
2709
+ tmp = join(dir2, name);
2710
2710
  if (statSync(tmp).isFile()) return tmp;
2711
2711
  } catch {
2712
2712
  }
2713
2713
  }
2714
2714
  }
2715
2715
  __name(file, "file");
2716
+ function dir(name, options) {
2717
+ let dir2, tmp;
2718
+ let start = options && options.cwd || "";
2719
+ for (dir2 of up(start, options)) {
2720
+ try {
2721
+ tmp = join(dir2, name);
2722
+ if (statSync(tmp).isDirectory()) return tmp;
2723
+ } catch {
2724
+ }
2725
+ }
2726
+ }
2727
+ __name(dir, "dir");
2716
2728
 
2717
2729
  // ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
2718
2730
  function dedent(templ) {
@@ -3179,4 +3191,4 @@ smol-toml/dist/index.js:
3179
3191
  *)
3180
3192
  */
3181
3193
 
3182
- export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, applyEdits, configFileName, configFormat, createFatalError, dedent, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, indexLocation, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation };
3194
+ export { APIError, CommandLineArgsError, DeprecationError, ENVIRONMENT_TAG_PREFIX, FatalError, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, JsonFriendlyFatalError, MissingConfigError, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, UserError, applyEdits, configFileName, configFormat, createFatalError, dedent, dir, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, indexLocation, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, searchLocation };
@@ -799,10 +799,18 @@ interface CfWorkerInit {
799
799
  } | undefined;
800
800
  observability: Observability | undefined;
801
801
  cache: CacheOptions | undefined;
802
+ /**
803
+ * The list of npm package dependencies collected from the project's package.json.
804
+ * Sent to the API for instrumentation and analytics purposes.
805
+ */
806
+ package_dependencies?: Array<{
807
+ name: string;
808
+ packageJsonVersion: string;
809
+ installedVersion: string;
810
+ }> | undefined;
802
811
  }
803
812
  interface CfWorkerContext {
804
813
  env: string | undefined;
805
- useServiceEnvironments: boolean | undefined;
806
814
  zone: string | undefined;
807
815
  host: string | undefined;
808
816
  routes: Route[] | undefined;
@@ -1107,6 +1115,11 @@ type WorkerMetadataPut = {
1107
1115
  containers?: {
1108
1116
  class_name: string;
1109
1117
  }[];
1118
+ package_dependencies?: Array<{
1119
+ name: string;
1120
+ packageJsonVersion: string;
1121
+ installedVersion: string;
1122
+ }>;
1110
1123
  [key: string]: unknown;
1111
1124
  };
1112
1125
  type WorkerMetadataVersionsPost = WorkerMetadataPut & {
@@ -1505,7 +1518,6 @@ interface StartDevWorkerInput {
1505
1518
  };
1506
1519
  legacy?: {
1507
1520
  site?: Hook<Config["site"], [Config]>;
1508
- useServiceEnvironments?: boolean;
1509
1521
  };
1510
1522
  unsafe?: Omit<CfUnsafe, "bindings">;
1511
1523
  assets?: string;
@@ -3199,13 +3211,6 @@ interface ComputedFields {
3199
3211
  targetEnvironment: string | undefined;
3200
3212
  }
3201
3213
  interface ConfigFields<Dev extends RawDevConfig> {
3202
- /**
3203
- * A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
3204
- * These have been superseded by Services, but there may be projects that won't
3205
- * (or can't) use them. If you're using a legacy environment, you can set this
3206
- * to `true` to enable it.
3207
- */
3208
- legacy_env: boolean;
3209
3214
  /**
3210
3215
  * Whether Wrangler should send usage metrics to Cloudflare for this project.
3211
3216
  *
@@ -3213,6 +3218,24 @@ interface ConfigFields<Dev extends RawDevConfig> {
3213
3218
  * Otherwise, Wrangler will use the user's preference.
3214
3219
  */
3215
3220
  send_metrics: boolean | undefined;
3221
+ /**
3222
+ * Configuration for npm package dependency instrumentation.
3223
+ *
3224
+ * Controls whether Wrangler should collect and send npm package dependency
3225
+ * metadata when deploying or uploading a Worker version.
3226
+ *
3227
+ * When `enabled` is set to `false`, Wrangler will not include
3228
+ * `package_dependencies` in the upload payload. Defaults to enabled when
3229
+ * not specified.
3230
+ *
3231
+ * Note: This is considered build metadata, so managed separately from the
3232
+ * telemetry one and not disabled when
3233
+ * `send_metrics`/`WRANGLER_SEND_METRICS` is set to `false`
3234
+ */
3235
+ dependencies_instrumentation: {
3236
+ /** Whether dependency instrumentation is enabled. Defaults to `true`. */
3237
+ enabled: boolean;
3238
+ } | undefined;
3216
3239
  /**
3217
3240
  * Options to configure the development server that your worker will use.
3218
3241
  *
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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 WorkerMetadataBinding, L as Logger, d as Route } from './config-B_-PmLum.mjs';
2
- export { bK as ApiCredentials, aG as AssetConfigMetadata, A as Assets, aH as AssetsOptions, a$ as AsyncHook, aW as BinaryFile, be as COMPLIANCE_REGION_CONFIG_PUBLIC, bf as COMPLIANCE_REGION_CONFIG_UNKNOWN, y as CacheOptions, X as CfAIBinding, a9 as CfAISearch, a8 as CfAISearchNamespace, aY as CfAccount, ab as CfAgentMemory, an as CfAnalyticsEngineDataset, ad as CfArtifacts, as as CfAssetsBinding, V as CfBrowserBinding, av as CfCapnp, a6 as CfD1Database, a1 as CfDataBlobBindings, aj as CfDevPluginCfg, ao as CfDispatchNamespace, a2 as CfDurableObject, ax as CfDurableObjectMigrations, ay as CfExports, af as CfFlagship, ae as CfHelloWorld, ai as CfHyperdrive, Y as CfImagesBinding, K as CfKvNamespace, aq as CfLogfwdr, ar as CfLogfwdrBinding, ap as CfMTlsCertificate, _ as CfMediaBinding, I as CfModule, H as CfModuleType, at as CfPipeline, az as CfPlacement, a4 as CfQueue, a5 as CfR2Bucket, ah as CfRateLimit, G as CfScriptFormat, ac as CfSecretsStoreSecrets, M as CfSendEmailBindings, ak as CfService, $ as CfStreamBinding, aA as CfTailConsumer, Q as CfTextBlobBindings, aw as CfUnsafe, au as CfUnsafeBinding, aB as CfUserLimits, J as CfVars, a7 as CfVectorize, a0 as CfVersionMetadataBinding, am as CfVpcNetwork, al as CfVpcService, N as CfWasmModuleBindings, aa as CfWebSearch, aD as CfWorkerContext, aC as CfWorkerInit, ag as CfWorkerLoader, aE as CfWorkerSourceMap, a3 as CfWorkflow, n as CloudchamberConfig, bd as ComplianceConfig, f as ConfigFields, w as ConfigModuleRuleType, r as ConfiguredExport, o as ContainerApp, F as ContainerEngine, m as CustomDomainRoute, x as DispatchNamespaceOutbound, z as DockerConfiguration, s as DurableObjectBindings, q as DurableObjectExportStorage, p as DurableObjectMigration, b6 as ENVIRONMENT_TAG_PREFIX, b3 as Entry, k as Environment, u as EnvironmentNonInheritable, aL as ExportsReconciliationEntryBase, aO as ExportsReconciliationErrorDetail, aM as ExportsReconciliationInfo, aP as ExportsReconciliationRename, aS as ExportsReconciliationResult, aQ as ExportsReconciliationTransfer, aR as ExportsReconciliationTransferPending, aN as ExportsReconciliationWarning, c0 as FetchKVGetValueFetcher, bN as FetchListResultFetcher, bO as FetchPagedListResultFetcher, bL as FetchResult, bM as FetchResultFetcher, aV as File, a_ as Hook, aZ as HookValues, b4 as INHERIT_SYMBOL, b8 as JSON_CONFIG_FORMATS, aF as Json, i as LOGGER_LEVELS, aJ as LegacyAssetPaths, b0 as LogLevel, j as LoggerLevel, b1 as NodeJSCompatMode, O as Observability, b7 as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, e as RawDevConfig, g as RawEnvironment, a as RedirectedRawConfig, v as Rule, b5 as SERVICE_TAG_PREFIX, aU as ServiceFetch, aT as ServiceMetadataRes, b2 as StartDevWorkerInput, S as StreamingTailConsumer, T as TailConsumer, aX as Trigger, U as UserLimits, aI as ValidatedAssetsOptions, aK as WorkerMetadata, t as WorkflowBinding, Z as ZoneIdRoute, l as ZoneNameRoute, bZ as addAuthorizationHeader, h as defaultWranglerConfig, bW as extractAccountTag, bV as extractWAFBlockRayId, bQ as fetchInternalBase, b$ as fetchKVGetValueBase, bS as fetchListResultBase, bR as fetchResultBase, bF as getBrowserRenderingHeadfulFromEnv, br as getBuildConditionsFromEnv, bs as getBuildPlatformFromEnv, b9 as getC3CommandFromEnv, bp as getCIGeneratePreviewAlias, bm as getCIMatchTag, bn as getCIOverrideName, bo as getCIOverrideNetworkModeHost, bG as getCfFetchEnabledFromEnv, bH as getCfFetchPathFromEnv, bh as getCloudflareApiBaseUrl, bc as getCloudflareApiEnvironmentFromEnv, bg as getCloudflareComplianceRegion, bC as getCloudflareEnv, by as getCloudflareIncludeProcessEnvFromEnv, bx as getCloudflareLoadDevVarsFromDotEnv, bJ as getCloudflaredPathFromEnv, bi as getComplianceRegionSubdomain, bu as getD1ExtraLocationChoices, bA as getDisableConfigWatching, bv as getDockerPath, bE as getLocalExplorerEnabledFromEnv, bD as getOpenNextDeployFromEnv, bk as getOutputFileDirectoryFromEnv, bl as getOutputFilePathFromEnv, bt as getRegistryPath, bj as getSanitizeLogs, bw as getSubdomainMixedStateCheckDisabled, bz as getTraceHeader, bq as getWorkersCIBranchName, bI as getWranglerCacheDirFromEnv, bB as getWranglerHideBanner, bb as getWranglerSendErrorReportsFromEnv, ba as getWranglerSendMetricsFromEnv, c1 as hasCursor, bX as hasMorePages, bU as isWAFBlockResponse, c2 as maybeAddTraceHeader, bP as performApiFetchBase, bY as renderError, b_ as throwFetchError, bT as truncate } from './config-B_-PmLum.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 WorkerMetadataBinding, L as Logger, d as Route } from './config-CkPlrcrD.mjs';
2
+ export { bK as ApiCredentials, aG as AssetConfigMetadata, A as Assets, aH as AssetsOptions, a$ as AsyncHook, aW as BinaryFile, be as COMPLIANCE_REGION_CONFIG_PUBLIC, bf as COMPLIANCE_REGION_CONFIG_UNKNOWN, y as CacheOptions, X as CfAIBinding, a9 as CfAISearch, a8 as CfAISearchNamespace, aY as CfAccount, ab as CfAgentMemory, an as CfAnalyticsEngineDataset, ad as CfArtifacts, as as CfAssetsBinding, V as CfBrowserBinding, av as CfCapnp, a6 as CfD1Database, a1 as CfDataBlobBindings, aj as CfDevPluginCfg, ao as CfDispatchNamespace, a2 as CfDurableObject, ax as CfDurableObjectMigrations, ay as CfExports, af as CfFlagship, ae as CfHelloWorld, ai as CfHyperdrive, Y as CfImagesBinding, K as CfKvNamespace, aq as CfLogfwdr, ar as CfLogfwdrBinding, ap as CfMTlsCertificate, _ as CfMediaBinding, I as CfModule, H as CfModuleType, at as CfPipeline, az as CfPlacement, a4 as CfQueue, a5 as CfR2Bucket, ah as CfRateLimit, G as CfScriptFormat, ac as CfSecretsStoreSecrets, M as CfSendEmailBindings, ak as CfService, $ as CfStreamBinding, aA as CfTailConsumer, Q as CfTextBlobBindings, aw as CfUnsafe, au as CfUnsafeBinding, aB as CfUserLimits, J as CfVars, a7 as CfVectorize, a0 as CfVersionMetadataBinding, am as CfVpcNetwork, al as CfVpcService, N as CfWasmModuleBindings, aa as CfWebSearch, aD as CfWorkerContext, aC as CfWorkerInit, ag as CfWorkerLoader, aE as CfWorkerSourceMap, a3 as CfWorkflow, n as CloudchamberConfig, bd as ComplianceConfig, f as ConfigFields, w as ConfigModuleRuleType, r as ConfiguredExport, o as ContainerApp, F as ContainerEngine, m as CustomDomainRoute, x as DispatchNamespaceOutbound, z as DockerConfiguration, s as DurableObjectBindings, q as DurableObjectExportStorage, p as DurableObjectMigration, b6 as ENVIRONMENT_TAG_PREFIX, b3 as Entry, k as Environment, u as EnvironmentNonInheritable, aL as ExportsReconciliationEntryBase, aO as ExportsReconciliationErrorDetail, aM as ExportsReconciliationInfo, aP as ExportsReconciliationRename, aS as ExportsReconciliationResult, aQ as ExportsReconciliationTransfer, aR as ExportsReconciliationTransferPending, aN as ExportsReconciliationWarning, c0 as FetchKVGetValueFetcher, bN as FetchListResultFetcher, bO as FetchPagedListResultFetcher, bL as FetchResult, bM as FetchResultFetcher, aV as File, a_ as Hook, aZ as HookValues, b4 as INHERIT_SYMBOL, b8 as JSON_CONFIG_FORMATS, aF as Json, i as LOGGER_LEVELS, aJ as LegacyAssetPaths, b0 as LogLevel, j as LoggerLevel, b1 as NodeJSCompatMode, O as Observability, b7 as PATH_TO_DEPLOY_CONFIG, P as PreviewsConfig, e as RawDevConfig, g as RawEnvironment, a as RedirectedRawConfig, v as Rule, b5 as SERVICE_TAG_PREFIX, aU as ServiceFetch, aT as ServiceMetadataRes, b2 as StartDevWorkerInput, S as StreamingTailConsumer, T as TailConsumer, aX as Trigger, U as UserLimits, aI as ValidatedAssetsOptions, aK as WorkerMetadata, t as WorkflowBinding, Z as ZoneIdRoute, l as ZoneNameRoute, bZ as addAuthorizationHeader, h as defaultWranglerConfig, bW as extractAccountTag, bV as extractWAFBlockRayId, bQ as fetchInternalBase, b$ as fetchKVGetValueBase, bS as fetchListResultBase, bR as fetchResultBase, bF as getBrowserRenderingHeadfulFromEnv, br as getBuildConditionsFromEnv, bs as getBuildPlatformFromEnv, b9 as getC3CommandFromEnv, bp as getCIGeneratePreviewAlias, bm as getCIMatchTag, bn as getCIOverrideName, bo as getCIOverrideNetworkModeHost, bG as getCfFetchEnabledFromEnv, bH as getCfFetchPathFromEnv, bh as getCloudflareApiBaseUrl, bc as getCloudflareApiEnvironmentFromEnv, bg as getCloudflareComplianceRegion, bC as getCloudflareEnv, by as getCloudflareIncludeProcessEnvFromEnv, bx as getCloudflareLoadDevVarsFromDotEnv, bJ as getCloudflaredPathFromEnv, bi as getComplianceRegionSubdomain, bu as getD1ExtraLocationChoices, bA as getDisableConfigWatching, bv as getDockerPath, bE as getLocalExplorerEnabledFromEnv, bD as getOpenNextDeployFromEnv, bk as getOutputFileDirectoryFromEnv, bl as getOutputFilePathFromEnv, bt as getRegistryPath, bj as getSanitizeLogs, bw as getSubdomainMixedStateCheckDisabled, bz as getTraceHeader, bq as getWorkersCIBranchName, bI as getWranglerCacheDirFromEnv, bB as getWranglerHideBanner, bb as getWranglerSendErrorReportsFromEnv, ba as getWranglerSendMetricsFromEnv, c1 as hasCursor, bX as hasMorePages, bU as isWAFBlockResponse, c2 as maybeAddTraceHeader, bP as performApiFetchBase, bY as renderError, b_ as throwFetchError, bT as truncate } from './config-CkPlrcrD.mjs';
3
3
  import * as jsoncParser from 'jsonc-parser';
4
4
  export { constructWranglerConfig } from './browser.mjs';
5
5
  export { GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath } from './global-wrangler-config-path.mjs';
@@ -102,7 +102,6 @@ declare function getBindingTypeFriendlyName(bindingType: Binding["type"]): strin
102
102
  type NormalizeAndValidateConfigArgs = {
103
103
  name?: string;
104
104
  env?: string;
105
- "legacy-env"?: boolean;
106
105
  "dispatch-namespace"?: string;
107
106
  remote?: boolean;
108
107
  localProtocol?: string;
@@ -309,6 +308,7 @@ declare function parseTOML(tomlContent: string, filePath?: string): unknown;
309
308
  type PackageJSON = {
310
309
  name?: string;
311
310
  version?: string;
311
+ private?: boolean;
312
312
  devDependencies?: Record<string, unknown>;
313
313
  dependencies?: Record<string, unknown>;
314
314
  scripts?: Record<string, unknown>;
@@ -423,6 +423,40 @@ type TypeofType = "string" | "number" | "bigint" | "boolean" | "symbol" | "undef
423
423
 
424
424
  declare function assertNever(_value: never): void;
425
425
 
426
+ /**
427
+ * Resolves the filesystem path for an installed npm package.
428
+ *
429
+ * Tries two strategies:
430
+ * 1. `require.resolve("<pkg>/package.json")` -- works when the package exports its package.json
431
+ * 2. `require.resolve("<pkg>")` -- fallback for packages that don't export package.json
432
+ *
433
+ * @param packageName - The npm package name to resolve
434
+ * @param projectPath - The project directory to resolve from
435
+ * @returns The resolved directory path, or `undefined` if the package is not installed
436
+ */
437
+ declare function getPackagePath(packageName: string, projectPath: string): string | undefined;
438
+ /**
439
+ * Checks whether an npm package is installed in a target project.
440
+ *
441
+ * @param packageName - The name of the target package
442
+ * @param projectPath - The path of the project to check
443
+ * @returns `true` if the package is installed, `false` otherwise
444
+ */
445
+ declare function isPackageInstalled(packageName: string, projectPath: string): boolean;
446
+ /**
447
+ * Gets the exact version of an npm package installed in a project by resolving
448
+ * it from node_modules and reading its package.json.
449
+ *
450
+ * @param packageName - The name of the target package
451
+ * @param projectPath - The path of the project to check
452
+ * @param opts - Options
453
+ * @param opts.stopAtProjectPath - If `true`, stop walking up at the project's path
454
+ * @returns The installed version string, or `undefined` if the package is not installed
455
+ */
456
+ declare function getInstalledPackageVersion(packageName: string, projectPath: string, opts?: {
457
+ stopAtProjectPath?: boolean;
458
+ }): string | undefined;
459
+
426
460
  /**
427
461
  * Maps a set of bindings defined as worker metadata bindings (straight from the Cloudflare API) to bindings defined in the local format.
428
462
  *
@@ -506,6 +540,8 @@ type VariableNames =
506
540
  | "WRANGLER_AUTH_URL"
507
541
  /** Custom OAuth client ID (usually auto-configured). */
508
542
  | "WRANGLER_CLIENT_ID"
543
+ /** Custom OAuth client ID for the `cf` CLI's OAuth app (usually auto-configured). */
544
+ | "CLOUDFLARE_CLIENT_ID"
509
545
  /** Custom token URL (usually auto-configured). */
510
546
  | "WRANGLER_TOKEN_URL"
511
547
  /** Custom token revocation URL (usually auto-configured). */
@@ -613,6 +649,38 @@ declare function isCompatDate(str: string): str is CompatDate;
613
649
  */
614
650
  declare function getTodaysCompatDate(): CompatDate;
615
651
 
652
+ /**
653
+ * A file-backed key/value cache scoped to a consumer's cache directory.
654
+ *
655
+ * The mechanism is generic (JSON blobs keyed by file name); the only
656
+ * consumer-specific input is the logger used for debug output, so the whole
657
+ * bundle is built by {@link createConfigCache}. Wrangler wraps this with its
658
+ * logger singleton in `src/config-cache.ts`; `@cloudflare/workers-auth` builds
659
+ * its own instance with the logger injected into `createWranglerAuth`.
660
+ */
661
+ interface ConfigCache {
662
+ getCacheFolder: () => string;
663
+ getConfigCache: <T>(fileName: string) => Partial<T>;
664
+ saveToConfigCache: <T>(fileName: string, newValues: Partial<T>) => void;
665
+ purgeConfigCaches: () => void;
666
+ }
667
+ interface ConfigCacheOptions {
668
+ /**
669
+ * Namespace for the cache directory, so different Cloudflare CLIs get
670
+ * isolated caches (`<node_modules>/.cache/<namespace>` or
671
+ * `.<namespace>/cache`). Defaults to `"wrangler"` for backward compatibility.
672
+ *
673
+ * `purgeConfigCaches()` deletes the whole cache folder, so a non-default
674
+ * namespace also ensures e.g. `cf login`/`logout` never wipes wrangler's
675
+ * cache.
676
+ */
677
+ namespace?: string;
678
+ }
679
+ /**
680
+ * Build a file-backed config cache bound to the given logger.
681
+ */
682
+ declare function createConfigCache(logger: Logger, options?: ConfigCacheOptions): ConfigCache;
683
+
616
684
  /**
617
685
  * A short-lived directory. Automatically removed when the process exits, but
618
686
  * can be removed earlier by calling `remove()`.
@@ -718,6 +786,76 @@ type NpmVersionCheckResult = {
718
786
  */
719
787
  declare function fetchLatestNpmVersion(name: string, version: string): Promise<NpmVersionCheckResult>;
720
788
 
789
+ /**
790
+ * Returns whether the process can handle interactive input (e.g. hotkeys).
791
+ *
792
+ * A process is considered interactive when **both** conditions are met:
793
+ * - It is **not** running in a Cloudflare CI environment (Pages or Workers CI).
794
+ * - `stdin` and `stdout` are connected to a TTY (not piped from/to another process).
795
+ *
796
+ * Note: generic CI environments (e.g. GitHub Actions) do **not** disable interactivity,
797
+ * because a real PTY may still be attached and hotkeys should still work.
798
+ *
799
+ * Use this for features that require a TTY but should remain functional in generic CI:
800
+ * - Registering hotkeys (e.g. `x` to exit `wrangler dev`)
801
+ * - Enabling raw mode / keypress handling
802
+ * - Showing animated spinners or progress indicators
803
+ * - Reading secrets from an interactive prompt vs stdin
804
+ *
805
+ * Use {@link isNonInteractiveOrCI} instead when user input should be suppressed
806
+ * in **all** CI environments.
807
+ *
808
+ * @returns `true` if the process is interactive, `false` otherwise.
809
+ */
810
+ declare function isInteractive(): boolean;
811
+ /**
812
+ * Returns whether the process should not prompt the user.
813
+ *
814
+ * Returns `true` when the process is non-interactive (no TTY) **or** running
815
+ * in any CI environment (detected via `ci-info`). This is stricter than
816
+ * {@link isInteractive} which only checks for Cloudflare-specific CI,
817
+ * because user prompts should never appear in CI even when a PTY is attached.
818
+ *
819
+ * Use this for anything that should be suppressed or adapted in CI:
820
+ * - User prompts (confirmations, text input, select dialogs)
821
+ * - OAuth login flows
822
+ * - Output format decisions (JSON in CI, pretty when interactive)
823
+ * - Banner / decoration display
824
+ * - Redacting sensitive info (account names, emails) in CI logs
825
+ * - Writing config changes back to disk (e.g. provisioned resource IDs)
826
+ *
827
+ * @returns `true` if the process is non-interactive or running in CI.
828
+ */
829
+ declare function isNonInteractiveOrCI(): boolean;
830
+ /**
831
+ * Whether the process is running in any CI environment (per `ci-info`).
832
+ *
833
+ * Distinct from {@link isNonInteractiveOrCI}: this ignores TTY state, so it is
834
+ * `true` only for genuine CI, not for merely non-interactive contexts (agents,
835
+ * piped commands). Used for behaviour that should key off CI specifically — e.g.
836
+ * redacting account names / emails in public CI logs while still showing them to
837
+ * non-interactive local tooling.
838
+ *
839
+ * Exposed from this package (rather than having consumers `import "ci-info"`
840
+ * directly) so the value flows through the mockable `ci-info` boundary and
841
+ * consumers don't take a fresh, unmockable dependency on it.
842
+ */
843
+ declare function isCI(): boolean;
844
+
845
+ /**
846
+ * Wrapper around the `open` package that gracefully handles environments where
847
+ * a browser opener (e.g. `xdg-open` on Linux) is unavailable. In those cases
848
+ * the URL is printed so the user can copy-paste it manually, rather than
849
+ * crashing with a confusing "file not found" error.
850
+ *
851
+ * The consumer's `logger` is passed in rather than imported: this package is
852
+ * shared across CLIs and has no logger singleton of its own.
853
+ *
854
+ * @param url the URL to point the browser at
855
+ * @param logger the consumer's logger, used to surface the manual-open fallback
856
+ */
857
+ declare function openInBrowser(url: string, logger: Logger): Promise<void>;
858
+
721
859
  declare function retryOnAPIFailure<T>(action: () => T | Promise<T>, logger: Logger, backoff?: number, attempts?: number, abortSignal?: AbortSignal): Promise<T>;
722
860
 
723
861
  declare function formatTime(duration: number): string;
@@ -874,4 +1012,4 @@ declare function getWorkerNameFromProject(projectPath: string): string;
874
1012
  */
875
1013
  declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
876
1014
 
877
- export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, JsonFriendlyFatalError, type Location, Logger, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, RawConfig, type ResolveConfigPathOptions, Route, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, assertNever, bucketFormatMessage, checkWorkerNameValidity, configFileName, configFormat, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCompatDate, isDockerfile, isOptionalProperty, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toValidWorkerName, validatePagesConfig };
1015
+ export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, type ConfigCache, type ConfigCacheOptions, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, JsonFriendlyFatalError, type Location, Logger, type Message, MissingConfigError, type NormalizeAndValidateConfigArgs, NpmPackageManager, type NpmVersionCheckResult, type PackageJSON, type PackageManager, ParseError, type ParseFile, type PartitionedExports, PatchConfigError, PnpmPackageManager, RawConfig, type ResolveConfigPathOptions, Route, type TelemetryMessage, type Tunnel, type TunnelOptions, UserError, WorkerEntrypointExport, WorkerMetadataBinding, YarnPackageManager, assertNever, bucketFormatMessage, checkWorkerNameValidity, configFileName, configFormat, createConfigCache, createFatalError, experimental_patchConfig, experimental_readRawConfig, fetchLatestNpmVersion, findWranglerConfig, formatConfigSnippet, formatTime, friendlyBindingNames, getBindingLocalSupport, getBindingTypeFriendlyName, getBooleanEnvironmentVariableFactory, getDurableObjectExports, getEnvironmentVariableFactory, getHostFromRoute, getHostFromUrl, getInstalledPackageVersion, getPackagePath, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCI, isCompatDate, isDockerfile, isInteractive, isNonInteractiveOrCI, isOptionalProperty, isPackageInstalled, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, openInBrowser, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toValidWorkerName, validatePagesConfig };