@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/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TailConsumer,
|
|
1
|
+
import { T as TailConsumer, aK as WorkerMetadata, R as RawConfig } from './config-B_-PmLum.mjs';
|
|
2
2
|
import { AssetConfig } from '@cloudflare/workers-shared';
|
|
3
3
|
import { Cloudflare } from 'cloudflare';
|
|
4
4
|
import 'node:url';
|
package/dist/browser.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { constructWranglerConfig } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { constructWranglerConfig } from './chunk-ELQRF72O.mjs';
|
|
2
|
+
import './chunk-DDRU76YD.mjs';
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import { __name } from './chunk-
|
|
2
|
-
import
|
|
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
|
+
// src/config/exports.ts
|
|
6
|
+
function partitionExports(exports) {
|
|
7
|
+
const partitioned = {
|
|
8
|
+
"durable-object": {},
|
|
9
|
+
worker: {}
|
|
10
|
+
};
|
|
11
|
+
if (exports === void 0) {
|
|
12
|
+
return partitioned;
|
|
13
|
+
}
|
|
14
|
+
for (const [name, entry] of Object.entries(exports)) {
|
|
15
|
+
partitioned[entry.type][name] = entry;
|
|
16
|
+
}
|
|
17
|
+
return partitioned;
|
|
18
|
+
}
|
|
19
|
+
__name(partitionExports, "partitionExports");
|
|
20
|
+
|
|
5
21
|
// src/errors.ts
|
|
6
22
|
var UserError = class extends Error {
|
|
7
23
|
static {
|
|
@@ -2360,6 +2376,12 @@ var APIError = class extends ParseError {
|
|
|
2360
2376
|
#status;
|
|
2361
2377
|
code;
|
|
2362
2378
|
accountTag;
|
|
2379
|
+
/**
|
|
2380
|
+
* Optional structured metadata hoisted from the first `FetchError.meta`
|
|
2381
|
+
* on the v4 response envelope. Consumers can inspect this to render
|
|
2382
|
+
* endpoint-specific structured error payloads.
|
|
2383
|
+
*/
|
|
2384
|
+
meta;
|
|
2363
2385
|
constructor({ status, ...rest }) {
|
|
2364
2386
|
super(rest);
|
|
2365
2387
|
this.name = this.constructor.name;
|
|
@@ -2893,34 +2915,6 @@ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) =>
|
|
|
2893
2915
|
redirected
|
|
2894
2916
|
};
|
|
2895
2917
|
}, "experimental_readRawConfig");
|
|
2896
|
-
function isDirectory(path2) {
|
|
2897
|
-
return fs.statSync(path2, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
2898
|
-
}
|
|
2899
|
-
__name(isDirectory, "isDirectory");
|
|
2900
|
-
function removeDir(dirPath, { fireAndForget = false } = {}) {
|
|
2901
|
-
const result = fs.promises.rm(dirPath, {
|
|
2902
|
-
recursive: true,
|
|
2903
|
-
force: true,
|
|
2904
|
-
maxRetries: 5,
|
|
2905
|
-
retryDelay: 100
|
|
2906
|
-
});
|
|
2907
|
-
if (fireAndForget) {
|
|
2908
|
-
void result.catch(() => {
|
|
2909
|
-
});
|
|
2910
|
-
} else {
|
|
2911
|
-
return result;
|
|
2912
|
-
}
|
|
2913
|
-
}
|
|
2914
|
-
__name(removeDir, "removeDir");
|
|
2915
|
-
function removeDirSync(dirPath) {
|
|
2916
|
-
fs.rmSync(dirPath, {
|
|
2917
|
-
recursive: true,
|
|
2918
|
-
force: true,
|
|
2919
|
-
maxRetries: 5,
|
|
2920
|
-
retryDelay: 100
|
|
2921
|
-
});
|
|
2922
|
-
}
|
|
2923
|
-
__name(removeDirSync, "removeDirSync");
|
|
2924
2918
|
/*! Bundled license information:
|
|
2925
2919
|
|
|
2926
2920
|
smol-toml/dist/error.js:
|
|
@@ -3185,4 +3179,4 @@ smol-toml/dist/index.js:
|
|
|
3185
3179
|
*)
|
|
3186
3180
|
*/
|
|
3187
3181
|
|
|
3188
|
-
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,
|
|
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,
|
|
34
|
+
export { __commonJS, __name, __require, __toESM };
|
|
@@ -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 };
|
|
@@ -7,6 +7,18 @@ interface FetchError {
|
|
|
7
7
|
documentation_url?: string;
|
|
8
8
|
message: string;
|
|
9
9
|
error_chain?: FetchError[];
|
|
10
|
+
/**
|
|
11
|
+
* Optional structured error metadata returned alongside the message. The
|
|
12
|
+
* Cloudflare v4 envelope permits a `meta` object whose shape varies by
|
|
13
|
+
* endpoint; consumers are expected to validate the shape at use site
|
|
14
|
+
* before relying on any field.
|
|
15
|
+
*
|
|
16
|
+
* Known usage: declarative DO exports reconciliation returns `meta.details`
|
|
17
|
+
* as an array of per-class errors.
|
|
18
|
+
*/
|
|
19
|
+
meta?: {
|
|
20
|
+
details?: unknown;
|
|
21
|
+
} & Record<string, unknown>;
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
/**
|
|
@@ -709,6 +721,12 @@ interface CfDurableObjectMigrations {
|
|
|
709
721
|
deleted_classes?: string[];
|
|
710
722
|
}[];
|
|
711
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* The declarative `exports` map keyed by class name.
|
|
726
|
+
*
|
|
727
|
+
* Durable Objects can only be configured by `exports` or `migrations`, not both.
|
|
728
|
+
*/
|
|
729
|
+
type CfExports = Exports;
|
|
712
730
|
type CfPlacement = {
|
|
713
731
|
mode: "smart";
|
|
714
732
|
hint?: string;
|
|
@@ -754,6 +772,11 @@ interface CfWorkerInit {
|
|
|
754
772
|
class_name: string;
|
|
755
773
|
}[] | undefined;
|
|
756
774
|
migrations: CfDurableObjectMigrations | undefined;
|
|
775
|
+
/**
|
|
776
|
+
* Declarative exports configuration. Durable Object entries are sent instead
|
|
777
|
+
* of `migrations`.
|
|
778
|
+
*/
|
|
779
|
+
exports: CfExports | undefined;
|
|
757
780
|
compatibility_date: string | undefined;
|
|
758
781
|
compatibility_flags: string[] | undefined;
|
|
759
782
|
keepVars: boolean | undefined;
|
|
@@ -1067,6 +1090,7 @@ type WorkerMetadataPut = {
|
|
|
1067
1090
|
compatibility_flags?: string[];
|
|
1068
1091
|
usage_model?: "bundled" | "unbound";
|
|
1069
1092
|
migrations?: CfDurableObjectMigrations;
|
|
1093
|
+
exports?: CfExports;
|
|
1070
1094
|
capnp_schema?: string;
|
|
1071
1095
|
bindings: WorkerMetadataBinding[];
|
|
1072
1096
|
keep_bindings?: (WorkerMetadataBinding["type"] | "secret_text" | "secret_key")[];
|
|
@@ -1089,6 +1113,62 @@ type WorkerMetadataVersionsPost = WorkerMetadataPut & {
|
|
|
1089
1113
|
annotations?: Record<string, string>;
|
|
1090
1114
|
};
|
|
1091
1115
|
type WorkerMetadata = WorkerMetadataPut | WorkerMetadataVersionsPost;
|
|
1116
|
+
/**
|
|
1117
|
+
* Structured per-class entry returned by the declarative exports
|
|
1118
|
+
* reconciliation flow.
|
|
1119
|
+
*
|
|
1120
|
+
* The same shape is used for both successful info entries (under
|
|
1121
|
+
* `exports_reconciliation.info[]`) and blocking errors (under the v4 error
|
|
1122
|
+
* envelope's `meta.details[]`). The `scenario` tag is the stable, machine-
|
|
1123
|
+
* readable identifier of which reconciliation case produced the entry.
|
|
1124
|
+
*/
|
|
1125
|
+
type ExportsReconciliationEntryBase = {
|
|
1126
|
+
class: string;
|
|
1127
|
+
scenario: string;
|
|
1128
|
+
message: string;
|
|
1129
|
+
namespace_id?: string;
|
|
1130
|
+
};
|
|
1131
|
+
type ExportsReconciliationInfo = ExportsReconciliationEntryBase & {
|
|
1132
|
+
/**
|
|
1133
|
+
* Workers in the account that still bind to the source class name and must
|
|
1134
|
+
* be redeployed before the tombstone is safe to remove.
|
|
1135
|
+
*/
|
|
1136
|
+
referencing_scripts?: string[];
|
|
1137
|
+
};
|
|
1138
|
+
type ExportsReconciliationWarning = ExportsReconciliationEntryBase;
|
|
1139
|
+
type ExportsReconciliationErrorDetail = ExportsReconciliationEntryBase & {
|
|
1140
|
+
suggestion?: string;
|
|
1141
|
+
referencing_scripts?: string[];
|
|
1142
|
+
};
|
|
1143
|
+
type ExportsReconciliationRename = {
|
|
1144
|
+
from: string;
|
|
1145
|
+
to: string;
|
|
1146
|
+
};
|
|
1147
|
+
type ExportsReconciliationTransfer = {
|
|
1148
|
+
class: string;
|
|
1149
|
+
to: string;
|
|
1150
|
+
phase: "committed";
|
|
1151
|
+
};
|
|
1152
|
+
type ExportsReconciliationTransferPending = {
|
|
1153
|
+
class: string;
|
|
1154
|
+
from: string;
|
|
1155
|
+
};
|
|
1156
|
+
/**
|
|
1157
|
+
* The customer-visible summary of a successful exports reconciliation,
|
|
1158
|
+
* embedded in the upload response under `exports_reconciliation`. All arrays
|
|
1159
|
+
* are present, and are empty when there are no entries to report.
|
|
1160
|
+
*/
|
|
1161
|
+
type ExportsReconciliationResult = {
|
|
1162
|
+
created: string[];
|
|
1163
|
+
updated: string[];
|
|
1164
|
+
deleted: string[];
|
|
1165
|
+
renamed: ExportsReconciliationRename[];
|
|
1166
|
+
transferred: ExportsReconciliationTransfer[];
|
|
1167
|
+
transfer_pending: ExportsReconciliationTransferPending[];
|
|
1168
|
+
warnings: ExportsReconciliationWarning[];
|
|
1169
|
+
info: ExportsReconciliationInfo[];
|
|
1170
|
+
removable_entries: string[];
|
|
1171
|
+
};
|
|
1092
1172
|
type ServiceMetadataRes = {
|
|
1093
1173
|
id: string;
|
|
1094
1174
|
default_environment: {
|
|
@@ -1312,6 +1392,7 @@ interface StartDevWorkerInput {
|
|
|
1312
1392
|
type: "plain_text";
|
|
1313
1393
|
}>>;
|
|
1314
1394
|
migrations?: DurableObjectMigration[];
|
|
1395
|
+
exports?: Exports;
|
|
1315
1396
|
containers?: ContainerApp[];
|
|
1316
1397
|
/** The triggers which will cause the worker's exported default handlers to be called. */
|
|
1317
1398
|
triggers?: Trigger[];
|
|
@@ -1753,6 +1834,66 @@ type DurableObjectMigration = {
|
|
|
1753
1834
|
/** The Durable Objects being removed. */
|
|
1754
1835
|
deleted_classes?: string[];
|
|
1755
1836
|
};
|
|
1837
|
+
/**
|
|
1838
|
+
* Storage backend for a declarative Durable Object export. See
|
|
1839
|
+
* {@link DurableObjectExport}.
|
|
1840
|
+
*/
|
|
1841
|
+
type DurableObjectExportStorage = "sqlite" | "legacy-kv";
|
|
1842
|
+
/**
|
|
1843
|
+
* A single declarative Durable Object export entry in the `exports` config
|
|
1844
|
+
* map. `type` is reserved for the export kind. `state` carries the Durable
|
|
1845
|
+
* Object lifecycle and defaults to `"created"` (live) when omitted.
|
|
1846
|
+
*
|
|
1847
|
+
* Mutually exclusive with {@link DurableObjectMigration} at the config-
|
|
1848
|
+
* validation boundary.
|
|
1849
|
+
*
|
|
1850
|
+
* - `created` (default, live): `storage` is required.
|
|
1851
|
+
* - `deleted` (tombstone): retire a provisioned namespace whose class has
|
|
1852
|
+
* been removed from code.
|
|
1853
|
+
* - `renamed` (tombstone): rewrite a provisioned namespace's class name to
|
|
1854
|
+
* `renamed_to`. The target name must also appear as a live (state
|
|
1855
|
+
* `"created"`) `durable-object` entry in the same map.
|
|
1856
|
+
* - `transferred` (tombstone): hand ownership of the namespace to another
|
|
1857
|
+
* script in the same account (`transferred_to`). Two-phase commit;
|
|
1858
|
+
* the target must first deploy an `expecting-transfer` entry naming this
|
|
1859
|
+
* script via `transfer_from`.
|
|
1860
|
+
* - `expecting-transfer` (live): receiving side of a two-phase transfer;
|
|
1861
|
+
* `storage` and `transfer_from` are both required.
|
|
1862
|
+
*/
|
|
1863
|
+
type DurableObjectExport = {
|
|
1864
|
+
type: "durable-object";
|
|
1865
|
+
state?: "created";
|
|
1866
|
+
storage: DurableObjectExportStorage;
|
|
1867
|
+
} | {
|
|
1868
|
+
type: "durable-object";
|
|
1869
|
+
state: "deleted";
|
|
1870
|
+
} | {
|
|
1871
|
+
type: "durable-object";
|
|
1872
|
+
state: "renamed";
|
|
1873
|
+
renamed_to: string;
|
|
1874
|
+
} | {
|
|
1875
|
+
type: "durable-object";
|
|
1876
|
+
state: "transferred";
|
|
1877
|
+
transferred_to: string;
|
|
1878
|
+
} | {
|
|
1879
|
+
type: "durable-object";
|
|
1880
|
+
state: "expecting-transfer";
|
|
1881
|
+
storage: DurableObjectExportStorage;
|
|
1882
|
+
transfer_from: string;
|
|
1883
|
+
};
|
|
1884
|
+
interface WorkerEntrypointExport {
|
|
1885
|
+
type: "worker";
|
|
1886
|
+
cache?: {
|
|
1887
|
+
/** Whether cache is enabled for this entrypoint. */
|
|
1888
|
+
enabled: boolean;
|
|
1889
|
+
};
|
|
1890
|
+
}
|
|
1891
|
+
type ConfiguredExport = DurableObjectExport | WorkerEntrypointExport;
|
|
1892
|
+
/**
|
|
1893
|
+
* The declarative `exports` map keyed by export name. Durable Object exports
|
|
1894
|
+
* are mutually exclusive with `migrations` at the wrangler config layer.
|
|
1895
|
+
*/
|
|
1896
|
+
type Exports = Record<string, ConfiguredExport>;
|
|
1756
1897
|
/**
|
|
1757
1898
|
* The `EnvironmentInheritable` interface declares all the configuration fields for an environment
|
|
1758
1899
|
* that can be inherited (and overridden) from the top-level environment.
|
|
@@ -1894,6 +2035,15 @@ interface EnvironmentInheritable {
|
|
|
1894
2035
|
* @inheritable
|
|
1895
2036
|
*/
|
|
1896
2037
|
migrations: DurableObjectMigration[];
|
|
2038
|
+
/**
|
|
2039
|
+
* Declarative exports configuration — a map of class name to export configuration.
|
|
2040
|
+
*
|
|
2041
|
+
* The configuration of Durable Objects via `exports` is mutually exclusive with `migrations`.
|
|
2042
|
+
*
|
|
2043
|
+
* @default {}
|
|
2044
|
+
* @inheritable
|
|
2045
|
+
*/
|
|
2046
|
+
exports: Exports;
|
|
1897
2047
|
/**
|
|
1898
2048
|
* "Cron" definitions to trigger a Worker's "scheduled" function.
|
|
1899
2049
|
*
|
|
@@ -2977,6 +3127,8 @@ interface Observability {
|
|
|
2977
3127
|
interface CacheOptions {
|
|
2978
3128
|
/** If cache is enabled for this Worker */
|
|
2979
3129
|
enabled: boolean;
|
|
3130
|
+
/** Whether cached assets may be reused across Worker versions. */
|
|
3131
|
+
cross_version_cache?: boolean;
|
|
2980
3132
|
}
|
|
2981
3133
|
type DockerConfiguration = {
|
|
2982
3134
|
/** Socket used by miniflare to communicate with Docker */
|
|
@@ -3249,4 +3401,4 @@ interface EnvironmentMap {
|
|
|
3249
3401
|
}
|
|
3250
3402
|
declare const defaultWranglerConfig: Config;
|
|
3251
3403
|
|
|
3252
|
-
export { type
|
|
3404
|
+
export { type CfStreamBinding as $, type Assets as A, type Binding as B, type ComputedFields as C, type DurableObjectExport as D, type Exports as E, type ContainerEngine as F, type CfScriptFormat as G, type CfModuleType as H, type CfModule as I, type CfVars as J, type CfKvNamespace as K, type Logger as L, type CfSendEmailBindings as M, type CfWasmModuleBindings as N, type Observability as O, type PreviewsConfig as P, type CfTextBlobBindings as Q, type RawConfig as R, type StreamingTailConsumer as S, type TailConsumer as T, type UserLimits as U, type CfBrowserBinding as V, type WorkerEntrypointExport as W, type CfAIBinding as X, type CfImagesBinding as Y, type ZoneIdRoute as Z, type CfMediaBinding as _, type RedirectedRawConfig as a, type AsyncHook as a$, type CfVersionMetadataBinding as a0, type CfDataBlobBindings as a1, type CfDurableObject as a2, type CfWorkflow as a3, type CfQueue as a4, type CfR2Bucket as a5, type CfD1Database as a6, type CfVectorize as a7, type CfAISearchNamespace as a8, type CfAISearch as a9, type CfTailConsumer as aA, type CfUserLimits as aB, type CfWorkerInit as aC, type CfWorkerContext as aD, type CfWorkerSourceMap as aE, type Json as aF, type AssetConfigMetadata as aG, type AssetsOptions as aH, type ValidatedAssetsOptions as aI, type LegacyAssetPaths as aJ, type WorkerMetadata as aK, type ExportsReconciliationEntryBase as aL, type ExportsReconciliationInfo as aM, type ExportsReconciliationWarning as aN, type ExportsReconciliationErrorDetail as aO, type ExportsReconciliationRename as aP, type ExportsReconciliationTransfer as aQ, type ExportsReconciliationTransferPending as aR, type ExportsReconciliationResult as aS, type ServiceMetadataRes as aT, type ServiceFetch as aU, type File as aV, type BinaryFile as aW, type Trigger as aX, type CfAccount as aY, type HookValues as aZ, type Hook as a_, type CfWebSearch as aa, type CfAgentMemory as ab, type CfSecretsStoreSecrets as ac, type CfArtifacts as ad, type CfHelloWorld as ae, type CfFlagship as af, type CfWorkerLoader as ag, type CfRateLimit as ah, type CfHyperdrive as ai, type CfDevPluginCfg as aj, type CfService as ak, type CfVpcService as al, type CfVpcNetwork as am, type CfAnalyticsEngineDataset as an, type CfDispatchNamespace as ao, type CfMTlsCertificate as ap, type CfLogfwdr as aq, type CfLogfwdrBinding as ar, type CfAssetsBinding as as, type CfPipeline as at, type CfUnsafeBinding as au, type CfCapnp as av, type CfUnsafe as aw, type CfDurableObjectMigrations as ax, type CfExports as ay, type CfPlacement as az, type Config as b, fetchKVGetValueBase as b$, type LogLevel as b0, type NodeJSCompatMode as b1, type StartDevWorkerInput as b2, type Entry as b3, INHERIT_SYMBOL as b4, SERVICE_TAG_PREFIX as b5, ENVIRONMENT_TAG_PREFIX as b6, PATH_TO_DEPLOY_CONFIG as b7, JSON_CONFIG_FORMATS as b8, getC3CommandFromEnv as b9, getDisableConfigWatching as bA, getWranglerHideBanner as bB, getCloudflareEnv as bC, getOpenNextDeployFromEnv as bD, getLocalExplorerEnabledFromEnv as bE, getBrowserRenderingHeadfulFromEnv as bF, getCfFetchEnabledFromEnv as bG, getCfFetchPathFromEnv as bH, getWranglerCacheDirFromEnv as bI, getCloudflaredPathFromEnv as bJ, type ApiCredentials as bK, type FetchResult as bL, type FetchResultFetcher as bM, type FetchListResultFetcher as bN, type FetchPagedListResultFetcher as bO, performApiFetchBase as bP, fetchInternalBase as bQ, fetchResultBase as bR, fetchListResultBase as bS, truncate as bT, isWAFBlockResponse as bU, extractWAFBlockRayId as bV, extractAccountTag as bW, hasMorePages as bX, renderError as bY, addAuthorizationHeader as bZ, throwFetchError as b_, getWranglerSendMetricsFromEnv as ba, getWranglerSendErrorReportsFromEnv as bb, getCloudflareApiEnvironmentFromEnv as bc, type ComplianceConfig as bd, COMPLIANCE_REGION_CONFIG_PUBLIC as be, COMPLIANCE_REGION_CONFIG_UNKNOWN as bf, getCloudflareComplianceRegion as bg, getCloudflareApiBaseUrl as bh, getComplianceRegionSubdomain as bi, getSanitizeLogs as bj, getOutputFileDirectoryFromEnv as bk, getOutputFilePathFromEnv as bl, getCIMatchTag as bm, getCIOverrideName as bn, getCIOverrideNetworkModeHost as bo, getCIGeneratePreviewAlias as bp, getWorkersCIBranchName as bq, getBuildConditionsFromEnv as br, getBuildPlatformFromEnv as bs, getRegistryPath as bt, getD1ExtraLocationChoices as bu, getDockerPath as bv, getSubdomainMixedStateCheckDisabled as bw, getCloudflareLoadDevVarsFromDotEnv as bx, getCloudflareIncludeProcessEnvFromEnv as by, getTraceHeader as bz, type WorkerMetadataBinding as c, type FetchKVGetValueFetcher as c0, hasCursor as c1, maybeAddTraceHeader as c2, type Route as d, type RawDevConfig as e, type ConfigFields as f, type RawEnvironment as g, defaultWranglerConfig as h, LOGGER_LEVELS as i, type LoggerLevel as j, type Environment as k, type ZoneNameRoute as l, type CustomDomainRoute as m, type CloudchamberConfig as n, type ContainerApp as o, type DurableObjectMigration as p, type DurableObjectExportStorage as q, type ConfiguredExport as r, type DurableObjectBindings as s, type WorkflowBinding as t, type EnvironmentNonInheritable as u, type Rule as v, type ConfigModuleRuleType as w, type DispatchNamespaceOutbound as x, type CacheOptions as y, type DockerConfiguration as z };
|
|
@@ -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,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 };
|