@cloudflare/workers-utils 0.26.0 → 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.
- package/dist/browser.d.mts +1 -1
- package/dist/{chunk-27EBTAT2.mjs → chunk-XPMIK7N6.mjs} +16 -4
- package/dist/{config-D5W7gaPI.d.mts → config-CkPlrcrD.d.mts} +0 -9
- package/dist/index.d.mts +107 -4
- package/dist/index.mjs +685 -130
- package/dist/metafile-esm.json +1 -1
- package/dist/open-BCHIM4MY.mjs +607 -0
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +10 -2
- package/package.json +5 -3
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TailConsumer, aK as WorkerMetadata, R as RawConfig } from './config-
|
|
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
|
|
2705
|
+
let dir2, tmp;
|
|
2706
2706
|
let start = options && options.cwd || "";
|
|
2707
|
-
for (
|
|
2707
|
+
for (dir2 of up(start, options)) {
|
|
2708
2708
|
try {
|
|
2709
|
-
tmp = join(
|
|
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 };
|
|
@@ -811,7 +811,6 @@ interface CfWorkerInit {
|
|
|
811
811
|
}
|
|
812
812
|
interface CfWorkerContext {
|
|
813
813
|
env: string | undefined;
|
|
814
|
-
useServiceEnvironments: boolean | undefined;
|
|
815
814
|
zone: string | undefined;
|
|
816
815
|
host: string | undefined;
|
|
817
816
|
routes: Route[] | undefined;
|
|
@@ -1519,7 +1518,6 @@ interface StartDevWorkerInput {
|
|
|
1519
1518
|
};
|
|
1520
1519
|
legacy?: {
|
|
1521
1520
|
site?: Hook<Config["site"], [Config]>;
|
|
1522
|
-
useServiceEnvironments?: boolean;
|
|
1523
1521
|
};
|
|
1524
1522
|
unsafe?: Omit<CfUnsafe, "bindings">;
|
|
1525
1523
|
assets?: string;
|
|
@@ -3213,13 +3211,6 @@ interface ComputedFields {
|
|
|
3213
3211
|
targetEnvironment: string | undefined;
|
|
3214
3212
|
}
|
|
3215
3213
|
interface ConfigFields<Dev extends RawDevConfig> {
|
|
3216
|
-
/**
|
|
3217
|
-
* A boolean to enable "legacy" style wrangler environments (from Wrangler v1).
|
|
3218
|
-
* These have been superseded by Services, but there may be projects that won't
|
|
3219
|
-
* (or can't) use them. If you're using a legacy environment, you can set this
|
|
3220
|
-
* to `true` to enable it.
|
|
3221
|
-
*/
|
|
3222
|
-
legacy_env: boolean;
|
|
3223
3214
|
/**
|
|
3224
3215
|
* Whether Wrangler should send usage metrics to Cloudflare for this project.
|
|
3225
3216
|
*
|
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-
|
|
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-
|
|
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;
|
|
@@ -541,6 +540,8 @@ type VariableNames =
|
|
|
541
540
|
| "WRANGLER_AUTH_URL"
|
|
542
541
|
/** Custom OAuth client ID (usually auto-configured). */
|
|
543
542
|
| "WRANGLER_CLIENT_ID"
|
|
543
|
+
/** Custom OAuth client ID for the `cf` CLI's OAuth app (usually auto-configured). */
|
|
544
|
+
| "CLOUDFLARE_CLIENT_ID"
|
|
544
545
|
/** Custom token URL (usually auto-configured). */
|
|
545
546
|
| "WRANGLER_TOKEN_URL"
|
|
546
547
|
/** Custom token revocation URL (usually auto-configured). */
|
|
@@ -648,6 +649,38 @@ declare function isCompatDate(str: string): str is CompatDate;
|
|
|
648
649
|
*/
|
|
649
650
|
declare function getTodaysCompatDate(): CompatDate;
|
|
650
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
|
+
|
|
651
684
|
/**
|
|
652
685
|
* A short-lived directory. Automatically removed when the process exits, but
|
|
653
686
|
* can be removed earlier by calling `remove()`.
|
|
@@ -753,6 +786,76 @@ type NpmVersionCheckResult = {
|
|
|
753
786
|
*/
|
|
754
787
|
declare function fetchLatestNpmVersion(name: string, version: string): Promise<NpmVersionCheckResult>;
|
|
755
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
|
+
|
|
756
859
|
declare function retryOnAPIFailure<T>(action: () => T | Promise<T>, logger: Logger, backoff?: number, attempts?: number, abortSignal?: AbortSignal): Promise<T>;
|
|
757
860
|
|
|
758
861
|
declare function formatTime(duration: number): string;
|
|
@@ -909,4 +1012,4 @@ declare function getWorkerNameFromProject(projectPath: string): string;
|
|
|
909
1012
|
*/
|
|
910
1013
|
declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
|
|
911
1014
|
|
|
912
|
-
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, getInstalledPackageVersion, getPackagePath, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCompatDate, isDockerfile, isOptionalProperty, isPackageInstalled, 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 };
|