@cloudflare/workers-utils 0.24.0 → 0.25.1
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/browser.mjs +2 -2
- package/dist/{chunk-ULVYGN52.mjs → chunk-27EBTAT2.mjs} +25 -31
- package/dist/{chunk-DCOBXSFB.mjs → chunk-DDRU76YD.mjs} +1 -6
- package/dist/{chunk-J6D57QVQ.mjs → chunk-ELQRF72O.mjs} +1 -1
- package/dist/chunk-OC543JY3.mjs +33 -0
- package/dist/chunk-OTBYAUQ6.mjs +155 -0
- package/dist/{chunk-O4YGOZSW.mjs → chunk-TJ6ANXA2.mjs} +1 -1
- package/dist/{config-8UymS5SL.d.mts → config-B_-PmLum.d.mts} +153 -1
- package/dist/fs-helpers.d.mts +40 -0
- package/dist/fs-helpers.mjs +2 -0
- package/dist/global-wrangler-config-path.d.mts +35 -0
- package/dist/global-wrangler-config-path.mjs +3 -0
- package/dist/index.d.mts +49 -77
- package/dist/index.mjs +675 -845
- package/dist/metafile-esm.json +1 -1
- package/dist/prometheus-metrics.mjs +2 -2
- package/dist/test-helpers/index.d.mts +1 -1
- package/dist/test-helpers/index.mjs +3 -2
- package/package.json +10 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, W as WorkerMetadataBinding, L as Logger,
|
|
2
|
-
export {
|
|
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';
|
|
3
3
|
import * as jsoncParser from 'jsonc-parser';
|
|
4
4
|
export { constructWranglerConfig } from './browser.mjs';
|
|
5
|
+
export { GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath } from './global-wrangler-config-path.mjs';
|
|
6
|
+
export { isDirectory, removeDir, removeDirSync } from './fs-helpers.mjs';
|
|
5
7
|
export { Counter, MetricsRegistry } from './prometheus-metrics.mjs';
|
|
6
8
|
import { ChildProcess } from 'node:child_process';
|
|
7
9
|
import 'node:url';
|
|
@@ -93,10 +95,6 @@ declare const bucketFormatMessage = "Bucket names must begin and end with an alp
|
|
|
93
95
|
* These are the keys used in Wrangler's config file
|
|
94
96
|
*/
|
|
95
97
|
type ConfigBindingFieldName = "data_blobs" | "durable_objects" | "kv_namespaces" | "send_email" | "queues" | "d1_databases" | "vectorize" | "ai_search_namespaces" | "ai_search" | "websearch" | "agent_memory" | "hyperdrive" | "r2_buckets" | "logfwdr" | "services" | "analytics_engine_datasets" | "text_blobs" | "browser" | "ai" | "images" | "stream" | "media" | "version_metadata" | "unsafe" | "vars" | "wasm_modules" | "dispatch_namespaces" | "mtls_certificates" | "workflows" | "pipelines" | "secrets_store_secrets" | "artifacts" | "ratelimits" | "assets" | "unsafe_hello_world" | "flagship" | "worker_loaders" | "vpc_services" | "vpc_networks";
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated new code should use getBindingTypeFriendlyName() instead
|
|
98
|
-
*/
|
|
99
|
-
declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
|
|
100
98
|
/**
|
|
101
99
|
* Get a friendly name for a binding type, handling unsafe bindings
|
|
102
100
|
*/
|
|
@@ -142,6 +140,13 @@ declare function normalizeAndValidateConfig(rawConfig: RawConfig, configPath: st
|
|
|
142
140
|
*/
|
|
143
141
|
declare function isDockerfile(imagePath: string, configPath: string | undefined): boolean;
|
|
144
142
|
|
|
143
|
+
type ExportType = Exports[string]["type"];
|
|
144
|
+
interface PartitionedExports {
|
|
145
|
+
"durable-object": Record<string, DurableObjectExport>;
|
|
146
|
+
worker: Record<string, WorkerEntrypointExport>;
|
|
147
|
+
}
|
|
148
|
+
declare function partitionExports(exports: Exports | undefined): PartitionedExports;
|
|
149
|
+
|
|
145
150
|
type ConfigBindingOptions = Pick<Config, "ai" | "browser" | "d1_databases" | "dispatch_namespaces" | "durable_objects" | "queues" | "r2_buckets" | "services" | "kv_namespaces" | "mtls_certificates" | "vectorize" | "workflows" | "vpc_services">;
|
|
146
151
|
|
|
147
152
|
declare function configFormat(configPath: string | undefined): "json" | "jsonc" | "toml" | "none";
|
|
@@ -163,6 +168,12 @@ declare const experimental_readRawConfig: (args: ReadConfigCommandArgs, options?
|
|
|
163
168
|
redirected: boolean;
|
|
164
169
|
};
|
|
165
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Returns a map of exports that are only of type "durable-object".
|
|
173
|
+
*/
|
|
174
|
+
declare function getDurableObjectExports(exports: Config["exports"] | undefined): Record<string, DurableObjectExport>;
|
|
175
|
+
declare function hasDurableObjectExports(exports: Config["exports"] | undefined): boolean;
|
|
176
|
+
|
|
166
177
|
declare const experimental_patchConfig: (configPath: string,
|
|
167
178
|
/**
|
|
168
179
|
* if you want to add something new, e.g. a binding, you can just provide that {kv_namespace:[{binding:"KV"}]}
|
|
@@ -265,6 +276,14 @@ declare class APIError extends ParseError {
|
|
|
265
276
|
#private;
|
|
266
277
|
code?: number;
|
|
267
278
|
accountTag?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Optional structured metadata hoisted from the first `FetchError.meta`
|
|
281
|
+
* on the v4 response envelope. Consumers can inspect this to render
|
|
282
|
+
* endpoint-specific structured error payloads.
|
|
283
|
+
*/
|
|
284
|
+
meta?: {
|
|
285
|
+
details?: unknown;
|
|
286
|
+
} & Record<string, unknown>;
|
|
268
287
|
constructor({ status, ...rest }: MessageInit & {
|
|
269
288
|
status?: number;
|
|
270
289
|
});
|
|
@@ -293,6 +312,18 @@ type PackageJSON = {
|
|
|
293
312
|
devDependencies?: Record<string, unknown>;
|
|
294
313
|
dependencies?: Record<string, unknown>;
|
|
295
314
|
scripts?: Record<string, unknown>;
|
|
315
|
+
/**
|
|
316
|
+
* NOTE: This is **not** a standard `package.json` field — don't confuse it
|
|
317
|
+
* with the standard `bundledDependencies`. It is a convention introduced by
|
|
318
|
+
* vite+ (https://viteplus.dev): vite+ installs `@voidzero-dev/vite-plus-core`
|
|
319
|
+
* under the `vite` npm alias and records the versions of the tools it bundles
|
|
320
|
+
* here, keyed by package name
|
|
321
|
+
* (e.g. `{ "vite": "8.1.2", "rolldown": "...", "tsdown": "..." }`).
|
|
322
|
+
*
|
|
323
|
+
* We read it to recover the underlying Vite version when Vite is installed via
|
|
324
|
+
* such an alias. It is optional and absent for the vast majority of packages.
|
|
325
|
+
*/
|
|
326
|
+
bundledVersions?: Record<string, string | undefined>;
|
|
296
327
|
};
|
|
297
328
|
/**
|
|
298
329
|
* A typed version of `parseJSON()`.
|
|
@@ -485,6 +516,12 @@ type VariableNames =
|
|
|
485
516
|
| "CLOUDFLARE_ACCESS_CLIENT_ID"
|
|
486
517
|
/** Cloudflare Access Service Token Client Secret. Used with CLOUDFLARE_ACCESS_CLIENT_ID. */
|
|
487
518
|
| "CLOUDFLARE_ACCESS_CLIENT_SECRET"
|
|
519
|
+
/**
|
|
520
|
+
* Store OAuth credentials in the OS keychain instead of a plaintext TOML
|
|
521
|
+
* file. Overrides the persistent `keyring_enabled` preference written by
|
|
522
|
+
* `wrangler login --use-keyring`.
|
|
523
|
+
*/
|
|
524
|
+
| "CLOUDFLARE_AUTH_USE_KEYRING"
|
|
488
525
|
/** Enable the local explorer UI at /cdn-cgi/explorer (experimental, default: false). */
|
|
489
526
|
| "X_LOCAL_EXPLORER"
|
|
490
527
|
/** Open the browser in headful (visible) mode when using the Browser Run API in local dev (default: false). */
|
|
@@ -557,37 +594,6 @@ declare function getEnvironmentVariableFactory<Choices extends readonly string[]
|
|
|
557
594
|
readonly choices?: Choices;
|
|
558
595
|
}): () => ElementType<Choices>;
|
|
559
596
|
|
|
560
|
-
interface GetGlobalConfigPathOptions {
|
|
561
|
-
/**
|
|
562
|
-
* The application namespace. Defaults to `"wrangler"`.
|
|
563
|
-
*/
|
|
564
|
-
appName?: string;
|
|
565
|
-
/**
|
|
566
|
-
* Whether to prepend a `.` to `appName` when resolving the XDG path and the
|
|
567
|
-
* legacy `$HOME` directory. Defaults to `true` to match wrangler's
|
|
568
|
-
* historical behaviour (`.wrangler`).
|
|
569
|
-
*/
|
|
570
|
-
leadingDot?: boolean;
|
|
571
|
-
/**
|
|
572
|
-
* When `true` (the default, matching wrangler's historical behaviour), a
|
|
573
|
-
* pre-existing `~/.<appName>` directory takes precedence over the XDG path.
|
|
574
|
-
* Pass `false` to always use the XDG-compliant path.
|
|
575
|
-
*/
|
|
576
|
-
useLegacyHomeDir?: boolean;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Resolve the global config directory for a Cloudflare CLI.
|
|
580
|
-
*
|
|
581
|
-
* Defaults to wrangler's directory (`.wrangler`) so existing callers are
|
|
582
|
-
* unaffected, but accepts an `appName` so other first-party CLIs (e.g. `cf`)
|
|
583
|
-
* can reuse the same XDG-compliant resolution under their own namespace.
|
|
584
|
-
*/
|
|
585
|
-
declare function getGlobalConfigPath({ appName, leadingDot, useLegacyHomeDir, }?: GetGlobalConfigPathOptions): string;
|
|
586
|
-
/**
|
|
587
|
-
* @deprecated Use {@link getGlobalConfigPath} instead.
|
|
588
|
-
*/
|
|
589
|
-
declare function getGlobalWranglerConfigPath(): string;
|
|
590
|
-
|
|
591
597
|
type YYYY = `${number}${number}${number}${number}`;
|
|
592
598
|
type MM = `${number}${number}`;
|
|
593
599
|
type DD = `${number}${number}`;
|
|
@@ -607,45 +613,6 @@ declare function isCompatDate(str: string): str is CompatDate;
|
|
|
607
613
|
*/
|
|
608
614
|
declare function getTodaysCompatDate(): CompatDate;
|
|
609
615
|
|
|
610
|
-
/**
|
|
611
|
-
* Returns whether the given path is a directory
|
|
612
|
-
*
|
|
613
|
-
* Note: this function never throws; if the path does not exist or is inaccessible, it returns false.
|
|
614
|
-
*
|
|
615
|
-
* @param path The file system path to check
|
|
616
|
-
* @returns `true` if the path is a directory, `false` otherwise
|
|
617
|
-
*/
|
|
618
|
-
declare function isDirectory(path: string): boolean;
|
|
619
|
-
/**
|
|
620
|
-
* Recursively remove a directory without waiting for completion or throwing any errors.
|
|
621
|
-
*
|
|
622
|
-
* @param dirPath The directory path to remove
|
|
623
|
-
* @param options An object with a `fireAndForget` property set to `true`
|
|
624
|
-
* @return `void` - the removal is fire-and-forget with errors suppressed
|
|
625
|
-
*/
|
|
626
|
-
declare function removeDir(dirPath: string, { fireAndForget }: {
|
|
627
|
-
fireAndForget: true;
|
|
628
|
-
}): void;
|
|
629
|
-
/**
|
|
630
|
-
* Recursively remove a directory with retries for Windows compatibility.
|
|
631
|
-
*
|
|
632
|
-
* @param dirPath The directory path to remove
|
|
633
|
-
* @param options An optional object with a `fireAndForget` property set to `false`, if defined
|
|
634
|
-
* @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails
|
|
635
|
-
*/
|
|
636
|
-
declare function removeDir(dirPath: string, options?: {
|
|
637
|
-
fireAndForget?: false;
|
|
638
|
-
}): Promise<void>;
|
|
639
|
-
/**
|
|
640
|
-
* Synchronously and recursively remove a directory, with retries for Windows compatibility.
|
|
641
|
-
*
|
|
642
|
-
* @see {@link removeDir} for the async version and rationale.
|
|
643
|
-
*
|
|
644
|
-
* @param dirPath The directory path to remove
|
|
645
|
-
* @throws If the removal fails after retries, an error will be thrown
|
|
646
|
-
*/
|
|
647
|
-
declare function removeDirSync(dirPath: string): void;
|
|
648
|
-
|
|
649
616
|
/**
|
|
650
617
|
* A short-lived directory. Automatically removed when the process exits, but
|
|
651
618
|
* can be removed earlier by calling `remove()`.
|
|
@@ -902,4 +869,9 @@ declare function getWorkerName(projectOrWorkerName: string | undefined, projectP
|
|
|
902
869
|
*/
|
|
903
870
|
declare function getWorkerNameFromProject(projectPath: string): string;
|
|
904
871
|
|
|
905
|
-
|
|
872
|
+
/**
|
|
873
|
+
* @deprecated new code should use getBindingTypeFriendlyName() instead
|
|
874
|
+
*/
|
|
875
|
+
declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
|
|
876
|
+
|
|
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 };
|