@nightintelligence/cloudflare-workers-utils 0.35.0-patch2 → 0.35.0-patch4

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.
Files changed (47) hide show
  1. package/dist/browser.mjs +2 -2
  2. package/dist/{chunk-NXPJWJ2B.mjs → chunk-47QFQIPP.mjs} +7 -7
  3. package/dist/{chunk-NXPJWJ2B.mjs.map → chunk-47QFQIPP.mjs.map} +1 -1
  4. package/dist/{chunk-OPAKTV2K.mjs → chunk-555CCIJE.mjs} +4 -4
  5. package/dist/{chunk-OPAKTV2K.mjs.map → chunk-555CCIJE.mjs.map} +1 -1
  6. package/dist/chunk-CGILA3WO.mjs +12 -0
  7. package/dist/{chunk-6LYDFTTF.mjs.map → chunk-CGILA3WO.mjs.map} +1 -1
  8. package/dist/{chunk-3D4BXUZX.mjs → chunk-FEHWZI5W.mjs} +3 -3
  9. package/dist/{chunk-3D4BXUZX.mjs.map → chunk-FEHWZI5W.mjs.map} +1 -1
  10. package/dist/{chunk-CPLEE7LH.mjs → chunk-KAEJMITB.mjs} +3 -3
  11. package/dist/{chunk-CPLEE7LH.mjs.map → chunk-KAEJMITB.mjs.map} +1 -1
  12. package/dist/{chunk-VKFVZ67V.mjs → chunk-T6I7NOR4.mjs} +3 -3
  13. package/dist/{chunk-VKFVZ67V.mjs.map → chunk-T6I7NOR4.mjs.map} +1 -1
  14. package/dist/{chunk-W7DIL5J2.mjs → chunk-VTOON473.mjs} +4 -34
  15. package/dist/chunk-VTOON473.mjs.map +1 -0
  16. package/dist/chunk-W4SU7D4X.mjs +575 -0
  17. package/dist/chunk-W4SU7D4X.mjs.map +1 -0
  18. package/dist/{chunk-IGC3TZGH.mjs → chunk-YTEYGQOX.mjs} +4 -4
  19. package/dist/{chunk-IGC3TZGH.mjs.map → chunk-YTEYGQOX.mjs.map} +1 -1
  20. package/dist/{chunk-ZQ2EZEOC.mjs → chunk-Z7Q743IF.mjs} +3 -3
  21. package/dist/{chunk-ZQ2EZEOC.mjs.map → chunk-Z7Q743IF.mjs.map} +1 -1
  22. package/dist/{chunk-ZLUHKBEC.mjs → chunk-ZZBYXY7A.mjs} +3 -3
  23. package/dist/{chunk-ZLUHKBEC.mjs.map → chunk-ZZBYXY7A.mjs.map} +1 -1
  24. package/dist/compatibility-date.mjs +2 -2
  25. package/dist/compliance.mjs +6 -7
  26. package/dist/docker-path.mjs +3 -3
  27. package/dist/errors.mjs +2 -2
  28. package/dist/fs-helpers.mjs +2 -2
  29. package/dist/global-wrangler-config-path.mjs +3 -3
  30. package/dist/index.mjs +402 -17128
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/local-env.mjs +3 -78
  33. package/dist/local-env.mjs.map +1 -1
  34. package/dist/metafile-esm.json +1 -1
  35. package/dist/prometheus-metrics.mjs +2 -2
  36. package/dist/test-helpers/index.mjs +4 -5
  37. package/dist/test-helpers/index.mjs.map +1 -1
  38. package/dist/zod-format.mjs +2 -2
  39. package/package.json +1 -1
  40. package/dist/chunk-4RE36JUD.mjs +0 -3160
  41. package/dist/chunk-4RE36JUD.mjs.map +0 -1
  42. package/dist/chunk-6LYDFTTF.mjs +0 -40
  43. package/dist/chunk-G5FCNCLK.mjs +0 -47
  44. package/dist/chunk-G5FCNCLK.mjs.map +0 -1
  45. package/dist/chunk-W7DIL5J2.mjs.map +0 -1
  46. package/dist/open-OYMIZX6T.mjs +0 -609
  47. package/dist/open-OYMIZX6T.mjs.map +0 -1
