wrangler 3.114.6 → 3.114.8
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 +6 -6
- package/wrangler-dist/cli.d.ts +2 -0
- package/wrangler-dist/cli.js +302 -260
package/wrangler-dist/cli.js
CHANGED
@@ -6990,7 +6990,7 @@ var require_client = __commonJS({
|
|
6990
6990
|
resume(client);
|
6991
6991
|
}
|
6992
6992
|
__name(onHTTP2GoAway, "onHTTP2GoAway");
|
6993
|
-
var
|
6993
|
+
var constants4 = require_constants3();
|
6994
6994
|
var createRedirectInterceptor = require_redirectInterceptor();
|
6995
6995
|
var EMPTY_BUF = Buffer.alloc(0);
|
6996
6996
|
async function lazyllhttp() {
|
@@ -7058,7 +7058,7 @@ var require_client = __commonJS({
|
|
7058
7058
|
constructor(client, socket, { exports: exports3 }) {
|
7059
7059
|
assert38(Number.isFinite(client[kMaxHeadersSize]) && client[kMaxHeadersSize] > 0);
|
7060
7060
|
this.llhttp = exports3;
|
7061
|
-
this.ptr = this.llhttp.llhttp_alloc(
|
7061
|
+
this.ptr = this.llhttp.llhttp_alloc(constants4.TYPE.RESPONSE);
|
7062
7062
|
this.client = client;
|
7063
7063
|
this.socket = socket;
|
7064
7064
|
this.timeout = null;
|
@@ -7150,19 +7150,19 @@ var require_client = __commonJS({
|
|
7150
7150
|
currentBufferRef = null;
|
7151
7151
|
}
|
7152
7152
|
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
|
7153
|
-
if (ret ===
|
7153
|
+
if (ret === constants4.ERROR.PAUSED_UPGRADE) {
|
7154
7154
|
this.onUpgrade(data.slice(offset));
|
7155
|
-
} else if (ret ===
|
7155
|
+
} else if (ret === constants4.ERROR.PAUSED) {
|
7156
7156
|
this.paused = true;
|
7157
7157
|
socket.unshift(data.slice(offset));
|
7158
|
-
} else if (ret !==
|
7158
|
+
} else if (ret !== constants4.ERROR.OK) {
|
7159
7159
|
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
7160
7160
|
let message = "";
|
7161
7161
|
if (ptr) {
|
7162
7162
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
7163
7163
|
message = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
7164
7164
|
}
|
7165
|
-
throw new HTTPParserError(message,
|
7165
|
+
throw new HTTPParserError(message, constants4.ERROR[ret], data.slice(offset));
|
7166
7166
|
}
|
7167
7167
|
} catch (err) {
|
7168
7168
|
util5.destroy(socket, err);
|
@@ -7332,7 +7332,7 @@ var require_client = __commonJS({
|
|
7332
7332
|
socket[kBlocking] = false;
|
7333
7333
|
resume(client);
|
7334
7334
|
}
|
7335
|
-
return pause ?
|
7335
|
+
return pause ? constants4.ERROR.PAUSED : 0;
|
7336
7336
|
}
|
7337
7337
|
onBody(buf) {
|
7338
7338
|
const { client, socket, statusCode, maxResponseSize } = this;
|
@@ -7354,7 +7354,7 @@ var require_client = __commonJS({
|
|
7354
7354
|
}
|
7355
7355
|
this.bytesRead += buf.length;
|
7356
7356
|
if (request4.onData(buf) === false) {
|
7357
|
-
return
|
7357
|
+
return constants4.ERROR.PAUSED;
|
7358
7358
|
}
|
7359
7359
|
}
|
7360
7360
|
onMessageComplete() {
|
@@ -7389,13 +7389,13 @@ var require_client = __commonJS({
|
|
7389
7389
|
if (socket[kWriting]) {
|
7390
7390
|
assert38.strictEqual(client[kRunning], 0);
|
7391
7391
|
util5.destroy(socket, new InformationalError("reset"));
|
7392
|
-
return
|
7392
|
+
return constants4.ERROR.PAUSED;
|
7393
7393
|
} else if (!shouldKeepAlive) {
|
7394
7394
|
util5.destroy(socket, new InformationalError("reset"));
|
7395
|
-
return
|
7395
|
+
return constants4.ERROR.PAUSED;
|
7396
7396
|
} else if (socket[kReset2] && client[kRunning] === 0) {
|
7397
7397
|
util5.destroy(socket, new InformationalError("reset"));
|
7398
|
-
return
|
7398
|
+
return constants4.ERROR.PAUSED;
|
7399
7399
|
} else if (client[kPipelining] === 1) {
|
7400
7400
|
setImmediate(resume, client);
|
7401
7401
|
} else {
|
@@ -29722,9 +29722,9 @@ var require_async = __commonJS({
|
|
29722
29722
|
];
|
29723
29723
|
}, "defaultPaths");
|
29724
29724
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb2) {
|
29725
|
-
fs27.stat(file, function(err,
|
29725
|
+
fs27.stat(file, function(err, stat9) {
|
29726
29726
|
if (!err) {
|
29727
|
-
return cb2(null,
|
29727
|
+
return cb2(null, stat9.isFile() || stat9.isFIFO());
|
29728
29728
|
}
|
29729
29729
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
29730
29730
|
return cb2(null, false);
|
@@ -29732,9 +29732,9 @@ var require_async = __commonJS({
|
|
29732
29732
|
});
|
29733
29733
|
}, "isFile");
|
29734
29734
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir, cb2) {
|
29735
|
-
fs27.stat(dir, function(err,
|
29735
|
+
fs27.stat(dir, function(err, stat9) {
|
29736
29736
|
if (!err) {
|
29737
|
-
return cb2(null,
|
29737
|
+
return cb2(null, stat9.isDirectory());
|
29738
29738
|
}
|
29739
29739
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
29740
29740
|
return cb2(null, false);
|
@@ -30268,23 +30268,23 @@ var require_sync = __commonJS({
|
|
30268
30268
|
}, "defaultPaths");
|
30269
30269
|
var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
|
30270
30270
|
try {
|
30271
|
-
var
|
30271
|
+
var stat9 = fs27.statSync(file, { throwIfNoEntry: false });
|
30272
30272
|
} catch (e7) {
|
30273
30273
|
if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
|
30274
30274
|
return false;
|
30275
30275
|
throw e7;
|
30276
30276
|
}
|
30277
|
-
return !!
|
30277
|
+
return !!stat9 && (stat9.isFile() || stat9.isFIFO());
|
30278
30278
|
}, "isFile");
|
30279
30279
|
var defaultIsDir = /* @__PURE__ */ __name(function isDirectory2(dir) {
|
30280
30280
|
try {
|
30281
|
-
var
|
30281
|
+
var stat9 = fs27.statSync(dir, { throwIfNoEntry: false });
|
30282
30282
|
} catch (e7) {
|
30283
30283
|
if (e7 && (e7.code === "ENOENT" || e7.code === "ENOTDIR"))
|
30284
30284
|
return false;
|
30285
30285
|
throw e7;
|
30286
30286
|
}
|
30287
|
-
return !!
|
30287
|
+
return !!stat9 && stat9.isDirectory();
|
30288
30288
|
}, "isDirectory");
|
30289
30289
|
var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync4(x6) {
|
30290
30290
|
try {
|
@@ -53952,16 +53952,16 @@ var require_windows = __commonJS({
|
|
53952
53952
|
return false;
|
53953
53953
|
}
|
53954
53954
|
__name(checkPathExt, "checkPathExt");
|
53955
|
-
function checkStat(
|
53956
|
-
if (!
|
53955
|
+
function checkStat(stat9, path72, options32) {
|
53956
|
+
if (!stat9.isSymbolicLink() && !stat9.isFile()) {
|
53957
53957
|
return false;
|
53958
53958
|
}
|
53959
53959
|
return checkPathExt(path72, options32);
|
53960
53960
|
}
|
53961
53961
|
__name(checkStat, "checkStat");
|
53962
53962
|
function isexe(path72, options32, cb2) {
|
53963
|
-
fs27.stat(path72, function(er,
|
53964
|
-
cb2(er, er ? false : checkStat(
|
53963
|
+
fs27.stat(path72, function(er, stat9) {
|
53964
|
+
cb2(er, er ? false : checkStat(stat9, path72, options32));
|
53965
53965
|
});
|
53966
53966
|
}
|
53967
53967
|
__name(isexe, "isexe");
|
@@ -53980,8 +53980,8 @@ var require_mode = __commonJS({
|
|
53980
53980
|
isexe.sync = sync;
|
53981
53981
|
var fs27 = require("fs");
|
53982
53982
|
function isexe(path72, options32, cb2) {
|
53983
|
-
fs27.stat(path72, function(er,
|
53984
|
-
cb2(er, er ? false : checkStat(
|
53983
|
+
fs27.stat(path72, function(er, stat9) {
|
53984
|
+
cb2(er, er ? false : checkStat(stat9, options32));
|
53985
53985
|
});
|
53986
53986
|
}
|
53987
53987
|
__name(isexe, "isexe");
|
@@ -53989,14 +53989,14 @@ var require_mode = __commonJS({
|
|
53989
53989
|
return checkStat(fs27.statSync(path72), options32);
|
53990
53990
|
}
|
53991
53991
|
__name(sync, "sync");
|
53992
|
-
function checkStat(
|
53993
|
-
return
|
53992
|
+
function checkStat(stat9, options32) {
|
53993
|
+
return stat9.isFile() && checkMode(stat9, options32);
|
53994
53994
|
}
|
53995
53995
|
__name(checkStat, "checkStat");
|
53996
|
-
function checkMode(
|
53997
|
-
var mod =
|
53998
|
-
var uid =
|
53999
|
-
var gid =
|
53996
|
+
function checkMode(stat9, options32) {
|
53997
|
+
var mod = stat9.mode;
|
53998
|
+
var uid = stat9.uid;
|
53999
|
+
var gid = stat9.gid;
|
54000
54000
|
var myUid = options32.uid !== void 0 ? options32.uid : process.getuid && process.getuid();
|
54001
54001
|
var myGid = options32.gid !== void 0 ? options32.gid : process.getgid && process.getgid();
|
54002
54002
|
var u5 = parseInt("100", 8);
|
@@ -54618,14 +54618,14 @@ var require_command_exists = __commonJS({
|
|
54618
54618
|
var execSync4 = require("child_process").execSync;
|
54619
54619
|
var fs27 = require("fs");
|
54620
54620
|
var path72 = require("path");
|
54621
|
-
var
|
54621
|
+
var access4 = fs27.access;
|
54622
54622
|
var accessSync = fs27.accessSync;
|
54623
|
-
var
|
54623
|
+
var constants4 = fs27.constants || fs27;
|
54624
54624
|
var isUsingWindows = process.platform == "win32";
|
54625
54625
|
var fileNotExists = /* @__PURE__ */ __name(function(commandName, callback) {
|
54626
|
-
|
54626
|
+
access4(
|
54627
54627
|
commandName,
|
54628
|
-
|
54628
|
+
constants4.F_OK,
|
54629
54629
|
function(err) {
|
54630
54630
|
callback(!err);
|
54631
54631
|
}
|
@@ -54633,16 +54633,16 @@ var require_command_exists = __commonJS({
|
|
54633
54633
|
}, "fileNotExists");
|
54634
54634
|
var fileNotExistsSync = /* @__PURE__ */ __name(function(commandName) {
|
54635
54635
|
try {
|
54636
|
-
accessSync(commandName,
|
54636
|
+
accessSync(commandName, constants4.F_OK);
|
54637
54637
|
return false;
|
54638
54638
|
} catch (e7) {
|
54639
54639
|
return true;
|
54640
54640
|
}
|
54641
54641
|
}, "fileNotExistsSync");
|
54642
54642
|
var localExecutable = /* @__PURE__ */ __name(function(commandName, callback) {
|
54643
|
-
|
54643
|
+
access4(
|
54644
54644
|
commandName,
|
54645
|
-
|
54645
|
+
constants4.F_OK | constants4.X_OK,
|
54646
54646
|
function(err) {
|
54647
54647
|
callback(null, !err);
|
54648
54648
|
}
|
@@ -54650,7 +54650,7 @@ var require_command_exists = __commonJS({
|
|
54650
54650
|
}, "localExecutable");
|
54651
54651
|
var localExecutableSync = /* @__PURE__ */ __name(function(commandName) {
|
54652
54652
|
try {
|
54653
|
-
accessSync(commandName,
|
54653
|
+
accessSync(commandName, constants4.F_OK | constants4.X_OK);
|
54654
54654
|
return true;
|
54655
54655
|
} catch (e7) {
|
54656
54656
|
return false;
|
@@ -58621,8 +58621,8 @@ var init_esm2 = __esm({
|
|
58621
58621
|
}
|
58622
58622
|
return this._userIgnored(path72, stats);
|
58623
58623
|
}
|
58624
|
-
_isntIgnored(path72,
|
58625
|
-
return !this._isIgnored(path72,
|
58624
|
+
_isntIgnored(path72, stat9) {
|
58625
|
+
return !this._isIgnored(path72, stat9);
|
58626
58626
|
}
|
58627
58627
|
/**
|
58628
58628
|
* Provides a set of common helpers and properties relating to symlink handling.
|
@@ -67691,11 +67691,11 @@ var init_createConfigValueProvider = __esm({
|
|
67691
67691
|
// ../../node_modules/.pnpm/@smithy+node-config-provider@3.1.12/node_modules/@smithy/node-config-provider/dist-es/getSelectorName.js
|
67692
67692
|
function getSelectorName(functionString) {
|
67693
67693
|
try {
|
67694
|
-
const
|
67695
|
-
|
67696
|
-
|
67697
|
-
|
67698
|
-
return [...
|
67694
|
+
const constants4 = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
|
67695
|
+
constants4.delete("CONFIG");
|
67696
|
+
constants4.delete("CONFIG_PREFIX_SEPARATOR");
|
67697
|
+
constants4.delete("ENV");
|
67698
|
+
return [...constants4].join(", ");
|
67699
67699
|
} catch (e7) {
|
67700
67700
|
return functionString;
|
67701
67701
|
}
|
@@ -81436,7 +81436,7 @@ var import_miniflare8 = require("miniflare");
|
|
81436
81436
|
init_import_meta_url();
|
81437
81437
|
var import_node_assert5 = __toESM(require("node:assert"));
|
81438
81438
|
var import_node_crypto4 = require("node:crypto");
|
81439
|
-
var
|
81439
|
+
var import_node_path16 = __toESM(require("node:path"));
|
81440
81440
|
var import_miniflare6 = require("miniflare");
|
81441
81441
|
|
81442
81442
|
// src/ai/fetcher.ts
|
@@ -81450,7 +81450,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81450
81450
|
|
81451
81451
|
// package.json
|
81452
81452
|
var name = "wrangler";
|
81453
|
-
var version = "3.114.
|
81453
|
+
var version = "3.114.8";
|
81454
81454
|
|
81455
81455
|
// src/environment-variables/misc-variables.ts
|
81456
81456
|
init_import_meta_url();
|
@@ -83998,7 +83998,7 @@ function checkType(type) {
|
|
83998
83998
|
throw new Error(`Invalid type specified: ${type}`);
|
83999
83999
|
}
|
84000
84000
|
__name(checkType, "checkType");
|
84001
|
-
var matchType = /* @__PURE__ */ __name((type,
|
84001
|
+
var matchType = /* @__PURE__ */ __name((type, stat9) => type === void 0 || stat9[typeMappings[type]](), "matchType");
|
84002
84002
|
var toPath = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath, "toPath");
|
84003
84003
|
async function locatePath(paths, {
|
84004
84004
|
cwd: cwd2 = import_node_process2.default.cwd(),
|
@@ -84012,8 +84012,8 @@ async function locatePath(paths, {
|
|
84012
84012
|
const statFunction = allowSymlinks ? import_node_fs3.promises.stat : import_node_fs3.promises.lstat;
|
84013
84013
|
return pLocate(paths, async (path_) => {
|
84014
84014
|
try {
|
84015
|
-
const
|
84016
|
-
return matchType(type,
|
84015
|
+
const stat9 = await statFunction(import_node_path6.default.resolve(cwd2, path_));
|
84016
|
+
return matchType(type, stat9);
|
84017
84017
|
} catch {
|
84018
84018
|
return false;
|
84019
84019
|
}
|
@@ -84030,8 +84030,8 @@ function locatePathSync(paths, {
|
|
84030
84030
|
const statFunction = allowSymlinks ? import_node_fs3.default.statSync : import_node_fs3.default.lstatSync;
|
84031
84031
|
for (const path_ of paths) {
|
84032
84032
|
try {
|
84033
|
-
const
|
84034
|
-
if (matchType(type,
|
84033
|
+
const stat9 = statFunction(import_node_path6.default.resolve(cwd2, path_));
|
84034
|
+
if (matchType(type, stat9)) {
|
84035
84035
|
return path_;
|
84036
84036
|
}
|
84037
84037
|
} catch {
|
@@ -85236,11 +85236,13 @@ function normalizeAndValidateConfig(rawConfig, configPath, userConfigPath, args)
|
|
85236
85236
|
let activeEnv = topLevelEnv;
|
85237
85237
|
if (envName !== void 0) {
|
85238
85238
|
if (isRedirectedConfig) {
|
85239
|
-
|
85240
|
-
|
85241
|
-
|
85242
|
-
|
85243
|
-
|
85239
|
+
if (!isPagesConfig(rawConfig)) {
|
85240
|
+
diagnostics.errors.push(dedent`
|
85241
|
+
You have specified the environment "${envName}", but are using a redirected configuration, produced by a build tool such as Vite.
|
85242
|
+
You need to set the environment in your build tool, rather than via Wrangler.
|
85243
|
+
For example, if you are using Vite, refer to these docs: https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/
|
85244
|
+
`);
|
85245
|
+
}
|
85244
85246
|
} else {
|
85245
85247
|
const envDiagnostics = new Diagnostics(
|
85246
85248
|
`"env.${envName}" environment configuration`
|
@@ -91828,18 +91830,78 @@ __name(AIFetcher, "AIFetcher");
|
|
91828
91830
|
// src/deployment-bundle/module-collection.ts
|
91829
91831
|
init_import_meta_url();
|
91830
91832
|
var import_node_crypto3 = __toESM(require("node:crypto"));
|
91831
|
-
var
|
91833
|
+
var import_node_fs8 = require("node:fs");
|
91832
91834
|
var import_promises4 = require("node:fs/promises");
|
91833
|
-
var
|
91835
|
+
var import_node_path15 = __toESM(require("node:path"));
|
91834
91836
|
var import_glob_to_regexp2 = __toESM(require_glob_to_regexp());
|
91835
91837
|
var import_resolve = __toESM(require_resolve());
|
91836
91838
|
|
91837
91839
|
// src/deployment-bundle/find-additional-modules.ts
|
91838
91840
|
init_import_meta_url();
|
91839
91841
|
var import_promises3 = require("node:fs/promises");
|
91840
|
-
var
|
91842
|
+
var import_node_path14 = __toESM(require("node:path"));
|
91841
91843
|
var import_glob_to_regexp = __toESM(require_glob_to_regexp());
|
91842
91844
|
|
91845
|
+
// src/paths.ts
|
91846
|
+
init_import_meta_url();
|
91847
|
+
var import_node_console = require("node:console");
|
91848
|
+
var import_node_fs6 = __toESM(require("node:fs"));
|
91849
|
+
var import_node_path12 = __toESM(require("node:path"));
|
91850
|
+
var import_signal_exit3 = __toESM(require_signal_exit());
|
91851
|
+
function toUrlPath(filePath) {
|
91852
|
+
(0, import_node_console.assert)(
|
91853
|
+
!/^[a-z]:/i.test(filePath),
|
91854
|
+
"Tried to convert a Windows file path with a drive to a URL path."
|
91855
|
+
);
|
91856
|
+
return filePath.replace(/\\/g, "/");
|
91857
|
+
}
|
91858
|
+
__name(toUrlPath, "toUrlPath");
|
91859
|
+
function readableRelative(to) {
|
91860
|
+
const relativePath = import_node_path12.default.relative(process.cwd(), to);
|
91861
|
+
if (
|
91862
|
+
// No directory nesting, return as-is
|
91863
|
+
import_node_path12.default.basename(relativePath) === relativePath || // Outside current directory
|
91864
|
+
relativePath.startsWith(".")
|
91865
|
+
) {
|
91866
|
+
return relativePath;
|
91867
|
+
} else {
|
91868
|
+
return "./" + relativePath;
|
91869
|
+
}
|
91870
|
+
}
|
91871
|
+
__name(readableRelative, "readableRelative");
|
91872
|
+
function getBasePath() {
|
91873
|
+
return import_node_path12.default.resolve(__dirname, "..");
|
91874
|
+
}
|
91875
|
+
__name(getBasePath, "getBasePath");
|
91876
|
+
function getWranglerHiddenDirPath(projectRoot) {
|
91877
|
+
projectRoot ??= process.cwd();
|
91878
|
+
return import_node_path12.default.join(projectRoot, ".wrangler");
|
91879
|
+
}
|
91880
|
+
__name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
|
91881
|
+
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
91882
|
+
const tmpRoot = import_node_path12.default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
|
91883
|
+
import_node_fs6.default.mkdirSync(tmpRoot, { recursive: true });
|
91884
|
+
const tmpPrefix = import_node_path12.default.join(tmpRoot, `${prefix}-`);
|
91885
|
+
const tmpDir = import_node_fs6.default.realpathSync(import_node_fs6.default.mkdtempSync(tmpPrefix));
|
91886
|
+
const removeDir = /* @__PURE__ */ __name(() => {
|
91887
|
+
if (cleanup) {
|
91888
|
+
try {
|
91889
|
+
return import_node_fs6.default.rmSync(tmpDir, { recursive: true, force: true });
|
91890
|
+
} catch (e7) {
|
91891
|
+
}
|
91892
|
+
}
|
91893
|
+
}, "removeDir");
|
91894
|
+
const removeExitListener = (0, import_signal_exit3.default)(removeDir);
|
91895
|
+
return {
|
91896
|
+
path: tmpDir,
|
91897
|
+
remove() {
|
91898
|
+
removeExitListener();
|
91899
|
+
removeDir();
|
91900
|
+
}
|
91901
|
+
};
|
91902
|
+
}
|
91903
|
+
__name(getWranglerTmpDir, "getWranglerTmpDir");
|
91904
|
+
|
91843
91905
|
// src/deployment-bundle/bundle-type.ts
|
91844
91906
|
init_import_meta_url();
|
91845
91907
|
function getBundleType(format11, file) {
|
@@ -91912,8 +91974,8 @@ __name(parseRules, "parseRules");
|
|
91912
91974
|
|
91913
91975
|
// src/deployment-bundle/source-maps.ts
|
91914
91976
|
init_import_meta_url();
|
91915
|
-
var
|
91916
|
-
var
|
91977
|
+
var import_node_fs7 = __toESM(require("node:fs"));
|
91978
|
+
var import_node_path13 = __toESM(require("node:path"));
|
91917
91979
|
function loadSourceMaps(main2, modules, bundle) {
|
91918
91980
|
const { sourceMapPath, sourceMapMetadata } = bundle;
|
91919
91981
|
if (sourceMapPath && sourceMapMetadata) {
|
@@ -91928,18 +91990,18 @@ function loadSourceMap({ name: name2, filePath }, sourceMapPath, { entryDirector
|
|
91928
91990
|
return [];
|
91929
91991
|
}
|
91930
91992
|
const map2 = JSON.parse(
|
91931
|
-
|
91993
|
+
import_node_fs7.default.readFileSync(import_node_path13.default.join(entryDirectory, sourceMapPath), "utf8")
|
91932
91994
|
);
|
91933
91995
|
map2.file = name2;
|
91934
91996
|
if (map2.sourceRoot) {
|
91935
|
-
const sourceRootPath =
|
91936
|
-
|
91997
|
+
const sourceRootPath = import_node_path13.default.dirname(
|
91998
|
+
import_node_path13.default.join(entryDirectory, sourceMapPath)
|
91937
91999
|
);
|
91938
|
-
map2.sourceRoot =
|
92000
|
+
map2.sourceRoot = import_node_path13.default.relative(sourceRootPath, map2.sourceRoot);
|
91939
92001
|
}
|
91940
92002
|
map2.sources = map2.sources.map((source) => {
|
91941
|
-
const originalPath =
|
91942
|
-
return
|
92003
|
+
const originalPath = import_node_path13.default.join(import_node_path13.default.dirname(filePath), source);
|
92004
|
+
return import_node_path13.default.relative(entryDirectory, originalPath);
|
91943
92005
|
});
|
91944
92006
|
return [
|
91945
92007
|
{
|
@@ -91999,14 +92061,14 @@ function sourceMapForModule(module3) {
|
|
91999
92061
|
if (sourceMapUrl === void 0) {
|
92000
92062
|
return;
|
92001
92063
|
}
|
92002
|
-
const sourcemapPath =
|
92003
|
-
if (!
|
92064
|
+
const sourcemapPath = import_node_path13.default.join(import_node_path13.default.dirname(module3.filePath), sourceMapUrl);
|
92065
|
+
if (!import_node_fs7.default.existsSync(sourcemapPath)) {
|
92004
92066
|
throw new Error(
|
92005
92067
|
`Invalid source map path in ${module3.filePath}: ${sourcemapPath} does not exist.`
|
92006
92068
|
);
|
92007
92069
|
}
|
92008
92070
|
const map2 = JSON.parse(
|
92009
|
-
|
92071
|
+
import_node_fs7.default.readFileSync(sourcemapPath, "utf8")
|
92010
92072
|
);
|
92011
92073
|
map2.file = module3.name;
|
92012
92074
|
if (map2.sourceRoot) {
|
@@ -92036,12 +92098,18 @@ function stripPrefix(prefix, input) {
|
|
92036
92098
|
__name(stripPrefix, "stripPrefix");
|
92037
92099
|
|
92038
92100
|
// src/deployment-bundle/find-additional-modules.ts
|
92039
|
-
async function* getFiles(
|
92040
|
-
|
92101
|
+
async function* getFiles(configPath, moduleRoot, relativeTo, projectRoot) {
|
92102
|
+
const wranglerHiddenDirPath = getWranglerHiddenDirPath(projectRoot);
|
92103
|
+
for (const file of await (0, import_promises3.readdir)(moduleRoot, { withFileTypes: true })) {
|
92104
|
+
const absPath = import_node_path14.default.join(moduleRoot, file.name);
|
92041
92105
|
if (file.isDirectory()) {
|
92042
|
-
|
92106
|
+
if (absPath !== wranglerHiddenDirPath) {
|
92107
|
+
yield* getFiles(configPath, absPath, relativeTo, projectRoot);
|
92108
|
+
}
|
92043
92109
|
} else {
|
92044
|
-
|
92110
|
+
if (absPath !== configPath) {
|
92111
|
+
yield import_node_path14.default.relative(relativeTo, absPath).replaceAll("\\", "/");
|
92112
|
+
}
|
92045
92113
|
}
|
92046
92114
|
}
|
92047
92115
|
}
|
@@ -92052,8 +92120,13 @@ function isValidPythonPackageName(name2) {
|
|
92052
92120
|
}
|
92053
92121
|
__name(isValidPythonPackageName, "isValidPythonPackageName");
|
92054
92122
|
async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
|
92055
|
-
const files = getFiles(
|
92056
|
-
|
92123
|
+
const files = getFiles(
|
92124
|
+
entry.configPath,
|
92125
|
+
entry.moduleRoot,
|
92126
|
+
entry.moduleRoot,
|
92127
|
+
entry.projectRoot
|
92128
|
+
);
|
92129
|
+
const relativeEntryPoint = import_node_path14.default.relative(entry.moduleRoot, entry.file).replaceAll("\\", "/");
|
92057
92130
|
if (Array.isArray(rules)) {
|
92058
92131
|
rules = parseRules(rules);
|
92059
92132
|
}
|
@@ -92066,7 +92139,7 @@ async function findAdditionalModules(entry, rules, attachSourcemaps = false) {
|
|
92066
92139
|
let pythonRequirements = "";
|
92067
92140
|
try {
|
92068
92141
|
pythonRequirements = await (0, import_promises3.readFile)(
|
92069
|
-
|
92142
|
+
import_node_path14.default.resolve(entry.projectRoot, "requirements.txt"),
|
92070
92143
|
"utf-8"
|
92071
92144
|
);
|
92072
92145
|
} catch (e7) {
|
@@ -92130,7 +92203,7 @@ async function matchFiles(files, relativeTo, { rules, removedRules }) {
|
|
92130
92203
|
if (!regexp.test(filePath)) {
|
92131
92204
|
continue;
|
92132
92205
|
}
|
92133
|
-
const absoluteFilePath =
|
92206
|
+
const absoluteFilePath = import_node_path14.default.join(relativeTo, filePath);
|
92134
92207
|
const fileContent = await (0, import_promises3.readFile)(
|
92135
92208
|
absoluteFilePath
|
92136
92209
|
);
|
@@ -92175,19 +92248,19 @@ async function* findAdditionalModuleWatchDirs(root) {
|
|
92175
92248
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
92176
92249
|
continue;
|
92177
92250
|
}
|
92178
|
-
yield* findAdditionalModuleWatchDirs(
|
92251
|
+
yield* findAdditionalModuleWatchDirs(import_node_path14.default.join(root, entry.name));
|
92179
92252
|
}
|
92180
92253
|
}
|
92181
92254
|
}
|
92182
92255
|
__name(findAdditionalModuleWatchDirs, "findAdditionalModuleWatchDirs");
|
92183
92256
|
async function writeAdditionalModules(modules, destination) {
|
92184
92257
|
for (const module3 of modules) {
|
92185
|
-
const modulePath =
|
92258
|
+
const modulePath = import_node_path14.default.resolve(destination, module3.name);
|
92186
92259
|
logger.debug("Writing additional module to output", modulePath);
|
92187
|
-
await (0, import_promises3.mkdir)(
|
92260
|
+
await (0, import_promises3.mkdir)(import_node_path14.default.dirname(modulePath), { recursive: true });
|
92188
92261
|
await (0, import_promises3.writeFile)(modulePath, module3.content);
|
92189
92262
|
if (module3.sourceMap) {
|
92190
|
-
const sourcemapPath =
|
92263
|
+
const sourcemapPath = import_node_path14.default.resolve(destination, module3.sourceMap.name);
|
92191
92264
|
await (0, import_promises3.writeFile)(sourcemapPath, module3.sourceMap.content);
|
92192
92265
|
}
|
92193
92266
|
}
|
@@ -92246,7 +92319,7 @@ function createModuleCollector(props) {
|
|
92246
92319
|
}
|
92247
92320
|
const found = await findAdditionalModules(props.entry, parsedRules);
|
92248
92321
|
foundModulePaths = found.map(
|
92249
|
-
({ name: name2 }) =>
|
92322
|
+
({ name: name2 }) => import_node_path15.default.resolve(props.entry.moduleRoot, name2)
|
92250
92323
|
);
|
92251
92324
|
modules.push(...found);
|
92252
92325
|
}
|
@@ -92261,7 +92334,7 @@ function createModuleCollector(props) {
|
|
92261
92334
|
const watchDirs = [];
|
92262
92335
|
if (props.findAdditionalModules) {
|
92263
92336
|
watchFiles = foundModulePaths;
|
92264
|
-
const root =
|
92337
|
+
const root = import_node_path15.default.resolve(props.entry.moduleRoot);
|
92265
92338
|
for await (const dir of findAdditionalModuleWatchDirs(root)) {
|
92266
92339
|
watchDirs.push(dir);
|
92267
92340
|
}
|
@@ -92290,12 +92363,12 @@ function createModuleCollector(props) {
|
|
92290
92363
|
return;
|
92291
92364
|
}
|
92292
92365
|
logger.warn(
|
92293
|
-
`Deprecation: detected a legacy module import in "./${
|
92366
|
+
`Deprecation: detected a legacy module import in "./${import_node_path15.default.relative(
|
92294
92367
|
process.cwd(),
|
92295
92368
|
args.importer
|
92296
92369
|
)}". This will stop working in the future. Replace references to "${args.path}" with "./${args.path}";`
|
92297
92370
|
);
|
92298
|
-
const filePath =
|
92371
|
+
const filePath = import_node_path15.default.join(
|
92299
92372
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
92300
92373
|
props.wrangler1xLegacyModuleReferences.rootDirectory,
|
92301
92374
|
args.path
|
@@ -92304,7 +92377,7 @@ function createModuleCollector(props) {
|
|
92304
92377
|
filePath
|
92305
92378
|
);
|
92306
92379
|
const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
|
92307
|
-
const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${
|
92380
|
+
const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
|
92308
92381
|
const { rule } = rulesMatchers.find(({ regex: regex2 }) => regex2.test(fileName)) || {};
|
92309
92382
|
if (rule) {
|
92310
92383
|
modules.push({
|
@@ -92338,7 +92411,7 @@ function createModuleCollector(props) {
|
|
92338
92411
|
if (args.pluginData?.skip) {
|
92339
92412
|
return;
|
92340
92413
|
}
|
92341
|
-
let filePath =
|
92414
|
+
let filePath = import_node_path15.default.join(args.resolveDir, args.path);
|
92342
92415
|
if (foundModulePaths.includes(filePath)) {
|
92343
92416
|
return { path: args.path, external: true };
|
92344
92417
|
}
|
@@ -92369,7 +92442,7 @@ function createModuleCollector(props) {
|
|
92369
92442
|
filePath
|
92370
92443
|
);
|
92371
92444
|
const fileHash = import_node_crypto3.default.createHash("sha1").update(fileContent).digest("hex");
|
92372
|
-
const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${
|
92445
|
+
const fileName = props.preserveFileNames ? args.path : `./${fileHash}-${import_node_path15.default.basename(args.path)}`;
|
92373
92446
|
modules.push({
|
92374
92447
|
name: fileName,
|
92375
92448
|
filePath,
|
@@ -92431,8 +92504,8 @@ function getWrangler1xLegacyModuleReferences(rootDirectory, entryPath) {
|
|
92431
92504
|
return {
|
92432
92505
|
rootDirectory,
|
92433
92506
|
fileNames: new Set(
|
92434
|
-
(0,
|
92435
|
-
(dirEntry) => dirEntry.isFile() && dirEntry.name !==
|
92507
|
+
(0, import_node_fs8.readdirSync)(rootDirectory, { withFileTypes: true }).filter(
|
92508
|
+
(dirEntry) => dirEntry.isFile() && dirEntry.name !== import_node_path15.default.basename(entryPath)
|
92436
92509
|
).map((dirEnt) => dirEnt.name)
|
92437
92510
|
)
|
92438
92511
|
};
|
@@ -93196,7 +93269,7 @@ async function buildSourceOptions(config) {
|
|
93196
93269
|
config.bundle.modules
|
93197
93270
|
);
|
93198
93271
|
const entrypointNames = isPython ? [] : config.bundle.entry.exports;
|
93199
|
-
const modulesRoot =
|
93272
|
+
const modulesRoot = import_node_path16.default.dirname(scriptPath3);
|
93200
93273
|
const sourceOptions = {
|
93201
93274
|
modulesRoot,
|
93202
93275
|
modules: [
|
@@ -93209,7 +93282,7 @@ async function buildSourceOptions(config) {
|
|
93209
93282
|
// Misc (WebAssembly, etc, ...)
|
93210
93283
|
...modules.map((module3) => ({
|
93211
93284
|
type: ModuleTypeToRuleType[module3.type ?? "esm"],
|
93212
|
-
path:
|
93285
|
+
path: import_node_path16.default.resolve(modulesRoot, module3.name),
|
93213
93286
|
contents: module3.content
|
93214
93287
|
}))
|
93215
93288
|
]
|
@@ -93290,14 +93363,14 @@ function buildMiniflareBindingOptions(config) {
|
|
93290
93363
|
const wasmBindings = { ...bindings.wasm_modules };
|
93291
93364
|
if (config.format === "service-worker" && config.bundle) {
|
93292
93365
|
const scriptPath3 = config.bundle.path;
|
93293
|
-
const modulesRoot =
|
93366
|
+
const modulesRoot = import_node_path16.default.dirname(scriptPath3);
|
93294
93367
|
for (const { type, name: name2 } of config.bundle.modules) {
|
93295
93368
|
if (type === "text") {
|
93296
|
-
textBlobBindings[getIdentifier(name2)] =
|
93369
|
+
textBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
|
93297
93370
|
} else if (type === "buffer") {
|
93298
|
-
dataBlobBindings[getIdentifier(name2)] =
|
93371
|
+
dataBlobBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
|
93299
93372
|
} else if (type === "compiled-wasm") {
|
93300
|
-
wasmBindings[getIdentifier(name2)] =
|
93373
|
+
wasmBindings[getIdentifier(name2)] = import_node_path16.default.resolve(modulesRoot, name2);
|
93301
93374
|
}
|
93302
93375
|
}
|
93303
93376
|
}
|
@@ -93563,14 +93636,14 @@ function buildMiniflareBindingOptions(config) {
|
|
93563
93636
|
__name(buildMiniflareBindingOptions, "buildMiniflareBindingOptions");
|
93564
93637
|
function buildPersistOptions(localPersistencePath) {
|
93565
93638
|
if (localPersistencePath !== null) {
|
93566
|
-
const v3Path =
|
93639
|
+
const v3Path = import_node_path16.default.join(localPersistencePath, "v3");
|
93567
93640
|
return {
|
93568
|
-
cachePersist:
|
93569
|
-
durableObjectsPersist:
|
93570
|
-
kvPersist:
|
93571
|
-
r2Persist:
|
93572
|
-
d1Persist:
|
93573
|
-
workflowsPersist:
|
93641
|
+
cachePersist: import_node_path16.default.join(v3Path, "cache"),
|
93642
|
+
durableObjectsPersist: import_node_path16.default.join(v3Path, "do"),
|
93643
|
+
kvPersist: import_node_path16.default.join(v3Path, "kv"),
|
93644
|
+
r2Persist: import_node_path16.default.join(v3Path, "r2"),
|
93645
|
+
d1Persist: import_node_path16.default.join(v3Path, "d1"),
|
93646
|
+
workflowsPersist: import_node_path16.default.join(v3Path, "workflows")
|
93574
93647
|
};
|
93575
93648
|
}
|
93576
93649
|
}
|
@@ -93594,7 +93667,7 @@ function buildSitesOptions({
|
|
93594
93667
|
if (legacyAssetPaths !== void 0) {
|
93595
93668
|
const { baseDirectory, assetDirectory, includePatterns, excludePatterns } = legacyAssetPaths;
|
93596
93669
|
return {
|
93597
|
-
sitePath:
|
93670
|
+
sitePath: import_node_path16.default.join(baseDirectory, assetDirectory),
|
93598
93671
|
siteInclude: includePatterns.length > 0 ? includePatterns : void 0,
|
93599
93672
|
siteExclude: excludePatterns.length > 0 ? excludePatterns : void 0
|
93600
93673
|
};
|
@@ -94543,19 +94616,19 @@ init_import_meta_url();
|
|
94543
94616
|
var import_node_assert9 = __toESM(require("node:assert"));
|
94544
94617
|
var import_node_crypto7 = require("node:crypto");
|
94545
94618
|
var import_node_events2 = __toESM(require("node:events"));
|
94546
|
-
var
|
94619
|
+
var import_node_path20 = __toESM(require("node:path"));
|
94547
94620
|
var import_miniflare10 = require("miniflare");
|
94548
94621
|
|
94549
94622
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
94550
94623
|
init_import_meta_url();
|
94551
|
-
var
|
94552
|
-
var scriptPath =
|
94624
|
+
var import_node_path17 = __toESM(require("node:path"));
|
94625
|
+
var scriptPath = import_node_path17.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
|
94553
94626
|
var InspectorProxyWorker_default = scriptPath;
|
94554
94627
|
|
94555
94628
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
|
94556
94629
|
init_import_meta_url();
|
94557
|
-
var
|
94558
|
-
var scriptPath2 =
|
94630
|
+
var import_node_path18 = __toESM(require("node:path"));
|
94631
|
+
var scriptPath2 = import_node_path18.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
94559
94632
|
var ProxyWorker_default = scriptPath2;
|
94560
94633
|
|
94561
94634
|
// ../../node_modules/.pnpm/ws@8.18.0/node_modules/ws/wrapper.mjs
|
@@ -94578,8 +94651,8 @@ var import_open2 = __toESM(require_open());
|
|
94578
94651
|
// src/api/startDevWorker/bundle-allowed-paths.ts
|
94579
94652
|
init_import_meta_url();
|
94580
94653
|
var import_node_assert8 = __toESM(require("node:assert"));
|
94581
|
-
var
|
94582
|
-
var
|
94654
|
+
var import_node_fs9 = __toESM(require("node:fs"));
|
94655
|
+
var import_node_path19 = __toESM(require("node:path"));
|
94583
94656
|
var import_node_url6 = require("node:url");
|
94584
94657
|
function isAllowedSourcePath(bundle, filePath) {
|
94585
94658
|
const allowed = getBundleReferencedPaths(bundle);
|
@@ -94606,12 +94679,12 @@ function getBundleReferencedPaths(bundle) {
|
|
94606
94679
|
}
|
94607
94680
|
const sourceMappingPath = (0, import_node_url6.fileURLToPath)(sourceMappingURL);
|
94608
94681
|
allowed.sourceMapPaths.add(sourceMappingPath);
|
94609
|
-
const sourceMapData =
|
94682
|
+
const sourceMapData = import_node_fs9.default.readFileSync(sourceMappingPath, "utf8");
|
94610
94683
|
const sourceMap = JSON.parse(sourceMapData);
|
94611
94684
|
const sourceRoot = sourceMap.sourceRoot ?? "";
|
94612
94685
|
for (const source of sourceMap.sources) {
|
94613
94686
|
const sourceURL = new URL(
|
94614
|
-
|
94687
|
+
import_node_path19.default.posix.join(sourceRoot, source),
|
94615
94688
|
sourceMappingURL
|
94616
94689
|
);
|
94617
94690
|
allowed.sourcePaths.add((0, import_node_url6.fileURLToPath)(sourceURL));
|
@@ -94634,7 +94707,7 @@ function* getBundleSourcePaths(bundle) {
|
|
94634
94707
|
}
|
94635
94708
|
__name(getBundleSourcePaths, "getBundleSourcePaths");
|
94636
94709
|
function maybeGetSourceMappingURL(sourcePath) {
|
94637
|
-
const source =
|
94710
|
+
const source = import_node_fs9.default.readFileSync(sourcePath, "utf8");
|
94638
94711
|
const sourceMappingURLIndex = source.lastIndexOf("//# sourceMappingURL=");
|
94639
94712
|
if (sourceMappingURLIndex === -1) {
|
94640
94713
|
return;
|
@@ -94853,8 +94926,8 @@ var openInspector = /* @__PURE__ */ __name(async (inspectorPort, worker) => {
|
|
94853
94926
|
|
94854
94927
|
// src/https-options.ts
|
94855
94928
|
init_import_meta_url();
|
94856
|
-
var
|
94857
|
-
var
|
94929
|
+
var fs8 = __toESM(require("node:fs"));
|
94930
|
+
var path21 = __toESM(require("node:path"));
|
94858
94931
|
var import_miniflare9 = require("miniflare");
|
94859
94932
|
var CERT_EXPIRY_DAYS = 30;
|
94860
94933
|
var ONE_DAY_IN_MS = 864e5;
|
@@ -94871,37 +94944,37 @@ function getHttpsOptions(customHttpsKeyPath = getHttpsKeyPathFromEnv(), customHt
|
|
94871
94944
|
"Must specify both certificate path and key path to use a Custom Certificate."
|
94872
94945
|
);
|
94873
94946
|
}
|
94874
|
-
if (!
|
94947
|
+
if (!fs8.existsSync(customHttpsKeyPath)) {
|
94875
94948
|
throw new UserError(
|
94876
94949
|
"Missing Custom Certificate Key at " + customHttpsKeyPath
|
94877
94950
|
);
|
94878
94951
|
}
|
94879
|
-
if (!
|
94952
|
+
if (!fs8.existsSync(customHttpsCertPath)) {
|
94880
94953
|
throw new UserError(
|
94881
94954
|
"Missing Custom Certificate File at " + customHttpsCertPath
|
94882
94955
|
);
|
94883
94956
|
}
|
94884
94957
|
logger.log("Using custom certificate at ", customHttpsKeyPath);
|
94885
94958
|
return {
|
94886
|
-
key:
|
94887
|
-
cert:
|
94959
|
+
key: fs8.readFileSync(customHttpsKeyPath, "utf8"),
|
94960
|
+
cert: fs8.readFileSync(customHttpsCertPath, "utf8")
|
94888
94961
|
};
|
94889
94962
|
}
|
94890
|
-
const certDirectory =
|
94891
|
-
const keyPath =
|
94892
|
-
const certPath =
|
94893
|
-
const regenerate = !
|
94963
|
+
const certDirectory = path21.join(getGlobalWranglerConfigPath(), "local-cert");
|
94964
|
+
const keyPath = path21.join(certDirectory, "key.pem");
|
94965
|
+
const certPath = path21.join(certDirectory, "cert.pem");
|
94966
|
+
const regenerate = !fs8.existsSync(keyPath) || !fs8.existsSync(certPath) || hasCertificateExpired(keyPath, certPath);
|
94894
94967
|
if (regenerate) {
|
94895
94968
|
logger.log("Generating new self-signed certificate...");
|
94896
94969
|
const { key, cert } = generateCertificate();
|
94897
94970
|
try {
|
94898
|
-
|
94899
|
-
|
94900
|
-
|
94971
|
+
fs8.mkdirSync(certDirectory, { recursive: true });
|
94972
|
+
fs8.writeFileSync(keyPath, key, "utf8");
|
94973
|
+
fs8.writeFileSync(certPath, cert, "utf8");
|
94901
94974
|
} catch (e7) {
|
94902
94975
|
const message = e7 instanceof Error ? e7.message : `${e7}`;
|
94903
94976
|
logger.warn(
|
94904
|
-
`Unable to cache generated self-signed certificate in ${
|
94977
|
+
`Unable to cache generated self-signed certificate in ${path21.relative(
|
94905
94978
|
process.cwd(),
|
94906
94979
|
certDirectory
|
94907
94980
|
)}.
|
@@ -94911,15 +94984,15 @@ ${message}`
|
|
94911
94984
|
return { key, cert };
|
94912
94985
|
} else {
|
94913
94986
|
return {
|
94914
|
-
key:
|
94915
|
-
cert:
|
94987
|
+
key: fs8.readFileSync(keyPath, "utf8"),
|
94988
|
+
cert: fs8.readFileSync(certPath, "utf8")
|
94916
94989
|
};
|
94917
94990
|
}
|
94918
94991
|
}
|
94919
94992
|
__name(getHttpsOptions, "getHttpsOptions");
|
94920
94993
|
function hasCertificateExpired(keyPath, certPath) {
|
94921
|
-
const keyStat =
|
94922
|
-
const certStat =
|
94994
|
+
const keyStat = fs8.statSync(keyPath);
|
94995
|
+
const certStat = fs8.statSync(certPath);
|
94923
94996
|
const created = Math.max(keyStat.mtimeMs, certStat.mtimeMs);
|
94924
94997
|
return Date.now() - created > (CERT_EXPIRY_DAYS - 2) * ONE_DAY_IN_MS;
|
94925
94998
|
}
|
@@ -94994,7 +95067,7 @@ var ProxyController = class extends Controller {
|
|
94994
95067
|
name: "ProxyWorker",
|
94995
95068
|
compatibilityDate: "2023-12-18",
|
94996
95069
|
compatibilityFlags: ["nodejs_compat"],
|
94997
|
-
modulesRoot:
|
95070
|
+
modulesRoot: import_node_path20.default.dirname(ProxyWorker_default),
|
94998
95071
|
modules: [{ type: "ESModule", path: ProxyWorker_default }],
|
94999
95072
|
durableObjects: {
|
95000
95073
|
DURABLE_OBJECT: {
|
@@ -95023,7 +95096,7 @@ var ProxyController = class extends Controller {
|
|
95023
95096
|
"nodejs_compat",
|
95024
95097
|
"increase_websocket_message_size"
|
95025
95098
|
],
|
95026
|
-
modulesRoot:
|
95099
|
+
modulesRoot: import_node_path20.default.dirname(InspectorProxyWorker_default),
|
95027
95100
|
modules: [{ type: "ESModule", path: InspectorProxyWorker_default }],
|
95028
95101
|
durableObjects: {
|
95029
95102
|
DURABLE_OBJECT: {
|
@@ -95401,7 +95474,7 @@ __name(NoOpProxyController, "NoOpProxyController");
|
|
95401
95474
|
init_import_meta_url();
|
95402
95475
|
var import_node_assert25 = __toESM(require("node:assert"));
|
95403
95476
|
var import_node_fs33 = require("node:fs");
|
95404
|
-
var
|
95477
|
+
var import_promises38 = require("node:fs/promises");
|
95405
95478
|
var path65 = __toESM(require("node:path"));
|
95406
95479
|
|
95407
95480
|
// ../workers-shared/index.ts
|
@@ -100035,16 +100108,16 @@ var import_undici4 = __toESM(require_undici());
|
|
100035
100108
|
|
100036
100109
|
// src/dev/get-local-persistence-path.ts
|
100037
100110
|
init_import_meta_url();
|
100038
|
-
var
|
100111
|
+
var import_node_path21 = __toESM(require("node:path"));
|
100039
100112
|
function getLocalPersistencePath(persistTo, { userConfigPath }) {
|
100040
100113
|
return persistTo ? (
|
100041
100114
|
// If path specified, always treat it as relative to cwd()
|
100042
|
-
|
100115
|
+
import_node_path21.default.resolve(process.cwd(), persistTo)
|
100043
100116
|
) : (
|
100044
100117
|
// Otherwise, treat it as relative to the Wrangler configuration file,
|
100045
100118
|
// if one can be found, otherwise cwd()
|
100046
|
-
|
100047
|
-
userConfigPath ?
|
100119
|
+
import_node_path21.default.resolve(
|
100120
|
+
userConfigPath ? import_node_path21.default.dirname(userConfigPath) : process.cwd(),
|
100048
100121
|
".wrangler/state"
|
100049
100122
|
)
|
100050
100123
|
);
|
@@ -100324,14 +100397,14 @@ var import_undici5 = __toESM(require_undici());
|
|
100324
100397
|
|
100325
100398
|
// src/package-manager.ts
|
100326
100399
|
init_import_meta_url();
|
100327
|
-
var
|
100328
|
-
var
|
100400
|
+
var import_node_fs10 = require("node:fs");
|
100401
|
+
var import_node_path24 = require("node:path");
|
100329
100402
|
var import_node_process10 = require("node:process");
|
100330
100403
|
|
100331
100404
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js
|
100332
100405
|
init_import_meta_url();
|
100333
100406
|
var import_node_buffer2 = require("node:buffer");
|
100334
|
-
var
|
100407
|
+
var import_node_path23 = __toESM(require("node:path"), 1);
|
100335
100408
|
var import_node_child_process = __toESM(require("node:child_process"), 1);
|
100336
100409
|
var import_node_process9 = __toESM(require("node:process"), 1);
|
100337
100410
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
@@ -100354,7 +100427,7 @@ __name(stripFinalNewline, "stripFinalNewline");
|
|
100354
100427
|
// ../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js
|
100355
100428
|
init_import_meta_url();
|
100356
100429
|
var import_node_process8 = __toESM(require("node:process"), 1);
|
100357
|
-
var
|
100430
|
+
var import_node_path22 = __toESM(require("node:path"), 1);
|
100358
100431
|
var import_node_url9 = __toESM(require("node:url"), 1);
|
100359
100432
|
|
100360
100433
|
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
@@ -100380,15 +100453,15 @@ function npmRunPath(options32 = {}) {
|
|
100380
100453
|
} = options32;
|
100381
100454
|
let previous;
|
100382
100455
|
const cwdString = cwd2 instanceof URL ? import_node_url9.default.fileURLToPath(cwd2) : cwd2;
|
100383
|
-
let cwdPath =
|
100456
|
+
let cwdPath = import_node_path22.default.resolve(cwdString);
|
100384
100457
|
const result = [];
|
100385
100458
|
while (previous !== cwdPath) {
|
100386
|
-
result.push(
|
100459
|
+
result.push(import_node_path22.default.join(cwdPath, "node_modules/.bin"));
|
100387
100460
|
previous = cwdPath;
|
100388
|
-
cwdPath =
|
100461
|
+
cwdPath = import_node_path22.default.resolve(cwdPath, "..");
|
100389
100462
|
}
|
100390
|
-
result.push(
|
100391
|
-
return [...result, path_].join(
|
100463
|
+
result.push(import_node_path22.default.resolve(cwdString, execPath, ".."));
|
100464
|
+
return [...result, path_].join(import_node_path22.default.delimiter);
|
100392
100465
|
}
|
100393
100466
|
__name(npmRunPath, "npmRunPath");
|
100394
100467
|
function npmRunPathEnv({ env: env6 = import_node_process8.default.env, ...options32 } = {}) {
|
@@ -100949,7 +101022,7 @@ var normalizeStdio = /* @__PURE__ */ __name((options32) => {
|
|
100949
101022
|
// ../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/lib/kill.js
|
100950
101023
|
init_import_meta_url();
|
100951
101024
|
var import_node_os5 = __toESM(require("node:os"), 1);
|
100952
|
-
var
|
101025
|
+
var import_signal_exit4 = __toESM(require_signal_exit(), 1);
|
100953
101026
|
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
|
100954
101027
|
var spawnedKill = /* @__PURE__ */ __name((kill, signal = "SIGTERM", options32 = {}) => {
|
100955
101028
|
const killResult = kill(signal);
|
@@ -101013,7 +101086,7 @@ var setExitHandler = /* @__PURE__ */ __name(async (spawned, { cleanup, detached
|
|
101013
101086
|
if (!cleanup || detached) {
|
101014
101087
|
return timedPromise;
|
101015
101088
|
}
|
101016
|
-
const removeExitHandler = (0,
|
101089
|
+
const removeExitHandler = (0, import_signal_exit4.default)(() => {
|
101017
101090
|
spawned.kill();
|
101018
101091
|
});
|
101019
101092
|
return timedPromise.finally(() => {
|
@@ -101190,7 +101263,7 @@ var handleArguments = /* @__PURE__ */ __name((file, args, options32 = {}) => {
|
|
101190
101263
|
};
|
101191
101264
|
options32.env = getEnv(options32);
|
101192
101265
|
options32.stdio = normalizeStdio(options32);
|
101193
|
-
if (import_node_process9.default.platform === "win32" &&
|
101266
|
+
if (import_node_process9.default.platform === "win32" && import_node_path23.default.basename(file, ".exe") === "cmd") {
|
101194
101267
|
args.unshift("/q");
|
101195
101268
|
}
|
101196
101269
|
return { file, args, options: options32, parsed };
|
@@ -101352,9 +101425,9 @@ async function getPackageManager(cwd2) {
|
|
101352
101425
|
supportsNpm(),
|
101353
101426
|
supportsPnpm()
|
101354
101427
|
]);
|
101355
|
-
const hasYarnLock = (0,
|
101356
|
-
const hasNpmLock = (0,
|
101357
|
-
const hasPnpmLock = (0,
|
101428
|
+
const hasYarnLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "yarn.lock"));
|
101429
|
+
const hasNpmLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "package-lock.json"));
|
101430
|
+
const hasPnpmLock = (0, import_node_fs10.existsSync)((0, import_node_path24.join)(cwd2, "pnpm-lock.yaml"));
|
101358
101431
|
const userAgent = sniffUserAgent();
|
101359
101432
|
if (hasNpmLock) {
|
101360
101433
|
if (hasNpm) {
|
@@ -101550,8 +101623,8 @@ __name(getNodeVersion, "getNodeVersion");
|
|
101550
101623
|
// src/metrics/metrics-config.ts
|
101551
101624
|
init_import_meta_url();
|
101552
101625
|
var import_node_crypto8 = require("node:crypto");
|
101553
|
-
var
|
101554
|
-
var
|
101626
|
+
var import_node_fs11 = require("node:fs");
|
101627
|
+
var import_node_path25 = __toESM(require("node:path"));
|
101555
101628
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
101556
101629
|
function getMetricsConfig({
|
101557
101630
|
sendMetrics
|
@@ -101590,8 +101663,8 @@ function getMetricsConfig({
|
|
101590
101663
|
}
|
101591
101664
|
__name(getMetricsConfig, "getMetricsConfig");
|
101592
101665
|
function writeMetricsConfig(config) {
|
101593
|
-
(0,
|
101594
|
-
(0,
|
101666
|
+
(0, import_node_fs11.mkdirSync)(import_node_path25.default.dirname(getMetricsConfigPath()), { recursive: true });
|
101667
|
+
(0, import_node_fs11.writeFileSync)(
|
101595
101668
|
getMetricsConfigPath(),
|
101596
101669
|
JSON.stringify(
|
101597
101670
|
config,
|
@@ -101603,7 +101676,7 @@ function writeMetricsConfig(config) {
|
|
101603
101676
|
__name(writeMetricsConfig, "writeMetricsConfig");
|
101604
101677
|
function readMetricsConfig() {
|
101605
101678
|
try {
|
101606
|
-
const config = (0,
|
101679
|
+
const config = (0, import_node_fs11.readFileSync)(getMetricsConfigPath(), "utf8");
|
101607
101680
|
return JSON.parse(
|
101608
101681
|
config,
|
101609
101682
|
(key, value) => key === "date" ? new Date(value) : value
|
@@ -101623,7 +101696,7 @@ function updateMetricsPermission(enabled) {
|
|
101623
101696
|
}
|
101624
101697
|
__name(updateMetricsPermission, "updateMetricsPermission");
|
101625
101698
|
function getMetricsConfigPath() {
|
101626
|
-
return
|
101699
|
+
return import_node_path25.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
101627
101700
|
}
|
101628
101701
|
__name(getMetricsConfigPath, "getMetricsConfigPath");
|
101629
101702
|
function getDeviceId(config) {
|
@@ -101891,7 +101964,7 @@ __name(getMetricsUsageHeaders, "getMetricsUsageHeaders");
|
|
101891
101964
|
|
101892
101965
|
// src/r2/helpers.ts
|
101893
101966
|
init_import_meta_url();
|
101894
|
-
var
|
101967
|
+
var fs9 = __toESM(require("node:fs"));
|
101895
101968
|
var import_web = require("node:stream/web");
|
101896
101969
|
var import_miniflare14 = require("miniflare");
|
101897
101970
|
|
@@ -102901,7 +102974,7 @@ function isValidR2BucketName(name2) {
|
|
102901
102974
|
__name(isValidR2BucketName, "isValidR2BucketName");
|
102902
102975
|
var CHUNK_SIZE = 1024;
|
102903
102976
|
async function createFileReadableStream(filePath) {
|
102904
|
-
const handle = await
|
102977
|
+
const handle = await fs9.promises.open(filePath, "r");
|
102905
102978
|
let position = 0;
|
102906
102979
|
return new import_web.ReadableStream({
|
102907
102980
|
async pull(controller) {
|
@@ -103331,62 +103404,6 @@ var fs11 = __toESM(require("node:fs"));
|
|
103331
103404
|
var path28 = __toESM(require("node:path"));
|
103332
103405
|
var esbuild = __toESM(require("esbuild"));
|
103333
103406
|
|
103334
|
-
// src/paths.ts
|
103335
|
-
init_import_meta_url();
|
103336
|
-
var import_node_console = require("node:console");
|
103337
|
-
var import_node_fs11 = __toESM(require("node:fs"));
|
103338
|
-
var import_node_path25 = __toESM(require("node:path"));
|
103339
|
-
var import_signal_exit4 = __toESM(require_signal_exit());
|
103340
|
-
function toUrlPath(filePath) {
|
103341
|
-
(0, import_node_console.assert)(
|
103342
|
-
!/^[a-z]:/i.test(filePath),
|
103343
|
-
"Tried to convert a Windows file path with a drive to a URL path."
|
103344
|
-
);
|
103345
|
-
return filePath.replace(/\\/g, "/");
|
103346
|
-
}
|
103347
|
-
__name(toUrlPath, "toUrlPath");
|
103348
|
-
function readableRelative(to) {
|
103349
|
-
const relativePath = import_node_path25.default.relative(process.cwd(), to);
|
103350
|
-
if (
|
103351
|
-
// No directory nesting, return as-is
|
103352
|
-
import_node_path25.default.basename(relativePath) === relativePath || // Outside current directory
|
103353
|
-
relativePath.startsWith(".")
|
103354
|
-
) {
|
103355
|
-
return relativePath;
|
103356
|
-
} else {
|
103357
|
-
return "./" + relativePath;
|
103358
|
-
}
|
103359
|
-
}
|
103360
|
-
__name(readableRelative, "readableRelative");
|
103361
|
-
function getBasePath() {
|
103362
|
-
return import_node_path25.default.resolve(__dirname, "..");
|
103363
|
-
}
|
103364
|
-
__name(getBasePath, "getBasePath");
|
103365
|
-
function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
|
103366
|
-
projectRoot ??= process.cwd();
|
103367
|
-
const tmpRoot = import_node_path25.default.join(projectRoot, ".wrangler", "tmp");
|
103368
|
-
import_node_fs11.default.mkdirSync(tmpRoot, { recursive: true });
|
103369
|
-
const tmpPrefix = import_node_path25.default.join(tmpRoot, `${prefix}-`);
|
103370
|
-
const tmpDir = import_node_fs11.default.realpathSync(import_node_fs11.default.mkdtempSync(tmpPrefix));
|
103371
|
-
const removeDir = /* @__PURE__ */ __name(() => {
|
103372
|
-
if (cleanup) {
|
103373
|
-
try {
|
103374
|
-
return import_node_fs11.default.rmSync(tmpDir, { recursive: true, force: true });
|
103375
|
-
} catch (e7) {
|
103376
|
-
}
|
103377
|
-
}
|
103378
|
-
}, "removeDir");
|
103379
|
-
const removeExitListener = (0, import_signal_exit4.default)(removeDir);
|
103380
|
-
return {
|
103381
|
-
path: tmpDir,
|
103382
|
-
remove() {
|
103383
|
-
removeExitListener();
|
103384
|
-
removeDir();
|
103385
|
-
}
|
103386
|
-
};
|
103387
|
-
}
|
103388
|
-
__name(getWranglerTmpDir, "getWranglerTmpDir");
|
103389
|
-
|
103390
103407
|
// src/deployment-bundle/apply-middleware.ts
|
103391
103408
|
init_import_meta_url();
|
103392
103409
|
var fs10 = __toESM(require("node:fs"));
|
@@ -105923,22 +105940,22 @@ __name(triggersDeploy, "triggersDeploy");
|
|
105923
105940
|
|
105924
105941
|
// src/utils/friendly-validator-errors.ts
|
105925
105942
|
init_import_meta_url();
|
105926
|
-
var
|
105943
|
+
var import_promises37 = require("node:fs/promises");
|
105927
105944
|
var import_node_path60 = __toESM(require("node:path"));
|
105928
105945
|
|
105929
105946
|
// src/check/commands.ts
|
105930
105947
|
init_import_meta_url();
|
105931
105948
|
var import_crypto6 = require("crypto");
|
105932
|
-
var
|
105949
|
+
var import_promises35 = require("fs/promises");
|
105933
105950
|
var import_node_events4 = __toESM(require("node:events"));
|
105934
|
-
var
|
105951
|
+
var import_promises36 = require("node:fs/promises");
|
105935
105952
|
var import_path23 = __toESM(require("path"));
|
105936
105953
|
var import_miniflare22 = require("miniflare");
|
105937
105954
|
|
105938
105955
|
// src/index.ts
|
105939
105956
|
init_import_meta_url();
|
105940
105957
|
var import_node_os8 = __toESM(require("node:os"));
|
105941
|
-
var
|
105958
|
+
var import_promises34 = require("node:timers/promises");
|
105942
105959
|
var import_undici20 = __toESM(require_undici());
|
105943
105960
|
|
105944
105961
|
// ../../node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/index.mjs
|
@@ -120124,6 +120141,7 @@ ${migrateUrl}`
|
|
120124
120141
|
return {
|
120125
120142
|
file: paths.absolutePath,
|
120126
120143
|
projectRoot,
|
120144
|
+
configPath: config.configPath,
|
120127
120145
|
format: format11,
|
120128
120146
|
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path33.default.dirname(paths.absolutePath),
|
120129
120147
|
name: config.name ?? "worker",
|
@@ -123879,6 +123897,7 @@ function buildWorkerFromFunctions({
|
|
123879
123897
|
const entry = {
|
123880
123898
|
file: (0, import_node_path41.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
|
123881
123899
|
projectRoot: functionsDirectory,
|
123900
|
+
configPath: void 0,
|
123882
123901
|
format: "modules",
|
123883
123902
|
moduleRoot: functionsDirectory,
|
123884
123903
|
exports: []
|
@@ -123948,6 +123967,7 @@ function buildRawWorker({
|
|
123948
123967
|
const entry = {
|
123949
123968
|
file: workerScriptPath,
|
123950
123969
|
projectRoot: (0, import_node_path41.resolve)(directory),
|
123970
|
+
configPath: void 0,
|
123951
123971
|
format: "modules",
|
123952
123972
|
moduleRoot: (0, import_node_path41.resolve)(directory),
|
123953
123973
|
exports: []
|
@@ -124022,6 +124042,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
124022
124042
|
{
|
124023
124043
|
file: entrypoint,
|
124024
124044
|
projectRoot: (0, import_node_path41.resolve)(workerJSDirectory),
|
124045
|
+
configPath: void 0,
|
124025
124046
|
format: "modules",
|
124026
124047
|
moduleRoot: (0, import_node_path41.resolve)(workerJSDirectory),
|
124027
124048
|
exports: []
|
@@ -124217,6 +124238,7 @@ function buildPluginFromFunctions({
|
|
124217
124238
|
const entry = {
|
124218
124239
|
file: (0, import_node_path42.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
|
124219
124240
|
projectRoot: functionsDirectory,
|
124241
|
+
configPath: void 0,
|
124220
124242
|
format: "modules",
|
124221
124243
|
moduleRoot: functionsDirectory,
|
124222
124244
|
exports: []
|
@@ -147151,7 +147173,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
147151
147173
|
if (configToDTS.version_metadata) {
|
147152
147174
|
envTypeStructure.push([
|
147153
147175
|
configToDTS.version_metadata.binding,
|
147154
|
-
"
|
147176
|
+
"WorkerVersionMetadata"
|
147155
147177
|
]);
|
147156
147178
|
}
|
147157
147179
|
if (configToDTS.assets?.binding) {
|
@@ -147382,8 +147404,8 @@ function printTokenPermissions(user) {
|
|
147382
147404
|
`\u{1F513} Token Permissions: If scopes are missing, you may need to logout and re-login.`
|
147383
147405
|
);
|
147384
147406
|
logger.log(`Scope (Access)`);
|
147385
|
-
for (const [scope,
|
147386
|
-
logger.log(`- ${scope} ${
|
147407
|
+
for (const [scope, access4] of permissions) {
|
147408
|
+
logger.log(`- ${scope} ${access4 ? `(${access4})` : ``}`);
|
147387
147409
|
}
|
147388
147410
|
}
|
147389
147411
|
__name(printTokenPermissions, "printTokenPermissions");
|
@@ -147553,6 +147575,12 @@ var whoamiCommand = createCommand({
|
|
147553
147575
|
// src/utils/logPossibleBugMessage.ts
|
147554
147576
|
init_import_meta_url();
|
147555
147577
|
async function logPossibleBugMessage() {
|
147578
|
+
if (process.versions.bun) {
|
147579
|
+
logger.warn(
|
147580
|
+
`Wrangler does not support the Bun runtime. Please try this command again using Node.js via \`npm\` or \`pnpm\`. Alternatively, make sure you're not passing the \`--bun\` flag when running \`bun run wrangler ...\``
|
147581
|
+
);
|
147582
|
+
return;
|
147583
|
+
}
|
147556
147584
|
logger.log(
|
147557
147585
|
`${fgGreenColor}%s${resetColor}`,
|
147558
147586
|
"If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose"
|
@@ -147571,6 +147599,7 @@ init_import_meta_url();
|
|
147571
147599
|
|
147572
147600
|
// src/vectorize/common.ts
|
147573
147601
|
init_import_meta_url();
|
147602
|
+
var import_promises33 = require("node:fs/promises");
|
147574
147603
|
var vectorizeGABanner = `--------------------
|
147575
147604
|
\u{1F4E3} Vectorize is now Generally Available.
|
147576
147605
|
\u{1F4E3} Please use the '--deprecated-v1' flag to create, get, list, delete and insert vectors into legacy Vectorize indexes
|
@@ -147585,6 +147614,16 @@ var VECTORIZE_V1_MAX_BATCH_SIZE = 1e3;
|
|
147585
147614
|
var VECTORIZE_MAX_BATCH_SIZE = 5e3;
|
147586
147615
|
var VECTORIZE_UPSERT_BATCH_SIZE = VECTORIZE_V1_MAX_BATCH_SIZE;
|
147587
147616
|
var VECTORIZE_MAX_UPSERT_VECTOR_RECORDS = 1e5;
|
147617
|
+
async function isValidFile(path72) {
|
147618
|
+
try {
|
147619
|
+
await (0, import_promises33.access)(path72, import_promises33.constants.R_OK);
|
147620
|
+
const fileStat = await (0, import_promises33.stat)(path72);
|
147621
|
+
return fileStat.isFile() && fileStat.size > 0;
|
147622
|
+
} catch (err) {
|
147623
|
+
return false;
|
147624
|
+
}
|
147625
|
+
}
|
147626
|
+
__name(isValidFile, "isValidFile");
|
147588
147627
|
async function* getBatchFromFile(rl, batchSize = VECTORIZE_MAX_BATCH_SIZE) {
|
147589
147628
|
const batch = [];
|
147590
147629
|
try {
|
@@ -147863,10 +147902,9 @@ async function handler18(args) {
|
|
147863
147902
|
dimensions: args.dimensions
|
147864
147903
|
};
|
147865
147904
|
} else {
|
147866
|
-
|
147867
|
-
"You must provide both dimensions and a metric, or a known model preset when creating an index."
|
147905
|
+
throw new UserError(
|
147906
|
+
"\u{1F6A8} You must provide both dimensions and a metric, or a known model preset when creating an index."
|
147868
147907
|
);
|
147869
|
-
return;
|
147870
147908
|
}
|
147871
147909
|
if (args.deprecatedV1) {
|
147872
147910
|
logger.warn(
|
@@ -148002,8 +148040,9 @@ __name(options22, "options");
|
|
148002
148040
|
async function handler21(args) {
|
148003
148041
|
const config = readConfig(args);
|
148004
148042
|
if (args.ids.length === 0) {
|
148005
|
-
|
148006
|
-
|
148043
|
+
throw new UserError(
|
148044
|
+
"\u{1F6A8} Please provide valid vector identifiers for deletion."
|
148045
|
+
);
|
148007
148046
|
}
|
148008
148047
|
logger.log(`\u{1F4CB} Deleting vectors...`);
|
148009
148048
|
const ids = {
|
@@ -148101,8 +148140,7 @@ __name(options25, "options");
|
|
148101
148140
|
async function handler24(args) {
|
148102
148141
|
const config = readConfig(args);
|
148103
148142
|
if (args.ids.length === 0) {
|
148104
|
-
|
148105
|
-
return;
|
148143
|
+
throw new UserError("\u{1F6A8} Please provide valid vector identifiers.");
|
148106
148144
|
}
|
148107
148145
|
logger.log(`\u{1F4CB} Fetching vectors...`);
|
148108
148146
|
const ids = {
|
@@ -148187,18 +148225,19 @@ function options27(yargs) {
|
|
148187
148225
|
}
|
148188
148226
|
__name(options27, "options");
|
148189
148227
|
async function handler26(args) {
|
148228
|
+
if (!await isValidFile(args.file)) {
|
148229
|
+
throw new UserError(`\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`);
|
148230
|
+
}
|
148190
148231
|
const config = readConfig(args);
|
148191
148232
|
const rl = (0, import_node_readline3.createInterface)({ input: (0, import_node_fs29.createReadStream)(args.file) });
|
148192
148233
|
if (args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_V1_MAX_BATCH_SIZE) {
|
148193
|
-
|
148234
|
+
throw new UserError(
|
148194
148235
|
`\u{1F6A8} Vectorize currently limits upload batches to ${VECTORIZE_V1_MAX_BATCH_SIZE} records at a time.`
|
148195
148236
|
);
|
148196
|
-
return;
|
148197
148237
|
} else if (!args.deprecatedV1 && Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
|
148198
|
-
|
148199
|
-
`\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits
|
148238
|
+
throw new UserError(
|
148239
|
+
`\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize V2 indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
|
148200
148240
|
);
|
148201
|
-
return;
|
148202
148241
|
}
|
148203
148242
|
let vectorInsertCount = 0;
|
148204
148243
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
@@ -148418,10 +148457,9 @@ async function handler29(args) {
|
|
148418
148457
|
}
|
148419
148458
|
}
|
148420
148459
|
if (args.vector === void 0 && args.vectorId === void 0 || args.vector !== void 0 && args.vectorId !== void 0) {
|
148421
|
-
|
148460
|
+
throw new UserError(
|
148422
148461
|
"\u{1F6A8} Either vector or vector-id parameter must be provided, but not both."
|
148423
148462
|
);
|
148424
|
-
return;
|
148425
148463
|
}
|
148426
148464
|
logger.log(`\u{1F4CB} Searching for relevant vectors...`);
|
148427
148465
|
let res;
|
@@ -148538,13 +148576,15 @@ function options31(yargs) {
|
|
148538
148576
|
}
|
148539
148577
|
__name(options31, "options");
|
148540
148578
|
async function handler30(args) {
|
148579
|
+
if (!await isValidFile(args.file)) {
|
148580
|
+
throw new UserError(`\u{1F6A8} Cannot read invalid or empty file: ${args.file}.`);
|
148581
|
+
}
|
148541
148582
|
const config = readConfig(args);
|
148542
148583
|
const rl = (0, import_node_readline4.createInterface)({ input: (0, import_node_fs30.createReadStream)(args.file) });
|
148543
148584
|
if (Number(args.batchSize) > VECTORIZE_MAX_BATCH_SIZE) {
|
148544
|
-
|
148545
|
-
`\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits
|
148585
|
+
throw new UserError(
|
148586
|
+
`\u{1F6A8} The global rate limit for the Cloudflare API is 1200 requests per five minutes. Vectorize indexes currently limit upload batches to ${VECTORIZE_MAX_BATCH_SIZE} records at a time to stay within the service limits.`
|
148546
148587
|
);
|
148547
|
-
return;
|
148548
148588
|
}
|
148549
148589
|
let vectorUpsertCount = 0;
|
148550
148590
|
for await (const batch of getBatchFromFile(rl, args.batchSize)) {
|
@@ -153341,7 +153381,7 @@ ${tryRunningItIn}${oneOfThese}`
|
|
153341
153381
|
const controller = new AbortController();
|
153342
153382
|
await Promise.race([
|
153343
153383
|
Promise.allSettled(dispatcher?.requests ?? []),
|
153344
|
-
(0,
|
153384
|
+
(0, import_promises34.setTimeout)(1e3, void 0, controller)
|
153345
153385
|
// Ensure we don't hang indefinitely
|
153346
153386
|
]).then(() => controller.abort());
|
153347
153387
|
} catch (e7) {
|
@@ -153405,7 +153445,7 @@ async function checkStartupHandler({
|
|
153405
153445
|
startMessage: "Analysing",
|
153406
153446
|
endMessage: source_default.green("Startup phase analysed")
|
153407
153447
|
});
|
153408
|
-
await (0,
|
153448
|
+
await (0, import_promises36.writeFile)(outfile, JSON.stringify(await cpuProfileResult));
|
153409
153449
|
log(
|
153410
153450
|
`CPU Profile written to ${outfile}. Load it into the Chrome DevTools profiler (or directly in VSCode) to view a flamegraph.`
|
153411
153451
|
);
|
@@ -153484,7 +153524,7 @@ async function convertWorkerBundleToModules(workerBundle) {
|
|
153484
153524
|
}
|
153485
153525
|
__name(convertWorkerBundleToModules, "convertWorkerBundleToModules");
|
153486
153526
|
async function parseFormDataFromFile(file) {
|
153487
|
-
const bundle = await (0,
|
153527
|
+
const bundle = await (0, import_promises35.readFile)(file);
|
153488
153528
|
const firstLine = bundle.findIndex((v7) => v7 === 10);
|
153489
153529
|
const boundary = Uint8Array.prototype.slice.call(bundle, 2, firstLine).toString();
|
153490
153530
|
return await new Response(bundle, {
|
@@ -153582,7 +153622,7 @@ async function handleStartupError(workerBundle, projectRoot) {
|
|
153582
153622
|
projectRoot ?? process.cwd(),
|
153583
153623
|
import_node_path60.default.join(tmpDir.path, `worker.cpuprofile`)
|
153584
153624
|
);
|
153585
|
-
await (0,
|
153625
|
+
await (0, import_promises37.writeFile)(profile, JSON.stringify(cpuProfile));
|
153586
153626
|
throw new UserError(esm_default2`
|
153587
153627
|
Your Worker failed validation because it exceeded startup limits.
|
153588
153628
|
To ensure fast responses, there are constraints on Worker startup, such as how much CPU it can use, or how long it can take. Your Worker has hit one of these startup limits. Try reducing the amount of work done during startup (outside the event handler), either by removing code or relocating it inside the event handler.
|
@@ -154528,7 +154568,7 @@ var syncAssets = /* @__PURE__ */ __name(async (accountId, assetDirectory, script
|
|
154528
154568
|
payload.append(
|
154529
154569
|
manifestEntry[1].hash,
|
154530
154570
|
new import_undici22.File(
|
154531
|
-
[(await (0,
|
154571
|
+
[(await (0, import_promises38.readFile)(absFilePath)).toString("base64")],
|
154532
154572
|
manifestEntry[1].hash,
|
154533
154573
|
{
|
154534
154574
|
// Most formdata body encoders (incl. undici's) will override with "application/octet-stream" if you use a falsy value here
|
@@ -154620,7 +154660,7 @@ Assets already uploaded have been saved, so the next attempt will automatically
|
|
154620
154660
|
return completionJwt;
|
154621
154661
|
}, "syncAssets");
|
154622
154662
|
var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
154623
|
-
const files = await (0,
|
154663
|
+
const files = await (0, import_promises38.readdir)(dir, { recursive: true });
|
154624
154664
|
const manifest = {};
|
154625
154665
|
let counter = 0;
|
154626
154666
|
const { assetsIgnoreFunction, assetsIgnoreFilePresent } = await createAssetsIgnoreFunction(dir);
|
@@ -154631,7 +154671,7 @@ var buildAssetManifest = /* @__PURE__ */ __name(async (dir) => {
|
|
154631
154671
|
return;
|
154632
154672
|
}
|
154633
154673
|
const filepath = path65.join(dir, relativeFilepath);
|
154634
|
-
const filestat = await (0,
|
154674
|
+
const filestat = await (0, import_promises38.stat)(filepath);
|
154635
154675
|
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
154636
154676
|
return;
|
154637
154677
|
} else {
|
@@ -154826,7 +154866,7 @@ init_import_meta_url();
|
|
154826
154866
|
// src/dev-registry/file-registry.ts
|
154827
154867
|
init_import_meta_url();
|
154828
154868
|
var import_node_fs34 = require("node:fs");
|
154829
|
-
var
|
154869
|
+
var import_promises39 = require("node:fs/promises");
|
154830
154870
|
var import_node_path62 = __toESM(require("node:path"));
|
154831
154871
|
var util3 = __toESM(require("node:util"));
|
154832
154872
|
init_esm2();
|
@@ -154898,8 +154938,8 @@ async function registerWorker(name2, definition) {
|
|
154898
154938
|
if (existingHeartbeat) {
|
154899
154939
|
clearInterval(existingHeartbeat);
|
154900
154940
|
}
|
154901
|
-
await (0,
|
154902
|
-
await (0,
|
154941
|
+
await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
154942
|
+
await (0, import_promises39.writeFile)(
|
154903
154943
|
import_node_path62.default.join(DEV_REGISTRY_PATH, name2),
|
154904
154944
|
// We don't currently do anything with the stored Wrangler version,
|
154905
154945
|
// but if we need to make breaking changes to this format in the future
|
@@ -154922,7 +154962,7 @@ async function getRegisteredWorkers() {
|
|
154922
154962
|
__name(getRegisteredWorkers, "getRegisteredWorkers");
|
154923
154963
|
async function unregisterWorker(name2) {
|
154924
154964
|
try {
|
154925
|
-
await (0,
|
154965
|
+
await (0, import_promises39.unlink)(import_node_path62.default.join(DEV_REGISTRY_PATH, name2));
|
154926
154966
|
const existingHeartbeat = heartbeats.get(name2);
|
154927
154967
|
if (existingHeartbeat) {
|
154928
154968
|
clearInterval(existingHeartbeat);
|
@@ -154934,17 +154974,17 @@ async function unregisterWorker(name2) {
|
|
154934
154974
|
}
|
154935
154975
|
__name(unregisterWorker, "unregisterWorker");
|
154936
154976
|
async function loadWorkerDefinitions() {
|
154937
|
-
await (0,
|
154977
|
+
await (0, import_promises39.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
154938
154978
|
globalWorkers ??= {};
|
154939
154979
|
const newWorkers = /* @__PURE__ */ new Set();
|
154940
|
-
const workerDefinitions = await (0,
|
154980
|
+
const workerDefinitions = await (0, import_promises39.readdir)(DEV_REGISTRY_PATH);
|
154941
154981
|
for (const workerName of workerDefinitions) {
|
154942
154982
|
try {
|
154943
|
-
const file = await (0,
|
154983
|
+
const file = await (0, import_promises39.readFile)(
|
154944
154984
|
import_node_path62.default.join(DEV_REGISTRY_PATH, workerName),
|
154945
154985
|
"utf8"
|
154946
154986
|
);
|
154947
|
-
const stats = await (0,
|
154987
|
+
const stats = await (0, import_promises39.stat)(import_node_path62.default.join(DEV_REGISTRY_PATH, workerName));
|
154948
154988
|
if (stats.mtime.getTime() < Date.now() - 6e5) {
|
154949
154989
|
await unregisterWorker(workerName);
|
154950
154990
|
} else {
|
@@ -156435,6 +156475,7 @@ var BundlerController = class extends Controller {
|
|
156435
156475
|
const entry = {
|
156436
156476
|
file: config.entrypoint,
|
156437
156477
|
projectRoot: config.projectRoot,
|
156478
|
+
configPath: config.config,
|
156438
156479
|
format: config.build.format,
|
156439
156480
|
moduleRoot: config.build.moduleRoot,
|
156440
156481
|
exports: config.build.exports
|
@@ -156564,6 +156605,7 @@ var BundlerController = class extends Controller {
|
|
156564
156605
|
const entry = {
|
156565
156606
|
file: config.entrypoint,
|
156566
156607
|
projectRoot: config.projectRoot,
|
156608
|
+
configPath: config.config,
|
156567
156609
|
format: config.build.format,
|
156568
156610
|
moduleRoot: config.build.moduleRoot,
|
156569
156611
|
exports: config.build.exports,
|