wrangler 3.74.0 → 3.75.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/README.md +4 -0
- package/config-schema.json +24 -3
- package/package.json +3 -3
- package/wrangler-dist/cli.d.ts +3 -0
- package/wrangler-dist/cli.js +60 -51
package/README.md
CHANGED
@@ -8,6 +8,10 @@
|
|
8
8
|
|
9
9
|
`wrangler` is a command line tool for building [Cloudflare Workers](https://workers.cloudflare.com/).
|
10
10
|
|
11
|
+
> [!WARNING]
|
12
|
+
>
|
13
|
+
> Wrangler v2 is **only receiving critical security updates.** We recommend you [migrate to Wrangler v3](https://developers.cloudflare.com/workers/wrangler/migration/update-v2-to-v3/) if you can.
|
14
|
+
|
11
15
|
## Quick Start
|
12
16
|
|
13
17
|
```bash
|
package/config-schema.json
CHANGED
@@ -489,6 +489,13 @@
|
|
489
489
|
},
|
490
490
|
"type": "array"
|
491
491
|
},
|
492
|
+
"new_sqlite_classes": {
|
493
|
+
"description": "The new SQLite Durable Objects being defined.",
|
494
|
+
"items": {
|
495
|
+
"type": "string"
|
496
|
+
},
|
497
|
+
"type": "array"
|
498
|
+
},
|
492
499
|
"renamed_classes": {
|
493
500
|
"description": "The Durable Objects being renamed.",
|
494
501
|
"items": {
|
@@ -939,7 +946,7 @@
|
|
939
946
|
},
|
940
947
|
"workers_dev": {
|
941
948
|
"default": "`true` (This is a breaking change from Wrangler v1)",
|
942
|
-
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
949
|
+
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined // warning: you must force \"workers_dev: true\" in tests to match expected behavior",
|
943
950
|
"type": "boolean"
|
944
951
|
},
|
945
952
|
"zone_id": {
|
@@ -1520,6 +1527,13 @@
|
|
1520
1527
|
},
|
1521
1528
|
"type": "array"
|
1522
1529
|
},
|
1530
|
+
"new_sqlite_classes": {
|
1531
|
+
"description": "The new SQLite Durable Objects being defined.",
|
1532
|
+
"items": {
|
1533
|
+
"type": "string"
|
1534
|
+
},
|
1535
|
+
"type": "array"
|
1536
|
+
},
|
1523
1537
|
"renamed_classes": {
|
1524
1538
|
"description": "The Durable Objects being renamed.",
|
1525
1539
|
"items": {
|
@@ -2046,7 +2060,7 @@
|
|
2046
2060
|
},
|
2047
2061
|
"workers_dev": {
|
2048
2062
|
"default": "`true` (This is a breaking change from Wrangler v1)",
|
2049
|
-
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
2063
|
+
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined // warning: you must force \"workers_dev: true\" in tests to match expected behavior",
|
2050
2064
|
"type": "boolean"
|
2051
2065
|
},
|
2052
2066
|
"zone_id": {
|
@@ -2485,6 +2499,13 @@
|
|
2485
2499
|
},
|
2486
2500
|
"type": "array"
|
2487
2501
|
},
|
2502
|
+
"new_sqlite_classes": {
|
2503
|
+
"description": "The new SQLite Durable Objects being defined.",
|
2504
|
+
"items": {
|
2505
|
+
"type": "string"
|
2506
|
+
},
|
2507
|
+
"type": "array"
|
2508
|
+
},
|
2488
2509
|
"renamed_classes": {
|
2489
2510
|
"description": "The Durable Objects being renamed.",
|
2490
2511
|
"items": {
|
@@ -2935,7 +2956,7 @@
|
|
2935
2956
|
},
|
2936
2957
|
"workers_dev": {
|
2937
2958
|
"default": "`true` (This is a breaking change from Wrangler v1)",
|
2938
|
-
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined",
|
2959
|
+
"description": "Whether we use <name>.<subdomain>.workers.dev to test and deploy your Worker.\n\n// Carmen according to our tests the default is undefined // warning: you must force \"workers_dev: true\" in tests to match expected behavior",
|
2939
2960
|
"type": "boolean"
|
2940
2961
|
},
|
2941
2962
|
"zone_id": {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrangler",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.75.0",
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
5
5
|
"keywords": [
|
6
6
|
"wrangler",
|
@@ -65,8 +65,8 @@
|
|
65
65
|
"unenv": "npm:unenv-nightly@2.0.0-1724863496.70db6f1",
|
66
66
|
"workerd": "1.20240821.1",
|
67
67
|
"xxhash-wasm": "^1.0.1",
|
68
|
-
"@cloudflare/workers-shared": "0.4.1",
|
69
68
|
"@cloudflare/kv-asset-handler": "0.3.4",
|
69
|
+
"@cloudflare/workers-shared": "0.4.1",
|
70
70
|
"miniflare": "3.20240821.1"
|
71
71
|
},
|
72
72
|
"devDependencies": {
|
@@ -152,8 +152,8 @@
|
|
152
152
|
"xdg-app-paths": "^8.3.0",
|
153
153
|
"yargs": "^17.7.2",
|
154
154
|
"yoga-layout": "file:../../vendor/yoga-layout-2.0.0-beta.1.tgz",
|
155
|
-
"@cloudflare/eslint-config-worker": "1.1.0",
|
156
155
|
"@cloudflare/cli": "1.1.1",
|
156
|
+
"@cloudflare/eslint-config-worker": "1.1.0",
|
157
157
|
"@cloudflare/pages-shared": "^0.11.54",
|
158
158
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
159
159
|
},
|
package/wrangler-dist/cli.d.ts
CHANGED
@@ -1499,6 +1499,7 @@ declare interface EnvironmentInheritable {
|
|
1499
1499
|
* test and deploy your Worker.
|
1500
1500
|
*
|
1501
1501
|
* // Carmen according to our tests the default is undefined
|
1502
|
+
* // warning: you must force "workers_dev: true" in tests to match expected behavior
|
1502
1503
|
* @default `true` (This is a breaking change from Wrangler v1)
|
1503
1504
|
* @breaking
|
1504
1505
|
* @inheritable
|
@@ -1558,6 +1559,8 @@ declare interface EnvironmentInheritable {
|
|
1558
1559
|
tag: string;
|
1559
1560
|
/** The new Durable Objects being defined. */
|
1560
1561
|
new_classes?: string[];
|
1562
|
+
/** The new SQLite Durable Objects being defined. */
|
1563
|
+
new_sqlite_classes?: string[];
|
1561
1564
|
/** The Durable Objects being renamed. */
|
1562
1565
|
renamed_classes?: {
|
1563
1566
|
from: string;
|
package/wrangler-dist/cli.js
CHANGED
@@ -152394,7 +152394,7 @@ __name(getEnvironmentVariableFactory, "getEnvironmentVariableFactory");
|
|
152394
152394
|
init_import_meta_url();
|
152395
152395
|
var getC3CommandFromEnv = getEnvironmentVariableFactory({
|
152396
152396
|
variableName: "WRANGLER_C3_COMMAND",
|
152397
|
-
defaultValue: () => "create cloudflare
|
152397
|
+
defaultValue: () => "create cloudflare@^2.5.0"
|
152398
152398
|
});
|
152399
152399
|
var getWranglerSendMetricsFromEnv = getEnvironmentVariableFactory({
|
152400
152400
|
variableName: "WRANGLER_SEND_METRICS"
|
@@ -152693,7 +152693,7 @@ init_import_meta_url();
|
|
152693
152693
|
init_import_meta_url();
|
152694
152694
|
|
152695
152695
|
// package.json
|
152696
|
-
var version = "3.
|
152696
|
+
var version = "3.75.0";
|
152697
152697
|
var package_default = {
|
152698
152698
|
name: "wrangler",
|
152699
152699
|
version,
|
@@ -157058,7 +157058,14 @@ var validateMigrations = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
157058
157058
|
}
|
157059
157059
|
let valid = true;
|
157060
157060
|
for (let i = 0; i < rawMigrations.length; i++) {
|
157061
|
-
const {
|
157061
|
+
const {
|
157062
|
+
tag,
|
157063
|
+
new_classes,
|
157064
|
+
new_sqlite_classes,
|
157065
|
+
renamed_classes,
|
157066
|
+
deleted_classes,
|
157067
|
+
...rest
|
157068
|
+
} = rawMigrations[i];
|
157062
157069
|
valid = validateAdditionalProperties(
|
157063
157070
|
diagnostics,
|
157064
157071
|
"migrations",
|
@@ -157078,6 +157085,12 @@ var validateMigrations = /* @__PURE__ */ __name((diagnostics, field, value) => {
|
|
157078
157085
|
new_classes,
|
157079
157086
|
"string"
|
157080
157087
|
) && valid;
|
157088
|
+
valid = validateOptionalTypedArray(
|
157089
|
+
diagnostics,
|
157090
|
+
`migrations[${i}].new_sqlite_classes`,
|
157091
|
+
new_sqlite_classes,
|
157092
|
+
"string"
|
157093
|
+
) && valid;
|
157081
157094
|
if (renamed_classes !== void 0) {
|
157082
157095
|
if (!Array.isArray(renamed_classes)) {
|
157083
157096
|
diagnostics.errors.push(
|
@@ -165037,7 +165050,10 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
165037
165050
|
1
|
165038
165051
|
);
|
165039
165052
|
}
|
165040
|
-
assetLogCount = logAssetUpload(
|
165053
|
+
assetLogCount = logAssetUpload(
|
165054
|
+
`+ ${decodeFilepath(manifestEntry[0])}`,
|
165055
|
+
assetLogCount
|
165056
|
+
);
|
165041
165057
|
return manifestEntry;
|
165042
165058
|
});
|
165043
165059
|
});
|
@@ -165051,7 +165067,8 @@ var syncExperimentalAssets = /* @__PURE__ */ __name(async (accountId, scriptName
|
|
165051
165067
|
const doUpload = /* @__PURE__ */ __name(async () => {
|
165052
165068
|
const payload = await Promise.all(
|
165053
165069
|
bucket.map(async (manifestEntry) => {
|
165054
|
-
const
|
165070
|
+
const decodedFilePath = decodeFilepath(manifestEntry[0]);
|
165071
|
+
const absFilePath = path28.join(assetDirectory, decodedFilePath);
|
165055
165072
|
return {
|
165056
165073
|
base64: true,
|
165057
165074
|
key: manifestEntry[1].hash,
|
@@ -165239,6 +165256,9 @@ var encodeFilePath = /* @__PURE__ */ __name((filePath) => {
|
|
165239
165256
|
const encodedPath = filePath.split(path28.sep).map((segment) => encodeURIComponent(segment)).join("/");
|
165240
165257
|
return "/" + encodedPath;
|
165241
165258
|
}, "encodeFilePath");
|
165259
|
+
var decodeFilepath = /* @__PURE__ */ __name((filePath) => {
|
165260
|
+
return filePath.split("/").map((segment) => decodeURIComponent(segment)).join(path28.sep);
|
165261
|
+
}, "decodeFilepath");
|
165242
165262
|
|
165243
165263
|
// src/metrics/index.ts
|
165244
165264
|
init_import_meta_url();
|
@@ -169584,22 +169604,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
169584
169604
|
headers: await getMetricsUsageHeaders(config.send_metrics)
|
169585
169605
|
}
|
169586
169606
|
);
|
169587
|
-
|
169588
|
-
|
169589
|
-
|
169590
|
-
method: "POST",
|
169591
|
-
body: JSON.stringify({
|
169592
|
-
stratergy: "percentage",
|
169593
|
-
versions: [
|
169594
|
-
{
|
169595
|
-
percentage: 100,
|
169596
|
-
version_id: versionResult.id
|
169597
|
-
}
|
169598
|
-
]
|
169599
|
-
}),
|
169600
|
-
headers: await getMetricsUsageHeaders(config.send_metrics)
|
169601
|
-
}
|
169602
|
-
);
|
169607
|
+
const versionMap = /* @__PURE__ */ new Map();
|
169608
|
+
versionMap.set(versionResult.id, 100);
|
169609
|
+
await createDeployment(accountId, scriptName, versionMap, void 0);
|
169603
169610
|
await patchNonVersionedScriptSettings(accountId, scriptName, {
|
169604
169611
|
tail_consumers: worker.tail_consumers,
|
169605
169612
|
logpush: worker.logpush
|
@@ -195369,7 +195376,7 @@ var secret2 = /* @__PURE__ */ __name((secretYargs) => {
|
|
195369
195376
|
} catch (e3) {
|
195370
195377
|
if (e3 instanceof APIError && e3.code === VERSION_NOT_DEPLOYED_ERR_CODE) {
|
195371
195378
|
throw new UserError(
|
195372
|
-
"Secret edit failed. You attempted to modify a secret, but the latest version of your Worker isn't currently deployed. Please ensure that the latest version of your Worker is fully deployed (wrangler versions deploy
|
195379
|
+
"Secret edit failed. You attempted to modify a secret, but the latest version of your Worker isn't currently deployed. Please ensure that the latest version of your Worker is fully deployed (wrangler versions deploy) before modifying secrets. Alternatively, you can use the Cloudflare dashboard to modify secrets and deploy the version.\n\nNote: This limitation will be addressed in an upcoming release."
|
195373
195380
|
);
|
195374
195381
|
} else {
|
195375
195382
|
throw e3;
|
@@ -205316,7 +205323,11 @@ async function generateTypes(configToDTS, config, envInterface, outputPath) {
|
|
205316
205323
|
}
|
205317
205324
|
if (configToDTS.unsafe?.bindings) {
|
205318
205325
|
for (const unsafe of configToDTS.unsafe.bindings) {
|
205319
|
-
|
205326
|
+
if (unsafe.type === "ratelimit") {
|
205327
|
+
envTypeStructure.push(constructType(unsafe.name, "RateLimit"));
|
205328
|
+
} else {
|
205329
|
+
envTypeStructure.push(constructType(unsafe.name, "any"));
|
205330
|
+
}
|
205320
205331
|
}
|
205321
205332
|
}
|
205322
205333
|
if (configToDTS.queues) {
|
@@ -206677,7 +206688,7 @@ async function versionsSecretPutBulkHandler(args) {
|
|
206677
206688
|
}
|
206678
206689
|
logger.log(
|
206679
206690
|
`\u2728 Success! Created version ${newVersion.id} with ${secrets.length} secrets.
|
206680
|
-
\u27A1\uFE0F To deploy this version to production traffic use the command "wrangler versions deploy
|
206691
|
+
\u27A1\uFE0F To deploy this version to production traffic use the command "wrangler versions deploy".`
|
206681
206692
|
);
|
206682
206693
|
}
|
206683
206694
|
__name(versionsSecretPutBulkHandler, "versionsSecretPutBulkHandler");
|
@@ -206755,7 +206766,7 @@ async function versionsSecretDeleteHandler(args) {
|
|
206755
206766
|
});
|
206756
206767
|
logger.log(
|
206757
206768
|
`\u2728 Success! Created version ${newVersion.id} with deleted secret ${args.key}.
|
206758
|
-
\u27A1\uFE0F To deploy this version without the secret ${args.key} to production traffic use the command "wrangler versions deploy
|
206769
|
+
\u27A1\uFE0F To deploy this version without the secret ${args.key} to production traffic use the command "wrangler versions deploy".`
|
206759
206770
|
);
|
206760
206771
|
}
|
206761
206772
|
}
|
@@ -206891,7 +206902,7 @@ async function versionsSecretPutHandler(args) {
|
|
206891
206902
|
});
|
206892
206903
|
logger.log(
|
206893
206904
|
`\u2728 Success! Created version ${newVersion.id} with secret ${args.key}.
|
206894
|
-
\u27A1\uFE0F To deploy this version with secret ${args.key} to production traffic use the command "wrangler versions deploy
|
206905
|
+
\u27A1\uFE0F To deploy this version with secret ${args.key} to production traffic use the command "wrangler versions deploy".`
|
206895
206906
|
);
|
206896
206907
|
}
|
206897
206908
|
__name(versionsSecretPutHandler, "versionsSecretPutHandler");
|
@@ -207081,7 +207092,6 @@ __name(parseModules, "parseModules");
|
|
207081
207092
|
init_import_meta_url();
|
207082
207093
|
var import_node_fs36 = require("node:fs");
|
207083
207094
|
var import_node_path61 = __toESM(require("node:path"));
|
207084
|
-
var import_node_url16 = require("node:url");
|
207085
207095
|
var scriptStartupErrorRegex2 = /startup/i;
|
207086
207096
|
function errIsScriptSize2(err) {
|
207087
207097
|
if (!err) {
|
@@ -207192,7 +207202,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207192
207202
|
const destination = props.outDir ?? getWranglerTmpDir(props.projectRoot, "deploy");
|
207193
207203
|
const start = Date.now();
|
207194
207204
|
const workerName = scriptName;
|
207195
|
-
const workerUrl = `/accounts/${accountId}/workers/scripts/${scriptName}
|
207205
|
+
const workerUrl = `/accounts/${accountId}/workers/scripts/${scriptName}`;
|
207196
207206
|
const { format: format10 } = props.entry;
|
207197
207207
|
if (config.wasm_modules && format10 === "modules") {
|
207198
207208
|
throw new UserError(
|
@@ -207209,6 +207219,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207209
207219
|
"You cannot configure [data_blobs] with an ES module worker. Instead, import the file directly in your code, and optionally configure `[rules]` in your wrangler.toml"
|
207210
207220
|
);
|
207211
207221
|
}
|
207222
|
+
let hasPreview = false;
|
207212
207223
|
try {
|
207213
207224
|
if (props.noBundle) {
|
207214
207225
|
const destinationDir = typeof destination === "string" ? destination : destination.path;
|
@@ -207374,25 +207385,16 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207374
207385
|
let bindingsPrinted = false;
|
207375
207386
|
try {
|
207376
207387
|
const body = createWorkerUploadForm(worker);
|
207377
|
-
const result = await fetchResult(
|
207378
|
-
|
207379
|
-
|
207380
|
-
|
207381
|
-
|
207382
|
-
headers: await getMetricsUsageHeaders(config.send_metrics)
|
207383
|
-
},
|
207384
|
-
new import_node_url16.URLSearchParams({
|
207385
|
-
include_subdomain_availability: "true",
|
207386
|
-
// pass excludeScript so the whole body of the
|
207387
|
-
// script doesn't get included in the response
|
207388
|
-
excludeScript: "true"
|
207389
|
-
})
|
207390
|
-
);
|
207388
|
+
const result = await fetchResult(`${workerUrl}/versions`, {
|
207389
|
+
method: "POST",
|
207390
|
+
body,
|
207391
|
+
headers: await getMetricsUsageHeaders(config.send_metrics)
|
207392
|
+
});
|
207391
207393
|
logger.log("Worker Startup Time:", result.startup_time_ms, "ms");
|
207392
207394
|
bindingsPrinted = true;
|
207393
207395
|
printBindings({ ...withoutStaticAssets, vars: maskedVars });
|
207394
|
-
logger.log("Worker Version ID:", result.id);
|
207395
207396
|
versionId = result.id;
|
207397
|
+
hasPreview = result.metadata.has_preview;
|
207396
207398
|
} catch (err) {
|
207397
207399
|
if (!bindingsPrinted) {
|
207398
207400
|
printBindings({ ...withoutStaticAssets, vars: maskedVars });
|
@@ -207435,12 +207437,19 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
207435
207437
|
}
|
207436
207438
|
const uploadMs = Date.now() - start;
|
207437
207439
|
logger.log("Uploaded", workerName, formatTime3(uploadMs));
|
207438
|
-
|
207439
|
-
|
207440
|
-
|
207441
|
-
|
207442
|
-
|
207443
|
-
|
207440
|
+
logger.log("Worker Version ID:", versionId);
|
207441
|
+
if (versionId && hasPreview) {
|
207442
|
+
const { enabled: available_on_subdomain } = await fetchResult(`${workerUrl}/subdomain`);
|
207443
|
+
if (available_on_subdomain) {
|
207444
|
+
const userSubdomain = await getWorkersDevSubdomain(accountId);
|
207445
|
+
const shortVersion = versionId.slice(0, 8);
|
207446
|
+
logger.log(
|
207447
|
+
`Version Preview URL: https://${shortVersion}-${workerName}.${userSubdomain}.workers.dev`
|
207448
|
+
);
|
207449
|
+
}
|
207450
|
+
}
|
207451
|
+
const cmdVersionsDeploy = blue("wrangler versions deploy");
|
207452
|
+
const cmdTriggersDeploy = blue("wrangler triggers deploy");
|
207444
207453
|
logger.info(
|
207445
207454
|
gray(`
|
207446
207455
|
To deploy this version to production traffic use the command ${cmdVersionsDeploy}
|
@@ -208084,11 +208093,11 @@ async function versionsDeploymentsViewHandler(args) {
|
|
208084
208093
|
await printWranglerBanner();
|
208085
208094
|
if (args.deploymentId === void 0) {
|
208086
208095
|
throw new UserError(
|
208087
|
-
"`wrangler deployments view` has been renamed `wrangler deployments status
|
208096
|
+
"`wrangler deployments view` has been renamed `wrangler deployments status`. Please use that command instead."
|
208088
208097
|
);
|
208089
208098
|
} else {
|
208090
208099
|
throw new UserError(
|
208091
|
-
"`wrangler deployments view <deployment-id>` has been renamed `wrangler versions view [version-id]
|
208100
|
+
"`wrangler deployments view <deployment-id>` has been renamed `wrangler versions view [version-id]`. Please use that command instead."
|
208092
208101
|
);
|
208093
208102
|
}
|
208094
208103
|
}
|