wrangler 4.0.0 → 4.1.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 +7 -7
- package/wrangler-dist/cli.d.ts +6 -2
- package/wrangler-dist/cli.js +91 -22
- package/wrangler-dist/cli.js.map +7 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "wrangler",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.1.0",
|
4
4
|
"description": "Command-line interface for all things Cloudflare Workers",
|
5
5
|
"keywords": [
|
6
6
|
"wrangler",
|
@@ -55,14 +55,14 @@
|
|
55
55
|
"esbuild": "0.24.2",
|
56
56
|
"path-to-regexp": "6.3.0",
|
57
57
|
"unenv": "2.0.0-rc.14",
|
58
|
-
"workerd": "1.
|
59
|
-
"
|
60
|
-
"
|
58
|
+
"workerd": "1.20250317.0",
|
59
|
+
"@cloudflare/kv-asset-handler": "0.4.0",
|
60
|
+
"miniflare": "4.20250317.0"
|
61
61
|
},
|
62
62
|
"devDependencies": {
|
63
63
|
"@aws-sdk/client-s3": "^3.721.0",
|
64
64
|
"@cloudflare/types": "6.18.4",
|
65
|
-
"@cloudflare/workers-types": "^4.
|
65
|
+
"@cloudflare/workers-types": "^4.20250317.0",
|
66
66
|
"@cspotcode/source-map-support": "0.8.1",
|
67
67
|
"@iarna/toml": "^3.0.0",
|
68
68
|
"@microsoft/api-extractor": "^7.47.0",
|
@@ -137,12 +137,12 @@
|
|
137
137
|
"yargs": "^17.7.2",
|
138
138
|
"@cloudflare/cli": "1.1.1",
|
139
139
|
"@cloudflare/eslint-config-worker": "1.1.0",
|
140
|
+
"@cloudflare/pages-shared": "^0.13.15",
|
140
141
|
"@cloudflare/workers-shared": "0.16.0",
|
141
|
-
"@cloudflare/pages-shared": "^0.13.14",
|
142
142
|
"@cloudflare/workers-tsconfig": "0.0.0"
|
143
143
|
},
|
144
144
|
"peerDependencies": {
|
145
|
-
"@cloudflare/workers-types": "^4.
|
145
|
+
"@cloudflare/workers-types": "^4.20250317.0"
|
146
146
|
},
|
147
147
|
"peerDependenciesMeta": {
|
148
148
|
"@cloudflare/workers-types": {
|
package/wrangler-dist/cli.d.ts
CHANGED
@@ -26512,9 +26512,13 @@ export declare interface Unstable_DevWorker {
|
|
26512
26512
|
|
26513
26513
|
export declare const unstable_generateASSETSBinding: (opts: Unstable_ASSETSBindingsOptions) => (request: Request_3) => Promise<Response_3>;
|
26514
26514
|
|
26515
|
-
export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string
|
26515
|
+
export declare function unstable_getMiniflareWorkerOptions(configPath: string, env?: string, options?: {
|
26516
|
+
imagesLocalMode: boolean;
|
26517
|
+
}): Unstable_MiniflareWorkerOptions;
|
26516
26518
|
|
26517
|
-
export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string
|
26519
|
+
export declare function unstable_getMiniflareWorkerOptions(config: Unstable_Config, env?: string, options?: {
|
26520
|
+
imagesLocalMode: boolean;
|
26521
|
+
}): Unstable_MiniflareWorkerOptions;
|
26518
26522
|
|
26519
26523
|
export declare interface Unstable_MiniflareWorkerOptions {
|
26520
26524
|
workerOptions: SourcelessWorkerOptions;
|
package/wrangler-dist/cli.js
CHANGED
@@ -81177,7 +81177,7 @@ var import_undici3 = __toESM(require_undici());
|
|
81177
81177
|
|
81178
81178
|
// package.json
|
81179
81179
|
var name = "wrangler";
|
81180
|
-
var version = "4.
|
81180
|
+
var version = "4.1.0";
|
81181
81181
|
|
81182
81182
|
// src/environment-variables/misc-variables.ts
|
81183
81183
|
init_import_meta_url();
|
@@ -87415,6 +87415,7 @@ var supportedPagesConfigFields = [
|
|
87415
87415
|
"compatibility_date",
|
87416
87416
|
"compatibility_flags",
|
87417
87417
|
"send_metrics",
|
87418
|
+
"no_bundle",
|
87418
87419
|
"limits",
|
87419
87420
|
"placement",
|
87420
87421
|
"vars",
|
@@ -117152,7 +117153,8 @@ async function handler4(args) {
|
|
117152
117153
|
const database = await createConfig(config, {
|
117153
117154
|
name: args.name,
|
117154
117155
|
origin,
|
117155
|
-
caching: getCacheOptionsFromArgs(args)
|
117156
|
+
caching: getCacheOptionsFromArgs(args),
|
117157
|
+
mtls: getMtlsFromArgs(args)
|
117156
117158
|
});
|
117157
117159
|
logger.log(`\u2705 Created new Hyperdrive config: ${database.id}`);
|
117158
117160
|
logger.log(
|
@@ -117223,7 +117225,8 @@ async function handler7(args) {
|
|
117223
117225
|
host: database.origin.host ?? "",
|
117224
117226
|
port: database.origin.port?.toString() ?? "",
|
117225
117227
|
database: database.origin.database ?? "",
|
117226
|
-
caching: JSON.stringify(database.caching)
|
117228
|
+
caching: JSON.stringify(database.caching),
|
117229
|
+
mtls: JSON.stringify(database.mtls)
|
117227
117230
|
}))
|
117228
117231
|
);
|
117229
117232
|
}
|
@@ -117249,7 +117252,8 @@ async function handler8(args) {
|
|
117249
117252
|
const updated = await patchConfig(config, args.id, {
|
117250
117253
|
name: args.name,
|
117251
117254
|
origin,
|
117252
|
-
caching: getCacheOptionsFromArgs(args)
|
117255
|
+
caching: getCacheOptionsFromArgs(args),
|
117256
|
+
mtls: getMtlsFromArgs(args)
|
117253
117257
|
});
|
117254
117258
|
logger.log(
|
117255
117259
|
`\u2705 Updated ${updated.id} Hyperdrive config
|
@@ -117346,6 +117350,14 @@ function upsertOptions(yargs) {
|
|
117346
117350
|
swr: {
|
117347
117351
|
type: "number",
|
117348
117352
|
describe: "Indicates the number of seconds cache may serve the response after it becomes stale, cannot be set when caching is disabled"
|
117353
|
+
},
|
117354
|
+
"ca-certificate-uuid": {
|
117355
|
+
type: "string",
|
117356
|
+
describe: "Sets custom CA certificate when connecting to origin database. Must be valid UUID of already uploaded CA certificate."
|
117357
|
+
},
|
117358
|
+
"mtls-certificate-uuid": {
|
117359
|
+
type: "string",
|
117360
|
+
describe: "Sets custom mTLS client certificates when connecting to origin database. Must be valid UUID of already uploaded public/private key certificates."
|
117349
117361
|
}
|
117350
117362
|
}).group(
|
117351
117363
|
["connection-string"],
|
@@ -117494,6 +117506,18 @@ function getCacheOptionsFromArgs(args) {
|
|
117494
117506
|
}
|
117495
117507
|
}
|
117496
117508
|
__name(getCacheOptionsFromArgs, "getCacheOptionsFromArgs");
|
117509
|
+
function getMtlsFromArgs(args) {
|
117510
|
+
const mtls = {
|
117511
|
+
ca_certificate_uuid: args.caCertificateUuid,
|
117512
|
+
mtls_certificate_uuid: args.mtlsCertificateUuid
|
117513
|
+
};
|
117514
|
+
if (JSON.stringify(mtls) === "{}") {
|
117515
|
+
return void 0;
|
117516
|
+
} else {
|
117517
|
+
return mtls;
|
117518
|
+
}
|
117519
|
+
}
|
117520
|
+
__name(getMtlsFromArgs, "getMtlsFromArgs");
|
117497
117521
|
|
117498
117522
|
// src/init.ts
|
117499
117523
|
init_import_meta_url();
|
@@ -121546,7 +121570,8 @@ function Options12(yargs) {
|
|
121546
121570
|
},
|
121547
121571
|
"no-bundle": {
|
121548
121572
|
type: "boolean",
|
121549
|
-
default:
|
121573
|
+
default: void 0,
|
121574
|
+
conflicts: "bundle",
|
121550
121575
|
description: "Whether to run bundling on `_worker.js` before deploying"
|
121551
121576
|
},
|
121552
121577
|
config: {
|
@@ -121749,6 +121774,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
121749
121774
|
commitDirty = isGitDirty;
|
121750
121775
|
}
|
121751
121776
|
}
|
121777
|
+
const enableBundling = args.bundle ?? !(args.noBundle ?? config?.no_bundle);
|
121752
121778
|
const { deploymentResponse, formData } = await deploy2({
|
121753
121779
|
directory,
|
121754
121780
|
accountId,
|
@@ -121758,9 +121784,7 @@ To silence this warning, pass in --commit-dirty=true`
|
|
121758
121784
|
commitHash,
|
121759
121785
|
commitDirty,
|
121760
121786
|
skipCaching: args.skipCaching,
|
121761
|
-
|
121762
|
-
// There is no sane way to get the true value out of yargs, so here we are.
|
121763
|
-
bundle: args.bundle ?? !args.noBundle,
|
121787
|
+
bundle: enableBundling,
|
121764
121788
|
// Sourcemaps from deploy arguments will take precedence so people can try it for one-off deployments without updating their wrangler.toml
|
121765
121789
|
sourceMaps: config?.upload_source_maps || args.uploadSourceMaps,
|
121766
121790
|
args
|
@@ -122562,7 +122586,8 @@ function Options14(yargs) {
|
|
122562
122586
|
},
|
122563
122587
|
"no-bundle": {
|
122564
122588
|
type: "boolean",
|
122565
|
-
default:
|
122589
|
+
default: void 0,
|
122590
|
+
conflicts: "bundle",
|
122566
122591
|
description: "Whether to run bundling on `_worker.js`"
|
122567
122592
|
},
|
122568
122593
|
binding: {
|
@@ -122747,7 +122772,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
122747
122772
|
const workerScriptPath = directory !== void 0 ? (0, import_node_path51.join)(directory, singleWorkerScriptPath) : (0, import_node_path51.resolve)(singleWorkerScriptPath);
|
122748
122773
|
const usingWorkerDirectory = (0, import_node_fs24.existsSync)(workerScriptPath) && (0, import_node_fs24.lstatSync)(workerScriptPath).isDirectory();
|
122749
122774
|
const usingWorkerScript = (0, import_node_fs24.existsSync)(workerScriptPath);
|
122750
|
-
const enableBundling = args.bundle ?? !args.noBundle;
|
122775
|
+
const enableBundling = args.bundle ?? !(args.noBundle ?? config.no_bundle);
|
122751
122776
|
const functionsDirectory = "./functions";
|
122752
122777
|
let usingFunctions = !usingWorkerScript && (0, import_node_fs24.existsSync)(functionsDirectory);
|
122753
122778
|
let scriptPath3 = "";
|
@@ -122755,7 +122780,7 @@ The Worker script should be named \`_worker.js\` and located in the build output
|
|
122755
122780
|
args.compatibilityDate ?? config.compatibility_date,
|
122756
122781
|
args.compatibilityFlags ?? config.compatibility_flags ?? [],
|
122757
122782
|
{
|
122758
|
-
noBundle:
|
122783
|
+
noBundle: !enableBundling
|
122759
122784
|
}
|
122760
122785
|
);
|
122761
122786
|
const defineNavigatorUserAgent = isNavigatorDefined(
|
@@ -142060,6 +142085,22 @@ function getVarsForDev(config, env6, silent = false) {
|
|
142060
142085
|
}
|
142061
142086
|
__name(getVarsForDev, "getVarsForDev");
|
142062
142087
|
|
142088
|
+
// src/process-env.ts
|
142089
|
+
init_import_meta_url();
|
142090
|
+
function isProcessEnvPopulated(compatibility_date, compatibility_flags = []) {
|
142091
|
+
if (compatibility_flags.includes("nodejs_compat_populate_process_env") && compatibility_flags.includes("nodejs_compat_do_not_populate_process_env")) {
|
142092
|
+
throw new UserError("Can't both enable and disable a flag");
|
142093
|
+
}
|
142094
|
+
if (compatibility_flags.includes("nodejs_compat_populate_process_env") && compatibility_flags.includes("nodejs_compat")) {
|
142095
|
+
return true;
|
142096
|
+
}
|
142097
|
+
if (compatibility_flags.includes("nodejs_compat_do_not_populate_process_env")) {
|
142098
|
+
return false;
|
142099
|
+
}
|
142100
|
+
return compatibility_flags.includes("nodejs_compat") && !!compatibility_date && compatibility_date >= "2025-04-01";
|
142101
|
+
}
|
142102
|
+
__name(isProcessEnvPopulated, "isProcessEnvPopulated");
|
142103
|
+
|
142063
142104
|
// src/type-generation/runtime/index.ts
|
142064
142105
|
init_import_meta_url();
|
142065
142106
|
var import_fs22 = require("fs");
|
@@ -142379,6 +142420,7 @@ function generateImportSpecifier(from, to) {
|
|
142379
142420
|
}
|
142380
142421
|
__name(generateImportSpecifier, "generateImportSpecifier");
|
142381
142422
|
async function generateEnvTypes(config, args, envInterface, outputPath, entrypoint, log2 = true) {
|
142423
|
+
const stringKeys = [];
|
142382
142424
|
const secrets = getVarsForDev(
|
142383
142425
|
// We do not want `getVarsForDev()` to merge in the standard vars into the dev vars
|
142384
142426
|
// because we want to be able to work with secrets differently to vars.
|
@@ -142443,10 +142485,12 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
142443
142485
|
constructTypeKey(varName),
|
142444
142486
|
varValues.length === 1 ? varValues[0] : varValues.join(" | ")
|
142445
142487
|
]);
|
142488
|
+
stringKeys.push(varName);
|
142446
142489
|
}
|
142447
142490
|
}
|
142448
142491
|
for (const secretName in configToDTS.secrets) {
|
142449
142492
|
envTypeStructure.push([constructTypeKey(secretName), "string"]);
|
142493
|
+
stringKeys.push(secretName);
|
142450
142494
|
}
|
142451
142495
|
if (configToDTS.durable_objects?.bindings) {
|
142452
142496
|
const importPath = entrypoint?.file ? generateImportSpecifier(fullOutputPath, entrypoint.file) : void 0;
|
@@ -142612,7 +142656,10 @@ async function generateEnvTypes(config, args, envInterface, outputPath, entrypoi
|
|
142612
142656
|
entrypointFormat,
|
142613
142657
|
envInterface,
|
142614
142658
|
envTypeStructure.map(([key, value]) => `${key}: ${value};`),
|
142615
|
-
modulesTypeStructure
|
142659
|
+
modulesTypeStructure,
|
142660
|
+
stringKeys,
|
142661
|
+
config.compatibility_date,
|
142662
|
+
config.compatibility_flags
|
142616
142663
|
);
|
142617
142664
|
const hash = (0, import_node_crypto13.createHash)("sha256").update(consoleOutput).digest("hex").slice(0, 32);
|
142618
142665
|
const envHeader = `// Generated by Wrangler by running \`${wranglerCommandUsed}\` (hash: ${hash})`;
|
@@ -142650,16 +142697,29 @@ var checkPath = /* @__PURE__ */ __name((path69) => {
|
|
142650
142697
|
}
|
142651
142698
|
}
|
142652
142699
|
}, "checkPath");
|
142653
|
-
function generateTypeStrings(formatType, envInterface, envTypeStructure, modulesTypeStructure) {
|
142700
|
+
function generateTypeStrings(formatType, envInterface, envTypeStructure, modulesTypeStructure, stringKeys, compatibilityDate, compatibilityFlags) {
|
142654
142701
|
let baseContent = "";
|
142655
142702
|
let eslintDisable = "";
|
142703
|
+
let processEnv = "";
|
142656
142704
|
if (formatType === "modules") {
|
142657
142705
|
if (envTypeStructure.length === 0) {
|
142658
|
-
eslintDisable = "// eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type\n";
|
142706
|
+
eslintDisable = " // eslint-disable-next-line @typescript-eslint/no-empty-interface,@typescript-eslint/no-empty-object-type\n";
|
142659
142707
|
}
|
142660
|
-
|
142661
|
-
|
142708
|
+
if (isProcessEnvPopulated(compatibilityDate, compatibilityFlags) && stringKeys.length > 0) {
|
142709
|
+
processEnv = `
|
142710
|
+
type StringifyValues<EnvType extends Record<string, unknown>> = {
|
142711
|
+
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
|
142712
|
+
};
|
142713
|
+
declare namespace NodeJS {
|
142714
|
+
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, ${stringKeys.map((k6) => `"${k6}"`).join(" | ")}>> {}
|
142662
142715
|
}`;
|
142716
|
+
}
|
142717
|
+
baseContent = `declare namespace Cloudflare {
|
142718
|
+
${eslintDisable} interface Env {${envTypeStructure.map((value) => `
|
142719
|
+
${value}`).join("")}
|
142720
|
+
}
|
142721
|
+
}
|
142722
|
+
interface ${envInterface} extends Cloudflare.Env {}${processEnv}`;
|
142663
142723
|
} else {
|
142664
142724
|
baseContent = `export {};
|
142665
142725
|
declare global {
|
@@ -142668,7 +142728,7 @@ ${envTypeStructure.map((value) => ` const ${value}`).join("\n")}
|
|
142668
142728
|
}
|
142669
142729
|
const modulesContent = modulesTypeStructure.join("\n");
|
142670
142730
|
return {
|
142671
|
-
fileContent: `${
|
142731
|
+
fileContent: `${baseContent}
|
142672
142732
|
${modulesContent}`,
|
142673
142733
|
consoleOutput: `${baseContent}
|
142674
142734
|
${modulesContent}`
|
@@ -148786,7 +148846,13 @@ async function getEntryValue(entry) {
|
|
148786
148846
|
__name(getEntryValue, "getEntryValue");
|
148787
148847
|
function getModuleType(entry) {
|
148788
148848
|
if (entry instanceof Blob) {
|
148789
|
-
|
148849
|
+
const type = ModuleTypeToRuleType[mimeTypeModuleType[entry.type]];
|
148850
|
+
if (!type) {
|
148851
|
+
throw new Error(
|
148852
|
+
`Unable to determine module type for ${entry.type} mime type`
|
148853
|
+
);
|
148854
|
+
}
|
148855
|
+
return type;
|
148790
148856
|
} else {
|
148791
148857
|
return "Text";
|
148792
148858
|
}
|
@@ -150050,8 +150116,10 @@ ${resolvedAssetsPath}`,
|
|
150050
150116
|
"Cannot set run_worker_first=true without a Worker script.\nPlease remove run_worker_first from your configuration file, or provide a Worker script in your configuration file (`main`)."
|
150051
150117
|
);
|
150052
150118
|
}
|
150053
|
-
const redirects = maybeGetFile(
|
150054
|
-
|
150119
|
+
const redirects = maybeGetFile(
|
150120
|
+
path62.join(resolvedAssetsPath, REDIRECTS_FILENAME)
|
150121
|
+
);
|
150122
|
+
const headers = maybeGetFile(path62.join(resolvedAssetsPath, HEADERS_FILENAME));
|
150055
150123
|
const assetConfig = {
|
150056
150124
|
html_handling: config.assets?.html_handling,
|
150057
150125
|
not_found_handling: config.assets?.not_found_handling
|
@@ -153434,7 +153502,7 @@ function deepFreeze(obj) {
|
|
153434
153502
|
});
|
153435
153503
|
}
|
153436
153504
|
__name(deepFreeze, "deepFreeze");
|
153437
|
-
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
|
153505
|
+
function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6, options32) {
|
153438
153506
|
const config = typeof configOrConfigPath === "string" ? readConfig({ config: configOrConfigPath, env: env6 }) : configOrConfigPath;
|
153439
153507
|
const modulesRules = config.rules.concat(DEFAULT_MODULE_RULES).map((rule) => ({
|
153440
153508
|
type: rule.type,
|
@@ -153450,7 +153518,7 @@ function unstable_getMiniflareWorkerOptions(configOrConfigPath, env6) {
|
|
153450
153518
|
services: [],
|
153451
153519
|
serviceBindings: {},
|
153452
153520
|
migrations: config.migrations,
|
153453
|
-
imagesLocalMode:
|
153521
|
+
imagesLocalMode: !!options32?.imagesLocalMode
|
153454
153522
|
});
|
153455
153523
|
if (bindings.services !== void 0) {
|
153456
153524
|
bindingOptions.serviceBindings = Object.fromEntries(
|
@@ -153685,3 +153753,4 @@ yargs-parser/build/lib/index.js:
|
|
153685
153753
|
* SPDX-License-Identifier: ISC
|
153686
153754
|
*)
|
153687
153755
|
*/
|
153756
|
+
//# sourceMappingURL=cli.js.map
|