@nightintelligence/cloudflare-workers-utils 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/README.md +5 -0
- package/dist/browser.d.mts +47 -0
- package/dist/browser.mjs +4 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/chunk-3D4BXUZX.mjs +54 -0
- package/dist/chunk-3D4BXUZX.mjs.map +1 -0
- package/dist/chunk-4RE36JUD.mjs +3160 -0
- package/dist/chunk-4RE36JUD.mjs.map +1 -0
- package/dist/chunk-6LYDFTTF.mjs +40 -0
- package/dist/chunk-6LYDFTTF.mjs.map +1 -0
- package/dist/chunk-CPLEE7LH.mjs +64 -0
- package/dist/chunk-CPLEE7LH.mjs.map +1 -0
- package/dist/chunk-G5FCNCLK.mjs +47 -0
- package/dist/chunk-G5FCNCLK.mjs.map +1 -0
- package/dist/chunk-IGC3TZGH.mjs +157 -0
- package/dist/chunk-IGC3TZGH.mjs.map +1 -0
- package/dist/chunk-NXPJWJ2B.mjs +180 -0
- package/dist/chunk-NXPJWJ2B.mjs.map +1 -0
- package/dist/chunk-OPAKTV2K.mjs +75 -0
- package/dist/chunk-OPAKTV2K.mjs.map +1 -0
- package/dist/chunk-VKFVZ67V.mjs +35 -0
- package/dist/chunk-VKFVZ67V.mjs.map +1 -0
- package/dist/chunk-W7DIL5J2.mjs +267 -0
- package/dist/chunk-W7DIL5J2.mjs.map +1 -0
- package/dist/chunk-ZLUHKBEC.mjs +44 -0
- package/dist/chunk-ZLUHKBEC.mjs.map +1 -0
- package/dist/chunk-ZQ2EZEOC.mjs +477 -0
- package/dist/chunk-ZQ2EZEOC.mjs.map +1 -0
- package/dist/compatibility-date.d.mts +80 -0
- package/dist/compatibility-date.mjs +4 -0
- package/dist/compatibility-date.mjs.map +1 -0
- package/dist/compliance-j3-tqeao.d.mts +3616 -0
- package/dist/compliance.d.mts +4 -0
- package/dist/compliance.mjs +9 -0
- package/dist/compliance.mjs.map +1 -0
- package/dist/docker-path.d.mts +8 -0
- package/dist/docker-path.mjs +5 -0
- package/dist/docker-path.mjs.map +1 -0
- package/dist/errors.d.mts +55 -0
- package/dist/errors.mjs +4 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/fs-helpers.d.mts +40 -0
- package/dist/fs-helpers.mjs +4 -0
- package/dist/fs-helpers.mjs.map +1 -0
- package/dist/global-wrangler-config-path.d.mts +35 -0
- package/dist/global-wrangler-config-path.mjs +5 -0
- package/dist/global-wrangler-config-path.mjs.map +1 -0
- package/dist/index.d.mts +1263 -0
- package/dist/index.mjs +26282 -0
- package/dist/index.mjs.map +1 -0
- package/dist/local-env.d.mts +54 -0
- package/dist/local-env.mjs +178 -0
- package/dist/local-env.mjs.map +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/open-OYMIZX6T.mjs +609 -0
- package/dist/open-OYMIZX6T.mjs.map +1 -0
- package/dist/prometheus-metrics.d.mts +50 -0
- package/dist/prometheus-metrics.mjs +4 -0
- package/dist/prometheus-metrics.mjs.map +1 -0
- package/dist/test-helpers/index.d.mts +46 -0
- package/dist/test-helpers/index.mjs +310 -0
- package/dist/test-helpers/index.mjs.map +1 -0
- package/dist/zod-format.d.mts +6 -0
- package/dist/zod-format.mjs +4 -0
- package/dist/zod-format.mjs.map +1 -0
- package/package.json +126 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
|
|
38
|
+
export { __commonJS, __export, __name, __require, __toESM };
|
|
39
|
+
//# sourceMappingURL=chunk-6LYDFTTF.mjs.map
|
|
40
|
+
//# sourceMappingURL=chunk-6LYDFTTF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-6LYDFTTF.mjs"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { __name } from './chunk-6LYDFTTF.mjs';
|
|
2
|
+
|
|
3
|
+
// src/errors.ts
|
|
4
|
+
var UserError = class extends Error {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "UserError");
|
|
7
|
+
}
|
|
8
|
+
telemetryMessage;
|
|
9
|
+
constructor(message, options) {
|
|
10
|
+
super(message, options);
|
|
11
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
12
|
+
this.telemetryMessage = typeof options?.telemetryMessage === "string" ? options.telemetryMessage : options?.telemetryMessage ? message : void 0;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var DeprecationError = class extends UserError {
|
|
16
|
+
static {
|
|
17
|
+
__name(this, "DeprecationError");
|
|
18
|
+
}
|
|
19
|
+
constructor(message, options) {
|
|
20
|
+
super(`Deprecation:
|
|
21
|
+
${message}`, options);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var FatalError = class extends UserError {
|
|
25
|
+
static {
|
|
26
|
+
__name(this, "FatalError");
|
|
27
|
+
}
|
|
28
|
+
code;
|
|
29
|
+
constructor(message, options) {
|
|
30
|
+
super(message, options);
|
|
31
|
+
this.code = options.code;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var CommandLineArgsError = class extends UserError {
|
|
35
|
+
static {
|
|
36
|
+
__name(this, "CommandLineArgsError");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var JsonFriendlyFatalError = class extends FatalError {
|
|
40
|
+
static {
|
|
41
|
+
__name(this, "JsonFriendlyFatalError");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var MissingConfigError = class extends Error {
|
|
45
|
+
static {
|
|
46
|
+
__name(this, "MissingConfigError");
|
|
47
|
+
}
|
|
48
|
+
telemetryMessage;
|
|
49
|
+
constructor(key) {
|
|
50
|
+
super(`Missing config value for ${key}`);
|
|
51
|
+
this.telemetryMessage = `Missing config value for ${key}`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function createFatalError(message, isJson, options) {
|
|
55
|
+
if (isJson) {
|
|
56
|
+
return new JsonFriendlyFatalError(JSON.stringify(message), options);
|
|
57
|
+
}
|
|
58
|
+
return new FatalError(`${message}`, options);
|
|
59
|
+
}
|
|
60
|
+
__name(createFatalError, "createFatalError");
|
|
61
|
+
|
|
62
|
+
export { CommandLineArgsError, DeprecationError, FatalError, JsonFriendlyFatalError, MissingConfigError, UserError, createFatalError };
|
|
63
|
+
//# sourceMappingURL=chunk-CPLEE7LH.mjs.map
|
|
64
|
+
//# sourceMappingURL=chunk-CPLEE7LH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;AAoBO,IAAM,SAAA,GAAN,cAAwB,KAAA,CAAM;AAAA,EApBrC;AAoBqC,IAAA,MAAA,CAAA,IAAA,EAAA,WAAA,CAAA;AAAA;AAAA,EACpC,gBAAA;AAAA,EACA,WAAA,CAAY,SAAiB,OAAA,EAA2B;AACvD,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AAGtB,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,GAAA,CAAA,MAAA,CAAW,SAAS,CAAA;AAChD,IAAA,IAAA,CAAK,gBAAA,GACJ,OAAO,OAAA,EAAS,gBAAA,KAAqB,WAClC,OAAA,CAAQ,gBAAA,GACR,OAAA,EAAS,gBAAA,GACR,OAAA,GACA,MAAA;AAAA,EACN;AACD;AAEO,IAAM,gBAAA,GAAN,cAA+B,SAAA,CAAU;AAAA,EApChD;AAoCgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA,EAC/C,WAAA,CAAY,SAAiB,OAAA,EAA2B;AACvD,IAAA,KAAA,CAAM,CAAA;AAAA,EAAiB,OAAO,IAAI,OAAO,CAAA;AAAA,EAC1C;AACD;AAEO,IAAM,UAAA,GAAN,cAAyB,SAAA,CAAU;AAAA,EA1C1C;AA0C0C,IAAA,MAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AAAA;AAAA,EAChC,IAAA;AAAA,EAET,WAAA,CAAY,SAAiB,OAAA,EAA4B;AACxD,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AACtB,IAAA,IAAA,CAAK,OAAO,OAAA,CAAQ,IAAA;AAAA,EACrB;AACD;AAEO,IAAM,oBAAA,GAAN,cAAmC,SAAA,CAAU;AAAA,EAnDpD;AAmDoD,IAAA,MAAA,CAAA,IAAA,EAAA,sBAAA,CAAA;AAAA;AAAC;AAY9C,IAAM,sBAAA,GAAN,cAAqC,UAAA,CAAW;AAAA,EA/DvD;AA+DuD,IAAA,MAAA,CAAA,IAAA,EAAA,wBAAA,CAAA;AAAA;AAAC;AAEjD,IAAM,kBAAA,GAAN,cAAiC,KAAA,CAAM;AAAA,EAjE9C;AAiE8C,IAAA,MAAA,CAAA,IAAA,EAAA,oBAAA,CAAA;AAAA;AAAA,EAC7C,gBAAA;AAAA,EACA,YAAY,GAAA,EAAa;AACxB,IAAA,KAAA,CAAM,CAAA,yBAAA,EAA4B,GAAG,CAAA,CAAE,CAAA;AACvC,IAAA,IAAA,CAAK,gBAAA,GAAmB,4BAA4B,GAAG,CAAA,CAAA;AAAA,EACxD;AACD;AAOO,SAAS,gBAAA,CACf,OAAA,EACA,MAAA,EACA,OAAA,EACQ;AACR,EAAA,IAAI,MAAA,EAAQ;AACX,IAAA,OAAO,IAAI,sBAAA,CAAuB,IAAA,CAAK,SAAA,CAAU,OAAO,GAAG,OAAO,CAAA;AAAA,EACnE;AAEA,EAAA,OAAO,IAAI,UAAA,CAAW,CAAA,EAAG,OAAO,IAAI,OAAO,CAAA;AAC5C;AAVgB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA","file":"chunk-CPLEE7LH.mjs","sourcesContent":["/**\n * This is used to provide telemetry with a sanitised error\n * message that could not have any user-identifying information.\n * Set to `true` to duplicate `message`.\n * */\nexport type TelemetryMessage = {\n\ttelemetryMessage: string | boolean;\n};\n\ntype UserErrorOptions = ErrorOptions & TelemetryMessage;\n\ntype FatalErrorOptions = UserErrorOptions & {\n\tcode?: number;\n};\n/**\n * Base class for errors where the user has done something wrong. These are not\n * reported to Sentry. API errors are intentionally *not* `UserError`s, and are\n * reported to Sentry. This will help us understand which API errors need better\n * messaging.\n */\nexport class UserError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(message: string, options: UserErrorOptions) {\n\t\tsuper(message, options);\n\t\t// Restore prototype chain:\n\t\t// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget\n\t\tObject.setPrototypeOf(this, new.target.prototype);\n\t\tthis.telemetryMessage =\n\t\t\ttypeof options?.telemetryMessage === \"string\"\n\t\t\t\t? options.telemetryMessage\n\t\t\t\t: options?.telemetryMessage\n\t\t\t\t\t? message\n\t\t\t\t\t: undefined;\n\t}\n}\n\nexport class DeprecationError extends UserError {\n\tconstructor(message: string, options: TelemetryMessage) {\n\t\tsuper(`Deprecation:\\n${message}`, options);\n\t}\n}\n\nexport class FatalError extends UserError {\n\treadonly code: number | undefined;\n\n\tconstructor(message: string, options: FatalErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options.code;\n\t}\n}\n\nexport class CommandLineArgsError extends UserError {}\n\n/**\n * JsonFriendlyFatalError is used to output JSON when wrangler crashes, useful for --json mode.\n *\n * To use, pass stringify'd json into the constructor like so:\n * ```js\n * throw new JsonFriendlyFatalError(JSON.stringify({ error: messageToDisplay }), {\n * telemetryMessage: false,\n * });\n * ```\n */\nexport class JsonFriendlyFatalError extends FatalError {}\n\nexport class MissingConfigError extends Error {\n\ttelemetryMessage: string | undefined;\n\tconstructor(key: string) {\n\t\tsuper(`Missing config value for ${key}`);\n\t\tthis.telemetryMessage = `Missing config value for ${key}`;\n\t}\n}\n\n/**\n * Create either a FatalError or JsonFriendlyFatalError depending upon `isJson` parameter.\n *\n * If `isJson` is true, then the `message` is JSON stringified.\n */\nexport function createFatalError(\n\tmessage: unknown,\n\tisJson: boolean,\n\toptions: FatalErrorOptions\n): Error {\n\tif (isJson) {\n\t\treturn new JsonFriendlyFatalError(JSON.stringify(message), options);\n\t}\n\n\treturn new FatalError(`${message}`, options);\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __name } from './chunk-6LYDFTTF.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 };
|
|
46
|
+
//# sourceMappingURL=chunk-G5FCNCLK.mjs.map
|
|
47
|
+
//# sourceMappingURL=chunk-G5FCNCLK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/src/index.ts"],"names":["i"],"mappings":";;;AAAM,SAAU,OACd,KAAA,EAAoC;AACpC,EAAA,IAAA,SAAA,EAAA;AAAA,EAAA,KAAA,IAAA,EAAA,GAAA,CAAA,EAAA,EAAA,GAAA,SAAA,CAAA,MAAA,EAAA,EAAA,EAAA,EAAoB;AAApB,IAAA,MAAA,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,EAAA,CAAA;;AAEA,EAAA,IAAI,OAAA,GAAU,MAAM,IAAA,CAAK,OAAO,UAAU,QAAA,GAAW,CAAC,KAAK,CAAA,GAAI,KAAK,CAAA;AAGpE,EAAA,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA,GAAI,OAAA,CAAQ,OAAA,CAAQ,MAAA,GAAS,CAAC,CAAA,CAAE,OAAA,CACxD,gBAAA,EACA,EAAE,CAAA;AAIJ,EAAA,IAAM,aAAA,GAAgB,OAAA,CAAQ,MAAA,CAAO,SAAC,KAAK,GAAA,EAAG;AAC5C,IAAA,IAAM,OAAA,GAAU,GAAA,CAAI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A;AAEpB,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,QAAA,CAAS,IAAI,CAAA,EAAG;AACrD,MAAA,aAAA,GAAgB,MAAA,CAAO,KAAK,CAAA,CACzB,KAAA,CAAM,IAAI,CAAA,CACV,GAAA,CAAI,SAAC,GAAA,EAAKA,EAAAA,EAAC;AACV,QAAA,OAAOA,EAAAA,KAAM,CAAA,GAAI,GAAA,GAAM,EAAA,GAAG,WAAA,GAAc,GAAA;MAC1C,CAAC,CAAA,CACA,KAAK,IAAI,CAAA;;AAGd,IAAA,MAAA,IAAU,aAAA,GAAgB,OAAA,CAAQ,CAAA,GAAI,CAAC,CAAA;EACzC,CAAC,CAAA;AAED,EAAA,OAAO,MAAA;AACT;AAvDgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA;AAyDhB,IAAA,WAAA,GAAe","file":"chunk-G5FCNCLK.mjs","sourcesContent":["export function dedent(\n templ: TemplateStringsArray | string,\n ...values: unknown[]\n): string {\n let strings = Array.from(typeof templ === 'string' ? [templ] : templ);\n\n // 1. Remove trailing whitespace.\n strings[strings.length - 1] = strings[strings.length - 1].replace(\n /\\r?\\n([\\t ]*)$/,\n '',\n );\n\n // 2. Find all line breaks to determine the highest common indentation level.\n const indentLengths = strings.reduce((arr, str) => {\n const matches = str.match(/\\n([\\t ]+|(?!\\s).)/g);\n if (matches) {\n return arr.concat(\n matches.map((match) => match.match(/[\\t ]/g)?.length ?? 0),\n );\n }\n return arr;\n }, <number[]>[]);\n\n // 3. Remove the common indentation from all strings.\n if (indentLengths.length) {\n const pattern = new RegExp(`\\n[\\t ]{${Math.min(...indentLengths)}}`, 'g');\n\n strings = strings.map((str) => str.replace(pattern, '\\n'));\n }\n\n // 4. Remove leading whitespace.\n strings[0] = strings[0].replace(/^\\r?\\n/, '');\n\n // 5. Perform interpolation.\n let string = strings[0];\n\n values.forEach((value, i) => {\n // 5.1 Read current indentation level\n const endentations = string.match(/(?:^|\\n)( *)$/)\n const endentation = endentations ? endentations[1] : ''\n let indentedValue = value\n // 5.2 Add indentation to values with multiline strings\n if (typeof value === 'string' && value.includes('\\n')) {\n indentedValue = String(value)\n .split('\\n')\n .map((str, i) => {\n return i === 0 ? str : `${endentation}${str}`\n })\n .join('\\n');\n }\n\n string += indentedValue + strings[i + 1];\n });\n\n return string;\n}\n\nexport default dedent;\n"]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { isDirectory } from './chunk-VKFVZ67V.mjs';
|
|
2
|
+
import { __name } from './chunk-6LYDFTTF.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 };
|
|
156
|
+
//# sourceMappingURL=chunk-IGC3TZGH.mjs.map
|
|
157
|
+
//# sourceMappingURL=chunk-IGC3TZGH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/xdg-app-paths.ts","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UAAA;AAAA,EACV,UAAA,GAAa,IAAA;AAAA,EACb,gBAAA,GAAmB;AACpB,CAAA,GAAgC,EAAC,EAAG;AAEnC,EAAA,MAAM,UAAU,CAAA,EAAG,UAAA,GAAa,GAAA,GAAM,EAAE,GAAG,OAAO,CAAA,CAAA;AAClD,EAAA,MAAM,SAAA,GAAY,WAAA,CAAY,OAAO,CAAA,CAAE,MAAA,EAAO;AAE9C,EAAA,IAAI,gBAAA,EAAkB;AACrB,IAAA,MAAM,kBAAkBC,IAAAA,CAAK,IAAA,CAAKC,EAAAA,CAAG,OAAA,IAAW,OAAO,CAAA;AAGvD,IAAA,IAAI,WAAA,CAAY,eAAe,CAAA,EAAG;AACjC,MAAA,OAAO,eAAA;AAAA,IACR;AAAA,EACD;AAEA,EAAA,OAAO,SAAA;AACR;AAnBgB,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA;AA2BT,SAAS,0BAAA,GAA6B;AAC5C,EAAA,OAAO,WAAA,CAAY,WAAW,CAAA,CAAE,KAAA,EAAM;AACvC;AAFgB,MAAA,CAAA,0BAAA,EAAA,4BAAA,CAAA","file":"chunk-IGC3TZGH.mjs","sourcesContent":["import os from \"node:os\";\nimport path from \"node:path\";\n\n/**\n * @module\n *\n * A small, pure-ESM, dependency-free reimplementation of the subset of\n * [`xdg-app-paths`](https://www.npmjs.com/package/xdg-app-paths) that this\n * repository relies on.\n *\n * `xdg-app-paths` (and its `xdg-portable` / `os-paths` dependencies) ship as\n * CommonJS. When the consuming package is bundled to ESM (e.g. via tsup or when\n * a downstream consumer runs through Vite), the CJS `require()` calls are\n * shimmed and throw at runtime (\"Dynamic require of 'path' is not supported\").\n * Vendoring the resolution logic here keeps the behaviour identical while\n * remaining pure ESM.\n *\n * The path resolution intentionally mirrors `xdg-app-paths@8` →\n * `xdg-portable@10` → `os-paths@7` exactly so that the resolved config/cache\n * directories (which hold, amongst other things, Wrangler's auth credentials)\n * do not change for existing users.\n *\n * ---\n *\n * This implementation is adapted from `xdg-app-paths`, `xdg-portable` and\n * `os-paths` (https://github.com/rivy/js.xdg-app-paths), published under the\n * MIT License:\n *\n * Copyright (c) Roy Ivy III <rivy.dev@gmail.com>\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nfunction isWindows(): boolean {\n\treturn /^win/i.test(process.platform);\n}\n\nfunction isMacOS(): boolean {\n\treturn /^darwin$/i.test(process.platform);\n}\n\nfunction isNonEmpty(value: string | undefined): value is string {\n\treturn !!value;\n}\n\n/**\n * Read an OS/XDG environment variable. Accessed dynamically (mirroring\n * `xdg-portable`'s `env.get()`) so these process-level variables don't need to\n * be declared as build inputs (`turbo/no-undeclared-env-vars`) — they are not\n * Wrangler configuration variables.\n */\nfunction getEnv(name: string): string | undefined {\n\treturn process.env[name];\n}\n\n/** Mirrors `os-paths`' `normalizePath`. */\nfunction normalizePath(p: string | undefined): string | undefined {\n\treturn p ? path.normalize(path.join(p, \".\")) : undefined;\n}\n\n/** Mirrors `os-paths`' `home()`. */\nfunction homeDir(): string | undefined {\n\tif (isWindows()) {\n\t\tconst priorityList = [\n\t\t\tos.homedir(),\n\t\t\tgetEnv(\"USERPROFILE\"),\n\t\t\tgetEnv(\"HOME\"),\n\t\t\t// NOTE: `os-paths@7` uses `||` here (not `&&`), so a home directory is\n\t\t\t// derived even when only one of HOMEDRIVE/HOMEPATH is set. This is\n\t\t\t// preserved deliberately for byte-for-byte parity — see the parity\n\t\t\t// tests, which compare this branch against the real package.\n\t\t\tgetEnv(\"HOMEDRIVE\") || getEnv(\"HOMEPATH\")\n\t\t\t\t? path.join(getEnv(\"HOMEDRIVE\") ?? \"\", getEnv(\"HOMEPATH\") ?? \"\")\n\t\t\t\t: undefined,\n\t\t];\n\t\treturn normalizePath(priorityList.find(isNonEmpty));\n\t}\n\treturn normalizePath(os.homedir() || getEnv(\"HOME\"));\n}\n\nfunction joinToBase(\n\tbase: string | undefined,\n\tsegments: string[]\n): string | undefined {\n\treturn base ? path.join(base, ...segments) : undefined;\n}\n\n/** Mirrors `os-paths`' `temp()`. */\nfunction tempDir(): string {\n\tif (isWindows()) {\n\t\tconst fallback = \"C:\\\\Temp\";\n\t\tconst priorityListLazy: Array<() => string | undefined> = [\n\t\t\t() => os.tmpdir(),\n\t\t\t() => getEnv(\"TEMP\"),\n\t\t\t() => getEnv(\"TMP\"),\n\t\t\t() => joinToBase(getEnv(\"LOCALAPPDATA\"), [\"Temp\"]),\n\t\t\t() => joinToBase(homeDir(), [\"AppData\", \"Local\", \"Temp\"]),\n\t\t\t() => joinToBase(getEnv(\"ALLUSERSPROFILE\"), [\"Temp\"]),\n\t\t\t() => joinToBase(getEnv(\"SystemRoot\"), [\"Temp\"]),\n\t\t\t() => joinToBase(getEnv(\"windir\"), [\"Temp\"]),\n\t\t\t() => joinToBase(getEnv(\"SystemDrive\"), [\"\\\\\", \"Temp\"]),\n\t\t];\n\t\tconst found = priorityListLazy.find((fn) => isNonEmpty(fn()));\n\t\treturn (found && normalizePath(found())) || fallback;\n\t}\n\tconst fallback = \"/tmp\";\n\tconst priorityList = [\n\t\tos.tmpdir(),\n\t\tgetEnv(\"TMPDIR\"),\n\t\tgetEnv(\"TEMP\"),\n\t\tgetEnv(\"TMP\"),\n\t];\n\treturn normalizePath(priorityList.find(isNonEmpty)) || fallback;\n}\n\n/** Mirrors `xdg-portable`'s `baseDir()`. */\nfunction baseDir(): string {\n\treturn homeDir() || tempDir();\n}\n\n/** Mirrors `xdg-portable`'s `valOrPath()`. */\nfunction valOrPath(value: string | undefined, segments: string[]): string {\n\treturn value || path.join(...segments);\n}\n\nfunction windowsAppData(): string {\n\treturn valOrPath(getEnv(\"APPDATA\"), [baseDir(), \"AppData\", \"Roaming\"]);\n}\n\nfunction windowsLocalAppData(): string {\n\treturn valOrPath(getEnv(\"LOCALAPPDATA\"), [baseDir(), \"AppData\", \"Local\"]);\n}\n\n/** XDG config base directory (`xdg-portable`'s `config()`). */\nfunction xdgConfig(): string {\n\tif (isMacOS()) {\n\t\treturn valOrPath(getEnv(\"XDG_CONFIG_HOME\"), [\n\t\t\tbaseDir(),\n\t\t\t\"Library\",\n\t\t\t\"Preferences\",\n\t\t]);\n\t}\n\tif (isWindows()) {\n\t\treturn valOrPath(getEnv(\"XDG_CONFIG_HOME\"), [\n\t\t\twindowsAppData(),\n\t\t\t\"xdg.config\",\n\t\t]);\n\t}\n\treturn valOrPath(getEnv(\"XDG_CONFIG_HOME\"), [baseDir(), \".config\"]);\n}\n\n/** XDG cache base directory (`xdg-portable`'s `cache()`). */\nfunction xdgCache(): string {\n\tif (isMacOS()) {\n\t\treturn valOrPath(getEnv(\"XDG_CACHE_HOME\"), [\n\t\t\tbaseDir(),\n\t\t\t\"Library\",\n\t\t\t\"Caches\",\n\t\t]);\n\t}\n\tif (isWindows()) {\n\t\treturn valOrPath(getEnv(\"XDG_CACHE_HOME\"), [\n\t\t\twindowsLocalAppData(),\n\t\t\t\"xdg.cache\",\n\t\t]);\n\t}\n\treturn valOrPath(getEnv(\"XDG_CACHE_HOME\"), [baseDir(), \".cache\"]);\n}\n\nexport interface XDGAppPaths {\n\t/** The XDG-compliant config directory for the application. */\n\tconfig(): string;\n\t/** The XDG-compliant cache directory for the application. */\n\tcache(): string;\n}\n\n/**\n * Resolve XDG-compliant application paths for the given application name.\n *\n * Equivalent to `xdgAppPaths(name)` with the default `isolated: true`, i.e. the\n * application name is appended as the final path segment.\n */\nexport function xdgAppPaths(name: string): XDGAppPaths {\n\t// `xdg-app-paths` runs the name through `path.parse(name).name`, which (for\n\t// example) leaves `.wrangler` untouched since a leading dot is not treated\n\t// as a file extension.\n\tconst segment = path.parse(name).name;\n\treturn {\n\t\tconfig: () => path.join(xdgConfig(), segment),\n\t\tcache: () => path.join(xdgCache(), segment),\n\t};\n}\n","import os from \"node:os\";\nimport path from \"node:path\";\nimport { isDirectory } from \"./fs-helpers\";\nimport { xdgAppPaths } from \"./xdg-app-paths\";\n\nexport interface GetGlobalConfigPathOptions {\n\t/**\n\t * The application namespace. Defaults to `\"wrangler\"`.\n\t */\n\tappName?: string;\n\t/**\n\t * Whether to prepend a `.` to `appName` when resolving the XDG path and the\n\t * legacy `$HOME` directory. Defaults to `true` to match wrangler's\n\t * historical behaviour (`.wrangler`).\n\t */\n\tleadingDot?: boolean;\n\t/**\n\t * When `true` (the default, matching wrangler's historical behaviour), a\n\t * pre-existing `~/.<appName>` directory takes precedence over the XDG path.\n\t * Pass `false` to always use the XDG-compliant path.\n\t */\n\tuseLegacyHomeDir?: boolean;\n}\n\n/**\n * Resolve the global config directory for a Cloudflare CLI.\n *\n * Defaults to wrangler's directory (`.wrangler`) so existing callers are\n * unaffected, but accepts an `appName` so other first-party CLIs (e.g. `cf`)\n * can reuse the same XDG-compliant resolution under their own namespace.\n */\nexport function getGlobalConfigPath({\n\tappName = \"wrangler\",\n\tleadingDot = true,\n\tuseLegacyHomeDir = true,\n}: GetGlobalConfigPathOptions = {}) {\n\t//TODO: We should implement a custom path --global-config and/or the WRANGLER_HOME type environment variable\n\tconst dirName = `${leadingDot ? \".\" : \"\"}${appName}`;\n\tconst configDir = xdgAppPaths(dirName).config(); // New XDG compliant config path\n\n\tif (useLegacyHomeDir) {\n\t\tconst legacyConfigDir = path.join(os.homedir(), dirName); // Legacy config in user's home directory\n\t\t// Check for the legacy directory in $HOME; if it is not there then use the\n\t\t// XDG compliant path.\n\t\tif (isDirectory(legacyConfigDir)) {\n\t\t\treturn legacyConfigDir;\n\t\t}\n\t}\n\n\treturn configDir;\n}\n\n/**\n * Resolve the XDG-compliant global cache directory for wrangler (`.wrangler`).\n *\n * Unlike {@link getGlobalConfigPath}, this never falls back to a legacy\n * `~/.wrangler` directory.\n */\nexport function getGlobalWranglerCachePath() {\n\treturn xdgAppPaths(\".wrangler\").cache();\n}\n"]}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { dedent } from './chunk-G5FCNCLK.mjs';
|
|
2
|
+
import { getEnvironmentVariableFactory, getBooleanEnvironmentVariableFactory } from './chunk-OPAKTV2K.mjs';
|
|
3
|
+
import { UserError } from './chunk-CPLEE7LH.mjs';
|
|
4
|
+
import { getGlobalConfigPath } from './chunk-IGC3TZGH.mjs';
|
|
5
|
+
import { __name } from './chunk-6LYDFTTF.mjs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
|
|
8
|
+
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
|
9
|
+
variableName: "WRANGLER_C3_COMMAND",
|
|
10
|
+
defaultValue: /* @__PURE__ */ __name(() => "create cloudflare", "defaultValue")
|
|
11
|
+
});
|
|
12
|
+
var getDoNotTrackFromEnv = getEnvironmentVariableFactory({
|
|
13
|
+
variableName: "DO_NOT_TRACK"
|
|
14
|
+
});
|
|
15
|
+
function isDoNotTrackEnabled() {
|
|
16
|
+
const value = getDoNotTrackFromEnv()?.toLowerCase();
|
|
17
|
+
return value === "1" || value === "true";
|
|
18
|
+
}
|
|
19
|
+
__name(isDoNotTrackEnabled, "isDoNotTrackEnabled");
|
|
20
|
+
var getWranglerSendMetricsVariableFromEnv = getBooleanEnvironmentVariableFactory({
|
|
21
|
+
variableName: "WRANGLER_SEND_METRICS"
|
|
22
|
+
});
|
|
23
|
+
function getWranglerSendMetricsFromEnv() {
|
|
24
|
+
if (isDoNotTrackEnabled()) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return getWranglerSendMetricsVariableFromEnv();
|
|
28
|
+
}
|
|
29
|
+
__name(getWranglerSendMetricsFromEnv, "getWranglerSendMetricsFromEnv");
|
|
30
|
+
var getNoSkillsUpdatePromptsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
31
|
+
variableName: "WRANGLER_NO_SKILLS_UPDATE_PROMPTS"
|
|
32
|
+
});
|
|
33
|
+
var getWranglerSendErrorReportsFromEnv = getBooleanEnvironmentVariableFactory({
|
|
34
|
+
variableName: "WRANGLER_SEND_ERROR_REPORTS",
|
|
35
|
+
defaultValue: false
|
|
36
|
+
});
|
|
37
|
+
var getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(
|
|
38
|
+
{
|
|
39
|
+
variableName: "WRANGLER_API_ENVIRONMENT",
|
|
40
|
+
defaultValue: /* @__PURE__ */ __name(() => "production", "defaultValue"),
|
|
41
|
+
choices: ["production", "staging"]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var COMPLIANCE_REGION_CONFIG_PUBLIC = {
|
|
45
|
+
compliance_region: "public"
|
|
46
|
+
};
|
|
47
|
+
var COMPLIANCE_REGION_CONFIG_UNKNOWN = {
|
|
48
|
+
compliance_region: void 0
|
|
49
|
+
};
|
|
50
|
+
var getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({
|
|
51
|
+
variableName: "CLOUDFLARE_COMPLIANCE_REGION",
|
|
52
|
+
choices: ["public", "fedramp_high"]
|
|
53
|
+
});
|
|
54
|
+
var getCloudflareComplianceRegion = /* @__PURE__ */ __name((complianceConfig) => {
|
|
55
|
+
const complianceRegionFromEnv = getCloudflareComplianceRegionFromEnv();
|
|
56
|
+
if (complianceRegionFromEnv !== void 0 && complianceConfig?.compliance_region !== void 0 && complianceRegionFromEnv !== complianceConfig.compliance_region) {
|
|
57
|
+
throw new UserError(
|
|
58
|
+
dedent`
|
|
59
|
+
The compliance region has been set to different values in two places:
|
|
60
|
+
- \`CLOUDFLARE_COMPLIANCE_REGION\` environment variable: \`${complianceRegionFromEnv}\`
|
|
61
|
+
- \`compliance_region\` configuration property: \`${complianceConfig.compliance_region}\`
|
|
62
|
+
`,
|
|
63
|
+
{ telemetryMessage: false }
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
return complianceRegionFromEnv || complianceConfig?.compliance_region || "public";
|
|
67
|
+
}, "getCloudflareComplianceRegion");
|
|
68
|
+
var getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({
|
|
69
|
+
variableName: "CLOUDFLARE_API_BASE_URL",
|
|
70
|
+
deprecatedName: "CF_API_BASE_URL"
|
|
71
|
+
});
|
|
72
|
+
var getCloudflareApiBaseUrl = /* @__PURE__ */ __name((complianceConfig) => getCloudflareApiBaseUrlFromEnv() ?? `https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`, "getCloudflareApiBaseUrl");
|
|
73
|
+
function getComplianceRegionSubdomain(complianceConfig) {
|
|
74
|
+
return getCloudflareComplianceRegion(complianceConfig) === "fedramp_high" ? ".fed" : "";
|
|
75
|
+
}
|
|
76
|
+
__name(getComplianceRegionSubdomain, "getComplianceRegionSubdomain");
|
|
77
|
+
function getStagingSubdomain() {
|
|
78
|
+
return getCloudflareApiEnvironmentFromEnv() === "staging" ? ".staging" : "";
|
|
79
|
+
}
|
|
80
|
+
__name(getStagingSubdomain, "getStagingSubdomain");
|
|
81
|
+
var getSanitizeLogs = getBooleanEnvironmentVariableFactory({
|
|
82
|
+
variableName: "WRANGLER_LOG_SANITIZE",
|
|
83
|
+
defaultValue: true
|
|
84
|
+
});
|
|
85
|
+
var getOutputFileDirectoryFromEnv = getEnvironmentVariableFactory({
|
|
86
|
+
variableName: "WRANGLER_OUTPUT_FILE_DIRECTORY"
|
|
87
|
+
});
|
|
88
|
+
var getOutputFilePathFromEnv = getEnvironmentVariableFactory({
|
|
89
|
+
variableName: "WRANGLER_OUTPUT_FILE_PATH"
|
|
90
|
+
});
|
|
91
|
+
var getCIMatchTag = getEnvironmentVariableFactory({
|
|
92
|
+
variableName: "WRANGLER_CI_MATCH_TAG"
|
|
93
|
+
});
|
|
94
|
+
var getCIOverrideName = getEnvironmentVariableFactory({
|
|
95
|
+
variableName: "WRANGLER_CI_OVERRIDE_NAME"
|
|
96
|
+
});
|
|
97
|
+
var getCIOverrideNetworkModeHost = getEnvironmentVariableFactory({
|
|
98
|
+
variableName: "WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST"
|
|
99
|
+
});
|
|
100
|
+
var getCIGeneratePreviewAlias = getEnvironmentVariableFactory({
|
|
101
|
+
variableName: "WRANGLER_CI_GENERATE_PREVIEW_ALIAS",
|
|
102
|
+
defaultValue: /* @__PURE__ */ __name(() => "false", "defaultValue"),
|
|
103
|
+
choices: ["true", "false"]
|
|
104
|
+
});
|
|
105
|
+
var getWorkersCIBranchName = getEnvironmentVariableFactory({
|
|
106
|
+
variableName: "WORKERS_CI_BRANCH"
|
|
107
|
+
});
|
|
108
|
+
var getBuildConditionsFromEnv = getEnvironmentVariableFactory({
|
|
109
|
+
variableName: "WRANGLER_BUILD_CONDITIONS"
|
|
110
|
+
});
|
|
111
|
+
var getBuildPlatformFromEnv = getEnvironmentVariableFactory({
|
|
112
|
+
variableName: "WRANGLER_BUILD_PLATFORM"
|
|
113
|
+
});
|
|
114
|
+
var getRegistryPath = getEnvironmentVariableFactory({
|
|
115
|
+
variableName: "WRANGLER_REGISTRY_PATH",
|
|
116
|
+
defaultValue() {
|
|
117
|
+
return path.join(getGlobalConfigPath(), "registry");
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
var getD1ExtraLocationChoices = getEnvironmentVariableFactory({
|
|
121
|
+
variableName: "WRANGLER_D1_EXTRA_LOCATION_CHOICES"
|
|
122
|
+
});
|
|
123
|
+
var getSubdomainMixedStateCheckDisabled = getBooleanEnvironmentVariableFactory({
|
|
124
|
+
variableName: "WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK",
|
|
125
|
+
defaultValue: false
|
|
126
|
+
});
|
|
127
|
+
var getCloudflareLoadDevVarsFromDotEnv = getBooleanEnvironmentVariableFactory({
|
|
128
|
+
variableName: "CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV",
|
|
129
|
+
defaultValue: true
|
|
130
|
+
});
|
|
131
|
+
var getCloudflareIncludeProcessEnvFromEnv = getBooleanEnvironmentVariableFactory({
|
|
132
|
+
variableName: "CLOUDFLARE_INCLUDE_PROCESS_ENV",
|
|
133
|
+
defaultValue: false
|
|
134
|
+
});
|
|
135
|
+
var getTraceHeader = getEnvironmentVariableFactory({
|
|
136
|
+
variableName: "WRANGLER_TRACE_ID"
|
|
137
|
+
});
|
|
138
|
+
var getDisableConfigWatching = getBooleanEnvironmentVariableFactory({
|
|
139
|
+
variableName: "WRANGLER_CI_DISABLE_CONFIG_WATCHING",
|
|
140
|
+
defaultValue: false
|
|
141
|
+
});
|
|
142
|
+
var getWranglerHideBanner = getBooleanEnvironmentVariableFactory({
|
|
143
|
+
variableName: "WRANGLER_HIDE_BANNER",
|
|
144
|
+
defaultValue: false
|
|
145
|
+
});
|
|
146
|
+
var getCloudflareEnv = getEnvironmentVariableFactory({
|
|
147
|
+
variableName: "CLOUDFLARE_ENV"
|
|
148
|
+
});
|
|
149
|
+
var getOpenNextDeployFromEnv = getEnvironmentVariableFactory({
|
|
150
|
+
variableName: "OPEN_NEXT_DEPLOY"
|
|
151
|
+
});
|
|
152
|
+
var getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
153
|
+
variableName: "X_LOCAL_EXPLORER",
|
|
154
|
+
defaultValue: true
|
|
155
|
+
});
|
|
156
|
+
var getLocalObservabilityEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
157
|
+
variableName: "X_LOCAL_OBSERVABILITY",
|
|
158
|
+
defaultValue: true
|
|
159
|
+
});
|
|
160
|
+
var getBrowserRenderingHeadfulFromEnv = getBooleanEnvironmentVariableFactory({
|
|
161
|
+
variableName: "X_BROWSER_HEADFUL",
|
|
162
|
+
defaultValue: false
|
|
163
|
+
});
|
|
164
|
+
var getCfFetchEnabledFromEnv = getBooleanEnvironmentVariableFactory({
|
|
165
|
+
variableName: "CLOUDFLARE_CF_FETCH_ENABLED",
|
|
166
|
+
defaultValue: true
|
|
167
|
+
});
|
|
168
|
+
var getCfFetchPathFromEnv = getEnvironmentVariableFactory({
|
|
169
|
+
variableName: "CLOUDFLARE_CF_FETCH_PATH"
|
|
170
|
+
});
|
|
171
|
+
var getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({
|
|
172
|
+
variableName: "WRANGLER_CACHE_DIR"
|
|
173
|
+
});
|
|
174
|
+
var getCloudflaredPathFromEnv = getEnvironmentVariableFactory({
|
|
175
|
+
variableName: "CLOUDFLARED_PATH"
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
export { COMPLIANCE_REGION_CONFIG_PUBLIC, COMPLIANCE_REGION_CONFIG_UNKNOWN, getBrowserRenderingHeadfulFromEnv, getBuildConditionsFromEnv, getBuildPlatformFromEnv, getC3CommandFromEnv, getCIGeneratePreviewAlias, getCIMatchTag, getCIOverrideName, getCIOverrideNetworkModeHost, getCfFetchEnabledFromEnv, getCfFetchPathFromEnv, getCloudflareApiBaseUrl, getCloudflareApiEnvironmentFromEnv, getCloudflareComplianceRegion, getCloudflareEnv, getCloudflareIncludeProcessEnvFromEnv, getCloudflareLoadDevVarsFromDotEnv, getCloudflaredPathFromEnv, getComplianceRegionSubdomain, getD1ExtraLocationChoices, getDisableConfigWatching, getLocalExplorerEnabledFromEnv, getLocalObservabilityEnabledFromEnv, getNoSkillsUpdatePromptsFromEnv, getOpenNextDeployFromEnv, getOutputFileDirectoryFromEnv, getOutputFilePathFromEnv, getRegistryPath, getSanitizeLogs, getSubdomainMixedStateCheckDisabled, getTraceHeader, getWorkersCIBranchName, getWranglerCacheDirFromEnv, getWranglerHideBanner, getWranglerSendErrorReportsFromEnv, getWranglerSendMetricsFromEnv, isDoNotTrackEnabled };
|
|
179
|
+
//# sourceMappingURL=chunk-NXPJWJ2B.mjs.map
|
|
180
|
+
//# sourceMappingURL=chunk-NXPJWJ2B.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/environment-variables/misc-variables.ts"],"names":[],"mappings":";;;;;;;AAkCO,IAAM,sBAAsB,6BAAA,CAA8B;AAAA,EAChE,YAAA,EAAc,qBAAA;AAAA,EACd,YAAA,+BAAoB,mBAAA,EAAN,cAAA;AACf,CAAC;AAED,IAAM,uBAAuB,6BAAA,CAA8B;AAAA,EAC1D,YAAA,EAAc;AACf,CAAC,CAAA;AAGM,SAAS,mBAAA,GAA+B;AAC9C,EAAA,MAAM,KAAA,GAAQ,oBAAA,EAAqB,EAAG,WAAA,EAAY;AAClD,EAAA,OAAO,KAAA,KAAU,OAAO,KAAA,KAAU,MAAA;AACnC;AAHgB,MAAA,CAAA,mBAAA,EAAA,qBAAA,CAAA;AAKhB,IAAM,wCACL,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc;AACf,CAAC,CAAA;AAMK,SAAS,6BAAA,GAAqD;AACpE,EAAA,IAAI,qBAAoB,EAAG;AAC1B,IAAA,OAAO,KAAA;AAAA,EACR;AAEA,EAAA,OAAO,qCAAA,EAAsC;AAC9C;AANgB,MAAA,CAAA,6BAAA,EAAA,+BAAA,CAAA;AAcT,IAAM,kCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc;AACf,CAAC;AAQK,IAAM,qCACZ,oCAAA,CAAqC;AAAA,EACpC,YAAA,EAAc,6BAAA;AAAA,E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5E,YAAA,EAAc,6BAAA;AAAA,EACd,YAAA,EAAc;AACf,CAAC;AAcM,IAAM,wBAAwB,6BAAA,CAA8B;AAAA,EAClE,YAAA,EAAc;AACf,CAAC;AAOM,IAAM,6BAA6B,6BAAA,CAA8B;AAAA,EACvE,YAAA,EAAc;AACf,CAAC;AAQM,IAAM,4BAA4B,6BAAA,CAA8B;AAAA,EACtE,YAAA,EAAc;AACf,CAAC","file":"chunk-NXPJWJ2B.mjs","sourcesContent":["import path from \"node:path\";\nimport { dedent } from \"ts-dedent\";\nimport { UserError } from \"../errors\";\nimport { getGlobalConfigPath } from \"../global-wrangler-config-path\";\nimport {\n\tgetBooleanEnvironmentVariableFactory,\n\tgetEnvironmentVariableFactory,\n} from \"./factory\";\nimport type { Config } from \"../config\";\n\n/**\n * `WRANGLER_C3_COMMAND` can override the command used by `wrangler init` when delegating to C3.\n *\n * By default this will use `create cloudflare`.\n *\n * To run against the beta release of C3 use:\n *\n * ```sh\n * # Tell Wrangler to use the beta version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"create cloudflare@beta\" npx wrangler init\n * ```\n *\n * To test the integration between wrangler and C3 locally, use:\n *\n * ```sh\n * # Ensure both Wrangler and C3 are built\n * npm run build\n * # Tell Wrangler to use the local version of create-cloudflare\n * WRANGLER_C3_COMMAND=\"exec ./packages/create-cloudflare\" npx wrangler init temp\n * ```\n *\n * Note that you cannot use `WRANGLER_C3_COMMAND=\"create cloudflare@2\"` if you are\n * running Wrangler from inside the monorepo as the bin paths get messed up.\n */\nexport const getC3CommandFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_C3_COMMAND\",\n\tdefaultValue: () => \"create cloudflare\",\n});\n\nconst getDoNotTrackFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"DO_NOT_TRACK\",\n});\n\n/** Whether `DO_NOT_TRACK` is set to a supported telemetry opt-out value. */\nexport function isDoNotTrackEnabled(): boolean {\n\tconst value = getDoNotTrackFromEnv()?.toLowerCase();\n\treturn value === \"1\" || value === \"true\";\n}\n\nconst getWranglerSendMetricsVariableFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_METRICS\",\n\t});\n\n/**\n * `WRANGLER_SEND_METRICS` controls whether we attempt to send metrics information to Sparrow.\n * `DO_NOT_TRACK` takes precedence when it is set to an opt-out value.\n */\nexport function getWranglerSendMetricsFromEnv(): boolean | undefined {\n\tif (isDoNotTrackEnabled()) {\n\t\treturn false;\n\t}\n\n\treturn getWranglerSendMetricsVariableFromEnv();\n}\n\n/**\n * `WRANGLER_NO_SKILLS_UPDATE_PROMPTS` suppresses the prompt that offers to\n * update Cloudflare agent skills when they are out of date.\n *\n * Set to `\"true\"` to never be prompted for skills updates.\n */\nexport const getNoSkillsUpdatePromptsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_NO_SKILLS_UPDATE_PROMPTS\",\n\t});\n\n/**\n * `WRANGLER_SEND_ERROR_REPORTS` controls whether we attempt to send error reports to Sentry.\n *\n * Defaults to `false` to avoid noisy false-positive reports. Users can opt in\n * by setting `WRANGLER_SEND_ERROR_REPORTS=true`.\n */\nexport const getWranglerSendErrorReportsFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_SEND_ERROR_REPORTS\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * Set `WRANGLER_API_ENVIRONMENT` environment variable to \"staging\" to tell Wrangler to hit the staging APIs rather than production.\n */\nexport const getCloudflareApiEnvironmentFromEnv = getEnvironmentVariableFactory(\n\t{\n\t\tvariableName: \"WRANGLER_API_ENVIRONMENT\",\n\t\tdefaultValue: () => \"production\" as const,\n\t\tchoices: [\"production\", \"staging\"] as const,\n\t}\n);\n\n/**\n * The compliance region to use for the API requests.\n */\nexport type ComplianceConfig = Partial<Pick<Config, \"compliance_region\">>;\n\n/** Used for commands that explicitly do not support compliance regions other than \"public\" */\nexport const COMPLIANCE_REGION_CONFIG_PUBLIC: ComplianceConfig = {\n\tcompliance_region: \"public\",\n};\n\n/**\n * Used for commands where there is no configuration available and\n * we rely upon the CLOUDFLARE_COMPLIANCE_REGION environment variable\n * to determine the compliance region.\n */\nexport const COMPLIANCE_REGION_CONFIG_UNKNOWN: ComplianceConfig = {\n\tcompliance_region: undefined,\n};\n\nconst getCloudflareComplianceRegionFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_COMPLIANCE_REGION\",\n\tchoices: [\"public\", \"fedramp_high\"] as const,\n});\n\n/**\n * Set `CLOUDFLARE_COMPLIANCE_REGION` environment variable to \"fedramp_high\"\n * or set the `compliance_region` property in the Wrangler configuration\n * to tell Wrangler to run in FedRAMP High compliance region mode, rather than \"public\" mode.\n */\nexport const getCloudflareComplianceRegion = (\n\tcomplianceConfig: ComplianceConfig\n) => {\n\tconst complianceRegionFromEnv = getCloudflareComplianceRegionFromEnv();\n\tif (\n\t\tcomplianceRegionFromEnv !== undefined &&\n\t\tcomplianceConfig?.compliance_region !== undefined &&\n\t\tcomplianceRegionFromEnv !== complianceConfig.compliance_region\n\t) {\n\t\tthrow new UserError(\n\t\t\tdedent`\n\t\t\tThe compliance region has been set to different values in two places:\n\t\t\t - \\`CLOUDFLARE_COMPLIANCE_REGION\\` environment variable: \\`${complianceRegionFromEnv}\\`\n\t\t\t - \\`compliance_region\\` configuration property: \\`${complianceConfig.compliance_region}\\`\n\t\t\t`,\n\t\t\t{ telemetryMessage: false }\n\t\t);\n\t}\n\treturn (\n\t\tcomplianceRegionFromEnv || complianceConfig?.compliance_region || \"public\"\n\t);\n};\n\nconst getCloudflareApiBaseUrlFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_API_BASE_URL\",\n\tdeprecatedName: \"CF_API_BASE_URL\",\n});\n\n/**\n * `CLOUDFLARE_API_BASE_URL` specifies the URL to the Cloudflare API.\n *\n * If this environment variable is not set, it will default to a URL computed from the\n * Cloudflare compliance region and the API environment.\n */\nexport const getCloudflareApiBaseUrl = (complianceConfig: ComplianceConfig) =>\n\tgetCloudflareApiBaseUrlFromEnv() ??\n\t`https://api${getComplianceRegionSubdomain(complianceConfig)}${getStagingSubdomain()}.cloudflare.com/client/v4`;\n\n/**\n * Compute the subdomain for the compliance region.\n */\nexport function getComplianceRegionSubdomain(\n\tcomplianceConfig: ComplianceConfig\n): string {\n\treturn getCloudflareComplianceRegion(complianceConfig) === \"fedramp_high\"\n\t\t? \".fed\"\n\t\t: \"\";\n}\n\n/**\n * Compute the subdomain for the staging environment.\n */\nfunction getStagingSubdomain(): string {\n\treturn getCloudflareApiEnvironmentFromEnv() === \"staging\" ? \".staging\" : \"\";\n}\n\n/**\n * `WRANGLER_LOG_SANITIZE` specifies whether we sanitize debug logs.\n *\n * By default we do, since debug logs could be added to GitHub issues and shouldn't include sensitive information.\n */\nexport const getSanitizeLogs = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_LOG_SANITIZE\",\n\tdefaultValue: true,\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_DIRECTORY` specifies a directory where we should write a file containing output data in ND-JSON format.\n *\n * If this is set a random file will be created in this directory, and certain Wrangler commands will write entries to this file.\n * This is overridden by the `WRANGLER_OUTPUT_FILE_PATH` environment variable.\n */\nexport const getOutputFileDirectoryFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_DIRECTORY\",\n});\n\n/**\n * `WRANGLER_OUTPUT_FILE_PATH` specifies a path to a file where we should write output data in ND-JSON format.\n *\n * If this is set certain Wrangler commands will write entries to this file.\n * This overrides the `WRANGLER_OUTPUT_FILE_DIRECTORY` environment variable.\n */\nexport const getOutputFilePathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_OUTPUT_FILE_PATH\",\n});\n\n/**\n * `WRANGLER_CI_MATCH_TAG` specifies a Worker tag\n *\n * If this is set, Wrangler will ensure the Worker being targeted has this tag\n */\nexport const getCIMatchTag = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_MATCH_TAG\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NAME` specifies a Worker name\n *\n * If this is set, Wrangler will override the Worker name with this one\n */\nexport const getCIOverrideName = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NAME\",\n});\n\n/**\n * `WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST` specifies whether --network=host should be set\n *\n * If this is set to true, Wrangler will use the --network=host flag when calling out to docker to build container images\n */\nexport const getCIOverrideNetworkModeHost = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_OVERRIDE_NETWORK_MODE_HOST\",\n});\n\n/**\n * `WRANGLER_CI_GENERATE_PREVIEW_ALIAS` specifies whether to generate a preview alias during version upload\n *\n * If this is set to true, Wrangler will attempt to autogenerate the preview alias by using the branch\n * name. If the branch name is too long and an alias cannot be created, a warning will be printed to the console.\n */\nexport const getCIGeneratePreviewAlias = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_GENERATE_PREVIEW_ALIAS\",\n\tdefaultValue: () => \"false\" as const,\n\tchoices: [\"true\", \"false\"] as const,\n});\n\n/**\n * `WORKERS_CI_BRANCH` is the branch name exposed by Workers CI\n *\n */\nexport const getWorkersCIBranchName = getEnvironmentVariableFactory({\n\tvariableName: \"WORKERS_CI_BRANCH\",\n});\n\n/**\n * `WRANGLER_BUILD_CONDITIONS` specifies the \"build conditions\" to use when importing packages at build time.\n *\n * See https://nodejs.org/api/packages.html#conditional-exports\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this list of conditions.\n * The format is a string of comma separated conditions.\n */\nexport const getBuildConditionsFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_CONDITIONS\",\n});\n\n/**\n * `WRANGLER_BUILD_PLATFORM` specifies the \"build platform\" to use when importing packages at build time.\n *\n * See https://esbuild.github.io/api/#platform\n * and https://esbuild.github.io/api/#how-conditions-work.\n *\n * If this is set, Wrangler will configure esbuild to use this platform.\n */\nexport const getBuildPlatformFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_BUILD_PLATFORM\",\n});\n\n/**\n * `WRANGLER_REGISTRY_PATH` specifies the file based dev registry folder\n */\nexport const getRegistryPath = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_REGISTRY_PATH\",\n\tdefaultValue() {\n\t\treturn path.join(getGlobalConfigPath(), \"registry\");\n\t},\n});\n\n/**\n * `WRANGLER_D1_EXTRA_LOCATION_CHOICES` is an internal variable to let D1 team target their testing environments.\n *\n * External accounts cannot access testing environments, so should not set this variable.\n */\nexport const getD1ExtraLocationChoices: () => string | undefined =\n\tgetEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_D1_EXTRA_LOCATION_CHOICES\",\n\t});\n\n/**\n * `WRANGLER_DOCKER_BIN` specifies the path to a docker binary.\n *\n * By default it's `docker`.\n */\nexport { getDockerPath } from \"../docker-path\";\n\nexport const getSubdomainMixedStateCheckDisabled =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"WRANGLER_DISABLE_SUBDOMAIN_MIXED_STATE_CHECK\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n/**\n * `CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV` specifies whether to load vars for local dev from `.env` files.\n */\nexport const getCloudflareLoadDevVarsFromDotEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `CLOUDFLARE_INCLUDE_PROCESS_ENV` specifies whether to include the `process.env` in vars loaded from `.env` for local development.\n */\nexport const getCloudflareIncludeProcessEnvFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"CLOUDFLARE_INCLUDE_PROCESS_ENV\",\n\t\tdefaultValue: false,\n\t});\n\nexport const getTraceHeader = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_TRACE_ID\",\n});\n\nexport const getDisableConfigWatching = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CI_DISABLE_CONFIG_WATCHING\",\n\tdefaultValue: false,\n});\n\n/**\n * Hide the Wrangler version banner and command status (deprecated/experimental) warnings\n */\nexport const getWranglerHideBanner = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_HIDE_BANNER\",\n\tdefaultValue: false,\n});\n\n/**\n * `CLOUDFLARE_ENV` specifies the currently selected Wrangler/Cloudflare environment.\n */\nexport const getCloudflareEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_ENV\",\n});\n\n/**\n * `OPEN_NEXT_DEPLOY` is an environment variables that indicates that the current process is being\n * run by the open-next deploy command\n */\nexport const getOpenNextDeployFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"OPEN_NEXT_DEPLOY\",\n});\n\n/**\n * `X_LOCAL_EXPLORER` enables the local explorer UI at /cdn-cgi/local/explorer.\n */\nexport const getLocalExplorerEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_EXPLORER\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_LOCAL_OBSERVABILITY` turns on local-dev observability capture. Both\n * `wrangler dev` and the Vite plugin read it and pass it through as the one\n * `unsafeObservability` Miniflare option, which makes core attach the trace\n * collector to each user worker.\n *\n * Defaults to `true` so the Local Explorer's Observability tab captures traces\n * and logs out of the box. Set `X_LOCAL_OBSERVABILITY=false` to opt out — for\n * example if the extra per-worker services (collector + streaming tail) cause\n * trouble in a multi-process dev-registry setup.\n */\nexport const getLocalObservabilityEnabledFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_LOCAL_OBSERVABILITY\",\n\t\tdefaultValue: true,\n\t});\n\n/**\n * `X_BROWSER_HEADFUL` opens the browser in headful (visible) mode when using the\n * Browser Run API in local development.\n *\n * Set to \"true\" to enable:\n *\n * ```sh\n * X_BROWSER_HEADFUL=true vite dev\n * ```\n *\n * Note: when using `@cloudflare/playwright`, two Chrome windows may appear — the initial blank\n * page and the one created by `browser.newPage()`. This is expected due to how Playwright handles\n * browser contexts via CDP.\n */\nexport const getBrowserRenderingHeadfulFromEnv =\n\tgetBooleanEnvironmentVariableFactory({\n\t\tvariableName: \"X_BROWSER_HEADFUL\",\n\t\tdefaultValue: false,\n\t});\n\n/**\n * `CLOUDFLARE_CF_FETCH_ENABLED` controls whether Miniflare fetches the `cf.json` file\n * containing request.cf properties from workers.cloudflare.com.\n *\n * - If set to \"false\", disables fetching and uses fallback data (no files created)\n * - If set to \"true\" or not set, uses the default behavior (fetches and caches cf.json)\n *\n * This is particularly useful for non-JavaScript projects that don't want\n * a node_modules directory created automatically.\n *\n * Example:\n * ```sh\n * # Disable cf fetching entirely\n * CLOUDFLARE_CF_FETCH_ENABLED=false npx wrangler dev\n * ```\n */\nexport const getCfFetchEnabledFromEnv = getBooleanEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_ENABLED\",\n\tdefaultValue: true,\n});\n\n/**\n * `CLOUDFLARE_CF_FETCH_PATH` specifies a custom path for caching the cf.json file.\n *\n * - If set, uses the specified path instead of the default node_modules/.mf/cf.json\n * - If not set, uses the default location (node_modules/.mf/cf.json)\n *\n * Example:\n * ```sh\n * # Use a custom cache location\n * CLOUDFLARE_CF_FETCH_PATH=/tmp/cf-cache.json npx wrangler dev\n * ```\n */\nexport const getCfFetchPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARE_CF_FETCH_PATH\",\n});\n\n/**\n * `WRANGLER_CACHE_DIR` specifies a custom directory for Wrangler's cache files.\n * This overrides the default `node_modules/.cache/wrangler` location.\n * Useful for Yarn PnP or projects without node_modules.\n */\nexport const getWranglerCacheDirFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"WRANGLER_CACHE_DIR\",\n});\n\n/**\n * `CLOUDFLARED_PATH` specifies a custom path to a cloudflared binary.\n *\n * If set, Wrangler will use this cloudflared binary instead of downloading one.\n * The path must point to an existing executable file.\n */\nexport const getCloudflaredPathFromEnv = getEnvironmentVariableFactory({\n\tvariableName: \"CLOUDFLARED_PATH\",\n});\n"]}
|