@cloudflare/workers-utils 0.25.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.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { constructWranglerConfig } from './chunk-J6D57QVQ.mjs';
2
- import './chunk-DCOBXSFB.mjs';
1
+ export { constructWranglerConfig } from './chunk-ELQRF72O.mjs';
2
+ import './chunk-DDRU76YD.mjs';
@@ -1,5 +1,5 @@
1
- import { __name } from './chunk-DCOBXSFB.mjs';
2
- import fs, { readFileSync as readFileSync$1, statSync, existsSync } from 'node:fs';
1
+ import { __name } from './chunk-DDRU76YD.mjs';
2
+ import { readFileSync as readFileSync$1, statSync, existsSync } from 'node:fs';
3
3
  import path, { resolve, isAbsolute, dirname, join } from 'node:path';
4
4
 
5
5
  // src/config/exports.ts
@@ -2915,34 +2915,6 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
2915
2915
  redirected
2916
2916
  };
2917
2917
  }, "experimental_readRawConfig");
2918
- function isDirectory(path2) {
2919
- return fs.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
2920
- }
2921
- __name(isDirectory, "isDirectory");
2922
- function removeDir(dirPath, { fireAndForget = false } = {}) {
2923
- const result = fs.promises.rm(dirPath, {
2924
- recursive: true,
2925
- force: true,
2926
- maxRetries: 5,
2927
- retryDelay: 100
2928
- });
2929
- if (fireAndForget) {
2930
- void result.catch(() => {
2931
- });
2932
- } else {
2933
- return result;
2934
- }
2935
- }
2936
- __name(removeDir, "removeDir");
2937
- function removeDirSync(dirPath) {
2938
- fs.rmSync(dirPath, {
2939
- recursive: true,
2940
- force: true,
2941
- maxRetries: 5,
2942
- retryDelay: 100
2943
- });
2944
- }
2945
- __name(removeDirSync, "removeDirSync");
2946
2918
  /*! Bundled license information:
2947
2919
 
2948
2920
  smol-toml/dist/error.js:
@@ -3207,4 +3179,4 @@ smol-toml/dist/index.js:
3207
3179
  *)
3208
3180
  */
3209
3181
 
3210
- 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, isDirectory, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, searchLocation };
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 };
@@ -14,10 +14,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
14
14
  var __commonJS = (cb, mod) => function __require2() {
15
15
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
16
  };
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
17
  var __copyProps = (to, from, except, desc) => {
22
18
  if (from && typeof from === "object" || typeof from === "function") {
23
19
  for (let key of __getOwnPropNames(from))
@@ -26,7 +22,6 @@ var __copyProps = (to, from, except, desc) => {
26
22
  }
27
23
  return to;
28
24
  };
29
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
30
25
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
26
  // If the importer is in node compatibility mode or this is not an ESM
32
27
  // file that has been converted to a CommonJS file using a Babel-
@@ -36,4 +31,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
31
  mod
37
32
  ));
38
33
 
39
- export { __commonJS, __export, __name, __reExport, __require, __toESM };
34
+ export { __commonJS, __name, __require, __toESM };
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-DCOBXSFB.mjs';
1
+ import { __name } from './chunk-DDRU76YD.mjs';
2
2
  import assert from 'node:assert';
3
3
 
