wrangler 3.78.7 → 3.78.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 +4 -4
- package/wrangler-dist/cli.js +456 -362
- package/wrangler-dist/cli.js.map +7 -0
package/wrangler-dist/cli.js
CHANGED
@@ -66927,17 +66927,17 @@ var require_eventemitter3 = __commonJS({
|
|
66927
66927
|
});
|
66928
66928
|
|
66929
66929
|
// src/pages/hash.ts
|
66930
|
-
var import_node_fs10,
|
66930
|
+
var import_node_fs10, import_node_path16, import_blake3_wasm, hashFile;
|
66931
66931
|
var init_hash = __esm({
|
66932
66932
|
"src/pages/hash.ts"() {
|
66933
66933
|
init_import_meta_url();
|
66934
66934
|
import_node_fs10 = require("node:fs");
|
66935
|
-
|
66935
|
+
import_node_path16 = require("node:path");
|
66936
66936
|
import_blake3_wasm = require("blake3-wasm");
|
66937
66937
|
hashFile = /* @__PURE__ */ __name((filepath) => {
|
66938
66938
|
const contents = (0, import_node_fs10.readFileSync)(filepath);
|
66939
66939
|
const base64Contents = contents.toString("base64");
|
66940
|
-
const extension = (0,
|
66940
|
+
const extension = (0, import_node_path16.extname)(filepath).substring(1);
|
66941
66941
|
return (0, import_blake3_wasm.hash)(base64Contents + extension).toString("hex").slice(0, 32);
|
66942
66942
|
}, "hashFile");
|
66943
66943
|
}
|
@@ -71121,15 +71121,15 @@ function npmRunPath(options29 = {}) {
|
|
71121
71121
|
} = options29;
|
71122
71122
|
let previous;
|
71123
71123
|
const cwdString = cwd2 instanceof URL ? import_node_url9.default.fileURLToPath(cwd2) : cwd2;
|
71124
|
-
let cwdPath =
|
71124
|
+
let cwdPath = import_node_path25.default.resolve(cwdString);
|
71125
71125
|
const result = [];
|
71126
71126
|
while (previous !== cwdPath) {
|
71127
|
-
result.push(
|
71127
|
+
result.push(import_node_path25.default.join(cwdPath, "node_modules/.bin"));
|
71128
71128
|
previous = cwdPath;
|
71129
|
-
cwdPath =
|
71129
|
+
cwdPath = import_node_path25.default.resolve(cwdPath, "..");
|
71130
71130
|
}
|
71131
|
-
result.push(
|
71132
|
-
return [...result, path_].join(
|
71131
|
+
result.push(import_node_path25.default.resolve(cwdString, execPath, ".."));
|
71132
|
+
return [...result, path_].join(import_node_path25.default.delimiter);
|
71133
71133
|
}
|
71134
71134
|
function npmRunPathEnv({ env: env7 = import_node_process8.default.env, ...options29 } = {}) {
|
71135
71135
|
env7 = { ...env7 };
|
@@ -71138,12 +71138,12 @@ function npmRunPathEnv({ env: env7 = import_node_process8.default.env, ...option
|
|
71138
71138
|
env7[path74] = npmRunPath(options29);
|
71139
71139
|
return env7;
|
71140
71140
|
}
|
71141
|
-
var import_node_process8,
|
71141
|
+
var import_node_process8, import_node_path25, import_node_url9;
|
71142
71142
|
var init_npm_run_path = __esm({
|
71143
71143
|
"../../node_modules/.pnpm/npm-run-path@5.1.0/node_modules/npm-run-path/index.js"() {
|
71144
71144
|
init_import_meta_url();
|
71145
71145
|
import_node_process8 = __toESM(require("node:process"), 1);
|
71146
|
-
|
71146
|
+
import_node_path25 = __toESM(require("node:path"), 1);
|
71147
71147
|
import_node_url9 = __toESM(require("node:url"), 1);
|
71148
71148
|
init_path_key();
|
71149
71149
|
__name(npmRunPath, "npmRunPath");
|
@@ -72256,12 +72256,12 @@ function execaCommandSync(command2, options29) {
|
|
72256
72256
|
const [file, ...args] = parseCommand(command2);
|
72257
72257
|
return execaSync(file, args, options29);
|
72258
72258
|
}
|
72259
|
-
var import_node_buffer3,
|
72259
|
+
var import_node_buffer3, import_node_path26, import_node_child_process2, import_node_process9, import_cross_spawn, DEFAULT_MAX_BUFFER, getEnv, handleArguments, handleOutput;
|
72260
72260
|
var init_execa = __esm({
|
72261
72261
|
"../../node_modules/.pnpm/execa@6.1.0/node_modules/execa/index.js"() {
|
72262
72262
|
init_import_meta_url();
|
72263
72263
|
import_node_buffer3 = require("node:buffer");
|
72264
|
-
|
72264
|
+
import_node_path26 = __toESM(require("node:path"), 1);
|
72265
72265
|
import_node_child_process2 = __toESM(require("node:child_process"), 1);
|
72266
72266
|
import_node_process9 = __toESM(require("node:process"), 1);
|
72267
72267
|
import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
@@ -72304,7 +72304,7 @@ var init_execa = __esm({
|
|
72304
72304
|
};
|
72305
72305
|
options29.env = getEnv(options29);
|
72306
72306
|
options29.stdio = normalizeStdio(options29);
|
72307
|
-
if (import_node_process9.default.platform === "win32" &&
|
72307
|
+
if (import_node_process9.default.platform === "win32" && import_node_path26.default.basename(file, ".exe") === "cmd") {
|
72308
72308
|
args.unshift("/q");
|
72309
72309
|
}
|
72310
72310
|
return { file, args, options: options29, parsed };
|
@@ -93847,7 +93847,7 @@ var require_response2 = __commonJS({
|
|
93847
93847
|
var encodeUrl = require_encodeurl();
|
93848
93848
|
var escapeHtml = require_escape_html();
|
93849
93849
|
var http4 = require("http");
|
93850
|
-
var
|
93850
|
+
var isAbsolute2 = require_utils5().isAbsolute;
|
93851
93851
|
var onFinished = require_on_finished();
|
93852
93852
|
var path74 = require("path");
|
93853
93853
|
var statuses = require_statuses();
|
@@ -94054,7 +94054,7 @@ var require_response2 = __commonJS({
|
|
94054
94054
|
done = options29;
|
94055
94055
|
opts = {};
|
94056
94056
|
}
|
94057
|
-
if (!opts.root && !
|
94057
|
+
if (!opts.root && !isAbsolute2(path75)) {
|
94058
94058
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
94059
94059
|
}
|
94060
94060
|
var pathname = encodeURI(path75);
|
@@ -107494,7 +107494,7 @@ function constructRedirects({
|
|
107494
107494
|
}
|
107495
107495
|
const num_valid = redirects.rules.length;
|
107496
107496
|
const num_invalid = redirects.invalid.length;
|
107497
|
-
const redirectsRelativePath = redirectsFile ? (0,
|
107497
|
+
const redirectsRelativePath = redirectsFile ? (0, import_node_path33.relative)(process.cwd(), redirectsFile) : "";
|
107498
107498
|
logger3.log(
|
107499
107499
|
`\u2728 Parsed ${num_valid} valid redirect rule${num_valid === 1 ? "" : "s"}.`
|
107500
107500
|
);
|
@@ -107556,7 +107556,7 @@ function constructHeaders({
|
|
107556
107556
|
}
|
107557
107557
|
const num_valid = headers.rules.length;
|
107558
107558
|
const num_invalid = headers.invalid.length;
|
107559
|
-
const headersRelativePath = headersFile ? (0,
|
107559
|
+
const headersRelativePath = headersFile ? (0, import_node_path33.relative)(process.cwd(), headersFile) : "";
|
107560
107560
|
logger3.log(
|
107561
107561
|
`\u2728 Parsed ${num_valid} valid header rule${num_valid === 1 ? "" : "s"}.`
|
107562
107562
|
);
|
@@ -107609,11 +107609,11 @@ function constructWebAnalytics({
|
|
107609
107609
|
}
|
107610
107610
|
};
|
107611
107611
|
}
|
107612
|
-
var
|
107612
|
+
var import_node_path33, noopLogger;
|
107613
107613
|
var init_createMetadataObject = __esm({
|
107614
107614
|
"../pages-shared/metadata-generator/createMetadataObject.ts"() {
|
107615
107615
|
init_import_meta_url();
|
107616
|
-
|
107616
|
+
import_node_path33 = require("node:path");
|
107617
107617
|
init_constants();
|
107618
107618
|
noopLogger = {
|
107619
107619
|
debug: (_message) => {
|
@@ -112386,7 +112386,7 @@ async function installAndReturnDir(packages, logger3) {
|
|
112386
112386
|
throw new Error(`Failed installing ${packages.map((p2) => p2.name).join(",")} using: ${installPackage}.`);
|
112387
112387
|
}
|
112388
112388
|
const tempPath = getTempPath(stdout2);
|
112389
|
-
const nodeModulesPath =
|
112389
|
+
const nodeModulesPath = import_node_path34.default.resolve(tempPath, "..");
|
112390
112390
|
if (!nodeModulesPath.endsWith("node_modules")) {
|
112391
112391
|
throw new Error(`Found NPX temporary path of '${tempPath}' but expected to be able to find a node_modules directory by looking in '..'.`);
|
112392
112392
|
}
|
@@ -112440,12 +112440,12 @@ ${JSON.stringify(paths)}`);
|
|
112440
112440
|
return tempPath;
|
112441
112441
|
}
|
112442
112442
|
}
|
112443
|
-
var import_node_os6,
|
112443
|
+
var import_node_os6, import_node_path34, import_semver, import_validate_npm_package_name, WINDOWS, NOT_IMPORTABLE, INSTALLED_LOCALLY, INSTALL_CACHE, DEFAULT_LOGGER, INSTRUCTIONS, formatForCLI;
|
112444
112444
|
var init_lib = __esm({
|
112445
112445
|
"../../node_modules/.pnpm/npx-import@1.1.4/node_modules/npx-import/lib/index.js"() {
|
112446
112446
|
init_import_meta_url();
|
112447
112447
|
import_node_os6 = __toESM(require("node:os"), 1);
|
112448
|
-
|
112448
|
+
import_node_path34 = __toESM(require("node:path"), 1);
|
112449
112449
|
import_semver = __toESM(require_semver2(), 1);
|
112450
112450
|
init_dist();
|
112451
112451
|
init_execa();
|
@@ -113290,7 +113290,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
113290
113290
|
}
|
113291
113291
|
}
|
113292
113292
|
}, "Mutex");
|
113293
|
-
var
|
113293
|
+
var import_node_path69 = __toModule(require("node:path"));
|
113294
113294
|
async function createSQLiteDB(dbPath) {
|
113295
113295
|
const { npxImport: npxImport2, npxResolve: npxResolve2 } = await Promise.resolve().then(() => (init_lib(), lib_exports));
|
113296
113296
|
const { default: DatabaseConstructor } = await npxImport2("better-sqlite3@8.0.1");
|
@@ -113300,7 +113300,7 @@ A subrequest is a call to fetch(), a redirect, or a call to any Cache API method
|
|
113300
113300
|
}
|
113301
113301
|
__name(createSQLiteDB, "createSQLiteDB");
|
113302
113302
|
function getSQLiteNativeBindingLocation(sqliteResolvePath) {
|
113303
|
-
return
|
113303
|
+
return import_node_path69.default.resolve(import_node_path69.default.dirname(sqliteResolvePath), "../build/Release/better_sqlite3.node");
|
113304
113304
|
}
|
113305
113305
|
__name(getSQLiteNativeBindingLocation, "getSQLiteNativeBindingLocation");
|
113306
113306
|
}
|
@@ -141511,13 +141511,13 @@ async function generateASSETSBinding(options29) {
|
|
141511
141511
|
};
|
141512
141512
|
}
|
141513
141513
|
async function generateAssetsFetch(directory, log2) {
|
141514
|
-
directory = (0,
|
141514
|
+
directory = (0, import_node_path35.resolve)(directory);
|
141515
141515
|
const polyfill2 = (await Promise.resolve().then(() => (init_miniflare(), miniflare_exports))).default;
|
141516
141516
|
await polyfill2();
|
141517
141517
|
const { generateHandler: generateHandler3, parseQualityWeightedList: parseQualityWeightedList2 } = await Promise.resolve().then(() => (init_handler(), handler_exports));
|
141518
|
-
const headersFile = (0,
|
141519
|
-
const redirectsFile = (0,
|
141520
|
-
const workerFile = (0,
|
141518
|
+
const headersFile = (0, import_node_path35.join)(directory, "_headers");
|
141519
|
+
const redirectsFile = (0, import_node_path35.join)(directory, "_redirects");
|
141520
|
+
const workerFile = (0, import_node_path35.join)(directory, "_worker.js");
|
141521
141521
|
const ignoredFiles = [headersFile, redirectsFile, workerFile];
|
141522
141522
|
let redirects;
|
141523
141523
|
if ((0, import_node_fs19.existsSync)(redirectsFile)) {
|
@@ -141570,7 +141570,7 @@ async function generateAssetsFetch(directory, log2) {
|
|
141570
141570
|
xServerEnvHeader: "dev",
|
141571
141571
|
logError: console.error,
|
141572
141572
|
findAssetEntryForPath: async (path74) => {
|
141573
|
-
const filepath = (0,
|
141573
|
+
const filepath = (0, import_node_path35.resolve)((0, import_node_path35.join)(directory, path74));
|
141574
141574
|
if (!filepath.startsWith(directory)) {
|
141575
141575
|
return null;
|
141576
141576
|
}
|
@@ -141618,13 +141618,13 @@ async function generateAssetsFetch(directory, log2) {
|
|
141618
141618
|
return await generateResponse(request3);
|
141619
141619
|
};
|
141620
141620
|
}
|
141621
|
-
var import_node_assert15, import_node_fs19,
|
141621
|
+
var import_node_assert15, import_node_fs19, import_node_path35, import_chokidar2, import_mime3, import_miniflare7, import_undici9, ProxyDispatcher, invalidAssetsFetch;
|
141622
141622
|
var init_assets = __esm({
|
141623
141623
|
"src/miniflare-cli/assets.ts"() {
|
141624
141624
|
init_import_meta_url();
|
141625
141625
|
import_node_assert15 = __toESM(require("node:assert"));
|
141626
141626
|
import_node_fs19 = require("node:fs");
|
141627
|
-
|
141627
|
+
import_node_path35 = require("node:path");
|
141628
141628
|
init_createMetadataObject();
|
141629
141629
|
init_parseHeaders();
|
141630
141630
|
init_parseRedirects();
|
@@ -151333,7 +151333,7 @@ var import_undici27 = __toESM(require_undici());
|
|
151333
151333
|
init_import_meta_url();
|
151334
151334
|
var import_node_assert24 = __toESM(require("node:assert"));
|
151335
151335
|
var import_node_events3 = __toESM(require("node:events"));
|
151336
|
-
var
|
151336
|
+
var import_node_path64 = __toESM(require("node:path"));
|
151337
151337
|
var import_node_util3 = __toESM(require("node:util"));
|
151338
151338
|
var import_env2 = __toESM(require_dist());
|
151339
151339
|
var import_chokidar6 = require("chokidar");
|
@@ -152882,7 +152882,7 @@ init_import_meta_url();
|
|
152882
152882
|
init_import_meta_url();
|
152883
152883
|
|
152884
152884
|
// package.json
|
152885
|
-
var version = "3.78.
|
152885
|
+
var version = "3.78.8";
|
152886
152886
|
var package_default = {
|
152887
152887
|
name: "wrangler",
|
152888
152888
|
version,
|
@@ -158110,7 +158110,7 @@ __name(loadDotEnv, "loadDotEnv");
|
|
158110
158110
|
init_import_meta_url();
|
158111
158111
|
var import_node_assert13 = __toESM(require("node:assert"));
|
158112
158112
|
var import_node_fs15 = require("node:fs");
|
158113
|
-
var
|
158113
|
+
var import_node_path23 = __toESM(require("node:path"));
|
158114
158114
|
var import_node_url8 = require("node:url");
|
158115
158115
|
|
158116
158116
|
// ../cli/index.ts
|
@@ -165777,14 +165777,14 @@ var AssetConfigSchema = z.object({
|
|
165777
165777
|
|
165778
165778
|
// ../workers-shared/utils/helpers.ts
|
165779
165779
|
init_import_meta_url();
|
165780
|
+
var import_node_path15 = require("node:path");
|
165780
165781
|
var import_mime = __toESM(require_mime());
|
165781
|
-
var
|
165782
|
-
|
165783
|
-
|
165784
|
-
}
|
165785
|
-
|
165786
|
-
|
165787
|
-
}, "decodeFilePath");
|
165782
|
+
var normalizeFilePath = /* @__PURE__ */ __name((relativeFilepath) => {
|
165783
|
+
if ((0, import_node_path15.isAbsolute)(relativeFilepath)) {
|
165784
|
+
throw new Error(`Expected relative path`);
|
165785
|
+
}
|
165786
|
+
return "/" + relativeFilepath.split(import_node_path15.sep).join("/");
|
165787
|
+
}, "normalizeFilePath");
|
165788
165788
|
var getContentType = /* @__PURE__ */ __name((absFilePath) => {
|
165789
165789
|
let contentType = (0, import_mime.getType)(absFilePath) || "application/octet-stream";
|
165790
165790
|
if (contentType.startsWith("text/") && !contentType.includes("charset")) {
|
@@ -166370,14 +166370,14 @@ init_hash();
|
|
166370
166370
|
// src/pages/upload.tsx
|
166371
166371
|
init_import_meta_url();
|
166372
166372
|
var import_promises7 = require("node:fs/promises");
|
166373
|
-
var
|
166373
|
+
var import_node_path18 = require("node:path");
|
166374
166374
|
var import_ink = __toESM(require_build2());
|
166375
166375
|
var import_ink_spinner = __toESM(require_build3());
|
166376
166376
|
|
166377
166377
|
// src/pages/validate.tsx
|
166378
166378
|
init_import_meta_url();
|
166379
166379
|
var import_promises6 = require("node:fs/promises");
|
166380
|
-
var
|
166380
|
+
var import_node_path17 = require("node:path");
|
166381
166381
|
var import_mime2 = __toESM(require_mime());
|
166382
166382
|
var import_minimatch = __toESM(require_minimatch());
|
166383
166383
|
init_hash();
|
@@ -166408,13 +166408,13 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
166408
166408
|
"**/node_modules",
|
166409
166409
|
"**/.git"
|
166410
166410
|
].map((pattern) => new import_minimatch.Minimatch(pattern));
|
166411
|
-
const directory = (0,
|
166411
|
+
const directory = (0, import_node_path17.resolve)(args.directory);
|
166412
166412
|
const walk = /* @__PURE__ */ __name(async (dir, fileMap2 = /* @__PURE__ */ new Map(), startingDir = dir) => {
|
166413
166413
|
const files = await (0, import_promises6.readdir)(dir);
|
166414
166414
|
await Promise.all(
|
166415
166415
|
files.map(async (file) => {
|
166416
|
-
const filepath = (0,
|
166417
|
-
const relativeFilepath = (0,
|
166416
|
+
const filepath = (0, import_node_path17.join)(dir, file);
|
166417
|
+
const relativeFilepath = (0, import_node_path17.relative)(startingDir, filepath);
|
166418
166418
|
const filestat = await (0, import_promises6.stat)(filepath);
|
166419
166419
|
for (const minimatch of IGNORE_LIST) {
|
166420
166420
|
if (minimatch.match(relativeFilepath)) {
|
@@ -166427,7 +166427,7 @@ var validate = /* @__PURE__ */ __name(async (args) => {
|
|
166427
166427
|
if (filestat.isDirectory()) {
|
166428
166428
|
fileMap2 = await walk(filepath, fileMap2, startingDir);
|
166429
166429
|
} else {
|
166430
|
-
const name = relativeFilepath.split(
|
166430
|
+
const name = relativeFilepath.split(import_node_path17.sep).join("/");
|
166431
166431
|
if (filestat.size > MAX_ASSET_SIZE) {
|
166432
166432
|
throw new FatalError(
|
166433
166433
|
`Error: Pages only supports files up to ${prettyBytes(
|
@@ -166498,7 +166498,7 @@ var Handler2 = /* @__PURE__ */ __name(async ({
|
|
166498
166498
|
skipCaching: skipCaching ?? false
|
166499
166499
|
});
|
166500
166500
|
if (outputManifestPath) {
|
166501
|
-
await (0, import_promises7.mkdir)((0,
|
166501
|
+
await (0, import_promises7.mkdir)((0, import_node_path18.dirname)(outputManifestPath), { recursive: true });
|
166502
166502
|
await (0, import_promises7.writeFile)(outputManifestPath, JSON.stringify(manifest));
|
166503
166503
|
}
|
166504
166504
|
logger.log(`\u2728 Upload complete!`);
|
@@ -166798,10 +166798,7 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
166798
166798
|
1
|
166799
166799
|
);
|
166800
166800
|
}
|
166801
|
-
assetLogCount = logAssetUpload(
|
166802
|
-
`+ ${decodeFilePath(manifestEntry[0], path16.sep)}`,
|
166803
|
-
assetLogCount
|
166804
|
-
);
|
166801
|
+
assetLogCount = logAssetUpload(`+ ${manifestEntry[0]}`, assetLogCount);
|
166805
166802
|
return manifestEntry;
|
166806
166803
|
});
|
166807
166804
|
});
|
@@ -166816,8 +166813,7 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
166816
166813
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
166817
166814
|
const payload = new import_undici5.FormData();
|
166818
166815
|
for (const manifestEntry of bucket) {
|
166819
|
-
const
|
166820
|
-
const absFilePath = path16.join(assetDirectory, decodedFilePath);
|
166816
|
+
const absFilePath = path16.join(assetDirectory, manifestEntry[0]);
|
166821
166817
|
payload.append(
|
166822
166818
|
manifestEntry[1].hash,
|
166823
166819
|
new import_undici5.File(
|
@@ -166944,7 +166940,7 @@ Cloudflare Workers supports assets with sizes of up to ${prettyBytes(
|
|
166944
166940
|
Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`
|
166945
166941
|
);
|
166946
166942
|
}
|
166947
|
-
manifest[
|
166943
|
+
manifest[normalizeFilePath(relativeFilepath)] = {
|
166948
166944
|
hash: hashFile(filepath),
|
166949
166945
|
size: filestat.size
|
166950
166946
|
};
|
@@ -167007,15 +167003,15 @@ ${resolvedExperimentalAssetsPath}`
|
|
167007
167003
|
};
|
167008
167004
|
}
|
167009
167005
|
__name(processExperimentalAssetsArg, "processExperimentalAssetsArg");
|
167010
|
-
function
|
167006
|
+
function validateAssetsArgsAndConfig(args, config) {
|
167011
167007
|
if ((args.experimentalAssets || config.experimental_assets) && (args.legacyAssets || config.legacy_assets)) {
|
167012
167008
|
throw new UserError(
|
167013
|
-
"Cannot use Experimental Assets and Legacy Assets in the same Worker."
|
167009
|
+
"Cannot use Experimental Assets and Legacy Assets in the same Worker.\nPlease remove either the `legacy_assets` or `experimental_assets` field from your configuration file."
|
167014
167010
|
);
|
167015
167011
|
}
|
167016
167012
|
if ((args.experimentalAssets || config.experimental_assets) && (args.site || config.site)) {
|
167017
167013
|
throw new UserError(
|
167018
|
-
"Cannot use Experimental Assets and Workers Sites in the same Worker."
|
167014
|
+
"Cannot use Experimental Assets and Workers Sites in the same Worker.\nPlease remove either the `site` or `experimental_assets` field from your configuration file."
|
167019
167015
|
);
|
167020
167016
|
}
|
167021
167017
|
if ((args.experimentalAssets || config.experimental_assets) && config.tail_consumers?.length) {
|
@@ -167023,8 +167019,13 @@ function verifyMutuallyExclusiveAssetsArgsOrConfig(args, config) {
|
|
167023
167019
|
"Cannot use Experimental Assets and tail consumers in the same Worker. Tail Workers are not yet supported for Workers with assets."
|
167024
167020
|
);
|
167025
167021
|
}
|
167022
|
+
if (!(args.script || config.main) && config.experimental_assets?.binding) {
|
167023
|
+
throw new UserError(
|
167024
|
+
"Cannot use Experimental Assets with a binding in an assets-only Worker.\nPlease remove the asset binding from your configuration file, or provide a Worker script in your configuration file (`main`)."
|
167025
|
+
);
|
167026
|
+
}
|
167026
167027
|
}
|
167027
|
-
__name(
|
167028
|
+
__name(validateAssetsArgsAndConfig, "validateAssetsArgsAndConfig");
|
167028
167029
|
var CF_ASSETS_IGNORE_FILENAME = ".assetsignore";
|
167029
167030
|
async function createAssetIgnoreFunction(dir) {
|
167030
167031
|
const cfAssetIgnorePath = path16.resolve(dir, CF_ASSETS_IGNORE_FILENAME);
|
@@ -167062,7 +167063,7 @@ var import_undici6 = __toESM(require_undici());
|
|
167062
167063
|
init_import_meta_url();
|
167063
167064
|
var import_node_crypto4 = require("node:crypto");
|
167064
167065
|
var import_node_fs12 = require("node:fs");
|
167065
|
-
var
|
167066
|
+
var import_node_path19 = __toESM(require("node:path"));
|
167066
167067
|
var CURRENT_METRICS_DATE = new Date(2022, 6, 4);
|
167067
167068
|
var USER_ID_CACHE_PATH = "user-id.json";
|
167068
167069
|
async function getMetricsConfig({
|
@@ -167100,7 +167101,7 @@ async function getMetricsConfig({
|
|
167100
167101
|
"Would you like to help improve Wrangler by sending usage metrics to Cloudflare?"
|
167101
167102
|
);
|
167102
167103
|
logger.log(
|
167103
|
-
`Your choice has been saved in the following file: ${
|
167104
|
+
`Your choice has been saved in the following file: ${import_node_path19.default.relative(
|
167104
167105
|
process.cwd(),
|
167105
167106
|
getMetricsConfigPath()
|
167106
167107
|
)}.
|
@@ -167121,7 +167122,7 @@ async function getMetricsConfig({
|
|
167121
167122
|
}
|
167122
167123
|
__name(getMetricsConfig, "getMetricsConfig");
|
167123
167124
|
function writeMetricsConfig(config) {
|
167124
|
-
(0, import_node_fs12.mkdirSync)(
|
167125
|
+
(0, import_node_fs12.mkdirSync)(import_node_path19.default.dirname(getMetricsConfigPath()), { recursive: true });
|
167125
167126
|
(0, import_node_fs12.writeFileSync)(
|
167126
167127
|
getMetricsConfigPath(),
|
167127
167128
|
JSON.stringify(
|
@@ -167145,7 +167146,7 @@ function readMetricsConfig() {
|
|
167145
167146
|
}
|
167146
167147
|
__name(readMetricsConfig, "readMetricsConfig");
|
167147
167148
|
function getMetricsConfigPath() {
|
167148
|
-
return
|
167149
|
+
return import_node_path19.default.resolve(getGlobalWranglerConfigPath(), "metrics.json");
|
167149
167150
|
}
|
167150
167151
|
__name(getMetricsConfigPath, "getMetricsConfigPath");
|
167151
167152
|
function getDeviceId(config) {
|
@@ -167593,16 +167594,16 @@ var import_undici7 = __toESM(require_undici());
|
|
167593
167594
|
|
167594
167595
|
// src/dev/get-local-persistence-path.ts
|
167595
167596
|
init_import_meta_url();
|
167596
|
-
var
|
167597
|
+
var import_node_path20 = __toESM(require("node:path"));
|
167597
167598
|
function getLocalPersistencePath(persistTo, configPath) {
|
167598
167599
|
return persistTo ? (
|
167599
167600
|
// If path specified, always treat it as relative to cwd()
|
167600
|
-
|
167601
|
+
import_node_path20.default.resolve(process.cwd(), persistTo)
|
167601
167602
|
) : (
|
167602
167603
|
// Otherwise, treat it as relative to wrangler.toml,
|
167603
167604
|
// if one can be found, otherwise cwd()
|
167604
|
-
|
167605
|
-
configPath ?
|
167605
|
+
import_node_path20.default.resolve(
|
167606
|
+
configPath ? import_node_path20.default.dirname(configPath) : process.cwd(),
|
167606
167607
|
".wrangler/state"
|
167607
167608
|
)
|
167608
167609
|
);
|
@@ -167613,7 +167614,7 @@ __name(getLocalPersistencePath, "getLocalPersistencePath");
|
|
167613
167614
|
init_import_meta_url();
|
167614
167615
|
var import_node_assert11 = __toESM(require("node:assert"));
|
167615
167616
|
var import_node_crypto5 = require("node:crypto");
|
167616
|
-
var
|
167617
|
+
var import_node_path21 = __toESM(require("node:path"));
|
167617
167618
|
|
167618
167619
|
// ../../node_modules/.pnpm/es-module-lexer@1.3.1/node_modules/es-module-lexer/dist/lexer.js
|
167619
167620
|
init_import_meta_url();
|
@@ -168255,7 +168256,7 @@ async function buildSourceOptions(config) {
|
|
168255
168256
|
config.bundle.modules
|
168256
168257
|
);
|
168257
168258
|
const entrypointNames = isPython ? [] : await getEntrypointNames(entrypointSource);
|
168258
|
-
const modulesRoot =
|
168259
|
+
const modulesRoot = import_node_path21.default.dirname(scriptPath3);
|
168259
168260
|
const sourceOptions = {
|
168260
168261
|
modulesRoot,
|
168261
168262
|
modules: [
|
@@ -168268,7 +168269,7 @@ async function buildSourceOptions(config) {
|
|
168268
168269
|
// Misc (WebAssembly, etc, ...)
|
168269
168270
|
...modules.map((module3) => ({
|
168270
168271
|
type: ModuleTypeToRuleType[module3.type ?? "esm"],
|
168271
|
-
path:
|
168272
|
+
path: import_node_path21.default.resolve(modulesRoot, module3.name),
|
168272
168273
|
contents: module3.content
|
168273
168274
|
}))
|
168274
168275
|
]
|
@@ -168327,14 +168328,14 @@ function buildMiniflareBindingOptions(config) {
|
|
168327
168328
|
const wasmBindings = { ...bindings.wasm_modules };
|
168328
168329
|
if (config.format === "service-worker" && config.bundle) {
|
168329
168330
|
const scriptPath3 = config.bundle.path;
|
168330
|
-
const modulesRoot =
|
168331
|
+
const modulesRoot = import_node_path21.default.dirname(scriptPath3);
|
168331
168332
|
for (const { type, name } of config.bundle.modules) {
|
168332
168333
|
if (type === "text") {
|
168333
|
-
textBlobBindings[getIdentifier(name)] =
|
168334
|
+
textBlobBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168334
168335
|
} else if (type === "buffer") {
|
168335
|
-
dataBlobBindings[getIdentifier(name)] =
|
168336
|
+
dataBlobBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168336
168337
|
} else if (type === "compiled-wasm") {
|
168337
|
-
wasmBindings[getIdentifier(name)] =
|
168338
|
+
wasmBindings[getIdentifier(name)] = import_node_path21.default.resolve(modulesRoot, name);
|
168338
168339
|
}
|
168339
168340
|
}
|
168340
168341
|
}
|
@@ -168545,13 +168546,13 @@ function buildMiniflareBindingOptions(config) {
|
|
168545
168546
|
__name(buildMiniflareBindingOptions, "buildMiniflareBindingOptions");
|
168546
168547
|
function buildPersistOptions(localPersistencePath) {
|
168547
168548
|
if (localPersistencePath !== null) {
|
168548
|
-
const v3Path =
|
168549
|
+
const v3Path = import_node_path21.default.join(localPersistencePath, "v3");
|
168549
168550
|
return {
|
168550
|
-
cachePersist:
|
168551
|
-
durableObjectsPersist:
|
168552
|
-
kvPersist:
|
168553
|
-
r2Persist:
|
168554
|
-
d1Persist:
|
168551
|
+
cachePersist: import_node_path21.default.join(v3Path, "cache"),
|
168552
|
+
durableObjectsPersist: import_node_path21.default.join(v3Path, "do"),
|
168553
|
+
kvPersist: import_node_path21.default.join(v3Path, "kv"),
|
168554
|
+
r2Persist: import_node_path21.default.join(v3Path, "r2"),
|
168555
|
+
d1Persist: import_node_path21.default.join(v3Path, "d1")
|
168555
168556
|
};
|
168556
168557
|
}
|
168557
168558
|
}
|
@@ -168576,7 +168577,7 @@ function buildSitesOptions({
|
|
168576
168577
|
if (legacyAssetPaths !== void 0) {
|
168577
168578
|
const { baseDirectory, assetDirectory, includePatterns, excludePatterns } = legacyAssetPaths;
|
168578
168579
|
return {
|
168579
|
-
sitePath:
|
168580
|
+
sitePath: import_node_path21.default.join(baseDirectory, assetDirectory),
|
168580
168581
|
siteInclude: includePatterns.length > 0 ? includePatterns : void 0,
|
168581
168582
|
siteExclude: excludePatterns.length > 0 ? excludePatterns : void 0
|
168582
168583
|
};
|
@@ -171051,6 +171052,16 @@ __name(createLogUpdate, "createLogUpdate");
|
|
171051
171052
|
var logUpdate = createLogUpdate(import_node_process7.default.stdout);
|
171052
171053
|
var logUpdateStderr = createLogUpdate(import_node_process7.default.stderr);
|
171053
171054
|
|
171055
|
+
// ../cli/error.ts
|
171056
|
+
init_import_meta_url();
|
171057
|
+
var CancelError = class extends Error {
|
171058
|
+
constructor(message, signal) {
|
171059
|
+
super(message);
|
171060
|
+
this.signal = signal;
|
171061
|
+
}
|
171062
|
+
};
|
171063
|
+
__name(CancelError, "CancelError");
|
171064
|
+
|
171054
171065
|
// ../cli/select-list.ts
|
171055
171066
|
init_import_meta_url();
|
171056
171067
|
var SelectRefreshablePrompt = class extends h {
|
@@ -171112,7 +171123,11 @@ var leftT = gray(shapes.leftT);
|
|
171112
171123
|
function acceptDefault(promptConfig, renderers, initialValue) {
|
171113
171124
|
const error2 = promptConfig.validate?.(initialValue);
|
171114
171125
|
if (error2) {
|
171115
|
-
|
171126
|
+
if (promptConfig.throwOnError) {
|
171127
|
+
throw new Error(error2);
|
171128
|
+
} else {
|
171129
|
+
crash(error2);
|
171130
|
+
}
|
171116
171131
|
}
|
171117
171132
|
const lines = renderers.submit({ value: initialValue });
|
171118
171133
|
logRaw(lines.join("\n"));
|
@@ -171203,8 +171218,12 @@ var inputPrompt = /* @__PURE__ */ __name(async (promptConfig) => {
|
|
171203
171218
|
}
|
171204
171219
|
const input = await prompt2.prompt();
|
171205
171220
|
if (eD(input)) {
|
171206
|
-
|
171207
|
-
|
171221
|
+
if (promptConfig.throwOnError) {
|
171222
|
+
throw new CancelError("Operation cancelled");
|
171223
|
+
} else {
|
171224
|
+
cancel("Operation cancelled");
|
171225
|
+
process.exit(0);
|
171226
|
+
}
|
171208
171227
|
}
|
171209
171228
|
return input;
|
171210
171229
|
}, "inputPrompt");
|
@@ -171216,10 +171235,6 @@ var renderSubmit = /* @__PURE__ */ __name((config, value) => {
|
|
171216
171235
|
const content = config.type === "confirm" ? `${grayBar} ${brandColor(value)} ${dim(label)}` : `${grayBar} ${brandColor(label)} ${dim(value)}`;
|
171217
171236
|
return [`${leftT} ${question}`, content, `${grayBar}`];
|
171218
171237
|
}, "renderSubmit");
|
171219
|
-
var handleCancel = /* @__PURE__ */ __name(() => {
|
171220
|
-
cancel("Operation cancelled.");
|
171221
|
-
process.exit(0);
|
171222
|
-
}, "handleCancel");
|
171223
171238
|
var getRenderers = /* @__PURE__ */ __name((config) => {
|
171224
171239
|
switch (config.type) {
|
171225
171240
|
case "select":
|
@@ -171239,6 +171254,12 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171239
171254
|
const helpText = config.helpText ?? "";
|
171240
171255
|
const format10 = config.format ?? ((val) => String(val));
|
171241
171256
|
const defaultValue = config.defaultValue?.toString() ?? "";
|
171257
|
+
const activeRenderer = /* @__PURE__ */ __name(({ value }) => [
|
171258
|
+
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
171259
|
+
`${space(2)}${format10(value || dim(defaultValue))}`,
|
171260
|
+
``
|
171261
|
+
// extra line for readability
|
171262
|
+
], "activeRenderer");
|
171242
171263
|
return {
|
171243
171264
|
initial: () => [
|
171244
171265
|
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
@@ -171246,12 +171267,7 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171246
171267
|
``
|
171247
171268
|
// extra line for readability
|
171248
171269
|
],
|
171249
|
-
active:
|
171250
|
-
`${blCorner} ${bold(question)} ${dim(helpText)}`,
|
171251
|
-
`${space(2)}${format10(value || dim(defaultValue))}`,
|
171252
|
-
``
|
171253
|
-
// extra line for readability
|
171254
|
-
],
|
171270
|
+
active: activeRenderer,
|
171255
171271
|
error: ({ value, error: error2 }) => [
|
171256
171272
|
`${leftT} ${status.error} ${dim(error2)}`,
|
171257
171273
|
`${grayBar}`,
|
@@ -171261,7 +171277,7 @@ var getTextRenderers = /* @__PURE__ */ __name((config) => {
|
|
171261
171277
|
// extra line for readability
|
171262
171278
|
],
|
171263
171279
|
submit: ({ value }) => renderSubmit(config, format10(value ?? "")),
|
171264
|
-
cancel:
|
171280
|
+
cancel: activeRenderer
|
171265
171281
|
};
|
171266
171282
|
}, "getTextRenderers");
|
171267
171283
|
var getSelectRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171351,7 +171367,7 @@ ${space(2)}${dim("...")}` : ""}`,
|
|
171351
171367
|
options29.find((o2) => o2.value === value)?.label
|
171352
171368
|
);
|
171353
171369
|
},
|
171354
|
-
cancel:
|
171370
|
+
cancel: defaultRenderer
|
171355
171371
|
};
|
171356
171372
|
}, "getSelectRenderers");
|
171357
171373
|
var getSelectListRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171446,7 +171462,7 @@ var getSelectListRenderers = /* @__PURE__ */ __name((config) => {
|
|
171446
171462
|
options29.find((o2) => o2.value === value)?.value
|
171447
171463
|
);
|
171448
171464
|
},
|
171449
|
-
cancel:
|
171465
|
+
cancel: defaultRenderer
|
171450
171466
|
};
|
171451
171467
|
}, "getSelectListRenderers");
|
171452
171468
|
var getConfirmRenderers = /* @__PURE__ */ __name((config) => {
|
@@ -171468,7 +171484,7 @@ var getConfirmRenderers = /* @__PURE__ */ __name((config) => {
|
|
171468
171484
|
confirm: defaultRenderer,
|
171469
171485
|
error: defaultRenderer,
|
171470
171486
|
submit: ({ value }) => renderSubmit(config, value ? "yes" : "no"),
|
171471
|
-
cancel:
|
171487
|
+
cancel: defaultRenderer
|
171472
171488
|
};
|
171473
171489
|
}, "getConfirmRenderers");
|
171474
171490
|
var spinnerFrames = {
|
@@ -171553,7 +171569,7 @@ var isInteractive2 = /* @__PURE__ */ __name(() => {
|
|
171553
171569
|
init_import_meta_url();
|
171554
171570
|
var import_node_crypto6 = require("node:crypto");
|
171555
171571
|
var import_node_fs14 = require("node:fs");
|
171556
|
-
var
|
171572
|
+
var import_node_path22 = require("node:path");
|
171557
171573
|
function writeOutput(entry) {
|
171558
171574
|
if (outputFilePath === void 0) {
|
171559
171575
|
outputFilePath = getOutputFilePath();
|
@@ -171577,7 +171593,7 @@ function getOutputFilePath() {
|
|
171577
171593
|
const outputFileDirectoryFromEnv = getOutputFileDirectoryFromEnv();
|
171578
171594
|
if (outputFileDirectoryFromEnv) {
|
171579
171595
|
const date = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replace(".", "_").replace("T", "_").replace("Z", "");
|
171580
|
-
return (0,
|
171596
|
+
return (0, import_node_path22.resolve)(
|
171581
171597
|
outputFileDirectoryFromEnv,
|
171582
171598
|
`wrangler-output-${date}-${(0, import_node_crypto6.randomBytes)(3).toString("hex")}.json`
|
171583
171599
|
);
|
@@ -172368,7 +172384,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172368
172384
|
);
|
172369
172385
|
if (props.outDir) {
|
172370
172386
|
(0, import_node_fs15.mkdirSync)(props.outDir, { recursive: true });
|
172371
|
-
const readmePath =
|
172387
|
+
const readmePath = import_node_path23.default.join(props.outDir, "README.md");
|
172372
172388
|
(0, import_node_fs15.writeFileSync)(
|
172373
172389
|
readmePath,
|
172374
172390
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
@@ -172415,11 +172431,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172415
172431
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
172416
172432
|
(0, import_node_fs15.mkdirSync)(destinationDir, { recursive: true });
|
172417
172433
|
(0, import_node_fs15.writeFileSync)(
|
172418
|
-
|
172434
|
+
import_node_path23.default.join(destinationDir, import_node_path23.default.basename(props.entry.file)),
|
172419
172435
|
(0, import_node_fs15.readFileSync)(props.entry.file, "utf-8")
|
172420
172436
|
);
|
172421
172437
|
}
|
172422
|
-
const entryDirectory =
|
172438
|
+
const entryDirectory = import_node_path23.default.dirname(props.entry.file);
|
172423
172439
|
const moduleCollector = createModuleCollector({
|
172424
172440
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
172425
172441
|
entryDirectory,
|
@@ -172475,7 +172491,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172475
172491
|
}
|
172476
172492
|
);
|
172477
172493
|
for (const module3 of modules) {
|
172478
|
-
const modulePath = module3.filePath === void 0 ? module3.name :
|
172494
|
+
const modulePath = module3.filePath === void 0 ? module3.name : import_node_path23.default.relative("", module3.filePath);
|
172479
172495
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
172480
172496
|
dependencies[modulePath] = { bytesInOutput };
|
172481
172497
|
}
|
@@ -172552,7 +172568,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172552
172568
|
});
|
172553
172569
|
}
|
172554
172570
|
const placement = config.placement?.mode === "smart" ? { mode: "smart", hint: config.placement.hint } : void 0;
|
172555
|
-
const entryPointName =
|
172571
|
+
const entryPointName = import_node_path23.default.basename(resolvedEntryPointPath);
|
172556
172572
|
const main2 = {
|
172557
172573
|
name: entryPointName,
|
172558
172574
|
filePath: resolvedEntryPointPath,
|
@@ -172587,7 +172603,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
172587
172603
|
0
|
172588
172604
|
);
|
172589
172605
|
await printBundleSize(
|
172590
|
-
{ name:
|
172606
|
+
{ name: import_node_path23.default.basename(resolvedEntryPointPath), content },
|
172591
172607
|
modules
|
172592
172608
|
);
|
172593
172609
|
const withoutStaticAssets = {
|
@@ -172991,17 +173007,17 @@ __name(noBundleWorker, "noBundleWorker");
|
|
172991
173007
|
|
172992
173008
|
// src/deployment-bundle/entry.ts
|
172993
173009
|
init_import_meta_url();
|
172994
|
-
var
|
173010
|
+
var import_node_path28 = __toESM(require("node:path"));
|
172995
173011
|
|
172996
173012
|
// src/deployment-bundle/guess-worker-format.ts
|
172997
173013
|
init_import_meta_url();
|
172998
|
-
var
|
173014
|
+
var import_node_path24 = __toESM(require("node:path"));
|
172999
173015
|
var esbuild2 = __toESM(require("esbuild"));
|
173000
173016
|
async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfig) {
|
173001
|
-
const parsedEntryPath =
|
173017
|
+
const parsedEntryPath = import_node_path24.default.parse(entryFile);
|
173002
173018
|
if (parsedEntryPath.ext == ".py") {
|
173003
173019
|
logger.warn(
|
173004
|
-
`The entrypoint ${
|
173020
|
+
`The entrypoint ${import_node_path24.default.relative(
|
173005
173021
|
process.cwd(),
|
173006
173022
|
entryFile
|
173007
173023
|
)} defines a Python worker, support for Python workers is currently experimental. Python workers with a requirements.txt file can only be run locally and cannot be deployed.`
|
@@ -173025,7 +173041,7 @@ async function guessWorkerFormat(entryFile, entryWorkingDirectory, hint, tsconfi
|
|
173025
173041
|
guessedWorkerFormat = "modules";
|
173026
173042
|
} else {
|
173027
173043
|
logger.warn(
|
173028
|
-
`The entrypoint ${
|
173044
|
+
`The entrypoint ${import_node_path24.default.relative(
|
173029
173045
|
process.cwd(),
|
173030
173046
|
entryFile
|
173031
173047
|
)} has exports like an ES Module, but hasn't defined a default export like a module worker normally would. Building the worker using "service-worker" format...`
|
@@ -173055,7 +173071,7 @@ __name(guessWorkerFormat, "guessWorkerFormat");
|
|
173055
173071
|
// src/deployment-bundle/run-custom-build.ts
|
173056
173072
|
init_import_meta_url();
|
173057
173073
|
var import_node_fs16 = require("node:fs");
|
173058
|
-
var
|
173074
|
+
var import_node_path27 = __toESM(require("node:path"));
|
173059
173075
|
init_execa();
|
173060
173076
|
async function runCustomBuild(expectedEntryAbsolute, expectedEntryRelative, build5) {
|
173061
173077
|
if (build5.command) {
|
@@ -173118,8 +173134,8 @@ The provided entry-point path, "${relativeEntryPointPath}", points to a director
|
|
173118
173134
|
]) {
|
173119
173135
|
for (const extension of [".ts", ".tsx", ".js", ".jsx"]) {
|
173120
173136
|
const filePath = basenamePath + extension;
|
173121
|
-
if (fileExists(
|
173122
|
-
possiblePaths.push(
|
173137
|
+
if (fileExists(import_node_path27.default.resolve(absoluteEntryPointPath, filePath))) {
|
173138
|
+
possiblePaths.push(import_node_path27.default.join(relativeEntryPointPath, filePath));
|
173123
173139
|
}
|
173124
173140
|
}
|
173125
173141
|
}
|
@@ -173136,10 +173152,10 @@ Did you mean to set the main field to${possiblePaths.length > 1 ? " one of" : ""
|
|
173136
173152
|
__name(getMissingEntryPointMessage, "getMissingEntryPointMessage");
|
173137
173153
|
function fileExists(filePath) {
|
173138
173154
|
const SOURCE_FILE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx"];
|
173139
|
-
if (
|
173155
|
+
if (import_node_path27.default.extname(filePath) !== "") {
|
173140
173156
|
return (0, import_node_fs16.existsSync)(filePath);
|
173141
173157
|
}
|
173142
|
-
const base =
|
173158
|
+
const base = import_node_path27.default.join(import_node_path27.default.dirname(filePath), import_node_path27.default.basename(filePath));
|
173143
173159
|
for (const ext of SOURCE_FILE_EXTENSIONS) {
|
173144
173160
|
if ((0, import_node_fs16.existsSync)(base + ext)) {
|
173145
173161
|
return true;
|
@@ -173154,26 +173170,26 @@ async function getEntry(args, config, command2) {
|
|
173154
173170
|
let file;
|
173155
173171
|
let directory = process.cwd();
|
173156
173172
|
if (args.script) {
|
173157
|
-
file =
|
173173
|
+
file = import_node_path28.default.resolve(args.script);
|
173158
173174
|
} else if (config.main === void 0) {
|
173159
173175
|
if (config.site?.["entry-point"]) {
|
173160
|
-
directory =
|
173161
|
-
file =
|
173176
|
+
directory = import_node_path28.default.resolve(import_node_path28.default.dirname(config.configPath ?? "."));
|
173177
|
+
file = import_node_path28.default.extname(config.site?.["entry-point"]) ? import_node_path28.default.resolve(config.site?.["entry-point"]) : (
|
173162
173178
|
// site.entry-point could be a directory
|
173163
|
-
|
173179
|
+
import_node_path28.default.resolve(config.site?.["entry-point"], "index.js")
|
173164
173180
|
);
|
173165
173181
|
} else if (args.legacyAssets || config.legacy_assets || args.experimentalAssets || config.experimental_assets) {
|
173166
|
-
file =
|
173182
|
+
file = import_node_path28.default.resolve(getBasePath(), "templates/no-op-worker.js");
|
173167
173183
|
} else {
|
173168
173184
|
throw new UserError(
|
173169
173185
|
`Missing entry-point: The entry-point should be specified via the command line (e.g. \`wrangler ${command2} path/to/script\`) or the \`main\` config field.`
|
173170
173186
|
);
|
173171
173187
|
}
|
173172
173188
|
} else {
|
173173
|
-
directory =
|
173174
|
-
file =
|
173189
|
+
directory = import_node_path28.default.resolve(import_node_path28.default.dirname(config.configPath ?? "."));
|
173190
|
+
file = import_node_path28.default.resolve(directory, config.main);
|
173175
173191
|
}
|
173176
|
-
const relativeFile =
|
173192
|
+
const relativeFile = import_node_path28.default.relative(directory, file) || ".";
|
173177
173193
|
await runCustomBuild(file, relativeFile, config.build);
|
173178
173194
|
const format10 = await guessWorkerFormat(
|
173179
173195
|
file,
|
@@ -173205,7 +173221,7 @@ ${migrateUrl}`
|
|
173205
173221
|
file,
|
173206
173222
|
directory,
|
173207
173223
|
format: format10,
|
173208
|
-
moduleRoot: args.moduleRoot ?? config.base_dir ??
|
173224
|
+
moduleRoot: args.moduleRoot ?? config.base_dir ?? import_node_path28.default.dirname(file),
|
173209
173225
|
name: config.name ?? "worker"
|
173210
173226
|
};
|
173211
173227
|
}
|
@@ -173244,7 +173260,7 @@ var import_node_fs17 = require("node:fs");
|
|
173244
173260
|
var import_promises10 = require("node:fs/promises");
|
173245
173261
|
var import_node_http2 = require("node:http");
|
173246
173262
|
var import_node_net = __toESM(require("node:net"));
|
173247
|
-
var
|
173263
|
+
var import_node_path29 = __toESM(require("node:path"));
|
173248
173264
|
var import_body_parser = __toESM(require_body_parser());
|
173249
173265
|
var import_chokidar = require("chokidar");
|
173250
173266
|
|
@@ -173317,7 +173333,7 @@ if (Number.isNaN(DEV_REGISTRY_PORT)) {
|
|
173317
173333
|
DEV_REGISTRY_PORT = 6284;
|
173318
173334
|
}
|
173319
173335
|
var DEV_REGISTRY_HOST = `http://127.0.0.1:${DEV_REGISTRY_PORT}`;
|
173320
|
-
var DEV_REGISTRY_PATH =
|
173336
|
+
var DEV_REGISTRY_PATH = import_node_path29.default.join(getGlobalWranglerConfigPath(), "registry");
|
173321
173337
|
var globalServer;
|
173322
173338
|
var globalTerminator;
|
173323
173339
|
var globalWatcher;
|
@@ -173331,10 +173347,10 @@ async function loadWorkerDefinitions() {
|
|
173331
173347
|
for (const workerName of workerDefinitions) {
|
173332
173348
|
try {
|
173333
173349
|
const file = await (0, import_promises10.readFile)(
|
173334
|
-
|
173350
|
+
import_node_path29.default.join(DEV_REGISTRY_PATH, workerName),
|
173335
173351
|
"utf8"
|
173336
173352
|
);
|
173337
|
-
const stats = await (0, import_promises10.stat)(
|
173353
|
+
const stats = await (0, import_promises10.stat)(import_node_path29.default.join(DEV_REGISTRY_PATH, workerName));
|
173338
173354
|
if (stats.mtime < subMinutes(/* @__PURE__ */ new Date(), 10)) {
|
173339
173355
|
await unregisterWorker(workerName);
|
173340
173356
|
} else {
|
@@ -173442,7 +173458,7 @@ async function registerWorker(name, definition) {
|
|
173442
173458
|
}
|
173443
173459
|
await (0, import_promises10.mkdir)(DEV_REGISTRY_PATH, { recursive: true });
|
173444
173460
|
await (0, import_promises10.writeFile)(
|
173445
|
-
|
173461
|
+
import_node_path29.default.join(DEV_REGISTRY_PATH, name),
|
173446
173462
|
// We don't currently do anything with the stored Wrangler version,
|
173447
173463
|
// but if we need to make breaking changes to this format in the future
|
173448
173464
|
// we can use this field to present useful messaging
|
@@ -173451,7 +173467,7 @@ async function registerWorker(name, definition) {
|
|
173451
173467
|
heartbeats.set(
|
173452
173468
|
name,
|
173453
173469
|
setInterval(() => {
|
173454
|
-
(0, import_node_fs17.utimesSync)(
|
173470
|
+
(0, import_node_fs17.utimesSync)(import_node_path29.default.join(DEV_REGISTRY_PATH, name), /* @__PURE__ */ new Date(), /* @__PURE__ */ new Date());
|
173455
173471
|
}, 3e4)
|
173456
173472
|
);
|
173457
173473
|
return;
|
@@ -173479,7 +173495,7 @@ __name(registerWorker, "registerWorker");
|
|
173479
173495
|
async function unregisterWorker(name) {
|
173480
173496
|
if (getFlag("FILE_BASED_REGISTRY")) {
|
173481
173497
|
try {
|
173482
|
-
await (0, import_promises10.unlink)(
|
173498
|
+
await (0, import_promises10.unlink)(import_node_path29.default.join(DEV_REGISTRY_PATH, name));
|
173483
173499
|
const existingHeartbeat = heartbeats.get(name);
|
173484
173500
|
if (existingHeartbeat) {
|
173485
173501
|
clearInterval(existingHeartbeat);
|
@@ -173598,12 +173614,12 @@ var termux_default = clipboard;
|
|
173598
173614
|
|
173599
173615
|
// ../../node_modules/.pnpm/clipboardy@3.0.0/node_modules/clipboardy/lib/linux.js
|
173600
173616
|
init_import_meta_url();
|
173601
|
-
var
|
173617
|
+
var import_node_path30 = __toESM(require("node:path"), 1);
|
173602
173618
|
var import_node_url10 = require("node:url");
|
173603
173619
|
var import_execa3 = __toESM(require_execa(), 1);
|
173604
|
-
var __dirname3 =
|
173620
|
+
var __dirname3 = import_node_path30.default.dirname((0, import_node_url10.fileURLToPath)(import_meta_url));
|
173605
173621
|
var xsel = "xsel";
|
173606
|
-
var xselFallback =
|
173622
|
+
var xselFallback = import_node_path30.default.join(__dirname3, "../fallbacks/linux/xsel");
|
173607
173623
|
var copyArguments = ["--clipboard", "--input"];
|
173608
173624
|
var pasteArguments = ["--clipboard", "--output"];
|
173609
173625
|
var makeError2 = /* @__PURE__ */ __name((xselError, fallbackError) => {
|
@@ -173672,13 +173688,13 @@ var macos_default = clipboard3;
|
|
173672
173688
|
|
173673
173689
|
// ../../node_modules/.pnpm/clipboardy@3.0.0/node_modules/clipboardy/lib/windows.js
|
173674
173690
|
init_import_meta_url();
|
173675
|
-
var
|
173691
|
+
var import_node_path31 = __toESM(require("node:path"), 1);
|
173676
173692
|
var import_node_url11 = require("node:url");
|
173677
173693
|
var import_execa5 = __toESM(require_execa(), 1);
|
173678
173694
|
var import_arch = __toESM(require_arch(), 1);
|
173679
|
-
var __dirname4 =
|
173695
|
+
var __dirname4 = import_node_path31.default.dirname((0, import_node_url11.fileURLToPath)(import_meta_url));
|
173680
173696
|
var binarySuffix = (0, import_arch.default)() === "x64" ? "x86_64" : "i686";
|
173681
|
-
var windowBinaryPath =
|
173697
|
+
var windowBinaryPath = import_node_path31.default.join(__dirname4, `../fallbacks/windows/clipboard_${binarySuffix}.exe`);
|
173682
173698
|
var clipboard4 = {
|
173683
173699
|
copy: async (options29) => (0, import_execa5.default)(windowBinaryPath, ["--copy"], options29),
|
173684
173700
|
paste: async (options29) => {
|
@@ -173871,7 +173887,7 @@ var import_open2 = __toESM(require_open());
|
|
173871
173887
|
init_import_meta_url();
|
173872
173888
|
var import_node_assert14 = __toESM(require("node:assert"));
|
173873
173889
|
var import_node_fs18 = __toESM(require("node:fs"));
|
173874
|
-
var
|
173890
|
+
var import_node_path32 = __toESM(require("node:path"));
|
173875
173891
|
var import_node_url12 = require("node:url");
|
173876
173892
|
function isAllowedSourcePath(bundle, filePath) {
|
173877
173893
|
const allowed = getBundleReferencedPaths(bundle);
|
@@ -173903,7 +173919,7 @@ function getBundleReferencedPaths(bundle) {
|
|
173903
173919
|
const sourceRoot = sourceMap.sourceRoot ?? "";
|
173904
173920
|
for (const source of sourceMap.sources) {
|
173905
173921
|
const sourceURL = new URL(
|
173906
|
-
|
173922
|
+
import_node_path32.default.posix.join(sourceRoot, source),
|
173907
173923
|
sourceMappingURL
|
173908
173924
|
);
|
173909
173925
|
allowed.sourcePaths.add((0, import_node_url12.fileURLToPath)(sourceURL));
|
@@ -174322,7 +174338,7 @@ __name(useLocalWorker, "useLocalWorker");
|
|
174322
174338
|
// src/dev/remote.tsx
|
174323
174339
|
init_import_meta_url();
|
174324
174340
|
var import_node_assert17 = __toESM(require("node:assert"));
|
174325
|
-
var
|
174341
|
+
var import_node_path36 = __toESM(require("node:path"));
|
174326
174342
|
var import_ink2 = __toESM(require_build2());
|
174327
174343
|
var import_ink_select_input = __toESM(require_build4());
|
174328
174344
|
var import_react3 = __toESM(require_react());
|
@@ -175406,7 +175422,7 @@ async function createRemoteWorkerInit(props) {
|
|
175406
175422
|
);
|
175407
175423
|
void printBundleSize(
|
175408
175424
|
{
|
175409
|
-
name:
|
175425
|
+
name: import_node_path36.default.basename(props.bundle.path),
|
175410
175426
|
content
|
175411
175427
|
},
|
175412
175428
|
props.modules
|
@@ -175434,9 +175450,9 @@ async function createRemoteWorkerInit(props) {
|
|
175434
175450
|
const init3 = {
|
175435
175451
|
name: props.name,
|
175436
175452
|
main: {
|
175437
|
-
name:
|
175453
|
+
name: import_node_path36.default.basename(props.bundle.path),
|
175438
175454
|
filePath: props.bundle.path,
|
175439
|
-
type: getBundleType(props.format,
|
175455
|
+
type: getBundleType(props.format, import_node_path36.default.basename(props.bundle.path)),
|
175440
175456
|
content
|
175441
175457
|
},
|
175442
175458
|
modules,
|
@@ -175551,7 +175567,7 @@ __name(handleUserFriendlyError, "handleUserFriendlyError");
|
|
175551
175567
|
init_import_meta_url();
|
175552
175568
|
var import_node_assert18 = __toESM(require("node:assert"));
|
175553
175569
|
var import_node_fs20 = require("node:fs");
|
175554
|
-
var
|
175570
|
+
var import_node_path37 = __toESM(require("node:path"));
|
175555
175571
|
var import_chokidar3 = require("chokidar");
|
175556
175572
|
var import_ink3 = __toESM(require_build2());
|
175557
175573
|
var import_react4 = __toESM(require_react());
|
@@ -175582,7 +175598,7 @@ function runBuild({
|
|
175582
175598
|
defineNavigatorUserAgent
|
175583
175599
|
}, setBundle, onErr) {
|
175584
175600
|
let stopWatching = void 0;
|
175585
|
-
const entryDirectory =
|
175601
|
+
const entryDirectory = import_node_path37.default.dirname(entry.file);
|
175586
175602
|
const moduleCollector = noBundle ? noopModuleCollector : createModuleCollector({
|
175587
175603
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
175588
175604
|
entryDirectory,
|
@@ -175651,8 +175667,8 @@ function runBuild({
|
|
175651
175667
|
}) : void 0;
|
175652
175668
|
stopWatching = bundleResult?.stop;
|
175653
175669
|
if (noBundle) {
|
175654
|
-
const watching = [
|
175655
|
-
const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ?
|
175670
|
+
const watching = [import_node_path37.default.resolve(entry.moduleRoot)];
|
175671
|
+
const watchPythonRequirements = getBundleType(entry.format, entry.file) === "python" ? import_node_path37.default.resolve(entry.directory, "requirements.txt") : void 0;
|
175656
175672
|
if (watchPythonRequirements) {
|
175657
175673
|
watching.push(watchPythonRequirements);
|
175658
175674
|
}
|
@@ -180932,7 +180948,7 @@ __name(ApiError, "ApiError");
|
|
180932
180948
|
|
180933
180949
|
// src/cloudchamber/client/core/CancelablePromise.ts
|
180934
180950
|
init_import_meta_url();
|
180935
|
-
var
|
180951
|
+
var CancelError2 = class extends Error {
|
180936
180952
|
constructor(message) {
|
180937
180953
|
super(message);
|
180938
180954
|
this.name = "CancelError";
|
@@ -180941,7 +180957,7 @@ var CancelError = class extends Error {
|
|
180941
180957
|
return true;
|
180942
180958
|
}
|
180943
180959
|
};
|
180944
|
-
__name(
|
180960
|
+
__name(CancelError2, "CancelError");
|
180945
180961
|
var CancelablePromise = class {
|
180946
180962
|
#isResolved;
|
180947
180963
|
#isRejected;
|
@@ -181018,7 +181034,7 @@ var CancelablePromise = class {
|
|
181018
181034
|
}
|
181019
181035
|
}
|
181020
181036
|
this.#cancelHandlers.length = 0;
|
181021
|
-
this.#reject?.(new
|
181037
|
+
this.#reject?.(new CancelError2("Request aborted"));
|
181022
181038
|
}
|
181023
181039
|
get isCancelled() {
|
181024
181040
|
return this.#isCancelled;
|
@@ -187353,7 +187369,7 @@ var Handler5 = withConfig(
|
|
187353
187369
|
init_import_meta_url();
|
187354
187370
|
var import_fs9 = require("fs");
|
187355
187371
|
var import_node_assert19 = __toESM(require("node:assert"));
|
187356
|
-
var
|
187372
|
+
var import_node_path38 = __toESM(require("node:path"));
|
187357
187373
|
var import_ink7 = __toESM(require_build2());
|
187358
187374
|
var import_ink_table3 = __toESM(require_dist4());
|
187359
187375
|
var import_md5_file = __toESM(require_md5_file());
|
@@ -187681,7 +187697,7 @@ async function executeLocally({
|
|
187681
187697
|
}
|
187682
187698
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
187683
187699
|
const persistencePath = getLocalPersistencePath(persistTo, config.configPath);
|
187684
|
-
const d1Persist =
|
187700
|
+
const d1Persist = import_node_path38.default.join(persistencePath, "v3", "d1");
|
187685
187701
|
logger.log(
|
187686
187702
|
`\u{1F300} Executing on local database ${name} (${id}) from ${readableRelative(
|
187687
187703
|
d1Persist
|
@@ -187946,7 +187962,7 @@ __name(checkForSQLiteBinary, "checkForSQLiteBinary");
|
|
187946
187962
|
// src/d1/export.ts
|
187947
187963
|
init_import_meta_url();
|
187948
187964
|
var import_promises15 = __toESM(require("node:fs/promises"));
|
187949
|
-
var
|
187965
|
+
var import_node_path39 = __toESM(require("node:path"));
|
187950
187966
|
var import_miniflare14 = require("miniflare");
|
187951
187967
|
var import_undici15 = __toESM(require_undici());
|
187952
187968
|
function Options7(yargs) {
|
@@ -188010,7 +188026,7 @@ async function exportLocal(config, name, output, tables, noSchema, noData) {
|
|
188010
188026
|
}
|
188011
188027
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
188012
188028
|
const persistencePath = getLocalPersistencePath(void 0, config.configPath);
|
188013
|
-
const d1Persist =
|
188029
|
+
const d1Persist = import_node_path39.default.join(persistencePath, "v3", "d1");
|
188014
188030
|
logger.log(
|
188015
188031
|
`\u{1F300} Exporting local database ${name} (${id}) from ${readableRelative(
|
188016
188032
|
d1Persist
|
@@ -189341,7 +189357,7 @@ __name(checkAndConfirmForceDeleteIfNecessary, "checkAndConfirmForceDeleteIfNeces
|
|
189341
189357
|
// src/deploy/index.ts
|
189342
189358
|
init_import_meta_url();
|
189343
189359
|
var import_node_assert21 = __toESM(require("node:assert"));
|
189344
|
-
var
|
189360
|
+
var import_node_path40 = __toESM(require("node:path"));
|
189345
189361
|
|
189346
189362
|
// src/match-tag.ts
|
189347
189363
|
init_import_meta_url();
|
@@ -189576,8 +189592,8 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189576
189592
|
throw new UserError("Cannot use both --assets and --legacy-assets.");
|
189577
189593
|
}
|
189578
189594
|
args.legacyAssets = args.legacyAssets ?? args.assets;
|
189579
|
-
const configPath = args.config || args.script && findWranglerToml(
|
189580
|
-
const projectRoot = configPath &&
|
189595
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path40.default.dirname(args.script));
|
189596
|
+
const projectRoot = configPath && import_node_path40.default.dirname(configPath);
|
189581
189597
|
const config = readConfig(configPath, args);
|
189582
189598
|
const entry = await getEntry(args, config, "deploy");
|
189583
189599
|
if (args.public) {
|
@@ -189595,7 +189611,7 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189595
189611
|
"Cannot use Legacy Assets and Workers Sites in the same Worker."
|
189596
189612
|
);
|
189597
189613
|
}
|
189598
|
-
|
189614
|
+
validateAssetsArgsAndConfig(args, config);
|
189599
189615
|
const experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
189600
189616
|
if (args.latest) {
|
189601
189617
|
logger.warn(
|
@@ -189626,7 +189642,7 @@ Please shift to the --legacy-assets command to preserve the current functionalit
|
|
189626
189642
|
await verifyWorkerMatchesCITag(
|
189627
189643
|
accountId,
|
189628
189644
|
name,
|
189629
|
-
|
189645
|
+
import_node_path40.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
|
189630
189646
|
);
|
189631
189647
|
}
|
189632
189648
|
const { sourceMapSize, versionId, workerTag, targets } = await deploy({
|
@@ -189695,7 +189711,7 @@ var import_undici16 = __toESM(require_undici());
|
|
189695
189711
|
init_import_meta_url();
|
189696
189712
|
var fs20 = __toESM(require("node:fs"));
|
189697
189713
|
var import_promises16 = require("node:fs/promises");
|
189698
|
-
var
|
189714
|
+
var import_node_path43 = __toESM(require("node:path"));
|
189699
189715
|
var import_toml4 = __toESM(require_toml());
|
189700
189716
|
init_execa();
|
189701
189717
|
|
@@ -189703,7 +189719,7 @@ init_execa();
|
|
189703
189719
|
init_import_meta_url();
|
189704
189720
|
var import_node_fs24 = __toESM(require("node:fs"));
|
189705
189721
|
var import_node_os8 = __toESM(require("node:os"));
|
189706
|
-
var
|
189722
|
+
var import_node_path41 = __toESM(require("node:path"));
|
189707
189723
|
init_execa();
|
189708
189724
|
|
189709
189725
|
// ../../node_modules/.pnpm/semiver@1.1.0/node_modules/semiver/dist/semiver.mjs
|
@@ -189774,7 +189790,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189774
189790
|
args.push(remote.substring(0, tagIndex));
|
189775
189791
|
}
|
189776
189792
|
const tempDir = import_node_fs24.default.mkdtempSync(
|
189777
|
-
|
189793
|
+
import_node_path41.default.join(import_node_os8.default.tmpdir(), `wrangler-generate-repo-`)
|
189778
189794
|
);
|
189779
189795
|
args.push(tempDir);
|
189780
189796
|
await execa("git", args);
|
@@ -189783,7 +189799,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189783
189799
|
cwd: tempDir
|
189784
189800
|
});
|
189785
189801
|
}
|
189786
|
-
const templatePath = subdirectory !== void 0 ?
|
189802
|
+
const templatePath = subdirectory !== void 0 ? import_node_path41.default.join(tempDir, subdirectory) : tempDir;
|
189787
189803
|
try {
|
189788
189804
|
import_node_fs24.default.renameSync(templatePath, targetDirectory);
|
189789
189805
|
} catch (err) {
|
@@ -189802,7 +189818,7 @@ async function cloneIntoDirectory(remote, targetDirectory, subdirectory) {
|
|
189802
189818
|
throw new UserError(`Failed to find "${subdirectory}" in ${remote}`);
|
189803
189819
|
}
|
189804
189820
|
}
|
189805
|
-
import_node_fs24.default.rmSync(
|
189821
|
+
import_node_fs24.default.rmSync(import_node_path41.default.join(targetDirectory, ".git"), {
|
189806
189822
|
recursive: true,
|
189807
189823
|
force: true
|
189808
189824
|
});
|
@@ -189812,7 +189828,7 @@ __name(cloneIntoDirectory, "cloneIntoDirectory");
|
|
189812
189828
|
// src/package-manager.ts
|
189813
189829
|
init_import_meta_url();
|
189814
189830
|
var import_node_fs25 = require("node:fs");
|
189815
|
-
var
|
189831
|
+
var import_node_path42 = require("node:path");
|
189816
189832
|
var import_node_process11 = require("node:process");
|
189817
189833
|
init_execa();
|
189818
189834
|
async function getPackageManager2(cwd2) {
|
@@ -189821,9 +189837,9 @@ async function getPackageManager2(cwd2) {
|
|
189821
189837
|
supportsNpm(),
|
189822
189838
|
supportsPnpm()
|
189823
189839
|
]);
|
189824
|
-
const hasYarnLock = (0, import_node_fs25.existsSync)((0,
|
189825
|
-
const hasNpmLock = (0, import_node_fs25.existsSync)((0,
|
189826
|
-
const hasPnpmLock = (0, import_node_fs25.existsSync)((0,
|
189840
|
+
const hasYarnLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "yarn.lock"));
|
189841
|
+
const hasNpmLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "package-lock.json"));
|
189842
|
+
const hasPnpmLock = (0, import_node_fs25.existsSync)((0, import_node_path42.join)(cwd2, "pnpm-lock.yaml"));
|
189827
189843
|
const userAgent = sniffUserAgent();
|
189828
189844
|
if (hasNpmLock) {
|
189829
189845
|
if (hasNpm) {
|
@@ -190065,15 +190081,15 @@ async function initHandler(args) {
|
|
190065
190081
|
const instructions = [];
|
190066
190082
|
let shouldRunPackageManagerInstall = false;
|
190067
190083
|
const fromDashWorkerName = args.fromDash;
|
190068
|
-
const creationDirectory =
|
190084
|
+
const creationDirectory = import_node_path43.default.resolve(
|
190069
190085
|
process.cwd(),
|
190070
190086
|
(args.name ? args.name : fromDashWorkerName) ?? ""
|
190071
190087
|
);
|
190072
190088
|
assertNoTypeArg(args);
|
190073
190089
|
assertNoSiteArg(args, creationDirectory);
|
190074
|
-
const workerName =
|
190090
|
+
const workerName = import_node_path43.default.basename(creationDirectory).toLowerCase().replaceAll(/[^a-z0-9\-_]/gm, "-");
|
190075
190091
|
const packageManager = await getPackageManager2(creationDirectory);
|
190076
|
-
const wranglerTomlDestination =
|
190092
|
+
const wranglerTomlDestination = import_node_path43.default.join(
|
190077
190093
|
creationDirectory,
|
190078
190094
|
"./wrangler.toml"
|
190079
190095
|
);
|
@@ -190123,7 +190139,7 @@ The \`init\` command will be removed in a future version.`
|
|
190123
190139
|
if (fs20.existsSync(wranglerTomlDestination)) {
|
190124
190140
|
let shouldContinue = false;
|
190125
190141
|
logger.warn(
|
190126
|
-
`${
|
190142
|
+
`${import_node_path43.default.relative(process.cwd(), wranglerTomlDestination)} already exists!`
|
190127
190143
|
);
|
190128
190144
|
if (!fromDashWorkerName) {
|
190129
190145
|
shouldContinue = await confirm(
|
@@ -190175,12 +190191,12 @@ The \`init\` command will be removed in a future version.`
|
|
190175
190191
|
}) + "\n"
|
190176
190192
|
);
|
190177
190193
|
logger.log(
|
190178
|
-
`\u2728 Created ${
|
190194
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), wranglerTomlDestination)}`
|
190179
190195
|
);
|
190180
190196
|
justCreatedWranglerToml = true;
|
190181
190197
|
} catch (err) {
|
190182
190198
|
throw new Error(
|
190183
|
-
`Failed to create ${
|
190199
|
+
`Failed to create ${import_node_path43.default.relative(
|
190184
190200
|
process.cwd(),
|
190185
190201
|
wranglerTomlDestination
|
190186
190202
|
)}.
|
@@ -190193,11 +190209,11 @@ ${err.message ?? err}`
|
|
190193
190209
|
if (shouldInitGit) {
|
190194
190210
|
await initializeGit(creationDirectory);
|
190195
190211
|
await (0, import_promises16.writeFile)(
|
190196
|
-
|
190197
|
-
readFileSync5(
|
190212
|
+
import_node_path43.default.join(creationDirectory, ".gitignore"),
|
190213
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), "templates/gitignore"))
|
190198
190214
|
);
|
190199
190215
|
logger.log(
|
190200
|
-
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${
|
190216
|
+
args.name && args.name !== "." ? `\u2728 Initialized git repository at ${import_node_path43.default.relative(
|
190201
190217
|
process.cwd(),
|
190202
190218
|
creationDirectory
|
190203
190219
|
)}` : `\u2728 Initialized git repository`
|
@@ -190217,7 +190233,7 @@ ${err.message ?? err}`
|
|
190217
190233
|
shouldCreatePackageJson = yesFlag || await confirm("No package.json found. Would you like to create one?");
|
190218
190234
|
if (shouldCreatePackageJson) {
|
190219
190235
|
await (0, import_promises16.writeFile)(
|
190220
|
-
|
190236
|
+
import_node_path43.default.join(creationDirectory, "./package.json"),
|
190221
190237
|
JSON.stringify(
|
190222
190238
|
{
|
190223
190239
|
name: workerName,
|
@@ -190232,9 +190248,9 @@ ${err.message ?? err}`
|
|
190232
190248
|
) + "\n"
|
190233
190249
|
);
|
190234
190250
|
shouldRunPackageManagerInstall = true;
|
190235
|
-
pathToPackageJson =
|
190251
|
+
pathToPackageJson = import_node_path43.default.join(creationDirectory, "package.json");
|
190236
190252
|
logger.log(
|
190237
|
-
`\u2728 Created ${
|
190253
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), pathToPackageJson)}`
|
190238
190254
|
);
|
190239
190255
|
} else {
|
190240
190256
|
return;
|
@@ -190246,7 +190262,7 @@ ${err.message ?? err}`
|
|
190246
190262
|
);
|
190247
190263
|
if (!(packageJson.devDependencies?.wrangler || packageJson.dependencies?.wrangler)) {
|
190248
190264
|
const shouldInstall = yesFlag || await confirm(
|
190249
|
-
`Would you like to install wrangler into ${
|
190265
|
+
`Would you like to install wrangler into ${import_node_path43.default.relative(
|
190250
190266
|
process.cwd(),
|
190251
190267
|
pathToPackageJson
|
190252
190268
|
)}?`
|
@@ -190267,14 +190283,14 @@ ${err.message ?? err}`
|
|
190267
190283
|
if (yesFlag || await confirm("Would you like to use TypeScript?")) {
|
190268
190284
|
isTypescriptProject = true;
|
190269
190285
|
await (0, import_promises16.writeFile)(
|
190270
|
-
|
190271
|
-
readFileSync5(
|
190286
|
+
import_node_path43.default.join(creationDirectory, "./tsconfig.json"),
|
190287
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), "templates/tsconfig.init.json"))
|
190272
190288
|
);
|
190273
190289
|
devDepsToInstall.push("@cloudflare/workers-types");
|
190274
190290
|
devDepsToInstall.push("typescript");
|
190275
|
-
pathToTSConfig =
|
190291
|
+
pathToTSConfig = import_node_path43.default.join(creationDirectory, "tsconfig.json");
|
190276
190292
|
logger.log(
|
190277
|
-
`\u2728 Created ${
|
190293
|
+
`\u2728 Created ${import_node_path43.default.relative(process.cwd(), pathToTSConfig)}`
|
190278
190294
|
);
|
190279
190295
|
}
|
190280
190296
|
} else {
|
@@ -190290,7 +190306,7 @@ ${err.message ?? err}`
|
|
190290
190306
|
if (shouldInstall) {
|
190291
190307
|
devDepsToInstall.push("@cloudflare/workers-types");
|
190292
190308
|
instructions.push(
|
190293
|
-
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${
|
190309
|
+
`\u{1F6A8} Please add "@cloudflare/workers-types" to compilerOptions.types in ${import_node_path43.default.relative(
|
190294
190310
|
process.cwd(),
|
190295
190311
|
pathToTSConfig
|
190296
190312
|
)}`
|
@@ -190328,7 +190344,7 @@ ${err.message ?? err}`
|
|
190328
190344
|
};
|
190329
190345
|
fs20.writeFileSync(wranglerTomlDestination, import_toml4.default.stringify(newToml));
|
190330
190346
|
}
|
190331
|
-
const isNamedWorker = isCreatingWranglerToml &&
|
190347
|
+
const isNamedWorker = isCreatingWranglerToml && import_node_path43.default.dirname(packagePath) !== process.cwd();
|
190332
190348
|
const isAddingTestScripts = isAddingTests && !packageJsonContent.scripts?.test;
|
190333
190349
|
if (isWritingScripts) {
|
190334
190350
|
await (0, import_promises16.writeFile)(
|
@@ -190369,25 +190385,25 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190369
190385
|
}
|
190370
190386
|
__name(writePackageJsonScriptsAndUpdateWranglerToml, "writePackageJsonScriptsAndUpdateWranglerToml");
|
190371
190387
|
if (isTypescriptProject) {
|
190372
|
-
if (!fs20.existsSync(
|
190373
|
-
const newWorkerFilename =
|
190388
|
+
if (!fs20.existsSync(import_node_path43.default.join(creationDirectory, "./src/index.ts"))) {
|
190389
|
+
const newWorkerFilename = import_node_path43.default.relative(
|
190374
190390
|
process.cwd(),
|
190375
|
-
|
190391
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts")
|
190376
190392
|
);
|
190377
190393
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
190378
190394
|
if (newWorkerType !== "none") {
|
190379
190395
|
const template = getNewWorkerTemplate("ts", newWorkerType);
|
190380
|
-
await (0, import_promises16.mkdir)(
|
190396
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190381
190397
|
recursive: true
|
190382
190398
|
});
|
190383
190399
|
await (0, import_promises16.writeFile)(
|
190384
|
-
|
190385
|
-
readFileSync5(
|
190400
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts"),
|
190401
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), `templates/${template}`))
|
190386
190402
|
);
|
190387
190403
|
logger.log(
|
190388
|
-
`\u2728 Created ${
|
190404
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190389
190405
|
process.cwd(),
|
190390
|
-
|
190406
|
+
import_node_path43.default.join(creationDirectory, "./src/index.ts")
|
190391
190407
|
)}`
|
190392
190408
|
);
|
190393
190409
|
shouldCreateTests = yesFlag || await confirm(
|
@@ -190400,18 +190416,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190400
190416
|
newWorkerTestType = "vitest";
|
190401
190417
|
devDepsToInstall.push(newWorkerTestType);
|
190402
190418
|
await (0, import_promises16.writeFile)(
|
190403
|
-
|
190419
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.ts"),
|
190404
190420
|
readFileSync5(
|
190405
|
-
|
190421
|
+
import_node_path43.default.join(
|
190406
190422
|
getBasePath(),
|
190407
190423
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.ts`
|
190408
190424
|
)
|
190409
190425
|
)
|
190410
190426
|
);
|
190411
190427
|
logger.log(
|
190412
|
-
`\u2728 Created ${
|
190428
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190413
190429
|
process.cwd(),
|
190414
|
-
|
190430
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.ts")
|
190415
190431
|
)}`
|
190416
190432
|
);
|
190417
190433
|
}
|
@@ -190427,10 +190443,10 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190427
190443
|
}
|
190428
190444
|
}
|
190429
190445
|
} else {
|
190430
|
-
if (!fs20.existsSync(
|
190431
|
-
const newWorkerFilename =
|
190446
|
+
if (!fs20.existsSync(import_node_path43.default.join(creationDirectory, "./src/index.js"))) {
|
190447
|
+
const newWorkerFilename = import_node_path43.default.relative(
|
190432
190448
|
process.cwd(),
|
190433
|
-
|
190449
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js")
|
190434
190450
|
);
|
190435
190451
|
if (fromDashWorkerName) {
|
190436
190452
|
logger.warn(
|
@@ -190440,7 +190456,7 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190440
190456
|
accountId,
|
190441
190457
|
fromDashWorkerName
|
190442
190458
|
);
|
190443
|
-
await (0, import_promises16.mkdir)(
|
190459
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190444
190460
|
recursive: true
|
190445
190461
|
});
|
190446
190462
|
config.main = `src/${config.main}`;
|
@@ -190448,11 +190464,11 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190448
190464
|
for (const files of createBatches(modules, 10)) {
|
190449
190465
|
await Promise.all(
|
190450
190466
|
files.map(async (file) => {
|
190451
|
-
const filepath =
|
190467
|
+
const filepath = import_node_path43.default.join(
|
190452
190468
|
creationDirectory,
|
190453
190469
|
`./src/${file.name}`
|
190454
190470
|
);
|
190455
|
-
const directory = (0,
|
190471
|
+
const directory = (0, import_node_path43.dirname)(filepath);
|
190456
190472
|
await (0, import_promises16.mkdir)(directory, { recursive: true });
|
190457
190473
|
await (0, import_promises16.writeFile)(filepath, file.stream());
|
190458
190474
|
})
|
@@ -190470,17 +190486,17 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190470
190486
|
const newWorkerType = yesFlag ? "fetch" : await getNewWorkerType(newWorkerFilename);
|
190471
190487
|
if (newWorkerType !== "none") {
|
190472
190488
|
const template = getNewWorkerTemplate("js", newWorkerType);
|
190473
|
-
await (0, import_promises16.mkdir)(
|
190489
|
+
await (0, import_promises16.mkdir)(import_node_path43.default.join(creationDirectory, "./src"), {
|
190474
190490
|
recursive: true
|
190475
190491
|
});
|
190476
190492
|
await (0, import_promises16.writeFile)(
|
190477
|
-
|
190478
|
-
readFileSync5(
|
190493
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js"),
|
190494
|
+
readFileSync5(import_node_path43.default.join(getBasePath(), `templates/${template}`))
|
190479
190495
|
);
|
190480
190496
|
logger.log(
|
190481
|
-
`\u2728 Created ${
|
190497
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190482
190498
|
process.cwd(),
|
190483
|
-
|
190499
|
+
import_node_path43.default.join(creationDirectory, "./src/index.js")
|
190484
190500
|
)}`
|
190485
190501
|
);
|
190486
190502
|
shouldCreateTests = yesFlag || await confirm("Would you like us to write your first test?");
|
@@ -190488,18 +190504,18 @@ To start developing your Worker, run \`npx wrangler dev\`${isCreatingWranglerTom
|
|
190488
190504
|
newWorkerTestType = await getNewWorkerTestType(yesFlag);
|
190489
190505
|
devDepsToInstall.push(newWorkerTestType);
|
190490
190506
|
await (0, import_promises16.writeFile)(
|
190491
|
-
|
190507
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.js"),
|
190492
190508
|
readFileSync5(
|
190493
|
-
|
190509
|
+
import_node_path43.default.join(
|
190494
190510
|
getBasePath(),
|
190495
190511
|
`templates/init-tests/test-${newWorkerTestType}-new-worker.js`
|
190496
190512
|
)
|
190497
190513
|
)
|
190498
190514
|
);
|
190499
190515
|
logger.log(
|
190500
|
-
`\u2728 Created ${
|
190516
|
+
`\u2728 Created ${import_node_path43.default.relative(
|
190501
190517
|
process.cwd(),
|
190502
|
-
|
190518
|
+
import_node_path43.default.join(creationDirectory, "./src/index.test.js")
|
190503
190519
|
)}`
|
190504
190520
|
);
|
190505
190521
|
}
|
@@ -190612,7 +190628,7 @@ function getNewWorkerToml(workerType) {
|
|
190612
190628
|
__name(getNewWorkerToml, "getNewWorkerToml");
|
190613
190629
|
async function findPath(isolatedInit, cwd2, basename5) {
|
190614
190630
|
if (isolatedInit) {
|
190615
|
-
return fs20.existsSync(
|
190631
|
+
return fs20.existsSync(import_node_path43.default.resolve(cwd2, basename5)) ? import_node_path43.default.resolve(cwd2, basename5) : void 0;
|
190616
190632
|
} else {
|
190617
190633
|
return await findUp(basename5, {
|
190618
190634
|
cwd: cwd2
|
@@ -190857,14 +190873,90 @@ async function mapBindings(accountId, bindings) {
|
|
190857
190873
|
};
|
190858
190874
|
}
|
190859
190875
|
break;
|
190860
|
-
|
190861
|
-
|
190862
|
-
|
190876
|
+
case "secret_text":
|
190877
|
+
break;
|
190878
|
+
case "version_metadata": {
|
190879
|
+
{
|
190880
|
+
configObj.version_metadata = {
|
190881
|
+
binding: binding.name
|
190882
|
+
};
|
190863
190883
|
}
|
190884
|
+
break;
|
190885
|
+
}
|
190886
|
+
case "send_email": {
|
190887
|
+
configObj.send_email = [
|
190888
|
+
...configObj.send_email ?? [],
|
190889
|
+
{
|
190890
|
+
name: binding.name,
|
190891
|
+
destination_address: binding.destination_address,
|
190892
|
+
allowed_destination_addresses: binding.allowed_destination_addresses
|
190893
|
+
}
|
190894
|
+
];
|
190895
|
+
break;
|
190896
|
+
}
|
190897
|
+
case "queue":
|
190898
|
+
configObj.queues ??= { producers: [] };
|
190899
|
+
configObj.queues.producers = [
|
190900
|
+
...configObj.queues.producers ?? [],
|
190901
|
+
{
|
190902
|
+
binding: binding.name,
|
190903
|
+
queue: binding.queue_name,
|
190904
|
+
delivery_delay: binding.delivery_delay
|
190905
|
+
}
|
190906
|
+
];
|
190907
|
+
break;
|
190908
|
+
case "vectorize":
|
190909
|
+
configObj.vectorize = [
|
190910
|
+
...configObj.vectorize ?? [],
|
190911
|
+
{
|
190912
|
+
binding: binding.name,
|
190913
|
+
index_name: binding.index_name
|
190914
|
+
}
|
190915
|
+
];
|
190916
|
+
break;
|
190917
|
+
case "hyperdrive":
|
190918
|
+
configObj.hyperdrive = [
|
190919
|
+
...configObj.hyperdrive ?? [],
|
190920
|
+
{
|
190921
|
+
binding: binding.name,
|
190922
|
+
id: binding.id
|
190923
|
+
}
|
190924
|
+
];
|
190925
|
+
break;
|
190926
|
+
case "mtls_certificate":
|
190927
|
+
configObj.mtls_certificates = [
|
190928
|
+
...configObj.mtls_certificates ?? [],
|
190929
|
+
{
|
190930
|
+
binding: binding.name,
|
190931
|
+
certificate_id: binding.certificate_id
|
190932
|
+
}
|
190933
|
+
];
|
190934
|
+
break;
|
190935
|
+
case "pipelines":
|
190936
|
+
configObj.pipelines = [
|
190937
|
+
...configObj.pipelines ?? [],
|
190938
|
+
{
|
190939
|
+
binding: binding.name,
|
190940
|
+
pipeline: binding.id
|
190941
|
+
}
|
190942
|
+
];
|
190943
|
+
break;
|
190944
|
+
case "assets":
|
190945
|
+
throw new FatalError(
|
190946
|
+
"`wrangler init --from-dash` is not yet supported for Workers with Assets"
|
190947
|
+
);
|
190948
|
+
case "inherit":
|
190864
190949
|
configObj.unsafe = {
|
190865
190950
|
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
190866
190951
|
metadata: configObj.unsafe?.metadata ?? void 0
|
190867
190952
|
};
|
190953
|
+
break;
|
190954
|
+
default: {
|
190955
|
+
configObj.unsafe = {
|
190956
|
+
bindings: [...configObj.unsafe?.bindings ?? [], binding],
|
190957
|
+
metadata: configObj.unsafe?.metadata ?? void 0
|
190958
|
+
};
|
190959
|
+
assertNever(binding);
|
190868
190960
|
}
|
190869
190961
|
}
|
190870
190962
|
return configObj;
|
@@ -190883,7 +190975,7 @@ function assertNoTypeArg(args) {
|
|
190883
190975
|
__name(assertNoTypeArg, "assertNoTypeArg");
|
190884
190976
|
function assertNoSiteArg(args, creationDirectory) {
|
190885
190977
|
if (args.site) {
|
190886
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
190978
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path43.default.basename(creationDirectory) : "my-site";
|
190887
190979
|
const message = `The --site option is no longer supported.
|
190888
190980
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
190889
190981
|
|
@@ -191518,7 +191610,7 @@ __name(docsHandler, "docsHandler");
|
|
191518
191610
|
// src/generate/index.ts
|
191519
191611
|
init_import_meta_url();
|
191520
191612
|
var import_node_fs26 = __toESM(require("node:fs"));
|
191521
|
-
var
|
191613
|
+
var import_node_path44 = __toESM(require("node:path"));
|
191522
191614
|
init_execa();
|
191523
191615
|
function generateOptions(yargs) {
|
191524
191616
|
return yargs.positional("name", {
|
@@ -191578,7 +191670,7 @@ Please refer to https://developers.cloudflare.com/workers/wrangler/deprecations/
|
|
191578
191670
|
}
|
191579
191671
|
const creationDirectory = generateWorkerDirectoryName(args.name);
|
191580
191672
|
if (args.site) {
|
191581
|
-
const gitDirectory = creationDirectory !== process.cwd() ?
|
191673
|
+
const gitDirectory = creationDirectory !== process.cwd() ? import_node_path44.default.basename(creationDirectory) : "my-site";
|
191582
191674
|
const message = `The --site option is no longer supported.
|
191583
191675
|
If you wish to create a brand new Worker Sites project then clone the \`worker-sites-template\` starter repository:
|
191584
191676
|
|
@@ -191610,7 +191702,7 @@ Running \`npm create cloudflare@latest\` for you instead.
|
|
191610
191702
|
return;
|
191611
191703
|
}
|
191612
191704
|
logger.log(
|
191613
|
-
`Creating a worker in ${
|
191705
|
+
`Creating a worker in ${import_node_path44.default.basename(creationDirectory)} from ${args.template}`
|
191614
191706
|
);
|
191615
191707
|
const { remote, subdirectory } = parseTemplatePath(args.template);
|
191616
191708
|
await cloneIntoDirectory(remote, creationDirectory, subdirectory);
|
@@ -191619,10 +191711,10 @@ Running \`npm create cloudflare@latest\` for you instead.
|
|
191619
191711
|
}
|
191620
191712
|
__name(generateHandler2, "generateHandler");
|
191621
191713
|
function generateWorkerDirectoryName(workerName) {
|
191622
|
-
let workerDirectoryPath =
|
191714
|
+
let workerDirectoryPath = import_node_path44.default.resolve(process.cwd(), workerName);
|
191623
191715
|
let i = 1;
|
191624
191716
|
while (import_node_fs26.default.existsSync(workerDirectoryPath)) {
|
191625
|
-
workerDirectoryPath =
|
191717
|
+
workerDirectoryPath = import_node_path44.default.resolve(process.cwd(), `${workerName}-${i}`);
|
191626
191718
|
i++;
|
191627
191719
|
}
|
191628
191720
|
return workerDirectoryPath;
|
@@ -192917,12 +193009,12 @@ init_import_meta_url();
|
|
192917
193009
|
var import_node_crypto7 = require("node:crypto");
|
192918
193010
|
var import_node_fs29 = require("node:fs");
|
192919
193011
|
var import_promises21 = require("node:fs/promises");
|
192920
|
-
var
|
193012
|
+
var import_node_path53 = __toESM(require("node:path"));
|
192921
193013
|
|
192922
193014
|
// src/api/pages/create-worker-bundle-contents.ts
|
192923
193015
|
init_import_meta_url();
|
192924
193016
|
var import_node_fs27 = require("node:fs");
|
192925
|
-
var
|
193017
|
+
var import_node_path45 = __toESM(require("node:path"));
|
192926
193018
|
var import_undici18 = __toESM(require_undici());
|
192927
193019
|
async function createUploadWorkerBundleContents(workerBundle, config) {
|
192928
193020
|
const workerBundleFormData = createWorkerBundleFormData(workerBundle, config);
|
@@ -192936,7 +193028,7 @@ async function createUploadWorkerBundleContents(workerBundle, config) {
|
|
192936
193028
|
__name(createUploadWorkerBundleContents, "createUploadWorkerBundleContents");
|
192937
193029
|
function createWorkerBundleFormData(workerBundle, config) {
|
192938
193030
|
const mainModule = {
|
192939
|
-
name:
|
193031
|
+
name: import_node_path45.default.basename(workerBundle.resolvedEntryPointPath),
|
192940
193032
|
filePath: workerBundle.resolvedEntryPointPath,
|
192941
193033
|
content: (0, import_node_fs27.readFileSync)(workerBundle.resolvedEntryPointPath, {
|
192942
193034
|
encoding: "utf-8"
|
@@ -192997,16 +193089,16 @@ __name(createWorkerBundleFormData, "createWorkerBundleFormData");
|
|
192997
193089
|
// src/pages/buildFunctions.ts
|
192998
193090
|
init_import_meta_url();
|
192999
193091
|
var import_node_fs28 = require("node:fs");
|
193000
|
-
var
|
193092
|
+
var import_node_path52 = require("node:path");
|
193001
193093
|
|
193002
193094
|
// src/pages/functions/buildPlugin.ts
|
193003
193095
|
init_import_meta_url();
|
193004
193096
|
var import_promises18 = require("node:fs/promises");
|
193005
|
-
var
|
193097
|
+
var import_node_path48 = require("node:path");
|
193006
193098
|
|
193007
193099
|
// src/pages/utils.ts
|
193008
193100
|
init_import_meta_url();
|
193009
|
-
var
|
193101
|
+
var import_node_path46 = __toESM(require("node:path"));
|
193010
193102
|
var RUNNING_BUILDERS = [];
|
193011
193103
|
var CLEANUP_CALLBACKS = [];
|
193012
193104
|
var CLEANUP = /* @__PURE__ */ __name(() => {
|
@@ -193035,7 +193127,7 @@ function getPagesProjectRoot() {
|
|
193035
193127
|
return projectRootCache;
|
193036
193128
|
}
|
193037
193129
|
const packagePath = findUpSync("package.json");
|
193038
|
-
projectRootCache = packagePath ?
|
193130
|
+
projectRootCache = packagePath ? import_node_path46.default.dirname(packagePath) : process.cwd();
|
193039
193131
|
projectRootCacheCwd = cwd2;
|
193040
193132
|
return projectRootCache;
|
193041
193133
|
}
|
@@ -193067,7 +193159,7 @@ __name(debounce, "debounce");
|
|
193067
193159
|
// src/pages/functions/buildWorker.ts
|
193068
193160
|
init_import_meta_url();
|
193069
193161
|
var import_promises17 = require("node:fs/promises");
|
193070
|
-
var
|
193162
|
+
var import_node_path47 = require("node:path");
|
193071
193163
|
var import_esbuild3 = require("esbuild");
|
193072
193164
|
|
193073
193165
|
// ../../node_modules/.pnpm/nanoid@3.3.6/node_modules/nanoid/index.js
|
@@ -193105,7 +193197,7 @@ var nanoid = /* @__PURE__ */ __name((size = 21) => {
|
|
193105
193197
|
// src/pages/functions/buildWorker.ts
|
193106
193198
|
function buildWorkerFromFunctions({
|
193107
193199
|
routesModule,
|
193108
|
-
outfile = (0,
|
193200
|
+
outfile = (0, import_node_path47.join)(getPagesTmpDir(), `./functionsWorker-${Math.random()}.js`),
|
193109
193201
|
outdir,
|
193110
193202
|
minify = false,
|
193111
193203
|
sourcemap = false,
|
@@ -193121,7 +193213,7 @@ function buildWorkerFromFunctions({
|
|
193121
193213
|
external
|
193122
193214
|
}) {
|
193123
193215
|
const entry = {
|
193124
|
-
file: (0,
|
193216
|
+
file: (0, import_node_path47.resolve)(getBasePath(), "templates/pages-template-worker.ts"),
|
193125
193217
|
directory: functionsDirectory,
|
193126
193218
|
format: "modules",
|
193127
193219
|
moduleRoot: functionsDirectory
|
@@ -193130,7 +193222,7 @@ function buildWorkerFromFunctions({
|
|
193130
193222
|
entry,
|
193131
193223
|
findAdditionalModules: false
|
193132
193224
|
});
|
193133
|
-
return bundleWorker(entry, outdir ? (0,
|
193225
|
+
return bundleWorker(entry, outdir ? (0, import_node_path47.resolve)(outdir) : (0, import_node_path47.resolve)(outfile), {
|
193134
193226
|
bundle: true,
|
193135
193227
|
additionalModules: [],
|
193136
193228
|
moduleCollector,
|
@@ -193163,7 +193255,7 @@ function buildWorkerFromFunctions({
|
|
193163
193255
|
__name(buildWorkerFromFunctions, "buildWorkerFromFunctions");
|
193164
193256
|
function buildRawWorker({
|
193165
193257
|
workerScriptPath,
|
193166
|
-
outfile = (0,
|
193258
|
+
outfile = (0, import_node_path47.join)(getPagesTmpDir(), `./functionsWorker-${Math.random()}.js`),
|
193167
193259
|
outdir,
|
193168
193260
|
directory,
|
193169
193261
|
bundle = true,
|
@@ -193182,12 +193274,12 @@ function buildRawWorker({
|
|
193182
193274
|
}) {
|
193183
193275
|
const entry = {
|
193184
193276
|
file: workerScriptPath,
|
193185
|
-
directory: (0,
|
193277
|
+
directory: (0, import_node_path47.resolve)(directory),
|
193186
193278
|
format: "modules",
|
193187
|
-
moduleRoot: (0,
|
193279
|
+
moduleRoot: (0, import_node_path47.resolve)(directory)
|
193188
193280
|
};
|
193189
193281
|
const moduleCollector = externalModules ? noopModuleCollector : createModuleCollector({ entry, findAdditionalModules: false });
|
193190
|
-
return bundleWorker(entry, outdir ? (0,
|
193282
|
+
return bundleWorker(entry, outdir ? (0, import_node_path47.resolve)(outdir) : (0, import_node_path47.resolve)(outfile), {
|
193191
193283
|
bundle,
|
193192
193284
|
moduleCollector,
|
193193
193285
|
additionalModules,
|
@@ -193213,7 +193305,7 @@ function buildRawWorker({
|
|
193213
193305
|
setup(pluginBuild) {
|
193214
193306
|
pluginBuild.onResolve({ filter: /.*/ }, async (args) => {
|
193215
193307
|
if (externalModules.includes(
|
193216
|
-
(0,
|
193308
|
+
(0, import_node_path47.resolve)(args.resolveDir, args.path)
|
193217
193309
|
)) {
|
193218
193310
|
return { path: args.path, external: true };
|
193219
193311
|
}
|
@@ -193241,13 +193333,13 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193241
193333
|
defineNavigatorUserAgent,
|
193242
193334
|
sourceMaps
|
193243
193335
|
}) {
|
193244
|
-
const entrypoint = (0,
|
193336
|
+
const entrypoint = (0, import_node_path47.resolve)((0, import_node_path47.join)(workerJSDirectory, "index.js"));
|
193245
193337
|
const additionalModules = await findAdditionalModules(
|
193246
193338
|
{
|
193247
193339
|
file: entrypoint,
|
193248
|
-
directory: (0,
|
193340
|
+
directory: (0, import_node_path47.resolve)(workerJSDirectory),
|
193249
193341
|
format: "modules",
|
193250
|
-
moduleRoot: (0,
|
193342
|
+
moduleRoot: (0, import_node_path47.resolve)(workerJSDirectory)
|
193251
193343
|
},
|
193252
193344
|
[
|
193253
193345
|
{
|
@@ -193268,7 +193360,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193268
193360
|
sourceMapPath: void 0
|
193269
193361
|
};
|
193270
193362
|
}
|
193271
|
-
const outfile = (0,
|
193363
|
+
const outfile = (0, import_node_path47.join)(
|
193272
193364
|
getPagesTmpDir(),
|
193273
193365
|
`./bundledWorker-${Math.random()}.mjs`
|
193274
193366
|
);
|
@@ -193276,7 +193368,7 @@ async function produceWorkerBundleForWorkerJSDirectory({
|
|
193276
193368
|
workerScriptPath: entrypoint,
|
193277
193369
|
bundle: true,
|
193278
193370
|
externalModules: additionalModules.map(
|
193279
|
-
(m2) => (0,
|
193371
|
+
(m2) => (0, import_node_path47.join)(workerJSDirectory, m2.name)
|
193280
193372
|
),
|
193281
193373
|
outfile,
|
193282
193374
|
directory: buildOutputDirectory,
|
@@ -193360,7 +193452,7 @@ function assetsPlugin(buildOutputDirectory) {
|
|
193360
193452
|
setup(pluginBuild) {
|
193361
193453
|
const identifiers = /* @__PURE__ */ new Map();
|
193362
193454
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
193363
|
-
const directory = (0,
|
193455
|
+
const directory = (0, import_node_path47.resolve)(
|
193364
193456
|
args.resolveDir,
|
193365
193457
|
args.path.slice("assets:".length)
|
193366
193458
|
);
|
@@ -193388,7 +193480,7 @@ function assetsPlugin(buildOutputDirectory) {
|
|
193388
193480
|
async (args) => {
|
193389
193481
|
const identifier = identifiers.get(args.path);
|
193390
193482
|
if (buildOutputDirectory) {
|
193391
|
-
const staticAssetsOutputDirectory = (0,
|
193483
|
+
const staticAssetsOutputDirectory = (0, import_node_path47.join)(
|
193392
193484
|
buildOutputDirectory,
|
193393
193485
|
"cdn-cgi",
|
193394
193486
|
"pages-plugins",
|
@@ -193436,7 +193528,7 @@ function buildPluginFromFunctions({
|
|
193436
193528
|
external
|
193437
193529
|
}) {
|
193438
193530
|
const entry = {
|
193439
|
-
file: (0,
|
193531
|
+
file: (0, import_node_path48.resolve)(getBasePath(), "templates/pages-template-plugin.ts"),
|
193440
193532
|
directory: functionsDirectory,
|
193441
193533
|
format: "modules",
|
193442
193534
|
moduleRoot: functionsDirectory
|
@@ -193445,7 +193537,7 @@ function buildPluginFromFunctions({
|
|
193445
193537
|
entry,
|
193446
193538
|
findAdditionalModules: false
|
193447
193539
|
});
|
193448
|
-
return bundleWorker(entry, (0,
|
193540
|
+
return bundleWorker(entry, (0, import_node_path48.resolve)(outdir), {
|
193449
193541
|
bundle: true,
|
193450
193542
|
additionalModules: [],
|
193451
193543
|
moduleCollector,
|
@@ -193469,7 +193561,7 @@ function buildPluginFromFunctions({
|
|
193469
193561
|
name: "Assets",
|
193470
193562
|
setup(pluginBuild) {
|
193471
193563
|
pluginBuild.onResolve({ filter: /^assets:/ }, async (args) => {
|
193472
|
-
const directory = (0,
|
193564
|
+
const directory = (0, import_node_path48.resolve)(
|
193473
193565
|
args.resolveDir,
|
193474
193566
|
args.path.slice("assets:".length)
|
193475
193567
|
);
|
@@ -193484,7 +193576,7 @@ function buildPluginFromFunctions({
|
|
193484
193576
|
]
|
193485
193577
|
};
|
193486
193578
|
}
|
193487
|
-
const path74 = `assets:./${(0,
|
193579
|
+
const path74 = `assets:./${(0, import_node_path48.relative)(outdir, directory)}`;
|
193488
193580
|
return { path: path74, external: true, namespace: "assets" };
|
193489
193581
|
});
|
193490
193582
|
}
|
@@ -193497,9 +193589,9 @@ function buildPluginFromFunctions({
|
|
193497
193589
|
pluginBuild.onResolve({ filter: /.*\.(wasm|bin)$/ }, async (args) => {
|
193498
193590
|
return {
|
193499
193591
|
external: true,
|
193500
|
-
path: `./${(0,
|
193592
|
+
path: `./${(0, import_node_path48.relative)(
|
193501
193593
|
outdir,
|
193502
|
-
(0,
|
193594
|
+
(0, import_node_path48.resolve)(args.resolveDir, args.path)
|
193503
193595
|
)}`
|
193504
193596
|
};
|
193505
193597
|
});
|
@@ -193522,7 +193614,7 @@ __name(buildPluginFromFunctions, "buildPluginFromFunctions");
|
|
193522
193614
|
// src/pages/functions/filepath-routing.ts
|
193523
193615
|
init_import_meta_url();
|
193524
193616
|
var import_promises19 = __toESM(require("node:fs/promises"));
|
193525
|
-
var
|
193617
|
+
var import_node_path49 = __toESM(require("node:path"));
|
193526
193618
|
var import_esbuild4 = require("esbuild");
|
193527
193619
|
async function generateConfigFromFileTree({
|
193528
193620
|
baseDir,
|
@@ -193536,13 +193628,13 @@ async function generateConfigFromFileTree({
|
|
193536
193628
|
baseURL = baseURL.slice(0, -1);
|
193537
193629
|
}
|
193538
193630
|
await forEachFile(baseDir, async (filepath) => {
|
193539
|
-
const ext =
|
193631
|
+
const ext = import_node_path49.default.extname(filepath);
|
193540
193632
|
if (/^\.(mjs|js|ts|tsx|jsx)$/.test(ext)) {
|
193541
193633
|
const { metafile } = await (0, import_esbuild4.build)({
|
193542
193634
|
metafile: true,
|
193543
193635
|
write: false,
|
193544
193636
|
bundle: false,
|
193545
|
-
entryPoints: [
|
193637
|
+
entryPoints: [import_node_path49.default.resolve(filepath)]
|
193546
193638
|
}).catch((e3) => {
|
193547
193639
|
throw new FunctionsBuildError(e3.message);
|
193548
193640
|
});
|
@@ -193557,13 +193649,13 @@ async function generateConfigFromFileTree({
|
|
193557
193649
|
/^onRequest(Get|Post|Put|Patch|Delete|Options|Head)?$/
|
193558
193650
|
) ?? [];
|
193559
193651
|
if (match) {
|
193560
|
-
const basename5 =
|
193652
|
+
const basename5 = import_node_path49.default.basename(filepath).slice(0, -ext.length);
|
193561
193653
|
const isIndexFile = basename5 === "index";
|
193562
193654
|
const isMiddlewareFile = basename5 === "_middleware" || basename5 === "_middleware_";
|
193563
|
-
let routePath =
|
193564
|
-
let mountPath =
|
193655
|
+
let routePath = import_node_path49.default.relative(baseDir, filepath).slice(0, -ext.length);
|
193656
|
+
let mountPath = import_node_path49.default.dirname(routePath);
|
193565
193657
|
if (isIndexFile || isMiddlewareFile) {
|
193566
|
-
routePath =
|
193658
|
+
routePath = import_node_path49.default.dirname(routePath);
|
193567
193659
|
}
|
193568
193660
|
if (routePath === ".") {
|
193569
193661
|
routePath = "";
|
@@ -193577,7 +193669,7 @@ async function generateConfigFromFileTree({
|
|
193577
193669
|
routePath = convertSimpleParams(routePath);
|
193578
193670
|
mountPath = convertCatchallParams(mountPath);
|
193579
193671
|
mountPath = convertSimpleParams(mountPath);
|
193580
|
-
const modulePath = toUrlPath(
|
193672
|
+
const modulePath = toUrlPath(import_node_path49.default.relative(baseDir, filepath));
|
193581
193673
|
const routeEntry = {
|
193582
193674
|
routePath: toUrlPath(routePath),
|
193583
193675
|
mountPath: toUrlPath(mountPath),
|
@@ -193655,7 +193747,7 @@ async function forEachFile(baseDir, fn2) {
|
|
193655
193747
|
const cwd2 = searchPaths.shift();
|
193656
193748
|
const dir = await import_promises19.default.readdir(cwd2, { withFileTypes: true });
|
193657
193749
|
for (const entry of dir) {
|
193658
|
-
const pathname =
|
193750
|
+
const pathname = import_node_path49.default.join(cwd2, entry.name);
|
193659
193751
|
if (entry.isDirectory()) {
|
193660
193752
|
searchPaths.push(pathname);
|
193661
193753
|
} else if (entry.isFile()) {
|
@@ -193699,7 +193791,7 @@ __name(convertSimpleParams, "convertSimpleParams");
|
|
193699
193791
|
// src/pages/functions/routes.ts
|
193700
193792
|
init_import_meta_url();
|
193701
193793
|
var import_promises20 = __toESM(require("node:fs/promises"));
|
193702
|
-
var
|
193794
|
+
var import_node_path50 = __toESM(require("node:path"));
|
193703
193795
|
|
193704
193796
|
// src/pages/functions/identifiers.ts
|
193705
193797
|
init_import_meta_url();
|
@@ -193796,8 +193888,8 @@ function parseConfig(config, baseDir) {
|
|
193796
193888
|
return paths.map((modulePath) => {
|
193797
193889
|
const [filepath, name = "default"] = modulePath.split(":");
|
193798
193890
|
let { identifier } = importMap.get(modulePath) ?? {};
|
193799
|
-
const resolvedPath =
|
193800
|
-
if (
|
193891
|
+
const resolvedPath = import_node_path50.default.resolve(baseDir, filepath);
|
193892
|
+
if (import_node_path50.default.relative(baseDir, resolvedPath).startsWith("..")) {
|
193801
193893
|
throw new UserError(`Invalid module path "${filepath}"`);
|
193802
193894
|
}
|
193803
193895
|
if (name !== "default" && !isValidIdentifier(name)) {
|
@@ -193849,7 +193941,7 @@ __name(generateRoutesModule, "generateRoutesModule");
|
|
193849
193941
|
|
193850
193942
|
// src/pages/functions/routes-transformation.ts
|
193851
193943
|
init_import_meta_url();
|
193852
|
-
var
|
193944
|
+
var import_node_path51 = require("node:path");
|
193853
193945
|
|
193854
193946
|
// src/pages/functions/routes-consolidation.ts
|
193855
193947
|
init_import_meta_url();
|
@@ -193903,7 +193995,7 @@ function convertRoutesToGlobPatterns(routes) {
|
|
193903
193995
|
const globbedRoutePath = routePath.replace(/:\w+\*?.*/, "*");
|
193904
193996
|
if (typeof middleware === "string" || Array.isArray(middleware) && middleware.length > 0) {
|
193905
193997
|
if (!globbedRoutePath.endsWith("*")) {
|
193906
|
-
return toUrlPath((0,
|
193998
|
+
return toUrlPath((0, import_node_path51.join)(globbedRoutePath, "*"));
|
193907
193999
|
}
|
193908
194000
|
}
|
193909
194001
|
return toUrlPath(globbedRoutePath);
|
@@ -193973,7 +194065,7 @@ async function buildFunctions({
|
|
193973
194065
|
routesOutputPath,
|
193974
194066
|
nodejsCompatMode,
|
193975
194067
|
local,
|
193976
|
-
routesModule = (0,
|
194068
|
+
routesModule = (0, import_node_path52.join)(
|
193977
194069
|
getPagesTmpDir(),
|
193978
194070
|
`./functionsRoutes-${Math.random()}.mjs`
|
193979
194071
|
),
|
@@ -194008,7 +194100,7 @@ async function buildFunctions({
|
|
194008
194100
|
srcDir: functionsDirectory,
|
194009
194101
|
outfile: routesModule
|
194010
194102
|
});
|
194011
|
-
const absoluteFunctionsDirectory = (0,
|
194103
|
+
const absoluteFunctionsDirectory = (0, import_node_path52.resolve)(functionsDirectory);
|
194012
194104
|
let bundle;
|
194013
194105
|
if (plugin) {
|
194014
194106
|
if (outdir === void 0) {
|
@@ -194195,8 +194287,8 @@ var Handler10 = /* @__PURE__ */ __name(async (args) => {
|
|
194195
194287
|
if (outfile && outfile !== bundle.resolvedEntryPointPath) {
|
194196
194288
|
(0, import_node_fs29.writeFileSync)(
|
194197
194289
|
outfile,
|
194198
|
-
`export { default } from './${(0,
|
194199
|
-
(0,
|
194290
|
+
`export { default } from './${(0, import_node_path53.relative)(
|
194291
|
+
(0, import_node_path53.dirname)(outfile),
|
194200
194292
|
bundle.resolvedEntryPointPath
|
194201
194293
|
)}'`
|
194202
194294
|
);
|
@@ -194282,7 +194374,7 @@ var Handler10 = /* @__PURE__ */ __name(async (args) => {
|
|
194282
194374
|
bundle,
|
194283
194375
|
config
|
194284
194376
|
);
|
194285
|
-
(0, import_node_fs29.mkdirSync)((0,
|
194377
|
+
(0, import_node_fs29.mkdirSync)((0, import_node_path53.dirname)(outfile), { recursive: true });
|
194286
194378
|
(0, import_node_fs29.writeFileSync)(
|
194287
194379
|
outfile,
|
194288
194380
|
Buffer.from(await workerBundleContents.arrayBuffer())
|
@@ -194298,7 +194390,7 @@ async function maybeReadPagesConfig(args) {
|
|
194298
194390
|
if (!args.projectDirectory || !args.buildMetadataPath) {
|
194299
194391
|
return;
|
194300
194392
|
}
|
194301
|
-
const configPath =
|
194393
|
+
const configPath = import_node_path53.default.resolve(args.projectDirectory, "wrangler.toml");
|
194302
194394
|
if (!(0, import_node_fs29.existsSync)(configPath)) {
|
194303
194395
|
return void 0;
|
194304
194396
|
}
|
@@ -194337,7 +194429,7 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194337
194429
|
logger.warn(
|
194338
194430
|
"Creating a Pages Plugin with `--outfile` is now deprecated. Please use `--outdir` instead."
|
194339
194431
|
);
|
194340
|
-
args.outdir = (0,
|
194432
|
+
args.outdir = (0, import_node_path53.dirname)((0, import_node_path53.resolve)(args.outfile));
|
194341
194433
|
} else if (!args.outfile && !args.outdir) {
|
194342
194434
|
args.outfile ??= "_worker.js";
|
194343
194435
|
args.outdir = ".";
|
@@ -194361,14 +194453,14 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194361
194453
|
if (!args.outdir) {
|
194362
194454
|
args.outfile ??= "_worker.bundle";
|
194363
194455
|
}
|
194364
|
-
args.buildOutputDirectory ??= args.outfile ? (0,
|
194456
|
+
args.buildOutputDirectory ??= args.outfile ? (0, import_node_path53.dirname)(args.outfile) : ".";
|
194365
194457
|
}
|
194366
|
-
args.buildOutputDirectory = config?.pages_build_output_dir ?? (args.buildOutputDirectory ? (0,
|
194458
|
+
args.buildOutputDirectory = config?.pages_build_output_dir ?? (args.buildOutputDirectory ? (0, import_node_path53.resolve)(args.buildOutputDirectory) : void 0);
|
194367
194459
|
if (args.outdir) {
|
194368
|
-
args.outdir = (0,
|
194460
|
+
args.outdir = (0, import_node_path53.resolve)(args.outdir);
|
194369
194461
|
}
|
194370
194462
|
if (args.outfile) {
|
194371
|
-
args.outfile = (0,
|
194463
|
+
args.outfile = (0, import_node_path53.resolve)(args.outfile);
|
194372
194464
|
}
|
194373
194465
|
const { nodeCompat: node_compat, ...argsExceptNodeCompat } = args;
|
194374
194466
|
const nodejsCompatMode = getNodeCompatMode(args.compatibilityFlags ?? [], {
|
@@ -194381,7 +194473,7 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194381
194473
|
);
|
194382
194474
|
let workerScriptPath;
|
194383
194475
|
if (args.buildOutputDirectory) {
|
194384
|
-
const prospectiveWorkerScriptPath = (0,
|
194476
|
+
const prospectiveWorkerScriptPath = (0, import_node_path53.resolve)(
|
194385
194477
|
args.buildOutputDirectory,
|
194386
194478
|
"_worker.js"
|
194387
194479
|
);
|
@@ -194391,9 +194483,9 @@ var validateArgs = /* @__PURE__ */ __name(async (args) => {
|
|
194391
194483
|
} else if (!foundWorkerScript && !(0, import_node_fs29.existsSync)(args.directory)) {
|
194392
194484
|
throw new FatalError(
|
194393
194485
|
`Could not find anything to build.
|
194394
|
-
We first looked inside the build output directory (${(0,
|
194395
|
-
(0,
|
194396
|
-
)}), then looked for the Functions directory (${(0,
|
194486
|
+
We first looked inside the build output directory (${(0, import_node_path53.basename)(
|
194487
|
+
(0, import_node_path53.resolve)(args.buildOutputDirectory)
|
194488
|
+
)}), then looked for the Functions directory (${(0, import_node_path53.basename)(
|
194397
194489
|
args.directory
|
194398
194490
|
)}) but couldn't find anything to build.
|
194399
194491
|
\u27A4 If you are trying to build _worker.js, please make sure you provide the [--build-output-directory] containing your static files.
|
@@ -194404,7 +194496,7 @@ We first looked inside the build output directory (${(0, import_node_path52.base
|
|
194404
194496
|
} else if (!(0, import_node_fs29.existsSync)(args.directory)) {
|
194405
194497
|
throw new FatalError(
|
194406
194498
|
`Could not find anything to build.
|
194407
|
-
We looked for the Functions directory (${(0,
|
194499
|
+
We looked for the Functions directory (${(0, import_node_path53.basename)(
|
194408
194500
|
args.directory
|
194409
194501
|
)}) but couldn't find anything to build.
|
194410
194502
|
\u27A4 Please make sure [directory] points to the location of your Functions files.`,
|
@@ -194419,7 +194511,7 @@ We looked for the Functions directory (${(0, import_node_path52.basename)(
|
|
194419
194511
|
config,
|
194420
194512
|
buildMetadata: config && args.projectDirectory && config.pages_build_output_dir ? {
|
194421
194513
|
wrangler_config_hash: config.hash,
|
194422
|
-
build_output_directory:
|
194514
|
+
build_output_directory: import_node_path53.default.relative(
|
194423
194515
|
args.projectDirectory,
|
194424
194516
|
config.pages_build_output_dir
|
194425
194517
|
)
|
@@ -194430,7 +194522,7 @@ We looked for the Functions directory (${(0, import_node_path52.basename)(
|
|
194430
194522
|
// src/pages/build-env.ts
|
194431
194523
|
init_import_meta_url();
|
194432
194524
|
var import_node_fs30 = require("node:fs");
|
194433
|
-
var
|
194525
|
+
var import_node_path54 = __toESM(require("node:path"));
|
194434
194526
|
function Options11(yargs) {
|
194435
194527
|
return yargs.positional("projectDir", {
|
194436
194528
|
type: "string",
|
@@ -194453,7 +194545,7 @@ var Handler11 = /* @__PURE__ */ __name(async (args) => {
|
|
194453
194545
|
logger.log(
|
194454
194546
|
"Checking for configuration in a wrangler.toml configuration file (BETA)\n"
|
194455
194547
|
);
|
194456
|
-
const configPath =
|
194548
|
+
const configPath = import_node_path54.default.resolve(args.projectDir, "wrangler.toml");
|
194457
194549
|
if (!(0, import_node_fs30.existsSync)(configPath)) {
|
194458
194550
|
logger.debug("No wrangler.toml configuration file found. Exiting.");
|
194459
194551
|
process.exitCode = EXIT_CODE_NO_CONFIG_FOUND;
|
@@ -194484,7 +194576,7 @@ var Handler11 = /* @__PURE__ */ __name(async (args) => {
|
|
194484
194576
|
);
|
194485
194577
|
const buildConfiguration = {
|
194486
194578
|
vars: textVars,
|
194487
|
-
pages_build_output_dir:
|
194579
|
+
pages_build_output_dir: import_node_path54.default.relative(
|
194488
194580
|
args.projectDir,
|
194489
194581
|
config.pages_build_output_dir
|
194490
194582
|
)
|
@@ -194514,7 +194606,7 @@ init_import_meta_url();
|
|
194514
194606
|
var import_node_crypto8 = require("node:crypto");
|
194515
194607
|
var import_node_fs31 = require("node:fs");
|
194516
194608
|
var import_promises22 = require("node:fs/promises");
|
194517
|
-
var
|
194609
|
+
var import_node_path55 = __toESM(require("node:path"));
|
194518
194610
|
var import_node_process12 = require("node:process");
|
194519
194611
|
var import_undici19 = __toESM(require_undici());
|
194520
194612
|
async function deploy2({
|
@@ -194533,17 +194625,17 @@ async function deploy2({
|
|
194533
194625
|
}) {
|
194534
194626
|
let _headers, _redirects, _routesGenerated, _routesCustom, _workerJSIsDirectory = false, _workerJS;
|
194535
194627
|
bundle = bundle ?? true;
|
194536
|
-
const _workerPath = (0,
|
194628
|
+
const _workerPath = (0, import_node_path55.resolve)(directory, "_worker.js");
|
194537
194629
|
try {
|
194538
|
-
_headers = (0, import_node_fs31.readFileSync)((0,
|
194630
|
+
_headers = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_headers"), "utf-8");
|
194539
194631
|
} catch {
|
194540
194632
|
}
|
194541
194633
|
try {
|
194542
|
-
_redirects = (0, import_node_fs31.readFileSync)((0,
|
194634
|
+
_redirects = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_redirects"), "utf-8");
|
194543
194635
|
} catch {
|
194544
194636
|
}
|
194545
194637
|
try {
|
194546
|
-
_routesCustom = (0, import_node_fs31.readFileSync)((0,
|
194638
|
+
_routesCustom = (0, import_node_fs31.readFileSync)((0, import_node_path55.join)(directory, "_routes.json"), "utf-8");
|
194547
194639
|
} catch {
|
194548
194640
|
}
|
194549
194641
|
try {
|
@@ -194587,11 +194679,11 @@ async function deploy2({
|
|
194587
194679
|
);
|
194588
194680
|
let builtFunctions = void 0;
|
194589
194681
|
let workerBundle = void 0;
|
194590
|
-
const functionsDirectory = customFunctionsDirectory || (0,
|
194591
|
-
const routesOutputPath = !(0, import_node_fs31.existsSync)((0,
|
194682
|
+
const functionsDirectory = customFunctionsDirectory || (0, import_node_path55.join)((0, import_node_process12.cwd)(), "functions");
|
194683
|
+
const routesOutputPath = !(0, import_node_fs31.existsSync)((0, import_node_path55.join)(directory, "_routes.json")) ? (0, import_node_path55.join)(getPagesTmpDir(), `_routes-${Math.random()}.json`) : void 0;
|
194592
194684
|
let filepathRoutingConfig;
|
194593
194685
|
if (!_workerJS && (0, import_node_fs31.existsSync)(functionsDirectory)) {
|
194594
|
-
const outputConfigPath = (0,
|
194686
|
+
const outputConfigPath = (0, import_node_path55.join)(
|
194595
194687
|
getPagesTmpDir(),
|
194596
194688
|
`functions-filepath-routing-config-${Math.random()}.json`
|
194597
194689
|
);
|
@@ -194663,7 +194755,7 @@ async function deploy2({
|
|
194663
194755
|
}
|
194664
194756
|
if (config !== void 0 && config.configPath !== void 0 && config.pages_build_output_dir) {
|
194665
194757
|
const configHash = (0, import_node_crypto8.createHash)("sha256").update(await (0, import_promises22.readFile)(config.configPath)).digest("hex");
|
194666
|
-
const outputDir =
|
194758
|
+
const outputDir = import_node_path55.default.relative(
|
194667
194759
|
process.cwd(),
|
194668
194760
|
config.pages_build_output_dir
|
194669
194761
|
);
|
@@ -194681,7 +194773,7 @@ async function deploy2({
|
|
194681
194773
|
});
|
194682
194774
|
} else if (_workerJS) {
|
194683
194775
|
if (bundle) {
|
194684
|
-
const outfile = (0,
|
194776
|
+
const outfile = (0, import_node_path55.join)(
|
194685
194777
|
getPagesTmpDir(),
|
194686
194778
|
`./bundledWorker-${Math.random()}.mjs`
|
194687
194779
|
);
|
@@ -194722,7 +194814,7 @@ async function deploy2({
|
|
194722
194814
|
if (_routesCustom) {
|
194723
194815
|
try {
|
194724
194816
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
194725
|
-
validateRoutes(routesCustomJSON, (0,
|
194817
|
+
validateRoutes(routesCustomJSON, (0, import_node_path55.join)(directory, "_routes.json"));
|
194726
194818
|
formData.append(
|
194727
194819
|
"_routes.json",
|
194728
194820
|
new import_undici19.File([_routesCustom], "_routes.json")
|
@@ -194748,7 +194840,7 @@ async function deploy2({
|
|
194748
194840
|
if (_routesCustom) {
|
194749
194841
|
try {
|
194750
194842
|
const routesCustomJSON = JSON.parse(_routesCustom);
|
194751
|
-
validateRoutes(routesCustomJSON, (0,
|
194843
|
+
validateRoutes(routesCustomJSON, (0, import_node_path55.join)(directory, "_routes.json"));
|
194752
194844
|
formData.append(
|
194753
194845
|
"_routes.json",
|
194754
194846
|
new import_undici19.File([_routesCustom], "_routes.json")
|
@@ -196034,7 +196126,7 @@ __name(ListHandler4, "ListHandler");
|
|
196034
196126
|
init_import_meta_url();
|
196035
196127
|
var import_node_child_process6 = require("node:child_process");
|
196036
196128
|
var import_node_fs32 = require("node:fs");
|
196037
|
-
var
|
196129
|
+
var import_node_path56 = require("node:path");
|
196038
196130
|
var import_chokidar5 = require("chokidar");
|
196039
196131
|
var esbuild3 = __toESM(require("esbuild"));
|
196040
196132
|
|
@@ -196293,7 +196385,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196293
196385
|
return void 0;
|
196294
196386
|
}
|
196295
196387
|
} else {
|
196296
|
-
directory = (0,
|
196388
|
+
directory = (0, import_node_path56.resolve)(directory);
|
196297
196389
|
}
|
196298
196390
|
const {
|
196299
196391
|
compatibilityDate,
|
@@ -196317,7 +196409,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196317
196409
|
(promiseResolve) => scriptReadyResolve = promiseResolve
|
196318
196410
|
);
|
196319
196411
|
const singleWorkerScriptPath = args.scriptPath ?? DEFAULT_SCRIPT_PATH;
|
196320
|
-
const workerScriptPath = directory !== void 0 ? (0,
|
196412
|
+
const workerScriptPath = directory !== void 0 ? (0, import_node_path56.join)(directory, singleWorkerScriptPath) : (0, import_node_path56.resolve)(singleWorkerScriptPath);
|
196321
196413
|
const usingWorkerDirectory = (0, import_node_fs32.existsSync)(workerScriptPath) && (0, import_node_fs32.lstatSync)(workerScriptPath).isDirectory();
|
196322
196414
|
const usingWorkerScript = (0, import_node_fs32.existsSync)(workerScriptPath);
|
196323
196415
|
const enableBundling = args.bundle ?? !args.noBundle;
|
@@ -196379,15 +196471,15 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196379
196471
|
);
|
196380
196472
|
}, "runBuild");
|
196381
196473
|
if (enableBundling) {
|
196382
|
-
scriptPath3 = (0,
|
196474
|
+
scriptPath3 = (0, import_node_path56.join)(
|
196383
196475
|
getPagesTmpDir(),
|
196384
196476
|
`./bundledWorker-${Math.random()}.mjs`
|
196385
196477
|
);
|
196386
196478
|
runBuild2 = /* @__PURE__ */ __name(async () => {
|
196387
|
-
const workerScriptDirectory = (0,
|
196479
|
+
const workerScriptDirectory = (0, import_node_path56.dirname)(workerScriptPath);
|
196388
196480
|
let currentBundleDependencies = [];
|
196389
196481
|
const bundle = await buildRawWorker({
|
196390
|
-
workerScriptPath: usingWorkerDirectory ? (0,
|
196482
|
+
workerScriptPath: usingWorkerDirectory ? (0, import_node_path56.join)(workerScriptPath, "index.js") : workerScriptPath,
|
196391
196483
|
outfile: scriptPath3,
|
196392
196484
|
directory: directory ?? ".",
|
196393
196485
|
nodejsCompatMode,
|
@@ -196397,11 +196489,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196397
196489
|
onEnd: () => scriptReadyResolve(),
|
196398
196490
|
defineNavigatorUserAgent
|
196399
196491
|
});
|
196400
|
-
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0,
|
196401
|
-
(resolvedDep) => !resolvedDep.includes((0,
|
196492
|
+
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0, import_node_path56.resolve)(workerScriptDirectory, dep)).filter(
|
196493
|
+
(resolvedDep) => !resolvedDep.includes((0, import_node_path56.normalize)(singleWorkerScriptPath)) && !resolvedDep.includes((0, import_node_path56.normalize)("/.wrangler/")) && resolvedDep.includes((0, import_node_path56.resolve)(process.cwd()))
|
196402
196494
|
);
|
196403
196495
|
const bundleModules = bundle.modules.filter((module3) => !!module3.filePath).map(
|
196404
|
-
(module3) => (0,
|
196496
|
+
(module3) => (0, import_node_path56.resolve)(workerScriptDirectory, module3.filePath)
|
196405
196497
|
);
|
196406
196498
|
currentBundleDependencies = [...bundleDependencies, ...bundleModules];
|
196407
196499
|
if (watchedBundleDependencies.length) {
|
@@ -196433,11 +196525,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196433
196525
|
throw new FatalError(`Failed to build ${singleWorkerScriptPath}.`);
|
196434
196526
|
}
|
196435
196527
|
} else if (usingFunctions) {
|
196436
|
-
scriptPath3 = (0,
|
196528
|
+
scriptPath3 = (0, import_node_path56.join)(
|
196437
196529
|
getPagesTmpDir(),
|
196438
196530
|
`./functionsWorker-${Math.random()}.mjs`
|
196439
196531
|
);
|
196440
|
-
const routesModule = (0,
|
196532
|
+
const routesModule = (0, import_node_path56.join)(
|
196441
196533
|
getPagesTmpDir(),
|
196442
196534
|
`./functionsRoutes-${Math.random()}.mjs`
|
196443
196535
|
);
|
@@ -196462,11 +196554,11 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196462
196554
|
routesModule,
|
196463
196555
|
defineNavigatorUserAgent
|
196464
196556
|
});
|
196465
|
-
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0,
|
196466
|
-
(resolvedDep) => !resolvedDep.includes((0,
|
196557
|
+
const bundleDependencies = Object.keys(bundle.dependencies).map((dep) => (0, import_node_path56.resolve)(functionsDirectory, dep)).filter(
|
196558
|
+
(resolvedDep) => !resolvedDep.includes((0, import_node_path56.normalize)("/functions/")) && !resolvedDep.includes((0, import_node_path56.normalize)("/.wrangler/")) && resolvedDep.includes((0, import_node_path56.resolve)(process.cwd()))
|
196467
196559
|
);
|
196468
196560
|
const bundleModules = bundle.modules.filter((module3) => !!module3.filePath).map(
|
196469
|
-
(module3) => (0,
|
196561
|
+
(module3) => (0, import_node_path56.resolve)(functionsDirectory, module3.filePath)
|
196470
196562
|
);
|
196471
196563
|
currentBundleDependencies = [...bundleDependencies, ...bundleModules];
|
196472
196564
|
if (watchedBundleDependencies.length) {
|
@@ -196514,7 +196606,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196514
196606
|
if (!usingFunctions && !usingWorkerScript) {
|
196515
196607
|
scriptReadyResolve();
|
196516
196608
|
logger.log("No Functions. Shimming...");
|
196517
|
-
scriptPath3 = (0,
|
196609
|
+
scriptPath3 = (0, import_node_path56.resolve)(getBasePath(), "templates/pages-shim.ts");
|
196518
196610
|
}
|
196519
196611
|
await scriptReadyPromise;
|
196520
196612
|
if (scriptPath3 === "") {
|
@@ -196524,13 +196616,13 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196524
196616
|
}
|
196525
196617
|
let scriptEntrypoint = scriptPath3;
|
196526
196618
|
if (directory && (usingFunctions || usingWorkerScript || usingWorkerDirectory)) {
|
196527
|
-
const routesJSONPath = (0,
|
196619
|
+
const routesJSONPath = (0, import_node_path56.join)(directory, "_routes.json");
|
196528
196620
|
if ((0, import_node_fs32.existsSync)(routesJSONPath)) {
|
196529
196621
|
let routesJSONContents;
|
196530
196622
|
const runBuild2 = /* @__PURE__ */ __name(async (entrypointFile, outfile, routes) => {
|
196531
196623
|
await esbuild3.build({
|
196532
196624
|
entryPoints: [
|
196533
|
-
(0,
|
196625
|
+
(0, import_node_path56.resolve)(getBasePath(), "templates/pages-dev-pipeline.ts")
|
196534
196626
|
],
|
196535
196627
|
bundle: true,
|
196536
196628
|
sourcemap: true,
|
@@ -196538,7 +196630,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196538
196630
|
plugins: [
|
196539
196631
|
esbuildAliasExternalPlugin({
|
196540
196632
|
__ENTRY_POINT__: entrypointFile,
|
196541
|
-
"./pages-dev-util": (0,
|
196633
|
+
"./pages-dev-util": (0, import_node_path56.resolve)(
|
196542
196634
|
getBasePath(),
|
196543
196635
|
"templates/pages-dev-util.ts"
|
196544
196636
|
)
|
@@ -196553,7 +196645,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
196553
196645
|
try {
|
196554
196646
|
routesJSONContents = (0, import_node_fs32.readFileSync)(routesJSONPath, "utf-8");
|
196555
196647
|
validateRoutes(JSON.parse(routesJSONContents), directory);
|
196556
|
-
scriptEntrypoint = (0,
|
196648
|
+
scriptEntrypoint = (0, import_node_path56.join)(
|
196557
196649
|
getPagesTmpDir(),
|
196558
196650
|
`${Math.random().toString(36).slice(2)}.js`
|
196559
196651
|
);
|
@@ -197123,7 +197215,7 @@ var Handler15 = /* @__PURE__ */ __name(async ({ projectName, force }) => {
|
|
197123
197215
|
// src/pages/functions.ts
|
197124
197216
|
init_import_meta_url();
|
197125
197217
|
var import_node_fs33 = require("node:fs");
|
197126
|
-
var
|
197218
|
+
var import_node_path57 = __toESM(require("node:path"));
|
197127
197219
|
function OptimizeRoutesOptions(yargs) {
|
197128
197220
|
return yargs.options({
|
197129
197221
|
"routes-path": {
|
@@ -197145,7 +197237,7 @@ async function OptimizeRoutesHandler({
|
|
197145
197237
|
outputRoutesPath
|
197146
197238
|
}) {
|
197147
197239
|
let routesFileContents;
|
197148
|
-
const routesOutputDirectory =
|
197240
|
+
const routesOutputDirectory = import_node_path57.default.dirname(outputRoutesPath);
|
197149
197241
|
if (!(0, import_node_fs33.existsSync)(routesPath)) {
|
197150
197242
|
throw new FatalError(
|
197151
197243
|
`Oops! File ${routesPath} does not exist. Please make sure --routes-path is a valid file path (for example "/public/_routes.json").`,
|
@@ -197180,7 +197272,7 @@ __name(OptimizeRoutesHandler, "OptimizeRoutesHandler");
|
|
197180
197272
|
|
197181
197273
|
// src/pages/secret/index.ts
|
197182
197274
|
init_import_meta_url();
|
197183
|
-
var
|
197275
|
+
var import_node_path58 = __toESM(require("node:path"));
|
197184
197276
|
var import_node_readline2 = __toESM(require("node:readline"));
|
197185
197277
|
|
197186
197278
|
// src/utils/std.ts
|
@@ -197340,7 +197432,7 @@ var secret = /* @__PURE__ */ __name((secretYargs, subHelp) => {
|
|
197340
197432
|
);
|
197341
197433
|
let content;
|
197342
197434
|
if (args.json) {
|
197343
|
-
const jsonFilePath =
|
197435
|
+
const jsonFilePath = import_node_path58.default.resolve(args.json);
|
197344
197436
|
content = parseJSON(
|
197345
197437
|
readFileSync5(jsonFilePath),
|
197346
197438
|
jsonFilePath
|
@@ -200322,7 +200414,7 @@ __name(r22, "r2");
|
|
200322
200414
|
|
200323
200415
|
// src/secret/index.ts
|
200324
200416
|
init_import_meta_url();
|
200325
|
-
var
|
200417
|
+
var import_node_path59 = __toESM(require("node:path"));
|
200326
200418
|
var import_node_readline3 = __toESM(require("node:readline"));
|
200327
200419
|
var import_undici20 = __toESM(require_undici());
|
200328
200420
|
var VERSION_NOT_DEPLOYED_ERR_CODE = 10215;
|
@@ -200588,7 +200680,7 @@ var secretBulkHandler = /* @__PURE__ */ __name(async (secretBulkArgs) => {
|
|
200588
200680
|
);
|
200589
200681
|
let content;
|
200590
200682
|
if (secretBulkArgs.json) {
|
200591
|
-
const jsonFilePath =
|
200683
|
+
const jsonFilePath = import_node_path59.default.resolve(secretBulkArgs.json);
|
200592
200684
|
try {
|
200593
200685
|
content = parseJSON(
|
200594
200686
|
readFileSync5(jsonFilePath),
|
@@ -210056,7 +210148,7 @@ __name(triggersDeployHandler, "triggersDeployHandler");
|
|
210056
210148
|
// src/type-generation/index.ts
|
210057
210149
|
init_import_meta_url();
|
210058
210150
|
var fs25 = __toESM(require("node:fs"));
|
210059
|
-
var
|
210151
|
+
var import_node_path60 = require("node:path");
|
210060
210152
|
|
210061
210153
|
// src/type-generation/runtime/index.ts
|
210062
210154
|
init_import_meta_url();
|
@@ -210230,7 +210322,7 @@ async function typesHandler(args) {
|
|
210230
210322
|
config,
|
210231
210323
|
outFile: args.experimentalIncludeRuntime || void 0
|
210232
210324
|
});
|
210233
|
-
const tsconfigPath = config.tsconfig ?? (0,
|
210325
|
+
const tsconfigPath = config.tsconfig ?? (0, import_node_path60.join)((0, import_node_path60.dirname)(configPath), "tsconfig.json");
|
210234
210326
|
const tsconfigTypes = readTsconfigTypes(tsconfigPath);
|
210235
210327
|
const mode = getNodeCompatMode(config.compatibility_flags, {
|
210236
210328
|
validateConfig: false,
|
@@ -210291,8 +210383,8 @@ function constructTypeKey(key) {
|
|
210291
210383
|
}
|
210292
210384
|
__name(constructTypeKey, "constructTypeKey");
|
210293
210385
|
function generateImportSpecifier(from, to) {
|
210294
|
-
const relativePath = (0,
|
210295
|
-
const filename = (0,
|
210386
|
+
const relativePath = (0, import_node_path60.relative)((0, import_node_path60.dirname)(from), (0, import_node_path60.dirname)(to)).replace(/\\/g, "/");
|
210387
|
+
const filename = (0, import_node_path60.basename)(to, (0, import_node_path60.extname)(to));
|
210296
210388
|
if (!relativePath) {
|
210297
210389
|
return `./${filename}`;
|
210298
210390
|
} else if (relativePath.startsWith("..")) {
|
@@ -210320,7 +210412,7 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
210320
210412
|
const configContainsEntrypoint = config.main !== void 0 || !!config.site?.["entry-point"];
|
210321
210413
|
const entrypoint = configContainsEntrypoint ? await getEntry({}, config, "types") : void 0;
|
210322
210414
|
const entrypointFormat = entrypoint?.format ?? "modules";
|
210323
|
-
const fullOutputPath = (0,
|
210415
|
+
const fullOutputPath = (0, import_node_path60.resolve)(outputPath);
|
210324
210416
|
const userProvidedEnvInterface = envInterface !== "Env";
|
210325
210417
|
if (userProvidedEnvInterface && entrypointFormat === "service-worker") {
|
210326
210418
|
throw new Error(
|
@@ -210505,7 +210597,7 @@ function writeDTSFile({
|
|
210505
210597
|
try {
|
210506
210598
|
if (wranglerOverrideDTSPath !== void 0 && !fs25.readFileSync(wranglerOverrideDTSPath, "utf8").includes("Generated by Wrangler")) {
|
210507
210599
|
throw new UserError(
|
210508
|
-
`A non-wrangler ${(0,
|
210600
|
+
`A non-wrangler ${(0, import_node_path60.basename)(path74)} already exists, please rename and try again.`
|
210509
210601
|
);
|
210510
210602
|
}
|
210511
210603
|
} catch (error2) {
|
@@ -211589,7 +211681,7 @@ __name(vectorize, "vectorize");
|
|
211589
211681
|
// src/versions/index.ts
|
211590
211682
|
init_import_meta_url();
|
211591
211683
|
var import_node_assert23 = __toESM(require("node:assert"));
|
211592
|
-
var
|
211684
|
+
var import_node_path63 = __toESM(require("node:path"));
|
211593
211685
|
|
211594
211686
|
// src/versions/list.ts
|
211595
211687
|
init_import_meta_url();
|
@@ -211692,7 +211784,7 @@ init_import_meta_url();
|
|
211692
211784
|
|
211693
211785
|
// src/versions/secrets/bulk.ts
|
211694
211786
|
init_import_meta_url();
|
211695
|
-
var
|
211787
|
+
var import_node_path61 = __toESM(require("node:path"));
|
211696
211788
|
var import_node_readline6 = __toESM(require("node:readline"));
|
211697
211789
|
function versionsSecretsPutBulkOptions(yargs) {
|
211698
211790
|
return yargs.positional("json", {
|
@@ -211728,7 +211820,7 @@ async function versionsSecretPutBulkHandler(args) {
|
|
211728
211820
|
);
|
211729
211821
|
let content;
|
211730
211822
|
if (args.json) {
|
211731
|
-
const jsonFilePath =
|
211823
|
+
const jsonFilePath = import_node_path61.default.resolve(args.json);
|
211732
211824
|
try {
|
211733
211825
|
content = parseJSON(
|
211734
211826
|
readFileSync5(jsonFilePath),
|
@@ -212189,7 +212281,7 @@ __name(parseModules, "parseModules");
|
|
212189
212281
|
// src/versions/upload.ts
|
212190
212282
|
init_import_meta_url();
|
212191
212283
|
var import_node_fs36 = require("node:fs");
|
212192
|
-
var
|
212284
|
+
var import_node_path62 = __toESM(require("node:path"));
|
212193
212285
|
var scriptStartupErrorRegex2 = /startup/i;
|
212194
212286
|
function errIsScriptSize2(err) {
|
212195
212287
|
if (!err) {
|
@@ -212286,7 +212378,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212286
212378
|
}
|
212287
212379
|
if (props.outDir) {
|
212288
212380
|
(0, import_node_fs36.mkdirSync)(props.outDir, { recursive: true });
|
212289
|
-
const readmePath =
|
212381
|
+
const readmePath = import_node_path62.default.join(props.outDir, "README.md");
|
212290
212382
|
(0, import_node_fs36.writeFileSync)(
|
212291
212383
|
readmePath,
|
212292
212384
|
`This folder contains the built output assets for the worker "${scriptName}" generated at ${(/* @__PURE__ */ new Date()).toISOString()}.`
|
@@ -212318,11 +212410,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212318
212410
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
212319
212411
|
(0, import_node_fs36.mkdirSync)(destinationDir, { recursive: true });
|
212320
212412
|
(0, import_node_fs36.writeFileSync)(
|
212321
|
-
|
212413
|
+
import_node_path62.default.join(destinationDir, import_node_path62.default.basename(props.entry.file)),
|
212322
212414
|
(0, import_node_fs36.readFileSync)(props.entry.file, "utf-8")
|
212323
212415
|
);
|
212324
212416
|
}
|
212325
|
-
const entryDirectory =
|
212417
|
+
const entryDirectory = import_node_path62.default.dirname(props.entry.file);
|
212326
212418
|
const moduleCollector = createModuleCollector({
|
212327
212419
|
wrangler1xLegacyModuleReferences: getWrangler1xLegacyModuleReferences(
|
212328
212420
|
entryDirectory,
|
@@ -212375,7 +212467,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212375
212467
|
}
|
212376
212468
|
);
|
212377
212469
|
for (const module3 of modules) {
|
212378
|
-
const modulePath = module3.filePath === void 0 ? module3.name :
|
212470
|
+
const modulePath = module3.filePath === void 0 ? module3.name : import_node_path62.default.relative("", module3.filePath);
|
212379
212471
|
const bytesInOutput = typeof module3.content === "string" ? Buffer.byteLength(module3.content) : module3.content.byteLength;
|
212380
212472
|
dependencies[modulePath] = { bytesInOutput };
|
212381
212473
|
}
|
@@ -212425,7 +212517,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212425
212517
|
}
|
212426
212518
|
};
|
212427
212519
|
const placement = config.placement?.mode === "smart" ? { mode: "smart", hint: config.placement.hint } : void 0;
|
212428
|
-
const entryPointName =
|
212520
|
+
const entryPointName = import_node_path62.default.basename(resolvedEntryPointPath);
|
212429
212521
|
const main2 = {
|
212430
212522
|
name: entryPointName,
|
212431
212523
|
filePath: resolvedEntryPointPath,
|
@@ -212462,7 +212554,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
212462
212554
|
observability: void 0
|
212463
212555
|
};
|
212464
212556
|
await printBundleSize(
|
212465
|
-
{ name:
|
212557
|
+
{ name: import_node_path62.default.basename(resolvedEntryPointPath), content },
|
212466
212558
|
modules
|
212467
212559
|
);
|
212468
212560
|
const withoutStaticAssets = {
|
@@ -212901,8 +212993,8 @@ function versionsUploadOptions(yargs) {
|
|
212901
212993
|
__name(versionsUploadOptions, "versionsUploadOptions");
|
212902
212994
|
async function versionsUploadHandler(args) {
|
212903
212995
|
await printWranglerBanner();
|
212904
|
-
const configPath = args.config || args.script && findWranglerToml(
|
212905
|
-
const projectRoot = configPath &&
|
212996
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path63.default.dirname(args.script));
|
212997
|
+
const projectRoot = configPath && import_node_path63.default.dirname(configPath);
|
212906
212998
|
const config = readConfig(configPath, args);
|
212907
212999
|
const entry = await getEntry(args, config, "versions upload");
|
212908
213000
|
await sendMetricsEvent(
|
@@ -212925,14 +213017,15 @@ async function versionsUploadHandler(args) {
|
|
212925
213017
|
"Legacy Assets does not support uploading versions through `wrangler versions upload`. You must use `wrangler deploy` instead."
|
212926
213018
|
);
|
212927
213019
|
}
|
212928
|
-
|
213020
|
+
validateAssetsArgsAndConfig(
|
212929
213021
|
{
|
212930
213022
|
// given that legacyAssets and sites are not supported by
|
212931
213023
|
// `wrangler versions upload` pass them as undefined to
|
212932
213024
|
// skip the corresponding mutual exclusivity validation
|
212933
213025
|
legacyAssets: void 0,
|
212934
213026
|
site: void 0,
|
212935
|
-
experimentalAssets: args.experimentalAssets
|
213027
|
+
experimentalAssets: args.experimentalAssets,
|
213028
|
+
script: args.script
|
212936
213029
|
},
|
212937
213030
|
config
|
212938
213031
|
);
|
@@ -212956,7 +213049,7 @@ async function versionsUploadHandler(args) {
|
|
212956
213049
|
await verifyWorkerMatchesCITag(
|
212957
213050
|
accountId,
|
212958
213051
|
name,
|
212959
|
-
|
213052
|
+
import_node_path63.default.relative(entry.directory, config.configPath ?? "wrangler.toml")
|
212960
213053
|
);
|
212961
213054
|
}
|
212962
213055
|
if (!args.dryRun) {
|
@@ -214512,7 +214605,7 @@ async function startDev(args) {
|
|
214512
214605
|
let assetsWatcher;
|
214513
214606
|
let rerender;
|
214514
214607
|
try {
|
214515
|
-
const configPath = args.config || args.script && findWranglerToml(
|
214608
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path64.default.dirname(args.script));
|
214516
214609
|
let config = readConfig(configPath, args);
|
214517
214610
|
if (args.logLevel) {
|
214518
214611
|
logger.loggerLevel = args.logLevel;
|
@@ -214554,12 +214647,12 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214554
214647
|
"Cannot use Experimental Assets in remote mode. Workers with assets are only supported in local mode. Please use `wrangler dev`."
|
214555
214648
|
);
|
214556
214649
|
}
|
214557
|
-
|
214650
|
+
validateAssetsArgsAndConfig(args, config);
|
214558
214651
|
let experimentalAssetsOptions = processExperimentalAssetsArg(args, config);
|
214559
214652
|
if (experimentalAssetsOptions) {
|
214560
214653
|
args.forceLocal = true;
|
214561
214654
|
}
|
214562
|
-
const projectRoot = configPath &&
|
214655
|
+
const projectRoot = configPath && import_node_path64.default.dirname(configPath);
|
214563
214656
|
const devEnv = new DevEnv();
|
214564
214657
|
if (args.experimentalDevEnv) {
|
214565
214658
|
void devEnv.proxy.ready.promise.then(({ url: url4 }) => {
|
@@ -214705,7 +214798,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214705
214798
|
configParam
|
214706
214799
|
);
|
214707
214800
|
return Boolean(args.site || configParam.site) && legacyAssetPaths ? {
|
214708
|
-
bucket:
|
214801
|
+
bucket: import_node_path64.default.join(
|
214709
214802
|
legacyAssetPaths.baseDirectory,
|
214710
214803
|
legacyAssetPaths?.assetDirectory
|
214711
214804
|
),
|
@@ -214747,7 +214840,7 @@ use --persist-to=./wrangler-local-state to keep using the old path.`
|
|
214747
214840
|
if (!config.configPath) {
|
214748
214841
|
return;
|
214749
214842
|
}
|
214750
|
-
logger.log(`${
|
214843
|
+
logger.log(`${import_node_path64.default.basename(config.configPath)} changed...`);
|
214751
214844
|
entry = await getEntry(
|
214752
214845
|
{
|
214753
214846
|
legacyAssets: args.legacyAssets,
|
@@ -214918,8 +215011,8 @@ async function startApiDev(args) {
|
|
214918
215011
|
if (args.logLevel) {
|
214919
215012
|
logger.loggerLevel = args.logLevel;
|
214920
215013
|
}
|
214921
|
-
const configPath = args.config || args.script && findWranglerToml(
|
214922
|
-
const projectRoot = configPath &&
|
215014
|
+
const configPath = args.config || args.script && findWranglerToml(import_node_path64.default.dirname(args.script));
|
215015
|
+
const projectRoot = configPath && import_node_path64.default.dirname(configPath);
|
214923
215016
|
const config = readConfig(configPath, args);
|
214924
215017
|
const {
|
214925
215018
|
entry,
|
@@ -215840,7 +215933,7 @@ __name(BundlerController, "BundlerController");
|
|
215840
215933
|
// src/api/startDevWorker/ConfigController.ts
|
215841
215934
|
init_import_meta_url();
|
215842
215935
|
var import_node_assert25 = __toESM(require("node:assert"));
|
215843
|
-
var
|
215936
|
+
var import_node_path65 = __toESM(require("node:path"));
|
215844
215937
|
var import_chokidar8 = require("chokidar");
|
215845
215938
|
var getInspectorPort = memoizeGetPort(DEFAULT_INSPECTOR_PORT, "127.0.0.1");
|
215846
215939
|
var getLocalPort = memoizeGetPort(DEFAULT_LOCAL_PORT, "localhost");
|
@@ -216073,7 +216166,7 @@ var ConfigController = class extends Controller {
|
|
216073
216166
|
persistent: true,
|
216074
216167
|
ignoreInitial: true
|
216075
216168
|
}).on("change", async (_event) => {
|
216076
|
-
logger.log(`${
|
216169
|
+
logger.log(`${import_node_path65.default.basename(configPath)} changed...`);
|
216077
216170
|
(0, import_node_assert25.default)(
|
216078
216171
|
this.latestInput,
|
216079
216172
|
"Cannot be watching config without having first set an input"
|
@@ -216397,19 +216490,19 @@ init_import_meta_url();
|
|
216397
216490
|
var import_node_assert26 = __toESM(require("node:assert"));
|
216398
216491
|
var import_node_crypto11 = require("node:crypto");
|
216399
216492
|
var import_node_events5 = __toESM(require("node:events"));
|
216400
|
-
var
|
216493
|
+
var import_node_path68 = __toESM(require("node:path"));
|
216401
216494
|
var import_miniflare20 = require("miniflare");
|
216402
216495
|
|
216403
216496
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/InspectorProxyWorker.ts
|
216404
216497
|
init_import_meta_url();
|
216405
|
-
var
|
216406
|
-
var scriptPath =
|
216498
|
+
var import_node_path66 = __toESM(require("node:path"));
|
216499
|
+
var scriptPath = import_node_path66.default.resolve(__dirname, "..", "wrangler-dist/InspectorProxyWorker.js");
|
216407
216500
|
var InspectorProxyWorker_default = scriptPath;
|
216408
216501
|
|
216409
216502
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/wrangler/templates/startDevWorker/ProxyWorker.ts
|
216410
216503
|
init_import_meta_url();
|
216411
|
-
var
|
216412
|
-
var scriptPath2 =
|
216504
|
+
var import_node_path67 = __toESM(require("node:path"));
|
216505
|
+
var scriptPath2 = import_node_path67.default.resolve(__dirname, "..", "wrangler-dist/ProxyWorker.js");
|
216413
216506
|
var ProxyWorker_default = scriptPath2;
|
216414
216507
|
|
216415
216508
|
// src/api/startDevWorker/ProxyController.ts
|
@@ -216441,7 +216534,7 @@ var ProxyController = class extends Controller {
|
|
216441
216534
|
name: "ProxyWorker",
|
216442
216535
|
compatibilityDate: "2023-12-18",
|
216443
216536
|
compatibilityFlags: ["nodejs_compat"],
|
216444
|
-
modulesRoot:
|
216537
|
+
modulesRoot: import_node_path68.default.dirname(ProxyWorker_default),
|
216445
216538
|
modules: [{ type: "ESModule", path: ProxyWorker_default }],
|
216446
216539
|
durableObjects: {
|
216447
216540
|
DURABLE_OBJECT: {
|
@@ -216470,7 +216563,7 @@ var ProxyController = class extends Controller {
|
|
216470
216563
|
"nodejs_compat",
|
216471
216564
|
"increase_websocket_message_size"
|
216472
216565
|
],
|
216473
|
-
modulesRoot:
|
216566
|
+
modulesRoot: import_node_path68.default.dirname(InspectorProxyWorker_default),
|
216474
216567
|
modules: [{ type: "ESModule", path: InspectorProxyWorker_default }],
|
216475
216568
|
durableObjects: {
|
216476
216569
|
DURABLE_OBJECT: {
|
@@ -218190,3 +218283,4 @@ yargs-parser/build/lib/index.js:
|
|
218190
218283
|
* SPDX-License-Identifier: ISC
|
218191
218284
|
*)
|
218192
218285
|
*/
|
218286
|
+
//# sourceMappingURL=cli.js.map
|