wrangler 3.60.2 → 3.60.3
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 +5 -5
- package/wrangler-dist/cli.js +297 -230
- package/wrangler-dist/cli.js.map +7 -0
package/wrangler-dist/cli.js
CHANGED
@@ -66506,7 +66506,7 @@ var require_path_parse = __commonJS({
|
|
66506
66506
|
"../../node_modules/.pnpm/path-parse@1.0.7/node_modules/path-parse/index.js"(exports2, module3) {
|
66507
66507
|
"use strict";
|
66508
66508
|
init_import_meta_url();
|
66509
|
-
var
|
66509
|
+
var isWindows3 = process.platform === "win32";
|
66510
66510
|
var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
|
66511
66511
|
var win32 = {};
|
66512
66512
|
function win32SplitPath(filename) {
|
@@ -66555,7 +66555,7 @@ var require_path_parse = __commonJS({
|
|
66555
66555
|
name: allParts[3]
|
66556
66556
|
};
|
66557
66557
|
};
|
66558
|
-
if (
|
66558
|
+
if (isWindows3)
|
66559
66559
|
module3.exports = win32.parse;
|
66560
66560
|
else
|
66561
66561
|
module3.exports = posix2.parse;
|
@@ -67830,22 +67830,22 @@ var require_isexe = __commonJS({
|
|
67830
67830
|
var require_which = __commonJS({
|
67831
67831
|
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports2, module3) {
|
67832
67832
|
init_import_meta_url();
|
67833
|
-
var
|
67833
|
+
var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
67834
67834
|
var path68 = require("path");
|
67835
|
-
var COLON =
|
67835
|
+
var COLON = isWindows3 ? ";" : ":";
|
67836
67836
|
var isexe = require_isexe();
|
67837
67837
|
var getNotFoundError = /* @__PURE__ */ __name((cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), "getNotFoundError");
|
67838
67838
|
var getPathInfo = /* @__PURE__ */ __name((cmd, opt) => {
|
67839
67839
|
const colon = opt.colon || COLON;
|
67840
|
-
const pathEnv = cmd.match(/\//) ||
|
67840
|
+
const pathEnv = cmd.match(/\//) || isWindows3 && cmd.match(/\\/) ? [""] : [
|
67841
67841
|
// windows always checks the cwd first
|
67842
|
-
...
|
67842
|
+
...isWindows3 ? [process.cwd()] : [],
|
67843
67843
|
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
67844
67844
|
"").split(colon)
|
67845
67845
|
];
|
67846
|
-
const pathExtExe =
|
67847
|
-
const pathExt =
|
67848
|
-
if (
|
67846
|
+
const pathExtExe = isWindows3 ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
67847
|
+
const pathExt = isWindows3 ? pathExtExe.split(colon) : [""];
|
67848
|
+
if (isWindows3) {
|
67849
67849
|
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
|
67850
67850
|
pathExt.unshift("");
|
67851
67851
|
}
|
@@ -144291,8 +144291,8 @@ var require_eventemitter3 = __commonJS({
|
|
144291
144291
|
var require_path = __commonJS({
|
144292
144292
|
"../../node_modules/.pnpm/minimatch@5.1.0/node_modules/minimatch/lib/path.js"(exports2, module3) {
|
144293
144293
|
init_import_meta_url();
|
144294
|
-
var
|
144295
|
-
module3.exports =
|
144294
|
+
var isWindows3 = typeof process === "object" && process && process.platform === "win32";
|
144295
|
+
module3.exports = isWindows3 ? { sep: "\\" } : { sep: "/" };
|
144296
144296
|
}
|
144297
144297
|
});
|
144298
144298
|
|
@@ -152685,7 +152685,7 @@ init_import_meta_url();
|
|
152685
152685
|
init_import_meta_url();
|
152686
152686
|
|
152687
152687
|
// package.json
|
152688
|
-
var version = "3.60.
|
152688
|
+
var version = "3.60.3";
|
152689
152689
|
var package_default = {
|
152690
152690
|
name: "wrangler",
|
152691
152691
|
version,
|
@@ -152884,11 +152884,12 @@ var package_default = {
|
|
152884
152884
|
};
|
152885
152885
|
|
152886
152886
|
// src/pages/constants.ts
|
152887
|
+
var isWindows = process.platform === "win32";
|
152887
152888
|
var MAX_ASSET_COUNT = 2e4;
|
152888
152889
|
var MAX_ASSET_SIZE = 25 * 1024 * 1024;
|
152889
152890
|
var PAGES_CONFIG_CACHE_FILENAME = "pages.json";
|
152890
152891
|
var MAX_BUCKET_SIZE = 40 * 1024 * 1024;
|
152891
|
-
var MAX_BUCKET_FILE_COUNT = 2e3;
|
152892
|
+
var MAX_BUCKET_FILE_COUNT = isWindows ? 1e3 : 2e3;
|
152892
152893
|
var BULK_UPLOAD_CONCURRENCY = 3;
|
152893
152894
|
var MAX_UPLOAD_ATTEMPTS = 5;
|
152894
152895
|
var MAX_UPLOAD_GATEWAY_ERRORS = 5;
|
@@ -159513,13 +159514,13 @@ function handleNodeJSGlobals(build5, inject) {
|
|
159513
159514
|
...Object.keys(inject).map(
|
159514
159515
|
(globalName) => import_node_path9.default.resolve(
|
159515
159516
|
getBasePath(),
|
159516
|
-
`_virtual_unenv_global_polyfill-${globalName}.js`
|
159517
|
+
`_virtual_unenv_global_polyfill-${encodeToLowerCase(globalName)}.js`
|
159517
159518
|
)
|
159518
159519
|
)
|
159519
159520
|
];
|
159520
159521
|
build5.onResolve({ filter: UNENV_GLOBALS_RE }, ({ path: path68 }) => ({ path: path68 }));
|
159521
159522
|
build5.onLoad({ filter: UNENV_GLOBALS_RE }, ({ path: path68 }) => {
|
159522
|
-
const globalName = path68.match(UNENV_GLOBALS_RE)[1];
|
159523
|
+
const globalName = decodeFromLowerCase(path68.match(UNENV_GLOBALS_RE)[1]);
|
159523
159524
|
const globalMapping = inject[globalName];
|
159524
159525
|
if (typeof globalMapping === "string") {
|
159525
159526
|
const globalPolyfillSpecifier = globalMapping;
|
@@ -159543,10 +159544,6 @@ function handleNodeJSGlobals(build5, inject) {
|
|
159543
159544
|
*/
|
159544
159545
|
""}
|
159545
159546
|
/* @__PURE__ */ (() => {
|
159546
|
-
${/*
|
159547
|
-
// TODO: should we try to preserve globalThis.${globalName} if it exists?
|
159548
|
-
*/
|
159549
|
-
""}
|
159550
159547
|
return globalThis.${globalName} = globalVar;
|
159551
159548
|
})();
|
159552
159549
|
|
@@ -159578,10 +159575,6 @@ function handleNodeJSGlobals(build5, inject) {
|
|
159578
159575
|
*/
|
159579
159576
|
""}
|
159580
159577
|
/* @__PURE__ */ (() => {
|
159581
|
-
${/*
|
159582
|
-
// TODO: should we try to preserve globalThis.${globalName} if it exists?
|
159583
|
-
*/
|
159584
|
-
""}
|
159585
159578
|
return globalThis.${globalName} = ${exportName};
|
159586
159579
|
})();
|
159587
159580
|
|
@@ -159595,6 +159588,17 @@ function handleNodeJSGlobals(build5, inject) {
|
|
159595
159588
|
});
|
159596
159589
|
}
|
159597
159590
|
__name(handleNodeJSGlobals, "handleNodeJSGlobals");
|
159591
|
+
function encodeToLowerCase(str) {
|
159592
|
+
return str.replaceAll(/[A-Z]/g, (letter) => `$${letter.toLowerCase()}`);
|
159593
|
+
}
|
159594
|
+
__name(encodeToLowerCase, "encodeToLowerCase");
|
159595
|
+
function decodeFromLowerCase(str) {
|
159596
|
+
return str.replaceAll(
|
159597
|
+
/\$([a-z])/g,
|
159598
|
+
(match, letter) => `${letter.toUpperCase()}`
|
159599
|
+
);
|
159600
|
+
}
|
159601
|
+
__name(decodeFromLowerCase, "decodeFromLowerCase");
|
159598
159602
|
|
159599
159603
|
// src/deployment-bundle/esbuild-plugins/nodejs-compat.ts
|
159600
159604
|
init_import_meta_url();
|
@@ -163112,11 +163116,184 @@ var import_node_fs32 = require("node:fs");
|
|
163112
163116
|
var import_node_path55 = __toESM(require("node:path"));
|
163113
163117
|
var import_node_url15 = require("node:url");
|
163114
163118
|
|
163119
|
+
// ../cli/index.ts
|
163120
|
+
init_import_meta_url();
|
163121
|
+
var import_process = require("process");
|
163122
|
+
|
163123
|
+
// ../cli/colors.ts
|
163124
|
+
init_import_meta_url();
|
163125
|
+
var import_chalk7 = __toESM(require_chalk());
|
163126
|
+
var { white, gray, dim, hidden, bold, cyanBright, bgCyan } = import_chalk7.default;
|
163127
|
+
var brandColor = import_chalk7.default.hex("#BD5B08");
|
163128
|
+
var black = import_chalk7.default.hex("#111");
|
163129
|
+
var blue = import_chalk7.default.hex("#0E838F");
|
163130
|
+
var bgBlue = black.bgHex("#0E838F");
|
163131
|
+
var red = import_chalk7.default.hex("#AB2526");
|
163132
|
+
var bgRed = black.bgHex("#AB2526");
|
163133
|
+
var green = import_chalk7.default.hex("#218529");
|
163134
|
+
var bgGreen = black.bgHex("#218529");
|
163135
|
+
var yellow = import_chalk7.default.hex("#7F7322");
|
163136
|
+
var bgYellow = black.bgHex("#7F7322");
|
163137
|
+
|
163138
|
+
// ../cli/streams.ts
|
163139
|
+
init_import_meta_url();
|
163140
|
+
var stdout = process.stdout;
|
163141
|
+
var stderr = process.stderr;
|
163142
|
+
|
163143
|
+
// ../cli/index.ts
|
163144
|
+
var shapes = {
|
163145
|
+
diamond: "\u25C7",
|
163146
|
+
dash: "\u2500",
|
163147
|
+
radioInactive: "\u25CB",
|
163148
|
+
radioActive: "\u25CF",
|
163149
|
+
bar: "\u2502",
|
163150
|
+
leftT: "\u251C",
|
163151
|
+
rigthT: "\u2524",
|
163152
|
+
arrows: {
|
163153
|
+
left: "\u2039",
|
163154
|
+
right: "\u203A"
|
163155
|
+
},
|
163156
|
+
corners: {
|
163157
|
+
tl: "\u256D",
|
163158
|
+
bl: "\u2570",
|
163159
|
+
tr: "\u256E",
|
163160
|
+
br: "\u256F"
|
163161
|
+
}
|
163162
|
+
};
|
163163
|
+
var status = {
|
163164
|
+
error: bgRed(` ERROR `),
|
163165
|
+
warning: bgYellow(` WARNING `),
|
163166
|
+
info: bgBlue(` INFO `),
|
163167
|
+
success: bgGreen(` SUCCESS `),
|
163168
|
+
cancel: white.bgRed(` X `)
|
163169
|
+
};
|
163170
|
+
var space = /* @__PURE__ */ __name((n2 = 1) => {
|
163171
|
+
return hidden("\u200A".repeat(n2));
|
163172
|
+
}, "space");
|
163173
|
+
var logRaw = /* @__PURE__ */ __name((msg) => {
|
163174
|
+
stdout.write(`${msg}
|
163175
|
+
`);
|
163176
|
+
}, "logRaw");
|
163177
|
+
var log = /* @__PURE__ */ __name((msg) => {
|
163178
|
+
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)} ${white(ln)}`);
|
163179
|
+
logRaw(lines.join("\n"));
|
163180
|
+
}, "log");
|
163181
|
+
var newline = /* @__PURE__ */ __name(() => {
|
163182
|
+
log("");
|
163183
|
+
}, "newline");
|
163184
|
+
var format5 = /* @__PURE__ */ __name((msg, {
|
163185
|
+
linePrefix = gray(shapes.bar),
|
163186
|
+
firstLinePrefix = linePrefix,
|
163187
|
+
newlineBefore = false,
|
163188
|
+
newlineAfter = false,
|
163189
|
+
formatLine = /* @__PURE__ */ __name((line) => white(line), "formatLine"),
|
163190
|
+
multiline = true
|
163191
|
+
} = {}) => {
|
163192
|
+
const lines = multiline ? msg.split("\n") : [msg];
|
163193
|
+
const formattedLines = lines.map(
|
163194
|
+
(line, i) => (i === 0 ? firstLinePrefix : linePrefix) + space() + formatLine(line)
|
163195
|
+
);
|
163196
|
+
if (newlineBefore) {
|
163197
|
+
formattedLines.unshift(linePrefix);
|
163198
|
+
}
|
163199
|
+
if (newlineAfter) {
|
163200
|
+
formattedLines.push(linePrefix);
|
163201
|
+
}
|
163202
|
+
return formattedLines.join("\n");
|
163203
|
+
}, "format");
|
163204
|
+
var updateStatus = /* @__PURE__ */ __name((msg, printNewLine = true) => {
|
163205
|
+
logRaw(
|
163206
|
+
format5(msg, {
|
163207
|
+
firstLinePrefix: gray(shapes.leftT),
|
163208
|
+
linePrefix: gray(shapes.bar),
|
163209
|
+
newlineAfter: printNewLine
|
163210
|
+
})
|
163211
|
+
);
|
163212
|
+
}, "updateStatus");
|
163213
|
+
var startSection = /* @__PURE__ */ __name((heading, subheading, printNewLine = true) => {
|
163214
|
+
logRaw(
|
163215
|
+
`${gray(shapes.corners.tl)} ${brandColor(heading)} ${subheading ? dim(subheading) : ""}`
|
163216
|
+
);
|
163217
|
+
if (printNewLine) {
|
163218
|
+
newline();
|
163219
|
+
}
|
163220
|
+
}, "startSection");
|
163221
|
+
var endSection = /* @__PURE__ */ __name((heading, subheading) => {
|
163222
|
+
logRaw(
|
163223
|
+
`${gray(shapes.corners.bl)} ${brandColor(heading)} ${subheading ? dim(subheading) : ""}
|
163224
|
+
`
|
163225
|
+
);
|
163226
|
+
}, "endSection");
|
163227
|
+
var cancel = /* @__PURE__ */ __name((msg, {
|
163228
|
+
// current default is backcompat and makes sense going forward too
|
163229
|
+
shape = shapes.corners.bl,
|
163230
|
+
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
163231
|
+
multiline = false
|
163232
|
+
} = {}) => {
|
163233
|
+
logRaw(
|
163234
|
+
format5(msg, {
|
163235
|
+
firstLinePrefix: `${gray(shape)} ${status.cancel}`,
|
163236
|
+
linePrefix: gray(shapes.bar),
|
163237
|
+
newlineBefore: true,
|
163238
|
+
formatLine: (line) => dim(line),
|
163239
|
+
// for backcompat but it's not ideal for this to be "dim"
|
163240
|
+
multiline
|
163241
|
+
})
|
163242
|
+
);
|
163243
|
+
}, "cancel");
|
163244
|
+
var warn = /* @__PURE__ */ __name((msg, {
|
163245
|
+
// current default for backcompat -- TODO: change default to shapes.bar once all callees have been updated
|
163246
|
+
shape = shapes.corners.bl,
|
163247
|
+
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
163248
|
+
multiline = false,
|
163249
|
+
newlineBefore = true
|
163250
|
+
} = {}) => {
|
163251
|
+
logRaw(
|
163252
|
+
format5(msg, {
|
163253
|
+
firstLinePrefix: gray(shape) + space() + status.warning,
|
163254
|
+
linePrefix: gray(shapes.bar),
|
163255
|
+
formatLine: (line) => dim(line),
|
163256
|
+
// for backcompat but it's not ideal for this to be "dim"
|
163257
|
+
multiline,
|
163258
|
+
newlineBefore
|
163259
|
+
})
|
163260
|
+
);
|
163261
|
+
}, "warn");
|
163262
|
+
var success = /* @__PURE__ */ __name((msg, {
|
163263
|
+
// current default for backcompat -- TODO: change default to shapes.bar once all callees have been updated
|
163264
|
+
shape = shapes.corners.bl,
|
163265
|
+
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
163266
|
+
multiline = false
|
163267
|
+
} = {}) => {
|
163268
|
+
logRaw(
|
163269
|
+
format5(msg, {
|
163270
|
+
firstLinePrefix: gray(shape) + space() + status.success,
|
163271
|
+
linePrefix: gray(shapes.bar),
|
163272
|
+
newlineBefore: true,
|
163273
|
+
formatLine: (line) => dim(line),
|
163274
|
+
// for backcompat but it's not ideal for this to be "dim"
|
163275
|
+
multiline
|
163276
|
+
})
|
163277
|
+
);
|
163278
|
+
}, "success");
|
163279
|
+
var crash = /* @__PURE__ */ __name((msg, extra) => {
|
163280
|
+
error(msg, extra);
|
163281
|
+
(0, import_process.exit)(1);
|
163282
|
+
}, "crash");
|
163283
|
+
var error = /* @__PURE__ */ __name((msg, extra, corner = shapes.corners.bl) => {
|
163284
|
+
if (msg) {
|
163285
|
+
stderr.write(
|
163286
|
+
`${gray(corner)} ${status.error} ${dim(msg)}
|
163287
|
+
${extra ? space() + extra + "\n" : ""}`
|
163288
|
+
);
|
163289
|
+
}
|
163290
|
+
}, "error");
|
163291
|
+
|
163115
163292
|
// src/deployment-bundle/bundle-reporter.ts
|
163116
163293
|
init_import_meta_url();
|
163117
163294
|
var import_node_buffer2 = require("node:buffer");
|
163118
163295
|
var import_node_zlib = require("node:zlib");
|
163119
|
-
var
|
163296
|
+
var import_chalk8 = __toESM(require_chalk());
|
163120
163297
|
var ONE_KIB_BYTES = 1024;
|
163121
163298
|
var ALLOWED_INITIAL_MAX = ONE_KIB_BYTES * 1024;
|
163122
163299
|
async function getSize(modules) {
|
@@ -163131,7 +163308,7 @@ async function printBundleSize(main2, modules) {
|
|
163131
163308
|
const { size, gzipSize } = await getSize([...modules, main2]);
|
163132
163309
|
const bundleReport = `${(size / ONE_KIB_BYTES).toFixed(2)} KiB / gzip: ${(gzipSize / ONE_KIB_BYTES).toFixed(2)} KiB`;
|
163133
163310
|
const percentage = gzipSize / ALLOWED_INITIAL_MAX * 100;
|
163134
|
-
const colorizedReport = percentage > 90 ?
|
163311
|
+
const colorizedReport = percentage > 90 ? import_chalk8.default.red(bundleReport) : percentage > 70 ? import_chalk8.default.yellow(bundleReport) : import_chalk8.default.green(bundleReport);
|
163135
163312
|
logger.log(`Total Upload: ${colorizedReport}`);
|
163136
163313
|
if (gzipSize > ALLOWED_INITIAL_MAX && !process.env.NO_SCRIPT_SIZE_WARNING) {
|
163137
163314
|
logger.warn(
|
@@ -163859,6 +164036,15 @@ function sniffUserAgent() {
|
|
163859
164036
|
}
|
163860
164037
|
__name(sniffUserAgent, "sniffUserAgent");
|
163861
164038
|
|
164039
|
+
// src/utils/create-batches.ts
|
164040
|
+
init_import_meta_url();
|
164041
|
+
function* createBatches(array, size) {
|
164042
|
+
for (let i = 0; i < array.length; i += size) {
|
164043
|
+
yield array.slice(i, i + size);
|
164044
|
+
}
|
164045
|
+
}
|
164046
|
+
__name(createBatches, "createBatches");
|
164047
|
+
|
163862
164048
|
// src/utils/shell-quote.ts
|
163863
164049
|
init_import_meta_url();
|
163864
164050
|
var import_shell_quote = __toESM(require_shell_quote());
|
@@ -167471,178 +167657,6 @@ init_import_meta_url();
|
|
167471
167657
|
var import_promises5 = require("fs/promises");
|
167472
167658
|
var import_process2 = require("process");
|
167473
167659
|
|
167474
|
-
// ../cli/index.ts
|
167475
|
-
init_import_meta_url();
|
167476
|
-
var import_process = require("process");
|
167477
|
-
|
167478
|
-
// ../cli/colors.ts
|
167479
|
-
init_import_meta_url();
|
167480
|
-
var import_chalk8 = __toESM(require_chalk());
|
167481
|
-
var { white, gray, dim, hidden, bold, cyanBright, bgCyan } = import_chalk8.default;
|
167482
|
-
var brandColor = import_chalk8.default.hex("#BD5B08");
|
167483
|
-
var black = import_chalk8.default.hex("#111");
|
167484
|
-
var blue = import_chalk8.default.hex("#0E838F");
|
167485
|
-
var bgBlue = black.bgHex("#0E838F");
|
167486
|
-
var red = import_chalk8.default.hex("#AB2526");
|
167487
|
-
var bgRed = black.bgHex("#AB2526");
|
167488
|
-
var green = import_chalk8.default.hex("#218529");
|
167489
|
-
var bgGreen = black.bgHex("#218529");
|
167490
|
-
var yellow = import_chalk8.default.hex("#7F7322");
|
167491
|
-
var bgYellow = black.bgHex("#7F7322");
|
167492
|
-
|
167493
|
-
// ../cli/streams.ts
|
167494
|
-
init_import_meta_url();
|
167495
|
-
var stdout = process.stdout;
|
167496
|
-
var stderr = process.stderr;
|
167497
|
-
|
167498
|
-
// ../cli/index.ts
|
167499
|
-
var shapes = {
|
167500
|
-
diamond: "\u25C7",
|
167501
|
-
dash: "\u2500",
|
167502
|
-
radioInactive: "\u25CB",
|
167503
|
-
radioActive: "\u25CF",
|
167504
|
-
bar: "\u2502",
|
167505
|
-
leftT: "\u251C",
|
167506
|
-
rigthT: "\u2524",
|
167507
|
-
arrows: {
|
167508
|
-
left: "\u2039",
|
167509
|
-
right: "\u203A"
|
167510
|
-
},
|
167511
|
-
corners: {
|
167512
|
-
tl: "\u256D",
|
167513
|
-
bl: "\u2570",
|
167514
|
-
tr: "\u256E",
|
167515
|
-
br: "\u256F"
|
167516
|
-
}
|
167517
|
-
};
|
167518
|
-
var status = {
|
167519
|
-
error: bgRed(` ERROR `),
|
167520
|
-
warning: bgYellow(` WARNING `),
|
167521
|
-
info: bgBlue(` INFO `),
|
167522
|
-
success: bgGreen(` SUCCESS `),
|
167523
|
-
cancel: white.bgRed(` X `)
|
167524
|
-
};
|
167525
|
-
var space = /* @__PURE__ */ __name((n2 = 1) => {
|
167526
|
-
return hidden("\u200A".repeat(n2));
|
167527
|
-
}, "space");
|
167528
|
-
var logRaw = /* @__PURE__ */ __name((msg) => {
|
167529
|
-
stdout.write(`${msg}
|
167530
|
-
`);
|
167531
|
-
}, "logRaw");
|
167532
|
-
var log = /* @__PURE__ */ __name((msg) => {
|
167533
|
-
const lines = msg.split("\n").map((ln) => `${gray(shapes.bar)} ${white(ln)}`);
|
167534
|
-
logRaw(lines.join("\n"));
|
167535
|
-
}, "log");
|
167536
|
-
var newline = /* @__PURE__ */ __name(() => {
|
167537
|
-
log("");
|
167538
|
-
}, "newline");
|
167539
|
-
var format5 = /* @__PURE__ */ __name((msg, {
|
167540
|
-
linePrefix = gray(shapes.bar),
|
167541
|
-
firstLinePrefix = linePrefix,
|
167542
|
-
newlineBefore = false,
|
167543
|
-
newlineAfter = false,
|
167544
|
-
formatLine = /* @__PURE__ */ __name((line) => white(line), "formatLine"),
|
167545
|
-
multiline = true
|
167546
|
-
} = {}) => {
|
167547
|
-
const lines = multiline ? msg.split("\n") : [msg];
|
167548
|
-
const formattedLines = lines.map(
|
167549
|
-
(line, i) => (i === 0 ? firstLinePrefix : linePrefix) + space() + formatLine(line)
|
167550
|
-
);
|
167551
|
-
if (newlineBefore) {
|
167552
|
-
formattedLines.unshift(linePrefix);
|
167553
|
-
}
|
167554
|
-
if (newlineAfter) {
|
167555
|
-
formattedLines.push(linePrefix);
|
167556
|
-
}
|
167557
|
-
return formattedLines.join("\n");
|
167558
|
-
}, "format");
|
167559
|
-
var updateStatus = /* @__PURE__ */ __name((msg, printNewLine = true) => {
|
167560
|
-
logRaw(
|
167561
|
-
format5(msg, {
|
167562
|
-
firstLinePrefix: gray(shapes.leftT),
|
167563
|
-
linePrefix: gray(shapes.bar),
|
167564
|
-
newlineAfter: printNewLine
|
167565
|
-
})
|
167566
|
-
);
|
167567
|
-
}, "updateStatus");
|
167568
|
-
var startSection = /* @__PURE__ */ __name((heading, subheading, printNewLine = true) => {
|
167569
|
-
logRaw(
|
167570
|
-
`${gray(shapes.corners.tl)} ${brandColor(heading)} ${subheading ? dim(subheading) : ""}`
|
167571
|
-
);
|
167572
|
-
if (printNewLine) {
|
167573
|
-
newline();
|
167574
|
-
}
|
167575
|
-
}, "startSection");
|
167576
|
-
var endSection = /* @__PURE__ */ __name((heading, subheading) => {
|
167577
|
-
logRaw(
|
167578
|
-
`${gray(shapes.corners.bl)} ${brandColor(heading)} ${subheading ? dim(subheading) : ""}
|
167579
|
-
`
|
167580
|
-
);
|
167581
|
-
}, "endSection");
|
167582
|
-
var cancel = /* @__PURE__ */ __name((msg, {
|
167583
|
-
// current default is backcompat and makes sense going forward too
|
167584
|
-
shape = shapes.corners.bl,
|
167585
|
-
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
167586
|
-
multiline = false
|
167587
|
-
} = {}) => {
|
167588
|
-
logRaw(
|
167589
|
-
format5(msg, {
|
167590
|
-
firstLinePrefix: `${gray(shape)} ${status.cancel}`,
|
167591
|
-
linePrefix: gray(shapes.bar),
|
167592
|
-
newlineBefore: true,
|
167593
|
-
formatLine: (line) => dim(line),
|
167594
|
-
// for backcompat but it's not ideal for this to be "dim"
|
167595
|
-
multiline
|
167596
|
-
})
|
167597
|
-
);
|
167598
|
-
}, "cancel");
|
167599
|
-
var warn = /* @__PURE__ */ __name((msg, {
|
167600
|
-
// current default for backcompat -- TODO: change default to shapes.bar once all callees have been updated
|
167601
|
-
shape = shapes.corners.bl,
|
167602
|
-
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
167603
|
-
multiline = false
|
167604
|
-
} = {}) => {
|
167605
|
-
logRaw(
|
167606
|
-
format5(msg, {
|
167607
|
-
firstLinePrefix: gray(shape) + space() + status.warning,
|
167608
|
-
linePrefix: gray(shapes.bar),
|
167609
|
-
newlineBefore: true,
|
167610
|
-
formatLine: (line) => dim(line),
|
167611
|
-
// for backcompat but it's not ideal for this to be "dim"
|
167612
|
-
multiline
|
167613
|
-
})
|
167614
|
-
);
|
167615
|
-
}, "warn");
|
167616
|
-
var success = /* @__PURE__ */ __name((msg, {
|
167617
|
-
// current default for backcompat -- TODO: change default to shapes.bar once all callees have been updated
|
167618
|
-
shape = shapes.corners.bl,
|
167619
|
-
// current default for backcompat -- TODO: change default to true once all callees have been updated
|
167620
|
-
multiline = false
|
167621
|
-
} = {}) => {
|
167622
|
-
logRaw(
|
167623
|
-
format5(msg, {
|
167624
|
-
firstLinePrefix: gray(shape) + space() + status.success,
|
167625
|
-
linePrefix: gray(shapes.bar),
|
167626
|
-
newlineBefore: true,
|
167627
|
-
formatLine: (line) => dim(line),
|
167628
|
-
// for backcompat but it's not ideal for this to be "dim"
|
167629
|
-
multiline
|
167630
|
-
})
|
167631
|
-
);
|
167632
|
-
}, "success");
|
167633
|
-
var crash = /* @__PURE__ */ __name((msg, extra) => {
|
167634
|
-
error(msg, extra);
|
167635
|
-
(0, import_process.exit)(1);
|
167636
|
-
}, "crash");
|
167637
|
-
var error = /* @__PURE__ */ __name((msg, extra, corner = shapes.corners.bl) => {
|
167638
|
-
if (msg) {
|
167639
|
-
stderr.write(
|
167640
|
-
`${gray(corner)} ${status.error} ${dim(msg)}
|
167641
|
-
${extra ? space() + extra + "\n" : ""}`
|
167642
|
-
);
|
167643
|
-
}
|
167644
|
-
}, "error");
|
167645
|
-
|
167646
167660
|
// ../cli/interactive.ts
|
167647
167661
|
init_import_meta_url();
|
167648
167662
|
|
@@ -185118,10 +185132,10 @@ ${JSON.stringify(defaultRoutesJSONSpec, null, 2)}`
|
|
185118
185132
|
CLEANUP();
|
185119
185133
|
process.exit(0);
|
185120
185134
|
}, "Handler");
|
185121
|
-
function
|
185135
|
+
function isWindows2() {
|
185122
185136
|
return process.platform === "win32";
|
185123
185137
|
}
|
185124
|
-
__name(
|
185138
|
+
__name(isWindows2, "isWindows");
|
185125
185139
|
async function sleep(ms) {
|
185126
185140
|
await new Promise((promiseResolve) => setTimeout(promiseResolve, ms));
|
185127
185141
|
}
|
@@ -185129,7 +185143,7 @@ __name(sleep, "sleep");
|
|
185129
185143
|
function getPids(pid) {
|
185130
185144
|
const pids = [pid];
|
185131
185145
|
let command2, regExp;
|
185132
|
-
if (
|
185146
|
+
if (isWindows2()) {
|
185133
185147
|
command2 = `wmic process where (ParentProcessId=${pid}) get ProcessId`;
|
185134
185148
|
regExp = new RegExp(/(\d+)/);
|
185135
185149
|
} else {
|
@@ -185146,7 +185160,7 @@ function getPids(pid) {
|
|
185146
185160
|
__name(getPids, "getPids");
|
185147
185161
|
function getPort(pid) {
|
185148
185162
|
let command2, regExp;
|
185149
|
-
if (
|
185163
|
+
if (isWindows2()) {
|
185150
185164
|
command2 = process.env.SYSTEMROOT + "\\system32\\netstat.exe -nao";
|
185151
185165
|
regExp = new RegExp(`TCP\\s+.*:(\\d+)\\s+.*:\\d+\\s+LISTENING\\s+${pid}`);
|
185152
185166
|
} else {
|
@@ -185192,7 +185206,7 @@ This results in a more faithful emulation of production behavior.`
|
|
185192
185206
|
command2[0].toString(),
|
185193
185207
|
command2.slice(1).map((value) => value.toString()),
|
185194
185208
|
{
|
185195
|
-
shell:
|
185209
|
+
shell: isWindows2(),
|
185196
185210
|
env: {
|
185197
185211
|
BROWSER: "none",
|
185198
185212
|
...process.env
|
@@ -199427,16 +199441,12 @@ async function fetchLatestDeployment(accountId, workerName) {
|
|
199427
199441
|
return deployments2.at(0);
|
199428
199442
|
}
|
199429
199443
|
__name(fetchLatestDeployment, "fetchLatestDeployment");
|
199430
|
-
async function
|
199431
|
-
|
199432
|
-
if (!latestDeployment) {
|
199444
|
+
async function fetchDeploymentVersions(accountId, workerName, deployment, versionCache) {
|
199445
|
+
if (!deployment) {
|
199433
199446
|
return [[], /* @__PURE__ */ new Map()];
|
199434
199447
|
}
|
199435
199448
|
const versionTraffic = new Map(
|
199436
|
-
|
199437
|
-
versionId,
|
199438
|
-
percentage
|
199439
|
-
])
|
199449
|
+
deployment.versions.map((v2) => [v2.version_id, v2.percentage])
|
199440
199450
|
);
|
199441
199451
|
const versions = await fetchVersions(
|
199442
199452
|
accountId,
|
@@ -199446,7 +199456,7 @@ async function fetchLatestDeploymentVersions(accountId, workerName, versionCache
|
|
199446
199456
|
);
|
199447
199457
|
return [versions, versionTraffic];
|
199448
199458
|
}
|
199449
|
-
__name(
|
199459
|
+
__name(fetchDeploymentVersions, "fetchDeploymentVersions");
|
199450
199460
|
async function fetchDeployableVersions(accountId, workerName, versionCache) {
|
199451
199461
|
const { items: versions } = await fetchResult(
|
199452
199462
|
`/accounts/${accountId}/workers/scripts/${workerName}/versions?deployable=true`
|
@@ -199626,34 +199636,88 @@ function getConfig2(args) {
|
|
199626
199636
|
return config;
|
199627
199637
|
}
|
199628
199638
|
__name(getConfig2, "getConfig");
|
199639
|
+
async function confirmLatestDeploymentOverwrite(accountId, scriptName) {
|
199640
|
+
try {
|
199641
|
+
const latest = await fetchLatestDeployment(accountId, scriptName);
|
199642
|
+
if (latest && latest.versions.length >= 2) {
|
199643
|
+
const versionCache = /* @__PURE__ */ new Map();
|
199644
|
+
warn(
|
199645
|
+
`Your last deployment has multiple versions. To progress that deployment use "wrangler versions deploy" instead.`,
|
199646
|
+
{ shape: shapes.corners.tl, newlineBefore: false }
|
199647
|
+
);
|
199648
|
+
newline();
|
199649
|
+
await printDeployment(
|
199650
|
+
accountId,
|
199651
|
+
scriptName,
|
199652
|
+
latest,
|
199653
|
+
"last",
|
199654
|
+
versionCache
|
199655
|
+
);
|
199656
|
+
return inputPrompt({
|
199657
|
+
type: "confirm",
|
199658
|
+
question: `"wrangler deploy" will upload a new version and deploy it globally immediately.
|
199659
|
+
Are you sure you want to continue?`,
|
199660
|
+
label: "",
|
199661
|
+
defaultValue: !isInteractive() || CI.isCI(),
|
199662
|
+
// defaults to true in CI for back-compat
|
199663
|
+
acceptDefault: !isInteractive() || CI.isCI()
|
199664
|
+
});
|
199665
|
+
}
|
199666
|
+
} catch (e3) {
|
199667
|
+
const isNotFound = e3 instanceof APIError && e3.code == 10007;
|
199668
|
+
if (!isNotFound) {
|
199669
|
+
throw e3;
|
199670
|
+
}
|
199671
|
+
}
|
199672
|
+
return true;
|
199673
|
+
}
|
199674
|
+
__name(confirmLatestDeploymentOverwrite, "confirmLatestDeploymentOverwrite");
|
199629
199675
|
async function printLatestDeployment(accountId, workerName, versionCache) {
|
199630
|
-
const
|
199676
|
+
const latestDeployment = await spinnerWhile({
|
199631
199677
|
startMessage: "Fetching latest deployment",
|
199632
199678
|
async promise() {
|
199633
|
-
return
|
199679
|
+
return fetchLatestDeployment(accountId, workerName);
|
199634
199680
|
}
|
199635
199681
|
});
|
199682
|
+
await printDeployment(
|
199683
|
+
accountId,
|
199684
|
+
workerName,
|
199685
|
+
latestDeployment,
|
199686
|
+
"current",
|
199687
|
+
versionCache
|
199688
|
+
);
|
199689
|
+
}
|
199690
|
+
__name(printLatestDeployment, "printLatestDeployment");
|
199691
|
+
async function printDeployment(accountId, workerName, deployment, adjective, versionCache) {
|
199692
|
+
const [versions, traffic] = await fetchDeploymentVersions(
|
199693
|
+
accountId,
|
199694
|
+
workerName,
|
199695
|
+
deployment,
|
199696
|
+
versionCache
|
199697
|
+
);
|
199636
199698
|
logRaw(
|
199637
|
-
`${leftT} Your
|
199699
|
+
`${leftT} Your ${adjective} deployment has ${versions.length} version(s):`
|
199638
199700
|
);
|
199639
199701
|
printVersions(versions, traffic);
|
199640
199702
|
}
|
199641
|
-
__name(
|
199703
|
+
__name(printDeployment, "printDeployment");
|
199642
199704
|
function printVersions(versions, traffic) {
|
199643
|
-
|
199705
|
+
newline();
|
199706
|
+
log(formatVersions(versions, traffic));
|
199707
|
+
newline();
|
199708
|
+
}
|
199709
|
+
__name(printVersions, "printVersions");
|
199710
|
+
function formatVersions(versions, traffic) {
|
199711
|
+
return versions.map((version3) => {
|
199644
199712
|
const trafficString = brandColor(`(${traffic.get(version3.id)}%)`);
|
199645
199713
|
const versionIdString = white(version3.id);
|
199646
|
-
|
199647
|
-
gray(`
|
199648
|
-
${trafficString} ${versionIdString}
|
199714
|
+
return gray(`${trafficString} ${versionIdString}
|
199649
199715
|
Created: ${version3.metadata.created_on}
|
199650
199716
|
Tag: ${version3.annotations?.["workers/tag"] ?? BLANK_INPUT}
|
199651
|
-
Message: ${version3.annotations?.["workers/message"] ?? BLANK_INPUT}`)
|
199652
|
-
|
199653
|
-
}
|
199654
|
-
newline();
|
199717
|
+
Message: ${version3.annotations?.["workers/message"] ?? BLANK_INPUT}`);
|
199718
|
+
}).join("\n\n");
|
199655
199719
|
}
|
199656
|
-
__name(
|
199720
|
+
__name(formatVersions, "formatVersions");
|
199657
199721
|
async function promptVersionsToDeploy(accountId, workerName, defaultSelectedVersionIds, versionCache, yesFlag) {
|
199658
199722
|
await spinnerWhile({
|
199659
199723
|
startMessage: "Fetching deployable versions",
|
@@ -202588,12 +202652,6 @@ function mapBindings(bindings) {
|
|
202588
202652
|
}, {});
|
202589
202653
|
}
|
202590
202654
|
__name(mapBindings, "mapBindings");
|
202591
|
-
function* createBatches(array, size) {
|
202592
|
-
for (let i = 0; i < array.length; i += size) {
|
202593
|
-
yield array.slice(i, i + size);
|
202594
|
-
}
|
202595
|
-
}
|
202596
|
-
__name(createBatches, "createBatches");
|
202597
202655
|
function assertNoTypeArg(args) {
|
202598
202656
|
if (args.type) {
|
202599
202657
|
let message = "The --type option is no longer supported.";
|
@@ -203110,11 +203168,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
203110
203168
|
const destination = props.outDir ?? getWranglerTmpDir(props.projectRoot, "deploy");
|
203111
203169
|
const envName = props.env ?? "production";
|
203112
203170
|
const start = Date.now();
|
203113
|
-
const
|
203171
|
+
const prod = Boolean(props.legacyEnv || !props.env);
|
203172
|
+
const notProd = !prod;
|
203114
203173
|
const workerName = notProd ? `${scriptName} (${envName})` : scriptName;
|
203115
203174
|
const workerUrl = props.dispatchNamespace ? `/accounts/${accountId}/workers/dispatch/namespaces/${props.dispatchNamespace}/scripts/${scriptName}` : notProd ? `/accounts/${accountId}/workers/services/${scriptName}/environments/${envName}` : `/accounts/${accountId}/workers/scripts/${scriptName}`;
|
203116
203175
|
let deploymentId = null;
|
203117
203176
|
const { format: format10 } = props.entry;
|
203177
|
+
if (!props.dispatchNamespace && prod && accountId && scriptName) {
|
203178
|
+
const yes = await confirmLatestDeploymentOverwrite(accountId, scriptName);
|
203179
|
+
if (!yes) {
|
203180
|
+
cancel("Aborting deploy...");
|
203181
|
+
return;
|
203182
|
+
}
|
203183
|
+
}
|
203118
203184
|
if (!props.isWorkersSite && Boolean(props.assetPaths) && format10 === "service-worker") {
|
203119
203185
|
throw new UserError(
|
203120
203186
|
"You cannot use the service-worker format with an `assets` directory yet. For information on how to migrate to the module-worker format, see: https://developers.cloudflare.com/workers/learning/migrating-to-module-workers/"
|
@@ -209393,3 +209459,4 @@ yargs-parser/build/lib/index.js:
|
|
209393
209459
|
* SPDX-License-Identifier: ISC
|
209394
209460
|
*)
|
209395
209461
|
*/
|
209462
|
+
//# sourceMappingURL=cli.js.map
|