4
4
  function isCompatDate(str) {
@@ -0,0 +1,33 @@
1
+ import { __name } from './chunk-DDRU76YD.mjs';
2
+ import fs from 'node:fs';
3
+
4
+ function isDirectory(path) {
5
+ return fs.statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
6
+ }
7
+ __name(isDirectory, "isDirectory");
8
+ function removeDir(dirPath, { fireAndForget = false } = {}) {
9
+ const result = fs.promises.rm(dirPath, {
10
+ recursive: true,
11
+ force: true,
12
+ maxRetries: 5,
13
+ retryDelay: 100
14
+ });
15
+ if (fireAndForget) {
16
+ void result.catch(() => {
17
+ });
18
+ } else {
19
+ return result;
20
+ }
21
+ }
22
+ __name(removeDir, "removeDir");
23
+ function removeDirSync(dirPath) {
24
+ fs.rmSync(dirPath, {
25
+ recursive: true,
26
+ force: true,
27
+ maxRetries: 5,
28
+ retryDelay: 100
29
+ });
30
+ }
31
+ __name(removeDirSync, "removeDirSync");
32
+
33
+ export { isDirectory, removeDir, removeDirSync };
@@ -0,0 +1,155 @@
1
+ import { isDirectory } from './chunk-OC543JY3.mjs';
2
+ import { __name } from './chunk-DDRU76YD.mjs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+
6
+ function isWindows() {
7
+ return /^win/i.test(process.platform);
8
+ }
9
+ __name(isWindows, "isWindows");
10
+ function isMacOS() {
11
+ return /^darwin$/i.test(process.platform);
12
+ }
13
+ __name(isMacOS, "isMacOS");
14
+ function isNonEmpty(value) {
15
+ return !!value;
16
+ }
17
+ __name(isNonEmpty, "isNonEmpty");
18
+ function getEnv(name) {
19
+ return process.env[name];
20
+ }
21
+ __name(getEnv, "getEnv");
22
+ function normalizePath(p) {
23
+ return p ? path.normalize(path.join(p, ".")) : void 0;
24
+ }
25
+ __name(normalizePath, "normalizePath");
26
+ function homeDir() {
27
+ if (isWindows()) {
28
+ const priorityList = [
29
+ os.homedir(),
30
+ getEnv("USERPROFILE"),
31
+ getEnv("HOME"),
32
+ // NOTE: `os-paths@7` uses `||` here (not `&&`), so a home directory is
33
+ // derived even when only one of HOMEDRIVE/HOMEPATH is set. This is
34
+ // preserved deliberately for byte-for-byte parity — see the parity
35
+ // tests, which compare this branch against the real package.
36
+ getEnv("HOMEDRIVE") || getEnv("HOMEPATH") ? path.join(getEnv("HOMEDRIVE") ?? "", getEnv("HOMEPATH") ?? "") : void 0
37
+ ];
38
+ return normalizePath(priorityList.find(isNonEmpty));
39
+ }
40
+ return normalizePath(os.homedir() || getEnv("HOME"));
41
+ }
42
+ __name(homeDir, "homeDir");
43
+ function joinToBase(base, segments) {
44
+ return base ? path.join(base, ...segments) : void 0;
45
+ }
46
+ __name(joinToBase, "joinToBase");
47
+ function tempDir() {
48
+ if (isWindows()) {
49
+ const fallback2 = "C:\\Temp";
50
+ const priorityListLazy = [
51
+ () => os.tmpdir(),
52
+ () => getEnv("TEMP"),
53
+ () => getEnv("TMP"),
54
+ () => joinToBase(getEnv("LOCALAPPDATA"), ["Temp"]),
55
+ () => joinToBase(homeDir(), ["AppData", "Local", "Temp"]),
56
+ () => joinToBase(getEnv("ALLUSERSPROFILE"), ["Temp"]),
57
+ () => joinToBase(getEnv("SystemRoot"), ["Temp"]),
58
+ () => joinToBase(getEnv("windir"), ["Temp"]),
59
+ () => joinToBase(getEnv("SystemDrive"), ["\\", "Temp"])
60
+ ];
61
+ const found = priorityListLazy.find((fn) => isNonEmpty(fn()));
62
+ return found && normalizePath(found()) || fallback2;
63
+ }
64
+ const fallback = "/tmp";
65
+ const priorityList = [
66
+ os.tmpdir(),
67
+ getEnv("TMPDIR"),
68
+ getEnv("TEMP"),
69
+ getEnv("TMP")
70
+ ];
71
+ return normalizePath(priorityList.find(isNonEmpty)) || fallback;
72
+ }
73
+ __name(tempDir, "tempDir");
74
+ function baseDir() {
75
+ return homeDir() || tempDir();
76
+ }
77
+ __name(baseDir, "baseDir");
78
+ function valOrPath(value, segments) {
79
+ return value || path.join(...segments);
80
+ }
81
+ __name(valOrPath, "valOrPath");
82
+ function windowsAppData() {
83
+ return valOrPath(getEnv("APPDATA"), [baseDir(), "AppData", "Roaming"]);
84
+ }
85
+ __name(windowsAppData, "windowsAppData");
86
+ function windowsLocalAppData() {
87
+ return valOrPath(getEnv("LOCALAPPDATA"), [baseDir(), "AppData", "Local"]);
88
+ }
89
+ __name(windowsLocalAppData, "windowsLocalAppData");
90
+ function xdgConfig() {
91
+ if (isMacOS()) {
92
+ return valOrPath(getEnv("XDG_CONFIG_HOME"), [
93
+ baseDir(),
94
+ "Library",
95
+ "Preferences"
96
+ ]);
97
+ }
98
+ if (isWindows()) {
99
+ return valOrPath(getEnv("XDG_CONFIG_HOME"), [
100
+ windowsAppData(),
101
+ "xdg.config"
102
+ ]);
103
+ }
104
+ return valOrPath(getEnv("XDG_CONFIG_HOME"), [baseDir(), ".config"]);
105
+ }
106
+ __name(xdgConfig, "xdgConfig");
107
+ function xdgCache() {
108
+ if (isMacOS()) {
109
+ return valOrPath(getEnv("XDG_CACHE_HOME"), [
110
+ baseDir(),
111
+ "Library",
112
+ "Caches"
113
+ ]);
114
+ }
115
+ if (isWindows()) {
116
+ return valOrPath(getEnv("XDG_CACHE_HOME"), [
117
+ windowsLocalAppData(),
118
+ "xdg.cache"
119
+ ]);
120
+ }
121
+ return valOrPath(getEnv("XDG_CACHE_HOME"), [baseDir(), ".cache"]);
122
+ }
123
+ __name(xdgCache, "xdgCache");
124
+ function xdgAppPaths(name) {
125
+ const segment = path.parse(name).name;
126
+ return {
127
+ config: /* @__PURE__ */ __name(() => path.join(xdgConfig(), segment), "config"),
128
+ cache: /* @__PURE__ */ __name(() => path.join(xdgCache(), segment), "cache")
129
+ };
130
+ }
131
+ __name(xdgAppPaths, "xdgAppPaths");
132
+
133
+ // src/global-wrangler-config-path.ts
134
+ function getGlobalConfigPath({
135
+ appName = "wrangler",
136
+ leadingDot = true,
137
+ useLegacyHomeDir = true
138
+ } = {}) {
139
+ const dirName = `${leadingDot ? "." : ""}${appName}`;
140
+ const configDir = xdgAppPaths(dirName).config();
141
+ if (useLegacyHomeDir) {
142
+ const legacyConfigDir = path.join(os.homedir(), dirName);
143
+ if (isDirectory(legacyConfigDir)) {
144
+ return legacyConfigDir;
145
+ }
146
+ }
147
+ return configDir;
148
+ }
149
+ __name(getGlobalConfigPath, "getGlobalConfigPath");
150
+ function getGlobalWranglerCachePath() {
151
+ return xdgAppPaths(".wrangler").cache();
152
+ }
153
+ __name(getGlobalWranglerCachePath, "getGlobalWranglerCachePath");
154
+
155
+ export { getGlobalConfigPath, getGlobalWranglerCachePath };
@@ -1,4 +1,4 @@
1
- import { __name } from './chunk-DCOBXSFB.mjs';
1
+ import { __name } from './chunk-DDRU76YD.mjs';
2
2
 
3
3
  // src/prometheus-metrics.ts
4
4
  var MetricsRegistry = class {
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Returns whether the given path is a directory
3
+ *
4
+ * Note: this function never throws; if the path does not exist or is inaccessible, it returns false.
5
+ *
6
+ * @param path The file system path to check
7
+ * @returns `true` if the path is a directory, `false` otherwise
8
+ */
9
+ declare function isDirectory(path: string): boolean;
10
+ /**
11
+ * Recursively remove a directory without waiting for completion or throwing any errors.
12
+ *
13
+ * @param dirPath The directory path to remove
14
+ * @param options An object with a `fireAndForget` property set to `true`
15
+ * @return `void` - the removal is fire-and-forget with errors suppressed
16
+ */
17
+ declare function removeDir(dirPath: string, { fireAndForget }: {
18
+ fireAndForget: true;
19
+ }): void;
20
+ /**
21
+ * Recursively remove a directory with retries for Windows compatibility.
22
+ *
23
+ * @param dirPath The directory path to remove
24
+ * @param options An optional object with a `fireAndForget` property set to `false`, if defined
25
+ * @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails
26
+ */
27
+ declare function removeDir(dirPath: string, options?: {
28
+ fireAndForget?: false;
29
+ }): Promise<void>;
30
+ /**
31
+ * Synchronously and recursively remove a directory, with retries for Windows compatibility.
32
+ *
33
+ * @see {@link removeDir} for the async version and rationale.
34
+ *
35
+ * @param dirPath The directory path to remove
36
+ * @throws If the removal fails after retries, an error will be thrown
37
+ */
38
+ declare function removeDirSync(dirPath: string): void;
39
+
40
+ export { isDirectory, removeDir, removeDirSync };
@@ -0,0 +1,2 @@
1
+ export { isDirectory, removeDir, removeDirSync } from './chunk-OC543JY3.mjs';
2
+ import './chunk-DDRU76YD.mjs';
@@ -0,0 +1,35 @@
1
+ interface GetGlobalConfigPathOptions {
2
+ /**
3
+ * The application namespace. Defaults to `"wrangler"`.
4
+ */
5
+ appName?: string;
6
+ /**
7
+ * Whether to prepend a `.` to `appName` when resolving the XDG path and the
8
+ * legacy `$HOME` directory. Defaults to `true` to match wrangler's
9
+ * historical behaviour (`.wrangler`).
10
+ */
11
+ leadingDot?: boolean;
12
+ /**
13
+ * When `true` (the default, matching wrangler's historical behaviour), a
14
+ * pre-existing `~/.<appName>` directory takes precedence over the XDG path.
15
+ * Pass `false` to always use the XDG-compliant path.
16
+ */
17
+ useLegacyHomeDir?: boolean;
18
+ }
19
+ /**
20
+ * Resolve the global config directory for a Cloudflare CLI.
21
+ *
22
+ * Defaults to wrangler's directory (`.wrangler`) so existing callers are
23
+ * unaffected, but accepts an `appName` so other first-party CLIs (e.g. `cf`)
24
+ * can reuse the same XDG-compliant resolution under their own namespace.
25
+ */
26
+ declare function getGlobalConfigPath({ appName, leadingDot, useLegacyHomeDir, }?: GetGlobalConfigPathOptions): string;
27
+ /**
28
+ * Resolve the XDG-compliant global cache directory for wrangler (`.wrangler`).
29
+ *
30
+ * Unlike {@link getGlobalConfigPath}, this never falls back to a legacy
31
+ * `~/.wrangler` directory.
32
+ */
33
+ declare function getGlobalWranglerCachePath(): string;
34
+
35
+ export { type GetGlobalConfigPathOptions, getGlobalConfigPath, getGlobalWranglerCachePath };
@@ -0,0 +1,3 @@
1
+ export { getGlobalConfigPath, getGlobalWranglerCachePath } from './chunk-OTBYAUQ6.mjs';
2
+ import './chunk-OC543JY3.mjs';
3
+ import './chunk-DDRU76YD.mjs';
package/dist/index.d.mts CHANGED
@@ -2,6 +2,8 @@ import { C as ComputedFields, B as Binding, R as RawConfig, b as Config, E as Ex
2
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';
@@ -310,6 +312,18 @@ type PackageJSON = {
310
312
  devDependencies?: Record<string, unknown>;
311
313
  dependencies?: Record<string, unknown>;
312
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>;
313
327
  };
314
328
  /**
315
329
  * A typed version of `parseJSON()`.
@@ -580,37 +594,6 @@ declare function getEnvironmentVariableFactory<Choices extends readonly string[]
580
594
  readonly choices?: Choices;
581
595
  }): () => ElementType<Choices>;
582
596
 
583
- interface GetGlobalConfigPathOptions {
584
- /**
585
- * The application namespace. Defaults to `"wrangler"`.
586
- */
587
- appName?: string;
588
- /**
589
- * Whether to prepend a `.` to `appName` when resolving the XDG path and the
590
- * legacy `$HOME` directory. Defaults to `true` to match wrangler's
591
- * historical behaviour (`.wrangler`).
592
- */
593
- leadingDot?: boolean;
594
- /**
595
- * When `true` (the default, matching wrangler's historical behaviour), a
596
- * pre-existing `~/.<appName>` directory takes precedence over the XDG path.
597
- * Pass `false` to always use the XDG-compliant path.
598
- */
599
- useLegacyHomeDir?: boolean;
600
- }
601
- /**
602
- * Resolve the global config directory for a Cloudflare CLI.
603
- *
604
- * Defaults to wrangler's directory (`.wrangler`) so existing callers are
605
- * unaffected, but accepts an `appName` so other first-party CLIs (e.g. `cf`)
606
- * can reuse the same XDG-compliant resolution under their own namespace.
607
- */
608
- declare function getGlobalConfigPath({ appName, leadingDot, useLegacyHomeDir, }?: GetGlobalConfigPathOptions): string;
609
- /**
610
- * @deprecated Use {@link getGlobalConfigPath} instead.
611
- */
612
- declare function getGlobalWranglerConfigPath(): string;
613
-
614
597
  type YYYY = `${number}${number}${number}${number}`;
615
598
  type MM = `${number}${number}`;
616
599
  type DD = `${number}${number}`;
@@ -630,45 +613,6 @@ declare function isCompatDate(str: string): str is CompatDate;
630
613
  */
631
614
  declare function getTodaysCompatDate(): CompatDate;
632
615
 
633
- /**
634
- * Returns whether the given path is a directory
635
- *
636
- * Note: this function never throws; if the path does not exist or is inaccessible, it returns false.
637
- *
638
- * @param path The file system path to check
639
- * @returns `true` if the path is a directory, `false` otherwise
640
- */
641
- declare function isDirectory(path: string): boolean;
642
- /**
643
- * Recursively remove a directory without waiting for completion or throwing any errors.
644
- *
645
- * @param dirPath The directory path to remove
646
- * @param options An object with a `fireAndForget` property set to `true`
647
- * @return `void` - the removal is fire-and-forget with errors suppressed
648
- */
649
- declare function removeDir(dirPath: string, { fireAndForget }: {
650
- fireAndForget: true;
651
- }): void;
652
- /**
653
- * Recursively remove a directory with retries for Windows compatibility.
654
- *
655
- * @param dirPath The directory path to remove
656
- * @param options An optional object with a `fireAndForget` property set to `false`, if defined
657
- * @return `Promise<void>` - resolves when the removal is complete, or rejects if the removal fails
658
- */
659
- declare function removeDir(dirPath: string, options?: {
660
- fireAndForget?: false;
661
- }): Promise<void>;
662
- /**
663
- * Synchronously and recursively remove a directory, with retries for Windows compatibility.
664
- *
665
- * @see {@link removeDir} for the async version and rationale.
666
- *
667
- * @param dirPath The directory path to remove
668
- * @throws If the removal fails after retries, an error will be thrown
669
- */
670
- declare function removeDirSync(dirPath: string): void;
671
-
672
616
  /**
673
617
  * A short-lived directory. Automatically removed when the process exits, but
674
618
  * can be removed earlier by calling `remove()`.
@@ -930,4 +874,4 @@ declare function getWorkerNameFromProject(projectPath: string): string;
930
874
  */
931
875
  declare const friendlyBindingNames: Record<ConfigBindingFieldName, string>;
932
876
 
933
- export { APIError, Binding, type BindingLocalSupport, BunPackageManager, CommandLineArgsError, type CompatDate, Config, type ConfigBindingFieldName, type ConfigBindingOptions, DeprecationError, Diagnostics, DurableObjectExport, type EphemeralDirectory, type ExportType, Exports, FatalError, type GetGlobalConfigPathOptions, 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, getGlobalConfigPath, getGlobalWranglerConfigPath, getHostFromRoute, getHostFromUrl, getTodaysCompatDate, getWorkerName, getWorkerNameFromProject, getWranglerHiddenDirPath, getWranglerTmpDir, getZoneFromRoute, hasDurableObjectExports, hasProperty, indexLocation, isCompatDate, isDirectory, isDockerfile, isOptionalProperty, isPagesConfig, isRedirectedConfig, isRequiredProperty, isValidR2BucketName, mapWorkerMetadataBindings, normalizeAndValidateConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, removeDir, removeDirSync, resolveWranglerConfigPath, retryOnAPIFailure, searchLocation, spawnCloudflared, startTunnel, sweepStaleWranglerTmpDirs, toValidWorkerName, validatePagesConfig };
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 };