wrangler 3.40.0 → 3.41.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/package.json +4 -4
- package/wrangler-dist/cli.js +317 -227
package/wrangler-dist/cli.js
CHANGED
|
@@ -12736,7 +12736,7 @@ var require_fetch = __commonJS({
|
|
|
12736
12736
|
}
|
|
12737
12737
|
};
|
|
12738
12738
|
__name(Fetch, "Fetch");
|
|
12739
|
-
function
|
|
12739
|
+
function fetch15(input, init2 = {}) {
|
|
12740
12740
|
webidl.argumentLengthCheck(arguments, 1, { header: "globalThis.fetch" });
|
|
12741
12741
|
const p2 = createDeferredPromise();
|
|
12742
12742
|
let requestObject;
|
|
@@ -12800,7 +12800,7 @@ var require_fetch = __commonJS({
|
|
|
12800
12800
|
});
|
|
12801
12801
|
return p2.promise;
|
|
12802
12802
|
}
|
|
12803
|
-
__name(
|
|
12803
|
+
__name(fetch15, "fetch");
|
|
12804
12804
|
function finalizeAndReportTiming(response, initiatorType = "other") {
|
|
12805
12805
|
if (response.type === "error" && response.aborted) {
|
|
12806
12806
|
return;
|
|
@@ -13681,7 +13681,7 @@ var require_fetch = __commonJS({
|
|
|
13681
13681
|
}
|
|
13682
13682
|
__name(httpNetworkFetch, "httpNetworkFetch");
|
|
13683
13683
|
module3.exports = {
|
|
13684
|
-
fetch:
|
|
13684
|
+
fetch: fetch15,
|
|
13685
13685
|
Fetch,
|
|
13686
13686
|
fetching,
|
|
13687
13687
|
finalizeAndReportTiming
|
|
@@ -17022,7 +17022,7 @@ var require_undici = __commonJS({
|
|
|
17022
17022
|
module3.exports.getGlobalDispatcher = getGlobalDispatcher2;
|
|
17023
17023
|
if (util4.nodeMajor > 16 || util4.nodeMajor === 16 && util4.nodeMinor >= 8) {
|
|
17024
17024
|
let fetchImpl = null;
|
|
17025
|
-
module3.exports.fetch = /* @__PURE__ */ __name(async function
|
|
17025
|
+
module3.exports.fetch = /* @__PURE__ */ __name(async function fetch15(resource) {
|
|
17026
17026
|
if (!fetchImpl) {
|
|
17027
17027
|
fetchImpl = require_fetch().fetch;
|
|
17028
17028
|
}
|
|
@@ -29556,11 +29556,11 @@ var require_wasm_sync = __commonJS({
|
|
|
29556
29556
|
});
|
|
29557
29557
|
var ca = Object.assign({}, l2), da2 = "object" == typeof window, ea = "function" == typeof importScripts, q2 = "", fa, ha;
|
|
29558
29558
|
if ("object" == typeof process && "object" == typeof process.versions && "string" == typeof process.versions.node) {
|
|
29559
|
-
var
|
|
29559
|
+
var fs24 = require("fs"), ia = require("path");
|
|
29560
29560
|
q2 = ea ? ia.dirname(q2) + "/" : __dirname + "/";
|
|
29561
29561
|
fa = /* @__PURE__ */ __name((a, b2) => {
|
|
29562
29562
|
a = a.startsWith("file://") ? new URL(a) : ia.normalize(a);
|
|
29563
|
-
return
|
|
29563
|
+
return fs24.readFileSync(a, b2 ? void 0 : "utf8");
|
|
29564
29564
|
}, "fa");
|
|
29565
29565
|
ha = /* @__PURE__ */ __name((a) => {
|
|
29566
29566
|
a = fa(a, true);
|
|
@@ -53153,7 +53153,7 @@ var require_ErrorOverview = __commonJS({
|
|
|
53153
53153
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
53154
53154
|
};
|
|
53155
53155
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
53156
|
-
var
|
|
53156
|
+
var fs24 = __importStar(require("fs"));
|
|
53157
53157
|
var react_1 = __importDefault(require_react());
|
|
53158
53158
|
var stack_utils_1 = __importDefault(require_stack_utils());
|
|
53159
53159
|
var code_excerpt_1 = __importDefault(require_code_excerpt());
|
|
@@ -53168,8 +53168,8 @@ var require_ErrorOverview = __commonJS({
|
|
|
53168
53168
|
const origin = stack ? stackUtils.parseLine(stack[0]) : void 0;
|
|
53169
53169
|
let excerpt;
|
|
53170
53170
|
let lineWidth = 0;
|
|
53171
|
-
if ((origin === null || origin === void 0 ? void 0 : origin.file) && (origin === null || origin === void 0 ? void 0 : origin.line) &&
|
|
53172
|
-
const sourceCode =
|
|
53171
|
+
if ((origin === null || origin === void 0 ? void 0 : origin.file) && (origin === null || origin === void 0 ? void 0 : origin.line) && fs24.existsSync(origin.file)) {
|
|
53172
|
+
const sourceCode = fs24.readFileSync(origin.file, "utf8");
|
|
53173
53173
|
excerpt = code_excerpt_1.default(sourceCode, origin.line);
|
|
53174
53174
|
if (excerpt) {
|
|
53175
53175
|
for (const { line } of excerpt) {
|
|
@@ -54263,7 +54263,7 @@ var require_build2 = __commonJS({
|
|
|
54263
54263
|
var require_main2 = __commonJS({
|
|
54264
54264
|
"../../node_modules/.pnpm/dotenv@16.0.0/node_modules/dotenv/lib/main.js"(exports2, module3) {
|
|
54265
54265
|
init_import_meta_url();
|
|
54266
|
-
var
|
|
54266
|
+
var fs24 = require("fs");
|
|
54267
54267
|
var path62 = require("path");
|
|
54268
54268
|
var os10 = require("os");
|
|
54269
54269
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
@@ -54309,7 +54309,7 @@ var require_main2 = __commonJS({
|
|
|
54309
54309
|
}
|
|
54310
54310
|
}
|
|
54311
54311
|
try {
|
|
54312
|
-
const parsed = DotenvModule.parse(
|
|
54312
|
+
const parsed = DotenvModule.parse(fs24.readFileSync(dotenvPath, { encoding }));
|
|
54313
54313
|
Object.keys(parsed).forEach(function(key) {
|
|
54314
54314
|
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
|
54315
54315
|
process.env[key] = parsed[key];
|
|
@@ -65867,11 +65867,11 @@ var require_is_docker = __commonJS({
|
|
|
65867
65867
|
"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module3) {
|
|
65868
65868
|
"use strict";
|
|
65869
65869
|
init_import_meta_url();
|
|
65870
|
-
var
|
|
65870
|
+
var fs24 = require("fs");
|
|
65871
65871
|
var isDocker;
|
|
65872
65872
|
function hasDockerEnv() {
|
|
65873
65873
|
try {
|
|
65874
|
-
|
|
65874
|
+
fs24.statSync("/.dockerenv");
|
|
65875
65875
|
return true;
|
|
65876
65876
|
} catch (_3) {
|
|
65877
65877
|
return false;
|
|
@@ -65880,7 +65880,7 @@ var require_is_docker = __commonJS({
|
|
|
65880
65880
|
__name(hasDockerEnv, "hasDockerEnv");
|
|
65881
65881
|
function hasDockerCGroup() {
|
|
65882
65882
|
try {
|
|
65883
|
-
return
|
|
65883
|
+
return fs24.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
|
|
65884
65884
|
} catch (_3) {
|
|
65885
65885
|
return false;
|
|
65886
65886
|
}
|
|
@@ -65901,7 +65901,7 @@ var require_is_wsl = __commonJS({
|
|
|
65901
65901
|
"use strict";
|
|
65902
65902
|
init_import_meta_url();
|
|
65903
65903
|
var os10 = require("os");
|
|
65904
|
-
var
|
|
65904
|
+
var fs24 = require("fs");
|
|
65905
65905
|
var isDocker = require_is_docker();
|
|
65906
65906
|
var isWsl = /* @__PURE__ */ __name(() => {
|
|
65907
65907
|
if (process.platform !== "linux") {
|
|
@@ -65914,7 +65914,7 @@ var require_is_wsl = __commonJS({
|
|
|
65914
65914
|
return true;
|
|
65915
65915
|
}
|
|
65916
65916
|
try {
|
|
65917
|
-
return
|
|
65917
|
+
return fs24.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker() : false;
|
|
65918
65918
|
} catch (_3) {
|
|
65919
65919
|
return false;
|
|
65920
65920
|
}
|
|
@@ -65957,7 +65957,7 @@ var require_open = __commonJS({
|
|
|
65957
65957
|
init_import_meta_url();
|
|
65958
65958
|
var path62 = require("path");
|
|
65959
65959
|
var childProcess2 = require("child_process");
|
|
65960
|
-
var { promises:
|
|
65960
|
+
var { promises: fs24, constants: fsConstants } = require("fs");
|
|
65961
65961
|
var isWsl = require_is_wsl();
|
|
65962
65962
|
var isDocker = require_is_docker();
|
|
65963
65963
|
var defineLazyProperty = require_define_lazy_prop();
|
|
@@ -65973,14 +65973,14 @@ var require_open = __commonJS({
|
|
|
65973
65973
|
const configFilePath = "/etc/wsl.conf";
|
|
65974
65974
|
let isConfigFileExists = false;
|
|
65975
65975
|
try {
|
|
65976
|
-
await
|
|
65976
|
+
await fs24.access(configFilePath, fsConstants.F_OK);
|
|
65977
65977
|
isConfigFileExists = true;
|
|
65978
65978
|
} catch {
|
|
65979
65979
|
}
|
|
65980
65980
|
if (!isConfigFileExists) {
|
|
65981
65981
|
return defaultMountPoint;
|
|
65982
65982
|
}
|
|
65983
|
-
const configContent = await
|
|
65983
|
+
const configContent = await fs24.readFile(configFilePath, { encoding: "utf8" });
|
|
65984
65984
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
65985
65985
|
if (!configMountPoint) {
|
|
65986
65986
|
return defaultMountPoint;
|
|
@@ -66080,7 +66080,7 @@ var require_open = __commonJS({
|
|
|
66080
66080
|
const isBundled = !__dirname || __dirname === "/";
|
|
66081
66081
|
let exeLocalXdgOpen = false;
|
|
66082
66082
|
try {
|
|
66083
|
-
await
|
|
66083
|
+
await fs24.access(localXdgOpenPath, fsConstants.X_OK);
|
|
66084
66084
|
exeLocalXdgOpen = true;
|
|
66085
66085
|
} catch {
|
|
66086
66086
|
}
|
|
@@ -66747,14 +66747,14 @@ var require_is_core_module = __commonJS({
|
|
|
66747
66747
|
var require_async = __commonJS({
|
|
66748
66748
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/async.js"(exports2, module3) {
|
|
66749
66749
|
init_import_meta_url();
|
|
66750
|
-
var
|
|
66750
|
+
var fs24 = require("fs");
|
|
66751
66751
|
var getHomedir = require_homedir();
|
|
66752
66752
|
var path62 = require("path");
|
|
66753
66753
|
var caller = require_caller();
|
|
66754
66754
|
var nodeModulesPaths = require_node_modules_paths();
|
|
66755
66755
|
var normalizeOptions = require_normalize_options();
|
|
66756
66756
|
var isCore = require_is_core_module();
|
|
66757
|
-
var realpathFS = process.platform !== "win32" &&
|
|
66757
|
+
var realpathFS = process.platform !== "win32" && fs24.realpath && typeof fs24.realpath.native === "function" ? fs24.realpath.native : fs24.realpath;
|
|
66758
66758
|
var homedir2 = getHomedir();
|
|
66759
66759
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
|
66760
66760
|
return [
|
|
@@ -66763,7 +66763,7 @@ var require_async = __commonJS({
|
|
|
66763
66763
|
];
|
|
66764
66764
|
}, "defaultPaths");
|
|
66765
66765
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb) {
|
|
66766
|
-
|
|
66766
|
+
fs24.stat(file, function(err, stat4) {
|
|
66767
66767
|
if (!err) {
|
|
66768
66768
|
return cb(null, stat4.isFile() || stat4.isFIFO());
|
|
66769
66769
|
}
|
|
@@ -66773,7 +66773,7 @@ var require_async = __commonJS({
|
|
|
66773
66773
|
});
|
|
66774
66774
|
}, "isFile");
|
|
66775
66775
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb) {
|
|
66776
|
-
|
|
66776
|
+
fs24.stat(dir, function(err, stat4) {
|
|
66777
66777
|
if (!err) {
|
|
66778
66778
|
return cb(null, stat4.isDirectory());
|
|
66779
66779
|
}
|
|
@@ -66834,7 +66834,7 @@ var require_async = __commonJS({
|
|
|
66834
66834
|
opts = normalizeOptions(x2, opts);
|
|
66835
66835
|
var isFile = opts.isFile || defaultIsFile;
|
|
66836
66836
|
var isDirectory2 = opts.isDirectory || defaultIsDir;
|
|
66837
|
-
var readFile10 = opts.readFile ||
|
|
66837
|
+
var readFile10 = opts.readFile || fs24.readFile;
|
|
66838
66838
|
var realpath = opts.realpath || defaultRealpath;
|
|
66839
66839
|
var readPackage = opts.readPackage || defaultReadPackage;
|
|
66840
66840
|
if (opts.readFile && opts.readPackage) {
|
|
@@ -67293,13 +67293,13 @@ var require_sync = __commonJS({
|
|
|
67293
67293
|
"../../node_modules/.pnpm/resolve@1.22.8/node_modules/resolve/lib/sync.js"(exports2, module3) {
|
|
67294
67294
|
init_import_meta_url();
|
|
67295
67295
|
var isCore = require_is_core_module();
|
|
67296
|
-
var
|
|
67296
|
+
var fs24 = require("fs");
|
|
67297
67297
|
var path62 = require("path");
|
|
67298
67298
|
var getHomedir = require_homedir();
|
|
67299
67299
|
var caller = require_caller();
|
|
67300
67300
|
var nodeModulesPaths = require_node_modules_paths();
|
|
67301
67301
|
var normalizeOptions = require_normalize_options();
|
|
67302
|
-
var realpathFS = process.platform !== "win32" &&
|
|
67302
|
+
var realpathFS = process.platform !== "win32" && fs24.realpathSync && typeof fs24.realpathSync.native === "function" ? fs24.realpathSync.native : fs24.realpathSync;
|
|
67303
67303
|
var homedir2 = getHomedir();
|
|
67304
67304
|
var defaultPaths = /* @__PURE__ */ __name(function() {
|
|
67305
67305
|
return [
|
|
@@ -67309,7 +67309,7 @@ var require_sync = __commonJS({
|
|
|
67309
67309
|
}, "defaultPaths");
|
|
67310
67310
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
|
|
67311
67311
|
try {
|
|
67312
|
-
var stat4 =
|
|
67312
|
+
var stat4 = fs24.statSync(file, { throwIfNoEntry: false });
|
|
67313
67313
|
} catch (e3) {
|
|
67314
67314
|
if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
|
|
67315
67315
|
return false;
|
|
@@ -67319,7 +67319,7 @@ var require_sync = __commonJS({
|
|
|
67319
67319
|
}, "isFile");
|
|
67320
67320
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
|
|
67321
67321
|
try {
|
|
67322
|
-
var stat4 =
|
|
67322
|
+
var stat4 = fs24.statSync(dir, { throwIfNoEntry: false });
|
|
67323
67323
|
} catch (e3) {
|
|
67324
67324
|
if (e3 && (e3.code === "ENOENT" || e3.code === "ENOTDIR"))
|
|
67325
67325
|
return false;
|
|
@@ -67364,7 +67364,7 @@ var require_sync = __commonJS({
|
|
|
67364
67364
|
}
|
|
67365
67365
|
var opts = normalizeOptions(x2, options27);
|
|
67366
67366
|
var isFile = opts.isFile || defaultIsFile;
|
|
67367
|
-
var readFileSync25 = opts.readFileSync ||
|
|
67367
|
+
var readFileSync25 = opts.readFileSync || fs24.readFileSync;
|
|
67368
67368
|
var isDirectory2 = opts.isDirectory || defaultIsDir;
|
|
67369
67369
|
var realpathSync3 = opts.realpathSync || defaultRealpathSync;
|
|
67370
67370
|
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
@@ -67515,7 +67515,7 @@ var require_windows = __commonJS({
|
|
|
67515
67515
|
init_import_meta_url();
|
|
67516
67516
|
module3.exports = isexe;
|
|
67517
67517
|
isexe.sync = sync;
|
|
67518
|
-
var
|
|
67518
|
+
var fs24 = require("fs");
|
|
67519
67519
|
function checkPathExt(path62, options27) {
|
|
67520
67520
|
var pathext = options27.pathExt !== void 0 ? options27.pathExt : process.env.PATHEXT;
|
|
67521
67521
|
if (!pathext) {
|
|
@@ -67542,13 +67542,13 @@ var require_windows = __commonJS({
|
|
|
67542
67542
|
}
|
|
67543
67543
|
__name(checkStat, "checkStat");
|
|
67544
67544
|
function isexe(path62, options27, cb) {
|
|
67545
|
-
|
|
67545
|
+
fs24.stat(path62, function(er, stat4) {
|
|
67546
67546
|
cb(er, er ? false : checkStat(stat4, path62, options27));
|
|
67547
67547
|
});
|
|
67548
67548
|
}
|
|
67549
67549
|
__name(isexe, "isexe");
|
|
67550
67550
|
function sync(path62, options27) {
|
|
67551
|
-
return checkStat(
|
|
67551
|
+
return checkStat(fs24.statSync(path62), path62, options27);
|
|
67552
67552
|
}
|
|
67553
67553
|
__name(sync, "sync");
|
|
67554
67554
|
}
|
|
@@ -67560,15 +67560,15 @@ var require_mode = __commonJS({
|
|
|
67560
67560
|
init_import_meta_url();
|
|
67561
67561
|
module3.exports = isexe;
|
|
67562
67562
|
isexe.sync = sync;
|
|
67563
|
-
var
|
|
67563
|
+
var fs24 = require("fs");
|
|
67564
67564
|
function isexe(path62, options27, cb) {
|
|
67565
|
-
|
|
67565
|
+
fs24.stat(path62, function(er, stat4) {
|
|
67566
67566
|
cb(er, er ? false : checkStat(stat4, options27));
|
|
67567
67567
|
});
|
|
67568
67568
|
}
|
|
67569
67569
|
__name(isexe, "isexe");
|
|
67570
67570
|
function sync(path62, options27) {
|
|
67571
|
-
return checkStat(
|
|
67571
|
+
return checkStat(fs24.statSync(path62), options27);
|
|
67572
67572
|
}
|
|
67573
67573
|
__name(sync, "sync");
|
|
67574
67574
|
function checkStat(stat4, options27) {
|
|
@@ -67596,7 +67596,7 @@ var require_mode = __commonJS({
|
|
|
67596
67596
|
var require_isexe = __commonJS({
|
|
67597
67597
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports2, module3) {
|
|
67598
67598
|
init_import_meta_url();
|
|
67599
|
-
var
|
|
67599
|
+
var fs24 = require("fs");
|
|
67600
67600
|
var core;
|
|
67601
67601
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
67602
67602
|
core = require_windows();
|
|
@@ -67873,16 +67873,16 @@ var require_readShebang = __commonJS({
|
|
|
67873
67873
|
"../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module3) {
|
|
67874
67874
|
"use strict";
|
|
67875
67875
|
init_import_meta_url();
|
|
67876
|
-
var
|
|
67876
|
+
var fs24 = require("fs");
|
|
67877
67877
|
var shebangCommand = require_shebang_command();
|
|
67878
67878
|
function readShebang(command2) {
|
|
67879
67879
|
const size = 150;
|
|
67880
67880
|
const buffer = Buffer.alloc(size);
|
|
67881
67881
|
let fd;
|
|
67882
67882
|
try {
|
|
67883
|
-
fd =
|
|
67884
|
-
|
|
67885
|
-
|
|
67883
|
+
fd = fs24.openSync(command2, "r");
|
|
67884
|
+
fs24.readSync(fd, buffer, 0, size, 0);
|
|
67885
|
+
fs24.closeSync(fd);
|
|
67886
67886
|
} catch (e3) {
|
|
67887
67887
|
}
|
|
67888
67888
|
return shebangCommand(buffer.toString());
|
|
@@ -69280,7 +69280,7 @@ var require_arch = __commonJS({
|
|
|
69280
69280
|
"../../node_modules/.pnpm/arch@2.2.0/node_modules/arch/index.js"(exports2, module3) {
|
|
69281
69281
|
init_import_meta_url();
|
|
69282
69282
|
var cp2 = require("child_process");
|
|
69283
|
-
var
|
|
69283
|
+
var fs24 = require("fs");
|
|
69284
69284
|
var path62 = require("path");
|
|
69285
69285
|
module3.exports = /* @__PURE__ */ __name(function arch3() {
|
|
69286
69286
|
if (process.arch === "x64") {
|
|
@@ -69292,13 +69292,13 @@ var require_arch = __commonJS({
|
|
|
69292
69292
|
if (process.platform === "win32") {
|
|
69293
69293
|
var useEnv = false;
|
|
69294
69294
|
try {
|
|
69295
|
-
useEnv = !!(process.env.SYSTEMROOT &&
|
|
69295
|
+
useEnv = !!(process.env.SYSTEMROOT && fs24.statSync(process.env.SYSTEMROOT));
|
|
69296
69296
|
} catch (err) {
|
|
69297
69297
|
}
|
|
69298
69298
|
var sysRoot = useEnv ? process.env.SYSTEMROOT : "C:\\Windows";
|
|
69299
69299
|
var isWOW64 = false;
|
|
69300
69300
|
try {
|
|
69301
|
-
isWOW64 = !!
|
|
69301
|
+
isWOW64 = !!fs24.statSync(path62.join(sysRoot, "sysnative"));
|
|
69302
69302
|
} catch (err) {
|
|
69303
69303
|
}
|
|
69304
69304
|
return isWOW64 ? "x64" : "x86";
|
|
@@ -69319,11 +69319,11 @@ var require_command_exists = __commonJS({
|
|
|
69319
69319
|
init_import_meta_url();
|
|
69320
69320
|
var exec2 = require("child_process").exec;
|
|
69321
69321
|
var execSync4 = require("child_process").execSync;
|
|
69322
|
-
var
|
|
69322
|
+
var fs24 = require("fs");
|
|
69323
69323
|
var path62 = require("path");
|
|
69324
|
-
var access3 =
|
|
69325
|
-
var accessSync =
|
|
69326
|
-
var constants3 =
|
|
69324
|
+
var access3 = fs24.access;
|
|
69325
|
+
var accessSync = fs24.accessSync;
|
|
69326
|
+
var constants3 = fs24.constants || fs24;
|
|
69327
69327
|
var isUsingWindows = process.platform == "win32";
|
|
69328
69328
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
|
69329
69329
|
access3(
|
|
@@ -70820,8 +70820,8 @@ var require_node4 = __commonJS({
|
|
|
70820
70820
|
}
|
|
70821
70821
|
break;
|
|
70822
70822
|
case "FILE":
|
|
70823
|
-
var
|
|
70824
|
-
stream3 = new
|
|
70823
|
+
var fs24 = require("fs");
|
|
70824
|
+
stream3 = new fs24.SyncWriteStream(fd2, { autoClose: false });
|
|
70825
70825
|
stream3._type = "fs";
|
|
70826
70826
|
break;
|
|
70827
70827
|
case "PIPE":
|
|
@@ -87426,7 +87426,7 @@ var require_view = __commonJS({
|
|
|
87426
87426
|
init_import_meta_url();
|
|
87427
87427
|
var debug = require_src3()("express:view");
|
|
87428
87428
|
var path62 = require("path");
|
|
87429
|
-
var
|
|
87429
|
+
var fs24 = require("fs");
|
|
87430
87430
|
var dirname13 = path62.dirname;
|
|
87431
87431
|
var basename4 = path62.basename;
|
|
87432
87432
|
var extname4 = path62.extname;
|
|
@@ -87493,7 +87493,7 @@ var require_view = __commonJS({
|
|
|
87493
87493
|
function tryStat(path63) {
|
|
87494
87494
|
debug('stat "%s"', path63);
|
|
87495
87495
|
try {
|
|
87496
|
-
return
|
|
87496
|
+
return fs24.statSync(path63);
|
|
87497
87497
|
} catch (e3) {
|
|
87498
87498
|
return void 0;
|
|
87499
87499
|
}
|
|
@@ -87874,7 +87874,7 @@ var require_mime = __commonJS({
|
|
|
87874
87874
|
"../../node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports2, module3) {
|
|
87875
87875
|
init_import_meta_url();
|
|
87876
87876
|
var path62 = require("path");
|
|
87877
|
-
var
|
|
87877
|
+
var fs24 = require("fs");
|
|
87878
87878
|
function Mime() {
|
|
87879
87879
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
87880
87880
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -87896,7 +87896,7 @@ var require_mime = __commonJS({
|
|
|
87896
87896
|
};
|
|
87897
87897
|
Mime.prototype.load = function(file) {
|
|
87898
87898
|
this._loading = file;
|
|
87899
|
-
var map = {}, content =
|
|
87899
|
+
var map = {}, content = fs24.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
87900
87900
|
lines.forEach(function(line) {
|
|
87901
87901
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
87902
87902
|
map[fields.shift()] = fields;
|
|
@@ -88147,7 +88147,7 @@ var require_send = __commonJS({
|
|
|
88147
88147
|
var escapeHtml = require_escape_html();
|
|
88148
88148
|
var etag = require_etag();
|
|
88149
88149
|
var fresh = require_fresh();
|
|
88150
|
-
var
|
|
88150
|
+
var fs24 = require("fs");
|
|
88151
88151
|
var mime = require_mime();
|
|
88152
88152
|
var ms = require_ms2();
|
|
88153
88153
|
var onFinished = require_on_finished();
|
|
@@ -88483,7 +88483,7 @@ var require_send = __commonJS({
|
|
|
88483
88483
|
var i = 0;
|
|
88484
88484
|
var self2 = this;
|
|
88485
88485
|
debug('stat "%s"', path63);
|
|
88486
|
-
|
|
88486
|
+
fs24.stat(path63, /* @__PURE__ */ __name(function onstat(err, stat4) {
|
|
88487
88487
|
if (err && err.code === "ENOENT" && !extname4(path63) && path63[path63.length - 1] !== sep3) {
|
|
88488
88488
|
return next(err);
|
|
88489
88489
|
}
|
|
@@ -88500,7 +88500,7 @@ var require_send = __commonJS({
|
|
|
88500
88500
|
}
|
|
88501
88501
|
var p2 = path63 + "." + self2._extensions[i++];
|
|
88502
88502
|
debug('stat "%s"', p2);
|
|
88503
|
-
|
|
88503
|
+
fs24.stat(p2, function(err2, stat4) {
|
|
88504
88504
|
if (err2)
|
|
88505
88505
|
return next(err2);
|
|
88506
88506
|
if (stat4.isDirectory())
|
|
@@ -88522,7 +88522,7 @@ var require_send = __commonJS({
|
|
|
88522
88522
|
}
|
|
88523
88523
|
var p2 = join15(path63, self2._index[i]);
|
|
88524
88524
|
debug('stat "%s"', p2);
|
|
88525
|
-
|
|
88525
|
+
fs24.stat(p2, function(err2, stat4) {
|
|
88526
88526
|
if (err2)
|
|
88527
88527
|
return next(err2);
|
|
88528
88528
|
if (stat4.isDirectory())
|
|
@@ -88537,7 +88537,7 @@ var require_send = __commonJS({
|
|
|
88537
88537
|
SendStream.prototype.stream = /* @__PURE__ */ __name(function stream2(path63, options27) {
|
|
88538
88538
|
var self2 = this;
|
|
88539
88539
|
var res = this.res;
|
|
88540
|
-
var stream3 =
|
|
88540
|
+
var stream3 = fs24.createReadStream(path63, options27);
|
|
88541
88541
|
this.emit("stream", stream3);
|
|
88542
88542
|
stream3.pipe(res);
|
|
88543
88543
|
function cleanup() {
|
|
@@ -103843,7 +103843,7 @@ var require_utils5 = __commonJS({
|
|
|
103843
103843
|
"../../node_modules/.pnpm/rc@1.2.8/node_modules/rc/lib/utils.js"(exports2) {
|
|
103844
103844
|
"use strict";
|
|
103845
103845
|
init_import_meta_url();
|
|
103846
|
-
var
|
|
103846
|
+
var fs24 = require("fs");
|
|
103847
103847
|
var ini = require_ini();
|
|
103848
103848
|
var path62 = require("path");
|
|
103849
103849
|
var stripJsonComments = require_strip_json_comments();
|
|
@@ -103862,7 +103862,7 @@ var require_utils5 = __commonJS({
|
|
|
103862
103862
|
var file2 = path62.join.apply(null, args);
|
|
103863
103863
|
var content;
|
|
103864
103864
|
try {
|
|
103865
|
-
return
|
|
103865
|
+
return fs24.readFileSync(file2, "utf-8");
|
|
103866
103866
|
} catch (err) {
|
|
103867
103867
|
return;
|
|
103868
103868
|
}
|
|
@@ -103901,7 +103901,7 @@ var require_utils5 = __commonJS({
|
|
|
103901
103901
|
function find2(start, rel2) {
|
|
103902
103902
|
var file2 = path62.join(start, rel2);
|
|
103903
103903
|
try {
|
|
103904
|
-
|
|
103904
|
+
fs24.statSync(file2);
|
|
103905
103905
|
return file2;
|
|
103906
103906
|
} catch (err) {
|
|
103907
103907
|
if (path62.dirname(start) !== start)
|
|
@@ -104410,19 +104410,19 @@ var require_update_check = __commonJS({
|
|
|
104410
104410
|
init_import_meta_url();
|
|
104411
104411
|
var { URL: URL7 } = require("url");
|
|
104412
104412
|
var { join: join15 } = require("path");
|
|
104413
|
-
var
|
|
104413
|
+
var fs24 = require("fs");
|
|
104414
104414
|
var { promisify: promisify2 } = require("util");
|
|
104415
104415
|
var { tmpdir } = require("os");
|
|
104416
104416
|
var registryUrl = require_registry_url();
|
|
104417
|
-
var writeFile6 = promisify2(
|
|
104418
|
-
var mkdir6 = promisify2(
|
|
104419
|
-
var readFile10 = promisify2(
|
|
104417
|
+
var writeFile6 = promisify2(fs24.writeFile);
|
|
104418
|
+
var mkdir6 = promisify2(fs24.mkdir);
|
|
104419
|
+
var readFile10 = promisify2(fs24.readFile);
|
|
104420
104420
|
var compareVersions = /* @__PURE__ */ __name((a, b2) => a.localeCompare(b2, "en-US", { numeric: true }), "compareVersions");
|
|
104421
104421
|
var encode = /* @__PURE__ */ __name((value) => encodeURIComponent(value).replace(/^%40/, "@"), "encode");
|
|
104422
104422
|
var getFile = /* @__PURE__ */ __name(async (details, distTag) => {
|
|
104423
104423
|
const rootDir = tmpdir();
|
|
104424
104424
|
const subDir = join15(rootDir, "update-check");
|
|
104425
|
-
if (!
|
|
104425
|
+
if (!fs24.existsSync(subDir)) {
|
|
104426
104426
|
await mkdir6(subDir);
|
|
104427
104427
|
}
|
|
104428
104428
|
let name = `${details.name}-${distTag}.json`;
|
|
@@ -104432,7 +104432,7 @@ var require_update_check = __commonJS({
|
|
|
104432
104432
|
return join15(subDir, name);
|
|
104433
104433
|
}, "getFile");
|
|
104434
104434
|
var evaluateCache = /* @__PURE__ */ __name(async (file, time, interval2) => {
|
|
104435
|
-
if (
|
|
104435
|
+
if (fs24.existsSync(file)) {
|
|
104436
104436
|
const content = await readFile10(file, "utf8");
|
|
104437
104437
|
const { lastUpdate, latest } = JSON.parse(content);
|
|
104438
104438
|
const nextCheck = lastUpdate + interval2;
|
|
@@ -117790,7 +117790,7 @@ init_import_meta_url();
|
|
|
117790
117790
|
|
|
117791
117791
|
// src/api/dev.ts
|
|
117792
117792
|
init_import_meta_url();
|
|
117793
|
-
var
|
|
117793
|
+
var import_undici24 = __toESM(require_undici());
|
|
117794
117794
|
|
|
117795
117795
|
// src/dev.tsx
|
|
117796
117796
|
init_import_meta_url();
|
|
@@ -119652,7 +119652,7 @@ var import_node_assert2 = __toESM(require("node:assert"));
|
|
|
119652
119652
|
var import_undici3 = __toESM(require_undici());
|
|
119653
119653
|
|
|
119654
119654
|
// package.json
|
|
119655
|
-
var version = "3.
|
|
119655
|
+
var version = "3.41.0";
|
|
119656
119656
|
var package_default = {
|
|
119657
119657
|
name: "wrangler",
|
|
119658
119658
|
version,
|
|
@@ -127422,7 +127422,7 @@ __name(useErrorHandler, "useErrorHandler");
|
|
|
127422
127422
|
|
|
127423
127423
|
// src/dev/dev.tsx
|
|
127424
127424
|
var import_signal_exit8 = __toESM(require_signal_exit());
|
|
127425
|
-
var
|
|
127425
|
+
var import_undici23 = __toESM(require_undici());
|
|
127426
127426
|
|
|
127427
127427
|
// src/dev-registry.ts
|
|
127428
127428
|
init_import_meta_url();
|
|
@@ -129382,12 +129382,12 @@ init_import_meta_url();
|
|
|
129382
129382
|
var import_url8 = require("url");
|
|
129383
129383
|
var import_toml7 = __toESM(require_toml());
|
|
129384
129384
|
var import_chalk17 = __toESM(require_chalk());
|
|
129385
|
-
var
|
|
129385
|
+
var import_undici21 = __toESM(require_undici());
|
|
129386
129386
|
|
|
129387
129387
|
// src/init.ts
|
|
129388
129388
|
init_import_meta_url();
|
|
129389
|
-
var
|
|
129390
|
-
var
|
|
129389
|
+
var fs23 = __toESM(require("node:fs"));
|
|
129390
|
+
var import_promises19 = require("node:fs/promises");
|
|
129391
129391
|
var import_node_path49 = __toESM(require("node:path"));
|
|
129392
129392
|
var import_toml6 = __toESM(require_toml());
|
|
129393
129393
|
|
|
@@ -129710,7 +129710,7 @@ var import_node_module2 = __toESM(require("node:module"));
|
|
|
129710
129710
|
var import_node_os7 = __toESM(require("node:os"));
|
|
129711
129711
|
var import_toml5 = __toESM(require_toml());
|
|
129712
129712
|
var import_chalk16 = __toESM(require_chalk());
|
|
129713
|
-
var
|
|
129713
|
+
var import_undici20 = __toESM(require_undici());
|
|
129714
129714
|
|
|
129715
129715
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
|
|
129716
129716
|
init_import_meta_url();
|
|
@@ -142015,11 +142015,96 @@ function shorten(query, length) {
|
|
|
142015
142015
|
}
|
|
142016
142016
|
__name(shorten, "shorten");
|
|
142017
142017
|
|
|
142018
|
+
// src/d1/export.ts
|
|
142019
|
+
init_import_meta_url();
|
|
142020
|
+
var import_promises7 = __toESM(require("node:fs/promises"));
|
|
142021
|
+
var import_undici9 = __toESM(require_undici());
|
|
142022
|
+
function Options5(yargs) {
|
|
142023
|
+
return Name(yargs).option("local", {
|
|
142024
|
+
type: "boolean",
|
|
142025
|
+
describe: "Export from your local DB you use with wrangler dev",
|
|
142026
|
+
conflicts: "remote"
|
|
142027
|
+
}).option("remote", {
|
|
142028
|
+
type: "boolean",
|
|
142029
|
+
describe: "Export from your live D1",
|
|
142030
|
+
conflicts: "local"
|
|
142031
|
+
}).option("no-schema", {
|
|
142032
|
+
type: "boolean",
|
|
142033
|
+
describe: "Only output table contents, not the DB schema",
|
|
142034
|
+
conflicts: "no-data"
|
|
142035
|
+
}).option("no-data", {
|
|
142036
|
+
type: "boolean",
|
|
142037
|
+
describe: "Only output table schema, not the contents of the DBs themselves",
|
|
142038
|
+
conflicts: "no-schema"
|
|
142039
|
+
}).option("table", {
|
|
142040
|
+
type: "string",
|
|
142041
|
+
describe: "Specify which tables to include in export"
|
|
142042
|
+
}).option("output", {
|
|
142043
|
+
type: "string",
|
|
142044
|
+
describe: "Which .sql file to output to",
|
|
142045
|
+
demandOption: true
|
|
142046
|
+
});
|
|
142047
|
+
}
|
|
142048
|
+
__name(Options5, "Options");
|
|
142049
|
+
var Handler5 = /* @__PURE__ */ __name(async (args) => {
|
|
142050
|
+
const { local, remote, name, output, noSchema, noData, table } = args;
|
|
142051
|
+
await printWranglerBanner();
|
|
142052
|
+
const config = readConfig(args.config, args);
|
|
142053
|
+
if (local)
|
|
142054
|
+
throw new UserError(
|
|
142055
|
+
`Local imports/exports will be coming in a future version of Wrangler.`
|
|
142056
|
+
);
|
|
142057
|
+
if (!remote)
|
|
142058
|
+
throw new UserError(`You must specify either --local or --remote`);
|
|
142059
|
+
const tables = table ? Array.isArray(table) ? table : [table] : [];
|
|
142060
|
+
const result = await exportRemotely(
|
|
142061
|
+
config,
|
|
142062
|
+
name,
|
|
142063
|
+
output,
|
|
142064
|
+
tables,
|
|
142065
|
+
noSchema,
|
|
142066
|
+
noData
|
|
142067
|
+
);
|
|
142068
|
+
return result;
|
|
142069
|
+
}, "Handler");
|
|
142070
|
+
async function exportRemotely(config, name, output, tables, noSchema, noData) {
|
|
142071
|
+
const accountId = await requireAuth(config);
|
|
142072
|
+
const db = await getDatabaseByNameOrBinding(
|
|
142073
|
+
config,
|
|
142074
|
+
accountId,
|
|
142075
|
+
name
|
|
142076
|
+
);
|
|
142077
|
+
logger.log(`\u{1F300} Executing on remote database ${name} (${db.uuid}):`);
|
|
142078
|
+
logger.log(`\u{1F300} Creating export...`);
|
|
142079
|
+
const metadata = await fetchResult(
|
|
142080
|
+
`/accounts/${accountId}/d1/database/${db.uuid}/export`,
|
|
142081
|
+
{
|
|
142082
|
+
method: "POST",
|
|
142083
|
+
headers: {
|
|
142084
|
+
"Content-Type": "application/json"
|
|
142085
|
+
},
|
|
142086
|
+
body: JSON.stringify({
|
|
142087
|
+
outputFormat: "file",
|
|
142088
|
+
dumpOptions: {
|
|
142089
|
+
noSchema,
|
|
142090
|
+
noData,
|
|
142091
|
+
tables
|
|
142092
|
+
}
|
|
142093
|
+
})
|
|
142094
|
+
}
|
|
142095
|
+
);
|
|
142096
|
+
logger.log(`\u{1F300} Downloading SQL to ${output}`);
|
|
142097
|
+
const contents = await (0, import_undici9.fetch)(metadata.signedUrl);
|
|
142098
|
+
await import_promises7.default.writeFile(output, contents.body || "");
|
|
142099
|
+
logger.log(`Done!`);
|
|
142100
|
+
}
|
|
142101
|
+
__name(exportRemotely, "exportRemotely");
|
|
142102
|
+
|
|
142018
142103
|
// src/d1/info.tsx
|
|
142019
142104
|
init_import_meta_url();
|
|
142020
142105
|
var import_ink_table4 = __toESM(require_dist3());
|
|
142021
142106
|
var import_react6 = __toESM(require_react());
|
|
142022
|
-
function
|
|
142107
|
+
function Options6(d1ListYargs) {
|
|
142023
142108
|
return d1ListYargs.positional("name", {
|
|
142024
142109
|
describe: "The name of the DB",
|
|
142025
142110
|
type: "string",
|
|
@@ -142030,8 +142115,8 @@ function Options5(d1ListYargs) {
|
|
|
142030
142115
|
default: false
|
|
142031
142116
|
});
|
|
142032
142117
|
}
|
|
142033
|
-
__name(
|
|
142034
|
-
var
|
|
142118
|
+
__name(Options6, "Options");
|
|
142119
|
+
var Handler6 = withConfig(
|
|
142035
142120
|
async ({ name, config, json }) => {
|
|
142036
142121
|
const accountId = await requireAuth(config);
|
|
142037
142122
|
const db = await getDatabaseByNameOrBinding(
|
|
@@ -142133,7 +142218,7 @@ var Handler5 = withConfig(
|
|
|
142133
142218
|
|
|
142134
142219
|
// src/d1/insights.ts
|
|
142135
142220
|
init_import_meta_url();
|
|
142136
|
-
function
|
|
142221
|
+
function Options7(d1ListYargs) {
|
|
142137
142222
|
return d1ListYargs.positional("name", {
|
|
142138
142223
|
describe: "The name of the DB",
|
|
142139
142224
|
type: "string",
|
|
@@ -142164,14 +142249,14 @@ function Options6(d1ListYargs) {
|
|
|
142164
142249
|
default: false
|
|
142165
142250
|
});
|
|
142166
142251
|
}
|
|
142167
|
-
__name(
|
|
142252
|
+
__name(Options7, "Options");
|
|
142168
142253
|
var cliOptionToGraphQLOption = {
|
|
142169
142254
|
time: "queryDurationMs",
|
|
142170
142255
|
reads: "rowsRead",
|
|
142171
142256
|
writes: "rowsWritten",
|
|
142172
142257
|
count: "count"
|
|
142173
142258
|
};
|
|
142174
|
-
var
|
|
142259
|
+
var Handler7 = withConfig(
|
|
142175
142260
|
async ({
|
|
142176
142261
|
name,
|
|
142177
142262
|
config,
|
|
@@ -142915,13 +143000,13 @@ function d1(yargs) {
|
|
|
142915
143000
|
return yargs.command("list", "List D1 databases", Options, Handler).command(
|
|
142916
143001
|
"info <name>",
|
|
142917
143002
|
"Get information about a D1 database, including the current database size and state.",
|
|
142918
|
-
|
|
142919
|
-
|
|
143003
|
+
Options6,
|
|
143004
|
+
Handler6
|
|
142920
143005
|
).command(
|
|
142921
143006
|
"insights <name>",
|
|
142922
143007
|
"Experimental command. Get information about the queries run on a D1 database.",
|
|
142923
|
-
|
|
142924
|
-
|
|
143008
|
+
Options7,
|
|
143009
|
+
Handler7
|
|
142925
143010
|
).command(
|
|
142926
143011
|
"create <name>",
|
|
142927
143012
|
"Create D1 database",
|
|
@@ -142961,6 +143046,11 @@ function d1(yargs) {
|
|
|
142961
143046
|
"Executed command or SQL file",
|
|
142962
143047
|
Options4,
|
|
142963
143048
|
Handler4
|
|
143049
|
+
).command(
|
|
143050
|
+
"export <name>",
|
|
143051
|
+
"Export the contents or schema of your database as a .sql file",
|
|
143052
|
+
Options5,
|
|
143053
|
+
Handler5
|
|
142964
143054
|
).command(
|
|
142965
143055
|
"time-travel",
|
|
142966
143056
|
"Use Time Travel to restore, fork or copy a database at a specific point-in-time.",
|
|
@@ -143007,7 +143097,7 @@ var import_path11 = __toESM(require("path"));
|
|
|
143007
143097
|
init_import_meta_url();
|
|
143008
143098
|
var import_node_url11 = require("node:url");
|
|
143009
143099
|
var import_miniflare9 = require("miniflare");
|
|
143010
|
-
var
|
|
143100
|
+
var import_undici10 = __toESM(require_undici());
|
|
143011
143101
|
var API_MAX = 1e4;
|
|
143012
143102
|
var BATCH_KEY_MAX = API_MAX / 2;
|
|
143013
143103
|
async function createKVNamespace(accountId, title) {
|
|
@@ -143098,7 +143188,7 @@ function unexpectedKVKeyValueProps(keyValue) {
|
|
|
143098
143188
|
}
|
|
143099
143189
|
__name(unexpectedKVKeyValueProps, "unexpectedKVKeyValueProps");
|
|
143100
143190
|
function asFormData(fields) {
|
|
143101
|
-
const formData = new
|
|
143191
|
+
const formData = new import_undici10.FormData();
|
|
143102
143192
|
for (const [name, value] of Object.entries(fields)) {
|
|
143103
143193
|
formData.append(name, value);
|
|
143104
143194
|
}
|
|
@@ -143273,7 +143363,7 @@ init_import_meta_url();
|
|
|
143273
143363
|
|
|
143274
143364
|
// src/metrics/metrics-dispatcher.ts
|
|
143275
143365
|
init_import_meta_url();
|
|
143276
|
-
var
|
|
143366
|
+
var import_undici11 = __toESM(require_undici());
|
|
143277
143367
|
|
|
143278
143368
|
// src/metrics/metrics-config.ts
|
|
143279
143369
|
init_import_meta_url();
|
|
@@ -143449,7 +143539,7 @@ async function getMetricsDispatcher(options27) {
|
|
|
143449
143539
|
...event.properties
|
|
143450
143540
|
}
|
|
143451
143541
|
});
|
|
143452
|
-
(0,
|
|
143542
|
+
(0, import_undici11.fetch)(`${SPARROW_URL}/api/v1/${event.type}`, {
|
|
143453
143543
|
method: "POST",
|
|
143454
143544
|
headers: {
|
|
143455
143545
|
Accept: "*/*",
|
|
@@ -143659,7 +143749,7 @@ var import_node_path29 = __toESM(require("node:path"));
|
|
|
143659
143749
|
// src/sites.ts
|
|
143660
143750
|
init_import_meta_url();
|
|
143661
143751
|
var import_node_assert14 = __toESM(require("node:assert"));
|
|
143662
|
-
var
|
|
143752
|
+
var import_promises8 = require("node:fs/promises");
|
|
143663
143753
|
var path35 = __toESM(require("node:path"));
|
|
143664
143754
|
var import_chalk10 = __toESM(require_chalk());
|
|
143665
143755
|
var import_ignore = __toESM(require_ignore());
|
|
@@ -143731,7 +143821,7 @@ var HIDDEN_FILES_TO_INCLUDE = /* @__PURE__ */ new Set([
|
|
|
143731
143821
|
// See https://datatracker.ietf.org/doc/html/rfc8615
|
|
143732
143822
|
]);
|
|
143733
143823
|
async function* getFilesInFolder(dirPath) {
|
|
143734
|
-
const files = await (0,
|
|
143824
|
+
const files = await (0, import_promises8.readdir)(dirPath, { withFileTypes: true });
|
|
143735
143825
|
for (const file of files) {
|
|
143736
143826
|
if (ALWAYS_IGNORE.has(file.name)) {
|
|
143737
143827
|
continue;
|
|
@@ -143833,7 +143923,7 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun, ol
|
|
|
143833
143923
|
const assetFile = path35.relative(assetDirectory, absAssetFile);
|
|
143834
143924
|
if (!include(assetFile) || exclude(assetFile))
|
|
143835
143925
|
continue;
|
|
143836
|
-
const content = await (0,
|
|
143926
|
+
const content = await (0, import_promises8.readFile)(absAssetFile, "base64");
|
|
143837
143927
|
const assetSize = Buffer.byteLength(content);
|
|
143838
143928
|
await validateAssetSize(absAssetFile, assetFile);
|
|
143839
143929
|
const assetKey = hashAsset(hasher, assetFile, content);
|
|
@@ -143886,7 +143976,7 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun, ol
|
|
|
143886
143976
|
for (const [absAssetFile, assetKey] of nextBucket) {
|
|
143887
143977
|
bucket.push({
|
|
143888
143978
|
key: assetKey,
|
|
143889
|
-
value: await (0,
|
|
143979
|
+
value: await (0, import_promises8.readFile)(absAssetFile, "base64"),
|
|
143890
143980
|
base64: true
|
|
143891
143981
|
});
|
|
143892
143982
|
if (controller.signal.aborted)
|
|
@@ -143973,7 +144063,7 @@ function createPatternMatcher(patterns, exclude) {
|
|
|
143973
144063
|
}
|
|
143974
144064
|
__name(createPatternMatcher, "createPatternMatcher");
|
|
143975
144065
|
async function validateAssetSize(absFilePath, relativeFilePath) {
|
|
143976
|
-
const { size } = await (0,
|
|
144066
|
+
const { size } = await (0, import_promises8.stat)(absFilePath);
|
|
143977
144067
|
if (size > 25 * 1024 * 1024) {
|
|
143978
144068
|
throw new UserError(
|
|
143979
144069
|
`File ${relativeFilePath} is too big, it should be under 25 MiB. See https://developers.cloudflare.com/workers/platform/limits#kv-limits`
|
|
@@ -144549,7 +144639,7 @@ init_import_meta_url();
|
|
|
144549
144639
|
// src/docs/helpers.ts
|
|
144550
144640
|
init_import_meta_url();
|
|
144551
144641
|
var import_node_assert15 = __toESM(require("node:assert"));
|
|
144552
|
-
var
|
|
144642
|
+
var import_undici12 = __toESM(require_undici());
|
|
144553
144643
|
async function runSearch(searchTerm) {
|
|
144554
144644
|
const id = "8MU1G3QO9P";
|
|
144555
144645
|
const index = "developers-cloudflare2";
|
|
@@ -144561,7 +144651,7 @@ async function runSearch(searchTerm) {
|
|
|
144561
144651
|
});
|
|
144562
144652
|
(0, import_node_assert15.default)(id, "Missing Algolia App ID");
|
|
144563
144653
|
(0, import_node_assert15.default)(key, "Missing Algolia Key");
|
|
144564
|
-
const searchResp = await (0,
|
|
144654
|
+
const searchResp = await (0, import_undici12.fetch)(
|
|
144565
144655
|
`https://${id}-dsn.algolia.net/1/indexes/${index}/query`,
|
|
144566
144656
|
{
|
|
144567
144657
|
method: "POST",
|
|
@@ -145888,14 +145978,14 @@ init_import_meta_url();
|
|
|
145888
145978
|
init_import_meta_url();
|
|
145889
145979
|
var import_node_crypto6 = require("node:crypto");
|
|
145890
145980
|
var import_node_fs26 = require("node:fs");
|
|
145891
|
-
var
|
|
145981
|
+
var import_promises13 = require("node:fs/promises");
|
|
145892
145982
|
var import_node_path39 = __toESM(require("node:path"));
|
|
145893
145983
|
|
|
145894
145984
|
// src/api/pages/create-worker-bundle-contents.ts
|
|
145895
145985
|
init_import_meta_url();
|
|
145896
145986
|
var import_node_fs24 = require("node:fs");
|
|
145897
145987
|
var import_node_path31 = __toESM(require("node:path"));
|
|
145898
|
-
var
|
|
145988
|
+
var import_undici13 = __toESM(require_undici());
|
|
145899
145989
|
async function createUploadWorkerBundleContents(workerBundle, config) {
|
|
145900
145990
|
const workerBundleFormData = createWorkerBundleFormData(workerBundle, config);
|
|
145901
145991
|
const metadata = JSON.parse(workerBundleFormData.get("metadata"));
|
|
@@ -145903,7 +145993,7 @@ async function createUploadWorkerBundleContents(workerBundle, config) {
|
|
|
145903
145993
|
delete metadata.bindings;
|
|
145904
145994
|
}
|
|
145905
145995
|
workerBundleFormData.set("metadata", JSON.stringify(metadata));
|
|
145906
|
-
return await new
|
|
145996
|
+
return await new import_undici13.Response(workerBundleFormData).blob();
|
|
145907
145997
|
}
|
|
145908
145998
|
__name(createUploadWorkerBundleContents, "createUploadWorkerBundleContents");
|
|
145909
145999
|
function createWorkerBundleFormData(workerBundle, config) {
|
|
@@ -146169,7 +146259,7 @@ __name(getRoutesValidationErrorMessage, "getRoutesValidationErrorMessage");
|
|
|
146169
146259
|
|
|
146170
146260
|
// src/pages/functions/buildPlugin.ts
|
|
146171
146261
|
init_import_meta_url();
|
|
146172
|
-
var
|
|
146262
|
+
var import_promises10 = require("node:fs/promises");
|
|
146173
146263
|
var import_node_path34 = require("node:path");
|
|
146174
146264
|
|
|
146175
146265
|
// src/pages/utils.ts
|
|
@@ -146221,7 +146311,7 @@ __name(getPagesTmpDir, "getPagesTmpDir");
|
|
|
146221
146311
|
|
|
146222
146312
|
// src/pages/functions/buildWorker.ts
|
|
146223
146313
|
init_import_meta_url();
|
|
146224
|
-
var
|
|
146314
|
+
var import_promises9 = require("node:fs/promises");
|
|
146225
146315
|
var import_node_path33 = require("node:path");
|
|
146226
146316
|
var import_esbuild3 = require("esbuild");
|
|
146227
146317
|
|
|
@@ -146312,8 +146402,8 @@ function buildWorkerFromFunctions({
|
|
|
146312
146402
|
args.resolveDir,
|
|
146313
146403
|
args.path.slice("assets:".length)
|
|
146314
146404
|
);
|
|
146315
|
-
const exists = await (0,
|
|
146316
|
-
const isDirectory2 = exists && (await (0,
|
|
146405
|
+
const exists = await (0, import_promises9.access)(directory).then(() => true).catch(() => false);
|
|
146406
|
+
const isDirectory2 = exists && (await (0, import_promises9.lstat)(directory)).isDirectory();
|
|
146317
146407
|
if (!isDirectory2) {
|
|
146318
146408
|
return {
|
|
146319
146409
|
errors: [
|
|
@@ -146342,11 +146432,11 @@ function buildWorkerFromFunctions({
|
|
|
146342
146432
|
"pages-plugins",
|
|
146343
146433
|
identifier
|
|
146344
146434
|
);
|
|
146345
|
-
await (0,
|
|
146435
|
+
await (0, import_promises9.rm)(staticAssetsOutputDirectory, {
|
|
146346
146436
|
force: true,
|
|
146347
146437
|
recursive: true
|
|
146348
146438
|
});
|
|
146349
|
-
await (0,
|
|
146439
|
+
await (0, import_promises9.cp)(args.path, staticAssetsOutputDirectory, {
|
|
146350
146440
|
force: true,
|
|
146351
146441
|
recursive: true
|
|
146352
146442
|
});
|
|
@@ -146605,8 +146695,8 @@ function buildPluginFromFunctions({
|
|
|
146605
146695
|
args.resolveDir,
|
|
146606
146696
|
args.path.slice("assets:".length)
|
|
146607
146697
|
);
|
|
146608
|
-
const exists = await (0,
|
|
146609
|
-
const isDirectory2 = exists && (await (0,
|
|
146698
|
+
const exists = await (0, import_promises10.access)(directory).then(() => true).catch(() => false);
|
|
146699
|
+
const isDirectory2 = exists && (await (0, import_promises10.lstat)(directory)).isDirectory();
|
|
146610
146700
|
if (!isDirectory2) {
|
|
146611
146701
|
return {
|
|
146612
146702
|
errors: [
|
|
@@ -146651,7 +146741,7 @@ __name(buildPluginFromFunctions, "buildPluginFromFunctions");
|
|
|
146651
146741
|
|
|
146652
146742
|
// src/pages/functions/filepath-routing.ts
|
|
146653
146743
|
init_import_meta_url();
|
|
146654
|
-
var
|
|
146744
|
+
var import_promises11 = __toESM(require("node:fs/promises"));
|
|
146655
146745
|
var import_node_path35 = __toESM(require("node:path"));
|
|
146656
146746
|
var import_esbuild4 = require("esbuild");
|
|
146657
146747
|
async function generateConfigFromFileTree({
|
|
@@ -146777,7 +146867,7 @@ async function forEachFile(baseDir, fn2) {
|
|
|
146777
146867
|
const returnValues = [];
|
|
146778
146868
|
while (isNotEmpty(searchPaths)) {
|
|
146779
146869
|
const cwd2 = searchPaths.shift();
|
|
146780
|
-
const dir = await
|
|
146870
|
+
const dir = await import_promises11.default.readdir(cwd2, { withFileTypes: true });
|
|
146781
146871
|
for (const entry of dir) {
|
|
146782
146872
|
const pathname = import_node_path35.default.join(cwd2, entry.name);
|
|
146783
146873
|
if (entry.isDirectory()) {
|
|
@@ -146797,7 +146887,7 @@ __name(isNotEmpty, "isNotEmpty");
|
|
|
146797
146887
|
|
|
146798
146888
|
// src/pages/functions/routes.ts
|
|
146799
146889
|
init_import_meta_url();
|
|
146800
|
-
var
|
|
146890
|
+
var import_promises12 = __toESM(require("node:fs/promises"));
|
|
146801
146891
|
var import_node_path36 = __toESM(require("node:path"));
|
|
146802
146892
|
|
|
146803
146893
|
// src/pages/functions/identifiers.ts
|
|
@@ -146877,7 +146967,7 @@ async function writeRoutesModule({
|
|
|
146877
146967
|
}) {
|
|
146878
146968
|
const { importMap, routes } = parseConfig(config, srcDir);
|
|
146879
146969
|
const routesModule = generateRoutesModule(importMap, routes);
|
|
146880
|
-
await
|
|
146970
|
+
await import_promises12.default.writeFile(outfile, routesModule);
|
|
146881
146971
|
return outfile;
|
|
146882
146972
|
}
|
|
146883
146973
|
__name(writeRoutesModule, "writeRoutesModule");
|
|
@@ -147149,7 +147239,7 @@ async function buildFunctions({
|
|
|
147149
147239
|
__name(buildFunctions, "buildFunctions");
|
|
147150
147240
|
|
|
147151
147241
|
// src/pages/build.ts
|
|
147152
|
-
function
|
|
147242
|
+
function Options8(yargs) {
|
|
147153
147243
|
return yargs.positional("directory", {
|
|
147154
147244
|
type: "string",
|
|
147155
147245
|
default: "functions",
|
|
@@ -147234,8 +147324,8 @@ function Options7(yargs) {
|
|
|
147234
147324
|
}
|
|
147235
147325
|
});
|
|
147236
147326
|
}
|
|
147237
|
-
__name(
|
|
147238
|
-
var
|
|
147327
|
+
__name(Options8, "Options");
|
|
147328
|
+
var Handler8 = /* @__PURE__ */ __name(async (args) => {
|
|
147239
147329
|
const validatedArgs = await validateArgs(args);
|
|
147240
147330
|
let bundle = void 0;
|
|
147241
147331
|
if (validatedArgs.plugin) {
|
|
@@ -147401,7 +147491,7 @@ async function maybeReadPagesConfig(args) {
|
|
|
147401
147491
|
}
|
|
147402
147492
|
return {
|
|
147403
147493
|
...config,
|
|
147404
|
-
hash: (0, import_node_crypto6.createHash)("sha256").update(await (0,
|
|
147494
|
+
hash: (0, import_node_crypto6.createHash)("sha256").update(await (0, import_promises13.readFile)(configPath)).digest("hex")
|
|
147405
147495
|
};
|
|
147406
147496
|
}
|
|
147407
147497
|
__name(maybeReadPagesConfig, "maybeReadPagesConfig");
|
|
@@ -147520,14 +147610,14 @@ We looked for the Functions directory (${(0, import_node_path39.basename)(
|
|
|
147520
147610
|
init_import_meta_url();
|
|
147521
147611
|
var import_node_fs27 = require("node:fs");
|
|
147522
147612
|
var import_node_path40 = __toESM(require("node:path"));
|
|
147523
|
-
function
|
|
147613
|
+
function Options9(yargs) {
|
|
147524
147614
|
return yargs.positional("projectDir", {
|
|
147525
147615
|
type: "string",
|
|
147526
147616
|
description: "The location of the Pages project"
|
|
147527
147617
|
});
|
|
147528
147618
|
}
|
|
147529
|
-
__name(
|
|
147530
|
-
var
|
|
147619
|
+
__name(Options9, "Options");
|
|
147620
|
+
var Handler9 = /* @__PURE__ */ __name(async (args) => {
|
|
147531
147621
|
if (!args.projectDir) {
|
|
147532
147622
|
throw new FatalError("No Pages project location specified");
|
|
147533
147623
|
}
|
|
@@ -147567,11 +147657,11 @@ init_import_meta_url();
|
|
|
147567
147657
|
var import_node_fs28 = require("node:fs");
|
|
147568
147658
|
var import_node_path43 = require("node:path");
|
|
147569
147659
|
var import_node_process11 = require("node:process");
|
|
147570
|
-
var
|
|
147660
|
+
var import_undici14 = __toESM(require_undici());
|
|
147571
147661
|
|
|
147572
147662
|
// src/pages/upload.tsx
|
|
147573
147663
|
init_import_meta_url();
|
|
147574
|
-
var
|
|
147664
|
+
var import_promises15 = require("node:fs/promises");
|
|
147575
147665
|
var import_node_path42 = require("node:path");
|
|
147576
147666
|
var import_ink7 = __toESM(require_build2());
|
|
147577
147667
|
var import_ink_spinner = __toESM(require_build4());
|
|
@@ -148056,20 +148146,20 @@ var import_react10 = __toESM(require_react());
|
|
|
148056
148146
|
|
|
148057
148147
|
// src/pages/validate.tsx
|
|
148058
148148
|
init_import_meta_url();
|
|
148059
|
-
var
|
|
148149
|
+
var import_promises14 = require("node:fs/promises");
|
|
148060
148150
|
var import_node_path41 = require("node:path");
|
|
148061
148151
|
var import_mime2 = __toESM(require_mime2());
|
|
148062
148152
|
var import_minimatch = __toESM(require_minimatch());
|
|
148063
148153
|
init_hash();
|
|
148064
|
-
function
|
|
148154
|
+
function Options10(yargs) {
|
|
148065
148155
|
return yargs.positional("directory", {
|
|
148066
148156
|
type: "string",
|
|
148067
148157
|
demandOption: true,
|
|
148068
148158
|
description: "The directory of static files to validate"
|
|
148069
148159
|
});
|
|
148070
148160
|
}
|
|
148071
|
-
__name(
|
|
148072
|
-
var
|
|
148161
|
+
__name(Options10, "Options");
|
|
148162
|
+
var Handler10 = /* @__PURE__ */ __name(async ({ directory }) => {
|
|
148073
148163
|
if (!directory) {
|
|
148074
148164
|
throw new FatalError("Must specify a directory.", 1);
|
|
148075
148165
|
}
|
|
@@ -148090,12 +148180,12 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
|
148090
148180
|
].map((pattern) => new import_minimatch.Minimatch(pattern));
|
|
148091
148181
|
const directory = (0, import_node_path41.resolve)(args.directory);
|
|
148092
148182
|
const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
|
|
148093
|
-
const files = await (0,
|
|
148183
|
+
const files = await (0, import_promises14.readdir)(dir);
|
|
148094
148184
|
await Promise.all(
|
|
148095
148185
|
files.map(async (file) => {
|
|
148096
148186
|
const filepath = (0, import_node_path41.join)(dir, file);
|
|
148097
148187
|
const relativeFilepath = (0, import_node_path41.relative)(startingDir, filepath);
|
|
148098
|
-
const filestat = await (0,
|
|
148188
|
+
const filestat = await (0, import_promises14.stat)(filepath);
|
|
148099
148189
|
for (const minimatch of IGNORE_LIST) {
|
|
148100
148190
|
if (minimatch.match(relativeFilepath)) {
|
|
148101
148191
|
return;
|
|
@@ -148142,7 +148232,7 @@ ${name} is ${prettyBytes(filestat.size, {
|
|
|
148142
148232
|
}, "validate");
|
|
148143
148233
|
|
|
148144
148234
|
// src/pages/upload.tsx
|
|
148145
|
-
function
|
|
148235
|
+
function Options11(yargs) {
|
|
148146
148236
|
return yargs.positional("directory", {
|
|
148147
148237
|
type: "string",
|
|
148148
148238
|
demandOption: true,
|
|
@@ -148158,8 +148248,8 @@ function Options10(yargs) {
|
|
|
148158
148248
|
}
|
|
148159
148249
|
});
|
|
148160
148250
|
}
|
|
148161
|
-
__name(
|
|
148162
|
-
var
|
|
148251
|
+
__name(Options11, "Options");
|
|
148252
|
+
var Handler11 = /* @__PURE__ */ __name(async ({
|
|
148163
148253
|
directory,
|
|
148164
148254
|
outputManifestPath,
|
|
148165
148255
|
skipCaching
|
|
@@ -148177,8 +148267,8 @@ var Handler10 = /* @__PURE__ */ __name(async ({
|
|
|
148177
148267
|
skipCaching: skipCaching ?? false
|
|
148178
148268
|
});
|
|
148179
148269
|
if (outputManifestPath) {
|
|
148180
|
-
await (0,
|
|
148181
|
-
await (0,
|
|
148270
|
+
await (0, import_promises15.mkdir)((0, import_node_path42.dirname)(outputManifestPath), { recursive: true });
|
|
148271
|
+
await (0, import_promises15.writeFile)(outputManifestPath, JSON.stringify(manifest));
|
|
148182
148272
|
}
|
|
148183
148273
|
logger.log(`\u2728 Upload complete!`);
|
|
148184
148274
|
}, "Handler");
|
|
@@ -148264,7 +148354,7 @@ var upload = /* @__PURE__ */ __name(async (args) => {
|
|
|
148264
148354
|
const payload = await Promise.all(
|
|
148265
148355
|
bucket.files.map(async (file) => ({
|
|
148266
148356
|
key: file.hash,
|
|
148267
|
-
value: (await (0,
|
|
148357
|
+
value: (await (0, import_promises15.readFile)(file.path)).toString("base64"),
|
|
148268
148358
|
metadata: {
|
|
148269
148359
|
contentType: file.contentType
|
|
148270
148360
|
},
|
|
@@ -148509,7 +148599,7 @@ async function deploy2({
|
|
|
148509
148599
|
projectName,
|
|
148510
148600
|
skipCaching: skipCaching ?? false
|
|
148511
148601
|
});
|
|
148512
|
-
const formData = new
|
|
148602
|
+
const formData = new import_undici14.FormData();
|
|
148513
148603
|
formData.append("manifest", JSON.stringify(manifest));
|
|
148514
148604
|
if (branch) {
|
|
148515
148605
|
formData.append("branch", branch);
|
|
@@ -148524,17 +148614,17 @@ async function deploy2({
|
|
|
148524
148614
|
formData.append("commit_dirty", commitDirty);
|
|
148525
148615
|
}
|
|
148526
148616
|
if (_headers) {
|
|
148527
|
-
formData.append("_headers", new
|
|
148617
|
+
formData.append("_headers", new import_undici14.File([_headers], "_headers"));
|
|
148528
148618
|
logger.log(`\u2728 Uploading _headers`);
|
|
148529
148619
|
}
|
|
148530
148620
|
if (_redirects) {
|
|
148531
|
-
formData.append("_redirects", new
|
|
148621
|
+
formData.append("_redirects", new import_undici14.File([_redirects], "_redirects"));
|
|
148532
148622
|
logger.log(`\u2728 Uploading _redirects`);
|
|
148533
148623
|
}
|
|
148534
148624
|
if (filepathRoutingConfig) {
|
|
148535
148625
|
formData.append(
|
|
148536
148626
|
"functions-filepath-routing-config.json",
|
|
148537
|
-
new
|
|
148627
|
+
new import_undici14.File(
|
|
148538
148628
|
[filepathRoutingConfig],
|
|
148539
148629
|
"functions-filepath-routing-config.json"
|
|
148540
148630
|
)
|
|
@@ -148584,7 +148674,7 @@ async function deploy2({
|
|
|
148584
148674
|
);
|
|
148585
148675
|
formData.append(
|
|
148586
148676
|
"_worker.bundle",
|
|
148587
|
-
new
|
|
148677
|
+
new import_undici14.File([workerBundleContents], "_worker.bundle")
|
|
148588
148678
|
);
|
|
148589
148679
|
logger.log(`\u2728 Uploading Worker bundle`);
|
|
148590
148680
|
if (_routesCustom) {
|
|
@@ -148593,7 +148683,7 @@ async function deploy2({
|
|
|
148593
148683
|
validateRoutes2(routesCustomJSON, (0, import_node_path43.join)(directory, "_routes.json"));
|
|
148594
148684
|
formData.append(
|
|
148595
148685
|
"_routes.json",
|
|
148596
|
-
new
|
|
148686
|
+
new import_undici14.File([_routesCustom], "_routes.json")
|
|
148597
148687
|
);
|
|
148598
148688
|
logger.log(`\u2728 Uploading _routes.json`);
|
|
148599
148689
|
} catch (err) {
|
|
@@ -148610,7 +148700,7 @@ async function deploy2({
|
|
|
148610
148700
|
);
|
|
148611
148701
|
formData.append(
|
|
148612
148702
|
"_worker.bundle",
|
|
148613
|
-
new
|
|
148703
|
+
new import_undici14.File([workerBundleContents], "_worker.bundle")
|
|
148614
148704
|
);
|
|
148615
148705
|
logger.log(`\u2728 Uploading Functions bundle`);
|
|
148616
148706
|
if (_routesCustom) {
|
|
@@ -148619,7 +148709,7 @@ async function deploy2({
|
|
|
148619
148709
|
validateRoutes2(routesCustomJSON, (0, import_node_path43.join)(directory, "_routes.json"));
|
|
148620
148710
|
formData.append(
|
|
148621
148711
|
"_routes.json",
|
|
148622
|
-
new
|
|
148712
|
+
new import_undici14.File([_routesCustom], "_routes.json")
|
|
148623
148713
|
);
|
|
148624
148714
|
logger.log(`\u2728 Uploading _routes.json`);
|
|
148625
148715
|
} catch (err) {
|
|
@@ -148633,7 +148723,7 @@ async function deploy2({
|
|
|
148633
148723
|
if (_routesGenerated) {
|
|
148634
148724
|
formData.append(
|
|
148635
148725
|
"_routes.json",
|
|
148636
|
-
new
|
|
148726
|
+
new import_undici14.File([_routesGenerated], "_routes.json")
|
|
148637
148727
|
);
|
|
148638
148728
|
}
|
|
148639
148729
|
} catch {
|
|
@@ -148978,7 +149068,7 @@ async function promptSelectProject({
|
|
|
148978
149068
|
__name(promptSelectProject, "promptSelectProject");
|
|
148979
149069
|
|
|
148980
149070
|
// src/pages/deploy.tsx
|
|
148981
|
-
function
|
|
149071
|
+
function Options12(yargs) {
|
|
148982
149072
|
return yargs.positional("directory", {
|
|
148983
149073
|
type: "string",
|
|
148984
149074
|
demandOption: true,
|
|
@@ -149025,8 +149115,8 @@ function Options11(yargs) {
|
|
|
149025
149115
|
}
|
|
149026
149116
|
});
|
|
149027
149117
|
}
|
|
149028
|
-
__name(
|
|
149029
|
-
var
|
|
149118
|
+
__name(Options12, "Options");
|
|
149119
|
+
var Handler12 = /* @__PURE__ */ __name(async ({
|
|
149030
149120
|
_: _3,
|
|
149031
149121
|
directory,
|
|
149032
149122
|
projectName,
|
|
@@ -149193,7 +149283,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
|
149193
149283
|
|
|
149194
149284
|
// src/pages/deployment-tails.ts
|
|
149195
149285
|
init_import_meta_url();
|
|
149196
|
-
var
|
|
149286
|
+
var import_promises16 = require("node:timers/promises");
|
|
149197
149287
|
var import_signal_exit6 = __toESM(require_signal_exit());
|
|
149198
149288
|
|
|
149199
149289
|
// src/tail/createTail.ts
|
|
@@ -149515,7 +149605,7 @@ __name(createTail, "createTail");
|
|
|
149515
149605
|
// src/pages/deployment-tails.ts
|
|
149516
149606
|
var statusChoices = ["ok", "error", "canceled"];
|
|
149517
149607
|
var isStatusChoiceList = /* @__PURE__ */ __name((data) => data?.every((d2) => statusChoices.includes(d2)) ?? false, "isStatusChoiceList");
|
|
149518
|
-
function
|
|
149608
|
+
function Options13(yargs) {
|
|
149519
149609
|
return yargs.positional("deployment", {
|
|
149520
149610
|
type: "string",
|
|
149521
149611
|
description: "(Optional) ID or URL of the deployment to tail. Specify by environment if deployment ID is unknown."
|
|
@@ -149566,8 +149656,8 @@ function Options12(yargs) {
|
|
|
149566
149656
|
array: true
|
|
149567
149657
|
});
|
|
149568
149658
|
}
|
|
149569
|
-
__name(
|
|
149570
|
-
async function
|
|
149659
|
+
__name(Options13, "Options");
|
|
149660
|
+
async function Handler13({
|
|
149571
149661
|
deployment,
|
|
149572
149662
|
projectName,
|
|
149573
149663
|
environment,
|
|
@@ -149693,10 +149783,10 @@ async function Handler12({
|
|
|
149693
149783
|
while (tail.readyState !== tail.OPEN) {
|
|
149694
149784
|
switch (tail.readyState) {
|
|
149695
149785
|
case tail.CONNECTING:
|
|
149696
|
-
await (0,
|
|
149786
|
+
await (0, import_promises16.setTimeout)(100);
|
|
149697
149787
|
break;
|
|
149698
149788
|
case tail.CLOSING:
|
|
149699
|
-
await (0,
|
|
149789
|
+
await (0, import_promises16.setTimeout)(100);
|
|
149700
149790
|
break;
|
|
149701
149791
|
case tail.CLOSED:
|
|
149702
149792
|
await sendMetricsEvent("end log stream", {
|
|
@@ -149711,7 +149801,7 @@ async function Handler12({
|
|
|
149711
149801
|
logger.log(`Connected to deployment ${deploymentId}, waiting for logs...`);
|
|
149712
149802
|
}
|
|
149713
149803
|
}
|
|
149714
|
-
__name(
|
|
149804
|
+
__name(Handler13, "Handler");
|
|
149715
149805
|
|
|
149716
149806
|
// src/pages/deployments.tsx
|
|
149717
149807
|
init_import_meta_url();
|
|
@@ -149810,7 +149900,7 @@ var SERVICE_BINDING_REGEXP = new RegExp(
|
|
|
149810
149900
|
);
|
|
149811
149901
|
var DEFAULT_IP = process.platform === "win32" ? "127.0.0.1" : "localhost";
|
|
149812
149902
|
var DEFAULT_SCRIPT_PATH = "_worker.js";
|
|
149813
|
-
function
|
|
149903
|
+
function Options14(yargs) {
|
|
149814
149904
|
return yargs.positional("directory", {
|
|
149815
149905
|
type: "string",
|
|
149816
149906
|
demandOption: void 0,
|
|
@@ -149965,8 +150055,8 @@ function Options13(yargs) {
|
|
|
149965
150055
|
}
|
|
149966
150056
|
});
|
|
149967
150057
|
}
|
|
149968
|
-
__name(
|
|
149969
|
-
var
|
|
150058
|
+
__name(Options14, "Options");
|
|
150059
|
+
var Handler14 = /* @__PURE__ */ __name(async (args) => {
|
|
149970
150060
|
if (args.logLevel) {
|
|
149971
150061
|
logger.loggerLevel = args.logLevel;
|
|
149972
150062
|
}
|
|
@@ -150582,7 +150672,7 @@ __name(getBindingsFromArgs, "getBindingsFromArgs");
|
|
|
150582
150672
|
|
|
150583
150673
|
// src/pages/download-config.ts
|
|
150584
150674
|
init_import_meta_url();
|
|
150585
|
-
var
|
|
150675
|
+
var import_promises17 = require("node:fs/promises");
|
|
150586
150676
|
var import_toml4 = __toESM(require_toml());
|
|
150587
150677
|
var import_chalk12 = __toESM(require_chalk());
|
|
150588
150678
|
async function toEnvironment(project, accountId) {
|
|
@@ -150671,7 +150761,7 @@ async function toEnvironment(project, accountId) {
|
|
|
150671
150761
|
}
|
|
150672
150762
|
__name(toEnvironment, "toEnvironment");
|
|
150673
150763
|
async function writeWranglerToml(toml) {
|
|
150674
|
-
await (0,
|
|
150764
|
+
await (0, import_promises17.writeFile)(
|
|
150675
150765
|
"wrangler.toml",
|
|
150676
150766
|
[
|
|
150677
150767
|
`# Generated by Wrangler on ${/* @__PURE__ */ new Date()}`,
|
|
@@ -150698,14 +150788,14 @@ async function downloadProject(accountId, projectName) {
|
|
|
150698
150788
|
};
|
|
150699
150789
|
}
|
|
150700
150790
|
__name(downloadProject, "downloadProject");
|
|
150701
|
-
function
|
|
150791
|
+
function Options15(yargs) {
|
|
150702
150792
|
return yargs.positional("projectName", {
|
|
150703
150793
|
type: "string",
|
|
150704
150794
|
description: "The Pages project to download"
|
|
150705
150795
|
});
|
|
150706
150796
|
}
|
|
150707
|
-
__name(
|
|
150708
|
-
var
|
|
150797
|
+
__name(Options15, "Options");
|
|
150798
|
+
var Handler15 = /* @__PURE__ */ __name(async ({ projectName }) => {
|
|
150709
150799
|
void sendMetricsEvent("download pages config");
|
|
150710
150800
|
await printWranglerBanner();
|
|
150711
150801
|
const projectConfig = getConfigCache(
|
|
@@ -150796,21 +150886,21 @@ function pages(yargs) {
|
|
|
150796
150886
|
return yargs.command(
|
|
150797
150887
|
"dev [directory] [-- command..]",
|
|
150798
150888
|
"\u{1F9D1}\u200D\u{1F4BB} Develop your full-stack Pages application locally",
|
|
150799
|
-
|
|
150800
|
-
|
|
150889
|
+
Options14,
|
|
150890
|
+
Handler14
|
|
150801
150891
|
).command(
|
|
150802
150892
|
"functions",
|
|
150803
150893
|
false,
|
|
150804
150894
|
(args) => args.command(
|
|
150805
150895
|
"build [directory]",
|
|
150806
150896
|
"Compile a folder of Cloudflare Pages Functions into a single Worker",
|
|
150807
|
-
|
|
150808
|
-
|
|
150897
|
+
Options8,
|
|
150898
|
+
Handler8
|
|
150809
150899
|
).command(
|
|
150810
150900
|
"build-env [projectDir]",
|
|
150811
150901
|
"Render a list of environment variables from the config file",
|
|
150812
|
-
|
|
150813
|
-
|
|
150902
|
+
Options9,
|
|
150903
|
+
Handler9
|
|
150814
150904
|
).command(
|
|
150815
150905
|
"optimize-routes [routesPath] [outputRoutesPath]",
|
|
150816
150906
|
"Consolidate and optimize the route paths declared in _routes.json",
|
|
@@ -150835,11 +150925,11 @@ function pages(yargs) {
|
|
|
150835
150925
|
"Delete a Cloudflare Pages project",
|
|
150836
150926
|
DeleteOptions,
|
|
150837
150927
|
DeleteHandler
|
|
150838
|
-
).command("upload [directory]", false,
|
|
150928
|
+
).command("upload [directory]", false, Options11, Handler11).command(
|
|
150839
150929
|
"validate [directory]",
|
|
150840
150930
|
false,
|
|
150841
|
-
|
|
150842
|
-
|
|
150931
|
+
Options10,
|
|
150932
|
+
Handler10
|
|
150843
150933
|
)
|
|
150844
150934
|
).command(
|
|
150845
150935
|
"deployment",
|
|
@@ -150852,27 +150942,27 @@ function pages(yargs) {
|
|
|
150852
150942
|
).command(
|
|
150853
150943
|
"create [directory]",
|
|
150854
150944
|
"\u{1F199} Publish a directory of static assets as a Pages deployment",
|
|
150855
|
-
|
|
150856
|
-
|
|
150945
|
+
Options12,
|
|
150946
|
+
Handler12
|
|
150857
150947
|
).command(
|
|
150858
150948
|
"tail [deployment]",
|
|
150859
150949
|
"Start a tailing session for a project's deployment and livestream logs from your Functions",
|
|
150860
|
-
|
|
150861
|
-
|
|
150950
|
+
Options13,
|
|
150951
|
+
Handler13
|
|
150862
150952
|
)
|
|
150863
150953
|
).command(
|
|
150864
150954
|
["deploy [directory]", "publish [directory]"],
|
|
150865
150955
|
"\u{1F199} Deploy a directory of static assets as a Pages deployment",
|
|
150866
|
-
|
|
150867
|
-
|
|
150956
|
+
Options12,
|
|
150957
|
+
Handler12
|
|
150868
150958
|
).command(
|
|
150869
150959
|
"download",
|
|
150870
150960
|
"\u26A1\uFE0F Download settings from your project",
|
|
150871
150961
|
(args) => args.command(
|
|
150872
150962
|
"config [projectName]",
|
|
150873
150963
|
"Experimental: Download your Pages project config as a wrangler.toml file",
|
|
150874
|
-
|
|
150875
|
-
|
|
150964
|
+
Options15,
|
|
150965
|
+
Handler15
|
|
150876
150966
|
)
|
|
150877
150967
|
);
|
|
150878
150968
|
}
|
|
@@ -152006,7 +152096,7 @@ __name(queues, "queues");
|
|
|
152006
152096
|
// src/r2/index.ts
|
|
152007
152097
|
init_import_meta_url();
|
|
152008
152098
|
var import_node_buffer4 = require("node:buffer");
|
|
152009
|
-
var
|
|
152099
|
+
var fs21 = __toESM(require("node:fs"));
|
|
152010
152100
|
var path45 = __toESM(require("node:path"));
|
|
152011
152101
|
var stream = __toESM(require("node:stream"));
|
|
152012
152102
|
var import_web = require("node:stream/web");
|
|
@@ -152488,7 +152578,7 @@ __name(DisableHandler, "DisableHandler");
|
|
|
152488
152578
|
// src/r2/index.ts
|
|
152489
152579
|
var CHUNK_SIZE = 1024;
|
|
152490
152580
|
async function createFileReadableStream(filePath) {
|
|
152491
|
-
const handle = await
|
|
152581
|
+
const handle = await fs21.promises.open(filePath, "r");
|
|
152492
152582
|
let position = 0;
|
|
152493
152583
|
return new import_web.ReadableStream({
|
|
152494
152584
|
async pull(controller) {
|
|
@@ -152559,8 +152649,8 @@ function r22(r2Yargs) {
|
|
|
152559
152649
|
}
|
|
152560
152650
|
let output;
|
|
152561
152651
|
if (file) {
|
|
152562
|
-
|
|
152563
|
-
output =
|
|
152652
|
+
fs21.mkdirSync(path45.dirname(file), { recursive: true });
|
|
152653
|
+
output = fs21.createWriteStream(file);
|
|
152564
152654
|
} else {
|
|
152565
152655
|
output = process.stdout;
|
|
152566
152656
|
}
|
|
@@ -152676,7 +152766,7 @@ function r22(r2Yargs) {
|
|
|
152676
152766
|
let objectSize;
|
|
152677
152767
|
if (file) {
|
|
152678
152768
|
object = await createFileReadableStream(file);
|
|
152679
|
-
const stats =
|
|
152769
|
+
const stats = fs21.statSync(file);
|
|
152680
152770
|
objectSize = stats.size;
|
|
152681
152771
|
} else {
|
|
152682
152772
|
const buffer = await new Promise((resolve19, reject) => {
|
|
@@ -153026,7 +153116,7 @@ __name(r22, "r2");
|
|
|
153026
153116
|
init_import_meta_url();
|
|
153027
153117
|
var import_node_path46 = __toESM(require("node:path"));
|
|
153028
153118
|
var import_node_readline2 = __toESM(require("node:readline"));
|
|
153029
|
-
var
|
|
153119
|
+
var import_undici15 = __toESM(require_undici());
|
|
153030
153120
|
function isMissingWorkerError(e3) {
|
|
153031
153121
|
return typeof e3 === "object" && e3 !== null && e3.code === 10007;
|
|
153032
153122
|
}
|
|
@@ -153304,7 +153394,7 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
|
153304
153394
|
__name(getSettings, "getSettings");
|
|
153305
153395
|
function putBindingsSettings(bindings) {
|
|
153306
153396
|
const url4 = !secretBulkArgs.env || isLegacyEnv(config) ? `/accounts/${accountId}/workers/scripts/${scriptName}/settings` : `/accounts/${accountId}/workers/services/${scriptName}/environments/${secretBulkArgs.env}/settings`;
|
|
153307
|
-
const data = new
|
|
153397
|
+
const data = new import_undici15.FormData();
|
|
153308
153398
|
data.set("settings", JSON.stringify({ bindings }));
|
|
153309
153399
|
return fetchResult(url4, {
|
|
153310
153400
|
method: "PATCH",
|
|
@@ -162351,7 +162441,7 @@ var INTEGRATIONS = {
|
|
|
162351
162441
|
};
|
|
162352
162442
|
|
|
162353
162443
|
// src/sentry/index.ts
|
|
162354
|
-
var
|
|
162444
|
+
var import_undici18 = __toESM(require_undici());
|
|
162355
162445
|
var sentryReportingAllowed = false;
|
|
162356
162446
|
var makeSentry10Transport = /* @__PURE__ */ __name((options27) => {
|
|
162357
162447
|
let eventQueue = [];
|
|
@@ -162365,9 +162455,9 @@ var makeSentry10Transport = /* @__PURE__ */ __name((options27) => {
|
|
|
162365
162455
|
const eventsToSend = [...eventQueue];
|
|
162366
162456
|
eventQueue = [];
|
|
162367
162457
|
for (const event of eventsToSend) {
|
|
162368
|
-
await (0,
|
|
162458
|
+
await (0, import_undici18.fetch)(event[0], event[1]);
|
|
162369
162459
|
}
|
|
162370
|
-
const response = await (0,
|
|
162460
|
+
const response = await (0, import_undici18.fetch)(
|
|
162371
162461
|
`https://platform.dash.cloudflare.com/sentry/envelope`,
|
|
162372
162462
|
{
|
|
162373
162463
|
method: "POST",
|
|
@@ -162487,7 +162577,7 @@ __name(closeSentry, "closeSentry");
|
|
|
162487
162577
|
|
|
162488
162578
|
// src/tail/index.ts
|
|
162489
162579
|
init_import_meta_url();
|
|
162490
|
-
var
|
|
162580
|
+
var import_promises18 = require("node:timers/promises");
|
|
162491
162581
|
var import_signal_exit7 = __toESM(require_signal_exit());
|
|
162492
162582
|
|
|
162493
162583
|
// src/zones.ts
|
|
@@ -162739,10 +162829,10 @@ async function tailHandler(args) {
|
|
|
162739
162829
|
while (tail.readyState !== tail.OPEN) {
|
|
162740
162830
|
switch (tail.readyState) {
|
|
162741
162831
|
case tail.CONNECTING:
|
|
162742
|
-
await (0,
|
|
162832
|
+
await (0, import_promises18.setTimeout)(100);
|
|
162743
162833
|
break;
|
|
162744
162834
|
case tail.CLOSING:
|
|
162745
|
-
await (0,
|
|
162835
|
+
await (0, import_promises18.setTimeout)(100);
|
|
162746
162836
|
break;
|
|
162747
162837
|
case tail.CLOSED:
|
|
162748
162838
|
await sendMetricsEvent("end log stream", {
|
|
@@ -163142,7 +163232,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
|
163142
163232
|
|
|
163143
163233
|
// src/type-generation.ts
|
|
163144
163234
|
init_import_meta_url();
|
|
163145
|
-
var
|
|
163235
|
+
var fs22 = __toESM(require("node:fs"));
|
|
163146
163236
|
|
|
163147
163237
|
// src/dev/dev-vars.ts
|
|
163148
163238
|
init_import_meta_url();
|
|
@@ -163196,7 +163286,7 @@ async function typesHandler(args) {
|
|
|
163196
163286
|
}
|
|
163197
163287
|
await printWranglerBanner();
|
|
163198
163288
|
const configPath = args.config ?? findWranglerToml(process.cwd(), args.experimentalJsonConfig);
|
|
163199
|
-
if (!configPath || !
|
|
163289
|
+
if (!configPath || !fs22.existsSync(configPath) || fs22.statSync(configPath).isDirectory()) {
|
|
163200
163290
|
logger.warn(
|
|
163201
163291
|
`No config file detected${args.config ? ` (at ${args.config})` : ""}, aborting`
|
|
163202
163292
|
);
|
|
@@ -163405,7 +163495,7 @@ function writeDTSFile({
|
|
|
163405
163495
|
}) {
|
|
163406
163496
|
const wranglerOverrideDTSPath = findUpSync(path62);
|
|
163407
163497
|
try {
|
|
163408
|
-
if (wranglerOverrideDTSPath !== void 0 && !
|
|
163498
|
+
if (wranglerOverrideDTSPath !== void 0 && !fs22.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
|
163409
163499
|
throw new UserError(
|
|
163410
163500
|
`A non-wrangler ${path62} already exists, please rename and try again.`
|
|
163411
163501
|
);
|
|
@@ -163431,7 +163521,7 @@ ${modulesTypeStructure.join("\n")}`;
|
|
|
163431
163521
|
const wranglerCommandUsed = ["wrangler", ...process.argv.slice(2)].join(" ");
|
|
163432
163522
|
const typesHaveBeenFound = envTypeStructure.length || modulesTypeStructure.length;
|
|
163433
163523
|
if (formatType === "modules" || typesHaveBeenFound) {
|
|
163434
|
-
|
|
163524
|
+
fs22.writeFileSync(
|
|
163435
163525
|
path62,
|
|
163436
163526
|
[
|
|
163437
163527
|
`// Generated by Wrangler on ${/* @__PURE__ */ new Date()}`,
|
|
@@ -163671,7 +163761,7 @@ __name(handler25, "handler");
|
|
|
163671
163761
|
init_import_meta_url();
|
|
163672
163762
|
var import_node_fs31 = require("node:fs");
|
|
163673
163763
|
var import_node_readline3 = require("node:readline");
|
|
163674
|
-
var
|
|
163764
|
+
var import_undici19 = __toESM(require_undici());
|
|
163675
163765
|
var VECTORIZE_MAX_BATCH_SIZE = 1e3;
|
|
163676
163766
|
var VECTORIZE_UPSERT_BATCH_SIZE = VECTORIZE_MAX_BATCH_SIZE;
|
|
163677
163767
|
var VECTORIZE_MAX_UPSERT_VECTOR_RECORDS = 1e5;
|
|
@@ -163709,10 +163799,10 @@ async function handler26(args) {
|
|
|
163709
163799
|
}
|
|
163710
163800
|
let vectorInsertCount = 0;
|
|
163711
163801
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
|
163712
|
-
const formData = new
|
|
163802
|
+
const formData = new import_undici19.FormData();
|
|
163713
163803
|
formData.append(
|
|
163714
163804
|
"vectors",
|
|
163715
|
-
new
|
|
163805
|
+
new import_undici19.File([batch.join(`
|
|
163716
163806
|
`)], "vectors.ndjson", {
|
|
163717
163807
|
type: "application/x-ndjson"
|
|
163718
163808
|
})
|
|
@@ -165622,7 +165712,7 @@ var DEFAULT_LOCAL_PORT = 8787;
|
|
|
165622
165712
|
var DEFAULT_INSPECTOR_PORT = 9229;
|
|
165623
165713
|
var proxy = process.env.https_proxy || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.HTTP_PROXY || void 0;
|
|
165624
165714
|
if (proxy) {
|
|
165625
|
-
(0,
|
|
165715
|
+
(0, import_undici20.setGlobalDispatcher)(new import_undici20.ProxyAgent(proxy));
|
|
165626
165716
|
logger.log(
|
|
165627
165717
|
`Proxy environment variables detected. We'll use your proxy for fetch requests.`
|
|
165628
165718
|
);
|
|
@@ -166324,7 +166414,7 @@ The \`init\` command will be removed in a future version.`
|
|
|
166324
166414
|
}
|
|
166325
166415
|
}
|
|
166326
166416
|
}
|
|
166327
|
-
if (
|
|
166417
|
+
if (fs23.existsSync(wranglerTomlDestination)) {
|
|
166328
166418
|
let shouldContinue = false;
|
|
166329
166419
|
logger.warn(
|
|
166330
166420
|
`${import_node_path49.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
|
@@ -166368,10 +166458,10 @@ The \`init\` command will be removed in a future version.`
|
|
|
166368
166458
|
return;
|
|
166369
166459
|
}
|
|
166370
166460
|
}
|
|
166371
|
-
await (0,
|
|
166461
|
+
await (0, import_promises19.mkdir)(creationDirectory, { recursive: true });
|
|
166372
166462
|
const compatibilityDate = (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
|
|
166373
166463
|
try {
|
|
166374
|
-
await (0,
|
|
166464
|
+
await (0, import_promises19.writeFile)(
|
|
166375
166465
|
wranglerTomlDestination,
|
|
166376
166466
|
import_toml6.default.stringify({
|
|
166377
166467
|
name: workerName,
|
|
@@ -166396,7 +166486,7 @@ ${err.message ?? err}`
|
|
|
166396
166486
|
const shouldInitGit = yesFlag || await confirm("Would you like to use git to manage this Worker?");
|
|
166397
166487
|
if (shouldInitGit) {
|
|
166398
166488
|
await initializeGit(creationDirectory);
|
|
166399
|
-
await (0,
|
|
166489
|
+
await (0, import_promises19.writeFile)(
|
|
166400
166490
|
import_node_path49.default.join(creationDirectory, ".gitignore"),
|
|
166401
166491
|
readFileSync5(import_node_path49.default.join(getBasePath(), "templates/gitignore"))
|
|
166402
166492
|
);
|
|
@@ -166420,7 +166510,7 @@ ${err.message ?? err}`
|
|
|
166420
166510
|
if (!pathToPackageJson) {
|
|
166421
166511
|
shouldCreatePackageJson = yesFlag || await confirm("No package.json found. Would you like to create one?");
|
|
166422
166512
|
if (shouldCreatePackageJson) {
|
|
166423
|
-
await (0,
|
|
166513
|
+
await (0, import_promises19.writeFile)(
|
|
166424
166514
|
import_node_path49.default.join(creationDirectory, "./package.json"),
|
|
166425
166515
|
JSON.stringify(
|
|
166426
166516
|
{
|
|
@@ -166470,7 +166560,7 @@ ${err.message ?? err}`
|
|
|
166470
166560
|
if (!pathToTSConfig) {
|
|
166471
166561
|
if (yesFlag || await confirm("Would you like to use TypeScript?")) {
|
|
166472
166562
|
isTypescriptProject = true;
|
|
166473
|
-
await (0,
|
|
166563
|
+
await (0, import_promises19.writeFile)(
|
|
166474
166564
|
import_node_path49.default.join(creationDirectory, "./tsconfig.json"),
|
|
166475
166565
|
readFileSync5(import_node_path49.default.join(getBasePath(), "templates/tsconfig.init.json"))
|
|
166476
166566
|
);
|
|
@@ -166530,12 +166620,12 @@ ${err.message ?? err}`
|
|
|
166530
166620
|
compatibility_date: parsedWranglerToml.compatibility_date,
|
|
166531
166621
|
...extraToml
|
|
166532
166622
|
};
|
|
166533
|
-
|
|
166623
|
+
fs23.writeFileSync(wranglerTomlDestination, import_toml6.default.stringify(newToml));
|
|
166534
166624
|
}
|
|
166535
166625
|
const isNamedWorker = isCreatingWranglerToml && import_node_path49.default.dirname(packagePath) !== process.cwd();
|
|
166536
166626
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
|
166537
166627
|
if (isWritingScripts) {
|
|
166538
|
-
await (0,
|
|
166628
|
+
await (0, import_promises19.writeFile)(
|
|
166539
166629
|
packagePath,
|
|
166540
166630
|
JSON.stringify(
|
|
166541
166631
|
{
|
|
@@ -166573,7 +166663,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166573
166663
|
}
|
|
166574
166664
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
|
166575
166665
|
if (isTypescriptProject) {
|
|
166576
|
-
if (!
|
|
166666
|
+
if (!fs23.existsSync(import_node_path49.default.join(creationDirectory, "./src/index.ts"))) {
|
|
166577
166667
|
const newWorkerFilename = import_node_path49.default.relative(
|
|
166578
166668
|
process.cwd(),
|
|
166579
166669
|
import_node_path49.default.join(creationDirectory, "./src/index.ts")
|
|
@@ -166581,10 +166671,10 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166581
166671
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
|
166582
166672
|
if (newWorkerType !== "none") {
|
|
166583
166673
|
const template = getNewWorkerTemplate("ts", newWorkerType);
|
|
166584
|
-
await (0,
|
|
166674
|
+
await (0, import_promises19.mkdir)(import_node_path49.default.join(creationDirectory, "./src"), {
|
|
166585
166675
|
recursive: true
|
|
166586
166676
|
});
|
|
166587
|
-
await (0,
|
|
166677
|
+
await (0, import_promises19.writeFile)(
|
|
166588
166678
|
import_node_path49.default.join(creationDirectory, "./src/index.ts"),
|
|
166589
166679
|
readFileSync5(import_node_path49.default.join(getBasePath(), `templates/${template}`))
|
|
166590
166680
|
);
|
|
@@ -166603,7 +166693,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166603
166693
|
}
|
|
166604
166694
|
newWorkerTestType = "vitest";
|
|
166605
166695
|
devDepsToInstall.push(newWorkerTestType);
|
|
166606
|
-
await (0,
|
|
166696
|
+
await (0, import_promises19.writeFile)(
|
|
166607
166697
|
import_node_path49.default.join(creationDirectory, "./src/index.test.ts"),
|
|
166608
166698
|
readFileSync5(
|
|
166609
166699
|
import_node_path49.default.join(
|
|
@@ -166631,7 +166721,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166631
166721
|
}
|
|
166632
166722
|
}
|
|
166633
166723
|
} else {
|
|
166634
|
-
if (!
|
|
166724
|
+
if (!fs23.existsSync(import_node_path49.default.join(creationDirectory, "./src/index.js"))) {
|
|
166635
166725
|
const newWorkerFilename = import_node_path49.default.relative(
|
|
166636
166726
|
process.cwd(),
|
|
166637
166727
|
import_node_path49.default.join(creationDirectory, "./src/index.js")
|
|
@@ -166644,7 +166734,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166644
166734
|
accountId,
|
|
166645
166735
|
fromDashWorkerName
|
|
166646
166736
|
);
|
|
166647
|
-
await (0,
|
|
166737
|
+
await (0, import_promises19.mkdir)(import_node_path49.default.join(creationDirectory, "./src"), {
|
|
166648
166738
|
recursive: true
|
|
166649
166739
|
});
|
|
166650
166740
|
config.main = `src/${config.main}`;
|
|
@@ -166657,8 +166747,8 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166657
166747
|
`./src/${file.name}`
|
|
166658
166748
|
);
|
|
166659
166749
|
const directory = (0, import_node_path49.dirname)(filepath);
|
|
166660
|
-
await (0,
|
|
166661
|
-
await (0,
|
|
166750
|
+
await (0, import_promises19.mkdir)(directory, { recursive: true });
|
|
166751
|
+
await (0, import_promises19.writeFile)(filepath, file.stream());
|
|
166662
166752
|
})
|
|
166663
166753
|
);
|
|
166664
166754
|
}
|
|
@@ -166674,10 +166764,10 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166674
166764
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
|
166675
166765
|
if (newWorkerType !== "none") {
|
|
166676
166766
|
const template = getNewWorkerTemplate("js", newWorkerType);
|
|
166677
|
-
await (0,
|
|
166767
|
+
await (0, import_promises19.mkdir)(import_node_path49.default.join(creationDirectory, "./src"), {
|
|
166678
166768
|
recursive: true
|
|
166679
166769
|
});
|
|
166680
|
-
await (0,
|
|
166770
|
+
await (0, import_promises19.writeFile)(
|
|
166681
166771
|
import_node_path49.default.join(creationDirectory, "./src/index.js"),
|
|
166682
166772
|
readFileSync5(import_node_path49.default.join(getBasePath(), `templates/${template}`))
|
|
166683
166773
|
);
|
|
@@ -166691,7 +166781,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
|
166691
166781
|
if (shouldCreateTests) {
|
|
166692
166782
|
newWorkerTestType = await getNewWorkerTestType(yesFlag);
|
|
166693
166783
|
devDepsToInstall.push(newWorkerTestType);
|
|
166694
|
-
await (0,
|
|
166784
|
+
await (0, import_promises19.writeFile)(
|
|
166695
166785
|
import_node_path49.default.join(creationDirectory, "./src/index.test.js"),
|
|
166696
166786
|
readFileSync5(
|
|
166697
166787
|
import_node_path49.default.join(
|
|
@@ -166816,7 +166906,7 @@ function getNewWorkerToml(workerType) {
|
|
|
166816
166906
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
|
166817
166907
|
async function findPath(isolatedInit, cwd2, basename4) {
|
|
166818
166908
|
if (isolatedInit) {
|
|
166819
|
-
return
|
|
166909
|
+
return fs23.existsSync(import_node_path49.default.resolve(cwd2, basename4)) ? import_node_path49.default.resolve(cwd2, basename4) : void 0;
|
|
166820
166910
|
} else {
|
|
166821
166911
|
return await findUp(basename4, {
|
|
166822
166912
|
cwd: cwd2
|
|
@@ -167256,7 +167346,7 @@ Successfully rolled back to Deployment ID: ${deploymentId}`);
|
|
|
167256
167346
|
}
|
|
167257
167347
|
__name(rollbackDeployment, "rollbackDeployment");
|
|
167258
167348
|
async function rollbackRequest(accountId, scriptName, deploymentId, rollbackReason) {
|
|
167259
|
-
const body = new
|
|
167349
|
+
const body = new import_undici21.FormData();
|
|
167260
167350
|
body.set("message", rollbackReason);
|
|
167261
167351
|
const { deployment_id } = await fetchResult(
|
|
167262
167352
|
`/accounts/${accountId}/workers/scripts/${scriptName}?rollback_to=${deploymentId}`,
|
|
@@ -168128,7 +168218,7 @@ __name(noBundleWorker2, "noBundleWorker");
|
|
|
168128
168218
|
// src/dev/create-worker-preview.ts
|
|
168129
168219
|
init_import_meta_url();
|
|
168130
168220
|
var import_node_url14 = require("node:url");
|
|
168131
|
-
var
|
|
168221
|
+
var import_undici22 = __toESM(require_undici());
|
|
168132
168222
|
function randomId() {
|
|
168133
168223
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c2) {
|
|
168134
168224
|
const r3 = Math.random() * 16 | 0, v2 = c2 == "x" ? r3 : r3 & 3 | 8;
|
|
@@ -168161,7 +168251,7 @@ async function createPreviewSession(account, ctx, abortSignal) {
|
|
|
168161
168251
|
` GET ${switchedExchangeUrl}`
|
|
168162
168252
|
);
|
|
168163
168253
|
logger.debug("-- END EXCHANGE API REQUEST");
|
|
168164
|
-
const exchangeResponse = await (0,
|
|
168254
|
+
const exchangeResponse = await (0, import_undici22.fetch)(switchedExchangeUrl, {
|
|
168165
168255
|
signal: abortSignal
|
|
168166
168256
|
});
|
|
168167
168257
|
const bodyText = await exchangeResponse.text();
|
|
@@ -168252,7 +168342,7 @@ async function createWorkerPreview(init2, account, ctx, session, abortSignal) {
|
|
|
168252
168342
|
if (accessToken) {
|
|
168253
168343
|
headers.cookie = `CF_Authorization=${accessToken}`;
|
|
168254
168344
|
}
|
|
168255
|
-
(0,
|
|
168345
|
+
(0, import_undici22.fetch)(token.prewarmUrl.href, {
|
|
168256
168346
|
method: "POST",
|
|
168257
168347
|
signal: abortSignal,
|
|
168258
168348
|
headers
|
|
@@ -169772,7 +169862,7 @@ async function findTunnelHostname() {
|
|
|
169772
169862
|
let hostName;
|
|
169773
169863
|
while (!hostName) {
|
|
169774
169864
|
try {
|
|
169775
|
-
const resp = await (0,
|
|
169865
|
+
const resp = await (0, import_undici23.fetch)("http://localhost:8789/metrics");
|
|
169776
169866
|
const data = await resp.text();
|
|
169777
169867
|
const matches = Array.from(data.matchAll(hostNameRegex));
|
|
169778
169868
|
hostName = matches[0][1];
|
|
@@ -171150,7 +171240,7 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
171150
171240
|
proxyData,
|
|
171151
171241
|
stop: devServer.stop,
|
|
171152
171242
|
fetch: async (input, init2) => {
|
|
171153
|
-
return await (0,
|
|
171243
|
+
return await (0, import_undici24.fetch)(
|
|
171154
171244
|
...parseRequestInput(
|
|
171155
171245
|
address,
|
|
171156
171246
|
port2,
|
|
@@ -171174,7 +171264,7 @@ unstable_dev()'s behaviour will likely change in future releases`
|
|
|
171174
171264
|
proxyData,
|
|
171175
171265
|
stop: devServer.stop,
|
|
171176
171266
|
fetch: async (input, init2) => {
|
|
171177
|
-
return await (0,
|
|
171267
|
+
return await (0, import_undici24.fetch)(
|
|
171178
171268
|
...parseRequestInput(
|
|
171179
171269
|
address,
|
|
171180
171270
|
port2,
|
|
@@ -171192,7 +171282,7 @@ __name(unstable_dev, "unstable_dev");
|
|
|
171192
171282
|
function parseRequestInput(readyAddress, readyPort, input = "/", init2, protocol = "http") {
|
|
171193
171283
|
if (typeof input === "string")
|
|
171194
171284
|
input = new URL(input, "http://placeholder");
|
|
171195
|
-
const forward = new
|
|
171285
|
+
const forward = new import_undici24.Request(input, init2);
|
|
171196
171286
|
const url4 = new URL(forward.url);
|
|
171197
171287
|
forward.headers.set("MF-Original-URL", url4.toString());
|
|
171198
171288
|
forward.headers.set("MF-Disable-Pretty-Error", "true");
|
|
@@ -172008,7 +172098,7 @@ __name(ExecutionContext, "ExecutionContext");
|
|
|
172008
172098
|
// src/api/integrations/platform/services.ts
|
|
172009
172099
|
init_import_meta_url();
|
|
172010
172100
|
var import_miniflare17 = require("miniflare");
|
|
172011
|
-
var
|
|
172101
|
+
var import_undici25 = __toESM(require_undici());
|
|
172012
172102
|
async function getServiceBindings(services = []) {
|
|
172013
172103
|
if (services.length === 0) {
|
|
172014
172104
|
return;
|
|
@@ -172054,7 +172144,7 @@ function getServiceBindingProxyFetch({
|
|
|
172054
172144
|
return async (request3) => {
|
|
172055
172145
|
const newUrl = getExternalUrl(request3);
|
|
172056
172146
|
try {
|
|
172057
|
-
const resp = await (0,
|
|
172147
|
+
const resp = await (0, import_undici25.fetch)(newUrl, request3);
|
|
172058
172148
|
const respBody = await resp.arrayBuffer();
|
|
172059
172149
|
return new import_miniflare17.Response(respBody, resp);
|
|
172060
172150
|
} catch {
|