wrangler 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/__tests__/publish.test.ts +610 -184
- package/src/__tests__/tsconfig.tsbuildinfo +1 -1
- package/src/kv/helpers.ts +7 -4
- package/src/pages/functions/tsconfig.tsbuildinfo +1 -1
- package/src/sites.ts +164 -52
- package/wrangler-dist/cli.js +171 -89
package/wrangler-dist/cli.js
CHANGED
|
@@ -17960,14 +17960,14 @@ var require_templates = __commonJS({
|
|
|
17960
17960
|
return results;
|
|
17961
17961
|
}
|
|
17962
17962
|
__name(parseStyle, "parseStyle");
|
|
17963
|
-
function buildStyle(
|
|
17963
|
+
function buildStyle(chalk15, styles) {
|
|
17964
17964
|
const enabled = {};
|
|
17965
17965
|
for (const layer of styles) {
|
|
17966
17966
|
for (const style of layer.styles) {
|
|
17967
17967
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
17968
17968
|
}
|
|
17969
17969
|
}
|
|
17970
|
-
let current =
|
|
17970
|
+
let current = chalk15;
|
|
17971
17971
|
for (const styleName of Object.keys(enabled)) {
|
|
17972
17972
|
if (Array.isArray(enabled[styleName])) {
|
|
17973
17973
|
if (!(styleName in current)) {
|
|
@@ -17983,7 +17983,7 @@ var require_templates = __commonJS({
|
|
|
17983
17983
|
return current;
|
|
17984
17984
|
}
|
|
17985
17985
|
__name(buildStyle, "buildStyle");
|
|
17986
|
-
module2.exports = (
|
|
17986
|
+
module2.exports = (chalk15, tmp5) => {
|
|
17987
17987
|
const styles = [];
|
|
17988
17988
|
const chunks = [];
|
|
17989
17989
|
let chunk = [];
|
|
@@ -17993,13 +17993,13 @@ var require_templates = __commonJS({
|
|
|
17993
17993
|
} else if (style) {
|
|
17994
17994
|
const str = chunk.join("");
|
|
17995
17995
|
chunk = [];
|
|
17996
|
-
chunks.push(styles.length === 0 ? str : buildStyle(
|
|
17996
|
+
chunks.push(styles.length === 0 ? str : buildStyle(chalk15, styles)(str));
|
|
17997
17997
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
17998
17998
|
} else if (close) {
|
|
17999
17999
|
if (styles.length === 0) {
|
|
18000
18000
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
18001
18001
|
}
|
|
18002
|
-
chunks.push(buildStyle(
|
|
18002
|
+
chunks.push(buildStyle(chalk15, styles)(chunk.join("")));
|
|
18003
18003
|
chunk = [];
|
|
18004
18004
|
styles.pop();
|
|
18005
18005
|
} else {
|
|
@@ -18038,16 +18038,16 @@ var require_chalk = __commonJS({
|
|
|
18038
18038
|
__name(applyOptions, "applyOptions");
|
|
18039
18039
|
function Chalk(options6) {
|
|
18040
18040
|
if (!this || !(this instanceof Chalk) || this.template) {
|
|
18041
|
-
const
|
|
18042
|
-
applyOptions(
|
|
18043
|
-
|
|
18041
|
+
const chalk15 = {};
|
|
18042
|
+
applyOptions(chalk15, options6);
|
|
18043
|
+
chalk15.template = function() {
|
|
18044
18044
|
const args = [].slice.call(arguments);
|
|
18045
|
-
return chalkTag.apply(null, [
|
|
18045
|
+
return chalkTag.apply(null, [chalk15.template].concat(args));
|
|
18046
18046
|
};
|
|
18047
|
-
Object.setPrototypeOf(
|
|
18048
|
-
Object.setPrototypeOf(
|
|
18049
|
-
|
|
18050
|
-
return
|
|
18047
|
+
Object.setPrototypeOf(chalk15, Chalk.prototype);
|
|
18048
|
+
Object.setPrototypeOf(chalk15.template, chalk15);
|
|
18049
|
+
chalk15.template.constructor = Chalk;
|
|
18050
|
+
return chalk15.template;
|
|
18051
18051
|
}
|
|
18052
18052
|
applyOptions(this, options6);
|
|
18053
18053
|
}
|
|
@@ -18169,7 +18169,7 @@ var require_chalk = __commonJS({
|
|
|
18169
18169
|
return str;
|
|
18170
18170
|
}
|
|
18171
18171
|
__name(applyStyle, "applyStyle");
|
|
18172
|
-
function chalkTag(
|
|
18172
|
+
function chalkTag(chalk15, strings) {
|
|
18173
18173
|
if (!Array.isArray(strings)) {
|
|
18174
18174
|
return [].slice.call(arguments, 1).join(" ");
|
|
18175
18175
|
}
|
|
@@ -18179,7 +18179,7 @@ var require_chalk = __commonJS({
|
|
|
18179
18179
|
parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
|
18180
18180
|
parts.push(String(strings.raw[i]));
|
|
18181
18181
|
}
|
|
18182
|
-
return template(
|
|
18182
|
+
return template(chalk15, parts.join(""));
|
|
18183
18183
|
}
|
|
18184
18184
|
__name(chalkTag, "chalkTag");
|
|
18185
18185
|
Object.defineProperties(Chalk.prototype, styles);
|
|
@@ -53345,14 +53345,14 @@ var require_templates2 = __commonJS({
|
|
|
53345
53345
|
return results;
|
|
53346
53346
|
}
|
|
53347
53347
|
__name(parseStyle, "parseStyle");
|
|
53348
|
-
function buildStyle(
|
|
53348
|
+
function buildStyle(chalk15, styles) {
|
|
53349
53349
|
const enabled = {};
|
|
53350
53350
|
for (const layer of styles) {
|
|
53351
53351
|
for (const style of layer.styles) {
|
|
53352
53352
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
53353
53353
|
}
|
|
53354
53354
|
}
|
|
53355
|
-
let current =
|
|
53355
|
+
let current = chalk15;
|
|
53356
53356
|
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
53357
53357
|
if (!Array.isArray(styles2)) {
|
|
53358
53358
|
continue;
|
|
@@ -53365,7 +53365,7 @@ var require_templates2 = __commonJS({
|
|
|
53365
53365
|
return current;
|
|
53366
53366
|
}
|
|
53367
53367
|
__name(buildStyle, "buildStyle");
|
|
53368
|
-
module2.exports = (
|
|
53368
|
+
module2.exports = (chalk15, temporary) => {
|
|
53369
53369
|
const styles = [];
|
|
53370
53370
|
const chunks = [];
|
|
53371
53371
|
let chunk = [];
|
|
@@ -53375,13 +53375,13 @@ var require_templates2 = __commonJS({
|
|
|
53375
53375
|
} else if (style) {
|
|
53376
53376
|
const string = chunk.join("");
|
|
53377
53377
|
chunk = [];
|
|
53378
|
-
chunks.push(styles.length === 0 ? string : buildStyle(
|
|
53378
|
+
chunks.push(styles.length === 0 ? string : buildStyle(chalk15, styles)(string));
|
|
53379
53379
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
53380
53380
|
} else if (close) {
|
|
53381
53381
|
if (styles.length === 0) {
|
|
53382
53382
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
53383
53383
|
}
|
|
53384
|
-
chunks.push(buildStyle(
|
|
53384
|
+
chunks.push(buildStyle(chalk15, styles)(chunk.join("")));
|
|
53385
53385
|
chunk = [];
|
|
53386
53386
|
styles.pop();
|
|
53387
53387
|
} else {
|
|
@@ -53431,16 +53431,16 @@ var require_source = __commonJS({
|
|
|
53431
53431
|
};
|
|
53432
53432
|
__name(ChalkClass, "ChalkClass");
|
|
53433
53433
|
var chalkFactory = /* @__PURE__ */ __name((options6) => {
|
|
53434
|
-
const
|
|
53435
|
-
applyOptions(
|
|
53436
|
-
|
|
53437
|
-
Object.setPrototypeOf(
|
|
53438
|
-
Object.setPrototypeOf(
|
|
53439
|
-
|
|
53434
|
+
const chalk16 = {};
|
|
53435
|
+
applyOptions(chalk16, options6);
|
|
53436
|
+
chalk16.template = (...arguments_) => chalkTag(chalk16.template, ...arguments_);
|
|
53437
|
+
Object.setPrototypeOf(chalk16, Chalk.prototype);
|
|
53438
|
+
Object.setPrototypeOf(chalk16.template, chalk16);
|
|
53439
|
+
chalk16.template.constructor = () => {
|
|
53440
53440
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
53441
53441
|
};
|
|
53442
|
-
|
|
53443
|
-
return
|
|
53442
|
+
chalk16.template.Instance = ChalkClass;
|
|
53443
|
+
return chalk16.template;
|
|
53444
53444
|
}, "chalkFactory");
|
|
53445
53445
|
function Chalk(options6) {
|
|
53446
53446
|
return chalkFactory(options6);
|
|
@@ -53552,7 +53552,7 @@ var require_source = __commonJS({
|
|
|
53552
53552
|
return openAll + string + closeAll;
|
|
53553
53553
|
}, "applyStyle");
|
|
53554
53554
|
var template;
|
|
53555
|
-
var chalkTag = /* @__PURE__ */ __name((
|
|
53555
|
+
var chalkTag = /* @__PURE__ */ __name((chalk16, ...strings) => {
|
|
53556
53556
|
const [firstString] = strings;
|
|
53557
53557
|
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
53558
53558
|
return strings.join(" ");
|
|
@@ -53568,14 +53568,14 @@ var require_source = __commonJS({
|
|
|
53568
53568
|
if (template === void 0) {
|
|
53569
53569
|
template = require_templates2();
|
|
53570
53570
|
}
|
|
53571
|
-
return template(
|
|
53571
|
+
return template(chalk16, parts.join(""));
|
|
53572
53572
|
}, "chalkTag");
|
|
53573
53573
|
Object.defineProperties(Chalk.prototype, styles);
|
|
53574
|
-
var
|
|
53575
|
-
|
|
53576
|
-
|
|
53577
|
-
|
|
53578
|
-
module2.exports =
|
|
53574
|
+
var chalk15 = Chalk();
|
|
53575
|
+
chalk15.supportsColor = stdoutColor;
|
|
53576
|
+
chalk15.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
53577
|
+
chalk15.stderr.supportsColor = stderrColor;
|
|
53578
|
+
module2.exports = chalk15;
|
|
53579
53579
|
}
|
|
53580
53580
|
});
|
|
53581
53581
|
|
|
@@ -122132,7 +122132,7 @@ var import_undici16 = __toESM(require_undici());
|
|
|
122132
122132
|
// src/dev.tsx
|
|
122133
122133
|
init_import_meta_url();
|
|
122134
122134
|
var import_node_path42 = __toESM(require("node:path"));
|
|
122135
|
-
var
|
|
122135
|
+
var import_chalk14 = __toESM(require_chalk());
|
|
122136
122136
|
var import_chokidar5 = require("chokidar");
|
|
122137
122137
|
|
|
122138
122138
|
// ../../node_modules/get-port/index.js
|
|
@@ -128747,7 +128747,7 @@ var import_websocket_server = __toESM(require_websocket_server2(), 1);
|
|
|
128747
128747
|
var wrapper_default = import_websocket.default;
|
|
128748
128748
|
|
|
128749
128749
|
// package.json
|
|
128750
|
-
var version = "2.
|
|
128750
|
+
var version = "2.18.0";
|
|
128751
128751
|
var package_default = {
|
|
128752
128752
|
name: "wrangler",
|
|
128753
128753
|
version,
|
|
@@ -132683,14 +132683,14 @@ var import_node_assert11 = __toESM(require("node:assert"));
|
|
|
132683
132683
|
var import_node_fs24 = require("node:fs");
|
|
132684
132684
|
var import_node_path40 = __toESM(require("node:path"));
|
|
132685
132685
|
var import_node_url12 = require("node:url");
|
|
132686
|
-
var
|
|
132686
|
+
var import_chalk13 = __toESM(require_chalk());
|
|
132687
132687
|
var import_tmp_promise2 = __toESM(require_tmp_promise());
|
|
132688
132688
|
|
|
132689
132689
|
// src/deployments.ts
|
|
132690
132690
|
init_import_meta_url();
|
|
132691
132691
|
var import_url2 = require("url");
|
|
132692
132692
|
var import_toml6 = __toESM(require_toml());
|
|
132693
|
-
var
|
|
132693
|
+
var import_chalk10 = __toESM(require_chalk());
|
|
132694
132694
|
var import_undici14 = __toESM(require_undici());
|
|
132695
132695
|
|
|
132696
132696
|
// src/init.ts
|
|
@@ -132965,7 +132965,7 @@ __name(sniffUserAgent, "sniffUserAgent");
|
|
|
132965
132965
|
init_import_meta_url();
|
|
132966
132966
|
var import_node_os14 = __toESM(require("node:os"));
|
|
132967
132967
|
var import_toml4 = __toESM(require_toml());
|
|
132968
|
-
var
|
|
132968
|
+
var import_chalk9 = __toESM(require_chalk());
|
|
132969
132969
|
|
|
132970
132970
|
// node_modules/supports-color/index.js
|
|
132971
132971
|
init_import_meta_url();
|
|
@@ -140521,7 +140521,7 @@ function logBulkProgress(operation, index, total) {
|
|
|
140521
140521
|
);
|
|
140522
140522
|
}
|
|
140523
140523
|
__name(logBulkProgress, "logBulkProgress");
|
|
140524
|
-
async function putKVBulkKeyValue(accountId, namespaceId, keyValues, quiet = false) {
|
|
140524
|
+
async function putKVBulkKeyValue(accountId, namespaceId, keyValues, quiet = false, abortSignal) {
|
|
140525
140525
|
for (let index = 0; index < keyValues.length; index += BATCH_KEY_MAX) {
|
|
140526
140526
|
if (!quiet && keyValues.length > BATCH_KEY_MAX) {
|
|
140527
140527
|
logBulkProgress("put", index, keyValues.length);
|
|
@@ -140532,7 +140532,9 @@ async function putKVBulkKeyValue(accountId, namespaceId, keyValues, quiet = fals
|
|
|
140532
140532
|
method: "PUT",
|
|
140533
140533
|
body: JSON.stringify(keyValues.slice(index, index + BATCH_KEY_MAX)),
|
|
140534
140534
|
headers: { "Content-Type": "application/json" }
|
|
140535
|
-
}
|
|
140535
|
+
},
|
|
140536
|
+
void 0,
|
|
140537
|
+
abortSignal
|
|
140536
140538
|
);
|
|
140537
140539
|
}
|
|
140538
140540
|
if (!quiet && keyValues.length > BATCH_KEY_MAX) {
|
|
@@ -146179,6 +146181,7 @@ init_import_meta_url();
|
|
|
146179
146181
|
var import_node_assert9 = __toESM(require("node:assert"));
|
|
146180
146182
|
var import_promises12 = require("node:fs/promises");
|
|
146181
146183
|
var path32 = __toESM(require("node:path"));
|
|
146184
|
+
var import_chalk6 = __toESM(require_chalk());
|
|
146182
146185
|
var import_ignore = __toESM(require_ignore());
|
|
146183
146186
|
|
|
146184
146187
|
// ../../node_modules/xxhash-wasm/esm/xxhash-wasm.js
|
|
@@ -146289,6 +146292,14 @@ async function createKVNamespaceIfNotAlreadyExisting(title, accountId) {
|
|
|
146289
146292
|
};
|
|
146290
146293
|
}
|
|
146291
146294
|
__name(createKVNamespaceIfNotAlreadyExisting, "createKVNamespaceIfNotAlreadyExisting");
|
|
146295
|
+
var MAX_DIFF_LINES = 100;
|
|
146296
|
+
var MAX_BUCKET_SIZE2 = 98 * 1e3 * 1e3;
|
|
146297
|
+
var MAX_BUCKET_KEYS = BATCH_KEY_MAX;
|
|
146298
|
+
var MAX_BATCH_OPERATIONS = 5;
|
|
146299
|
+
function pluralise(count) {
|
|
146300
|
+
return count === 1 ? "" : "s";
|
|
146301
|
+
}
|
|
146302
|
+
__name(pluralise, "pluralise");
|
|
146292
146303
|
async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
146293
146304
|
if (siteAssets === void 0) {
|
|
146294
146305
|
return { manifest: void 0, namespace: void 0 };
|
|
@@ -146303,62 +146314,133 @@ async function syncAssets(accountId, scriptName, siteAssets, preview, dryRun) {
|
|
|
146303
146314
|
title,
|
|
146304
146315
|
accountId
|
|
146305
146316
|
);
|
|
146317
|
+
logger.info("Fetching list of already uploaded assets...");
|
|
146306
146318
|
const namespaceKeysResponse = await listKVNamespaceKeys(accountId, namespace);
|
|
146307
146319
|
const namespaceKeys = new Set(namespaceKeysResponse.map((x) => x.name));
|
|
146308
|
-
const manifest = {};
|
|
146309
|
-
const uploadBuckets = [];
|
|
146310
|
-
let uploadBucket = [];
|
|
146311
|
-
let uploadBucketSize = 0;
|
|
146312
|
-
const include = createPatternMatcher(siteAssets.includePatterns, false);
|
|
146313
|
-
const exclude = createPatternMatcher(siteAssets.excludePatterns, true);
|
|
146314
|
-
const hasher = await e();
|
|
146315
146320
|
const assetDirectory = path32.join(
|
|
146316
146321
|
siteAssets.baseDirectory,
|
|
146317
146322
|
siteAssets.assetDirectory
|
|
146318
146323
|
);
|
|
146324
|
+
const include = createPatternMatcher(siteAssets.includePatterns, false);
|
|
146325
|
+
const exclude = createPatternMatcher(siteAssets.excludePatterns, true);
|
|
146326
|
+
const hasher = await e();
|
|
146327
|
+
const manifest = {};
|
|
146328
|
+
const uploadBuckets = [];
|
|
146329
|
+
let uploadBucket = [];
|
|
146330
|
+
let uploadBucketSize = 0;
|
|
146331
|
+
let uploadCount = 0;
|
|
146332
|
+
let skipCount = 0;
|
|
146333
|
+
let diffCount = 0;
|
|
146334
|
+
function logDiff(line) {
|
|
146335
|
+
const level = logger.loggerLevel;
|
|
146336
|
+
if (LOGGER_LEVELS[level] >= LOGGER_LEVELS.debug) {
|
|
146337
|
+
logger.debug(line);
|
|
146338
|
+
} else if (diffCount < MAX_DIFF_LINES) {
|
|
146339
|
+
logger.info(line);
|
|
146340
|
+
} else if (diffCount === MAX_DIFF_LINES) {
|
|
146341
|
+
const msg = " (truncating changed assets log, set `WRANGLER_LOG=debug` environment variable to see full diff)";
|
|
146342
|
+
logger.info(import_chalk6.default.dim(msg));
|
|
146343
|
+
}
|
|
146344
|
+
diffCount++;
|
|
146345
|
+
}
|
|
146346
|
+
__name(logDiff, "logDiff");
|
|
146347
|
+
logger.info("Building list of assets to upload...");
|
|
146319
146348
|
for await (const absAssetFile of getFilesInFolder(assetDirectory)) {
|
|
146320
146349
|
const assetFile = path32.relative(assetDirectory, absAssetFile);
|
|
146321
|
-
if (!include(assetFile))
|
|
146322
|
-
continue;
|
|
146323
|
-
}
|
|
146324
|
-
if (exclude(assetFile)) {
|
|
146350
|
+
if (!include(assetFile) || exclude(assetFile))
|
|
146325
146351
|
continue;
|
|
146326
|
-
}
|
|
146327
|
-
logger.log(`Reading ${assetFile}...`);
|
|
146328
146352
|
const content = await (0, import_promises12.readFile)(absAssetFile, "base64");
|
|
146353
|
+
const assetSize = Buffer.byteLength(content);
|
|
146329
146354
|
await validateAssetSize(absAssetFile, assetFile);
|
|
146330
|
-
const assetSize = Buffer.from(content).length;
|
|
146331
146355
|
const assetKey = hashAsset(hasher, assetFile, content);
|
|
146332
146356
|
validateAssetKey(assetKey);
|
|
146333
146357
|
if (!namespaceKeys.has(assetKey)) {
|
|
146334
|
-
|
|
146335
|
-
|
|
146358
|
+
logDiff(
|
|
146359
|
+
import_chalk6.default.green(` + ${assetKey} (uploading new version of ${assetFile})`)
|
|
146360
|
+
);
|
|
146361
|
+
if (uploadBucketSize + assetSize > MAX_BUCKET_SIZE2 || uploadBucket.length + 1 > MAX_BUCKET_KEYS) {
|
|
146336
146362
|
uploadBuckets.push(uploadBucket);
|
|
146337
146363
|
uploadBucketSize = 0;
|
|
146338
146364
|
uploadBucket = [];
|
|
146339
146365
|
}
|
|
146340
146366
|
uploadBucketSize += assetSize;
|
|
146341
|
-
uploadBucket.push(
|
|
146342
|
-
|
|
146343
|
-
value: content,
|
|
146344
|
-
base64: true
|
|
146345
|
-
});
|
|
146367
|
+
uploadBucket.push([absAssetFile, assetKey]);
|
|
146368
|
+
uploadCount++;
|
|
146346
146369
|
} else {
|
|
146347
|
-
|
|
146370
|
+
logDiff(import_chalk6.default.dim(` = ${assetKey} (already uploaded ${assetFile})`));
|
|
146371
|
+
skipCount++;
|
|
146348
146372
|
}
|
|
146349
146373
|
namespaceKeys.delete(assetKey);
|
|
146350
146374
|
const manifestKey = urlSafe(path32.relative(assetDirectory, absAssetFile));
|
|
146351
146375
|
manifest[manifestKey] = assetKey;
|
|
146352
146376
|
}
|
|
146353
|
-
|
|
146377
|
+
if (uploadBucket.length > 0)
|
|
146378
|
+
uploadBuckets.push(uploadBucket);
|
|
146354
146379
|
for (const key of namespaceKeys) {
|
|
146355
|
-
|
|
146380
|
+
logDiff(import_chalk6.default.red(` - ${key} (removing as stale)`));
|
|
146356
146381
|
}
|
|
146357
|
-
|
|
146358
|
-
|
|
146359
|
-
|
|
146382
|
+
if (uploadCount > 0) {
|
|
146383
|
+
const s = pluralise(uploadCount);
|
|
146384
|
+
logger.info(`Uploading ${formatNumber(uploadCount)} new asset${s}...`);
|
|
146385
|
+
}
|
|
146386
|
+
if (skipCount > 0) {
|
|
146387
|
+
const s = pluralise(skipCount);
|
|
146388
|
+
logger.info(
|
|
146389
|
+
`Skipped uploading ${formatNumber(skipCount)} existing asset${s}.`
|
|
146390
|
+
);
|
|
146391
|
+
}
|
|
146392
|
+
let uploadedCount = 0;
|
|
146393
|
+
const controller = new AbortController();
|
|
146394
|
+
const uploaders = Array.from(Array(MAX_BATCH_OPERATIONS)).map(async () => {
|
|
146395
|
+
while (!controller.signal.aborted) {
|
|
146396
|
+
const nextBucket = uploadBuckets.shift();
|
|
146397
|
+
if (nextBucket === void 0)
|
|
146398
|
+
break;
|
|
146399
|
+
const bucket = [];
|
|
146400
|
+
for (const [absAssetFile, assetKey] of nextBucket) {
|
|
146401
|
+
bucket.push({
|
|
146402
|
+
key: assetKey,
|
|
146403
|
+
value: await (0, import_promises12.readFile)(absAssetFile, "base64"),
|
|
146404
|
+
base64: true
|
|
146405
|
+
});
|
|
146406
|
+
if (controller.signal.aborted)
|
|
146407
|
+
break;
|
|
146408
|
+
}
|
|
146409
|
+
try {
|
|
146410
|
+
await putKVBulkKeyValue(
|
|
146411
|
+
accountId,
|
|
146412
|
+
namespace,
|
|
146413
|
+
bucket,
|
|
146414
|
+
true,
|
|
146415
|
+
controller.signal
|
|
146416
|
+
);
|
|
146417
|
+
} catch (e2) {
|
|
146418
|
+
if (typeof e2 === "object" && e2 !== null && "name" in e2 && e2.name === "AbortError") {
|
|
146419
|
+
break;
|
|
146420
|
+
}
|
|
146421
|
+
throw e2;
|
|
146422
|
+
}
|
|
146423
|
+
uploadedCount += nextBucket.length;
|
|
146424
|
+
const percent = Math.floor(100 * uploadedCount / uploadCount);
|
|
146425
|
+
logger.info(
|
|
146426
|
+
`Uploaded ${percent}% [${formatNumber(
|
|
146427
|
+
uploadedCount
|
|
146428
|
+
)} out of ${formatNumber(uploadCount)}]`
|
|
146429
|
+
);
|
|
146430
|
+
}
|
|
146431
|
+
});
|
|
146432
|
+
try {
|
|
146433
|
+
await Promise.all(uploaders);
|
|
146434
|
+
} catch (e2) {
|
|
146435
|
+
logger.info(`Upload failed, aborting...`);
|
|
146436
|
+
controller.abort();
|
|
146437
|
+
throw e2;
|
|
146438
|
+
}
|
|
146439
|
+
const deleteCount = namespaceKeys.size;
|
|
146440
|
+
if (deleteCount > 0) {
|
|
146441
|
+
const s = pluralise(deleteCount);
|
|
146442
|
+
logger.info(`Removing ${formatNumber(deleteCount)} stale asset${s}...`);
|
|
146360
146443
|
}
|
|
146361
|
-
await Promise.all(bucketsToPut);
|
|
146362
146444
|
await deleteKVBulkKeyValue(accountId, namespace, Array.from(namespaceKeys));
|
|
146363
146445
|
logger.log("\u2197\uFE0F Done syncing assets");
|
|
146364
146446
|
return { manifest, namespace };
|
|
@@ -148512,7 +148594,7 @@ __name(writeDTSFile, "writeDTSFile");
|
|
|
148512
148594
|
|
|
148513
148595
|
// src/update-check.ts
|
|
148514
148596
|
init_import_meta_url();
|
|
148515
|
-
var
|
|
148597
|
+
var import_chalk7 = __toESM(require_chalk());
|
|
148516
148598
|
var import_update_check = __toESM(require_update_check());
|
|
148517
148599
|
async function updateCheck() {
|
|
148518
148600
|
let update = null;
|
|
@@ -148523,14 +148605,14 @@ async function updateCheck() {
|
|
|
148523
148605
|
} catch (err) {
|
|
148524
148606
|
}
|
|
148525
148607
|
if (update)
|
|
148526
|
-
return `(update available ${
|
|
148608
|
+
return `(update available ${import_chalk7.default.green(update.latest)})`;
|
|
148527
148609
|
return "";
|
|
148528
148610
|
}
|
|
148529
148611
|
__name(updateCheck, "updateCheck");
|
|
148530
148612
|
|
|
148531
148613
|
// src/whoami.ts
|
|
148532
148614
|
init_import_meta_url();
|
|
148533
|
-
var
|
|
148615
|
+
var import_chalk8 = __toESM(require_chalk());
|
|
148534
148616
|
async function whoami() {
|
|
148535
148617
|
logger.log("Getting User settings...");
|
|
148536
148618
|
const user = await getUserInfo();
|
|
@@ -148541,7 +148623,7 @@ async function whoami() {
|
|
|
148541
148623
|
}
|
|
148542
148624
|
if (user.email !== void 0) {
|
|
148543
148625
|
logger.log(
|
|
148544
|
-
`\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${
|
|
148626
|
+
`\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${import_chalk8.default.blue(user.email)}!`
|
|
148545
148627
|
);
|
|
148546
148628
|
} else {
|
|
148547
148629
|
logger.log(
|
|
@@ -148642,7 +148724,7 @@ async function printWranglerBanner() {
|
|
|
148642
148724
|
}
|
|
148643
148725
|
const text = ` \u26C5\uFE0F wrangler ${version} ${await updateCheck()}`;
|
|
148644
148726
|
logger.log(
|
|
148645
|
-
text + "\n" + (supports_color_default.stdout ?
|
|
148727
|
+
text + "\n" + (supports_color_default.stdout ? import_chalk9.default.hex("#FF8800")("-".repeat(text.length)) : "-".repeat(text.length))
|
|
148646
148728
|
);
|
|
148647
148729
|
}
|
|
148648
148730
|
__name(printWranglerBanner, "printWranglerBanner");
|
|
@@ -149980,9 +150062,9 @@ async function rollbackDeployment(accountId, scriptName, { send_metrics: sendMet
|
|
|
149980
150062
|
rollbackMessage = message;
|
|
149981
150063
|
} else {
|
|
149982
150064
|
if (!await confirm(
|
|
149983
|
-
`This deployment ${
|
|
150065
|
+
`This deployment ${import_chalk10.default.underline(
|
|
149984
150066
|
firstHash
|
|
149985
|
-
)} will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. ${
|
|
150067
|
+
)} will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. ${import_chalk10.default.blue.bold(
|
|
149986
150068
|
"Note:"
|
|
149987
150069
|
)} Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, R2, KV, etc.).`
|
|
149988
150070
|
)) {
|
|
@@ -150182,7 +150264,7 @@ __name(getMigrationsToUpload, "getMigrationsToUpload");
|
|
|
150182
150264
|
|
|
150183
150265
|
// src/routes.ts
|
|
150184
150266
|
init_import_meta_url();
|
|
150185
|
-
var
|
|
150267
|
+
var import_chalk11 = __toESM(require_chalk());
|
|
150186
150268
|
async function getWorkersDevSubdomain(accountId) {
|
|
150187
150269
|
try {
|
|
150188
150270
|
const { subdomain } = await fetchResult(
|
|
@@ -150243,8 +150325,8 @@ async function registerSubdomain(accountId) {
|
|
|
150243
150325
|
}
|
|
150244
150326
|
}
|
|
150245
150327
|
const ok = await confirm(
|
|
150246
|
-
`Creating a workers.dev subdomain for your account at ${
|
|
150247
|
-
|
|
150328
|
+
`Creating a workers.dev subdomain for your account at ${import_chalk11.default.blue(
|
|
150329
|
+
import_chalk11.default.underline(`https://${potentialName}.workers.dev`)
|
|
150248
150330
|
)}. Ok to proceed?`
|
|
150249
150331
|
);
|
|
150250
150332
|
if (!ok) {
|
|
@@ -150280,8 +150362,8 @@ ${onboardingLink}`);
|
|
|
150280
150362
|
}
|
|
150281
150363
|
logger.log("Success! It may take a few minutes for DNS records to update.");
|
|
150282
150364
|
logger.log(
|
|
150283
|
-
`Visit ${
|
|
150284
|
-
|
|
150365
|
+
`Visit ${import_chalk11.default.blue(
|
|
150366
|
+
import_chalk11.default.underline(
|
|
150285
150367
|
`https://dash.cloudflare.com/${accountId}/workers/subdomain`
|
|
150286
150368
|
)
|
|
150287
150369
|
)} to edit your workers.dev subdomain`
|
|
@@ -150294,7 +150376,7 @@ __name(registerSubdomain, "registerSubdomain");
|
|
|
150294
150376
|
init_import_meta_url();
|
|
150295
150377
|
var import_promises15 = require("node:fs/promises");
|
|
150296
150378
|
var import_node_path39 = __toESM(require("node:path"));
|
|
150297
|
-
var
|
|
150379
|
+
var import_chalk12 = __toESM(require_chalk());
|
|
150298
150380
|
async function getFiles(root, relativeTo) {
|
|
150299
150381
|
const files = [];
|
|
150300
150382
|
for (const file of await (0, import_promises15.readdir)(root, { withFileTypes: true })) {
|
|
@@ -150318,7 +150400,7 @@ async function traverseModuleGraph(entry, rules) {
|
|
|
150318
150400
|
if (modules.length > 0) {
|
|
150319
150401
|
logger.info(`Uploading additional modules:`);
|
|
150320
150402
|
modules.forEach(({ name, type }) => {
|
|
150321
|
-
logger.info(`- ${
|
|
150403
|
+
logger.info(`- ${import_chalk12.default.blue(name)} (${import_chalk12.default.green(type ?? "")})`);
|
|
150322
150404
|
});
|
|
150323
150405
|
}
|
|
150324
150406
|
return {
|
|
@@ -150812,13 +150894,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
150812
150894
|
const assignedRoutes = routesWithOtherBindings[worker];
|
|
150813
150895
|
errorMessage += `"${worker}" is already assigned to routes:
|
|
150814
150896
|
${assignedRoutes.map(
|
|
150815
|
-
(r) => ` - ${
|
|
150897
|
+
(r) => ` - ${import_chalk13.default.underline(r)}
|
|
150816
150898
|
`
|
|
150817
150899
|
)}`;
|
|
150818
150900
|
}
|
|
150819
150901
|
const resolution = "Unassign other workers from the routes you want to publish to, and then try again.";
|
|
150820
|
-
const dashLink = `Visit ${
|
|
150821
|
-
|
|
150902
|
+
const dashLink = `Visit ${import_chalk13.default.blue(
|
|
150903
|
+
import_chalk13.default.underline(
|
|
150822
150904
|
`https://dash.cloudflare.com/${accountId}/workers/overview`
|
|
150823
150905
|
)
|
|
150824
150906
|
)} to unassign a worker from a route.`;
|
|
@@ -152702,9 +152784,9 @@ async function startDev(args) {
|
|
|
152702
152784
|
await printWranglerBanner();
|
|
152703
152785
|
if (args.local && process.platform !== "win32") {
|
|
152704
152786
|
logger.info(
|
|
152705
|
-
|
|
152787
|
+
import_chalk14.default.magenta(
|
|
152706
152788
|
`Want to try out the next version of local mode using the open-source Workers runtime?
|
|
152707
|
-
Switch out --local for ${
|
|
152789
|
+
Switch out --local for ${import_chalk14.default.bold(
|
|
152708
152790
|
"--experimental-local"
|
|
152709
152791
|
)} and let us know what you think at https://discord.gg/cloudflaredev !`
|
|
152710
152792
|
)
|