@@ -0,0 +1,575 @@
1
+ import { UserError } from './chunk-KAEJMITB.mjs';
2
+ import { __name } from './chunk-CGILA3WO.mjs';
3
+ import { readFileSync as readFileSync$1, existsSync } from 'node:fs';
4
+ import path, { resolve } from 'node:path';
5
+ import * as jsoncParser from 'jsonc-parser';
6
+ import TOML, { TomlError } from 'smol-toml';
7
+ import * as find from 'empathic/find';
8
+ import dedent from 'ts-dedent';
9
+
10
+ // src/config/exports.ts
11
+ function hasKnownExportType(entry) {
12
+ const type = entry?.type;
13
+ return type === "durable-object" || type === "worker";
14
+ }
15
+ __name(hasKnownExportType, "hasKnownExportType");
16
+ function partitionExports(exports$1) {
17
+ const partitioned = {
18
+ "durable-object": {},
19
+ worker: {}
20
+ };
21
+ if (exports$1 === void 0) {
22
+ return partitioned;
23
+ }
24
+ for (const [name, entry] of Object.entries(exports$1)) {
25
+ if (!hasKnownExportType(entry)) {
26
+ continue;
27
+ }
28
+ partitioned[entry.type][name] = entry;
29
+ }
30
+ return partitioned;
31
+ }
32
+ __name(partitionExports, "partitionExports");
33
+
34
+ // src/config/durable-object-exports.ts
35
+ function getDurableObjectExports(exports$1) {
36
+ return partitionExports(exports$1)["durable-object"];
37
+ }
38
+ __name(getDurableObjectExports, "getDurableObjectExports");
39
+ function hasDurableObjectExports(exports$1) {
40
+ return Object.keys(getDurableObjectExports(exports$1)).length > 0;
41
+ }
42
+ __name(hasDurableObjectExports, "hasDurableObjectExports");
43
+
44
+ // src/config/containers.ts
45
+ function getContainerNameToClassNameMap(exports$1) {
46
+ const containerNameToClassName = /* @__PURE__ */ new Map();
47
+ for (const [className, entry] of Object.entries(
48
+ getDurableObjectExports(exports$1)
49
+ )) {
50
+ if ("container" in entry && typeof entry.container === "string" && !containerNameToClassName.has(entry.container)) {
51
+ containerNameToClassName.set(entry.container, className);
52
+ }
53
+ }
54
+ return containerNameToClassName;
55
+ }
56
+ __name(getContainerNameToClassNameMap, "getContainerNameToClassNameMap");
57
+ function resolveContainerClassName(container, exports$1) {
58
+ if (container.class_name !== void 0) {
59
+ return container.class_name;
60
+ }
61
+ if (container.name === void 0) {
62
+ return void 0;
63
+ }
64
+ return getContainerNameToClassNameMap(exports$1).get(container.name);
65
+ }
66
+ __name(resolveContainerClassName, "resolveContainerClassName");
67
+ function getContainerDurableObjectClassNames(containers, exports$1) {
68
+ const classNames = /* @__PURE__ */ new Set();
69
+ for (const container of containers ?? []) {
70
+ const className = resolveContainerClassName(container, exports$1);
71
+ if (className !== void 0) {
72
+ classNames.add(className);
73
+ }
74
+ }
75
+ return classNames;
76
+ }
77
+ __name(getContainerDurableObjectClassNames, "getContainerDurableObjectClassNames");
78
+ var ParseError = class extends UserError {
79
+ static {
80
+ __name(this, "ParseError");
81
+ }
82
+ text;
83
+ notes;
84
+ location;
85
+ kind;
86
+ constructor({ text, notes, location, kind, telemetryMessage }) {
87
+ super(text, { telemetryMessage });
88
+ this.name = this.constructor.name;
89
+ this.text = text;
90
+ this.notes = notes ?? [];
91
+ this.location = location;
92
+ this.kind = kind ?? "error";
93
+ }
94
+ };
95
+ var APIError = class extends ParseError {
96
+ static {
97
+ __name(this, "APIError");
98
+ }
99
+ #status;
100
+ code;
101
+ accountTag;
102
+ /**
103
+ * Optional structured metadata hoisted from the first `FetchError.meta`
104
+ * on the v4 response envelope. Consumers can inspect this to render
105
+ * endpoint-specific structured error payloads.
106
+ */
107
+ meta;
108
+ /**
109
+ * Optional number of milliseconds the API asked us to wait before retrying,
110
+ * derived from the response's `Retry-After` header (if present).
111
+ */
112
+ retryAfterMs;
113
+ constructor({
114
+ status,
115
+ retryAfterMs,
116
+ ...rest
117
+ }) {
118
+ super(rest);
119
+ this.name = this.constructor.name;
120
+ this.#status = status;
121
+ this.retryAfterMs = retryAfterMs;
122
+ }
123
+ get status() {
124
+ return this.#status;
125
+ }
126
+ isGatewayError() {
127
+ if (this.#status !== void 0) {
128
+ return [524].includes(this.#status);
129
+ }
130
+ return false;
131
+ }
132
+ isRetryable() {
133
+ return String(this.#status).startsWith("5");
134
+ }
135
+ // Allow `APIError`s to be marked as handled.
136
+ #reportable = true;
137
+ get reportable() {
138
+ return this.#reportable;
139
+ }
140
+ preventReport() {
141
+ this.#reportable = false;
142
+ }
143
+ };
144
+ function parseTOML(tomlContent, filePath) {
145
+ try {
146
+ return TOML.parse(tomlContent);
147
+ } catch (err) {
148
+ if (!(err instanceof TomlError)) {
149
+ throw err;
150
+ }
151
+ const location = {
152
+ lineText: tomlContent.split("\n")[err.line - 1],
153
+ line: err.line,
154
+ column: err.column - 1,
155
+ file: filePath,
156
+ fileText: tomlContent
157
+ };
158
+ throw new ParseError({
159
+ text: err.message.substring(0, err.message.indexOf("\n")),
160
+ location,
161
+ telemetryMessage: "TOML parse error"
162
+ });
163
+ }
164
+ }
165
+ __name(parseTOML, "parseTOML");
166
+ function parsePackageJSON(input, file2) {
167
+ return parseJSON(input, file2);
168
+ }
169
+ __name(parsePackageJSON, "parsePackageJSON");
170
+ function parseJSON(input, file2) {
171
+ return parseJSONC(input, file2, {
172
+ allowEmptyContent: false,
173
+ allowTrailingComma: false,
174
+ disallowComments: true
175
+ });
176
+ }
177
+ __name(parseJSON, "parseJSON");
178
+ function parseJSONC(input, file2, options = { allowTrailingComma: true }) {
179
+ const errors = [];
180
+ const data = jsoncParser.parse(input, errors, options);
181
+ if (errors.length) {
182
+ throw new ParseError({
183
+ text: jsoncParser.printParseErrorCode(errors[0].error),
184
+ location: {
185
+ ...indexLocation({ file: file2, fileText: input }, errors[0].offset + 1),
186
+ length: errors[0].length
187
+ },
188
+ telemetryMessage: "JSON(C) parse error"
189
+ });
190
+ }
191
+ return data;
192
+ }
193
+ __name(parseJSONC, "parseJSONC");
194
+ function readFileSyncToBuffer(file2) {
195
+ try {
196
+ return readFileSync$1(file2);
197
+ } catch (err) {
198
+ const { message } = err;
199
+ throw new ParseError({
200
+ text: `Could not read file: ${file2}`,
201
+ notes: [
202
+ {
203
+ text: message.replace(file2, resolve(file2))
204
+ }
205
+ ],
206
+ telemetryMessage: false
207
+ });
208
+ }
209
+ }
210
+ __name(readFileSyncToBuffer, "readFileSyncToBuffer");
211
+ function readFileSync(file2) {
212
+ try {
213
+ const buffer = readFileSync$1(file2);
214
+ return removeBOMAndValidate(buffer, file2);
215
+ } catch (err) {
216
+ if (err instanceof ParseError) {
217
+ throw err;
218
+ }
219
+ const { message } = err;
220
+ throw new ParseError({
221
+ text: `Could not read file: ${file2}`,
222
+ notes: [
223
+ {
224
+ text: message.replace(file2, resolve(file2))
225
+ }
226
+ ],
227
+ telemetryMessage: "Could not read file"
228
+ });
229
+ }
230
+ }
231
+ __name(readFileSync, "readFileSync");
232
+ function indexLocation(file2, index) {
233
+ let lineText, line = 0, column = 0, cursor = 0;
234
+ const { fileText = "" } = file2;
235
+ for (const row of fileText.split("\n")) {
236
+ line++;
237
+ cursor += row.length + 1;
238
+ if (cursor >= index) {
239
+ lineText = row;
240
+ column = row.length - (cursor - index);
241
+ break;
242
+ }
243
+ }
244
+ return { lineText, line, column, ...file2 };
245
+ }
246
+ __name(indexLocation, "indexLocation");
247
+ function searchLocation(file2, query) {
248
+ let lineText, length, line = 0, column = 0;
249
+ const queryText = String(query);
250
+ const { fileText = "" } = file2;
251
+ for (const content of fileText.split("\n")) {
252
+ line++;
253
+ const index = content.indexOf(queryText);
254
+ if (index >= 0) {
255
+ lineText = content;
256
+ column = index;
257
+ length = queryText.length;
258
+ break;
259
+ }
260
+ }
261
+ return { lineText, line, column, length, ...file2 };
262
+ }
263
+ __name(searchLocation, "searchLocation");
264
+ var units = {
265
+ nanoseconds: 1e-9,
266
+ nanosecond: 1e-9,
267
+ microseconds: 1e-6,
268
+ microsecond: 1e-6,
269
+ milliseconds: 1e-3,
270
+ millisecond: 1e-3,
271
+ seconds: 1,
272
+ second: 1,
273
+ minutes: 60,
274
+ minute: 60,
275
+ hours: 3600,
276
+ hour: 3600,
277
+ days: 86400,
278
+ day: 86400,
279
+ weeks: 604800,
280
+ week: 604800,
281
+ month: 18144e3,
282
+ year: 220752e3,
283
+ nsecs: 1e-9,
284
+ nsec: 1e-9,
285
+ usecs: 1e-6,
286
+ usec: 1e-6,
287
+ msecs: 1e-3,
288
+ msec: 1e-3,
289
+ secs: 1,
290
+ sec: 1,
291
+ mins: 60,
292
+ min: 60,
293
+ ns: 1e-9,
294
+ us: 1e-6,
295
+ ms: 1e-3,
296
+ mo: 18144e3,
297
+ yr: 220752e3,
298
+ s: 1,
299
+ m: 60,
300
+ h: 3600,
301
+ d: 86400,
302
+ w: 604800,
303
+ y: 220752e3
304
+ };
305
+ function parseHumanDuration(s) {
306
+ const unitsMap = new Map(Object.entries(units));
307
+ s = s.trim().toLowerCase();
308
+ let base = 1;
309
+ for (const [name, _] of unitsMap) {
310
+ if (s.endsWith(name)) {
311
+ s = s.substring(0, s.length - name.length);
312
+ base = unitsMap.get(name) || 1;
313
+ break;
314
+ }
315
+ }
316
+ return Number(s) * base;
317
+ }
318
+ __name(parseHumanDuration, "parseHumanDuration");
319
+ function parseNonHyphenedUuid(uuid) {
320
+ if (uuid == null || uuid.includes("-")) {
321
+ return uuid;
322
+ }
323
+ if (uuid.length != 32) {
324
+ return null;
325
+ }
326
+ const uuid_parts = [];
327
+ uuid_parts.push(uuid.slice(0, 8));
328
+ uuid_parts.push(uuid.slice(8, 12));
329
+ uuid_parts.push(uuid.slice(12, 16));
330
+ uuid_parts.push(uuid.slice(16, 20));
331
+ uuid_parts.push(uuid.slice(20));
332
+ let hyphenated = "";
333
+ uuid_parts.forEach((part) => hyphenated += part + "-");
334
+ return hyphenated.slice(0, 36);
335
+ }
336
+ __name(parseNonHyphenedUuid, "parseNonHyphenedUuid");
337
+ function parseByteSize(s, base = void 0) {
338
+ const match = s.match(
339
+ /^(\d*\.*\d*)\s*([kKmMgGtTpP]{0,1})([i]{0,1}[bB]{0,1})$/
340
+ );
341
+ if (!match) {
342
+ return NaN;
343
+ }
344
+ const size = match[1];
345
+ if (size.length === 0 || isNaN(Number(size))) {
346
+ return NaN;
347
+ }
348
+ const unit = match[2].toLowerCase();
349
+ const sizeUnits = {
350
+ k: 1,
351
+ m: 2,
352
+ g: 3,
353
+ t: 4,
354
+ p: 5
355
+ };
356
+ if (unit.length !== 0 && !(unit in sizeUnits)) {
357
+ return NaN;
358
+ }
359
+ const binary = match[3].toLowerCase() == "ib";
360
+ if (binary && unit.length === 0) {
361
+ return NaN;
362
+ }
363
+ const pow = sizeUnits[unit] || 0;
364
+ return Math.floor(
365
+ Number(size) * Math.pow(base ?? (binary ? 1024 : 1e3), pow)
366
+ );
367
+ }
368
+ __name(parseByteSize, "parseByteSize");
369
+ var UNSUPPORTED_BOMS = [
370
+ {
371
+ buffer: Buffer.from([0, 0, 254, 255]),
372
+ encoding: "UTF-32 BE"
373
+ },
374
+ {
375
+ buffer: Buffer.from([255, 254, 0, 0]),
376
+ encoding: "UTF-32 LE"
377
+ },
378
+ {
379
+ buffer: Buffer.from([254, 255]),
380
+ encoding: "UTF-16 BE"
381
+ },
382
+ {
383
+ buffer: Buffer.from([255, 254]),
384
+ encoding: "UTF-16 LE"
385
+ }
386
+ ];
387
+ function removeBOMAndValidate(buffer, file2) {
388
+ for (const bom of UNSUPPORTED_BOMS) {
389
+ if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) {
390
+ throw new ParseError({
391
+ text: `Configuration file contains ${bom.encoding} byte order marker`,
392
+ notes: [
393
+ {
394
+ text: `The file "${file2}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`
395
+ }
396
+ ],
397
+ location: { file: file2, line: 1, column: 0 },
398
+ telemetryMessage: `${bom.encoding} BOM detected`
399
+ });
400
+ }
401
+ }
402
+ const content = buffer.toString("utf-8");
403
+ if (content.charCodeAt(0) === 65279) {
404
+ return content.slice(1);
405
+ }
406
+ return content;
407
+ }
408
+ __name(removeBOMAndValidate, "removeBOMAndValidate");
409
+
410
+ // src/constants.ts
411
+ var INHERIT_SYMBOL = Symbol.for("inherit_binding");
412
+ var SERVICE_TAG_PREFIX = "cf:service=";
413
+ var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
414
+ var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
415
+ var JSON_CONFIG_FORMATS = ["json", "jsonc"];
416
+ function resolveWranglerConfigPath({
417
+ config,
418
+ script
419
+ }, options) {
420
+ if (config !== void 0) {
421
+ return {
422
+ userConfigPath: config,
423
+ configPath: config,
424
+ deployConfigPath: void 0,
425
+ redirected: false
426
+ };
427
+ }
428
+ const leafPath = script !== void 0 ? path.dirname(script) : process.cwd();
429
+ return findWranglerConfig(leafPath, options);
430
+ }
431
+ __name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
432
+ function findWranglerConfig(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
433
+ const userConfigPath = find.file(`wrangler.json`, { cwd: referencePath }) ?? find.file(`wrangler.jsonc`, { cwd: referencePath }) ?? find.file(`wrangler.toml`, { cwd: referencePath });
434
+ if (!useRedirectIfAvailable) {
435
+ return {
436
+ userConfigPath,
437
+ configPath: userConfigPath,
438
+ deployConfigPath: void 0,
439
+ redirected: false
440
+ };
441
+ }
442
+ const { configPath, deployConfigPath, redirected } = findRedirectedWranglerConfig(referencePath, userConfigPath);
443
+ return {
444
+ userConfigPath,
445
+ configPath,
446
+ deployConfigPath,
447
+ redirected
448
+ };
449
+ }
450
+ __name(findWranglerConfig, "findWranglerConfig");
451
+ function findRedirectedWranglerConfig(cwd, userConfigPath) {
452
+ const deployConfigPath = find.file(PATH_TO_DEPLOY_CONFIG, { cwd });
453
+ if (deployConfigPath === void 0) {
454
+ return { configPath: userConfigPath, deployConfigPath, redirected: false };
455
+ }
456
+ let redirectedConfigPath;
457
+ const deployConfigFile = readFileSync(deployConfigPath);
458
+ try {
459
+ const deployConfig = parseJSONC(deployConfigFile, deployConfigPath);
460
+ redirectedConfigPath = deployConfig.configPath && path.resolve(path.dirname(deployConfigPath), deployConfig.configPath);
461
+ } catch (e) {
462
+ throw new UserError(
463
+ `Failed to parse the deploy configuration file at ${path.relative(".", deployConfigPath)}`,
464
+ { cause: e, telemetryMessage: false }
465
+ );
466
+ }
467
+ if (!redirectedConfigPath) {
468
+ throw new UserError(
469
+ dedent`
470
+ A deploy configuration file was found at "${path.relative(".", deployConfigPath)}".
471
+ But this is not valid - the required "configPath" property was not found.
472
+ Instead this file contains:
473
+ \`\`\`
474
+ ${deployConfigFile}
475
+ \`\`\`
476
+ `,
477
+ { telemetryMessage: false }
478
+ );
479
+ }
480
+ if (!existsSync(redirectedConfigPath)) {
481
+ throw new UserError(
482
+ dedent`
483
+ There is a deploy configuration at "${path.relative(".", deployConfigPath)}".
484
+ But the redirected configuration path it points to, "${path.relative(".", redirectedConfigPath)}", does not exist.
485
+ `,
486
+ { telemetryMessage: false }
487
+ );
488
+ }
489
+ if (userConfigPath) {
490
+ if (path.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !== deployConfigPath) {
491
+ throw new UserError(
492
+ dedent`
493
+ Found both a user configuration file at "${path.relative(".", userConfigPath)}"
494
+ and a deploy configuration file at "${path.relative(".", deployConfigPath)}".
495
+ But these do not share the same base path so it is not clear which should be used.
496
+ `,
497
+ { telemetryMessage: false }
498
+ );
499
+ }
500
+ }
501
+ return {
502
+ configPath: redirectedConfigPath,
503
+ deployConfigPath,
504
+ redirected: true
505
+ };
506
+ }
507
+ __name(findRedirectedWranglerConfig, "findRedirectedWranglerConfig");
508
+ function isRedirectedConfig(config) {
509
+ return config.configPath !== void 0 && config.configPath !== config.userConfigPath;
510
+ }
511
+ __name(isRedirectedConfig, "isRedirectedConfig");
512
+ function isRedirectedRawConfig(rawConfig, configPath, userConfigPath) {
513
+ return isRedirectedConfig({ configPath, userConfigPath });
514
+ }
515
+ __name(isRedirectedRawConfig, "isRedirectedRawConfig");
516
+ function configFormat(configPath) {
517
+ if (configPath?.endsWith("toml")) {
518
+ return "toml";
519
+ }
520
+ if (configPath?.endsWith("jsonc")) {
521
+ return "jsonc";
522
+ }
523
+ if (configPath?.endsWith("json")) {
524
+ return "json";
525
+ }
526
+ return "none";
527
+ }
528
+ __name(configFormat, "configFormat");
529
+ function configFileName(configPath) {
530
+ const format = configFormat(configPath);
531
+ switch (format) {
532
+ case "toml":
533
+ return "wrangler.toml";
534
+ case "json":
535
+ return "wrangler.json";
536
+ case "jsonc":
537
+ return "wrangler.jsonc";
538
+ default:
539
+ return "Wrangler configuration";
540
+ }
541
+ }
542
+ __name(configFileName, "configFileName");
543
+ function formatConfigSnippet(snippet, configPath, formatted = true) {
544
+ const format = configFormat(configPath);
545
+ if (format === "toml") {
546
+ return TOML.stringify(snippet);
547
+ } else {
548
+ return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
549
+ }
550
+ }
551
+ __name(formatConfigSnippet, "formatConfigSnippet");
552
+ var parseRawConfigFile = /* @__PURE__ */ __name((configPath) => {
553
+ if (configPath.endsWith(".toml")) {
554
+ return parseTOML(readFileSync(configPath), configPath);
555
+ }
556
+ if (configPath.endsWith(".json") || configPath.endsWith(".jsonc")) {
557
+ return parseJSONC(readFileSync(configPath), configPath);
558
+ }
559
+ return {};
560
+ }, "parseRawConfigFile");
561
+ var experimental_readRawConfig = /* @__PURE__ */ __name((args, options = {}) => {
562
+ const { configPath, userConfigPath, deployConfigPath, redirected } = resolveWranglerConfigPath(args, options);
563
+ const rawConfig = parseRawConfigFile(configPath ?? "");
564
+ return {
565
+ rawConfig,
566
+ configPath,
567
+ userConfigPath,
568
+ deployConfigPath,
569
+ redirected
570
+ };
571
+ }, "experimental_readRawConfig");
572
+
573
+ export { APIError, ENVIRONMENT_TAG_PREFIX, INHERIT_SYMBOL, JSON_CONFIG_FORMATS, PATH_TO_DEPLOY_CONFIG, ParseError, SERVICE_TAG_PREFIX, configFileName, configFormat, experimental_readRawConfig, findWranglerConfig, formatConfigSnippet, getContainerDurableObjectClassNames, getContainerNameToClassNameMap, getDurableObjectExports, hasDurableObjectExports, indexLocation, isRedirectedConfig, isRedirectedRawConfig, parseByteSize, parseHumanDuration, parseJSON, parseJSONC, parseNonHyphenedUuid, parsePackageJSON, parseTOML, partitionExports, readFileSync, readFileSyncToBuffer, resolveContainerClassName, resolveWranglerConfigPath, searchLocation };
574
+ //# sourceMappingURL=chunk-W4SU7D4X.mjs.map
575
+ //# sourceMappingURL=chunk-W4SU7D4X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/exports.ts","../src/config/durable-object-exports.ts","../src/config/containers.ts","../src/parse.ts","../src/constants.ts","../src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AAAA,IACN,SAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,gBAAA;AAAA,IACA;AAAA,GACD;AACD,CAAA,EAvB0C,4BAAA","file":"chunk-W4SU7D4X.mjs","sourcesContent":["import type {\n\tDurableObjectExport,\n\tExports,\n\tWorkerEntrypointExport,\n} from \"./environment\";\n\nexport type ExportType = Exports[string][\"type\"];\n\nexport interface PartitionedExports {\n\t\"durable-object\": Record<string, DurableObjectExport>;\n\tworker: Record<string, WorkerEntrypointExport>;\n}\n\n/**\n * Entries with an unknown `type`, and entries that are not objects at all, are\n * reported by config validation. This lets us skip them rather than crash, so\n * that callers can run against a config that has failed validation.\n */\nfunction hasKnownExportType(entry: unknown): entry is Exports[string] {\n\tconst type = (entry as Exports[string] | null | undefined)?.type;\n\treturn type === \"durable-object\" || type === \"worker\";\n}\n\nexport function partitionExports(\n\texports: Exports | undefined\n): PartitionedExports {\n\tconst partitioned: PartitionedExports = {\n\t\t\"durable-object\": {},\n\t\tworker: {},\n\t};\n\n\tif (exports === undefined) {\n\t\treturn partitioned;\n\t}\n\n\tfor (const [name, entry] of Object.entries(exports)) {\n\t\tif (!hasKnownExportType(entry)) {\n\t\t\tcontinue;\n\t\t}\n\t\tpartitioned[entry.type][name] = entry;\n\t}\n\n\treturn partitioned;\n}\n","import { partitionExports } from \"./exports\";\nimport type { Config } from \"./config\";\nimport type { DurableObjectExport } from \"./environment\";\n\n/**\n * Returns a map of exports that are only of type \"durable-object\".\n */\nexport function getDurableObjectExports(\n\texports: Config[\"exports\"] | undefined\n): Record<string, DurableObjectExport> {\n\treturn partitionExports(exports)[\"durable-object\"];\n}\n\nexport function hasDurableObjectExports(\n\texports: Config[\"exports\"] | undefined\n): boolean {\n\treturn Object.keys(getDurableObjectExports(exports)).length > 0;\n}\n","import { getDurableObjectExports } from \"./durable-object-exports\";\nimport type { ContainerApp, Exports } from \"./environment\";\n\n/**\n * A container can be linked to a Durable Object from either direction:\n *\n * - the container names the class via `containers[].class_name`, or\n * - the Durable Object names the container via `exports[Class].container`.\n *\n * This returns the second direction as a lookup of container name to Durable\n * Object class name. Only live `durable-object` exports can attach a container,\n * so tombstones are ignored.\n *\n * When two exports name the same container the first wins. That is a config\n * error caught during validation, so the choice only affects which class a\n * rejected config reports.\n */\nexport function getContainerNameToClassNameMap(\n\texports: Exports | undefined\n): Map<string, string> {\n\tconst containerNameToClassName = new Map<string, string>();\n\n\tfor (const [className, entry] of Object.entries(\n\t\tgetDurableObjectExports(exports)\n\t)) {\n\t\tif (\n\t\t\t\"container\" in entry &&\n\t\t\ttypeof entry.container === \"string\" &&\n\t\t\t!containerNameToClassName.has(entry.container)\n\t\t) {\n\t\t\tcontainerNameToClassName.set(entry.container, className);\n\t\t}\n\t}\n\n\treturn containerNameToClassName;\n}\n\n/**\n * The Durable Object class a container backs, resolved from either direction of\n * the container/Durable Object link.\n *\n * Returns `undefined` when the container is not linked to a Durable Object at\n * all, which validation rejects.\n */\nexport function resolveContainerClassName(\n\tcontainer: Pick<ContainerApp, \"class_name\" | \"name\">,\n\texports: Exports | undefined\n): string | undefined {\n\tif (container.class_name !== undefined) {\n\t\treturn container.class_name;\n\t}\n\tif (container.name === undefined) {\n\t\treturn undefined;\n\t}\n\treturn getContainerNameToClassNameMap(exports).get(container.name);\n}\n\n/**\n * The set of Durable Object class names that have a container attached, resolved\n * from either direction of the container/Durable Object link.\n */\nexport function getContainerDurableObjectClassNames(\n\tcontainers: ContainerApp[] | undefined,\n\texports: Exports | undefined\n): Set<string> {\n\tconst classNames = new Set<string>();\n\n\tfor (const container of containers ?? []) {\n\t\tconst className = resolveContainerClassName(container, exports);\n\t\tif (className !== undefined) {\n\t\t\tclassNames.add(className);\n\t\t}\n\t}\n\n\treturn classNames;\n}\n","import { readFileSync as fsReadFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport * as jsoncParser from \"jsonc-parser\";\nimport TOML, { TomlError } from \"smol-toml\";\nimport { UserError } from \"./errors\";\nimport type { TelemetryMessage } from \"./errors\";\nimport type { ParseError as JsoncParseError } from \"jsonc-parser\";\n\nexport type Message = {\n\ttext: string;\n\tlocation?: Location;\n\tnotes?: Message[];\n\tkind?: \"warning\" | \"error\";\n};\n\ntype MessageInit = Message & TelemetryMessage;\n\nexport type Location = ParseFile & {\n\tline: number;\n\tcolumn: number;\n\tlength?: number;\n\tlineText?: string;\n\tsuggestion?: string;\n};\n\nexport type ParseFile = {\n\tfile?: string;\n\tfileText?: string;\n};\n\n/**\n * An error that's thrown when something fails to parse.\n */\nexport class ParseError extends UserError implements Message {\n\treadonly text: string;\n\treadonly notes: Message[];\n\treadonly location?: Location;\n\treadonly kind: \"warning\" | \"error\";\n\n\tconstructor({ text, notes, location, kind, telemetryMessage }: MessageInit) {\n\t\tsuper(text, { telemetryMessage });\n\t\tthis.name = this.constructor.name;\n\t\tthis.text = text;\n\t\tthis.notes = notes ?? [];\n\t\tthis.location = location;\n\t\tthis.kind = kind ?? \"error\";\n\t}\n}\n\n// `ParseError`s shouldn't generally be reported to Sentry, but Wrangler has\n// relied on `ParseError` for any sort of error with additional notes.\n// In particular, API errors which we'd like to report are `ParseError`s.\n// Therefore, allow particular `ParseError`s to be marked `reportable`.\nexport class APIError extends ParseError {\n\t#status?: number;\n\tcode?: number;\n\taccountTag?: string;\n\t/**\n\t * Optional structured metadata hoisted from the first `FetchError.meta`\n\t * on the v4 response envelope. Consumers can inspect this to render\n\t * endpoint-specific structured error payloads.\n\t */\n\tmeta?: { details?: unknown } & Record<string, unknown>;\n\t/**\n\t * Optional number of milliseconds the API asked us to wait before retrying,\n\t * derived from the response's `Retry-After` header (if present).\n\t */\n\tretryAfterMs?: number;\n\n\tconstructor({\n\t\tstatus,\n\t\tretryAfterMs,\n\t\t...rest\n\t}: MessageInit & { status?: number; retryAfterMs?: number }) {\n\t\tsuper(rest);\n\t\tthis.name = this.constructor.name;\n\t\tthis.#status = status;\n\t\tthis.retryAfterMs = retryAfterMs;\n\t}\n\n\tget status(): number | undefined {\n\t\treturn this.#status;\n\t}\n\n\tisGatewayError() {\n\t\tif (this.#status !== undefined) {\n\t\t\treturn [524].includes(this.#status);\n\t\t}\n\t\treturn false;\n\t}\n\n\tisRetryable() {\n\t\treturn String(this.#status).startsWith(\"5\");\n\t}\n\n\t// Allow `APIError`s to be marked as handled.\n\t#reportable = true;\n\tget reportable() {\n\t\treturn this.#reportable;\n\t}\n\tpreventReport() {\n\t\tthis.#reportable = false;\n\t}\n}\n\n/**\n * Parses a TOML string to an object.\n *\n * Note: throws a `ParseError` if parsing fails.\n *\n * @param tomlContent The TOML content to parse.\n * @param filePath Optional file path for error reporting.\n * @returns The parsed TOML object.\n */\nexport function parseTOML(tomlContent: string, filePath?: string): unknown {\n\ttry {\n\t\treturn TOML.parse(tomlContent);\n\t} catch (err) {\n\t\tif (!(err instanceof TomlError)) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tconst location = {\n\t\t\tlineText: tomlContent.split(\"\\n\")[err.line - 1],\n\t\t\tline: err.line,\n\t\t\tcolumn: err.column - 1,\n\t\t\tfile: filePath,\n\t\t\tfileText: tomlContent,\n\t\t};\n\t\tthrow new ParseError({\n\t\t\ttext: err.message.substring(0, err.message.indexOf(\"\\n\")),\n\t\t\tlocation,\n\t\t\ttelemetryMessage: \"TOML parse error\",\n\t\t});\n\t}\n}\n\n/**\n * A minimal type describing a package.json file.\n */\nexport type PackageJSON = {\n\tname?: string;\n\tversion?: string;\n\tprivate?: boolean;\n\tdevDependencies?: Record<string, unknown>;\n\tdependencies?: Record<string, unknown>;\n\tscripts?: Record<string, unknown>;\n\t/**\n\t * NOTE: This is **not** a standard `package.json` field — don't confuse it\n\t * with the standard `bundledDependencies`. It is a convention introduced by\n\t * vite+ (https://viteplus.dev): vite+ installs `@voidzero-dev/vite-plus-core`\n\t * under the `vite` npm alias and records the versions of the tools it bundles\n\t * here, keyed by package name\n\t * (e.g. `{ \"vite\": \"8.1.2\", \"rolldown\": \"...\", \"tsdown\": \"...\" }`).\n\t *\n\t * We read it to recover the underlying Vite version when Vite is installed via\n\t * such an alias. It is optional and absent for the vast majority of packages.\n\t */\n\tbundledVersions?: Record<string, string | undefined>;\n};\n\n/**\n * A typed version of `parseJSON()`.\n */\nexport function parsePackageJSON(input: string, file?: string): PackageJSON {\n\treturn parseJSON(input, file) as PackageJSON;\n}\n\n/**\n * Parses JSON and throws a `ParseError`.\n */\nexport function parseJSON(input: string, file?: string): unknown {\n\treturn parseJSONC(input, file, {\n\t\tallowEmptyContent: false,\n\t\tallowTrailingComma: false,\n\t\tdisallowComments: true,\n\t});\n}\n\n/**\n * A wrapper around `JSONC.parse` that throws a `ParseError`.\n */\nexport function parseJSONC(\n\tinput: string,\n\tfile?: string,\n\toptions: jsoncParser.ParseOptions = { allowTrailingComma: true }\n): unknown {\n\tconst errors: JsoncParseError[] = [];\n\tconst data = jsoncParser.parse(input, errors, options);\n\tif (errors.length) {\n\t\tthrow new ParseError({\n\t\t\ttext: jsoncParser.printParseErrorCode(errors[0].error),\n\t\t\tlocation: {\n\t\t\t\t...indexLocation({ file, fileText: input }, errors[0].offset + 1),\n\t\t\t\tlength: errors[0].length,\n\t\t\t},\n\t\t\ttelemetryMessage: \"JSON(C) parse error\",\n\t\t});\n\t}\n\treturn data;\n}\n\n/**\n * Reads a file into a node Buffer.\n */\nexport function readFileSyncToBuffer(file: string): Buffer {\n\ttry {\n\t\treturn fsReadFileSync(file);\n\t} catch (err) {\n\t\tconst { message } = err as Error;\n\t\tthrow new ParseError({\n\t\t\ttext: `Could not read file: ${file}`,\n\t\t\tnotes: [\n\t\t\t\t{\n\t\t\t\t\ttext: message.replace(file, resolve(file)),\n\t\t\t\t},\n\t\t\t],\n\t\t\ttelemetryMessage: false,\n\t\t});\n\t}\n}\n\n/**\n * Reads a file and parses it based on its type.\n */\nexport function readFileSync(file: string): string {\n\ttry {\n\t\tconst buffer = fsReadFileSync(file);\n\t\treturn removeBOMAndValidate(buffer, file);\n\t} catch (err) {\n\t\tif (err instanceof ParseError) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tconst { message } = err as Error;\n\t\tthrow new ParseError({\n\t\t\ttext: `Could not read file: ${file}`,\n\t\t\tnotes: [\n\t\t\t\t{\n\t\t\t\t\ttext: message.replace(file, resolve(file)),\n\t\t\t\t},\n\t\t\t],\n\t\t\ttelemetryMessage: \"Could not read file\",\n\t\t});\n\t}\n}\n\n/**\n * Calculates the line and column location from an index.\n */\nexport function indexLocation(file: ParseFile, index: number): Location {\n\tlet lineText,\n\t\tline = 0,\n\t\tcolumn = 0,\n\t\tcursor = 0;\n\tconst { fileText = \"\" } = file;\n\tfor (const row of fileText.split(\"\\n\")) {\n\t\tline++;\n\t\tcursor += row.length + 1;\n\t\tif (cursor >= index) {\n\t\t\tlineText = row;\n\t\t\tcolumn = row.length - (cursor - index);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn { lineText, line, column, ...file };\n}\n\n/**\n * Guesses the line and column location of a search query.\n */\nexport function searchLocation(file: ParseFile, query: unknown): Location {\n\tlet lineText,\n\t\tlength,\n\t\tline = 0,\n\t\tcolumn = 0;\n\tconst queryText = String(query);\n\tconst { fileText = \"\" } = file;\n\tfor (const content of fileText.split(\"\\n\")) {\n\t\tline++;\n\t\tconst index = content.indexOf(queryText);\n\t\tif (index >= 0) {\n\t\t\tlineText = content;\n\t\t\tcolumn = index;\n\t\t\tlength = queryText.length;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn { lineText, line, column, length, ...file };\n}\n\nconst units = {\n\tnanoseconds: 0.000000001,\n\tnanosecond: 0.000000001,\n\tmicroseconds: 0.000001,\n\tmicrosecond: 0.000001,\n\tmilliseconds: 0.001,\n\tmillisecond: 0.001,\n\tseconds: 1,\n\tsecond: 1,\n\tminutes: 60,\n\tminute: 60,\n\thours: 3600,\n\thour: 3600,\n\tdays: 86400,\n\tday: 86400,\n\tweeks: 604800,\n\tweek: 604800,\n\tmonth: 18144000,\n\tyear: 220752000,\n\n\tnsecs: 0.000000001,\n\tnsec: 0.000000001,\n\tusecs: 0.000001,\n\tusec: 0.000001,\n\tmsecs: 0.001,\n\tmsec: 0.001,\n\tsecs: 1,\n\tsec: 1,\n\tmins: 60,\n\tmin: 60,\n\n\tns: 0.000000001,\n\tus: 0.000001,\n\tms: 0.001,\n\tmo: 18144000,\n\tyr: 220752000,\n\n\ts: 1,\n\tm: 60,\n\th: 3600,\n\td: 86400,\n\tw: 604800,\n\ty: 220752000,\n};\n\n/**\n * Parse a human-readable time duration in seconds (including fractional)\n *\n * Invalid values will return NaN\n */\nexport function parseHumanDuration(s: string): number {\n\tconst unitsMap = new Map(Object.entries(units));\n\ts = s.trim().toLowerCase();\n\tlet base = 1;\n\tfor (const [name, _] of unitsMap) {\n\t\tif (s.endsWith(name)) {\n\t\t\ts = s.substring(0, s.length - name.length);\n\t\t\tbase = unitsMap.get(name) || 1;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn Number(s) * base;\n}\n\nexport function parseNonHyphenedUuid(uuid: string | null): string | null {\n\tif (uuid == null || uuid.includes(\"-\")) {\n\t\treturn uuid;\n\t}\n\n\tif (uuid.length != 32) {\n\t\treturn null;\n\t}\n\n\tconst uuid_parts: string[] = [];\n\tuuid_parts.push(uuid.slice(0, 8));\n\tuuid_parts.push(uuid.slice(8, 12));\n\tuuid_parts.push(uuid.slice(12, 16));\n\tuuid_parts.push(uuid.slice(16, 20));\n\tuuid_parts.push(uuid.slice(20));\n\n\tlet hyphenated = \"\";\n\tuuid_parts.forEach((part) => (hyphenated += part + \"-\"));\n\n\treturn hyphenated.slice(0, 36);\n}\n\nexport function parseByteSize(\n\ts: string,\n\tbase: number | undefined = undefined\n): number {\n\tconst match = s.match(\n\t\t/^(\\d*\\.*\\d*)\\s*([kKmMgGtTpP]{0,1})([i]{0,1}[bB]{0,1})$/\n\t);\n\tif (!match) {\n\t\treturn NaN;\n\t}\n\n\tconst size = match[1];\n\tif (size.length === 0 || isNaN(Number(size))) {\n\t\treturn NaN;\n\t}\n\n\tconst unit = match[2].toLowerCase();\n\tconst sizeUnits = {\n\t\tk: 1,\n\t\tm: 2,\n\t\tg: 3,\n\t\tt: 4,\n\t\tp: 5,\n\t} as const;\n\tif (unit.length !== 0 && !(unit in sizeUnits)) {\n\t\treturn NaN;\n\t}\n\n\tconst binary = match[3].toLowerCase() == \"ib\";\n\tif (binary && unit.length === 0) {\n\t\t// Plain \"ib\" without a size unit is invalid\n\t\treturn NaN;\n\t}\n\n\tconst pow = sizeUnits[unit as keyof typeof sizeUnits] || 0;\n\n\treturn Math.floor(\n\t\tNumber(size) * Math.pow(base ?? (binary ? 1024 : 1000), pow)\n\t);\n}\n\nconst UNSUPPORTED_BOMS = [\n\t{\n\t\tbuffer: Buffer.from([0x00, 0x00, 0xfe, 0xff]),\n\t\tencoding: \"UTF-32 BE\",\n\t},\n\t{\n\t\tbuffer: Buffer.from([0xff, 0xfe, 0x00, 0x00]),\n\t\tencoding: \"UTF-32 LE\",\n\t},\n\t{\n\t\tbuffer: Buffer.from([0xfe, 0xff]),\n\t\tencoding: \"UTF-16 BE\",\n\t},\n\t{\n\t\tbuffer: Buffer.from([0xff, 0xfe]),\n\t\tencoding: \"UTF-16 LE\",\n\t},\n];\n\n/**\n * Removes UTF-8 BOM if present and validates that no other BOMs are present.\n * Throws ParseError for non-UTF-8 BOMs with descriptive error messages.\n */\nfunction removeBOMAndValidate(buffer: Buffer, file: string): string {\n\tfor (const bom of UNSUPPORTED_BOMS) {\n\t\tif (\n\t\t\tbuffer.length >= bom.buffer.length &&\n\t\t\tbuffer.subarray(0, bom.buffer.length).equals(bom.buffer)\n\t\t) {\n\t\t\tthrow new ParseError({\n\t\t\t\ttext: `Configuration file contains ${bom.encoding} byte order marker`,\n\t\t\t\tnotes: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: `The file \"${file}\" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tlocation: { file, line: 1, column: 0 },\n\t\t\t\ttelemetryMessage: `${bom.encoding} BOM detected`,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst content = buffer.toString(\"utf-8\");\n\n\tif (content.charCodeAt(0) === 0xfeff) {\n\t\treturn content.slice(1);\n\t}\n\n\treturn content;\n}\n","/**\n * A symbol to inherit a binding from the deployed worker.\n */\nexport const INHERIT_SYMBOL = Symbol.for(\"inherit_binding\");\n\nexport const SERVICE_TAG_PREFIX = \"cf:service=\";\nexport const ENVIRONMENT_TAG_PREFIX = \"cf:environment=\";\n\nexport const PATH_TO_DEPLOY_CONFIG = \".wrangler/deploy/config.json\";\n\n/**\n * Config formats that use JSON parsing\n */\nexport const JSON_CONFIG_FORMATS: readonly string[] = [\"json\", \"jsonc\"];\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport * as find from \"empathic/find\";\nimport dedent from \"ts-dedent\";\nimport { PATH_TO_DEPLOY_CONFIG } from \"../constants\";\nimport { UserError } from \"../errors\";\nimport { parseJSONC, readFileSync } from \"../parse\";\nimport type { ComputedFields, RawConfig, RedirectedRawConfig } from \"./config\";\n\nexport type ResolveConfigPathOptions = {\n\tuseRedirectIfAvailable?: boolean;\n};\n\nexport type ConfigPaths = {\n\t/** Absolute path to the actual configuration being used (possibly redirected from the user's config). */\n\tconfigPath: string | undefined;\n\t/** Absolute path to the user's configuration, which may not be the same as `configPath` if it was redirected. */\n\tuserConfigPath: string | undefined;\n\t/** Absolute path to the deploy config path used */\n\tdeployConfigPath: string | undefined;\n\t/** Was a redirected config file read? */\n\tredirected: boolean;\n};\n\n/**\n * Resolve the path to the configuration file, given the `config` and `script` optional command line arguments.\n * `config` takes precedence, then `script`, then we just use the cwd.\n *\n * Returns an object with two paths: `configPath` and `userConfigPath`. If defined these are absolute file paths.\n */\nexport function resolveWranglerConfigPath(\n\t{\n\t\tconfig,\n\t\tscript,\n\t}: {\n\t\tconfig?: string;\n\t\tscript?: string;\n\t},\n\toptions: { useRedirectIfAvailable?: boolean }\n): ConfigPaths {\n\tif (config !== undefined) {\n\t\treturn {\n\t\t\tuserConfigPath: config,\n\t\t\tconfigPath: config,\n\t\t\tdeployConfigPath: undefined,\n\t\t\tredirected: false,\n\t\t};\n\t}\n\n\tconst leafPath = script !== undefined ? path.dirname(script) : process.cwd();\n\n\treturn findWranglerConfig(leafPath, options);\n}\n\n/**\n * Find the wrangler configuration file by searching up the file-system\n * from the current working directory.\n */\nexport function findWranglerConfig(\n\treferencePath: string = process.cwd(),\n\t{ useRedirectIfAvailable = false } = {}\n): ConfigPaths {\n\tconst userConfigPath =\n\t\tfind.file(`wrangler.json`, { cwd: referencePath }) ??\n\t\tfind.file(`wrangler.jsonc`, { cwd: referencePath }) ??\n\t\tfind.file(`wrangler.toml`, { cwd: referencePath });\n\n\tif (!useRedirectIfAvailable) {\n\t\treturn {\n\t\t\tuserConfigPath,\n\t\t\tconfigPath: userConfigPath,\n\t\t\tdeployConfigPath: undefined,\n\t\t\tredirected: false,\n\t\t};\n\t}\n\n\tconst { configPath, deployConfigPath, redirected } =\n\t\tfindRedirectedWranglerConfig(referencePath, userConfigPath);\n\n\treturn {\n\t\tuserConfigPath,\n\t\tconfigPath,\n\t\tdeployConfigPath,\n\t\tredirected,\n\t};\n}\n\n/**\n * Check whether there is a configuration file that indicates that we should redirect the user configuration.\n * @param cwd\n * @param userConfigPath\n * @returns\n */\nfunction findRedirectedWranglerConfig(\n\tcwd: string,\n\tuserConfigPath: string | undefined\n): {\n\tconfigPath: string | undefined;\n\tdeployConfigPath: string | undefined;\n\tredirected: boolean;\n} {\n\tconst deployConfigPath = find.file(PATH_TO_DEPLOY_CONFIG, { cwd });\n\tif (deployConfigPath === undefined) {\n\t\treturn { configPath: userConfigPath, deployConfigPath, redirected: false };\n\t}\n\n\tlet redirectedConfigPath: string | undefined;\n\tconst deployConfigFile = readFileSync(deployConfigPath);\n\ttry {\n\t\tconst deployConfig = parseJSONC(deployConfigFile, deployConfigPath) as {\n\t\t\tconfigPath?: string;\n\t\t};\n\t\tredirectedConfigPath =\n\t\t\tdeployConfig.configPath &&\n\t\t\tpath.resolve(path.dirname(deployConfigPath), deployConfig.configPath);\n\t} catch (e) {\n\t\tthrow new UserError(\n\t\t\t`Failed to parse the deploy configuration file at ${path.relative(\".\", deployConfigPath)}`,\n\t\t\t{ cause: e, telemetryMessage: false }\n\t\t);\n\t}\n\tif (!redirectedConfigPath) {\n\t\tthrow new UserError(\n\t\t\tdedent`\n\t\t\tA deploy configuration file was found at \"${path.relative(\".\", deployConfigPath)}\".\n\t\t\tBut this is not valid - the required \"configPath\" property was not found.\n\t\t\tInstead this file contains:\n\t\t\t\\`\\`\\`\n\t\t\t${deployConfigFile}\n\t\t\t\\`\\`\\`\n\t\t`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n\n\tif (!existsSync(redirectedConfigPath)) {\n\t\tthrow new UserError(\n\t\t\tdedent`\n\t\t\t\tThere is a deploy configuration at \"${path.relative(\".\", deployConfigPath)}\".\n\t\t\t\tBut the redirected configuration path it points to, \"${path.relative(\".\", redirectedConfigPath)}\", does not exist.\n\t\t\t`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n\tif (userConfigPath) {\n\t\tif (\n\t\t\tpath.join(path.dirname(userConfigPath), PATH_TO_DEPLOY_CONFIG) !==\n\t\t\tdeployConfigPath\n\t\t) {\n\t\t\tthrow new UserError(\n\t\t\t\tdedent`\n\t\t\t\t\tFound both a user configuration file at \"${path.relative(\".\", userConfigPath)}\"\n\t\t\t\t\tand a deploy configuration file at \"${path.relative(\".\", deployConfigPath)}\".\n\t\t\t\t\tBut these do not share the same base path so it is not clear which should be used.\n\t\t\t\t`,\n\t\t\t\t{ telemetryMessage: false }\n\t\t\t);\n\t\t}\n\t}\n\n\treturn {\n\t\tconfigPath: redirectedConfigPath,\n\t\tdeployConfigPath,\n\t\tredirected: true,\n\t};\n}\n\nexport function isRedirectedConfig(\n\tconfig: Pick<ComputedFields, \"configPath\" | \"userConfigPath\">\n): boolean {\n\treturn (\n\t\tconfig.configPath !== undefined &&\n\t\tconfig.configPath !== config.userConfigPath\n\t);\n}\n\nexport function isRedirectedRawConfig(\n\trawConfig: RawConfig,\n\tconfigPath: string | undefined,\n\tuserConfigPath: string | undefined\n): rawConfig is RedirectedRawConfig {\n\treturn isRedirectedConfig({ configPath, userConfigPath });\n}\n","import TOML from \"smol-toml\";\nimport { parseJSONC, parseTOML, readFileSync } from \"../parse\";\nimport { resolveWranglerConfigPath } from \"./config-helpers\";\nimport type { Config, RawConfig } from \"./config\";\nimport type { ResolveConfigPathOptions } from \"./config-helpers\";\nimport type { NormalizeAndValidateConfigArgs } from \"./validation\";\n\nexport type {\n\tConfig,\n\tConfigFields,\n\tDevConfig,\n\tRawConfig,\n\tRawDevConfig,\n} from \"./config\";\n\nexport type ConfigBindingOptions = Pick<\n\tConfig,\n\t| \"ai\"\n\t| \"browser\"\n\t| \"d1_databases\"\n\t| \"dispatch_namespaces\"\n\t| \"durable_objects\"\n\t| \"queues\"\n\t| \"r2_buckets\"\n\t| \"services\"\n\t| \"kv_namespaces\"\n\t| \"mtls_certificates\"\n\t| \"vectorize\"\n\t| \"workflows\"\n\t| \"vpc_services\"\n>;\nexport type {\n\tCacheOptions,\n\tConfiguredExport,\n\tConfigModuleRuleType,\n\tEnvironment,\n\tPreviewsConfig,\n\tRawEnvironment,\n\tWorkerEntrypointExport,\n} from \"./environment\";\nexport { partitionExports } from \"./exports\";\nexport type { ExportType, PartitionedExports } from \"./exports\";\nexport {\n\tgetContainerDurableObjectClassNames,\n\tgetContainerNameToClassNameMap,\n\tresolveContainerClassName,\n} from \"./containers\";\n\nexport function configFormat(\n\tconfigPath: string | undefined\n): \"json\" | \"jsonc\" | \"toml\" | \"none\" {\n\tif (configPath?.endsWith(\"toml\")) {\n\t\treturn \"toml\";\n\t}\n\tif (configPath?.endsWith(\"jsonc\")) {\n\t\treturn \"jsonc\";\n\t}\n\tif (configPath?.endsWith(\"json\")) {\n\t\treturn \"json\";\n\t}\n\treturn \"none\";\n}\n\nexport function configFileName(configPath: string | undefined) {\n\tconst format = configFormat(configPath);\n\tswitch (format) {\n\t\tcase \"toml\":\n\t\t\treturn \"wrangler.toml\";\n\t\tcase \"json\":\n\t\t\treturn \"wrangler.json\";\n\t\tcase \"jsonc\":\n\t\t\treturn \"wrangler.jsonc\";\n\t\tdefault:\n\t\t\treturn \"Wrangler configuration\";\n\t}\n}\n\nexport function formatConfigSnippet(\n\tsnippet: RawConfig,\n\tconfigPath: Config[\"configPath\"],\n\tformatted = true\n) {\n\tconst format = configFormat(configPath);\n\tif (format === \"toml\") {\n\t\treturn TOML.stringify(snippet);\n\t} else {\n\t\treturn formatted\n\t\t\t? JSON.stringify(snippet, null, 2)\n\t\t\t: JSON.stringify(snippet);\n\t}\n}\n\nexport const sharedResourceCreationArgs = {\n\t\"use-remote\": {\n\t\ttype: \"boolean\",\n\t\tdescription:\n\t\t\t\"Use a remote binding when adding the newly created resource to your config\",\n\t},\n\t\"update-config\": {\n\t\ttype: \"boolean\",\n\t\tdescription:\n\t\t\t\"Automatically update your config file with the newly added resource\",\n\t},\n\tbinding: {\n\t\ttype: \"string\",\n\t\tdescription: \"The binding name of this resource in your Worker\",\n\t},\n} as const;\n\nexport type ReadConfigCommandArgs = NormalizeAndValidateConfigArgs & {\n\tconfig?: string;\n\tscript?: string;\n};\n\nexport type ReadConfigOptions = ResolveConfigPathOptions & {\n\thideWarnings?: boolean;\n\t// Used by the Vite plugin\n\t// If set to `true`, the `main` field is not converted to an absolute path\n\tpreserveOriginalMain?: boolean;\n};\n\nconst parseRawConfigFile = (configPath: string): RawConfig => {\n\tif (configPath.endsWith(\".toml\")) {\n\t\treturn parseTOML(readFileSync(configPath), configPath) as RawConfig;\n\t}\n\n\tif (configPath.endsWith(\".json\") || configPath.endsWith(\".jsonc\")) {\n\t\treturn parseJSONC(readFileSync(configPath), configPath) as RawConfig;\n\t}\n\n\treturn {};\n};\n\nexport const experimental_readRawConfig = (\n\targs: ReadConfigCommandArgs,\n\toptions: ReadConfigOptions = {}\n): {\n\trawConfig: RawConfig;\n\tconfigPath: string | undefined;\n\tuserConfigPath: string | undefined;\n\tdeployConfigPath: string | undefined;\n\tredirected: boolean;\n} => {\n\t// Load the configuration from disk if available\n\tconst { configPath, userConfigPath, deployConfigPath, redirected } =\n\t\tresolveWranglerConfigPath(args, options);\n\n\tconst rawConfig = parseRawConfigFile(configPath ?? \"\");\n\n\treturn {\n\t\trawConfig,\n\t\tconfigPath,\n\t\tuserConfigPath,\n\t\tdeployConfigPath,\n\t\tredirected,\n\t};\n};\n"]}