@cloudflare/workers-utils 0.33.1 → 0.35.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/browser.mjs +1 -1
- package/dist/chunk-3IYLA2JH.mjs +73 -0
- package/dist/{chunk-IV7UMGT2.mjs → chunk-6VP24PQU.mjs} +1 -1
- package/dist/chunk-7AX24RFK.mjs +265 -0
- package/dist/chunk-C6O4ION7.mjs +42 -0
- package/dist/chunk-MCNIGVAF.mjs +45 -0
- package/dist/{chunk-QFKPUV4H.mjs → chunk-V6JSHOVJ.mjs} +16 -115
- package/dist/chunk-WO2IAW6M.mjs +62 -0
- package/dist/chunk-XUGGRRBO.mjs +178 -0
- package/dist/compatibility-date.d.mts +80 -0
- package/dist/compatibility-date.mjs +2 -0
- package/dist/{config-CRUFg2tu.d.mts → compliance-j3-tqeao.d.mts} +64 -17
- package/dist/compliance.d.mts +4 -0
- package/dist/compliance.mjs +7 -0
- package/dist/docker-path.d.mts +8 -0
- package/dist/docker-path.mjs +3 -0
- package/dist/errors.d.mts +55 -0
- package/dist/errors.mjs +2 -0
- package/dist/index.d.mts +238 -145
- package/dist/index.mjs +1656 -703
- package/dist/metafile-esm.json +1 -1
- package/dist/open-PBXRGS4R.mjs +3 -3
- package/dist/test-helpers/index.d.mts +6 -2
- package/dist/test-helpers/index.mjs +39 -2
- package/dist/zod-format.d.mts +6 -0
- package/dist/zod-format.mjs +2 -0
- package/package.json +24 -3
package/dist/browser.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { be as TailConsumer, bi as WorkerMetadata, R as RawConfig } from './compliance-j3-tqeao.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-
|
|
1
|
+
export { constructWranglerConfig } from './chunk-6VP24PQU.mjs';
|
|
2
2
|
import './chunk-Q72B4Q5Z.mjs';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { UserError } from './chunk-WO2IAW6M.mjs';
|
|
2
|
+
import { __name } from './chunk-Q72B4Q5Z.mjs';
|
|
3
|
+
|
|
4
|
+
// src/environment-variables/factory.ts
|
|
5
|
+
function getBooleanEnvironmentVariableFactory(options) {
|
|
6
|
+
return () => {
|
|
7
|
+
if (!(options.variableName in process.env) || process.env[options.variableName] === void 0) {
|
|
8
|
+
return typeof options.defaultValue === "function" ? options.defaultValue() : options.defaultValue;
|
|
9
|
+
}
|
|
10
|
+
switch (process.env[options.variableName]?.toLowerCase()) {
|
|
11
|
+
case "true":
|
|
12
|
+
return true;
|
|
13
|
+
case "false":
|
|
14
|
+
return false;
|
|
15
|
+
default:
|
|
16
|
+
throw new UserError(
|
|
17
|
+
`Expected ${options.variableName} to be "true" or "false", but got ${JSON.stringify(
|
|
18
|
+
process.env[options.variableName]
|
|
19
|
+
)}`,
|
|
20
|
+
{ telemetryMessage: false }
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
__name(getBooleanEnvironmentVariableFactory, "getBooleanEnvironmentVariableFactory");
|
|
26
|
+
function getEnvironmentVariableFactory({
|
|
27
|
+
variableName,
|
|
28
|
+
deprecatedName,
|
|
29
|
+
choices,
|
|
30
|
+
defaultValue
|
|
31
|
+
}) {
|
|
32
|
+
let hasWarned = false;
|
|
33
|
+
return () => {
|
|
34
|
+
if (variableName in process.env) {
|
|
35
|
+
return getProcessEnv(variableName, choices);
|
|
36
|
+
}
|
|
37
|
+
if (deprecatedName && deprecatedName in process.env) {
|
|
38
|
+
if (!hasWarned) {
|
|
39
|
+
hasWarned = true;
|
|
40
|
+
console.warn(
|
|
41
|
+
`Using "${deprecatedName}" environment variable. This is deprecated. Please use "${variableName}", instead.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return getProcessEnv(deprecatedName, choices);
|
|
45
|
+
}
|
|
46
|
+
return defaultValue?.();
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
__name(getEnvironmentVariableFactory, "getEnvironmentVariableFactory");
|
|
50
|
+
function getProcessEnv(variableName, choices) {
|
|
51
|
+
assertOneOf(choices, process.env[variableName]);
|
|
52
|
+
return process.env[variableName];
|
|
53
|
+
}
|
|
54
|
+
__name(getProcessEnv, "getProcessEnv");
|
|
55
|
+
function assertOneOf(choices, value) {
|
|
56
|
+
if (Array.isArray(choices) && !choices.includes(value)) {
|
|
57
|
+
throw new UserError(
|
|
58
|
+
`Expected ${JSON.stringify(value)} to be one of ${JSON.stringify(choices)}`,
|
|
59
|
+
{ telemetryMessage: false }
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
__name(assertOneOf, "assertOneOf");
|
|
64
|
+
|
|
65
|
+
// src/docker-path.ts
|
|
66
|
+
var getDockerPath = getEnvironmentVariableFactory({
|
|
67
|
+
variableName: "WRANGLER_DOCKER_BIN",
|
|
68
|
+
defaultValue() {
|
|
69
|
+
return "docker";
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export { getBooleanEnvironmentVariableFactory, getDockerPath, getEnvironmentVariableFactory };
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { __name } from './chunk-Q72B4Q5Z.mjs';
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
import util from 'node:util';
|
|
4
|
+
|
|
5
|
+
// ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
|
|
6
|
+
var FORCE_COLOR;
|
|
7
|
+
var NODE_DISABLE_COLORS;
|
|
8
|
+
var NO_COLOR;
|
|
9
|
+
var TERM;
|
|
10
|
+
var isTTY = true;
|
|
11
|
+
if (typeof process !== "undefined") {
|
|
12
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
13
|
+
isTTY = process.stdout && process.stdout.isTTY;
|
|
14
|
+
}
|
|
15
|
+
var $ = {
|
|
16
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
|
|
17
|
+
};
|
|
18
|
+
function init(x, y) {
|
|
19
|
+
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
|
|
20
|
+
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
|
|
21
|
+
return function(txt) {
|
|
22
|
+
if (!$.enabled || txt == null) return txt;
|
|
23
|
+
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
__name(init, "init");
|
|
27
|
+
var dim = init(2, 22);
|
|
28
|
+
var red = init(31, 39);
|
|
29
|
+
var green = init(32, 39);
|
|
30
|
+
var yellow = init(33, 39);
|
|
31
|
+
var blue = init(34, 39);
|
|
32
|
+
var magenta = init(35, 39);
|
|
33
|
+
var cyan = init(36, 39);
|
|
34
|
+
|
|
35
|
+
// src/zod-format.ts
|
|
36
|
+
var originalEnabled = $.enabled;
|
|
37
|
+
function _forceColour(enabled = originalEnabled) {
|
|
38
|
+
$.enabled = enabled;
|
|
39
|
+
}
|
|
40
|
+
__name(_forceColour, "_forceColour");
|
|
41
|
+
var kMessages = Symbol("kMessages");
|
|
42
|
+
var kActual = Symbol("kActual");
|
|
43
|
+
var kGroupId = Symbol("kGroupId");
|
|
44
|
+
var groupColours = [
|
|
45
|
+
yellow,
|
|
46
|
+
/* (green) */
|
|
47
|
+
cyan,
|
|
48
|
+
blue,
|
|
49
|
+
magenta,
|
|
50
|
+
green
|
|
51
|
+
];
|
|
52
|
+
var GroupCountsMap = Map;
|
|
53
|
+
function isAnnotation(value) {
|
|
54
|
+
return typeof value === "object" && value !== null && kMessages in value && kActual in value;
|
|
55
|
+
}
|
|
56
|
+
__name(isAnnotation, "isAnnotation");
|
|
57
|
+
function isRecord(value) {
|
|
58
|
+
return typeof value === "object" && value !== null;
|
|
59
|
+
}
|
|
60
|
+
__name(isRecord, "isRecord");
|
|
61
|
+
function arrayShallowEqual(a, b) {
|
|
62
|
+
if (a.length !== b.length) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
for (let i = 0; i < a.length; i++) {
|
|
66
|
+
if (a[i] !== b[i]) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
__name(arrayShallowEqual, "arrayShallowEqual");
|
|
73
|
+
function issueEqual(a, b) {
|
|
74
|
+
return a.message === b.message && arrayShallowEqual(a.path, b.path);
|
|
75
|
+
}
|
|
76
|
+
__name(issueEqual, "issueEqual");
|
|
77
|
+
function hasMultipleDistinctMessages(issues, atDepth) {
|
|
78
|
+
let firstIssue;
|
|
79
|
+
for (const issue of issues) {
|
|
80
|
+
if (issue.path.length < atDepth) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (firstIssue === void 0) {
|
|
84
|
+
firstIssue = issue;
|
|
85
|
+
} else if (!issueEqual(firstIssue, issue)) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
__name(hasMultipleDistinctMessages, "hasMultipleDistinctMessages");
|
|
92
|
+
function annotate(groupCounts, annotated, input, issue, path, groupId) {
|
|
93
|
+
if (path.length === 0) {
|
|
94
|
+
if (issue.code === "invalid_union") {
|
|
95
|
+
const allBranchIssues = issue.errors;
|
|
96
|
+
const unionIssues = allBranchIssues.flat();
|
|
97
|
+
if (unionIssues.length > 0) {
|
|
98
|
+
const multipleDistinct = hasMultipleDistinctMessages(unionIssues, 1);
|
|
99
|
+
let newGroupId;
|
|
100
|
+
if (isRecord(input) && multipleDistinct) {
|
|
101
|
+
newGroupId = groupCounts.size;
|
|
102
|
+
groupCounts.set(newGroupId, 0);
|
|
103
|
+
}
|
|
104
|
+
for (const branchIssues of allBranchIssues) {
|
|
105
|
+
for (const unionIssue of branchIssues) {
|
|
106
|
+
const unionPath = unionIssue.path;
|
|
107
|
+
if (multipleDistinct && unionPath.length === 0) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
annotated = annotate(
|
|
111
|
+
groupCounts,
|
|
112
|
+
annotated,
|
|
113
|
+
input,
|
|
114
|
+
unionIssue,
|
|
115
|
+
unionPath,
|
|
116
|
+
newGroupId
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return annotated;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const message = issue.message;
|
|
124
|
+
if (annotated !== void 0) {
|
|
125
|
+
if (isAnnotation(annotated) && !annotated[kMessages].includes(message)) {
|
|
126
|
+
annotated[kMessages].push(message);
|
|
127
|
+
}
|
|
128
|
+
return annotated;
|
|
129
|
+
}
|
|
130
|
+
if (groupId !== void 0) {
|
|
131
|
+
const current = groupCounts.get(groupId);
|
|
132
|
+
assert(current !== void 0);
|
|
133
|
+
groupCounts.set(groupId, current + 1);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
[kMessages]: [message],
|
|
137
|
+
[kActual]: input,
|
|
138
|
+
[kGroupId]: groupId
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const [head, ...tail] = path;
|
|
142
|
+
assert(isRecord(input), "Expected object/array input for nested issue");
|
|
143
|
+
if (annotated === void 0) {
|
|
144
|
+
if (Array.isArray(input)) {
|
|
145
|
+
annotated = new Array(input.length);
|
|
146
|
+
} else {
|
|
147
|
+
const entries = Object.keys(input).map((key) => [key, void 0]);
|
|
148
|
+
annotated = Object.fromEntries(entries);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
assert(isRecord(annotated), "Expected object/array for nested issue");
|
|
152
|
+
annotated[head] = annotate(
|
|
153
|
+
groupCounts,
|
|
154
|
+
annotated[head],
|
|
155
|
+
input[head],
|
|
156
|
+
issue,
|
|
157
|
+
tail,
|
|
158
|
+
groupId
|
|
159
|
+
);
|
|
160
|
+
return annotated;
|
|
161
|
+
}
|
|
162
|
+
__name(annotate, "annotate");
|
|
163
|
+
function print(inspectOptions, groupCounts, annotated, indent = "", extras) {
|
|
164
|
+
const prefix = extras?.prefix ?? "";
|
|
165
|
+
const suffix = extras?.suffix ?? "";
|
|
166
|
+
if (isAnnotation(annotated)) {
|
|
167
|
+
const prefixIndent = indent + " ".repeat(prefix.length);
|
|
168
|
+
const actual = util.inspect(annotated[kActual], inspectOptions);
|
|
169
|
+
const actualIndented = actual.split("\n").map((line, i) => i > 0 ? prefixIndent + line : line).join("\n");
|
|
170
|
+
let messageColour = red;
|
|
171
|
+
let messagePrefix = prefixIndent + "^";
|
|
172
|
+
let groupOr = "";
|
|
173
|
+
if (annotated[kGroupId] !== void 0) {
|
|
174
|
+
messageColour = groupColours[annotated[kGroupId] % groupColours.length];
|
|
175
|
+
messagePrefix += annotated[kGroupId] + 1;
|
|
176
|
+
const remaining = groupCounts.get(annotated[kGroupId]);
|
|
177
|
+
assert(remaining !== void 0);
|
|
178
|
+
if (remaining > 1) {
|
|
179
|
+
groupOr = " *or*";
|
|
180
|
+
}
|
|
181
|
+
groupCounts.set(annotated[kGroupId], remaining - 1);
|
|
182
|
+
}
|
|
183
|
+
messagePrefix += " ";
|
|
184
|
+
const messageIndent = " ".repeat(messagePrefix.length);
|
|
185
|
+
const messageIndented = annotated[kMessages].flatMap((m) => m.split("\n")).map((line, i) => i > 0 ? messageIndent + line : line).join("\n");
|
|
186
|
+
const error = messageColour(`${messagePrefix}${messageIndented}${groupOr}`);
|
|
187
|
+
return `${indent}${dim(prefix)}${actualIndented}${dim(suffix)}
|
|
188
|
+
${error}`;
|
|
189
|
+
} else if (Array.isArray(annotated)) {
|
|
190
|
+
let result = `${indent}${dim(`${prefix}[`)}
|
|
191
|
+
`;
|
|
192
|
+
const arrayIndent = indent + " ";
|
|
193
|
+
for (let i = 0; i < annotated.length; i++) {
|
|
194
|
+
const value = annotated[i];
|
|
195
|
+
if (value === void 0 && (i === 0 || annotated[i - 1] !== void 0)) {
|
|
196
|
+
result += `${arrayIndent}${dim("...,")}
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
if (value !== void 0) {
|
|
200
|
+
result += print(inspectOptions, groupCounts, value, arrayIndent, {
|
|
201
|
+
prefix: `/* [${i}] */ `,
|
|
202
|
+
suffix: ","
|
|
203
|
+
});
|
|
204
|
+
result += "\n";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
result += `${indent}${dim(`]${suffix}`)}`;
|
|
208
|
+
return result;
|
|
209
|
+
} else if (isRecord(annotated)) {
|
|
210
|
+
let result = `${indent}${dim(`${prefix}{`)}
|
|
211
|
+
`;
|
|
212
|
+
const objectIndent = indent + " ";
|
|
213
|
+
const entries = Object.entries(annotated);
|
|
214
|
+
for (let i = 0; i < entries.length; i++) {
|
|
215
|
+
const [key, value] = entries[i];
|
|
216
|
+
if (value === void 0 && (i === 0 || entries[i - 1][1] !== void 0)) {
|
|
217
|
+
result += `${objectIndent}${dim("...,")}
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
if (value !== void 0) {
|
|
221
|
+
result += print(inspectOptions, groupCounts, value, objectIndent, {
|
|
222
|
+
prefix: `${key}: `,
|
|
223
|
+
suffix: ","
|
|
224
|
+
});
|
|
225
|
+
result += "\n";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
result += `${indent}${dim(`}${suffix}`)}`;
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
return "";
|
|
232
|
+
}
|
|
233
|
+
__name(print, "print");
|
|
234
|
+
function formatZodError(error, input) {
|
|
235
|
+
const sortedIssues = Array.from(error.issues).sort((a, b) => {
|
|
236
|
+
if (a.code !== b.code) {
|
|
237
|
+
if (a.code === "invalid_union") {
|
|
238
|
+
return -1;
|
|
239
|
+
}
|
|
240
|
+
if (b.code === "invalid_union") {
|
|
241
|
+
return 1;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return 0;
|
|
245
|
+
});
|
|
246
|
+
let annotated;
|
|
247
|
+
const groupCounts = new GroupCountsMap();
|
|
248
|
+
for (const issue of sortedIssues) {
|
|
249
|
+
annotated = annotate(
|
|
250
|
+
groupCounts,
|
|
251
|
+
annotated,
|
|
252
|
+
input,
|
|
253
|
+
issue,
|
|
254
|
+
issue.path
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const inspectOptions = {
|
|
258
|
+
depth: 0,
|
|
259
|
+
colors: $.enabled
|
|
260
|
+
};
|
|
261
|
+
return print(inspectOptions, groupCounts, annotated);
|
|
262
|
+
}
|
|
263
|
+
__name(formatZodError, "formatZodError");
|
|
264
|
+
|
|
265
|
+
export { _forceColour, formatZodError };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __name } from './chunk-Q72B4Q5Z.mjs';
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
|
|
4
|
+
function isCompatDate(str) {
|
|
5
|
+
return /^\d{4}-\d{2}-\d{2}$/.test(str);
|
|
6
|
+
}
|
|
7
|
+
__name(isCompatDate, "isCompatDate");
|
|
8
|
+
function formatCompatibilityDate(date) {
|
|
9
|
+
const compatDate = date.toISOString().slice(0, 10);
|
|
10
|
+
assert(isCompatDate(compatDate));
|
|
11
|
+
return compatDate;
|
|
12
|
+
}
|
|
13
|
+
__name(formatCompatibilityDate, "formatCompatibilityDate");
|
|
14
|
+
function getTodaysCompatDate() {
|
|
15
|
+
return formatCompatibilityDate(/* @__PURE__ */ new Date());
|
|
16
|
+
}
|
|
17
|
+
__name(getTodaysCompatDate, "getTodaysCompatDate");
|
|
18
|
+
var NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
|
|
19
|
+
function isNodejsCompatDefaultOn(compatibilityDate) {
|
|
20
|
+
return compatibilityDate !== void 0 && compatibilityDate >= NODEJS_COMPAT_DEFAULT_ON_DATE;
|
|
21
|
+
}
|
|
22
|
+
__name(isNodejsCompatDefaultOn, "isNodejsCompatDefaultOn");
|
|
23
|
+
var NODEJS_COMPAT_V2_SWITCH_OVER_DATE = "2024-09-23";
|
|
24
|
+
function resolveNodejsCompat(compatibilityDate, compatibilityFlags) {
|
|
25
|
+
const isDefaultOn = isNodejsCompatDefaultOn(compatibilityDate);
|
|
26
|
+
const isNodejsCompatEnabled = compatibilityFlags.includes("nodejs_compat") || isDefaultOn && !compatibilityFlags.includes("no_nodejs_compat");
|
|
27
|
+
const isNodejsCompatV2Enabled = compatibilityFlags.includes("nodejs_compat_v2") || !compatibilityFlags.includes("no_nodejs_compat_v2") && (isDefaultOn || isNodejsCompatEnabled && compatibilityDate >= NODEJS_COMPAT_V2_SWITCH_OVER_DATE);
|
|
28
|
+
return { isNodejsCompatEnabled, isNodejsCompatV2Enabled };
|
|
29
|
+
}
|
|
30
|
+
__name(resolveNodejsCompat, "resolveNodejsCompat");
|
|
31
|
+
function stripRedundantNodejsCompatFlags(compatibilityDate, compatibilityFlags) {
|
|
32
|
+
if (!isNodejsCompatDefaultOn(compatibilityDate)) {
|
|
33
|
+
return compatibilityFlags;
|
|
34
|
+
}
|
|
35
|
+
const redundantFlags = ["nodejs_compat", "nodejs_compat_v2"].filter(
|
|
36
|
+
(flag) => !compatibilityFlags.includes(`no_${flag}`)
|
|
37
|
+
);
|
|
38
|
+
return compatibilityFlags.filter((flag) => !redundantFlags.includes(flag));
|
|
39
|
+
}
|
|
40
|
+
__name(stripRedundantNodejsCompatFlags, "stripRedundantNodejsCompatFlags");
|
|
41
|
+
|
|
42
|
+
export { NODEJS_COMPAT_DEFAULT_ON_DATE, NODEJS_COMPAT_V2_SWITCH_OVER_DATE, getTodaysCompatDate, isCompatDate, isNodejsCompatDefaultOn, resolveNodejsCompat, stripRedundantNodejsCompatFlags };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __name } from './chunk-Q72B4Q5Z.mjs';
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
|
|
4
|
+
function dedent(templ) {
|
|
5
|
+
var values = [];
|
|
6
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
7
|
+
values[_i - 1] = arguments[_i];
|
|
8
|
+
}
|
|
9
|
+
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
10
|
+
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
11
|
+
var indentLengths = strings.reduce(function(arr, str) {
|
|
12
|
+
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
13
|
+
if (matches) {
|
|
14
|
+
return arr.concat(matches.map(function(match) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
return arr;
|
|
20
|
+
}, []);
|
|
21
|
+
if (indentLengths.length) {
|
|
22
|
+
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
23
|
+
strings = strings.map(function(str) {
|
|
24
|
+
return str.replace(pattern_1, "\n");
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
28
|
+
var string = strings[0];
|
|
29
|
+
values.forEach(function(value, i) {
|
|
30
|
+
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
31
|
+
var endentation = endentations ? endentations[1] : "";
|
|
32
|
+
var indentedValue = value;
|
|
33
|
+
if (typeof value === "string" && value.includes("\n")) {
|
|
34
|
+
indentedValue = String(value).split("\n").map(function(str, i2) {
|
|
35
|
+
return i2 === 0 ? str : "" + endentation + str;
|
|
36
|
+
}).join("\n");
|
|
37
|
+
}
|
|
38
|
+
string += indentedValue + strings[i + 1];
|
|
39
|
+
});
|
|
40
|
+
return string;
|
|
41
|
+
}
|
|
42
|
+
__name(dedent, "dedent");
|
|
43
|
+
var esm_default = dedent;
|
|
44
|
+
|
|
45
|
+
export { dedent, esm_default };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { esm_default } from './chunk-MCNIGVAF.mjs';
|
|
2
|
+
import { UserError } from './chunk-WO2IAW6M.mjs';
|
|
1
3
|
import { __name } from './chunk-Q72B4Q5Z.mjs';
|
|
2
4
|
import { readFileSync as readFileSync$1, statSync, existsSync } from 'node:fs';
|
|
3
5
|
import path, { resolve, isAbsolute, dirname, join } from 'node:path';
|
|
@@ -8,15 +10,15 @@ function hasKnownExportType(entry) {
|
|
|
8
10
|
return type === "durable-object" || type === "worker";
|
|
9
11
|
}
|
|
10
12
|
__name(hasKnownExportType, "hasKnownExportType");
|
|
11
|
-
function partitionExports(exports) {
|
|
13
|
+
function partitionExports(exports$1) {
|
|
12
14
|
const partitioned = {
|
|
13
15
|
"durable-object": {},
|
|
14
16
|
worker: {}
|
|
15
17
|
};
|
|
16
|
-
if (exports === void 0) {
|
|
18
|
+
if (exports$1 === void 0) {
|
|
17
19
|
return partitioned;
|
|
18
20
|
}
|
|
19
|
-
for (const [name, entry] of Object.entries(exports)) {
|
|
21
|
+
for (const [name, entry] of Object.entries(exports$1)) {
|
|
20
22
|
if (!hasKnownExportType(entry)) {
|
|
21
23
|
continue;
|
|
22
24
|
}
|
|
@@ -27,20 +29,20 @@ function partitionExports(exports) {
|
|
|
27
29
|
__name(partitionExports, "partitionExports");
|
|
28
30
|
|
|
29
31
|
// src/config/durable-object-exports.ts
|
|
30
|
-
function getDurableObjectExports(exports) {
|
|
31
|
-
return partitionExports(exports)["durable-object"];
|
|
32
|
+
function getDurableObjectExports(exports$1) {
|
|
33
|
+
return partitionExports(exports$1)["durable-object"];
|
|
32
34
|
}
|
|
33
35
|
__name(getDurableObjectExports, "getDurableObjectExports");
|
|
34
|
-
function hasDurableObjectExports(exports) {
|
|
35
|
-
return Object.keys(getDurableObjectExports(exports)).length > 0;
|
|
36
|
+
function hasDurableObjectExports(exports$1) {
|
|
37
|
+
return Object.keys(getDurableObjectExports(exports$1)).length > 0;
|
|
36
38
|
}
|
|
37
39
|
__name(hasDurableObjectExports, "hasDurableObjectExports");
|
|
38
40
|
|
|
39
41
|
// src/config/containers.ts
|
|
40
|
-
function getContainerNameToClassNameMap(exports) {
|
|
42
|
+
function getContainerNameToClassNameMap(exports$1) {
|
|
41
43
|
const containerNameToClassName = /* @__PURE__ */ new Map();
|
|
42
44
|
for (const [className, entry] of Object.entries(
|
|
43
|
-
getDurableObjectExports(exports)
|
|
45
|
+
getDurableObjectExports(exports$1)
|
|
44
46
|
)) {
|
|
45
47
|
if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) {
|
|
46
48
|
containerNameToClassName.set(entry.container, className);
|
|
@@ -49,20 +51,20 @@ function getContainerNameToClassNameMap(exports) {
|
|
|
49
51
|
return containerNameToClassName;
|
|
50
52
|
}
|
|
51
53
|
__name(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
|
|
52
|
-
function resolveContainerClassName(container, exports) {
|
|
54
|
+
function resolveContainerClassName(container, exports$1) {
|
|
53
55
|
if (container.class_name !== void 0) {
|
|
54
56
|
return container.class_name;
|
|
55
57
|
}
|
|
56
58
|
if (container.name === void 0) {
|
|
57
59
|
return void 0;
|
|
58
60
|
}
|
|
59
|
-
return getContainerNameToClassNameMap(exports).get(container.name);
|
|
61
|
+
return getContainerNameToClassNameMap(exports$1).get(container.name);
|
|
60
62
|
}
|
|
61
63
|
__name(resolveContainerClassName, "resolveContainerClassName");
|
|
62
|
-
function getContainerDurableObjectClassNames(containers, exports) {
|
|
64
|
+
function getContainerDurableObjectClassNames(containers, exports$1) {
|
|
63
65
|
const classNames = /* @__PURE__ */ new Set();
|
|
64
66
|
for (const container of containers ?? []) {
|
|
65
|
-
const className = resolveContainerClassName(container, exports);
|
|
67
|
+
const className = resolveContainerClassName(container, exports$1);
|
|
66
68
|
if (className !== void 0) {
|
|
67
69
|
classNames.add(className);
|
|
68
70
|
}
|
|
@@ -71,65 +73,6 @@ function getContainerDurableObjectClassNames(containers, exports) {
|
|
|
71
73
|
}
|
|
72
74
|
__name(getContainerDurableObjectClassNames, "getContainerDurableObjectClassNames");
|
|
73
75
|
|
|
74
|
-
// src/errors.ts
|
|
75
|
-
var UserError = class extends Error {
|
|
76
|
-
static {
|
|
77
|
-
__name(this, "UserError");
|
|
78
|
-
}
|
|
79
|
-
telemetryMessage;
|
|
80
|
-
constructor(message, options) {
|
|
81
|
-
super(message, options);
|
|
82
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
83
|
-
this.telemetryMessage = typeof options?.telemetryMessage === "string" ? options.telemetryMessage : options?.telemetryMessage ? message : void 0;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var DeprecationError = class extends UserError {
|
|
87
|
-
static {
|
|
88
|
-
__name(this, "DeprecationError");
|
|
89
|
-
}
|
|
90
|
-
constructor(message, options) {
|
|
91
|
-
super(`Deprecation:
|
|
92
|
-
${message}`, options);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var FatalError = class extends UserError {
|
|
96
|
-
static {
|
|
97
|
-
__name(this, "FatalError");
|
|
98
|
-
}
|
|
99
|
-
code;
|
|
100
|
-
constructor(message, options) {
|
|
101
|
-
super(message, options);
|
|
102
|
-
this.code = options.code;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
var CommandLineArgsError = class extends UserError {
|
|
106
|
-
static {
|
|
107
|
-
__name(this, "CommandLineArgsError");
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
var JsonFriendlyFatalError = class extends FatalError {
|
|
111
|
-
static {
|
|
112
|
-
__name(this, "JsonFriendlyFatalError");
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
var MissingConfigError = class extends Error {
|
|
116
|
-
static {
|
|
117
|
-
__name(this, "MissingConfigError");
|
|
118
|
-
}
|
|
119
|
-
telemetryMessage;
|
|
120
|
-
constructor(key) {
|
|
121
|
-
super(`Missing config value for ${key}`);
|
|
122
|
-
this.telemetryMessage = `Missing config value for ${key}`;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
function createFatalError(message, isJson, options) {
|
|
126
|
-
if (isJson) {
|
|
127
|
-
return new JsonFriendlyFatalError(JSON.stringify(message), options);
|
|
128
|
-
}
|
|
129
|
-
return new FatalError(`${message}`, options);
|
|
130
|
-
}
|
|
131
|
-
__name(createFatalError, "createFatalError");
|
|
132
|
-
|
|
133
76
|
// ../../node_modules/.pnpm/jsonc-parser@3.2.0/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
134
77
|
function createScanner(text, ignoreTrivia = false) {
|
|
135
78
|
const len = text.length;
|
|
@@ -2789,48 +2732,6 @@ function dir(name, options) {
|
|
|
2789
2732
|
}
|
|
2790
2733
|
__name(dir, "dir");
|
|
2791
2734
|
|
|
2792
|
-
// ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js
|
|
2793
|
-
function dedent(templ) {
|
|
2794
|
-
var values = [];
|
|
2795
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
2796
|
-
values[_i - 1] = arguments[_i];
|
|
2797
|
-
}
|
|
2798
|
-
var strings = Array.from(typeof templ === "string" ? [templ] : templ);
|
|
2799
|
-
strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, "");
|
|
2800
|
-
var indentLengths = strings.reduce(function(arr, str) {
|
|
2801
|
-
var matches = str.match(/\n([\t ]+|(?!\s).)/g);
|
|
2802
|
-
if (matches) {
|
|
2803
|
-
return arr.concat(matches.map(function(match) {
|
|
2804
|
-
var _a, _b;
|
|
2805
|
-
return (_b = (_a = match.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
2806
|
-
}));
|
|
2807
|
-
}
|
|
2808
|
-
return arr;
|
|
2809
|
-
}, []);
|
|
2810
|
-
if (indentLengths.length) {
|
|
2811
|
-
var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
|
|
2812
|
-
strings = strings.map(function(str) {
|
|
2813
|
-
return str.replace(pattern_1, "\n");
|
|
2814
|
-
});
|
|
2815
|
-
}
|
|
2816
|
-
strings[0] = strings[0].replace(/^\r?\n/, "");
|
|
2817
|
-
var string = strings[0];
|
|
2818
|
-
values.forEach(function(value, i) {
|
|
2819
|
-
var endentations = string.match(/(?:^|\n)( *)$/);
|
|
2820
|
-
var endentation = endentations ? endentations[1] : "";
|
|
2821
|
-
var indentedValue = value;
|
|
2822
|
-
if (typeof value === "string" && value.includes("\n")) {
|
|
2823
|
-
indentedValue = String(value).split("\n").map(function(str, i2) {
|
|
2824
|
-
return i2 === 0 ? str : "" + endentation + str;
|
|
2825
|
-
}).join("\n");
|
|
2826
|
-
}
|
|
2827
|
-
string += indentedValue + strings[i + 1];
|
|
2828
|
-
});
|
|
2829
|
-
return string;
|
|
2830
|
-
}
|
|
2831
|
-
__name(dedent, "dedent");
|
|
2832
|
-
var esm_default = dedent;
|
|
2833
|
-
|
|
2834
2735
|
// src/config/config-helpers.ts
|
|
2835
2736
|
function resolveWranglerConfigPath({
|
|
2836
2737
|
config,
|
|
@@ -3254,4 +3155,4 @@ smol-toml/dist/index.js:
|
|
|
3254
3155
|
*)
|
|
3255
3156
|
*/
|
|
3256
3157
|
|
|
3257
|
-
export { APIError,
|
|
3158
|
+
export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, applyEdits, configFileName, configFormat, dir, dist_default, experimental_readRawConfig, findWranglerConfig, format2 as format, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, hasDurableObjectExports, indexLocation, isRedirectedConfig, isRedirectedRawConfig, modify, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation };
|